Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(experimental): add Eve provider and iMessage example (#3800)
Alberto Schiabelb07fcada3fee
diff --git a/.changeset/experimental-eve-provider.md b/.changeset/experimental-eve-provider.mdnew file mode 100644index 000000000..a3470a101--- /dev/null+++ b/.changeset/experimental-eve-provider.md@@ -0,0 +1,8 @@+---+'@composio/experimental': minor+'@composio/core': patch+---++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.++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.diff --git a/docs/components/imessage-flow.tsx b/docs/components/imessage-flow.tsxnew file mode 100644index 000000000..e35633d12--- /dev/null+++ b/docs/components/imessage-flow.tsx@@ -0,0 +1,222 @@+import { Cpu, Globe, MessageSquare, Terminal } from 'lucide-react';+import type { ReactNode } from 'react';++const LOGO_CDN = 'https://logos.composio.dev/api';++const TOOLS: { slug: string; name: string; where: string; local?: boolean }[] = [+ { slug: 'imessage', name: 'iMessage', where: 'on your Mac', local: true },+ { slug: 'gmail', name: 'Gmail', where: 'catalog' },+ { slug: 'github', name: 'GitHub', where: 'catalog' },+];++/**+ * ImessageFlow — branded diagram for the iMessage example page.+ *+ * Reads left-to-right as one request: you type a prompt (or a trigger fires),+ * the eve agent picks a tool and runs it through a single session, and that+ * session carries both the local iMessage toolkit (running on your Mac) and the+ * rest of the Composio catalog (running remote). The reply ends in a text.+ *+ * Server component, no client JS. Adapts to light/dark via fd-* tokens.+ */+export function ImessageFlow() {+ return (+ <div className="not-prose my-6 overflow-hidden rounded-sm border border-fd-border bg-fd-background">+ {/* header strip — mono, matches the other branded flow visuals */}+ <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">+ <span>imessage.runtime</span>+ <span className="inline-flex items-center gap-1.5 text-fd-foreground/55">+ <span className="relative inline-flex">+ <span className="size-1.5 rounded-full bg-[var(--composio-brand)]" />+ <span className="absolute inset-0 animate-ping rounded-full bg-[var(--composio-brand)] opacity-60" />+ </span>+ running on your Mac+ </span>+ </div>++ <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)]">+ {/* ── You ────────────────────────────────────────────────── */}+ <Column>+ <Lane label="You" />+ <div className="flex flex-1 items-center">+ <div className="w-full border border-fd-border bg-fd-card p-3">+ <div className="flex items-center gap-2">+ <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] text-fd-foreground/70">+ <Terminal aria-hidden="true" className="size-3.5" />+ </span>+ <div className="min-w-0">+ <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">+ Prompt or trigger+ </div>+ <div className="truncate font-mono text-[10px] text-fd-foreground/45">+ text Shams a summary+ </div>+ </div>+ </div>+ <p className="mt-2.5 inline-flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.05em] text-[var(--composio-brand)]">+ you <Arrow /> eve+ </p>+ </div>+ </div>+ <Connector />+ </Column>++ {/* ── eve agent ──────────────────────────────────────────── */}+ <Column>+ <Lane label="eve agent" />+ <div className="flex flex-1 items-center">+ <div className="w-full border border-fd-border bg-fd-card p-3">+ <div className="flex items-center gap-2">+ <span className="flex size-7 items-center justify-center rounded-sm bg-fd-foreground/[0.06] font-mono text-[13px] text-fd-foreground/70">+ {'{ }'}+ </span>+ <div className="min-w-0">+ <div className="truncate text-[12px] font-medium leading-tight text-fd-foreground">+ eve agent+ </div>+ <div className="truncate font-mono text-[10px] text-fd-foreground/45">+ searches + executes+ </div>+ </div>+ </div>+ <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/55">+ Picks the tool it needs and runs it through the session.+ </p>+ </div>+ </div>+ <Connector accent />+ </Column>++ {/* ── Session (the hub) ──────────────────────────────────── */}+ <Column>+ <Lane label="Session" accent />+ <div className="flex flex-1 flex-col">+ <div className="relative flex-1 border border-[var(--composio-brand)]/30 bg-[var(--composio-brand)]/[0.04] p-3">+ <span+ aria-hidden="true"+ className="pointer-events-none absolute inset-y-0 left-0 w-[2px] bg-[var(--composio-brand)]"+ />+ <div className="flex items-center justify-between">+ <span className="font-mono text-[10px] uppercase tracking-[0.06em] text-[var(--composio-brand)]">+ one session+ </span>+ <span className="font-mono text-[10px] text-fd-foreground/45">user_123</span>+ </div>++ {/* The local iMessage toolkit alongside the remote catalog */}+ <ul className="mt-2.5 overflow-hidden rounded-sm border border-fd-border bg-fd-card">+ {TOOLS.map((tool, i) => (+ <li+ key={tool.slug}+ className={+ 'flex items-center gap-2 px-2.5 py-1.5' ++ (i < TOOLS.length - 1 ? ' border-b border-fd-border' : '')+ }+ >+ {tool.local ? (+ <MessageSquare+ aria-hidden="true"+ className="size-3.5 text-[var(--composio-brand)]"+ />+ ) : (+ <img+ alt=""+ aria-hidden="true"+ className="size-3.5 object-contain"+ draggable={false}+ src={`${LOGO_CDN}/${tool.slug}`}+ />+ )}+ <span className="text-[11px] text-fd-foreground/75">{tool.name}</span>+ <span className="font-mono text-[9px] text-fd-foreground/40">{tool.where}</span>+ <span+ className={+ 'ml-auto inline-flex items-center gap-1 font-mono text-[9px] uppercase tracking-[0.05em] ' ++ (tool.local ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/45')+ }+ >+ {tool.local ? (+ <>+ <Cpu aria-hidden="true" className="size-2.5" />+ local+ </>+ ) : (+ <>+ <Globe aria-hidden="true" className="size-2.5" />+ remote+ </>+ )}+ </span>+ </li>+ ))}+ </ul>++ <p className="mt-2.5 text-[11px] leading-snug text-fd-foreground/60">+ Local tools run in-process on your Mac; the rest of the catalog runs+ remote, all from one session.+ </p>+ </div>+ </div>+ </Column>+ </div>++ {/* footer caption */}+ <div className="border-t border-fd-border px-3 py-2 text-center font-mono text-[10px] text-fd-foreground/45">+ prompt <Arrow /> eve <Arrow /> session (local mac tools + remote catalog){' '}+ <Arrow /> text sent+ </div>+ </div>+ );+}++function Column({ children }: { children: ReactNode }) {+ return <div className="relative flex flex-col gap-2 bg-fd-background p-3">{children}</div>;+}++function Lane({ label, accent = false }: { label: string; accent?: boolean }) {+ return (+ <div className="flex items-center gap-1.5">+ <span+ className={'size-1.5 rounded-full ' + (accent ? 'bg-[var(--composio-brand)]' : 'bg-fd-foreground/30')}+ aria-hidden="true"+ />+ <span+ className={+ 'font-mono text-[10px] font-medium uppercase tracking-[0.07em] ' ++ (accent ? 'text-[var(--composio-brand)]' : 'text-fd-foreground/55')+ }+ >+ {label}+ </span>+ </div>+ );+}++/**+ * Desktop-only directional connector shown between columns. On mobile, the+ * stacked columns read top-to-bottom without a connector.+ */+function Connector({ accent = false }: { accent?: boolean }) {+ const color = accent ? 'bg-[var(--composio-brand)]/40' : 'bg-fd-border';+ const tip = accent ? 'border-l-[var(--composio-brand)]/50' : 'border-l-fd-border';+ return (+ <div+ aria-hidden="true"+ className="pointer-events-none absolute z-10 hidden md:block"+ style={{ right: '-7px', top: '50%' }}+ >+ <div className="flex items-center">+ <span className={'h-px w-3 ' + color} />+ <span className={'size-0 border-y-[3px] border-l-[5px] border-y-transparent ' + tip} />+ </div>+ </div>+ );+}++function Arrow() {+ return (+ <span aria-hidden="true" className="text-[var(--composio-brand)]">+ {'→'}+ </span>+ );+}diff --git a/docs/components/repo-browser-client.tsx b/docs/components/repo-browser-client.tsxindex 042854385..237d3202d 100644--- a/docs/components/repo-browser-client.tsx+++ b/docs/components/repo-browser-client.tsx@@ -16,7 +16,13 @@ export interface RepoFile {* the selected file's code on the right (@pierre/diffs). Code is prerendered on* the server so the first paint is correct; selection swaps which file shows.*/-export function RepoBrowserClient({ files }: { files: RepoFile[] }) {+export function RepoBrowserClient({+ files,+ heightClass = 'max-h-[640px]',+}: {+ files: RepoFile[];+ heightClass?: string;+}) {const paths = files.map((f) => f.path);const { model } = useFileTree({ paths, initialSelectedPaths: [paths[0]], initialExpansion: 'open' });const selected = useFileTreeSelection(model);@@ -26,10 +32,10 @@ export function RepoBrowserClient({ files }: { files: RepoFile[] }) {return (<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)]">- <div className="max-h-[640px] overflow-auto border-b border-fd-border p-2 md:border-b-0 md:border-r">+ <div className={`${heightClass} overflow-auto border-b border-fd-border p-2 md:border-b-0 md:border-r`}><FileTree model={model} /></div>- <div className="relative max-h-[640px] overflow-auto">+ <div className={`relative ${heightClass} overflow-auto`}><CopyButton text={file.contents} className="absolute right-2 top-2 z-10" /><Filekey={file.path}diff --git a/docs/components/repo-browser.tsx b/docs/components/repo-browser.tsxindex e2b7021c9..1b8571bfc 100644--- a/docs/components/repo-browser.tsx+++ b/docs/components/repo-browser.tsx@@ -3,6 +3,7 @@ import { RepoBrowserClient, type RepoFile } from './repo-browser-client';import slackBot from '@/lib/slack-bot-source.json';import localWorkbench from '@/lib/local-workbench-source.json';import standup from '@/lib/standup-bot-source.json';+import imessage from '@/lib/imessage-source.json';interface SourceFile {path: string;@@ -16,6 +17,7 @@ const SOURCES = {'slack-bot': slackBot,'local-workbench': localWorkbench,standup,+ imessage,} as const;/**@@ -30,9 +32,11 @@ const SOURCES = {export async function RepoBrowser({source = 'slack-bot',caption = 'a slice of the real project, the Composio files do the work',+ heightClass,}: {source?: keyof typeof SOURCES;caption?: string | null;+ heightClass?: string;}) {const data = SOURCES[source] as SourceFile[];@@ -50,7 +54,7 @@ export async function RepoBrowser({{caption}</div>) : null}- <RepoBrowserClient files={files} />+ <RepoBrowserClient files={files} heightClass={heightClass} /></div>);}diff --git a/docs/content/docs/providers/eve.mdx b/docs/content/docs/providers/eve.mdxnew file mode 100644index 000000000..558178af6--- /dev/null+++ b/docs/content/docs/providers/eve.mdx@@ -0,0 +1,175 @@+---+title: Eve+description: Use Composio tools inside eve agents.+keywords: [eve, agent framework, provider, experimental, typescript]+experimental: true+---++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.++<Callout type="warning">+ The eve provider is experimental and currently ships from `@composio/experimental` for TypeScript+ projects.+</Callout>++## Usage++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/`.++<Steps>+<Step>+**Install**++```bash+npm install @composio/core @composio/experimental eve @ai-sdk/openai+```++This walkthrough uses OpenAI directly as one concrete model provider. OpenAI is only an example:+you can use any model provider supported by eve by installing its AI SDK package and configuring+the corresponding credential.++</Step>++<Step>+**Configure credentials**++```txt title=".env.local"+COMPOSIO_API_KEY=xxxxxxxxx+OPENAI_API_KEY=xxxxxxxxx+```++`COMPOSIO_API_KEY` authenticates Composio tools. `OPENAI_API_KEY` authenticates the model call+directly with OpenAI; this setup does not route through Vercel AI Gateway.++</Step>++<Step>+**Configure the eve model**++```typescript title="agent/agent.ts"+import { openai } from '@ai-sdk/openai';+import { defineAgent } from 'eve';++export default defineAgent({+ model: openai('gpt-5.4-mini'),+});+```++To use another provider, replace `@ai-sdk/openai`, `OPENAI_API_KEY`, and `openai(...)` with the+equivalent package, credential, and model factory supported by eve. Passing a provider model object+calls that provider directly; an eve string model ID such as `openai/gpt-5.4-mini` uses Vercel AI+Gateway instead.++</Step>++<Step>+**Register the provider and create a session**++```typescript title="agent/session.ts"+// @noErrors+import { Composio } from '@composio/core';+import { EveProvider } from '@composio/experimental/eve';++const composio = new Composio({ provider: new EveProvider() });++export const session = composio.sessions.create('user_123', {+ toolkits: ['github', 'hackernews'], // optional: scope the session to specific apps+});+```++</Step>++<Step>+**Expose the tools to eve**++```typescript title="agent/tools/composio.ts"+// @noErrors+import { defineComposioTools } from '@composio/experimental/eve';+import { session } from '../session';++export default defineComposioTools(session);+```++`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))`.++</Step>+</Steps>++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.++<Callout type="info">+ eve's `defineTool` takes plain JSON Schema, so `EveProvider` passes Composio's `inputParameters`+ straight through. It does not convert to a zod schema, which would trip eve's dynamic-tool+ normalizer.+</Callout>++## Hooks++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.++```typescript+// @noErrors+import { EveProvider } from '@composio/experimental/eve';++const provider = new EveProvider({+ hooks: {+ search: (ctx, next) => {+ ctx.request.args.toolkits = ['github'];+ return next();+ },+ remoteBash: async (ctx, next) => {+ if (String(ctx.request.args.command ?? '').includes('rm -rf')) {+ return ctx.deny('Destructive commands are blocked.');+ }+ return next();+ },+ onAuthLink: async (ctx, next) => {+ await sendConnectionLinkToUser(ctx.url);+ return next();+ },+ },+});+```++Available hooks, each keyed on `EveProviderHooks`:++| Hook | Wraps |+| ------------------- | --------------------------------------------------------- |+| `search` | `COMPOSIO_SEARCH_TOOLS` |+| `manageConnections` | `COMPOSIO_MANAGE_CONNECTIONS` |+| `execute` | `COMPOSIO_MULTI_EXECUTE_TOOL` and `COMPOSIO_EXECUTE_TOOL` |+| `remoteWorkbench` | `COMPOSIO_REMOTE_WORKBENCH` |+| `remoteBash` | `COMPOSIO_REMOTE_BASH_TOOL` |+| `onAuthLink` | Any auth link found in a result |++`ctx.request` carries the meta-tool's raw `{ slug, args }`, and `ctx.deny` is also exported as `denyEveToolCall(reason)`.++### Require approval++Map Composio tools onto eve's durable approval flow with `needsApproval`. The callback receives the original Composio tool plus eve's approval context:++```typescript+// @noErrors+import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';++const provider = new EveProvider({+ needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),+});+```++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.++## Next++<Card+ icon={<BookOpen />}+ title="iMessage on eve"+ href="/examples/imessage-agent"+ description="A full example: a custom toolkit for local iMessage plus the eve provider, on one session."+/>+<Card+ icon={<BookOpen />}+ title="What is a session?"+ href="/docs/how-composio-works"+ description="How sessions scope users, tools, and auth, and how to reuse them across requests."+/>diff --git a/docs/content/docs/providers/meta.json b/docs/content/docs/providers/meta.jsonindex ce2acc382..0fa6323fa 100644--- a/docs/content/docs/providers/meta.json+++ b/docs/content/docs/providers/meta.json@@ -6,6 +6,7 @@"openai","vercel","pi",+ "eve","google","langchain","autogen",diff --git a/docs/content/examples/imessage-agent.mdx b/docs/content/examples/imessage-agent.mdxnew file mode 100644index 000000000..a28ab3f51--- /dev/null+++ b/docs/content/examples/imessage-agent.mdx@@ -0,0 +1,266 @@+---+title: iMessage custom toolkit with eve+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.+keywords:+ [custom toolkit, imessage, local tools, eve, provider, session, custom tools, macOS, applescript]+full: true+gallery:+ categories: [General agents, Background agents]+ logos: [gmail, linear, github]+ featured: true+ order: 3+---++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.++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.++```+you › read my last email and text Shams a summary+you › text mom i'm running 10 min late+you › what did Lena and I last text about?+```++The pattern is the takeaway, not iMessage specifically. It comes together from a handful of Composio pieces:++1. **A custom toolkit** wraps local iMessage (send, contacts, history, memory) as Composio tools.+2. **In-process execution** runs each tool right on your Mac through `session.execute`, with no remote API.+3. **One session** puts those local tools on the same surface as the 1000+ app catalog.+4. **The eve provider** turns `session.tools()` into [eve](https://github.com/vercel/eve)-native tools, so `eve dev` can call them.+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.++<ImessageFlow />++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.++## Setup++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`).++<Steps>+<Step>+**Install**++```bash+npm install @composio/core @composio/experimental eve+```++</Step>+<Step>+**Configure**++```txt title=".env.local"+COMPOSIO_API_KEY=xxxxxxxxx+```++</Step>+<Step>+**Grant macOS permissions** (prompted on first use): Automation for Messages, Contacts access, and Full Disk Access to read `chat.db`.+</Step>+</Steps>++## The custom toolkit++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:++<FileBuildup name="send" />++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:++```ts title="imessage/index.ts"+// @noErrors+import { experimental_createToolkit } from '@composio/core';+import { sendMessage } from './send-message';+import { findContact } from './find-contact';+import { readMessages } from './read-messages';+import { recallContact, rememberContact } from './memory-tools';++export function createImessageToolkit() {+ return experimental_createToolkit('IMESSAGE', {+ name: 'iMessage',+ description:+ "Send and read iMessages, look up contacts, and remember people, locally on the user's Mac.",+ tools: [sendMessage, findContact, readMessages, recallContact, rememberContact],+ });+}+```++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.++## Wire it up++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:++### Create the client with the eve provider++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.++<FileBuildup name="wiring" step={1} />++### Scope a session to the user++`sessions.create` gives this user their own toolset, already wired to the full Composio catalog.++<FileBuildup name="wiring" step={2} />++### Register the local toolkit++Pass the custom toolkit through `experimental.customToolkits`, and the local iMessage tools join the catalog on the same session.++<FileBuildup name="wiring" step={3} />++Now hand that session to eve. eve discovers tools from files, so `defineComposioTools(session)` returns the resolver that exposes `session.tools()`. One line:++```ts title="agent/tools/composio.ts"+// @noErrors+import { defineComposioTools } from '@composio/experimental/eve';+import { session } from '../../composio';++export default defineComposioTools(session);+```++```ts title="agent/agent.ts"+// @noErrors+import { defineAgent } from 'eve';++export default defineAgent({+ model: 'google/gemini-2.5-flash',+});+```++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`.++## Extend it: triggers++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.++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:++```ts title="agent/channels/triggers.ts"+// @noErrors+import { defineChannel, POST } from 'eve/channels';+import { composio } from '../../composio';++export default defineChannel({+ routes: [+ POST('/webhook', async (req, { send }) => {+ const { payload: event } = await composio.triggers.parse(req, {+ verifySecret: process.env.COMPOSIO_WEBHOOK_SECRET,+ });+ if (event.userId !== 'user_123' || event.triggerSlug !== 'LINEAR_ISSUE_ASSIGNED') {+ return new Response(null, { status: 202 });+ }+ await send(+ `A verified Linear assignment event arrived. Ask whether I want to inspect it. ` ++ `Do not call tools in this turn. Event reference: ${event.uuid}.`,+ {+ auth: {+ authenticator: 'composio-webhook',+ principalType: 'service',+ principalId: event.userId,+ attributes: { triggerSlug: event.triggerSlug },+ },+ continuationToken: event.uuid,+ }+ );+ return new Response(null, { status: 202 });+ }),+ ],+});+```++Point Composio at your webhook and create the trigger, once each. Reuse the same `composio` client from `composio.ts`:++```ts title="agent/setup-triggers.ts"+// @noErrors+import { composio } from '../composio';++// Register the webhook URL once per project; store the returned+// secret as COMPOSIO_WEBHOOK_SECRET.+const subscription = await composio.triggers.setWebhookSubscription({+ webhookUrl: `${process.env.APP_URL}/webhook`,+});++// Use the exact slug from the Composio triggers catalog.+const trigger = await composio.triggers.create('user_123', 'LINEAR_ISSUE_ASSIGNED');+console.log(`Trigger created: ${trigger.triggerId}`);+```++Run it once with `npx tsx agent/setup-triggers.ts`, and the webhook handler above takes over from there.++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.++## More reflexes++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:++```ts title="agent/channels/triggers.ts"+// @noErrors+import { defineChannel, POST } from 'eve/channels';+import { composio } from '../../composio';++export default defineChannel({+ routes: [+ POST('/webhook', async (req, { send }) => {+ const { payload: event } = await composio.triggers.parse(req, {+ verifySecret: process.env.COMPOSIO_WEBHOOK_SECRET,+ });+ if (event.userId !== 'user_123' || event.triggerSlug !== 'GMAIL_NEW_GMAIL_MESSAGE') {+ return new Response(null, { status: 202 });+ }+ await send(+ `A verified Gmail event arrived. Ask whether I want to inspect the email. ` ++ `Do not call tools in this turn. Event reference: ${event.uuid}.`,+ {+ auth: {+ authenticator: 'composio-webhook',+ principalType: 'service',+ principalId: event.userId,+ attributes: { triggerSlug: event.triggerSlug },+ },+ continuationToken: event.uuid,+ }+ );+ return new Response(null, { status: 202 });+ }),+ ],+});+```++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:++- **Stand-up nudge.** A calendar event ten minutes out texts you the agenda and the meeting link, pulled straight from the invite.+- **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.+- **Money in.** A successful Stripe payment texts you the amount and the customer, no dashboard required.+- **Cover for me.** A Slack mention while you're away texts a teammate and asks them to take a look.++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.++## Browse the project++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.++<RepoBrowser+ source="imessage"+ caption="a slice of the real project; the Composio files do the work"+ heightClass="min-h-[420px] max-h-[640px]"+/>++The complete, runnable project will be published in the Composio examples repo.++## Run it++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`.++<Cards>+ <Card+ title="eve provider"+ href="/docs/providers/eve"+ description="EveProvider, the defineComposioTools resolver, and the (ctx, next) hooks."+ />+ <Card+ title="Custom tools and toolkits"+ href="/docs/extending-sessions/custom-tools-and-toolkits"+ description="Build and register your own in-process Composio tools."+ />+</Cards>diff --git a/docs/content/examples/index.mdx b/docs/content/examples/index.mdxindex 448652628..b27de06fa 100644--- a/docs/content/examples/index.mdx+++ b/docs/content/examples/index.mdx@@ -9,4 +9,5 @@ End-to-end builds that wire Composio into working agents. Each one is a complete<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." /><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." /><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." />+ <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." /></Cards>diff --git a/docs/content/examples/meta.json b/docs/content/examples/meta.jsonindex 48e62b428..efbf84d39 100644--- a/docs/content/examples/meta.json+++ b/docs/content/examples/meta.json@@ -5,6 +5,7 @@"index","general-agent-with-pi","standup-slackbot",- "local-sandbox-pr-reviewer"+ "local-sandbox-pr-reviewer",+ "imessage-agent"]}diff --git a/docs/lib/file-builds.ts b/docs/lib/file-builds.tsindex 7a30c167a..77992d950 100644--- a/docs/lib/file-builds.ts+++ b/docs/lib/file-builds.ts@@ -6,9 +6,11 @@* - slack-bot-build: `bot`, `install` (general-agent-with-pi)* - local-workbench-build: `reviewer` (local-sandbox-pr-reviewer)* - standup-bot-build: `setup`, `proxy`, `buttons`, `draft` (daily standup bot)+ * - imessage-build: `wiring`, `send` (iMessage agent)*/import { FILE_BUILDS as slackBot } from './slack-bot-build';import { FILE_BUILDS as localWorkbench } from './local-workbench-build';import { FILE_BUILDS as standup } from './standup-bot-build';+import { FILE_BUILDS as imessage } from './imessage-build';-export const FILE_BUILDS = { ...slackBot, ...localWorkbench, ...standup };+export const FILE_BUILDS = { ...slackBot, ...localWorkbench, ...standup, ...imessage };diff --git a/docs/lib/imessage-build.ts b/docs/lib/imessage-build.tsnew file mode 100644index 000000000..b22d28c67--- /dev/null+++ b/docs/lib/imessage-build.ts@@ -0,0 +1,143 @@+/**+ * Cumulative stages of the iMessage SEND tool, built up one piece at a time.+ * Each stage's `code` is the full file at that point; <FileBuildup>+ * diffs consecutive stages so the reader watches the tool grow.+ */+export interface BuildStage {+ title: string;+ description: string;+ /** Full file contents at this stage. */+ code: string;+}++const shell = `import { experimental_createTool } from '@composio/core';+import { z } from 'zod/v3';++export const sendMessage = experimental_createTool('SEND', {+ name: 'Send iMessage',+ description: 'Send an iMessage from your Mac to a phone number or iMessage email.',+ preload: true,+ inputParams: z.object({}),+ execute: async () => ({ sent: false }),+});+`;++const typed = `import { experimental_createTool } from '@composio/core';+import { z } from 'zod/v3';++export const sendMessage = experimental_createTool('SEND', {+ name: 'Send iMessage',+ description: 'Send an iMessage from your Mac to a phone number or iMessage email.',+ preload: true,+ inputParams: z.object({+ to: z.string().describe('Phone number or iMessage email.'),+ text: z.string().describe('Message body to send.'),+ }),+ execute: async () => ({ sent: false }),+});+`;++const full = `import { experimental_createTool } from '@composio/core';+import { z } from 'zod/v3';+import { runAppleScript, SEND_SCRIPT } from './applescript';++export const sendMessage = experimental_createTool('SEND', {+ name: 'Send iMessage',+ description: 'Send an iMessage from your Mac to a phone number or iMessage email.',+ preload: true,+ inputParams: z.object({+ to: z.string().describe('Phone number or iMessage email.'),+ text: z.string().describe('Message body to send.'),+ }),+ execute: async ({ to, text }) => {+ await runAppleScript(SEND_SCRIPT, [to, text]);+ return { sent: true, to };+ },+});+`;++const wiringClient = `import { Composio } from '@composio/core';+import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';++export const composio = new Composio({+ provider: new EveProvider({+ needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),+ }),+});+`;++const wiringSession = `import { Composio } from '@composio/core';+import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';++export const composio = new Composio({+ provider: new EveProvider({+ needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),+ }),+});++export const session = composio.sessions.create('user_123');+`;++const wiringToolkit = `import { Composio } from '@composio/core';+import { EveProvider, requireApprovalForTools } from '@composio/experimental/eve';+import { createImessageToolkit } from './imessage';++export const composio = new Composio({+ provider: new EveProvider({+ needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),+ }),+});++export const session = composio.sessions.create('user_123', {+ experimental: { customToolkits: [createImessageToolkit()] },+});+`;++export const FILE_BUILDS: Record<string, { file: string; stages: BuildStage[] }> = {+ wiring: {+ file: 'composio.ts',+ stages: [+ {+ title: 'Client with the eve provider',+ description:+ 'The eve provider makes session.tools() return eve-native tools, so eve can call them directly.',+ code: wiringClient,+ },+ {+ title: 'A session for the user',+ description:+ 'sessions.create scopes the toolset to one user. It already exposes the whole Composio catalog.',+ code: wiringSession,+ },+ {+ title: 'Register the local toolkit',+ description:+ 'Pass the custom toolkit so the local iMessage tools join the catalog on the same session.',+ code: wiringToolkit,+ },+ ],+ },+ send: {+ file: 'imessage/send-message.ts',+ stages: [+ {+ title: 'The tool shell',+ description:+ 'A custom tool is a slug, a description, and an execute. preload:true surfaces it in session.tools() without a search step.',+ code: shell,+ },+ {+ title: 'Typed inputs',+ description:+ 'Declare the input schema with zod/v3, which the Composio custom-tool API expects.',+ code: typed,+ },+ {+ title: 'Send via AppleScript',+ description:+ 'The execute runs locally on your Mac, driving Messages.app through osascript.',+ code: full,+ },+ ],+ },+};diff --git a/docs/lib/imessage-source.json b/docs/lib/imessage-source.jsonnew file mode 100644index 000000000..458210bbd--- /dev/null+++ b/docs/lib/imessage-source.json@@ -0,0 +1,47 @@+[+ {+ "path": "imessage/send-message.ts",+ "composio": true,+ "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});"+ },+ {+ "path": "imessage/find-contact.ts",+ "composio": true,+ "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"+ },+ {+ "path": "imessage/read-messages.ts",+ "composio": true,+ "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"+ },+ {+ "path": "imessage/memory-tools.ts",+ "composio": true,+ "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"+ },+ {+ "path": "imessage/applescript.ts",+ "composio": false,+ "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"+ },+ {+ "path": "imessage/index.ts",+ "composio": true,+ "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"+ },+ {+ "path": "composio.ts",+ "composio": true,+ "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"+ },+ {+ "path": "agent/tools/composio.ts",+ "composio": true,+ "contents": "import { defineComposioTools } from '@composio/experimental/eve';\nimport { session } from '../../composio';\n\nexport default defineComposioTools(session);\n"+ },+ {+ "path": "agent/agent.ts",+ "composio": false,+ "contents": "import { defineAgent } from \"eve\";\n\nexport default defineAgent({\n model: \"google/gemini-2.5-flash\",\n});\n"+ }+]diff --git a/docs/lib/source.ts b/docs/lib/source.tsindex 071828eac..0d437081a 100644--- a/docs/lib/source.ts+++ b/docs/lib/source.ts@@ -297,7 +297,14 @@ export function mdxToCleanMarkdown(content: string): string {});- // RepoBrowser is an interactive file tree; point agents at the real repo instead.+ // RepoBrowser is an interactive file tree. The iMessage page intentionally+ // shows a source slice while its public runnable fixture is still pending.+ result = result.replace(+ /<RepoBrowser\b(?=[^>]*\bsource="imessage")[^>]*\/>/g,+ '\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'+ );++ // Point the existing Slack browser at its real repository.result = result.replace(/<RepoBrowser\b[^>]*\/>/g,'\n> The complete project is on GitHub: [composio-slack-bot](https://github.com/ComposioHQ/composio-slack-bot).\n'diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsxindex 9c663db97..7d11d6f22 100644--- a/docs/mdx-components.tsx+++ b/docs/mdx-components.tsx@@ -33,6 +33,7 @@ import { LocalSandboxBoundary } from '@/components/local-sandbox-boundary';import { FileBuildup } from '@/components/file-buildup';import { RepoBrowser } from '@/components/repo-browser';import { AppLogo } from '@/components/standup-example';+import { ImessageFlow } from '@/components/imessage-flow';import { WorkbenchFlow } from '@/components/workbench-flow';import { AuthConfigFlow } from '@/components/auth-config-flow';import { WhiteLabelFlow } from '@/components/white-label-flow';@@ -129,6 +130,7 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {FileBuildup,RepoBrowser,AppLogo,+ ImessageFlow,WorkbenchFlow,AuthConfigFlow,WhiteLabelFlow,diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex c730458ea..c295fb698 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -173,7 +173,7 @@ importers:version: 7.8.5tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.22.5@@ -1249,7 +1249,7 @@ importers:version: 3.2.0tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.22.5@@ -1273,7 +1273,7 @@ importers:version: 3.21.4tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1304,7 +1304,7 @@ importers:version: 1.5.0tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1347,7 +1347,7 @@ importers:version: 7.7.1tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.22.5@@ -1366,6 +1366,9 @@ importers:ts/packages/experimental:dependencies:+ safe-stable-stringify:+ specifier: ^2.5.0+ version: 2.5.0typebox:specifier: 1.3.3version: 1.3.3@@ -1376,9 +1379,12 @@ importers:'@earendil-works/pi-coding-agent':specifier: ^0.80.3version: 0.80.3(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])([email protected])+ eve:+ specifier: ^0.12.0+ version: 0.12.3(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@cloudflare/[email protected]))tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])tsx:specifier: 'catalog:'version: 4.22.5@@ -1399,7 +1405,7 @@ importers:version: 26.1.0tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1429,7 +1435,7 @@ importers:version: 6.0.219([email protected])tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1451,7 +1457,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1470,7 +1476,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1489,7 +1495,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1504,7 +1510,7 @@ importers:version: 1.2.1(@opentelemetry/[email protected])([email protected](@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected]))([email protected])tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1526,7 +1532,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1548,7 +1554,7 @@ importers:version: 6.0.219([email protected])tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1570,7 +1576,7 @@ importers:version: link:../../coretsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1588,7 +1594,7 @@ importers:version: 0.12.0(@aws-sdk/[email protected])(@cfworker/[email protected])(@smithy/[email protected])([email protected])([email protected])([email protected])tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1609,7 +1615,7 @@ importers:version: 7.0.14([email protected])tsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])typescript:specifier: 'catalog:'version: 6.0.3@@ -1668,7 +1674,7 @@ importers:version: link:@types/@babel/helper-validator-identifiertsdown:specifier: 'catalog:'- version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected]))+ version: 0.22.3(@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: 'catalog:'version: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))@@ -1706,6 +1712,12 @@ packages:peerDependencies:zod: ^3.25.76 || ^4.1.8+ '@ai-sdk/[email protected]':+ resolution: {integrity: sha512-W/1kLlPb6Bgbhwep3CA3R6do0HD7SXV5gyuz2XBLY1YABqgxYkw+IhEcjOYlmn9v+Tifjqy5yJqmWdSHMJhyPQ==}+ engines: {node: '>=22'}+ peerDependencies:+ zod: ^3.25.76 || ^4.1.8+'@ai-sdk/[email protected]':resolution: {integrity: sha512-ZdZzQnBxYfjJpWpSNkV+rRWycwTBhxyvwGvxcwx9g+WQoy3MK2xNahSySEgP9hD/X2xY9jkjd0xB67oDE3rLMA==}engines: {node: '>=22'}@@ -1754,6 +1766,12 @@ packages:peerDependencies:zod: ^3.25.76 || ^4.1.8+ '@ai-sdk/[email protected]':+ resolution: {integrity: sha512-7xnpAQLpW0KGIsh0CQERcIZuXEGqv7FtFW2BdFk14iuMxRMVpXhTVvEQyqkm6tWAbQ7OsGQJhO6M0Me9gHQ52g==}+ engines: {node: '>=22'}+ peerDependencies:+ zod: ^3.25.76 || ^4.1.8+'@ai-sdk/[email protected]':resolution: {integrity: sha512-oI0t3dvCoqWNV1I8o1Rybi2DXDvHES5r/TrwtJW90tuFLVepgJlftPxrcjh8vaSvjqC2diTuA2vXyjKAyHJm4A==}engines: {node: '>=22'}@@ -1780,6 +1798,10 @@ packages:resolution: {integrity: sha512-fr9Gs89prDWiuox/T+kCA+i2cJkHpxU5S+tr4megjTzRC27ZsvFhwjU/+XrqqMbvBUlfmXxTOYWy8ng45dsjIg==}engines: {node: '>=22'}+ '@ai-sdk/[email protected]':+ resolution: {integrity: sha512-Aca/KiGeRtMM7rOJ38Qio+Dc2V45PpiGoWgdrdtIkgM9zkhYpS043t0ggKoNOWgm/csv99XWGrfSF63PSkVeHw==}+ engines: {node: '>=22'}+'@ai-sdk/[email protected]':resolution: {integrity: sha512-pfPoy9J1B1xV7cqJ8MYHOsDYrMv5tR3+EMNfI249OhkD2uRakvav3Fo7XpD2luuN/YNCBY7KfEQc7vEV7KEtyw==}engines: {node: '>=22'}@@ -4236,6 +4258,12 @@ packages:peerDependencies:zod: ^3.25.76 || ^4.1.8+ resolution: {integrity: sha512-kOfIbf23FDkvvfDHOS1gIjImBF9MlYut8fEMlps57vvS622VKL1PeEDLJ181aVd2LPSiDr3SupAMSzI2rEaW3w==}+ engines: {node: '>=22'}+ peerDependencies:+ zod: ^3.25.76 || ^4.1.8+resolution: {integrity: sha512-qA82fZyD4xh9IDB+s3SvwbjwjR+GGRmJjTYMwON1uROj8vPDIQbPTZLLq6ZWTVESn9daeH1GMv0zKfVLwNU2sQ==}engines: {node: '>=22'}@@ -4496,6 +4524,10 @@ packages:resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}+ resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}+ engines: {node: ^14.18.0 || >=16.10.0}+resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==}engines: {node: '>=18'}@@ -4539,6 +4571,14 @@ packages:resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}engines: {node: '>= 8'}+ resolution: {integrity: sha512-iWx+1OMSG2aOHpjyf9AESOzkwsVdS49cXM9dVrI2PDhxU5l2RIWE/KG56gk4BbAnsMoycvniJ9OnOxO9LRzHVA==}+ peerDependencies:+ srvx: '>=0.11.5'+ peerDependenciesMeta:+ srvx:+ optional: true+resolution: {integrity: sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==}engines: {node: '>=12'}@@ -4547,6 +4587,29 @@ packages:resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}engines: {node: '>= 12'}+ resolution: {integrity: sha512-RiXXi4WaNzPTHEOu8UPQKMooIbqOEyqA1t7Z6MsdxSCeb8iUC9ko3LcmsLmeUt2SM5bctfArZKkRQggKZz7JNw==}+ peerDependencies:+ '@electric-sql/pglite': '*'+ '@libsql/client': '*'+ better-sqlite3: '*'+ drizzle-orm: '*'+ mysql2: '*'+ sqlite3: '*'+ peerDependenciesMeta:+ '@electric-sql/pglite':+ optional: true+ '@libsql/client':+ optional: true+ better-sqlite3:+ optional: true+ drizzle-orm:+ optional: true+ mysql2:+ optional: true+ sqlite3:+ optional: true+resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}engines: {node: '>=6.0'}@@ -4679,6 +4742,24 @@ packages:resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}engines: {node: '>=0.12'}+ resolution: {integrity: sha512-2LRJM4P2KLX6J83QZZrMqvgCDt/D5ea7wPcI3yYiy5cG/9rX5QwdwZFx0D7ktWnjdRyZxYjttGGorb5nFqb1CA==}+ hasBin: true+ peerDependencies:+ '@netlify/runtime': ^4.1.23+ '@vercel/queue': '>=0.2.0'+ miniflare: ^4.20260515.0+ wrangler: ^4.0.0+ peerDependenciesMeta:+ '@netlify/runtime':+ optional: true+ '@vercel/queue':+ optional: true+ miniflare:+ optional: true+ wrangler:+ optional: true+resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==}engines: {node: '>=18'}@@ -4784,6 +4865,47 @@ packages:resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-SEMC0WiCT0tNd+8Tm1IUbTNTHmzHoeyX5UBOtFVi+E6dIWGarIzDkGllUwkpwnb5ZylKZnF8TriR3bufO4bwfw==}+ engines: {node: '>=24'}+ hasBin: true+ peerDependencies:+ '@opentelemetry/api': ^1.0.0+ '@sveltejs/kit': ^2.0.0+ ai: 7.0.0-beta.178+ braintrust: ^3.0.0+ just-bash: ^3.0.0+ microsandbox: ^0.5.0+ next: ^16.0.0+ nuxt: ^4.0.0+ react: ^19.0.0+ svelte: ^5.0.0+ vite: ^8.0.0+ vue: ^3.5.0+ peerDependenciesMeta:+ '@opentelemetry/api':+ optional: true+ '@sveltejs/kit':+ optional: true+ braintrust:+ optional: true+ just-bash:+ optional: true+ microsandbox:+ optional: true+ next:+ optional: true+ nuxt:+ optional: true+ react:+ optional: true+ svelte:+ optional: true+ vite:+ optional: true+ vue:+ optional: true+resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}@@ -4820,6 +4942,9 @@ packages:resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==}engines: {node: '>= 18'}+ resolution: {integrity: sha512-D+42+T12DdIlJM3uepa55qGiL3sYdLBOxIl2ifQCzCHz4c7eiolaHsi3BIqEr7JxBzxv2pYZQX9kw16ziMcEmw==}+resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}engines: {node: '>=0.10.0'}@@ -5036,6 +5161,16 @@ packages:resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}engines: {node: '>=6.0'}+ resolution: {integrity: sha512-Esv0DMIuPkCTSWCA0vO73vcTqwzH1wjSrAO1TXNu/K3up1sZHa9EKMapbmxCDYBeymC3fVTk4qxp7ogQWQ+KgA==}+ engines: {node: '>=20.11.1'}+ hasBin: true+ peerDependencies:+ crossws: ^0.4.1+ peerDependenciesMeta:+ crossws:+ optional: true+resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}engines: {node: '>=8'}@@ -5081,6 +5216,9 @@ packages:resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}engines: {node: '>= 14'}+ resolution: {integrity: sha512-URfeibL0kTH6VuIxxaJDXWQWEk8fKr+9L8MGv6CuAiNy0fGnoVhWbXBvJR1mkdsvCDUxvhX9cW60k2AhtH5s6w==}+resolution: {integrity: sha512-K3GbkIWqyvvlpfhBPlbEvD97TtqBpAYA4kt+cn2lD2x2HuohzZCibcA2nOlnJT6exqvJLggoB5nv2dNf192nEA==}hasBin: true@@ -5646,6 +5784,40 @@ packages:resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-tfOXX/ivQBL+4km/fzxQ0HWMmp1Ewx/YpFLbya080gXVfm26bZy0n4a5K5PPnqTLyuAHu0FobVpXXUadIiIwIQ==}++ resolution: {integrity: sha512-KPb4L5yaF/Rx/xoGMpgHRJvZhbhGiqbRKOwwPLCH9jKTKTsEUHLjnJas85AeCzaswqa8Wi52eQBtRsODC4PS0Q==}+ engines: {node: ^20.19.0 || >=22.12.0}+ hasBin: true+ peerDependencies:+ '@vercel/queue': ^0.3.0+ dotenv: '*'+ giget: '*'+ jiti: ^2.7.0+ rollup: ^4.61.1+ vite: ^7 || ^8+ xml2js: ^0.6.2+ zephyr-agent: ^0.2.0+ peerDependenciesMeta:+ '@vercel/queue':+ optional: true+ dotenv:+ optional: true+ giget:+ optional: true+ jiti:+ optional: true+ rollup:+ optional: true+ vite:+ optional: true+ xml2js:+ optional: true+ zephyr-agent:+ optional: true+resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==}@@ -5690,6 +5862,15 @@ packages:resolution: {integrity: sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==}engines: {node: '>=12.20.0'}+ resolution: {integrity: sha512-kNNnkkVQup/QDvmTz8Q84wc2ntiyoVHDxa6eHWKt5qdGAmFRBIxy83rxgCYEjW0x06UJ9E3P6VgM2yY4rOBH4w==}++ resolution: {integrity: sha512-zpYTCs2byOuft65vI3z43Dd6iSdFbOZZLb9/d21aCpx2rGastVU9dOCv0lu4ykc1Ur1anAYjDi3SUvR0vq50JA==}++ resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==}+resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}engines: {node: '>= 0.8'}@@ -6113,6 +6294,9 @@ packages:engines: {node: '>=18.0.0', npm: '>=8.0.0'}hasBin: true+ resolution: {integrity: sha512-ePa+XGk00/3HuCqrEnK3LxJW7I0SdNg6EFzKUJG73hMAdDcOUC/i/aSz7LSDwLrGr33kal/rqOGydzwl6U7zBA==}+resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}engines: {node: '>= 18'}@@ -6131,6 +6315,10 @@ packages:resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}+ resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==}+ engines: {node: '>=10'}+resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}@@ -6236,6 +6424,11 @@ packages:resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}+ resolution: {integrity: sha512-GWTHjKMeekX8CwJf4VU9Oo6mJpSGaflGMddbCvR+Cmmh9sslRMiGbAoqqZacE0r1ncARh6buCEETr2W52F8b1w==}+ engines: {node: '>=20.16.0'}+ hasBin: true+resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}@@ -6554,6 +6747,80 @@ packages:synckit:optional: true+ resolution: {integrity: sha512-ELPztchk2zgFJnakyodVY3vJWGW9jy//keJ32IOJVGUMyaPydwcA1FtVvWqT0TNRch9H+cMNEGllfVFfScImog==}+ peerDependencies:+ '@azure/app-configuration': ^1.11.0+ '@azure/cosmos': ^4.9.1+ '@azure/data-tables': ^13.3.2+ '@azure/identity': ^4.13.0+ '@azure/keyvault-secrets': ^4.10.0+ '@azure/storage-blob': ^12.31.0+ '@capacitor/preferences': ^6 || ^7 || ^8+ '@deno/kv': '>=0.13.0'+ '@netlify/blobs': ^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0+ '@planetscale/database': ^1.19.0+ '@upstash/redis': ^1.36.2+ '@vercel/blob': '>=0.27.3'+ '@vercel/functions': ^2.2.12 || ^3.0.0+ '@vercel/kv': ^1.0.1+ aws4fetch: ^1.0.20+ chokidar: ^4 || ^5+ db0: '>=0.3.4'+ idb-keyval: ^6.2.2+ ioredis: ^5.9.3+ lru-cache: ^11.2.6+ mongodb: ^6 || ^7+ ofetch: '*'+ uploadthing: ^7.7.4+ peerDependenciesMeta:+ '@azure/app-configuration':+ optional: true+ '@azure/cosmos':+ optional: true+ '@azure/data-tables':+ optional: true+ '@azure/identity':+ optional: true+ '@azure/keyvault-secrets':+ optional: true+ '@azure/storage-blob':+ optional: true+ '@capacitor/preferences':+ optional: true+ '@deno/kv':+ optional: true+ '@netlify/blobs':+ optional: true+ '@planetscale/database':+ optional: true+ '@upstash/redis':+ optional: true+ '@vercel/blob':+ optional: true+ '@vercel/functions':+ optional: true+ '@vercel/kv':+ optional: true+ aws4fetch:+ optional: true+ chokidar:+ optional: true+ db0:+ optional: true+ idb-keyval:+ optional: true+ ioredis:+ optional: true+ lru-cache:+ optional: true+ mongodb:+ optional: true+ ofetch:+ optional: true+ uploadthing:+ optional: true+resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==}@@ -6824,6 +7091,13 @@ snapshots:'@vercel/oidc': 3.2.0zod: 4.4.3+ '@ai-sdk/[email protected]([email protected])':+ dependencies:+ '@ai-sdk/provider': 4.0.0-beta.19+ '@ai-sdk/provider-utils': 5.0.0-beta.49([email protected])+ '@vercel/oidc': 3.2.0+ zod: 4.4.3+'@ai-sdk/[email protected]([email protected])':dependencies:'@ai-sdk/provider': 4.0.2@@ -6922,6 +7196,14 @@ snapshots:eventsource-parser: 3.1.0zod: 4.4.3+ '@ai-sdk/[email protected]([email protected])':+ dependencies:+ '@ai-sdk/provider': 4.0.0-beta.19+ '@standard-schema/spec': 1.1.0+ '@workflow/serde': 4.1.0+ eventsource-parser: 3.1.0+ zod: 4.4.3+'@ai-sdk/[email protected]([email protected])':dependencies:'@ai-sdk/provider': 4.0.2@@ -6958,6 +7240,10 @@ snapshots:dependencies:json-schema: 0.4.0+ '@ai-sdk/[email protected]':+ dependencies:+ json-schema: 0.4.0+'@ai-sdk/[email protected]':dependencies:json-schema: 0.4.0@@ -9413,7 +9699,7 @@ snapshots:sirv: 3.0.2tinyglobby: 0.2.17tinyrainbow: 3.1.0- vitest: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ vitest: 4.1.9(@opentelemetry/[email protected])(@types/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))'@vitest/[email protected]':dependencies:@@ -9493,6 +9779,13 @@ snapshots:'@opentelemetry/api': 1.9.1zod: 4.4.3+ dependencies:+ '@ai-sdk/gateway': 4.0.0-beta.109([email protected])+ '@ai-sdk/provider': 4.0.0-beta.19+ '@ai-sdk/provider-utils': 5.0.0-beta.49([email protected])+ zod: 4.4.3+dependencies:'@ai-sdk/gateway': 4.0.11([email protected])@@ -9743,6 +10036,8 @@ snapshots:+ [email protected]: {}+@@ -9774,12 +10069,18 @@ snapshots:shebang-command: 2.0.0which: 2.0.2+ optionalDependencies:+ srvx: 0.11.21+dependencies:type-fest: 1.4.0+ [email protected]: {}+dependencies:ms: 2.1.3@@ -9885,6 +10186,16 @@ snapshots:+ dependencies:+ crossws: 0.4.9([email protected])+ exsolve: 1.1.0+ httpxy: 0.5.4+ srvx: 0.11.21+ optionalDependencies:+ miniflare: 4.20260701.0+ wrangler: 4.107.0(@cloudflare/[email protected])+@@ -10043,6 +10354,52 @@ snapshots:+ [email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@cloudflare/[email protected])):+ dependencies:+ ai: 7.0.0-beta.178([email protected])+ nitro: 3.0.260610-beta([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@cloudflare/[email protected]))+ optionalDependencies:+ '@opentelemetry/api': 1.9.0+ transitivePeerDependencies:+ - '@azure/app-configuration'+ - '@azure/cosmos'+ - '@azure/data-tables'+ - '@azure/identity'+ - '@azure/keyvault-secrets'+ - '@azure/storage-blob'+ - '@capacitor/preferences'+ - '@deno/kv'+ - '@electric-sql/pglite'+ - '@libsql/client'+ - '@netlify/blobs'+ - '@netlify/runtime'+ - '@planetscale/database'+ - '@upstash/redis'+ - '@vercel/blob'+ - '@vercel/functions'+ - '@vercel/kv'+ - '@vercel/queue'+ - aws4fetch+ - better-sqlite3+ - chokidar+ - dotenv+ - drizzle-orm+ - giget+ - idb-keyval+ - ioredis+ - jiti+ - lru-cache+ - miniflare+ - mongodb+ - mysql2+ - rollup+ - sqlite3+ - uploadthing+ - wrangler+ - xml2js+ - zephyr-agent+@@ -10110,6 +10467,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+dependencies:is-extendable: 0.1.1@@ -10353,6 +10712,13 @@ snapshots:section-matter: 1.0.0strip-bom-string: 1.0.0+ dependencies:+ rou3: 0.8.1+ srvx: 0.11.21+ optionalDependencies:+ crossws: 0.4.9([email protected])+@@ -10408,6 +10774,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+@@ -11099,6 +11467,61 @@ snapshots:+ [email protected]: {}++ [email protected]([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))([email protected](@cloudflare/[email protected])):+ dependencies:+ consola: 3.4.2+ crossws: 0.4.9([email protected])+ db0: 0.3.4+ h3: 2.0.1-rc.22([email protected]([email protected]))+ hookable: 6.1.1+ nf3: 0.3.19+ ocache: 0.1.5+ ofetch: 2.0.0-alpha.3+ ohash: 2.0.11+ rolldown: 1.1.4+ srvx: 0.11.21+ unenv: 2.0.0-rc.24+ optionalDependencies:+ dotenv: 17.4.2+ jiti: 2.7.0+ rollup: 4.62.2+ transitivePeerDependencies:+ - '@azure/app-configuration'+ - '@azure/cosmos'+ - '@azure/data-tables'+ - '@azure/identity'+ - '@azure/keyvault-secrets'+ - '@azure/storage-blob'+ - '@capacitor/preferences'+ - '@deno/kv'+ - '@electric-sql/pglite'+ - '@libsql/client'+ - '@netlify/blobs'+ - '@netlify/runtime'+ - '@planetscale/database'+ - '@upstash/redis'+ - '@vercel/blob'+ - '@vercel/functions'+ - '@vercel/kv'+ - aws4fetch+ - better-sqlite3+ - chokidar+ - drizzle-orm+ - idb-keyval+ - ioredis+ - lru-cache+ - miniflare+ - mongodb+ - mysql2+ - sqlite3+ - uploadthing+ - wrangler+@@ -11136,6 +11559,14 @@ snapshots:+ dependencies:+ ohash: 2.0.11++ [email protected]: {}++ [email protected]: {}+dependencies:ee-first: 1.1.1@@ -11579,6 +12010,8 @@ snapshots:'@rollup/rollup-win32-x64-msvc': 4.62.2fsevents: 2.3.3+ [email protected]: {}+dependencies:debug: 4.4.3([email protected])@@ -11601,6 +12034,8 @@ snapshots:+ [email protected]: {}+@@ -11749,6 +12184,8 @@ snapshots:+ [email protected]: {}+@@ -11882,7 +12319,7 @@ snapshots:'@ts-morph/common': 0.29.0code-block-writer: 13.0.3- [email protected](@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected](@emnapi/[email protected])(@emnapi/[email protected])):+ [email protected](@arethetypeswrong/[email protected])(@typescript/[email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:ansis: 4.3.1cac: 7.0.0@@ -12042,6 +12479,12 @@ snapshots:- '@emnapi/runtime'optional: true+ optionalDependencies:+ db0: 0.3.4+ lru-cache: 11.5.1+ ofetch: 2.0.0-alpha.3+diff --git a/ts/packages/core/src/models/ToolRouterSession.ts b/ts/packages/core/src/models/ToolRouterSession.tsindex 150a07047..e9ebeac6e 100644--- a/ts/packages/core/src/models/ToolRouterSession.ts+++ b/ts/packages/core/src/models/ToolRouterSession.ts@@ -766,11 +766,23 @@ export class ToolRouterSession<);}- const [localResults, remoteResult] = await Promise.all([+ const [localResults, remoteOutcome] = await Promise.all([Promise.all(localPromises),- remotePromise,+ remotePromise+ ? remotePromise.then(result => ({ result })).catch(error => ({ error }))+ : undefined,]);+ const remoteTransportFailed = !!remoteOutcome && 'error' in remoteOutcome;+ const remoteTransportError = remoteTransportFailed ? remoteOutcome.error : null;+ const remoteErrorMessage = remoteTransportFailed+ ? (remoteTransportError instanceof Error+ ? remoteTransportError.message+ : String(remoteTransportError)) || 'Remote tool execution failed'+ : null;+ const remoteResult =+ remoteOutcome && 'result' in remoteOutcome ? remoteOutcome.result : undefined;+// If only local tools, return the single/first result unwrappedif (remoteIndices.length === 0 && localResults.length === 1) {return localResults[0].result;@@ -784,9 +796,15 @@ export class ToolRouterSession<? remoteResult.data: {}) as Record<string, unknown>;- const remoteResults = (- Array.isArray(remoteData.results) ? remoteData.results : []- ) as unknown[];+ const remoteResults = remoteErrorMessage+ ? remoteIndices.map(index => ({+ response: { successful: false, data: {}, error: remoteErrorMessage },+ tool_slug: parsed[index].tool_slug,+ error: remoteErrorMessage,+ }))+ : ((Array.isArray(remoteData.results) ? remoteData.results : []) as Array<+ Record<string, unknown>+ >);// Build local result entries matching backend formatconst localEntries = localResults.map(({ index, result }) => ({@@ -796,20 +814,22 @@ export class ToolRouterSession<...(result.error ? { error: result.error } : {}),},tool_slug: parsed[index].tool_slug,+ index,...(result.error ? { error: result.error } : {}),}));- // Merge and re-index sequentially so there are no collisions+ // Restore original request order, then re-index sequentially so there are no collisions.const merged: Array<Record<string, unknown>> = [- ...(remoteResults as Array<Record<string, unknown>>),- ...localEntries,- ];- const allResults = merged.map(- (entry, i): Record<string, unknown> => ({+ ...remoteResults.map((entry, remotePosition) => ({...entry,- index: i,- })- );+ index: remoteIndices[remotePosition] ?? remotePosition,+ })),+ ...localEntries,+ ].sort((a, b) => Number(a.index) - Number(b.index));+ const allResults = merged.map((entry, i): Record<string, unknown> => ({+ ...entry,+ index: i,+ }));const failedCount = allResults.filter(r => r.error).length;const mergedData: Record<string, unknown> = {...remoteData,@@ -817,13 +837,15 @@ export class ToolRouterSession<};if (localEntries.length > 0 &&- ['total_count', 'success_count', 'error_count'].some(key => key in remoteData)+ (remoteErrorMessage ||+ ['total_count', 'success_count', 'error_count'].some(key => key in remoteData))) {mergedData.total_count = allResults.length;mergedData.success_count = allResults.length - failedCount;mergedData.error_count = failedCount;}- const remoteError = typeof remoteResult?.error === 'string' ? remoteResult.error : null;+ const remoteError =+ remoteErrorMessage ?? (typeof remoteResult?.error === 'string' ? remoteResult.error : null);const hasAnyError = localResults.some(r => r.result.error) || !!remoteError;return {diff --git a/ts/packages/core/test/models/customToolRouting.test.ts b/ts/packages/core/test/models/customToolRouting.test.tsindex d4a66e42d..ad1ad09b2 100644--- a/ts/packages/core/test/models/customToolRouting.test.ts+++ b/ts/packages/core/test/models/customToolRouting.test.ts@@ -714,6 +714,12 @@ describe('ToolRouterSession execution routing', () => {expect(findResult(results, 'LOCAL_META_ADS_GET_AD_ACCOUNTS')).toBeDefined();expect(findResult(results, 'GMAIL_SEND_EMAIL')).toBeDefined();expect(findResult(results, 'SLACK_POST_MESSAGE')).toBeDefined();+ expect(results.map((entry: any) => entry.tool_slug)).toEqual([+ 'LOCAL_GET_USER_CONTEXT',+ 'GMAIL_SEND_EMAIL',+ 'LOCAL_META_ADS_GET_AD_ACCOUNTS',+ 'SLACK_POST_MESSAGE',+ ]);const backendTools = toolsInstance.executeSessionTool.mock.calls[0][1].arguments.tools;expect(backendTools).toHaveLength(2);@@ -727,6 +733,30 @@ describe('ToolRouterSession execution routing', () => {expect(result.successful).toBe(true);});+ it('should preserve successful local results when remote transport fails', async () => {+ const { executeFn, toolsInstance } = await setupMultiExecute(mockClient, [customToolHandle]);++ toolsInstance.executeSessionTool.mockRejectedValueOnce(new Error('remote unavailable'));++ const result = await executeFn('COMPOSIO_MULTI_EXECUTE_TOOL', {+ tools: [+ { tool_slug: 'LOCAL_GET_USER_CONTEXT', arguments: { category: 'safe-retry' } },+ { tool_slug: 'GMAIL_SEND_EMAIL', arguments: { to: '[email protected]' } },+ ],+ sync_response_to_workbench: false,+ });++ expect(result.successful).toBe(false);+ expect(localExecute).toHaveBeenCalledTimes(1);+ expect(findResult(result.data.results, 'LOCAL_GET_USER_CONTEXT')).toMatchObject({+ response: { successful: true, data: { local_result: true } },+ });+ expect(findResult(result.data.results, 'GMAIL_SEND_EMAIL')).toMatchObject({+ response: { successful: false, error: 'remote unavailable' },+ error: 'remote unavailable',+ });+ });+it('should recompute remote counters when local results are merged', async () => {const { executeFn, toolsInstance } = await setupMultiExecute(mockClient, [customToolHandle]);diff --git a/ts/packages/experimental/README.md b/ts/packages/experimental/README.mdindex 8f2b0ddfd..308b159df 100644--- a/ts/packages/experimental/README.md+++ b/ts/packages/experimental/README.md@@ -2,7 +2,10 @@Experimental Composio integrations and helpers.-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`.+This package currently includes two framework providers:++- 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`.+- An **eve provider** for the [eve](https://github.com/vercel/eve) agent framework (see [eve provider](#eve-provider) below).## Install@@ -185,6 +188,27 @@ const tools = provider.createSessionTools({});```+## eve provider++`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.++```ts+import { Composio } from '@composio/core';+import { EveProvider, defineComposioTools } from '@composio/experimental/eve';++const composio = new Composio({ provider: new EveProvider() });+const session = composio.sessions.create('user_123', {+ /* toolkits, customToolkits */+});++// Expose the tools to eve from agent/tools/<name>.ts:+export default defineComposioTools(session);+```++`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.++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.+## StatusExperimental. The dynamic helper names and session helper API may change.diff --git a/ts/packages/experimental/package.json b/ts/packages/experimental/package.jsonindex ba2d13553..bf82d55c4 100644--- a/ts/packages/experimental/package.json+++ b/ts/packages/experimental/package.json@@ -30,6 +30,10 @@"./workbench": {"types": "./dist/workbench/index.d.mts","default": "./dist/workbench/index.mjs"+ },+ "./eve": {+ "types": "./dist/eve/index.d.mts",+ "default": "./dist/eve/index.mjs"}},"files": [@@ -49,21 +53,33 @@"experimental","pi","coding-agent",+ "eve","tools","agent"],"author": "","license": "ISC","dependencies": {+ "safe-stable-stringify": "^2.5.0","typebox": "1.3.3"},"peerDependencies": {"@composio/core": ">=0.10.0 <1.0.0",- "@earendil-works/pi-coding-agent": ">=0.79.0 <1.0.0"+ "@earendil-works/pi-coding-agent": ">=0.79.0 <1.0.0",+ "eve": ">=0.12.0 <1.0.0"+ },+ "peerDependenciesMeta": {+ "@earendil-works/pi-coding-agent": {+ "optional": true+ },+ "eve": {+ "optional": true+ }},"devDependencies": {"@composio/core": "workspace:*","@earendil-works/pi-coding-agent": "^0.80.3",+ "eve": "^0.12.0","tsdown": "catalog:","tsx": "catalog:","typescript": "catalog:",diff --git a/ts/packages/experimental/src/auth-links.ts b/ts/packages/experimental/src/auth-links.tsnew file mode 100644index 000000000..187452e8d--- /dev/null+++ b/ts/packages/experimental/src/auth-links.ts@@ -0,0 +1,80 @@+import { configure } from 'safe-stable-stringify';++const HTTPS_PREFIX = 'https://';+const CONNECT_LINK_PREFIX = 'https://connect.composio.dev/';+const COMPOSIO_MARKER = 'composio';+const LINK_PATH_MARKER = '/link/';+const URL_BOUNDARIES = new Set(['<', '>', ')', '"', "'"]);+const TRAILING_PUNCTUATION = new Set(['.', ',', ';', ':', '!', '?']);+const stringify = configure({ deterministic: false });++const stringifyUnknown = (value: unknown): string => {+ if (typeof value === 'string') return value;++ try {+ const serialized = stringify(value);+ if (serialized === undefined) return '';+ return serialized;+ } catch {+ return '';+ }+};++const isUrlBoundary = (character: string): boolean =>+ URL_BOUNDARIES.has(character) || character.trim().length === 0;++const trimTrailingPunctuation = (url: string): string => {+ let end = url.length;++ while (end > 0 && TRAILING_PUNCTUATION.has(url[end - 1]!)) {+ end -= 1;+ }++ return url.slice(0, end);+};++const classifyToken = (+ token: string,+ connectLinks: Set<string>,+ genericLinks: Set<string>+): void => {+ const normalizedToken = token.toLowerCase();+ const httpsStart = normalizedToken.indexOf(HTTPS_PREFIX);+ if (httpsStart === -1) return;++ const connectStart = normalizedToken.indexOf(CONNECT_LINK_PREFIX, httpsStart);+ if (connectStart !== -1 && connectStart + CONNECT_LINK_PREFIX.length < token.length) {+ connectLinks.add(trimTrailingPunctuation(token.slice(connectStart)));+ }++ const composioStart = normalizedToken.indexOf(COMPOSIO_MARKER, httpsStart + HTTPS_PREFIX.length);+ if (composioStart === -1) return;++ const linkPathStart = normalizedToken.indexOf(+ LINK_PATH_MARKER,+ composioStart + COMPOSIO_MARKER.length+ );+ if (linkPathStart === -1 || linkPathStart + LINK_PATH_MARKER.length >= token.length) return;++ genericLinks.add(trimTrailingPunctuation(token.slice(httpsStart)));+};++export const extractComposioConnectLinks = (value: unknown): string[] => {+ const text = stringifyUnknown(value);+ const connectLinks = new Set<string>();+ const genericLinks = new Set<string>();+ let tokenStart = 0;++ for (let index = 0; index <= text.length; index += 1) {+ const character = text[index];+ if (character !== undefined && !isUrlBoundary(character)) continue;++ if (index > tokenStart) {+ classifyToken(text.slice(tokenStart, index), connectLinks, genericLinks);+ }++ tokenStart = index + 1;+ }++ return Array.from(new Set([...connectLinks, ...genericLinks]));+};diff --git a/ts/packages/experimental/src/eve/hooks.ts b/ts/packages/experimental/src/eve/hooks.tsnew file mode 100644index 000000000..b0d170aa4--- /dev/null+++ b/ts/packages/experimental/src/eve/hooks.ts@@ -0,0 +1,113 @@+import type { ExecuteToolFn, ToolExecuteResponse } from '@composio/core';+import type { ToolContext } from 'eve/tools';+import { extractComposioConnectLinks } from '../auth-links';++type MaybePromise<T> = T | Promise<T>;+type Next = () => Promise<ToolExecuteResponse>;++export interface EveHookControls {+ deny(reason: string): ToolExecuteResponse;+}++export interface EveHookContext extends EveHookControls {+ request: { slug: string; args: Record<string, unknown> };+ readonly context: { readonly slug: string; readonly eve: ToolContext };+}++export interface EveAuthLinkContext extends EveHookControls {+ readonly url: string;+ readonly result: ToolExecuteResponse;+ readonly context: { readonly slug: string; readonly eve: ToolContext };+}++export type EveHook = (ctx: EveHookContext, next: Next) => MaybePromise<ToolExecuteResponse | void>;+export type EveAuthLinkHook = (+ ctx: EveAuthLinkContext,+ next: Next+) => MaybePromise<ToolExecuteResponse | void>;++export interface EveProviderHooks {+ search?: EveHook;+ manageConnections?: EveHook;+ execute?: EveHook;+ remoteWorkbench?: EveHook;+ remoteBash?: EveHook;+ onAuthLink?: EveAuthLinkHook;+}++export const denyEveToolCall = (reason: string): ToolExecuteResponse => ({+ data: {},+ error: reason,+ successful: false,+});++const HOOK_BY_SLUG = {+ COMPOSIO_SEARCH_TOOLS: 'search',+ COMPOSIO_MANAGE_CONNECTIONS: 'manageConnections',+ COMPOSIO_MULTI_EXECUTE_TOOL: 'execute',+ COMPOSIO_EXECUTE_TOOL: 'execute',+ COMPOSIO_REMOTE_WORKBENCH: 'remoteWorkbench',+ COMPOSIO_REMOTE_BASH_TOOL: 'remoteBash',+} as const;++type MetaSlug = keyof typeof HOOK_BY_SLUG;++const hookForSlug = (hooks: EveProviderHooks, slug: string): EveHook | undefined => {+ const hookName = HOOK_BY_SLUG[slug as MetaSlug];+ if (!hookName) return undefined;+ return hooks[hookName];+};++const extractAuthLinks = (result: ToolExecuteResponse): string[] => {+ const links = new Set(extractComposioConnectLinks(result.data));+ for (const link of extractComposioConnectLinks(result.error)) {+ links.add(link);+ }+ return Array.from(links);+};++const runHook = async <C>(+ hook: ((ctx: C, next: Next) => MaybePromise<ToolExecuteResponse | void>) | undefined,+ ctx: C,+ getDefault: Next+): Promise<ToolExecuteResponse> => {+ if (!hook) return getDefault();++ let pending: Promise<ToolExecuteResponse> | undefined;+ const next: Next = () => {+ if (!pending) pending = getDefault();+ return pending;+ };++ const hookResult = await hook(ctx, next);+ if (hookResult !== undefined && hookResult !== null) return hookResult;+ if (pending) return pending;+ return next();+};++export async function applyHooks(+ hooks: EveProviderHooks,+ slug: string,+ args: Record<string, unknown>,+ executeTool: ExecuteToolFn,+ eveContext: ToolContext+): Promise<ToolExecuteResponse> {+ const context = { slug, eve: eveContext };+ const ctx: EveHookContext = { request: { slug, args }, context, deny: denyEveToolCall };+ const hook = hookForSlug(hooks, slug);+ const result = await runHook(hook, ctx, () => executeTool(ctx.request.slug, ctx.request.args));++ const { onAuthLink } = hooks;+ if (!onAuthLink) return result;++ let current = result;+ for (const url of extractAuthLinks(result)) {+ const previous = current;+ current = await runHook(+ onAuthLink,+ { url, result: previous, context, deny: denyEveToolCall },+ async () => previous+ );+ }+ return current;+}diff --git a/ts/packages/experimental/src/eve/index.ts b/ts/packages/experimental/src/eve/index.tsnew file mode 100644index 000000000..330138da2--- /dev/null+++ b/ts/packages/experimental/src/eve/index.ts@@ -0,0 +1,20 @@+/**+ * Experimental Composio provider for the eve agent framework.+ *+ * `EveProvider` makes `session.tools()` return eve-native `defineTool`s;+ * `defineComposioTools` is the replay-safe resolver that hands them to eve.+ *+ * @module experimental/eve+ */+export { EveProvider, requireApprovalForTools } from './provider';+export type { EveNeedsApproval, EveProviderOptions, EveTool, EveToolCollection } from './provider';+export { defineComposioTools } from './resolver';+export { denyEveToolCall } from './hooks';+export type {+ EveHook,+ EveAuthLinkHook,+ EveHookContext,+ EveAuthLinkContext,+ EveHookControls,+ EveProviderHooks,+} from './hooks';diff --git a/ts/packages/experimental/src/eve/provider.ts b/ts/packages/experimental/src/eve/provider.tsnew file mode 100644index 000000000..8a69acc58--- /dev/null+++ b/ts/packages/experimental/src/eve/provider.ts@@ -0,0 +1,115 @@+import {+ BaseAgenticProvider,+ type ExecuteToolFn,+ type McpServerGetResponse,+ type McpUrlResponse,+ normalizeToolArguments,+ removeNonRequiredProperties,+ type Tool,+ type ToolExecuteResponse,+} from '@composio/core';+import type { JsonValue } from 'eve/connections';+import {+ type NeedsApprovalContext,+ type ToolContext,+ type ToolDefinition,+ defineTool,+} from 'eve/tools';+import { applyHooks, type EveProviderHooks } from './hooks';++export type EveTool = ToolDefinition<Record<string, unknown>, ToolExecuteResponse>;+export type EveToolCollection = Record<string, EveTool>;+export type EveNeedsApproval = (+ tool: Tool,+ context: NeedsApprovalContext<Record<string, unknown>>+) => boolean;++const MULTI_EXECUTE_TOOL_SLUG = 'COMPOSIO_MULTI_EXECUTE_TOOL';++const toEveInputSchema = (tool: Tool, strict?: boolean): Record<string, JsonValue> => {+ const params = tool.inputParameters;+ if (!params) return { type: 'object', properties: {} };+ if (!strict || params.type !== 'object') return params as Record<string, JsonValue>;++ return removeNonRequiredProperties({+ ...params,+ properties: { ...params.properties },+ }) as Record<string, JsonValue>;+};++const toEveApprovalPolicy = (+ tool: Tool,+ approvalPolicy?: EveNeedsApproval+): EveTool['needsApproval'] => {+ if (!approvalPolicy) return undefined;+ return context => approvalPolicy(tool, context);+};++const isProtectedToolItem = (item: unknown, protectedSlugs: ReadonlySet<string>): boolean => {+ if (typeof item !== 'object' || item === null) return false;++ const toolSlug = (item as Record<string, unknown>).tool_slug;+ if (typeof toolSlug !== 'string') return false;++ return protectedSlugs.has(toolSlug.toUpperCase());+};++/** Require approval for direct calls and matching entries inside a multi-execute call. */+export const requireApprovalForTools = (...toolSlugs: string[]): EveNeedsApproval => {+ const protectedSlugs = new Set(toolSlugs.map(slug => slug.toUpperCase()));+ return (tool, context) => {+ const normalizedToolSlug = tool.slug.toUpperCase();+ if (protectedSlugs.has(normalizedToolSlug)) return true;+ if (normalizedToolSlug !== MULTI_EXECUTE_TOOL_SLUG) return false;++ const requestedTools = context.toolInput?.tools;+ if (!Array.isArray(requestedTools)) return false;++ return requestedTools.some(item => isProtectedToolItem(item, protectedSlugs));+ };+};++export interface EveProviderOptions {+ strict?: boolean;+ hooks?: EveProviderHooks;+ needsApproval?: EveNeedsApproval;+}++export class EveProvider extends BaseAgenticProvider<+ EveToolCollection,+ EveTool,+ McpServerGetResponse+> {+ readonly name = 'eve';++ constructor(private readonly options: EveProviderOptions = {}) {+ super();+ }++ wrapTool(tool: Tool, executeTool: ExecuteToolFn): EveTool {+ const inputSchema = toEveInputSchema(tool, this.options.strict);+ const needsApproval = toEveApprovalPolicy(tool, this.options.needsApproval);++ return defineTool({+ description: tool.description ?? tool.name,+ inputSchema,+ needsApproval,+ execute: (input, context: ToolContext) =>+ applyHooks(+ this.options.hooks ?? {},+ tool.slug,+ normalizeToolArguments(input, tool.slug),+ executeTool,+ context+ ),+ });+ }++ wrapTools(tools: Tool[], executeTool: ExecuteToolFn): EveToolCollection {+ return Object.fromEntries(tools.map(tool => [tool.slug, this.wrapTool(tool, executeTool)]));+ }++ wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse {+ return data.map(item => ({ url: new URL(item.url), name: item.name })) as McpServerGetResponse;+ }+}diff --git a/ts/packages/experimental/src/eve/resolver.ts b/ts/packages/experimental/src/eve/resolver.tsnew file mode 100644index 000000000..1140a1ec7--- /dev/null+++ b/ts/packages/experimental/src/eve/resolver.ts@@ -0,0 +1,34 @@+import { defineDynamic, type DynamicResolveContext } from 'eve/tools';+import type { EveToolCollection } from './provider';++type EveSession = { tools: () => Promise<EveToolCollection> };+type EveSessionSource<S extends EveSession> =+ S | Promise<S> | ((context: DynamicResolveContext) => S | Promise<S>);++// step.started keeps the provider's live execute closures (session.started+// snapshots them away); cached per resolved session since session.tools() is a+// network call. Rejected requests are evicted so transient failures can retry.+export function defineComposioTools<S extends EveSession>(source: EveSessionSource<S>) {+ const cache = new WeakMap<S, Promise<EveToolCollection>>();++ const resolveTools = async (context: DynamicResolveContext): Promise<EveToolCollection> => {+ const session = await (typeof source === 'function' ? source(context) : source);+ const cached = cache.get(session);+ if (cached) return cached;++ const pending = session.tools();+ cache.set(session, pending);+ try {+ return await pending;+ } catch (error) {+ if (cache.get(session) === pending) cache.delete(session);+ throw error;+ }+ };++ return defineDynamic({+ events: {+ 'step.started': (_event, context) => resolveTools(context),+ },+ });+}diff --git a/ts/packages/experimental/src/index.ts b/ts/packages/experimental/src/index.tsindex 0d58c875a..f55140383 100644--- a/ts/packages/experimental/src/index.ts+++ b/ts/packages/experimental/src/index.ts@@ -1,8 +1,8 @@/*** Experimental Composio integrations and helpers.*- * Currently includes the experimental Pi provider for- * @earendil-works/pi-coding-agent.+ * The root export remains the Pi provider for backwards compatibility.+ * Framework-specific integrations are also available through subpath exports.** @packageDocumentation* @module experimentaldiff --git a/ts/packages/experimental/src/pi/auth-links.ts b/ts/packages/experimental/src/pi/auth-links.tsindex 0408b5267..f9ad74386 100644--- a/ts/packages/experimental/src/pi/auth-links.ts+++ b/ts/packages/experimental/src/pi/auth-links.ts@@ -1,25 +1,9 @@+import { extractComposioConnectLinks } from '../auth-links';import { runHook } from './hooks';import { hookControls } from './results';import type { PiAuthLinkContext, PiHookControls, PiSessionToolCapabilities } from './types';-export const extractComposioConnectLinks = (value: unknown): string[] => {- const text = stringifyUnknown(value);- const connectLinks = text.match(/https:\/\/connect\.composio\.dev\/[^\s<>)"']+/gi) ?? [];- const genericLinks =- text.match(/https:\/\/[^\s<>)"']*composio[^\s<>)"']*\/link\/[^\s<>)"']+/gi) ?? [];- return [- ...new Set([...connectLinks, ...genericLinks].map(url => url.replace(/[.,;:!?]+$/g, ''))),- ];-};--const stringifyUnknown = (value: unknown): string => {- if (typeof value === 'string') return value;- try {- return JSON.stringify(value);- } catch {- return String(value);- }-};+export { extractComposioConnectLinks } from '../auth-links';export const applyAuthLinkHandlers = async (capabilities: PiSessionToolCapabilities,diff --git a/ts/packages/experimental/test/eve.test.ts b/ts/packages/experimental/test/eve.test.tsnew file mode 100644index 000000000..9a8fe775e--- /dev/null+++ b/ts/packages/experimental/test/eve.test.ts@@ -0,0 +1,254 @@+import type { ExecuteToolFn, Tool, ToolExecuteResponse } from '@composio/core';+import { describe, expect, it, vi } from 'vitest';+import {+ EveProvider,+ defineComposioTools,+ denyEveToolCall,+ requireApprovalForTools,+} from '../src/eve';++const tool = (slug: string): Tool =>+ ({+ slug,+ name: slug,+ description: `desc ${slug}`,+ inputParameters: { type: 'object', properties: { q: { type: 'string' } } },+ }) as unknown as Tool;++const ok = (data: Record<string, unknown> = {}): ToolExecuteResponse => ({+ data,+ error: null,+ successful: true,+});++describe('EveProvider', () => {+ it('identifies as the eve provider', () => {+ expect(new EveProvider().name).toBe('eve');+ });++ it('wraps tools by slug with description and schema', () => {+ const execute: ExecuteToolFn = vi.fn(async () => ok());+ const wrapped = new EveProvider().wrapTools([tool('GITHUB_CREATE_ISSUE')], execute);+ const eveTool = wrapped.GITHUB_CREATE_ISSUE;+ expect(eveTool).toBeDefined();+ expect(eveTool.description).toBe('desc GITHUB_CREATE_ISSUE');+ expect(eveTool.inputSchema).toEqual({ type: 'object', properties: { q: { type: 'string' } } });+ });++ it("executes through Composio's executeTool", async () => {+ const execute: ExecuteToolFn = vi.fn(async () => ok({ url: 'x' }));+ const wrapped = new EveProvider().wrapTools([tool('GMAIL_SEND_EMAIL')], execute);+ const result = await wrapped.GMAIL_SEND_EMAIL.execute({ q: 'hi' }, {} as never);+ expect(execute).toHaveBeenCalledWith('GMAIL_SEND_EMAIL', { q: 'hi' });+ expect(result).toEqual(ok({ url: 'x' }));+ });++ it('does not mutate the source schema in strict mode', () => {+ const source = {+ type: 'object',+ properties: {+ required: { type: 'string' },+ optional: { type: 'string' },+ },+ required: ['required'],+ } as const;+ const composioTool = {+ ...tool('GITHUB_CREATE_ISSUE'),+ inputParameters: source,+ } as unknown as Tool;++ const wrapped = new EveProvider({ strict: true }).wrapTools(+ [composioTool],+ vi.fn(async () => ok())+ );++ expect(source.properties).toHaveProperty('optional');+ expect(source).not.toHaveProperty('additionalProperties');+ expect(wrapped.GITHUB_CREATE_ISSUE.inputSchema).toEqual({+ type: 'object',+ properties: { required: { type: 'string' } },+ required: ['required'],+ additionalProperties: false,+ });+ });++ it('lets an execute hook deny a call', async () => {+ const execute: ExecuteToolFn = vi.fn(async () => ok());+ const provider = new EveProvider({+ hooks: { execute: ctx => ctx.deny('blocked') },+ });+ const wrapped = provider.wrapTools([tool('COMPOSIO_MULTI_EXECUTE_TOOL')], execute);+ const result = await wrapped.COMPOSIO_MULTI_EXECUTE_TOOL.execute({ q: 'x' }, {} as never);+ expect(execute).not.toHaveBeenCalled();+ expect(result).toEqual(denyEveToolCall('blocked'));+ });++ it('routes remote bash calls to the remoteBash hook', async () => {+ const execute: ExecuteToolFn = vi.fn(async () => ok());+ const provider = new EveProvider({+ hooks: { remoteBash: ctx => ctx.deny('shell blocked') },+ });+ const wrapped = provider.wrapTools([tool('COMPOSIO_REMOTE_BASH_TOOL')], execute);++ const result = await wrapped.COMPOSIO_REMOTE_BASH_TOOL.execute(+ { command: 'rm -rf /tmp/example' },+ {} as never+ );++ expect(execute).not.toHaveBeenCalled();+ expect(result).toEqual(denyEveToolCall('shell blocked'));+ });++ it("passes eve's tool context to hooks", async () => {+ const eveContext = { session: { id: 'eve-session' } } as never;+ const search = vi.fn((_ctx, next) => next());+ const provider = new EveProvider({ hooks: { search } });+ const wrapped = provider.wrapTools(+ [tool('COMPOSIO_SEARCH_TOOLS')],+ vi.fn(async () => ok())+ );++ await wrapped.COMPOSIO_SEARCH_TOOLS.execute({ q: 'calendar' }, eveContext);++ expect(search.mock.calls[0]?.[0].context.eve).toBe(eveContext);+ });++ it('maps approval policy onto wrapped tools', () => {+ const needsApproval = vi.fn(+ (composioTool: Tool) => composioTool.slug === 'LOCAL_IMESSAGE_SEND'+ );+ const provider = new EveProvider({ needsApproval });+ const wrapped = provider.wrapTools(+ [tool('LOCAL_IMESSAGE_SEND'), tool('GITHUB_GET_REPOSITORY')],+ vi.fn(async () => ok())+ );+ const context = {+ approvedTools: new Set<string>(),+ toolInput: { to: '+15551234567', text: 'test' },+ toolName: 'LOCAL_IMESSAGE_SEND',+ };++ expect(wrapped.LOCAL_IMESSAGE_SEND.needsApproval?.(context)).toBe(true);+ expect(wrapped.GITHUB_GET_REPOSITORY.needsApproval?.(context)).toBe(false);+ expect(needsApproval).toHaveBeenCalledWith(+ expect.objectContaining({ slug: 'LOCAL_IMESSAGE_SEND' }),+ context+ );+ });++ it('requires approval for protected tools nested in multi-execute', () => {+ const provider = new EveProvider({+ needsApproval: requireApprovalForTools('LOCAL_IMESSAGE_SEND'),+ });+ const wrapped = provider.wrapTools(+ [tool('COMPOSIO_MULTI_EXECUTE_TOOL')],+ vi.fn(async () => ok())+ );++ expect(+ wrapped.COMPOSIO_MULTI_EXECUTE_TOOL.needsApproval?.({+ approvedTools: new Set<string>(),+ toolInput: {+ tools: [+ { tool_slug: 'GMAIL_FETCH_EMAILS', arguments: {} },+ { tool_slug: 'LOCAL_IMESSAGE_SEND', arguments: { text: 'test' } },+ ],+ },+ toolName: 'COMPOSIO_MULTI_EXECUTE_TOOL',+ })+ ).toBe(true);+ });++ it('finds auth links in circular data containing bigint values', async () => {+ const circular: Record<string, unknown> = {+ connectionUrl: 'https://connect.composio.dev/link_123',+ sequence: 1n,+ };+ circular.self = circular;++ const onAuthLink = vi.fn((_ctx, next) => next());+ const provider = new EveProvider({ hooks: { onAuthLink } });+ const wrapped = provider.wrapTools(+ [tool('COMPOSIO_MANAGE_CONNECTIONS')],+ vi.fn(async () => ok(circular))+ );++ await wrapped.COMPOSIO_MANAGE_CONNECTIONS.execute({}, {} as never);++ expect(onAuthLink.mock.calls[0]?.[0].url).toBe('https://connect.composio.dev/link_123');+ });++ it('finds auth links in errors even when data cannot be serialized', async () => {+ const circular: Record<string, unknown> = {};+ circular.self = circular;+ Object.defineProperty(circular, 'broken', {+ enumerable: true,+ get: () => {+ throw new Error('unserializable');+ },+ });+ const onAuthLink = vi.fn((_ctx, next) => next());+ const provider = new EveProvider({ hooks: { onAuthLink } });+ const wrapped = provider.wrapTools(+ [tool('COMPOSIO_MANAGE_CONNECTIONS')],+ vi.fn(async () => ({+ data: circular,+ error: 'Connect at https://connect.composio.dev/link_123',+ successful: false,+ }))+ );++ await expect(+ wrapped.COMPOSIO_MANAGE_CONNECTIONS.execute({}, {} as never)+ ).resolves.toMatchObject({ successful: false });+ expect(onAuthLink.mock.calls[0]?.[0].url).toBe('https://connect.composio.dev/link_123');+ });+});++describe('defineComposioTools', () => {+ const resolve = (dynamic: ReturnType<typeof defineComposioTools>) =>+ dynamic.events['step.started'] as NonNullable<(typeof dynamic.events)['step.started']>;++ it('deduplicates concurrent discovery calls', async () => {+ let release: ((tools: Record<string, never>) => void) | undefined;+ const pending = new Promise<Record<string, never>>(done => {+ release = done;+ });+ const tools = vi.fn(() => pending);+ const handler = resolve(defineComposioTools({ tools }));++ const first = handler({}, {} as never);+ const second = handler({}, {} as never);+ release?.({});++ await expect(Promise.all([first, second])).resolves.toEqual([{}, {}]);+ expect(tools).toHaveBeenCalledTimes(1);+ });++ it('retries discovery after a transient failure', async () => {+ const tools = vi+ .fn<() => Promise<Record<string, never>>>()+ .mockRejectedValueOnce(new Error('temporary failure'))+ .mockResolvedValueOnce({});+ const handler = resolve(defineComposioTools({ tools }));++ await expect(handler({}, {} as never)).rejects.toThrow('temporary failure');+ await expect(handler({}, {} as never)).resolves.toEqual({});+ expect(tools).toHaveBeenCalledTimes(2);+ });++ it('caches independently for sessions returned by a resolver', async () => {+ const first = { tools: vi.fn(async () => ({})) };+ const second = { tools: vi.fn(async () => ({})) };+ const handler = resolve(+ defineComposioTools(context => (context.session.id === 'first' ? first : second))+ );++ await handler({}, { session: { id: 'first' } } as never);+ await handler({}, { session: { id: 'second' } } as never);+ await handler({}, { session: { id: 'first' } } as never);++ expect(first.tools).toHaveBeenCalledTimes(1);+ expect(second.tools).toHaveBeenCalledTimes(1);+ });+});diff --git a/ts/packages/experimental/test/pi.test.ts b/ts/packages/experimental/test/pi.test.tsindex 51085de13..8c8b5a2c2 100644--- a/ts/packages/experimental/test/pi.test.ts+++ b/ts/packages/experimental/test/pi.test.ts@@ -444,4 +444,35 @@ describe('PiProvider', () => {})).toEqual(['https://connect.composio.dev/abc123']);});++ it('extracts generic Composio auth links case-insensitively', () => {+ expect(extractComposioConnectLinks('Open HTTPS://auth.Composio.dev/LINK/abc123')).toEqual([+ 'HTTPS://auth.Composio.dev/LINK/abc123',+ ]);+ });++ it('returns connect links first and deduplicates links across classifiers', () => {+ const genericLink = 'https://auth.composio.dev/link/generic';+ const connectLink = 'https://connect.composio.dev/link/connect';++ expect(+ extractComposioConnectLinks(`${genericLink} ${connectLink} ${genericLink} ${connectLink}`)+ ).toEqual([connectLink, genericLink]);+ });++ it('trims repeated trailing punctuation from auth links', () => {+ const repeatedPunctuation = '!?.,;:'.repeat(5_000);++ expect(+ extractComposioConnectLinks(+ `Connect at https://connect.composio.dev/abc123${repeatedPunctuation} or https://auth.composio.dev/link/xyz!?.,`+ )+ ).toEqual(['https://connect.composio.dev/abc123', 'https://auth.composio.dev/link/xyz']);+ });++ it('handles long adversarial nonmatches without backtracking', () => {+ const nonMatch = `https://${'composio'.repeat(20_000)}/not-a-link`;++ expect(extractComposioConnectLinks(nonMatch)).toEqual([]);+ });});diff --git a/ts/packages/experimental/tsdown.config.ts b/ts/packages/experimental/tsdown.config.tsindex a61c0780e..175d081de 100644--- a/ts/packages/experimental/tsdown.config.ts+++ b/ts/packages/experimental/tsdown.config.ts@@ -3,6 +3,6 @@ import { baseConfig } from '../../../tsdown.config.base.ts';export default defineConfig({...baseConfig,- entry: ['src/index.ts', 'src/workbench/index.ts'],+ entry: ['src/index.ts', 'src/eve/index.ts', 'src/workbench/index.ts'],tsconfig: 'tsconfig.json',});