@devries-cameron20 / composio-1 / commits / b07fcada3
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(experimental): add Eve provider and iMessage example (#3800)

This PR: - supersedes https://github.com/ComposioHQ/composio/pull/3642 and credits @shamsharoon for the original Eve provider and iMessage work - rebases the integration onto the current `next` branch and resolves its lockfile conflicts - publishes an isolated `@composio/experimental/eve` entry with the correct Eve 0.12+ peer contract - adds recoverable per-session discovery, native Eve context propagation, and durable approval policies for direct and batched side effects - centralizes circular-safe auth-link extraction across Eve and Pi and replaces dense conditional expressions with named control flow - hardens the iMessage example against `osascript` option injection, unsafe trigger scoping, and third-party prompt injection - preserves completed local-tool results when a mixed local/remote batch loses its remote transport - consolidates the example documentation onto shared components, documents direct model-provider credentials, and clarifies that the browsable source is not yet a standalone fixture - verifies the change with 999 core tests, 32 experimental tests, package builds/typechecks, packed peer-isolation smokes, and a production docs build --------- Co-authored-by: shams haroon <144290365+shamsharoon@users.noreply.github.com> Co-authored-by: shams haroon <shamsharoon7@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: shams haroon <shams@composio.dev>

Alberto Schiabel committed Jul 10, 2026 at 16:57 UTC b07fcada3feeb88a34535783e9b78c0830d466ba
29 files changed +2117 -66
.changeset/experimental-eve-provider.md new
+8
@@ -0,0 +1,8 @@
1 +---
2 +'@composio/experimental': minor
3 +'@composio/core': patch
4 +---
5 +
6 +Add an eve provider: `EveProvider` makes `session.tools()` return eve-native `defineTool`s, `defineComposioTools` is the replay-safe `step.started` resolver, and `(ctx, next)` hooks can rewrite, deny, or transform Tool Router meta-tool calls.
7 +
8 +Preserve successful local-tool results when the remote half of a mixed `COMPOSIO_MULTI_EXECUTE_TOOL` batch fails at the transport layer, so callers can see which side effects already completed before retrying.
docs/components/imessage-flow.tsx new
+222
@@ -0,0 +1,222 @@
1 +import { Cpu, Globe, MessageSquare, Terminal } from 'lucide-react';
2 +import type { ReactNode } from 'react';
3 +
4 +const LOGO_CDN = 'https://logos.composio.dev/api';
5 +
6 +const TOOLS: { slug: string; name: string; where: string; local?: boolean }[] = [
7 + { slug: 'imessage', name: 'iMessage', where: 'on your Mac', local: true },
8 + { slug: 'gmail', name: 'Gmail', where: 'catalog' },
9 + { slug: 'github', name: 'GitHub', where: 'catalog' },
10 +];
11 +
12 +/**
13 + * ImessageFlow — branded diagram for the iMessage example page.
14 + *
15 + * Reads left-to-right as one request: you type a prompt (or a trigger fires),
16 + * the eve agent picks a tool and runs it through a single session, and that
17 + * session carries both the local iMessage toolkit (running on your Mac) and the
18 + * rest of the Composio catalog (running remote). The reply ends in a text.
19 + *
20 + * Server component, no client JS. Adapts to light/dark via fd-* tokens.
21 + */
22 +export function ImessageFlow() {
23 + return (
24 + <div className="not-prose my-6 overflow-hidden rounded-sm border border-fd-border bg-fd-background">
25 + {/* header strip — mono, matches the other branded flow visuals */}
26 + <div className="flex items-center justify-between border-b border-fd-border px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.06em] text-fd-foreground/45">
27 + <span>imessage.runtime</span>
28 + <span className="inline-flex items-center gap-1.5 text-fd-foreground/55">
29 + <span className="relative inline-flex">
30 + <span className="size-1.5 rounded-full bg-[var(--composio-brand)]" />
31 + <span className="absolute inset-0 animate-ping rounded-full bg-[var(--composio-brand)] opacity-60" />
32 + </span>
33 + running on your Mac
34 + </span>
35 + </div>
36 +
37 + <div className="grid items-stretch gap-px bg-fd-border md:grid-cols-[minmax(0,0.9fr)_minmax(0,0.95fr)_minmax(0,1.3fr)]">
38 + {/* ── You ────────────────────────────────────────────────── */}
39 + <Column>
40 + <Lane label="You" />
41 + <div className="flex flex-1 items-center">
42 + <div className="w-full border border-fd-border bg-fd-card p-3">
43 + <div className="flex items-center gap-2">
44 + <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] text-fd-foreground/70">
45 + <Terminal aria-hidden="true" className="size-3.5" />
46 + </span>
47 + <div className="min-w-0">
48 + <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
49 + Prompt or trigger
50 + </div>
51 + <div className="truncate font-mono text-[10px] text-fd-foreground/45">
52 + text Shams a summary
53 + </div>
54 + </div>
55 + </div>
56 + <p className="mt-2.5 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.05em] text-[var(--composio-brand)]">
57 + you <Arrow /> eve
58 + </p>
59 + </div>
60 + </div>
61 + <Connector />
62 + </Column>
63 +
64 + {/* ── eve agent ──────────────────────────────────────────── */}
65 + <Column>
66 + <Lane label="eve agent" />
67 + <div className="flex flex-1 items-center">
68 + <div className="w-full border border-fd-border bg-fd-card p-3">
69 + <div className="flex items-center gap-2">
70 + <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] font-mono text-[13px] text-fd-foreground/70">
71 + {'{ }'}
72 + </span>
73 + <div className="min-w-0">
74 + <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">
75 + eve agent
76 + </div>
77 + <div className="truncate font-mono text-[10px] text-fd-foreground/45">
78 + searches + executes
79 + </div>
80 + </div>
81 + </div>
82 + <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/55">
83 + Picks the tool it needs and runs it through the session.
84 + </p>
85 + </div>
86 + </div>
87 + <Connector accent />
88 + </Column>
89 +
90 + {/* ── Session (the hub) ──────────────────────────────────── */}
91 + <Column>
92 + <Lane label="Session" accent />
93 + <div className="flex flex-1 flex-col">
94 + <div className="relative flex-1 border border-[var(--composio-brand)]/30 bg-[var(--composio-brand)]/[0.04] p-3">
95 + <span
96 + aria-hidden="true"
97 + className="pointer-events-none absolute inset-y-0 left-0 w-[2px] bg-[var(--composio-brand)]"
98 + />
99 + <div className="flex items-center justify-between">
100 + <span className="font-mono text-[10px] uppercase tracking-[0.06em] text-[var(--composio-brand)]">
101 + one session
102 + </span>
103 + <span className="font-mono text-[10px] text-fd-foreground/45">user_123</span>
104 + </div>
105 +
106 + {/* The local iMessage toolkit alongside the remote catalog */}
107 + <ul className="mt-2.5 overflow-hidden rounded-sm border border-fd-border bg-fd-card">
108 + {TOOLS.map((tool, i) => (
109 + <li
110 + key={tool.slug}
111 + className={
112 + 'flex items-center gap-2 px-2.5 py-1.5' +
113 + (i < TOOLS.length - 1 ? ' border-b border-fd-border' : '')
114 + }
115 + >
116 + {tool.local ? (
117 + <MessageSquare
118 + aria-hidden="true"
119 + className="size-3.5 text-[var(--composio-brand)]"
120 + />
121 + ) : (
122 + <img
123 + alt=""
124 + aria-hidden="true"
125 + className="size-3.5 object-contain"
126 + draggable={false}
127 + src={`${LOGO_CDN}/${tool.slug}`}
128 + />
129 + )}
130 + <span className="text-[11px] text-fd-foreground/75">{tool.name}</span>
131 + <span className="font-mono text-[9px] text-fd-foreground/40">{tool.where}</span>
132 + <span
133 + className={
134 + 'ml-auto inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.05em] ' +
135 + (tool.local ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/45')
136 + }
137 + >
138 + {tool.local ? (
139 + <>
140 + <Cpu aria-hidden="true" className="size-2.5" />
141 + local
142 + </>
143 + ) : (
144 + <>
145 + <Globe aria-hidden="true" className="size-2.5" />
146 + remote
147 + </>
148 + )}
149 + </span>
150 + </li>
151 + ))}
152 + </ul>
153 +
154 + <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/60">
155 + Local tools run in-process on your Mac; the rest of the catalog runs
156 + remote, all from one session.
157 + </p>
158 + </div>
159 + </div>
160 + </Column>
161 + </div>
162 +
163 + {/* footer caption */}
164 + <div className="border-t border-fd-border px-3 py-2 text-center font-mono text-[10px] text-fd-foreground/45">
165 + prompt <Arrow /> eve <Arrow /> session (local mac tools + remote catalog){' '}
166 + <Arrow /> text sent
167 + </div>
168 + </div>
169 + );
170 +}
171 +
172 +function Column({ children }: { children: ReactNode }) {
173 + return <div className="relative flex flex-col gap-2 bg-fd-background p-3">{children}</div>;
174 +}
175 +
176 +function Lane({ label, accent = false }: { label: string; accent?: boolean }) {
177 + return (
178 + <div className="flex items-center gap-1.5">
179 + <span
180 + className={'size-1.5 rounded-full ' + (accent ? 'bg-[var(--composio-brand)]' : 'bg-fd-foreground/30')}
181 + aria-hidden="true"
182 + />
183 + <span
184 + className={
185 + 'font-mono text-[10px] font-medium uppercase tracking-[0.07em] ' +
186 + (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/55')
187 + }
188 + >
189 + {label}
190 + </span>
191 + </div>
192 + );
193 +}
194 +
195 +/**
196 + * Desktop-only directional connector shown between columns. On mobile, the
197 + * stacked columns read top-to-bottom without a connector.
198 + */
199 +function Connector({ accent = false }: { accent?: boolean }) {
200 + const color = accent ? 'bg-[var(--composio-brand)]/40' : 'bg-fd-border';
201 + const tip = accent ? 'border-l-[var(--composio-brand)]/50' : 'border-l-fd-border';
202 + return (
203 + <div
204 + aria-hidden="true"
205 + className="pointer-events-none absolute z-10 hidden md:block"
206 + style={{ right: '-7px', top: '50%' }}
207 + >
208 + <div className="flex items-center">
209 + <span className={'h-px w-3 ' + color} />
210 + <span className={'size-0 border-y-[3px] border-l-[5px] border-y-transparent ' + tip} />
211 + </div>
212 + </div>
213 + );
214 +}
215 +
216 +function Arrow() {
217 + return (
218 + <span aria-hidden="true" className="text-[var(--composio-brand)]">
219 + {'→'}
220 + </span>
221 + );
222 +}
docs/components/repo-browser-client.tsx
+9 -3
@@ -16,7 +16,13 @@ export interface RepoFile {
16 * the selected file's code on the right (@pierre/diffs). Code is prerendered on
17 * the server so the first paint is correct; selection swaps which file shows.
18 */
19 -export function RepoBrowserClient({ files }: { files: RepoFile[] }) {
19 +export function RepoBrowserClient({
20 + files,
21 + heightClass = 'max-h-[640px]',
22 +}: {
23 + files: RepoFile[];
24 + heightClass?: string;
25 +}) {
26 const paths = files.map((f) => f.path);
27 const { model } = useFileTree({ paths, initialSelectedPaths: [paths[0]], initialExpansion: 'open' });
28 const selected = useFileTreeSelection(model);
@@ -26,10 +32,10 @@ export function RepoBrowserClient({ files }: { files: RepoFile[] }) {
32
33 return (
34 <div className="grid grid-cols-1 overflow-hidden rounded-sm border border-fd-border bg-fd-card md:grid-cols-[minmax(0,260px)_minmax(0,1fr)]">
29 - <div className="max-h-[640px] overflow-auto border-b border-fd-border p-2 md:border-b-0 md:border-r">
35 + <div className={`${heightClass} overflow-auto border-b border-fd-border p-2 md:border-b-0 md:border-r`}>
36 <FileTree model={model} />
37 </div>
32 - <div className="relative max-h-[640px] overflow-auto">
38 + <div className={`relative ${heightClass} overflow-auto`}>
39 <CopyButton text={file.contents} className="absolute right-2 top-2 z-10" />
40 <File
41 key={file.path}
docs/components/repo-browser.tsx
+5 -1
@@ -3,6 +3,7 @@ import { RepoBrowserClient, type RepoFile } from './repo-browser-client';
3 import slackBot from '@/lib/slack-bot-source.json';
4 import localWorkbench from '@/lib/local-workbench-source.json';
5 import standup from '@/lib/standup-bot-source.json';
6 +import imessage from '@/lib/imessage-source.json';
7
8 interface SourceFile {
9 path: string;
@@ -16,6 +17,7 @@ const SOURCES = {
17 'slack-bot': slackBot,
18 'local-workbench': localWorkbench,
19 standup,
20 + imessage,
21 } as const;
22
23 /**
@@ -30,9 +32,11 @@ const SOURCES = {
32 export async function RepoBrowser({
33 source = 'slack-bot',
34 caption = 'a slice of the real project, the Composio files do the work',
35 + heightClass,
36 }: {
37 source?: keyof typeof SOURCES;
38 caption?: string | null;
39 + heightClass?: string;
40 }) {
41 const data = SOURCES[source] as SourceFile[];
42
@@ -50,7 +54,7 @@ export async function RepoBrowser({
54 {caption}
55 </div>
56 ) : null}
53 - <RepoBrowserClient files={files} />
57 + <RepoBrowserClient files={files} heightClass={heightClass} />
58 </div>
59 );
60 }
docs/content/docs/providers/eve.mdx new
+175
@@ -0,0 +1,175 @@
1 +---
2 +title: Eve
3 +description: Use Composio tools inside eve agents.
4 +keywords: [eve, agent framework, provider, experimental, typescript]
5 +experimental: true
6 +---
7 +
8 +The eve provider adapts Composio tools for the [eve](https://github.com/vercel/eve) agent framework. With `EveProvider` registered, `session.tools()` returns eve-native `defineTool`s, so an eve agent gets the Tool Router meta-tools and any preloaded custom toolkits from one call. The provider also ships a `(ctx, next)` hook interface to intercept, allow, deny, or rewrite meta-tool calls before the model sees the result.
9 +
10 +<Callout type="warning">
11 + The eve provider is experimental and currently ships from `@composio/experimental` for TypeScript
12 + projects.
13 +</Callout>
14 +
15 +## Usage
16 +
17 +eve owns the agent loop and discovers tools from files, so you register the provider on the Composio client and expose the session's tools from a file under `agent/tools/`.
18 +
19 +<Steps>
20 +<Step>
21 +**Install**
22 +
23 +```bash
24 +npm install @composio/core @composio/experimental eve @ai-sdk/openai
25 +```
26 +
27 +This walkthrough uses OpenAI directly as one concrete model provider. OpenAI is only an example:
28 +you can use any model provider supported by eve by installing its AI SDK package and configuring
29 +the corresponding credential.
30 +
31 +</Step>
32 +
33 +<Step>
34 +**Configure credentials**
35 +
36 +```txt title=".env.local"
37 +COMPOSIO_API_KEY=xxxxxxxxx
38 +OPENAI_API_KEY=xxxxxxxxx
39 +```
40 +
41 +`COMPOSIO_API_KEY` authenticates Composio tools. `OPENAI_API_KEY` authenticates the model call
42 +directly with OpenAI; this setup does not route through Vercel AI Gateway.
43 +
44 +</Step>
45 +
46 +<Step>
47 +**Configure the eve model**
48 +
49 +```typescript title="agent/agent.ts"
50 +import { openai } from '@ai-sdk/openai';
51 +import { defineAgent } from 'eve';
52 +
53 +export default defineAgent({
54 + model: openai('gpt-5.4-mini'),
55 +});
56 +```
57 +
58 +To use another provider, replace `@ai-sdk/openai`, `OPENAI_API_KEY`, and `openai(...)` with the
59 +equivalent package, credential, and model factory supported by eve. Passing a provider model object
60 +calls that provider directly; an eve string model ID such as `openai/gpt-5.4-mini` uses Vercel AI
61 +Gateway instead.
62 +
63 +</Step>
64 +
65 +<Step>
66 +**Register the provider and create a session**
67 +
68 +```typescript title="agent/session.ts"
69 +// @noErrors
70 +import { Composio } from '@composio/core';
71 +import { EveProvider } from '@composio/experimental/eve';
72 +
73 +const composio = new Composio({ provider: new EveProvider() });
74 +
75 +export const session = composio.sessions.create('user_123', {
76 + toolkits: ['github', 'hackernews'], // optional: scope the session to specific apps
77 +});
78 +```
79 +
80 +</Step>
81 +
82 +<Step>
83 +**Expose the tools to eve**
84 +
85 +```typescript title="agent/tools/composio.ts"
86 +// @noErrors
87 +import { defineComposioTools } from '@composio/experimental/eve';
88 +import { session } from '../session';
89 +
90 +export default defineComposioTools(session);
91 +```
92 +
93 +`defineComposioTools(session)` returns a `step.started` dynamic resolver and memoizes `session.tools()`. It resolves per step because the wrapped `execute` holds a live function eve keeps only for step-scoped tools. The fetch is cached per resolved Composio session, and transient failures are retried on the next step. For a multi-user channel, pass a resolver instead: `defineComposioTools((ctx) => sessionFor(ctx.session.auth.current?.principalId))`.
94 +
95 +</Step>
96 +</Steps>
97 +
98 +Your agent now has the Tool Router meta-tools (`COMPOSIO_SEARCH_TOOLS`, `COMPOSIO_MULTI_EXECUTE_TOOL`, `COMPOSIO_MANAGE_CONNECTIONS`) plus any preloaded custom toolkits, with auth handled in chat.
99 +
100 +<Callout type="info">
101 + eve's `defineTool` takes plain JSON Schema, so `EveProvider` passes Composio's `inputParameters`
102 + straight through. It does not convert to a zod schema, which would trip eve's dynamic-tool
103 + normalizer.
104 +</Callout>
105 +
106 +## Hooks
107 +
108 +Pass a `hooks` object to the constructor to wrap the Tool Router meta-tools. Each hook is `(ctx, next)`: `await next()` runs the default behavior, returning a value replaces what the model sees, and `ctx.deny(reason)` blocks the call. `ctx.request` is mutable; `ctx.context` is read-only.
109 +
110 +```typescript
111 +// @noErrors
112 +import { EveProvider } from '@composio/experimental/eve';
113 +
114 +const provider = new EveProvider({
115 + hooks: {
116 + search: (ctx, next) => {
117 + ctx.request.args.toolkits = ['github'];
118 + return next();
119 + },
120 + remoteBash: async (ctx, next) => {
121 + if (String(ctx.request.args.command ?? '').includes('rm -rf')) {
122 + return ctx.deny('Destructive commands are blocked.');
123 + }
124 + return next();
125 + },
126 + onAuthLink: async (ctx, next) => {
127 + await sendConnectionLinkToUser(ctx.url);
128 + return next();
129 + },
130 + },
131 +});
132 +```
133 +
134 +Available hooks, each keyed on `EveProviderHooks`:
135 +
136 +| Hook | Wraps |
137 +| ------------------- | --------------------------------------------------------- |
138 +| `search` | `COMPOSIO_SEARCH_TOOLS` |
139 +| `manageConnections` | `COMPOSIO_MANAGE_CONNECTIONS` |
140 +| `execute` | `COMPOSIO_MULTI_EXECUTE_TOOL` and `COMPOSIO_EXECUTE_TOOL` |
141 +| `remoteWorkbench` | `COMPOSIO_REMOTE_WORKBENCH` |
142 +| `remoteBash` | `COMPOSIO_REMOTE_BASH_TOOL` |
143 +| `onAuthLink` | Any auth link found in a result |
144 +
145 +`ctx.request` carries the meta-tool's raw `{ slug, args }`, and `ctx.deny` is also exported as `denyEveToolCall(reason)`.
146 +
147 +### Require approval
148 +
149 +Map Composio tools onto eve's durable approval flow with `needsApproval`. The callback receives the original Composio tool plus eve's approval context:
150 +
151 +```typescript
152 +// @noErrors
153 +import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';
154 +
155 +const provider = new EveProvider({
156 + needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),
157 +});
158 +```
159 +
160 +When this returns `true`, eve pauses before execution and asks the user to approve the call. `requireApprovalForTools` protects both direct calls and matching entries inside `COMPOSIO_MULTI_EXECUTE_TOOL`. Use an exact slug allowlist for side-effecting tools rather than approving every tool in a toolkit.
161 +
162 +## Next
163 +
164 +<Card
165 + icon={<BookOpen />}
166 + title="iMessage on eve"
167 + href="/examples/imessage-agent"
168 + description="A full example: a custom toolkit for local iMessage plus the eve provider, on one session."
169 +/>
170 +<Card
171 + icon={<BookOpen />}
172 + title="What is a session?"
173 + href="/docs/how-composio-works"
174 + description="How sessions scope users, tools, and auth, and how to reuse them across requests."
175 +/>
docs/content/docs/providers/meta.json
+1
@@ -6,6 +6,7 @@
6 "openai",
7 "vercel",
8 "pi",
9 + "eve",
10 "google",
11 "langchain",
12 "autogen",
docs/content/examples/imessage-agent.mdx new
+266
@@ -0,0 +1,266 @@
1 +---
2 +title: iMessage custom toolkit with eve
3 +description: Walk through an agent that texts on your behalf from your own Mac. A Composio custom toolkit wraps local iMessage in-process, and the eve provider puts it on the same session as the whole Composio catalog.
4 +keywords:
5 + [custom toolkit, imessage, local tools, eve, provider, session, custom tools, macOS, applescript]
6 +full: true
7 +gallery:
8 + categories: [General agents, Background agents]
9 + logos: [gmail, linear, github]
10 + featured: true
11 + order: 3
12 +---
13 +
14 +Most Composio toolkits call a remote API. Some capabilities only exist on one machine, and iMessage is the classic case: there's no iMessage cloud API, so the agent has to run on your Mac and drive Messages.app directly.
15 +
16 +This example builds exactly that: a terminal agent that **texts on your behalf from your own Mac** and reaches the rest of your apps (Gmail, Calendar, GitHub, Slack) through the Composio catalog in the same breath.
17 +
18 +```
19 +you › read my last email and text Shams a summary
20 +you › text mom i'm running 10 min late
21 +you › what did Lena and I last text about?
22 +```
23 +
24 +The pattern is the takeaway, not iMessage specifically. It comes together from a handful of Composio pieces:
25 +
26 +1. **A custom toolkit** wraps local iMessage (send, contacts, history, memory) as Composio tools.
27 +2. **In-process execution** runs each tool right on your Mac through `session.execute`, with no remote API.
28 +3. **One session** puts those local tools on the same surface as the 1000+ app catalog.
29 +4. **The eve provider** turns `session.tools()` into [eve](https://github.com/vercel/eve)-native tools, so `eve dev` can call them.
30 +5. **Triggers** let an outside event wake the agent and reach your phone, with in-chat auth through `COMPOSIO_MANAGE_CONNECTIONS` for any app you haven't connected.
31 +
32 +<ImessageFlow />
33 +
34 +Below you build the integration core: the custom toolkit first, then the wiring that puts it on a session, then triggers, then a browse of the relevant source. You bring a Composio API key and a Mac. Composio brings the catalog.
35 +
36 +## Setup
37 +
38 +You need a [Composio API key](https://dashboard.composio.dev) and macOS (the iMessage tools drive Messages.app, Contacts.app, and the local `chat.db`).
39 +
40 +<Steps>
41 +<Step>
42 +**Install**
43 +
44 +```bash
45 +npm install @composio/core @composio/experimental eve
46 +```
47 +
48 +</Step>
49 +<Step>
50 +**Configure**
51 +
52 +```txt title=".env.local"
53 +COMPOSIO_API_KEY=xxxxxxxxx
54 +```
55 +
56 +</Step>
57 +<Step>
58 +**Grant macOS permissions** (prompted on first use): Automation for Messages, Contacts access, and Full Disk Access to read `chat.db`.
59 +</Step>
60 +</Steps>
61 +
62 +## The custom toolkit
63 +
64 +A custom toolkit is a named group of custom tools. Each tool declares an input schema and an `execute` that runs locally. Here is `SEND`, which shells out to AppleScript to drive Messages.app:
65 +
66 +<FileBuildup name="send" />
67 +
68 +Group your tools into a toolkit. The full project also ships `FIND_CONTACT` (fuzzy contact lookup over Contacts.app), `READ_MESSAGES` (recent messages from `chat.db`), and `RECALL`/`REMEMBER` (per-contact memory), each built the same way:
69 +
70 +```ts title="imessage/index.ts"
71 +// @noErrors
72 +import { experimental_createToolkit } from '@composio/core';
73 +import { sendMessage } from './send-message';
74 +import { findContact } from './find-contact';
75 +import { readMessages } from './read-messages';
76 +import { recallContact, rememberContact } from './memory-tools';
77 +
78 +export function createImessageToolkit() {
79 + return experimental_createToolkit('IMESSAGE', {
80 + name: 'iMessage',
81 + description:
82 + "Send and read iMessages, look up contacts, and remember people, locally on the user's Mac.",
83 + tools: [sendMessage, findContact, readMessages, recallContact, rememberContact],
84 + });
85 +}
86 +```
87 +
88 +The toolkit depends only on `@composio/core`, so it drops into any Composio agent. Custom tools execute in-process through `session.execute`, which is why they aren't on the MCP URL yet.
89 +
90 +## Wire it up
91 +
92 +Set the [eve provider](/docs/providers/eve) on the client and register the toolkit on the session. `composio.ts` grows in three steps, one Composio concept each:
93 +
94 +### Create the client with the eve provider
95 +
96 +The provider is what makes `session.tools()` return eve-native tools instead of raw Composio tools. Its approval policy pauses every iMessage send before the local AppleScript runs.
97 +
98 +<FileBuildup name="wiring" step={1} />
99 +
100 +### Scope a session to the user
101 +
102 +`sessions.create` gives this user their own toolset, already wired to the full Composio catalog.
103 +
104 +<FileBuildup name="wiring" step={2} />
105 +
106 +### Register the local toolkit
107 +
108 +Pass the custom toolkit through `experimental.customToolkits`, and the local iMessage tools join the catalog on the same session.
109 +
110 +<FileBuildup name="wiring" step={3} />
111 +
112 +Now hand that session to eve. eve discovers tools from files, so `defineComposioTools(session)` returns the resolver that exposes `session.tools()`. One line:
113 +
114 +```ts title="agent/tools/composio.ts"
115 +// @noErrors
116 +import { defineComposioTools } from '@composio/experimental/eve';
117 +import { session } from '../../composio';
118 +
119 +export default defineComposioTools(session);
120 +```
121 +
122 +```ts title="agent/agent.ts"
123 +// @noErrors
124 +import { defineAgent } from 'eve';
125 +
126 +export default defineAgent({
127 + model: 'google/gemini-2.5-flash',
128 +});
129 +```
130 +
131 +That's the whole integration. Run `eve dev` and talk to it. The agent can text a contact, read a thread, and act across every connected app, with auth handled in chat through `COMPOSIO_MANAGE_CONNECTIONS`.
132 +
133 +## Extend it: triggers
134 +
135 +The agent can text, so anything that can wake the agent can reach your phone. Composio **triggers** turn an external event into an agent run: subscribe to an app event, point Composio's webhook at your app, and act on each event with the same iMessage tools.
136 +
137 +For example, surface a Linear assignment and ask the user whether to inspect it. The first turn contains no issue title or body, so third-party text does not cross into the agent prompt before the user opts in:
138 +
139 +```ts title="agent/channels/triggers.ts"
140 +// @noErrors
141 +import { defineChannel, POST } from 'eve/channels';
142 +import { composio } from '../../composio';
143 +
144 +export default defineChannel({
145 + routes: [
146 + POST('/webhook', async (req, { send }) => {
147 + const { payload: event } = await composio.triggers.parse(req, {
148 + verifySecret: process.env.COMPOSIO_WEBHOOK_SECRET,
149 + });
150 + if (event.userId !== 'user_123' || event.triggerSlug !== 'LINEAR_ISSUE_ASSIGNED') {
151 + return new Response(null, { status: 202 });
152 + }
153 + await send(
154 + `A verified Linear assignment event arrived. Ask whether I want to inspect it. ` +
155 + `Do not call tools in this turn. Event reference: ${event.uuid}.`,
156 + {
157 + auth: {
158 + authenticator: 'composio-webhook',
159 + principalType: 'service',
160 + principalId: event.userId,
161 + attributes: { triggerSlug: event.triggerSlug },
162 + },
163 + continuationToken: event.uuid,
164 + }
165 + );
166 + return new Response(null, { status: 202 });
167 + }),
168 + ],
169 +});
170 +```
171 +
172 +Point Composio at your webhook and create the trigger, once each. Reuse the same `composio` client from `composio.ts`:
173 +
174 +```ts title="agent/setup-triggers.ts"
175 +// @noErrors
176 +import { composio } from '../composio';
177 +
178 +// Register the webhook URL once per project; store the returned
179 +// secret as COMPOSIO_WEBHOOK_SECRET.
180 +const subscription = await composio.triggers.setWebhookSubscription({
181 + webhookUrl: `${process.env.APP_URL}/webhook`,
182 +});
183 +
184 +// Use the exact slug from the Composio triggers catalog.
185 +const trigger = await composio.triggers.create('user_123', 'LINEAR_ISSUE_ASSIGNED');
186 +console.log(`Trigger created: ${trigger.triggerId}`);
187 +```
188 +
189 +Run it once with `npx tsx agent/setup-triggers.ts`, and the webhook handler above takes over from there.
190 +
191 +Swap the trigger and the prompt to create another reflex. Keep the first turn content-free, then fetch third-party content only after the user asks to continue.
192 +
193 +## More reflexes
194 +
195 +The prompt is where each reflex earns its keep, but the webhook should not turn untrusted content into instructions. Here is the same two-step gate for Gmail:
196 +
197 +```ts title="agent/channels/triggers.ts"
198 +// @noErrors
199 +import { defineChannel, POST } from 'eve/channels';
200 +import { composio } from '../../composio';
201 +
202 +export default defineChannel({
203 + routes: [
204 + POST('/webhook', async (req, { send }) => {
205 + const { payload: event } = await composio.triggers.parse(req, {
206 + verifySecret: process.env.COMPOSIO_WEBHOOK_SECRET,
207 + });
208 + if (event.userId !== 'user_123' || event.triggerSlug !== 'GMAIL_NEW_GMAIL_MESSAGE') {
209 + return new Response(null, { status: 202 });
210 + }
211 + await send(
212 + `A verified Gmail event arrived. Ask whether I want to inspect the email. ` +
213 + `Do not call tools in this turn. Event reference: ${event.uuid}.`,
214 + {
215 + auth: {
216 + authenticator: 'composio-webhook',
217 + principalType: 'service',
218 + principalId: event.userId,
219 + attributes: { triggerSlug: event.triggerSlug },
220 + },
221 + continuationToken: event.uuid,
222 + }
223 + );
224 + return new Response(null, { status: 202 });
225 + }),
226 + ],
227 +});
228 +```
229 +
230 +If the user continues, the agent can fetch the email in a separate turn and require approval before any side effect. A few more patterns worth wiring up with the same gate:
231 +
232 +- **Stand-up nudge.** A calendar event ten minutes out texts you the agenda and the meeting link, pulled straight from the invite.
233 +- **Review request.** A new GitHub review request texts you the PR title and a one-line read of the diff, so you can reply "approve" from your phone.
234 +- **Money in.** A successful Stripe payment texts you the amount and the customer, no dashboard required.
235 +- **Cover for me.** A Slack mention while you're away texts a teammate and asks them to take a look.
236 +
237 +Use the exact slug from the Composio triggers catalog for each. Signature verification proves the event came through Composio; it does not make an email subject, issue title, or other third-party text trustworthy. Reject unexpected users and trigger slugs, keep external content out of the initial prompt, and require approval before side effects such as sending a message.
238 +
239 +## Browse the project
240 +
241 +The key files, in one place. The custom toolkit and the session wiring carry the integration, the eve provider is imported from `@composio/experimental/eve`, and the rest is local macOS glue.
242 +
243 +<RepoBrowser
244 + source="imessage"
245 + caption="a slice of the real project; the Composio files do the work"
246 + heightClass="min-h-[420px] max-h-[640px]"
247 +/>
248 +
249 +The complete, runnable project will be published in the Composio examples repo.
250 +
251 +## Run it
252 +
253 +The browser above is an implementation slice, not a standalone fixture: it omits the project's package manifest and supporting `handles`, `chat-db`, and `memory` modules. The complete runnable project will be published in the Composio examples repo. Until then, use the provider walkthrough on this page in an existing eve app and treat the iMessage source as a reference for the local toolkit. The first send or contact lookup prompts for macOS permission, and the first time the agent needs an app you haven't connected, it returns an auth link in chat through `COMPOSIO_MANAGE_CONNECTIONS`.
254 +
255 +<Cards>
256 + <Card
257 + title="eve provider"
258 + href="/docs/providers/eve"
259 + description="EveProvider, the defineComposioTools resolver, and the (ctx, next) hooks."
260 + />
261 + <Card
262 + title="Custom tools and toolkits"
263 + href="/docs/extending-sessions/custom-tools-and-toolkits"
264 + description="Build and register your own in-process Composio tools."
265 + />
266 +</Cards>
docs/content/examples/index.mdx
+1
@@ -9,4 +9,5 @@ End-to-end builds that wire Composio into working agents. Each one is a complete
9 <Card title="General agent with Pi" href="/examples/general-agent-with-pi" description="Build a Pi + Composio agent and drop it into Slack: triggers, per-user sessions, a shared connection, redirected auth links, and the proxy." />
10 <Card title="Daily standup bot" href="/examples/standup-slackbot" description="A Slack bot that drafts each teammate's standup from their own connected tools: your own Slack app, tool-router sessions, manual tool execution, the proxy, and per-member auth links." />
11 <Card title="Local sandbox PR reviewer" href="/examples/local-sandbox-pr-reviewer" description="Run a PR reviewer in your own sandbox while it calls GitHub tools through a Composio session." />
12 + <Card title="iMessage custom toolkit with eve" href="/examples/imessage-agent" description="An agent that texts on your behalf from your own Mac: a custom toolkit wraps local iMessage in-process, and the eve provider puts it on the same session as the whole Composio catalog." />
13 </Cards>
docs/content/examples/meta.json
+2 -1
@@ -5,6 +5,7 @@
5 "index",
6 "general-agent-with-pi",
7 "standup-slackbot",
8 - "local-sandbox-pr-reviewer"
8 + "local-sandbox-pr-reviewer",
9 + "imessage-agent"
10 ]
11 }
docs/lib/file-builds.ts
+3 -1
@@ -6,9 +6,11 @@
6 * - slack-bot-build: `bot`, `install` (general-agent-with-pi)
7 * - local-workbench-build: `reviewer` (local-sandbox-pr-reviewer)
8 * - standup-bot-build: `setup`, `proxy`, `buttons`, `draft` (daily standup bot)
9 + * - imessage-build: `wiring`, `send` (iMessage agent)
10 */
11 import { FILE_BUILDS as slackBot } from './slack-bot-build';
12 import { FILE_BUILDS as localWorkbench } from './local-workbench-build';
13 import { FILE_BUILDS as standup } from './standup-bot-build';
14 +import { FILE_BUILDS as imessage } from './imessage-build';
15
14 -export const FILE_BUILDS = { ...slackBot, ...localWorkbench, ...standup };
16 +export const FILE_BUILDS = { ...slackBot, ...localWorkbench, ...standup, ...imessage };
docs/lib/imessage-build.ts new
+143
@@ -0,0 +1,143 @@
1 +/**
2 + * Cumulative stages of the iMessage SEND tool, built up one piece at a time.
3 + * Each stage's `code` is the full file at that point; <FileBuildup>
4 + * diffs consecutive stages so the reader watches the tool grow.
5 + */
6 +export interface BuildStage {
7 + title: string;
8 + description: string;
9 + /** Full file contents at this stage. */
10 + code: string;
11 +}
12 +
13 +const shell = `import { experimental_createTool } from '@composio/core';
14 +import { z } from 'zod/v3';
15 +
16 +export const sendMessage = experimental_createTool('SEND', {
17 + name: 'Send iMessage',
18 + description: 'Send an iMessage from your Mac to a phone number or iMessage email.',
19 + preload: true,
20 + inputParams: z.object({}),
21 + execute: async () => ({ sent: false }),
22 +});
23 +`;
24 +
25 +const typed = `import { experimental_createTool } from '@composio/core';
26 +import { z } from 'zod/v3';
27 +
28 +export const sendMessage = experimental_createTool('SEND', {
29 + name: 'Send iMessage',
30 + description: 'Send an iMessage from your Mac to a phone number or iMessage email.',
31 + preload: true,
32 + inputParams: z.object({
33 + to: z.string().describe('Phone number or iMessage email.'),
34 + text: z.string().describe('Message body to send.'),
35 + }),
36 + execute: async () => ({ sent: false }),
37 +});
38 +`;
39 +
40 +const full = `import { experimental_createTool } from '@composio/core';
41 +import { z } from 'zod/v3';
42 +import { runAppleScript, SEND_SCRIPT } from './applescript';
43 +
44 +export const sendMessage = experimental_createTool('SEND', {
45 + name: 'Send iMessage',
46 + description: 'Send an iMessage from your Mac to a phone number or iMessage email.',
47 + preload: true,
48 + inputParams: z.object({
49 + to: z.string().describe('Phone number or iMessage email.'),
50 + text: z.string().describe('Message body to send.'),
51 + }),
52 + execute: async ({ to, text }) => {
53 + await runAppleScript(SEND_SCRIPT, [to, text]);
54 + return { sent: true, to };
55 + },
56 +});
57 +`;
58 +
59 +const wiringClient = `import { Composio } from '@composio/core';
60 +import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';
61 +
62 +export const composio = new Composio({
63 + provider: new EveProvider({
64 + needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),
65 + }),
66 +});
67 +`;
68 +
69 +const wiringSession = `import { Composio } from '@composio/core';
70 +import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';
71 +
72 +export const composio = new Composio({
73 + provider: new EveProvider({
74 + needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),
75 + }),
76 +});
77 +
78 +export const session = composio.sessions.create('user_123');
79 +`;
80 +
81 +const wiringToolkit = `import { Composio } from '@composio/core';
82 +import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';
83 +import { createImessageToolkit } from './imessage';
84 +
85 +export const composio = new Composio({
86 + provider: new EveProvider({
87 + needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),
88 + }),
89 +});
90 +
91 +export const session = composio.sessions.create('user_123', {
92 + experimental: { customToolkits: [createImessageToolkit()] },
93 +});
94 +`;
95 +
96 +export const FILE_BUILDS: Record<string, { file: string; stages: BuildStage[] }> = {
97 + wiring: {
98 + file: 'composio.ts',
99 + stages: [
100 + {
101 + title: 'Client with the eve provider',
102 + description:
103 + 'The eve provider makes session.tools() return eve-native tools, so eve can call them directly.',
104 + code: wiringClient,
105 + },
106 + {
107 + title: 'A session for the user',
108 + description:
109 + 'sessions.create scopes the toolset to one user. It already exposes the whole Composio catalog.',
110 + code: wiringSession,
111 + },
112 + {
113 + title: 'Register the local toolkit',
114 + description:
115 + 'Pass the custom toolkit so the local iMessage tools join the catalog on the same session.',
116 + code: wiringToolkit,
117 + },
118 + ],
119 + },
120 + send: {
121 + file: 'imessage/send-message.ts',
122 + stages: [
123 + {
124 + title: 'The tool shell',
125 + description:
126 + 'A custom tool is a slug, a description, and an execute. preload:true surfaces it in session.tools() without a search step.',
127 + code: shell,
128 + },
129 + {
130 + title: 'Typed inputs',
131 + description:
132 + 'Declare the input schema with zod/v3, which the Composio custom-tool API expects.',
133 + code: typed,
134 + },
135 + {
136 + title: 'Send via AppleScript',
137 + description:
138 + 'The execute runs locally on your Mac, driving Messages.app through osascript.',
139 + code: full,
140 + },
141 + ],
142 + },
143 +};
docs/lib/imessage-source.json new
+47
@@ -0,0 +1,47 @@
1 +[
2 + {
3 + "path": "imessage/send-message.ts",
4 + "composio": true,
5 + "contents": "import { experimental_createTool } from \"@composio/core\";\nimport { z } from \"zod/v3\";\nimport { runAppleScript } from \"./applescript\";\n\nconst SEND_SCRIPT = `on run {targetBuddy, targetText}\n\ttell application \"Messages\"\n\t\tset targetService to 1st service whose service type = iMessage\n\t\tsend targetText to buddy targetBuddy of targetService\n\tend tell\nend run`;\n\n// \"Think\" time + time to type the message, with jitter, capped so messages\n// don't fire instantly.\nfunction humanDelayMs(text: string): number {\n const think = 800 + Math.random() * 1700; // 0.8\u20132.5s\n const typing = text.length * (40 + Math.random() * 40); // ~40\u201380ms/char\n return Math.min(think + typing, 12_000);\n}\n\nexport const sendMessage = experimental_createTool(\"SEND\", {\n name: \"Send iMessage\",\n description:\n \"Send an iMessage from the user's Mac to a phone number or iMessage email handle.\",\n preload: true,\n inputParams: z.object({\n to: z\n .string()\n .describe(\"Recipient handle: phone number (e.g. +15551234567) or iMessage email.\"),\n text: z.string().describe(\"Message body to send.\"),\n name: z.string().optional().describe(\"Recipient's contact name, for display.\"),\n }),\n execute: async ({ to, text }) => {\n await new Promise((r) => setTimeout(r, humanDelayMs(text)));\n await runAppleScript(SEND_SCRIPT, [to, text]);\n return { sent: true, to };\n },\n});"
6 + },
7 + {
8 + "path": "imessage/find-contact.ts",
9 + "composio": true,
10 + "contents": "import { experimental_createTool } from \"@composio/core\";\nimport Fuse from \"fuse.js\";\nimport { z } from \"zod/v3\";\nimport { normalizeHandle } from \"../imessage/handles\";\nimport { runAppleScript } from \"./applescript\";\n\ntype Contact = {\n name: string;\n nickname: string;\n initials: string;\n numbers: { label: string; value: string }[];\n};\n\n// Emits one line per person: name|nickname|label=value;label=value\n//\n// Bulk-fetches each property for ALL people in one Apple Event apiece (a few\n// IPC round-trips total), then assembles locally. Reading properties per-person\n// inside a loop is thousands of round-trips and is what made this slow.\nconst CONTACTS_SCRIPT = `tell application \"Contacts\"\n\tset theNames to name of every person\n\tset theNicks to nickname of every person\n\tset theVals to value of phones of every person\n\tset theLbls to label of phones of every person\nend tell\nset out to {}\nrepeat with i from 1 to count of theNames\n\tset nm to item i of theNames\n\tif nm is missing value then set nm to \"\"\n\tset nk to item i of theNicks\n\tif nk is missing value then set nk to \"\"\n\tset vals to item i of theVals\n\tset lbls to item i of theLbls\n\tset phParts to {}\n\trepeat with j from 1 to count of vals\n\t\tset lb to item j of lbls\n\t\tif lb is missing value then set lb to \"other\"\n\t\tset end of phParts to (lb & \"=\" & item j of vals)\n\tend repeat\n\tset AppleScript's text item delimiters to \";\"\n\tset phStr to phParts as text\n\tset AppleScript's text item delimiters to \"\"\n\tset end of out to (nm & \"|\" & nk & \"|\" & phStr)\nend repeat\nset AppleScript's text item delimiters to (ASCII character 10)\nreturn out as text`;\n\nfunction cleanLabel(raw: string): string {\n return raw.replace(/^_\\$!<(.+)>!\\$_$/, \"$1\") || \"other\";\n}\n\nfunction initialsOf(name: string): string {\n return name\n .split(/\\s+/)\n .filter(Boolean)\n .map((w) => w[0])\n .join(\"\")\n .toLowerCase();\n}\n\nfunction parseContact(line: string): Contact | null {\n const [name = \"\", nickname = \"\", phonesPart = \"\"] = line.split(\"|\");\n const numbers = phonesPart\n .split(\";\")\n .filter(Boolean)\n .map((entry) => {\n const idx = entry.indexOf(\"=\");\n return { label: cleanLabel(entry.slice(0, idx)), value: entry.slice(idx + 1).trim() };\n })\n .filter((n) => n.value);\n if (!name || numbers.length === 0) return null;\n return { name, nickname, initials: initialsOf(name), numbers };\n}\n\nlet contactsCache: Contact[] | null = null;\n\nasync function loadContacts(): Promise<Contact[]> {\n if (contactsCache) return contactsCache;\n const stdout = await runAppleScript(CONTACTS_SCRIPT);\n contactsCache = stdout\n .split(\"\\n\")\n .map((l) => parseContact(l.trim()))\n .filter((c): c is Contact => c !== null);\n return contactsCache;\n}\n\nexport async function searchContacts(\n query: string,\n limit = 5,\n): Promise<{ name: string; numbers: { label: string; value: string }[] }[]> {\n const contacts = await loadContacts();\n const fuse = new Fuse(contacts, {\n keys: [\"name\", \"nickname\", \"initials\"],\n threshold: 0.4,\n ignoreLocation: true,\n });\n return fuse\n .search(query)\n .slice(0, limit)\n .map((r) => ({ name: r.item.name, numbers: r.item.numbers }));\n}\n\n// Reverse lookup: contact name for an incoming handle (for nicer prompts).\nexport async function nameForHandle(handle: string): Promise<string | null> {\n const target = normalizeHandle(handle);\n for (const c of await loadContacts()) {\n for (const n of c.numbers) {\n if (normalizeHandle(n.value) === target) return c.name;\n }\n }\n return null;\n}\n\nexport const findContact = experimental_createTool(\"FIND_CONTACT\", {\n name: \"Find Contact\",\n description:\n \"Fuzzy-search the user's Mac contacts by name, nickname, or initials. Returns matching contacts with their phone numbers (labeled). Use this to resolve who a message is for before sending.\",\n preload: true,\n inputParams: z.object({\n query: z.string().describe(\"Name, nickname, or initials to search for (e.g. 'sh').\"),\n }),\n execute: async ({ query }) => ({ candidates: await searchContacts(query) }),\n});\n"
11 + },
12 + {
13 + "path": "imessage/read-messages.ts",
14 + "composio": true,
15 + "contents": "import { experimental_createTool } from \"@composio/core\";\nimport { z } from \"zod/v3\";\nimport { decodeAttributedBody, runSqlite } from \"../imessage/chat-db\";\n\n// Apple stores message dates as ns since 2001-01-01; 978307200 = that in unix epoch.\nfunction buildQuery(limit: number, handle?: string): string {\n const select = `SELECT\n CASE WHEN m.is_from_me = 1 THEN 'me' ELSE h.id END AS sender,\n datetime(m.date / 1000000000 + 978307200, 'unixepoch', 'localtime') AS time,\n m.text AS text,\n CASE WHEN m.text IS NULL THEN hex(m.attributedBody) ELSE NULL END AS bodyHex\nFROM message m\nLEFT JOIN handle h ON m.handle_id = h.ROWID`;\n\n if (handle) {\n const safe = handle.replace(/'/g, \"''\");\n return `${select}\nJOIN chat_message_join cmj ON cmj.message_id = m.ROWID\nWHERE cmj.chat_id IN (\n SELECT chj.chat_id FROM chat_handle_join chj\n JOIN handle hh ON hh.ROWID = chj.handle_id\n WHERE hh.id = '${safe}'\n)\nORDER BY m.date DESC LIMIT ${limit};`;\n }\n return `${select}\nORDER BY m.date DESC LIMIT ${limit};`;\n}\n\ntype Row = { sender: string | null; time: string; text: string | null; bodyHex: string | null };\n\nexport const readMessages = experimental_createTool(\"READ_MESSAGES\", {\n name: \"Read iMessages\",\n description:\n \"Read recent iMessages from the user's Mac. Defaults to the last 5. Pass a larger limit to see more, or a handle (a phone/email, e.g. from find_contact) to read one conversation.\",\n preload: true,\n inputParams: z.object({\n handle: z\n .string()\n .optional()\n .describe(\"Phone number or email to focus on a single conversation.\"),\n limit: z\n .number()\n .int()\n .optional()\n .describe(\"How many recent messages to read (default 5, max 50).\"),\n }),\n execute: async ({ handle, limit }) => {\n const n = Math.min(Math.max(limit ?? 5, 1), 50);\n const rows = await runSqlite<Row>(buildQuery(n, handle));\n const messages = rows\n .reverse() // chronological: oldest first\n .map((r) => ({\n sender: r.sender ?? \"unknown\",\n time: r.time,\n text: r.text ?? decodeAttributedBody(r.bodyHex) ?? \"[unsupported message]\",\n }));\n return { messages };\n },\n});\n"
16 + },
17 + {
18 + "path": "imessage/memory-tools.ts",
19 + "composio": true,
20 + "contents": "import { experimental_createTool } from \"@composio/core\";\nimport { z } from \"zod/v3\";\nimport { readMemory, writeMemory } from \"../imessage/memory\";\n\nexport const recallContact = experimental_createTool(\"RECALL\", {\n name: \"Recall Contact\",\n description:\n \"Recall what you remember about a contact (notes from past conversations) by their phone/email handle. Call this before replying to or discussing someone.\",\n preload: true,\n inputParams: z.object({\n handle: z.string().describe(\"Phone number or email of the contact.\"),\n }),\n execute: async ({ handle }) => ({ notes: await readMemory(handle) }),\n});\n\nexport const rememberContact = experimental_createTool(\"REMEMBER\", {\n name: \"Remember Contact\",\n description:\n \"Save concise notes about a contact (facts, ongoing topics, plans) for future conversations. Replaces the existing notes, so pass the full updated notes. Keep them short, a few lines.\",\n preload: true,\n inputParams: z.object({\n handle: z.string().describe(\"Phone number or email of the contact.\"),\n notes: z.string().describe(\"The full updated notes to store (concise).\"),\n }),\n execute: async ({ handle, notes }) => {\n await writeMemory(handle, notes);\n return { saved: true };\n },\n});\n"
21 + },
22 + {
23 + "path": "imessage/applescript.ts",
24 + "composio": false,
25 + "contents": "import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst run = promisify(execFile);\n\n// Runs an AppleScript via osascript. `--` ends osascript option parsing; extra\n// values then become `on run {\u2026}` parameters and are never parsed as source.\nexport async function runAppleScript(script: string, args: string[] = []): Promise<string> {\n const { stdout } = await run(\"osascript\", [\"-e\", script, \"--\", ...args], {\n maxBuffer: 1024 * 1024 * 16,\n timeout: 60_000,\n });\n return stdout;\n}\n"
26 + },
27 + {
28 + "path": "imessage/index.ts",
29 + "composio": true,
30 + "contents": "import { experimental_createToolkit } from \"@composio/core\";\nimport { findContact } from \"./find-contact\";\nimport { recallContact, rememberContact } from \"./memory-tools\";\nimport { readMessages } from \"./read-messages\";\nimport { sendMessage } from \"./send-message\";\n\n// A self-contained Composio custom toolkit for local iMessage on macOS:\n// send, find contacts, read messages, and per-contact memory. Framework-agnostic\nexport function createImessageToolkit() {\n return experimental_createToolkit(\"IMESSAGE\", {\n name: \"iMessage\",\n description:\n \"Send and read iMessages, look up contacts, and remember things about them, locally on the user's Mac.\",\n tools: [sendMessage, findContact, readMessages, recallContact, rememberContact],\n });\n}\n"
31 + },
32 + {
33 + "path": "composio.ts",
34 + "composio": true,
35 + "contents": "import { Composio } from '@composio/core';\nimport { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';\nimport { createImessageToolkit } from './imessage';\n\nexport const composio = new Composio({\n provider: new EveProvider({\n needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),\n }),\n});\n\nexport const session = composio.sessions.create('user_123', {\n experimental: { customToolkits: [createImessageToolkit()] },\n});\n"
36 + },
37 + {
38 + "path": "agent/tools/composio.ts",
39 + "composio": true,
40 + "contents": "import { defineComposioTools } from '@composio/experimental/eve';\nimport { session } from '../../composio';\n\nexport default defineComposioTools(session);\n"
41 + },
42 + {
43 + "path": "agent/agent.ts",
44 + "composio": false,
45 + "contents": "import { defineAgent } from \"eve\";\n\nexport default defineAgent({\n model: \"google/gemini-2.5-flash\",\n});\n"
46 + }
47 +]
docs/lib/source.ts
+8 -1
@@ -297,7 +297,14 @@ export function mdxToCleanMarkdown(content: string): string {
297 }
298 );
299
300 - // RepoBrowser is an interactive file tree; point agents at the real repo instead.
300 + // RepoBrowser is an interactive file tree. The iMessage page intentionally
301 + // shows a source slice while its public runnable fixture is still pending.
302 + result = result.replace(
303 + /<RepoBrowser\b(?=[^>]*\bsource="imessage")[^>]*\/>/g,
304 + '\n> The iMessage code browser is an implementation slice, not a standalone fixture. The complete runnable project will be published in the Composio examples repo.\n'
305 + );
306 +
307 + // Point the existing Slack browser at its real repository.
308 result = result.replace(
309 /<RepoBrowser\b[^>]*\/>/g,
310 '\n> The complete project is on GitHub: [composio-slack-bot](https://github.com/ComposioHQ/composio-slack-bot).\n'
docs/mdx-components.tsx
+2
@@ -33,6 +33,7 @@ import { LocalSandboxBoundary } from '@/components/local-sandbox-boundary';
33 import { FileBuildup } from '@/components/file-buildup';
34 import { RepoBrowser } from '@/components/repo-browser';
35 import { AppLogo } from '@/components/standup-example';
36 +import { ImessageFlow } from '@/components/imessage-flow';
37 import { WorkbenchFlow } from '@/components/workbench-flow';
38 import { AuthConfigFlow } from '@/components/auth-config-flow';
39 import { WhiteLabelFlow } from '@/components/white-label-flow';
@@ -129,6 +130,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
130 FileBuildup,
131 RepoBrowser,
132 AppLogo,
133 + ImessageFlow,
134 WorkbenchFlow,
135 AuthConfigFlow,
136 WhiteLabelFlow,
pnpm-lock.yaml
+463 -20
@@ -173,7 +173,7 @@ importers:
173 version: 7.8.5
174 tsdown:
175 specifier: 'catalog:'
176 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
176 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
177 tsx:
178 specifier: 'catalog:'
179 version: 4.22.5
@@ -1249,7 +1249,7 @@ importers:
1249 version: 3.2.0
1250 tsdown:
1251 specifier: 'catalog:'
1252 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1252 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1253 tsx:
1254 specifier: 'catalog:'
1255 version: 4.22.5
@@ -1273,7 +1273,7 @@ importers:
1273 version: 3.21.4
1274 tsdown:
1275 specifier: 'catalog:'
1276 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1276 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1277 typescript:
1278 specifier: 'catalog:'
1279 version: 6.0.3
@@ -1304,7 +1304,7 @@ importers:
1304 version: 1.5.0
1305 tsdown:
1306 specifier: 'catalog:'
1307 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1307 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1308 typescript:
1309 specifier: 'catalog:'
1310 version: 6.0.3
@@ -1347,7 +1347,7 @@ importers:
1347 version: 7.7.1
1348 tsdown:
1349 specifier: 'catalog:'
1350 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1350 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1351 tsx:
1352 specifier: 'catalog:'
1353 version: 4.22.5
@@ -1366,6 +1366,9 @@ importers:
1366
1367 ts/packages/experimental:
1368 dependencies:
1369 + safe-stable-stringify:
1370 + specifier: ^2.5.0
1371 + version: 2.5.0
1372 typebox:
1373 specifier: 1.3.3
1374 version: 1.3.3
@@ -1376,9 +1379,12 @@ importers:
1379 '@earendil-works/pi-coding-agent':
1380 specifier: ^0.80.3
1381 version: 0.80.3(@modelcontextprotocol/sdk@1.29.0(@cfworker/json-schema@4.1.1)(zod@4.4.3))(supports-color@10.2.2)(ws@8.21.0)(zod@4.4.3)
1382 + eve:
1383 + specifier: ^0.12.0
1384 + version: 0.12.3(@opentelemetry/api@1.9.0)(ai@7.0.0-beta.178(zod@4.4.3))(dotenv@17.4.2)(jiti@2.7.0)(lru-cache@11.5.1)(miniflare@4.20260701.0)(rollup@4.62.2)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1))
1385 tsdown:
1386 specifier: 'catalog:'
1381 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1387 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1388 tsx:
1389 specifier: 'catalog:'
1390 version: 4.22.5
@@ -1399,7 +1405,7 @@ importers:
1405 version: 26.1.0
1406 tsdown:
1407 specifier: 'catalog:'
1402 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1408 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1409 typescript:
1410 specifier: 'catalog:'
1411 version: 6.0.3
@@ -1429,7 +1435,7 @@ importers:
1435 version: 6.0.219(zod@4.4.3)
1436 tsdown:
1437 specifier: 'catalog:'
1432 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1438 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1439 typescript:
1440 specifier: 'catalog:'
1441 version: 6.0.3
@@ -1451,7 +1457,7 @@ importers:
1457 version: link:../../core
1458 tsdown:
1459 specifier: 'catalog:'
1454 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1460 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1461 typescript:
1462 specifier: 'catalog:'
1463 version: 6.0.3
@@ -1470,7 +1476,7 @@ importers:
1476 version: link:../../core
1477 tsdown:
1478 specifier: 'catalog:'
1473 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1479 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1480 typescript:
1481 specifier: 'catalog:'
1482 version: 6.0.3
@@ -1489,7 +1495,7 @@ importers:
1495 version: link:../../core
1496 tsdown:
1497 specifier: 'catalog:'
1492 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1498 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1499 typescript:
1500 specifier: 'catalog:'
1501 version: 6.0.3
@@ -1504,7 +1510,7 @@ importers:
1510 version: 1.2.1(@opentelemetry/api@1.9.1)(openai@6.45.0(@aws-sdk/credential-provider-node@3.972.62)(@smithy/signature-v4@5.6.2)(ws@8.21.0)(zod@4.4.3))(ws@8.21.0)
1511 tsdown:
1512 specifier: 'catalog:'
1507 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1513 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1514 typescript:
1515 specifier: 'catalog:'
1516 version: 6.0.3
@@ -1526,7 +1532,7 @@ importers:
1532 version: link:../../core
1533 tsdown:
1534 specifier: 'catalog:'
1529 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1535 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1536 typescript:
1537 specifier: 'catalog:'
1538 version: 6.0.3
@@ -1548,7 +1554,7 @@ importers:
1554 version: 6.0.219(zod@4.4.3)
1555 tsdown:
1556 specifier: 'catalog:'
1551 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1557 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1558 typescript:
1559 specifier: 'catalog:'
1560 version: 6.0.3
@@ -1570,7 +1576,7 @@ importers:
1576 version: link:../../core
1577 tsdown:
1578 specifier: 'catalog:'
1573 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1579 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1580 typescript:
1581 specifier: 'catalog:'
1582 version: 6.0.3
@@ -1588,7 +1594,7 @@ importers:
1594 version: 0.12.0(@aws-sdk/credential-provider-node@3.972.62)(@cfworker/json-schema@4.1.1)(@smithy/signature-v4@5.6.2)(supports-color@10.2.2)(ws@8.21.0)(zod@4.4.3)
1595 tsdown:
1596 specifier: 'catalog:'
1591 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1597 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1598 typescript:
1599 specifier: 'catalog:'
1600 version: 6.0.3
@@ -1609,7 +1615,7 @@ importers:
1615 version: 7.0.14(zod@4.4.3)
1616 tsdown:
1617 specifier: 'catalog:'
1612 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1618 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1619 typescript:
1620 specifier: 'catalog:'
1621 version: 6.0.3
@@ -1668,7 +1674,7 @@ importers:
1674 version: link:@types/@babel/helper-validator-identifier
1675 tsdown:
1676 specifier: 'catalog:'
1671 - version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1))
1677 + version: 0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27)
1678 vitest:
1679 specifier: 'catalog:'
1680 version: 4.1.9(@opentelemetry/api@1.9.1)(@types/node@26.1.0)(@vitest/ui@4.1.9)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))
@@ -1706,6 +1712,12 @@ packages:
1712 peerDependencies:
1713 zod: ^3.25.76 || ^4.1.8
1714
1715 + '@ai-sdk/gateway@4.0.0-beta.109':
1716 + resolution: {integrity: sha512-W/1kLlPb6Bgbhwep3CA3R6do0HD7SXV5gyuz2XBLY1YABqgxYkw+IhEcjOYlmn9v+Tifjqy5yJqmWdSHMJhyPQ==}
1717 + engines: {node: '>=22'}
1718 + peerDependencies:
1719 + zod: ^3.25.76 || ^4.1.8
1720 +
1721 '@ai-sdk/gateway@4.0.11':
1722 resolution: {integrity: sha512-ZdZzQnBxYfjJpWpSNkV+rRWycwTBhxyvwGvxcwx9g+WQoy3MK2xNahSySEgP9hD/X2xY9jkjd0xB67oDE3rLMA==}
1723 engines: {node: '>=22'}
@@ -1754,6 +1766,12 @@ packages:
1766 peerDependencies:
1767 zod: ^3.25.76 || ^4.1.8
1768
1769 + '@ai-sdk/provider-utils@5.0.0-beta.49':
1770 + resolution: {integrity: sha512-7xnpAQLpW0KGIsh0CQERcIZuXEGqv7FtFW2BdFk14iuMxRMVpXhTVvEQyqkm6tWAbQ7OsGQJhO6M0Me9gHQ52g==}
1771 + engines: {node: '>=22'}
1772 + peerDependencies:
1773 + zod: ^3.25.76 || ^4.1.8
1774 +
1775 '@ai-sdk/provider-utils@5.0.5':
1776 resolution: {integrity: sha512-oI0t3dvCoqWNV1I8o1Rybi2DXDvHES5r/TrwtJW90tuFLVepgJlftPxrcjh8vaSvjqC2diTuA2vXyjKAyHJm4A==}
1777 engines: {node: '>=22'}
@@ -1780,6 +1798,10 @@ packages:
1798 resolution: {integrity: sha512-fr9Gs89prDWiuox/T+kCA+i2cJkHpxU5S+tr4megjTzRC27ZsvFhwjU/+XrqqMbvBUlfmXxTOYWy8ng45dsjIg==}
1799 engines: {node: '>=22'}
1800
1801 + '@ai-sdk/provider@4.0.0-beta.19':
1802 + resolution: {integrity: sha512-Aca/KiGeRtMM7rOJ38Qio+Dc2V45PpiGoWgdrdtIkgM9zkhYpS043t0ggKoNOWgm/csv99XWGrfSF63PSkVeHw==}
1803 + engines: {node: '>=22'}
1804 +
1805 '@ai-sdk/provider@4.0.2':
1806 resolution: {integrity: sha512-pfPoy9J1B1xV7cqJ8MYHOsDYrMv5tR3+EMNfI249OhkD2uRakvav3Fo7XpD2luuN/YNCBY7KfEQc7vEV7KEtyw==}
1807 engines: {node: '>=22'}
@@ -4236,6 +4258,12 @@ packages:
4258 peerDependencies:
4259 zod: ^3.25.76 || ^4.1.8
4260
4261 + ai@7.0.0-beta.178:
4262 + resolution: {integrity: sha512-kOfIbf23FDkvvfDHOS1gIjImBF9MlYut8fEMlps57vvS622VKL1PeEDLJ181aVd2LPSiDr3SupAMSzI2rEaW3w==}
4263 + engines: {node: '>=22'}
4264 + peerDependencies:
4265 + zod: ^3.25.76 || ^4.1.8
4266 +
4267 ai@7.0.14:
4268 resolution: {integrity: sha512-qA82fZyD4xh9IDB+s3SvwbjwjR+GGRmJjTYMwON1uROj8vPDIQbPTZLLq6ZWTVESn9daeH1GMv0zKfVLwNU2sQ==}
4269 engines: {node: '>=22'}
@@ -4496,6 +4524,10 @@ packages:
4524 concat-map@0.0.1:
4525 resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
4526
4527 + consola@3.4.2:
4528 + resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}
4529 + engines: {node: ^14.18.0 || >=16.10.0}
4530 +
4531 content-disposition@1.1.0:
4532 resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==}
4533 engines: {node: '>=18'}
@@ -4539,6 +4571,14 @@ packages:
4571 resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
4572 engines: {node: '>= 8'}
4573
4574 + crossws@0.4.9:
4575 + resolution: {integrity: sha512-iWx+1OMSG2aOHpjyf9AESOzkwsVdS49cXM9dVrI2PDhxU5l2RIWE/KG56gk4BbAnsMoycvniJ9OnOxO9LRzHVA==}
4576 + peerDependencies:
4577 + srvx: '>=0.11.5'
4578 + peerDependenciesMeta:
4579 + srvx:
4580 + optional: true
4581 +
4582 crypto-random-string@4.0.0:
4583 resolution: {integrity: sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==}
4584 engines: {node: '>=12'}
@@ -4547,6 +4587,29 @@ packages:
4587 resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
4588 engines: {node: '>= 12'}
4589
4590 + db0@0.3.4:
4591 + resolution: {integrity: sha512-RiXXi4WaNzPTHEOu8UPQKMooIbqOEyqA1t7Z6MsdxSCeb8iUC9ko3LcmsLmeUt2SM5bctfArZKkRQggKZz7JNw==}
4592 + peerDependencies:
4593 + '@electric-sql/pglite': '*'
4594 + '@libsql/client': '*'
4595 + better-sqlite3: '*'
4596 + drizzle-orm: '*'
4597 + mysql2: '*'
4598 + sqlite3: '*'
4599 + peerDependenciesMeta:
4600 + '@electric-sql/pglite':
4601 + optional: true
4602 + '@libsql/client':
4603 + optional: true
4604 + better-sqlite3:
4605 + optional: true
4606 + drizzle-orm:
4607 + optional: true
4608 + mysql2:
4609 + optional: true
4610 + sqlite3:
4611 + optional: true
4612 +
4613 debug@4.4.3:
4614 resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
4615 engines: {node: '>=6.0'}
@@ -4679,6 +4742,24 @@ packages:
4742 resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
4743 engines: {node: '>=0.12'}
4744
4745 + env-runner@0.1.16:
4746 + resolution: {integrity: sha512-2LRJM4P2KLX6J83QZZrMqvgCDt/D5ea7wPcI3yYiy5cG/9rX5QwdwZFx0D7ktWnjdRyZxYjttGGorb5nFqb1CA==}
4747 + hasBin: true
4748 + peerDependencies:
4749 + '@netlify/runtime': ^4.1.23
4750 + '@vercel/queue': '>=0.2.0'
4751 + miniflare: ^4.20260515.0
4752 + wrangler: ^4.0.0
4753 + peerDependenciesMeta:
4754 + '@netlify/runtime':
4755 + optional: true
4756 + '@vercel/queue':
4757 + optional: true
4758 + miniflare:
4759 + optional: true
4760 + wrangler:
4761 + optional: true
4762 +
4763 environment@1.1.0:
4764 resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==}
4765 engines: {node: '>=18'}
@@ -4784,6 +4865,47 @@ packages:
4865 resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}
4866 engines: {node: '>= 0.6'}
4867
4868 + eve@0.12.3:
4869 + resolution: {integrity: sha512-SEMC0WiCT0tNd+8Tm1IUbTNTHmzHoeyX5UBOtFVi+E6dIWGarIzDkGllUwkpwnb5ZylKZnF8TriR3bufO4bwfw==}
4870 + engines: {node: '>=24'}
4871 + hasBin: true
4872 + peerDependencies:
4873 + '@opentelemetry/api': ^1.0.0
4874 + '@sveltejs/kit': ^2.0.0
4875 + ai: 7.0.0-beta.178
4876 + braintrust: ^3.0.0
4877 + just-bash: ^3.0.0
4878 + microsandbox: ^0.5.0
4879 + next: ^16.0.0
4880 + nuxt: ^4.0.0
4881 + react: ^19.0.0
4882 + svelte: ^5.0.0
4883 + vite: ^8.0.0
4884 + vue: ^3.5.0
4885 + peerDependenciesMeta:
4886 + '@opentelemetry/api':
4887 + optional: true
4888 + '@sveltejs/kit':
4889 + optional: true
4890 + braintrust:
4891 + optional: true
4892 + just-bash:
4893 + optional: true
4894 + microsandbox:
4895 + optional: true
4896 + next:
4897 + optional: true
4898 + nuxt:
4899 + optional: true
4900 + react:
4901 + optional: true
4902 + svelte:
4903 + optional: true
4904 + vite:
4905 + optional: true
4906 + vue:
4907 + optional: true
4908 +
4909 eventemitter3@4.0.7:
4910 resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
4911
@@ -4820,6 +4942,9 @@ packages:
4942 resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}
4943 engines: {node: '>= 18'}
4944
4945 + exsolve@1.1.0:
4946 + resolution: {integrity: sha512-D+42+T12DdIlJM3uepa55qGiL3sYdLBOxIl2ifQCzCHz4c7eiolaHsi3BIqEr7JxBzxv2pYZQX9kw16ziMcEmw==}
4947 +
4948 extend-shallow@2.0.1:
4949 resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}
4950 engines: {node: '>=0.10.0'}
@@ -5036,6 +5161,16 @@ packages:
5161 resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}
5162 engines: {node: '>=6.0'}
5163
5164 + h3@2.0.1-rc.22:
5165 + resolution: {integrity: sha512-Esv0DMIuPkCTSWCA0vO73vcTqwzH1wjSrAO1TXNu/K3up1sZHa9EKMapbmxCDYBeymC3fVTk4qxp7ogQWQ+KgA==}
5166 + engines: {node: '>=20.11.1'}
5167 + hasBin: true
5168 + peerDependencies:
5169 + crossws: ^0.4.1
5170 + peerDependenciesMeta:
5171 + crossws:
5172 + optional: true
5173 +
5174 has-flag@4.0.0:
5175 resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
5176 engines: {node: '>=8'}
@@ -5081,6 +5216,9 @@ packages:
5216 resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
5217 engines: {node: '>= 14'}
5218
5219 + httpxy@0.5.4:
5220 + resolution: {integrity: sha512-URfeibL0kTH6VuIxxaJDXWQWEk8fKr+9L8MGv6CuAiNy0fGnoVhWbXBvJR1mkdsvCDUxvhX9cW60k2AhtH5s6w==}
5221 +
5222 human-id@4.2.0:
5223 resolution: {integrity: sha512-K3GbkIWqyvvlpfhBPlbEvD97TtqBpAYA4kt+cn2lD2x2HuohzZCibcA2nOlnJT6exqvJLggoB5nv2dNf192nEA==}
5224 hasBin: true
@@ -5646,6 +5784,40 @@ packages:
5784 resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
5785 engines: {node: '>= 0.6'}
5786
5787 + nf3@0.3.19:
5788 + resolution: {integrity: sha512-tfOXX/ivQBL+4km/fzxQ0HWMmp1Ewx/YpFLbya080gXVfm26bZy0n4a5K5PPnqTLyuAHu0FobVpXXUadIiIwIQ==}
5789 +
5790 + nitro@3.0.260610-beta:
5791 + resolution: {integrity: sha512-KPb4L5yaF/Rx/xoGMpgHRJvZhbhGiqbRKOwwPLCH9jKTKTsEUHLjnJas85AeCzaswqa8Wi52eQBtRsODC4PS0Q==}
5792 + engines: {node: ^20.19.0 || >=22.12.0}
5793 + hasBin: true
5794 + peerDependencies:
5795 + '@vercel/queue': ^0.3.0
5796 + dotenv: '*'
5797 + giget: '*'
5798 + jiti: ^2.7.0
5799 + rollup: ^4.61.1
5800 + vite: ^7 || ^8
5801 + xml2js: ^0.6.2
5802 + zephyr-agent: ^0.2.0
5803 + peerDependenciesMeta:
5804 + '@vercel/queue':
5805 + optional: true
5806 + dotenv:
5807 + optional: true
5808 + giget:
5809 + optional: true
5810 + jiti:
5811 + optional: true
5812 + rollup:
5813 + optional: true
5814 + vite:
5815 + optional: true
5816 + xml2js:
5817 + optional: true
5818 + zephyr-agent:
5819 + optional: true
5820 +
5821 node-addon-api@7.1.1:
5822 resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}
5823
@@ -5690,6 +5862,15 @@ packages:
5862 resolution: {integrity: sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==}
5863 engines: {node: '>=12.20.0'}
5864
5865 + ocache@0.1.5:
5866 + resolution: {integrity: sha512-kNNnkkVQup/QDvmTz8Q84wc2ntiyoVHDxa6eHWKt5qdGAmFRBIxy83rxgCYEjW0x06UJ9E3P6VgM2yY4rOBH4w==}
5867 +
5868 + ofetch@2.0.0-alpha.3:
5869 + resolution: {integrity: sha512-zpYTCs2byOuft65vI3z43Dd6iSdFbOZZLb9/d21aCpx2rGastVU9dOCv0lu4ykc1Ur1anAYjDi3SUvR0vq50JA==}
5870 +
5871 + ohash@2.0.11:
5872 + resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==}
5873 +
5874 on-finished@2.4.1:
5875 resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
5876 engines: {node: '>= 0.8'}
@@ -6113,6 +6294,9 @@ packages:
6294 engines: {node: '>=18.0.0', npm: '>=8.0.0'}
6295 hasBin: true
6296
6297 + rou3@0.8.1:
6298 + resolution: {integrity: sha512-ePa+XGk00/3HuCqrEnK3LxJW7I0SdNg6EFzKUJG73hMAdDcOUC/i/aSz7LSDwLrGr33kal/rqOGydzwl6U7zBA==}
6299 +
6300 router@2.2.0:
6301 resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}
6302 engines: {node: '>= 18'}
@@ -6131,6 +6315,10 @@ packages:
6315 safe-buffer@5.2.1:
6316 resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
6317
6318 + safe-stable-stringify@2.5.0:
6319 + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==}
6320 + engines: {node: '>=10'}
6321 +
6322 safer-buffer@2.1.2:
6323 resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
6324
@@ -6236,6 +6424,11 @@ packages:
6424 sprintf-js@1.0.3:
6425 resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
6426
6427 + srvx@0.11.21:
6428 + resolution: {integrity: sha512-GWTHjKMeekX8CwJf4VU9Oo6mJpSGaflGMddbCvR+Cmmh9sslRMiGbAoqqZacE0r1ncARh6buCEETr2W52F8b1w==}
6429 + engines: {node: '>=20.16.0'}
6430 + hasBin: true
6431 +
6432 stackback@0.0.2:
6433 resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}
6434
@@ -6554,6 +6747,80 @@ packages:
6747 synckit:
6748 optional: true
6749
6750 + unstorage@2.0.0-alpha.7:
6751 + resolution: {integrity: sha512-ELPztchk2zgFJnakyodVY3vJWGW9jy//keJ32IOJVGUMyaPydwcA1FtVvWqT0TNRch9H+cMNEGllfVFfScImog==}
6752 + peerDependencies:
6753 + '@azure/app-configuration': ^1.11.0
6754 + '@azure/cosmos': ^4.9.1
6755 + '@azure/data-tables': ^13.3.2
6756 + '@azure/identity': ^4.13.0
6757 + '@azure/keyvault-secrets': ^4.10.0
6758 + '@azure/storage-blob': ^12.31.0
6759 + '@capacitor/preferences': ^6 || ^7 || ^8
6760 + '@deno/kv': '>=0.13.0'
6761 + '@netlify/blobs': ^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0
6762 + '@planetscale/database': ^1.19.0
6763 + '@upstash/redis': ^1.36.2
6764 + '@vercel/blob': '>=0.27.3'
6765 + '@vercel/functions': ^2.2.12 || ^3.0.0
6766 + '@vercel/kv': ^1.0.1
6767 + aws4fetch: ^1.0.20
6768 + chokidar: ^4 || ^5
6769 + db0: '>=0.3.4'
6770 + idb-keyval: ^6.2.2
6771 + ioredis: ^5.9.3
6772 + lru-cache: ^11.2.6
6773 + mongodb: ^6 || ^7
6774 + ofetch: '*'
6775 + uploadthing: ^7.7.4
6776 + peerDependenciesMeta:
6777 + '@azure/app-configuration':
6778 + optional: true
6779 + '@azure/cosmos':
6780 + optional: true
6781 + '@azure/data-tables':
6782 + optional: true
6783 + '@azure/identity':
6784 + optional: true
6785 + '@azure/keyvault-secrets':
6786 + optional: true
6787 + '@azure/storage-blob':
6788 + optional: true
6789 + '@capacitor/preferences':
6790 + optional: true
6791 + '@deno/kv':
6792 + optional: true
6793 + '@netlify/blobs':
6794 + optional: true
6795 + '@planetscale/database':
6796 + optional: true
6797 + '@upstash/redis':
6798 + optional: true
6799 + '@vercel/blob':
6800 + optional: true
6801 + '@vercel/functions':
6802 + optional: true
6803 + '@vercel/kv':
6804 + optional: true
6805 + aws4fetch:
6806 + optional: true
6807 + chokidar:
6808 + optional: true
6809 + db0:
6810 + optional: true
6811 + idb-keyval:
6812 + optional: true
6813 + ioredis:
6814 + optional: true
6815 + lru-cache:
6816 + optional: true
6817 + mongodb:
6818 + optional: true
6819 + ofetch:
6820 + optional: true
6821 + uploadthing:
6822 + optional: true
6823 +
6824 uri-js-replace@1.0.1:
6825 resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==}
6826
@@ -6824,6 +7091,13 @@ snapshots:
7091 '@vercel/oidc': 3.2.0
7092 zod: 4.4.3
7093
7094 + '@ai-sdk/gateway@4.0.0-beta.109(zod@4.4.3)':
7095 + dependencies:
7096 + '@ai-sdk/provider': 4.0.0-beta.19
7097 + '@ai-sdk/provider-utils': 5.0.0-beta.49(zod@4.4.3)
7098 + '@vercel/oidc': 3.2.0
7099 + zod: 4.4.3
7100 +
7101 '@ai-sdk/gateway@4.0.11(zod@4.4.3)':
7102 dependencies:
7103 '@ai-sdk/provider': 4.0.2
@@ -6922,6 +7196,14 @@ snapshots:
7196 eventsource-parser: 3.1.0
7197 zod: 4.4.3
7198
7199 + '@ai-sdk/provider-utils@5.0.0-beta.49(zod@4.4.3)':
7200 + dependencies:
7201 + '@ai-sdk/provider': 4.0.0-beta.19
7202 + '@standard-schema/spec': 1.1.0
7203 + '@workflow/serde': 4.1.0
7204 + eventsource-parser: 3.1.0
7205 + zod: 4.4.3
7206 +
7207 '@ai-sdk/provider-utils@5.0.5(zod@3.25.76)':
7208 dependencies:
7209 '@ai-sdk/provider': 4.0.2
@@ -6958,6 +7240,10 @@ snapshots:
7240 dependencies:
7241 json-schema: 0.4.0
7242
7243 + '@ai-sdk/provider@4.0.0-beta.19':
7244 + dependencies:
7245 + json-schema: 0.4.0
7246 +
7247 '@ai-sdk/provider@4.0.2':
7248 dependencies:
7249 json-schema: 0.4.0
@@ -9413,7 +9699,7 @@ snapshots:
9699 sirv: 3.0.2
9700 tinyglobby: 0.2.17
9701 tinyrainbow: 3.1.0
9416 - vitest: 4.1.9(@opentelemetry/api@1.9.1)(@types/node@26.1.0)(@vitest/ui@4.1.9)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))
9702 + vitest: 4.1.9(@opentelemetry/api@1.9.0)(@types/node@26.1.0)(@vitest/ui@4.1.9)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))
9703
9704 '@vitest/utils@4.1.9':
9705 dependencies:
@@ -9493,6 +9779,13 @@ snapshots:
9779 '@opentelemetry/api': 1.9.1
9780 zod: 4.4.3
9781
9782 + ai@7.0.0-beta.178(zod@4.4.3):
9783 + dependencies:
9784 + '@ai-sdk/gateway': 4.0.0-beta.109(zod@4.4.3)
9785 + '@ai-sdk/provider': 4.0.0-beta.19
9786 + '@ai-sdk/provider-utils': 5.0.0-beta.49(zod@4.4.3)
9787 + zod: 4.4.3
9788 +
9789 ai@7.0.14(zod@4.4.3):
9790 dependencies:
9791 '@ai-sdk/gateway': 4.0.11(zod@4.4.3)
@@ -9743,6 +10036,8 @@ snapshots:
10036
10037 concat-map@0.0.1: {}
10038
10039 + consola@3.4.2: {}
10040 +
10041 content-disposition@1.1.0: {}
10042
10043 content-type@1.0.5: {}
@@ -9774,12 +10069,18 @@ snapshots:
10069 shebang-command: 2.0.0
10070 which: 2.0.2
10071
10072 + crossws@0.4.9(srvx@0.11.21):
10073 + optionalDependencies:
10074 + srvx: 0.11.21
10075 +
10076 crypto-random-string@4.0.0:
10077 dependencies:
10078 type-fest: 1.4.0
10079
10080 data-uri-to-buffer@4.0.1: {}
10081
10082 + db0@0.3.4: {}
10083 +
10084 debug@4.4.3(supports-color@10.2.2):
10085 dependencies:
10086 ms: 2.1.3
@@ -9885,6 +10186,16 @@ snapshots:
10186
10187 entities@4.5.0: {}
10188
10189 + env-runner@0.1.16(miniflare@4.20260701.0)(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1)):
10190 + dependencies:
10191 + crossws: 0.4.9(srvx@0.11.21)
10192 + exsolve: 1.1.0
10193 + httpxy: 0.5.4
10194 + srvx: 0.11.21
10195 + optionalDependencies:
10196 + miniflare: 4.20260701.0
10197 + wrangler: 4.107.0(@cloudflare/workers-types@4.20260702.1)
10198 +
10199 environment@1.1.0: {}
10200
10201 error-stack-parser-es@1.0.5: {}
@@ -10043,6 +10354,52 @@ snapshots:
10354
10355 etag@1.8.1: {}
10356
10357 + eve@0.12.3(@opentelemetry/api@1.9.0)(ai@7.0.0-beta.178(zod@4.4.3))(dotenv@17.4.2)(jiti@2.7.0)(lru-cache@11.5.1)(miniflare@4.20260701.0)(rollup@4.62.2)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1)):
10358 + dependencies:
10359 + ai: 7.0.0-beta.178(zod@4.4.3)
10360 + nitro: 3.0.260610-beta(dotenv@17.4.2)(jiti@2.7.0)(lru-cache@11.5.1)(miniflare@4.20260701.0)(rollup@4.62.2)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1))
10361 + optionalDependencies:
10362 + '@opentelemetry/api': 1.9.0
10363 + vite: 7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0)
10364 + transitivePeerDependencies:
10365 + - '@azure/app-configuration'
10366 + - '@azure/cosmos'
10367 + - '@azure/data-tables'
10368 + - '@azure/identity'
10369 + - '@azure/keyvault-secrets'
10370 + - '@azure/storage-blob'
10371 + - '@capacitor/preferences'
10372 + - '@deno/kv'
10373 + - '@electric-sql/pglite'
10374 + - '@libsql/client'
10375 + - '@netlify/blobs'
10376 + - '@netlify/runtime'
10377 + - '@planetscale/database'
10378 + - '@upstash/redis'
10379 + - '@vercel/blob'
10380 + - '@vercel/functions'
10381 + - '@vercel/kv'
10382 + - '@vercel/queue'
10383 + - aws4fetch
10384 + - better-sqlite3
10385 + - chokidar
10386 + - dotenv
10387 + - drizzle-orm
10388 + - giget
10389 + - idb-keyval
10390 + - ioredis
10391 + - jiti
10392 + - lru-cache
10393 + - miniflare
10394 + - mongodb
10395 + - mysql2
10396 + - rollup
10397 + - sqlite3
10398 + - uploadthing
10399 + - wrangler
10400 + - xml2js
10401 + - zephyr-agent
10402 +
10403 eventemitter3@4.0.7: {}
10404
10405 eventemitter3@5.0.4: {}
@@ -10110,6 +10467,8 @@ snapshots:
10467 transitivePeerDependencies:
10468 - supports-color
10469
10470 + exsolve@1.1.0: {}
10471 +
10472 extend-shallow@2.0.1:
10473 dependencies:
10474 is-extendable: 0.1.1
@@ -10353,6 +10712,13 @@ snapshots:
10712 section-matter: 1.0.0
10713 strip-bom-string: 1.0.0
10714
10715 + h3@2.0.1-rc.22(crossws@0.4.9(srvx@0.11.21)):
10716 + dependencies:
10717 + rou3: 0.8.1
10718 + srvx: 0.11.21
10719 + optionalDependencies:
10720 + crossws: 0.4.9(srvx@0.11.21)
10721 +
10722 has-flag@4.0.0: {}
10723
10724 has-symbols@1.1.0: {}
@@ -10408,6 +10774,8 @@ snapshots:
10774 transitivePeerDependencies:
10775 - supports-color
10776
10777 + httpxy@0.5.4: {}
10778 +
10779 human-id@4.2.0: {}
10780
10781 human-signals@8.0.1: {}
@@ -11099,6 +11467,61 @@ snapshots:
11467
11468 negotiator@1.0.0: {}
11469
11470 + nf3@0.3.19: {}
11471 +
11472 + nitro@3.0.260610-beta(dotenv@17.4.2)(jiti@2.7.0)(lru-cache@11.5.1)(miniflare@4.20260701.0)(rollup@4.62.2)(vite@7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0))(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1)):
11473 + dependencies:
11474 + consola: 3.4.2
11475 + crossws: 0.4.9(srvx@0.11.21)
11476 + db0: 0.3.4
11477 + env-runner: 0.1.16(miniflare@4.20260701.0)(wrangler@4.107.0(@cloudflare/workers-types@4.20260702.1))
11478 + h3: 2.0.1-rc.22(crossws@0.4.9(srvx@0.11.21))
11479 + hookable: 6.1.1
11480 + nf3: 0.3.19
11481 + ocache: 0.1.5
11482 + ofetch: 2.0.0-alpha.3
11483 + ohash: 2.0.11
11484 + rolldown: 1.1.4
11485 + srvx: 0.11.21
11486 + unenv: 2.0.0-rc.24
11487 + unstorage: 2.0.0-alpha.7(db0@0.3.4)(lru-cache@11.5.1)(ofetch@2.0.0-alpha.3)
11488 + optionalDependencies:
11489 + dotenv: 17.4.2
11490 + jiti: 2.7.0
11491 + rollup: 4.62.2
11492 + vite: 7.3.1(@types/node@26.1.0)(jiti@2.7.0)(tsx@4.22.5)(yaml@2.9.0)
11493 + transitivePeerDependencies:
11494 + - '@azure/app-configuration'
11495 + - '@azure/cosmos'
11496 + - '@azure/data-tables'
11497 + - '@azure/identity'
11498 + - '@azure/keyvault-secrets'
11499 + - '@azure/storage-blob'
11500 + - '@capacitor/preferences'
11501 + - '@deno/kv'
11502 + - '@electric-sql/pglite'
11503 + - '@libsql/client'
11504 + - '@netlify/blobs'
11505 + - '@netlify/runtime'
11506 + - '@planetscale/database'
11507 + - '@upstash/redis'
11508 + - '@vercel/blob'
11509 + - '@vercel/functions'
11510 + - '@vercel/kv'
11511 + - aws4fetch
11512 + - better-sqlite3
11513 + - chokidar
11514 + - drizzle-orm
11515 + - idb-keyval
11516 + - ioredis
11517 + - lru-cache
11518 + - miniflare
11519 + - mongodb
11520 + - mysql2
11521 + - sqlite3
11522 + - uploadthing
11523 + - wrangler
11524 +
11525 node-addon-api@7.1.1: {}
11526
11527 node-addon-api@8.9.0: {}
@@ -11136,6 +11559,14 @@ snapshots:
11559
11560 obug@2.1.3: {}
11561
11562 + ocache@0.1.5:
11563 + dependencies:
11564 + ohash: 2.0.11
11565 +
11566 + ofetch@2.0.0-alpha.3: {}
11567 +
11568 + ohash@2.0.11: {}
11569 +
11570 on-finished@2.4.1:
11571 dependencies:
11572 ee-first: 1.1.1
@@ -11579,6 +12010,8 @@ snapshots:
12010 '@rollup/rollup-win32-x64-msvc': 4.62.2
12011 fsevents: 2.3.3
12012
12013 + rou3@0.8.1: {}
12014 +
12015 router@2.2.0:
12016 dependencies:
12017 debug: 4.4.3(supports-color@10.2.2)
@@ -11601,6 +12034,8 @@ snapshots:
12034
12035 safe-buffer@5.2.1: {}
12036
12037 + safe-stable-stringify@2.5.0: {}
12038 +
12039 safer-buffer@2.1.2: {}
12040
12041 section-matter@1.0.0:
@@ -11749,6 +12184,8 @@ snapshots:
12184
12185 sprintf-js@1.0.3: {}
12186
12187 + srvx@0.11.21: {}
12188 +
12189 stackback@0.0.2: {}
12190
12191 standardwebhooks@1.0.0:
@@ -11882,7 +12319,7 @@ snapshots:
12319 '@ts-morph/common': 0.29.0
12320 code-block-writer: 13.0.3
12321
11885 - tsdown@0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)):
12322 + tsdown@0.22.3(@arethetypeswrong/core@0.18.4)(@typescript/native-preview@7.0.0-dev.20260703.1)(publint@0.3.21)(tsx@4.22.5)(typescript@6.0.3)(unrun@0.2.27):
12323 dependencies:
12324 ansis: 4.3.1
12325 cac: 7.0.0
@@ -12042,6 +12479,12 @@ snapshots:
12479 - '@emnapi/runtime'
12480 optional: true
12481
12482 + unstorage@2.0.0-alpha.7(db0@0.3.4)(lru-cache@11.5.1)(ofetch@2.0.0-alpha.3):
12483 + optionalDependencies:
12484 + db0: 0.3.4
12485 + lru-cache: 11.5.1
12486 + ofetch: 2.0.0-alpha.3
12487 +
12488 uri-js-replace@1.0.1: {}
12489
12490 uri-js@4.4.1:
ts/packages/core/src/models/ToolRouterSession.ts
+38 -16
@@ -766,11 +766,23 @@ export class ToolRouterSession<
766 );
767 }
768
769 - const [localResults, remoteResult] = await Promise.all([
769 + const [localResults, remoteOutcome] = await Promise.all([
770 Promise.all(localPromises),
771 - remotePromise,
771 + remotePromise
772 + ? remotePromise.then(result => ({ result })).catch(error => ({ error }))
773 + : undefined,
774 ]);
775
776 + const remoteTransportFailed = !!remoteOutcome && 'error' in remoteOutcome;
777 + const remoteTransportError = remoteTransportFailed ? remoteOutcome.error : null;
778 + const remoteErrorMessage = remoteTransportFailed
779 + ? (remoteTransportError instanceof Error
780 + ? remoteTransportError.message
781 + : String(remoteTransportError)) || 'Remote tool execution failed'
782 + : null;
783 + const remoteResult =
784 + remoteOutcome && 'result' in remoteOutcome ? remoteOutcome.result : undefined;
785 +
786 // If only local tools, return the single/first result unwrapped
787 if (remoteIndices.length === 0 && localResults.length === 1) {
788 return localResults[0].result;
@@ -784,9 +796,15 @@ export class ToolRouterSession<
796 ? remoteResult.data
797 : {}
798 ) as Record<string, unknown>;
787 - const remoteResults = (
788 - Array.isArray(remoteData.results) ? remoteData.results : []
789 - ) as unknown[];
799 + const remoteResults = remoteErrorMessage
800 + ? remoteIndices.map(index => ({
801 + response: { successful: false, data: {}, error: remoteErrorMessage },
802 + tool_slug: parsed[index].tool_slug,
803 + error: remoteErrorMessage,
804 + }))
805 + : ((Array.isArray(remoteData.results) ? remoteData.results : []) as Array<
806 + Record<string, unknown>
807 + >);
808
809 // Build local result entries matching backend format
810 const localEntries = localResults.map(({ index, result }) => ({
@@ -796,20 +814,22 @@ export class ToolRouterSession<
814 ...(result.error ? { error: result.error } : {}),
815 },
816 tool_slug: parsed[index].tool_slug,
817 + index,
818 ...(result.error ? { error: result.error } : {}),
819 }));
820
802 - // Merge and re-index sequentially so there are no collisions
821 + // Restore original request order, then re-index sequentially so there are no collisions.
822 const merged: Array<Record<string, unknown>> = [
804 - ...(remoteResults as Array<Record<string, unknown>>),
805 - ...localEntries,
806 - ];
807 - const allResults = merged.map(
808 - (entry, i): Record<string, unknown> => ({
823 + ...remoteResults.map((entry, remotePosition) => ({
824 ...entry,
810 - index: i,
811 - })
812 - );
825 + index: remoteIndices[remotePosition] ?? remotePosition,
826 + })),
827 + ...localEntries,
828 + ].sort((a, b) => Number(a.index) - Number(b.index));
829 + const allResults = merged.map((entry, i): Record<string, unknown> => ({
830 + ...entry,
831 + index: i,
832 + }));
833 const failedCount = allResults.filter(r => r.error).length;
834 const mergedData: Record<string, unknown> = {
835 ...remoteData,
@@ -817,13 +837,15 @@ export class ToolRouterSession<
837 };
838 if (
839 localEntries.length > 0 &&
820 - ['total_count', 'success_count', 'error_count'].some(key => key in remoteData)
840 + (remoteErrorMessage ||
841 + ['total_count', 'success_count', 'error_count'].some(key => key in remoteData))
842 ) {
843 mergedData.total_count = allResults.length;
844 mergedData.success_count = allResults.length - failedCount;
845 mergedData.error_count = failedCount;
846 }
826 - const remoteError = typeof remoteResult?.error === 'string' ? remoteResult.error : null;
847 + const remoteError =
848 + remoteErrorMessage ?? (typeof remoteResult?.error === 'string' ? remoteResult.error : null);
849 const hasAnyError = localResults.some(r => r.result.error) || !!remoteError;
850
851 return {
ts/packages/core/test/models/customToolRouting.test.ts
+30
@@ -714,6 +714,12 @@ describe('ToolRouterSession execution routing', () => {
714 expect(findResult(results, 'LOCAL_META_ADS_GET_AD_ACCOUNTS')).toBeDefined();
715 expect(findResult(results, 'GMAIL_SEND_EMAIL')).toBeDefined();
716 expect(findResult(results, 'SLACK_POST_MESSAGE')).toBeDefined();
717 + expect(results.map((entry: any) => entry.tool_slug)).toEqual([
718 + 'LOCAL_GET_USER_CONTEXT',
719 + 'GMAIL_SEND_EMAIL',
720 + 'LOCAL_META_ADS_GET_AD_ACCOUNTS',
721 + 'SLACK_POST_MESSAGE',
722 + ]);
723
724 const backendTools = toolsInstance.executeSessionTool.mock.calls[0][1].arguments.tools;
725 expect(backendTools).toHaveLength(2);
@@ -727,6 +733,30 @@ describe('ToolRouterSession execution routing', () => {
733 expect(result.successful).toBe(true);
734 });
735
736 + it('should preserve successful local results when remote transport fails', async () => {
737 + const { executeFn, toolsInstance } = await setupMultiExecute(mockClient, [customToolHandle]);
738 +
739 + toolsInstance.executeSessionTool.mockRejectedValueOnce(new Error('remote unavailable'));
740 +
741 + const result = await executeFn('COMPOSIO_MULTI_EXECUTE_TOOL', {
742 + tools: [
743 + { tool_slug: 'LOCAL_GET_USER_CONTEXT', arguments: { category: 'safe-retry' } },
744 + { tool_slug: 'GMAIL_SEND_EMAIL', arguments: { to: 'a@b.com' } },
745 + ],
746 + sync_response_to_workbench: false,
747 + });
748 +
749 + expect(result.successful).toBe(false);
750 + expect(localExecute).toHaveBeenCalledTimes(1);
751 + expect(findResult(result.data.results, 'LOCAL_GET_USER_CONTEXT')).toMatchObject({
752 + response: { successful: true, data: { local_result: true } },
753 + });
754 + expect(findResult(result.data.results, 'GMAIL_SEND_EMAIL')).toMatchObject({
755 + response: { successful: false, error: 'remote unavailable' },
756 + error: 'remote unavailable',
757 + });
758 + });
759 +
760 it('should recompute remote counters when local results are merged', async () => {
761 const { executeFn, toolsInstance } = await setupMultiExecute(mockClient, [customToolHandle]);
762
ts/packages/experimental/README.md
+25 -1
@@ -2,7 +2,10 @@
2
3 Experimental Composio integrations and helpers.
4
5 -This package currently includes a Pi provider for [`@earendil-works/pi-coding-agent`](https://www.npmjs.com/package/@earendil-works/pi-coding-agent). It lets Composio tools be passed to Pi SDK sessions as `customTools` and includes a dynamic Tool Router session toolset modeled after the Slack bot integration in `~/composio/slack-bot`.
5 +This package currently includes two framework providers:
6 +
7 +- A **Pi provider** for [`@earendil-works/pi-coding-agent`](https://www.npmjs.com/package/@earendil-works/pi-coding-agent). It lets Composio tools be passed to Pi SDK sessions as `customTools` and includes a dynamic Tool Router session toolset modeled after the Slack bot integration in `~/composio/slack-bot`.
8 +- An **eve provider** for the [eve](https://github.com/vercel/eve) agent framework (see [eve provider](#eve-provider) below).
9
10 ## Install
11
@@ -185,6 +188,27 @@ const tools = provider.createSessionTools({
188 });
189 ```
190
191 +## eve provider
192 +
193 +`EveProvider` is a Composio provider for the [eve](https://github.com/vercel/eve) agent framework. It makes `session.tools()` return eve-native `defineTool`s, so an eve agent gets the Tool Router meta-tools and any preloaded custom toolkits from one call.
194 +
195 +```ts
196 +import { Composio } from '@composio/core';
197 +import { EveProvider, defineComposioTools } from '@composio/experimental/eve';
198 +
199 +const composio = new Composio({ provider: new EveProvider() });
200 +const session = composio.sessions.create('user_123', {
201 + /* toolkits, customToolkits */
202 +});
203 +
204 +// Expose the tools to eve from agent/tools/<name>.ts:
205 +export default defineComposioTools(session);
206 +```
207 +
208 +`defineComposioTools(session)` returns a `step.started` dynamic resolver and memoizes `session.tools()`, because the wrapped tools carry live `execute` closures that eve keeps only for step-scoped tools.
209 +
210 +The provider also takes `(ctx, next)` hooks (`new EveProvider({ hooks })`) around the meta-tools, with the same rewrite, `deny`, transform, and `onAuthLink` semantics as the Pi hooks above.
211 +
212 ## Status
213
214 Experimental. The dynamic helper names and session helper API may change.
ts/packages/experimental/package.json
+17 -1
@@ -30,6 +30,10 @@
30 "./workbench": {
31 "types": "./dist/workbench/index.d.mts",
32 "default": "./dist/workbench/index.mjs"
33 + },
34 + "./eve": {
35 + "types": "./dist/eve/index.d.mts",
36 + "default": "./dist/eve/index.mjs"
37 }
38 },
39 "files": [
@@ -49,21 +53,33 @@
53 "experimental",
54 "pi",
55 "coding-agent",
56 + "eve",
57 "tools",
58 "agent"
59 ],
60 "author": "",
61 "license": "ISC",
62 "dependencies": {
63 + "safe-stable-stringify": "^2.5.0",
64 "typebox": "1.3.3"
65 },
66 "peerDependencies": {
67 "@composio/core": ">=0.10.0 <1.0.0",
62 - "@earendil-works/pi-coding-agent": ">=0.79.0 <1.0.0"
68 + "@earendil-works/pi-coding-agent": ">=0.79.0 <1.0.0",
69 + "eve": ">=0.12.0 <1.0.0"
70 + },
71 + "peerDependenciesMeta": {
72 + "@earendil-works/pi-coding-agent": {
73 + "optional": true
74 + },
75 + "eve": {
76 + "optional": true
77 + }
78 },
79 "devDependencies": {
80 "@composio/core": "workspace:*",
81 "@earendil-works/pi-coding-agent": "^0.80.3",
82 + "eve": "^0.12.0",
83 "tsdown": "catalog:",
84 "tsx": "catalog:",
85 "typescript": "catalog:",
ts/packages/experimental/src/auth-links.ts new
+80
@@ -0,0 +1,80 @@
1 +import { configure } from 'safe-stable-stringify';
2 +
3 +const HTTPS_PREFIX = 'https://';
4 +const CONNECT_LINK_PREFIX = 'https://connect.composio.dev/';
5 +const COMPOSIO_MARKER = 'composio';
6 +const LINK_PATH_MARKER = '/link/';
7 +const URL_BOUNDARIES = new Set(['<', '>', ')', '"', "'"]);
8 +const TRAILING_PUNCTUATION = new Set(['.', ',', ';', ':', '!', '?']);
9 +const stringify = configure({ deterministic: false });
10 +
11 +const stringifyUnknown = (value: unknown): string => {
12 + if (typeof value === 'string') return value;
13 +
14 + try {
15 + const serialized = stringify(value);
16 + if (serialized === undefined) return '';
17 + return serialized;
18 + } catch {
19 + return '';
20 + }
21 +};
22 +
23 +const isUrlBoundary = (character: string): boolean =>
24 + URL_BOUNDARIES.has(character) || character.trim().length === 0;
25 +
26 +const trimTrailingPunctuation = (url: string): string => {
27 + let end = url.length;
28 +
29 + while (end > 0 && TRAILING_PUNCTUATION.has(url[end - 1]!)) {
30 + end -= 1;
31 + }
32 +
33 + return url.slice(0, end);
34 +};
35 +
36 +const classifyToken = (
37 + token: string,
38 + connectLinks: Set<string>,
39 + genericLinks: Set<string>
40 +): void => {
41 + const normalizedToken = token.toLowerCase();
42 + const httpsStart = normalizedToken.indexOf(HTTPS_PREFIX);
43 + if (httpsStart === -1) return;
44 +
45 + const connectStart = normalizedToken.indexOf(CONNECT_LINK_PREFIX, httpsStart);
46 + if (connectStart !== -1 && connectStart + CONNECT_LINK_PREFIX.length < token.length) {
47 + connectLinks.add(trimTrailingPunctuation(token.slice(connectStart)));
48 + }
49 +
50 + const composioStart = normalizedToken.indexOf(COMPOSIO_MARKER, httpsStart + HTTPS_PREFIX.length);
51 + if (composioStart === -1) return;
52 +
53 + const linkPathStart = normalizedToken.indexOf(
54 + LINK_PATH_MARKER,
55 + composioStart + COMPOSIO_MARKER.length
56 + );
57 + if (linkPathStart === -1 || linkPathStart + LINK_PATH_MARKER.length >= token.length) return;
58 +
59 + genericLinks.add(trimTrailingPunctuation(token.slice(httpsStart)));
60 +};
61 +
62 +export const extractComposioConnectLinks = (value: unknown): string[] => {
63 + const text = stringifyUnknown(value);
64 + const connectLinks = new Set<string>();
65 + const genericLinks = new Set<string>();
66 + let tokenStart = 0;
67 +
68 + for (let index = 0; index <= text.length; index += 1) {
69 + const character = text[index];
70 + if (character !== undefined && !isUrlBoundary(character)) continue;
71 +
72 + if (index > tokenStart) {
73 + classifyToken(text.slice(tokenStart, index), connectLinks, genericLinks);
74 + }
75 +
76 + tokenStart = index + 1;
77 + }
78 +
79 + return Array.from(new Set([...connectLinks, ...genericLinks]));
80 +};
ts/packages/experimental/src/eve/hooks.ts new
+113
@@ -0,0 +1,113 @@
1 +import type { ExecuteToolFn, ToolExecuteResponse } from '@composio/core';
2 +import type { ToolContext } from 'eve/tools';
3 +import { extractComposioConnectLinks } from '../auth-links';
4 +
5 +type MaybePromise<T> = T | Promise<T>;
6 +type Next = () => Promise<ToolExecuteResponse>;
7 +
8 +export interface EveHookControls {
9 + deny(reason: string): ToolExecuteResponse;
10 +}
11 +
12 +export interface EveHookContext extends EveHookControls {
13 + request: { slug: string; args: Record<string, unknown> };
14 + readonly context: { readonly slug: string; readonly eve: ToolContext };
15 +}
16 +
17 +export interface EveAuthLinkContext extends EveHookControls {
18 + readonly url: string;
19 + readonly result: ToolExecuteResponse;
20 + readonly context: { readonly slug: string; readonly eve: ToolContext };
21 +}
22 +
23 +export type EveHook = (ctx: EveHookContext, next: Next) => MaybePromise<ToolExecuteResponse | void>;
24 +export type EveAuthLinkHook = (
25 + ctx: EveAuthLinkContext,
26 + next: Next
27 +) => MaybePromise<ToolExecuteResponse | void>;
28 +
29 +export interface EveProviderHooks {
30 + search?: EveHook;
31 + manageConnections?: EveHook;
32 + execute?: EveHook;
33 + remoteWorkbench?: EveHook;
34 + remoteBash?: EveHook;
35 + onAuthLink?: EveAuthLinkHook;
36 +}
37 +
38 +export const denyEveToolCall = (reason: string): ToolExecuteResponse => ({
39 + data: {},
40 + error: reason,
41 + successful: false,
42 +});
43 +
44 +const HOOK_BY_SLUG = {
45 + COMPOSIO_SEARCH_TOOLS: 'search',
46 + COMPOSIO_MANAGE_CONNECTIONS: 'manageConnections',
47 + COMPOSIO_MULTI_EXECUTE_TOOL: 'execute',
48 + COMPOSIO_EXECUTE_TOOL: 'execute',
49 + COMPOSIO_REMOTE_WORKBENCH: 'remoteWorkbench',
50 + COMPOSIO_REMOTE_BASH_TOOL: 'remoteBash',
51 +} as const;
52 +
53 +type MetaSlug = keyof typeof HOOK_BY_SLUG;
54 +
55 +const hookForSlug = (hooks: EveProviderHooks, slug: string): EveHook | undefined => {
56 + const hookName = HOOK_BY_SLUG[slug as MetaSlug];
57 + if (!hookName) return undefined;
58 + return hooks[hookName];
59 +};
60 +
61 +const extractAuthLinks = (result: ToolExecuteResponse): string[] => {
62 + const links = new Set(extractComposioConnectLinks(result.data));
63 + for (const link of extractComposioConnectLinks(result.error)) {
64 + links.add(link);
65 + }
66 + return Array.from(links);
67 +};
68 +
69 +const runHook = async <C>(
70 + hook: ((ctx: C, next: Next) => MaybePromise<ToolExecuteResponse | void>) | undefined,
71 + ctx: C,
72 + getDefault: Next
73 +): Promise<ToolExecuteResponse> => {
74 + if (!hook) return getDefault();
75 +
76 + let pending: Promise<ToolExecuteResponse> | undefined;
77 + const next: Next = () => {
78 + if (!pending) pending = getDefault();
79 + return pending;
80 + };
81 +
82 + const hookResult = await hook(ctx, next);
83 + if (hookResult !== undefined && hookResult !== null) return hookResult;
84 + if (pending) return pending;
85 + return next();
86 +};
87 +
88 +export async function applyHooks(
89 + hooks: EveProviderHooks,
90 + slug: string,
91 + args: Record<string, unknown>,
92 + executeTool: ExecuteToolFn,
93 + eveContext: ToolContext
94 +): Promise<ToolExecuteResponse> {
95 + const context = { slug, eve: eveContext };
96 + const ctx: EveHookContext = { request: { slug, args }, context, deny: denyEveToolCall };
97 + const hook = hookForSlug(hooks, slug);
98 + const result = await runHook(hook, ctx, () => executeTool(ctx.request.slug, ctx.request.args));
99 +
100 + const { onAuthLink } = hooks;
101 + if (!onAuthLink) return result;
102 +
103 + let current = result;
104 + for (const url of extractAuthLinks(result)) {
105 + const previous = current;
106 + current = await runHook(
107 + onAuthLink,
108 + { url, result: previous, context, deny: denyEveToolCall },
109 + async () => previous
110 + );
111 + }
112 + return current;
113 +}
ts/packages/experimental/src/eve/index.ts new
+20
@@ -0,0 +1,20 @@
1 +/**
2 + * Experimental Composio provider for the eve agent framework.
3 + *
4 + * `EveProvider` makes `session.tools()` return eve-native `defineTool`s;
5 + * `defineComposioTools` is the replay-safe resolver that hands them to eve.
6 + *
7 + * @module experimental/eve
8 + */
9 +export { EveProvider, requireApprovalForTools } from './provider';
10 +export type { EveNeedsApproval, EveProviderOptions, EveTool, EveToolCollection } from './provider';
11 +export { defineComposioTools } from './resolver';
12 +export { denyEveToolCall } from './hooks';
13 +export type {
14 + EveHook,
15 + EveAuthLinkHook,
16 + EveHookContext,
17 + EveAuthLinkContext,
18 + EveHookControls,
19 + EveProviderHooks,
20 +} from './hooks';
ts/packages/experimental/src/eve/provider.ts new
+115
@@ -0,0 +1,115 @@
1 +import {
2 + BaseAgenticProvider,
3 + type ExecuteToolFn,
4 + type McpServerGetResponse,
5 + type McpUrlResponse,
6 + normalizeToolArguments,
7 + removeNonRequiredProperties,
8 + type Tool,
9 + type ToolExecuteResponse,
10 +} from '@composio/core';
11 +import type { JsonValue } from 'eve/connections';
12 +import {
13 + type NeedsApprovalContext,
14 + type ToolContext,
15 + type ToolDefinition,
16 + defineTool,
17 +} from 'eve/tools';
18 +import { applyHooks, type EveProviderHooks } from './hooks';
19 +
20 +export type EveTool = ToolDefinition<Record<string, unknown>, ToolExecuteResponse>;
21 +export type EveToolCollection = Record<string, EveTool>;
22 +export type EveNeedsApproval = (
23 + tool: Tool,
24 + context: NeedsApprovalContext<Record<string, unknown>>
25 +) => boolean;
26 +
27 +const MULTI_EXECUTE_TOOL_SLUG = 'COMPOSIO_MULTI_EXECUTE_TOOL';
28 +
29 +const toEveInputSchema = (tool: Tool, strict?: boolean): Record<string, JsonValue> => {
30 + const params = tool.inputParameters;
31 + if (!params) return { type: 'object', properties: {} };
32 + if (!strict || params.type !== 'object') return params as Record<string, JsonValue>;
33 +
34 + return removeNonRequiredProperties({
35 + ...params,
36 + properties: { ...params.properties },
37 + }) as Record<string, JsonValue>;
38 +};
39 +
40 +const toEveApprovalPolicy = (
41 + tool: Tool,
42 + approvalPolicy?: EveNeedsApproval
43 +): EveTool['needsApproval'] => {
44 + if (!approvalPolicy) return undefined;
45 + return context => approvalPolicy(tool, context);
46 +};
47 +
48 +const isProtectedToolItem = (item: unknown, protectedSlugs: ReadonlySet<string>): boolean => {
49 + if (typeof item !== 'object' || item === null) return false;
50 +
51 + const toolSlug = (item as Record<string, unknown>).tool_slug;
52 + if (typeof toolSlug !== 'string') return false;
53 +
54 + return protectedSlugs.has(toolSlug.toUpperCase());
55 +};
56 +
57 +/** Require approval for direct calls and matching entries inside a multi-execute call. */
58 +export const requireApprovalForTools = (...toolSlugs: string[]): EveNeedsApproval => {
59 + const protectedSlugs = new Set(toolSlugs.map(slug => slug.toUpperCase()));
60 + return (tool, context) => {
61 + const normalizedToolSlug = tool.slug.toUpperCase();
62 + if (protectedSlugs.has(normalizedToolSlug)) return true;
63 + if (normalizedToolSlug !== MULTI_EXECUTE_TOOL_SLUG) return false;
64 +
65 + const requestedTools = context.toolInput?.tools;
66 + if (!Array.isArray(requestedTools)) return false;
67 +
68 + return requestedTools.some(item => isProtectedToolItem(item, protectedSlugs));
69 + };
70 +};
71 +
72 +export interface EveProviderOptions {
73 + strict?: boolean;
74 + hooks?: EveProviderHooks;
75 + needsApproval?: EveNeedsApproval;
76 +}
77 +
78 +export class EveProvider extends BaseAgenticProvider<
79 + EveToolCollection,
80 + EveTool,
81 + McpServerGetResponse
82 +> {
83 + readonly name = 'eve';
84 +
85 + constructor(private readonly options: EveProviderOptions = {}) {
86 + super();
87 + }
88 +
89 + wrapTool(tool: Tool, executeTool: ExecuteToolFn): EveTool {
90 + const inputSchema = toEveInputSchema(tool, this.options.strict);
91 + const needsApproval = toEveApprovalPolicy(tool, this.options.needsApproval);
92 +
93 + return defineTool({
94 + description: tool.description ?? tool.name,
95 + inputSchema,
96 + needsApproval,
97 + execute: (input, context: ToolContext) =>
98 + applyHooks(
99 + this.options.hooks ?? {},
100 + tool.slug,
101 + normalizeToolArguments(input, tool.slug),
102 + executeTool,
103 + context
104 + ),
105 + });
106 + }
107 +
108 + wrapTools(tools: Tool[], executeTool: ExecuteToolFn): EveToolCollection {
109 + return Object.fromEntries(tools.map(tool => [tool.slug, this.wrapTool(tool, executeTool)]));
110 + }
111 +
112 + wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse {
113 + return data.map(item => ({ url: new URL(item.url), name: item.name })) as McpServerGetResponse;
114 + }
115 +}
ts/packages/experimental/src/eve/resolver.ts new
+34
@@ -0,0 +1,34 @@
1 +import { defineDynamic, type DynamicResolveContext } from 'eve/tools';
2 +import type { EveToolCollection } from './provider';
3 +
4 +type EveSession = { tools: () => Promise<EveToolCollection> };
5 +type EveSessionSource<S extends EveSession> =
6 + S | Promise<S> | ((context: DynamicResolveContext) => S | Promise<S>);
7 +
8 +// step.started keeps the provider's live execute closures (session.started
9 +// snapshots them away); cached per resolved session since session.tools() is a
10 +// network call. Rejected requests are evicted so transient failures can retry.
11 +export function defineComposioTools<S extends EveSession>(source: EveSessionSource<S>) {
12 + const cache = new WeakMap<S, Promise<EveToolCollection>>();
13 +
14 + const resolveTools = async (context: DynamicResolveContext): Promise<EveToolCollection> => {
15 + const session = await (typeof source === 'function' ? source(context) : source);
16 + const cached = cache.get(session);
17 + if (cached) return cached;
18 +
19 + const pending = session.tools();
20 + cache.set(session, pending);
21 + try {
22 + return await pending;
23 + } catch (error) {
24 + if (cache.get(session) === pending) cache.delete(session);
25 + throw error;
26 + }
27 + };
28 +
29 + return defineDynamic({
30 + events: {
31 + 'step.started': (_event, context) => resolveTools(context),
32 + },
33 + });
34 +}
ts/packages/experimental/src/index.ts
+2 -2
@@ -1,8 +1,8 @@
1 /**
2 * Experimental Composio integrations and helpers.
3 *
4 - * Currently includes the experimental Pi provider for
5 - * @earendil-works/pi-coding-agent.
4 + * The root export remains the Pi provider for backwards compatibility.
5 + * Framework-specific integrations are also available through subpath exports.
6 *
7 * @packageDocumentation
8 * @module experimental
ts/packages/experimental/src/pi/auth-links.ts
+2 -18
@@ -1,25 +1,9 @@
1 +import { extractComposioConnectLinks } from '../auth-links';
2 import { runHook } from './hooks';
3 import { hookControls } from './results';
4 import type { PiAuthLinkContext, PiHookControls, PiSessionToolCapabilities } from './types';
5
5 -export const extractComposioConnectLinks = (value: unknown): string[] => {
6 - const text = stringifyUnknown(value);
7 - const connectLinks = text.match(/https:\/\/connect\.composio\.dev\/[^\s<>)"']+/gi) ?? [];
8 - const genericLinks =
9 - text.match(/https:\/\/[^\s<>)"']*composio[^\s<>)"']*\/link\/[^\s<>)"']+/gi) ?? [];
10 - return [
11 - ...new Set([...connectLinks, ...genericLinks].map(url => url.replace(/[.,;:!?]+$/g, ''))),
12 - ];
13 -};
14 -
15 -const stringifyUnknown = (value: unknown): string => {
16 - if (typeof value === 'string') return value;
17 - try {
18 - return JSON.stringify(value);
19 - } catch {
20 - return String(value);
21 - }
22 -};
6 +export { extractComposioConnectLinks } from '../auth-links';
7
8 export const applyAuthLinkHandlers = async (
9 capabilities: PiSessionToolCapabilities,
ts/packages/experimental/test/eve.test.ts new
+254
@@ -0,0 +1,254 @@
1 +import type { ExecuteToolFn, Tool, ToolExecuteResponse } from '@composio/core';
2 +import { describe, expect, it, vi } from 'vitest';
3 +import {
4 + EveProvider,
5 + defineComposioTools,
6 + denyEveToolCall,
7 + requireApprovalForTools,
8 +} from '../src/eve';
9 +
10 +const tool = (slug: string): Tool =>
11 + ({
12 + slug,
13 + name: slug,
14 + description: `desc ${slug}`,
15 + inputParameters: { type: 'object', properties: { q: { type: 'string' } } },
16 + }) as unknown as Tool;
17 +
18 +const ok = (data: Record<string, unknown> = {}): ToolExecuteResponse => ({
19 + data,
20 + error: null,
21 + successful: true,
22 +});
23 +
24 +describe('EveProvider', () => {
25 + it('identifies as the eve provider', () => {
26 + expect(new EveProvider().name).toBe('eve');
27 + });
28 +
29 + it('wraps tools by slug with description and schema', () => {
30 + const execute: ExecuteToolFn = vi.fn(async () => ok());
31 + const wrapped = new EveProvider().wrapTools([tool('GITHUB_CREATE_ISSUE')], execute);
32 + const eveTool = wrapped.GITHUB_CREATE_ISSUE;
33 + expect(eveTool).toBeDefined();
34 + expect(eveTool.description).toBe('desc GITHUB_CREATE_ISSUE');
35 + expect(eveTool.inputSchema).toEqual({ type: 'object', properties: { q: { type: 'string' } } });
36 + });
37 +
38 + it("executes through Composio's executeTool", async () => {
39 + const execute: ExecuteToolFn = vi.fn(async () => ok({ url: 'x' }));
40 + const wrapped = new EveProvider().wrapTools([tool('GMAIL_SEND_EMAIL')], execute);
41 + const result = await wrapped.GMAIL_SEND_EMAIL.execute({ q: 'hi' }, {} as never);
42 + expect(execute).toHaveBeenCalledWith('GMAIL_SEND_EMAIL', { q: 'hi' });
43 + expect(result).toEqual(ok({ url: 'x' }));
44 + });
45 +
46 + it('does not mutate the source schema in strict mode', () => {
47 + const source = {
48 + type: 'object',
49 + properties: {
50 + required: { type: 'string' },
51 + optional: { type: 'string' },
52 + },
53 + required: ['required'],
54 + } as const;
55 + const composioTool = {
56 + ...tool('GITHUB_CREATE_ISSUE'),
57 + inputParameters: source,
58 + } as unknown as Tool;
59 +
60 + const wrapped = new EveProvider({ strict: true }).wrapTools(
61 + [composioTool],
62 + vi.fn(async () => ok())
63 + );
64 +
65 + expect(source.properties).toHaveProperty('optional');
66 + expect(source).not.toHaveProperty('additionalProperties');
67 + expect(wrapped.GITHUB_CREATE_ISSUE.inputSchema).toEqual({
68 + type: 'object',
69 + properties: { required: { type: 'string' } },
70 + required: ['required'],
71 + additionalProperties: false,
72 + });
73 + });
74 +
75 + it('lets an execute hook deny a call', async () => {
76 + const execute: ExecuteToolFn = vi.fn(async () => ok());
77 + const provider = new EveProvider({
78 + hooks: { execute: ctx => ctx.deny('blocked') },
79 + });
80 + const wrapped = provider.wrapTools([tool('COMPOSIO_MULTI_EXECUTE_TOOL')], execute);
81 + const result = await wrapped.COMPOSIO_MULTI_EXECUTE_TOOL.execute({ q: 'x' }, {} as never);
82 + expect(execute).not.toHaveBeenCalled();
83 + expect(result).toEqual(denyEveToolCall('blocked'));
84 + });
85 +
86 + it('routes remote bash calls to the remoteBash hook', async () => {
87 + const execute: ExecuteToolFn = vi.fn(async () => ok());
88 + const provider = new EveProvider({
89 + hooks: { remoteBash: ctx => ctx.deny('shell blocked') },
90 + });
91 + const wrapped = provider.wrapTools([tool('COMPOSIO_REMOTE_BASH_TOOL')], execute);
92 +
93 + const result = await wrapped.COMPOSIO_REMOTE_BASH_TOOL.execute(
94 + { command: 'rm -rf /tmp/example' },
95 + {} as never
96 + );
97 +
98 + expect(execute).not.toHaveBeenCalled();
99 + expect(result).toEqual(denyEveToolCall('shell blocked'));
100 + });
101 +
102 + it("passes eve's tool context to hooks", async () => {
103 + const eveContext = { session: { id: 'eve-session' } } as never;
104 + const search = vi.fn((_ctx, next) => next());
105 + const provider = new EveProvider({ hooks: { search } });
106 + const wrapped = provider.wrapTools(
107 + [tool('COMPOSIO_SEARCH_TOOLS')],
108 + vi.fn(async () => ok())
109 + );
110 +
111 + await wrapped.COMPOSIO_SEARCH_TOOLS.execute({ q: 'calendar' }, eveContext);
112 +
113 + expect(search.mock.calls[0]?.[0].context.eve).toBe(eveContext);
114 + });
115 +
116 + it('maps approval policy onto wrapped tools', () => {
117 + const needsApproval = vi.fn(
118 + (composioTool: Tool) => composioTool.slug === 'LOCAL_IMESSAGE_SEND'
119 + );
120 + const provider = new EveProvider({ needsApproval });
121 + const wrapped = provider.wrapTools(
122 + [tool('LOCAL_IMESSAGE_SEND'), tool('GITHUB_GET_REPOSITORY')],
123 + vi.fn(async () => ok())
124 + );
125 + const context = {
126 + approvedTools: new Set<string>(),
127 + toolInput: { to: '+15551234567', text: 'test' },
128 + toolName: 'LOCAL_IMESSAGE_SEND',
129 + };
130 +
131 + expect(wrapped.LOCAL_IMESSAGE_SEND.needsApproval?.(context)).toBe(true);
132 + expect(wrapped.GITHUB_GET_REPOSITORY.needsApproval?.(context)).toBe(false);
133 + expect(needsApproval).toHaveBeenCalledWith(
134 + expect.objectContaining({ slug: 'LOCAL_IMESSAGE_SEND' }),
135 + context
136 + );
137 + });
138 +
139 + it('requires approval for protected tools nested in multi-execute', () => {
140 + const provider = new EveProvider({
141 + needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),
142 + });
143 + const wrapped = provider.wrapTools(
144 + [tool('COMPOSIO_MULTI_EXECUTE_TOOL')],
145 + vi.fn(async () => ok())
146 + );
147 +
148 + expect(
149 + wrapped.COMPOSIO_MULTI_EXECUTE_TOOL.needsApproval?.({
150 + approvedTools: new Set<string>(),
151 + toolInput: {
152 + tools: [
153 + { tool_slug: 'GMAIL_FETCH_EMAILS', arguments: {} },
154 + { tool_slug: 'LOCAL_IMESSAGE_SEND', arguments: { text: 'test' } },
155 + ],
156 + },
157 + toolName: 'COMPOSIO_MULTI_EXECUTE_TOOL',
158 + })
159 + ).toBe(true);
160 + });
161 +
162 + it('finds auth links in circular data containing bigint values', async () => {
163 + const circular: Record<string, unknown> = {
164 + connectionUrl: 'https://connect.composio.dev/link_123',
165 + sequence: 1n,
166 + };
167 + circular.self = circular;
168 +
169 + const onAuthLink = vi.fn((_ctx, next) => next());
170 + const provider = new EveProvider({ hooks: { onAuthLink } });
171 + const wrapped = provider.wrapTools(
172 + [tool('COMPOSIO_MANAGE_CONNECTIONS')],
173 + vi.fn(async () => ok(circular))
174 + );
175 +
176 + await wrapped.COMPOSIO_MANAGE_CONNECTIONS.execute({}, {} as never);
177 +
178 + expect(onAuthLink.mock.calls[0]?.[0].url).toBe('https://connect.composio.dev/link_123');
179 + });
180 +
181 + it('finds auth links in errors even when data cannot be serialized', async () => {
182 + const circular: Record<string, unknown> = {};
183 + circular.self = circular;
184 + Object.defineProperty(circular, 'broken', {
185 + enumerable: true,
186 + get: () => {
187 + throw new Error('unserializable');
188 + },
189 + });
190 + const onAuthLink = vi.fn((_ctx, next) => next());
191 + const provider = new EveProvider({ hooks: { onAuthLink } });
192 + const wrapped = provider.wrapTools(
193 + [tool('COMPOSIO_MANAGE_CONNECTIONS')],
194 + vi.fn(async () => ({
195 + data: circular,
196 + error: 'Connect at https://connect.composio.dev/link_123',
197 + successful: false,
198 + }))
199 + );
200 +
201 + await expect(
202 + wrapped.COMPOSIO_MANAGE_CONNECTIONS.execute({}, {} as never)
203 + ).resolves.toMatchObject({ successful: false });
204 + expect(onAuthLink.mock.calls[0]?.[0].url).toBe('https://connect.composio.dev/link_123');
205 + });
206 +});
207 +
208 +describe('defineComposioTools', () => {
209 + const resolve = (dynamic: ReturnType<typeof defineComposioTools>) =>
210 + dynamic.events['step.started'] as NonNullable<(typeof dynamic.events)['step.started']>;
211 +
212 + it('deduplicates concurrent discovery calls', async () => {
213 + let release: ((tools: Record<string, never>) => void) | undefined;
214 + const pending = new Promise<Record<string, never>>(done => {
215 + release = done;
216 + });
217 + const tools = vi.fn(() => pending);
218 + const handler = resolve(defineComposioTools({ tools }));
219 +
220 + const first = handler({}, {} as never);
221 + const second = handler({}, {} as never);
222 + release?.({});
223 +
224 + await expect(Promise.all([first, second])).resolves.toEqual([{}, {}]);
225 + expect(tools).toHaveBeenCalledTimes(1);
226 + });
227 +
228 + it('retries discovery after a transient failure', async () => {
229 + const tools = vi
230 + .fn<() => Promise<Record<string, never>>>()
231 + .mockRejectedValueOnce(new Error('temporary failure'))
232 + .mockResolvedValueOnce({});
233 + const handler = resolve(defineComposioTools({ tools }));
234 +
235 + await expect(handler({}, {} as never)).rejects.toThrow('temporary failure');
236 + await expect(handler({}, {} as never)).resolves.toEqual({});
237 + expect(tools).toHaveBeenCalledTimes(2);
238 + });
239 +
240 + it('caches independently for sessions returned by a resolver', async () => {
241 + const first = { tools: vi.fn(async () => ({})) };
242 + const second = { tools: vi.fn(async () => ({})) };
243 + const handler = resolve(
244 + defineComposioTools(context => (context.session.id === 'first' ? first : second))
245 + );
246 +
247 + await handler({}, { session: { id: 'first' } } as never);
248 + await handler({}, { session: { id: 'second' } } as never);
249 + await handler({}, { session: { id: 'first' } } as never);
250 +
251 + expect(first.tools).toHaveBeenCalledTimes(1);
252 + expect(second.tools).toHaveBeenCalledTimes(1);
253 + });
254 +});
ts/packages/experimental/test/pi.test.ts
+31
@@ -444,4 +444,35 @@ describe('PiProvider', () => {
444 })
445 ).toEqual(['https://connect.composio.dev/abc123']);
446 });
447 +
448 + it('extracts generic Composio auth links case-insensitively', () => {
449 + expect(extractComposioConnectLinks('Open HTTPS://auth.Composio.dev/LINK/abc123')).toEqual([
450 + 'HTTPS://auth.Composio.dev/LINK/abc123',
451 + ]);
452 + });
453 +
454 + it('returns connect links first and deduplicates links across classifiers', () => {
455 + const genericLink = 'https://auth.composio.dev/link/generic';
456 + const connectLink = 'https://connect.composio.dev/link/connect';
457 +
458 + expect(
459 + extractComposioConnectLinks(`${genericLink} ${connectLink} ${genericLink} ${connectLink}`)
460 + ).toEqual([connectLink, genericLink]);
461 + });
462 +
463 + it('trims repeated trailing punctuation from auth links', () => {
464 + const repeatedPunctuation = '!?.,;:'.repeat(5_000);
465 +
466 + expect(
467 + extractComposioConnectLinks(
468 + `Connect at https://connect.composio.dev/abc123${repeatedPunctuation} or https://auth.composio.dev/link/xyz!?.,`
469 + )
470 + ).toEqual(['https://connect.composio.dev/abc123', 'https://auth.composio.dev/link/xyz']);
471 + });
472 +
473 + it('handles long adversarial nonmatches without backtracking', () => {
474 + const nonMatch = `https://${'composio'.repeat(20_000)}/not-a-link`;
475 +
476 + expect(extractComposioConnectLinks(nonMatch)).toEqual([]);
477 + });
478 });
ts/packages/experimental/tsdown.config.ts
+1 -1
@@ -3,6 +3,6 @@ import { baseConfig } from '../../../tsdown.config.base.ts';
3
4 export default defineConfig({
5 ...baseConfig,
6 - entry: ['src/index.ts', 'src/workbench/index.ts'],
6 + entry: ['src/index.ts', 'src/eve/index.ts', 'src/workbench/index.ts'],
7 tsconfig: 'tsconfig.json',
8 });