The Open Framework for Building Agents
fix(eve): expose call IDs to connection arguments (#2634)
vercel-gh-bot-2[bot]16c8b63c19cb
diff --git a/.changeset/calm-calls-replay.md b/.changeset/calm-calls-replay.mdnew file mode 100644index 000000000..e36e4628e--- /dev/null+++ b/.changeset/calm-calls-replay.md@@ -0,0 +1,5 @@+---+"eve": patch+---++Expose a replay-stable `callId` to MCP and OpenAPI `providedArguments` callbacks so connection tools can derive per-call idempotency keys.diff --git a/docs/connections/mcp.mdx b/docs/connections/mcp.mdxindex 754f7c3f9..36b3e6ad1 100644--- a/docs/connections/mcp.mdx+++ b/docs/connections/mcp.mdx@@ -58,7 +58,7 @@ export default defineMcpClientConnection({});```-Values may be JSON values, promises, or callbacks. Callbacks receive the active session context plus the bare remote `toolName`.+Values may be JSON values, promises, or callbacks. Callbacks receive the active session context, the bare remote `toolName`, and a replay-stable `callId` that is unique to the tool call. Use `callId` when the remote server needs an idempotency key.eve treats configured keys as application-owned: it removes them from every remote tool's model-facing input schema and adds their resolved values immediately before execution. They apply to every tool call on the connection and replace any conflicting model value. Approval policies continue to receive only the model-authored input.diff --git a/docs/connections/openapi.mdx b/docs/connections/openapi.mdxindex 87f6171c8..79d38bf7e 100644--- a/docs/connections/openapi.mdx+++ b/docs/connections/openapi.mdx@@ -86,7 +86,7 @@ export default defineOpenAPIConnection({});```-Values may be JSON values, promises, or callbacks. Callbacks receive the active session context plus the bare operation `toolName`.+Values may be JSON values, promises, or callbacks. Callbacks receive the active session context, the bare operation `toolName`, and a replay-stable `callId` that is unique to the tool call. Use `callId` when the API needs an idempotency key.eve removes configured keys from every operation's model-facing input schema and adds their resolved values immediately before constructing the HTTP request. Values apply to every operation on the connection and replace any conflicting model value. The keys correspond to the generated top-level operation inputs: path, query, header, and cookie parameter names, plus `body` for a request body.diff --git a/packages/eve/extension-contracts/compatibility/connection/v6.ts b/packages/eve/extension-contracts/compatibility/connection/v6.tsnew file mode 100644index 000000000..def585931--- /dev/null+++ b/packages/eve/extension-contracts/compatibility/connection/v6.ts@@ -0,0 +1,11 @@+import { defineMcpClientConnection } from "#public/connections/index.js";++export default defineMcpClientConnection({+ description: "Tenant-aware MCP service",+ toolCall: {+ providedArguments: {+ tenantId: ({ session, toolName }) => `${session.id}:${toolName}`,+ },+ },+ url: "https://example.com/mcp",+});diff --git a/packages/eve/extension-contracts/compatibility/tool/v19.ts b/packages/eve/extension-contracts/compatibility/tool/v19.tsnew file mode 100644index 000000000..128129619--- /dev/null+++ b/packages/eve/extension-contracts/compatibility/tool/v19.ts@@ -0,0 +1,3 @@+import { defaultWebSearch } from "#public/tools/web-search.js";++export default defaultWebSearch;diff --git a/packages/eve/extension-contracts/reports/connection/v7.json b/packages/eve/extension-contracts/reports/connection/v7.jsonnew file mode 100644index 000000000..2c7be681c--- /dev/null+++ b/packages/eve/extension-contracts/reports/connection/v7.json@@ -0,0 +1,15 @@+{+ "kind": "eve-extension-capability-contract",+ "capability": "connection",+ "epoch": 7,+ "sha256": "c74f5dc2bb3f626cb99e8c568ae276df9fb1428ea9ec6b962cbdcb73766750f7",+ "exports": [+ "ConnectionAuthorizationFailedError",+ "ConnectionAuthorizationRequiredError",+ "defineInteractiveAuthorization",+ "defineMcpClientConnection",+ "defineOpenAPIConnection",+ "isConnectionAuthorizationFailedError",+ "isConnectionAuthorizationRequiredError"+ ]+}diff --git a/packages/eve/extension-contracts/reports/tool/v20.json b/packages/eve/extension-contracts/reports/tool/v20.jsonnew file mode 100644index 000000000..f046ad195--- /dev/null+++ b/packages/eve/extension-contracts/reports/tool/v20.json@@ -0,0 +1,19 @@+{+ "kind": "eve-extension-capability-contract",+ "capability": "tool",+ "epoch": 20,+ "sha256": "e1e4f6cac803715d104492a6f8353459cf60bd023a1ca9eaeb171d207ce62968",+ "exports": [+ "defaultWebSearch",+ "defineTool",+ "disableTool",+ "experimental_workflow",+ "isDisabledToolSentinel",+ "isExperimentalWorkflowToolDefinition",+ "isWebSearchToolDefinition",+ "toolOutput",+ "toolOutputPart",+ "toolResultFrom",+ "webSearch"+ ]+}diff --git a/packages/eve/src/compiler/extension-compatibility.ts b/packages/eve/src/compiler/extension-compatibility.tsindex 44869506d..46d17265c 100644--- a/packages/eve/src/compiler/extension-compatibility.ts+++ b/packages/eve/src/compiler/extension-compatibility.ts@@ -22,8 +22,8 @@ interface ExtensionCapabilityContract {const EXTENSION_CAPABILITY_CONTRACTS = {extension: { current: 1, supported: [1], dropped: {} },tool: {- current: 19,- supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19],+ current: 20,+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20],dropped: { 15: "TaskExec replaces stageEffect with send" },},dynamicTool: {@@ -42,8 +42,8 @@ const EXTENSION_CAPABILITY_CONTRACTS = {},},connection: {- current: 6,- supported: [1, 2, 3, 4, 5, 6],+ current: 7,+ supported: [1, 2, 3, 4, 5, 6, 7],dropped: {},},hook: {diff --git a/packages/eve/src/execution/tools/connection-search.test.ts b/packages/eve/src/execution/tools/connection-search.test.tsindex ac2558c62..1b8527031 100644--- a/packages/eve/src/execution/tools/connection-search.test.ts+++ b/packages/eve/src/execution/tools/connection-search.test.ts@@ -1,4 +1,4 @@-import { describe, expect, it } from "vitest";+import { describe, expect, it, vi } from "vitest";import { ConnectionRegistryKey } from "#context/providers/connection-key.js";import { ContextContainer, contextStorage } from "#context/container.js";@@ -10,7 +10,10 @@ import {} from "#harness/authorization.js";import { ConnectionAuthorizationRequiredError } from "#connections/errors.js";import type { ToolContext } from "#tools/definition.js";-import type { ConnectionToolMetadata } from "#shared/connection-types.js";+import type {+ ConnectionToolExecuteOptions,+ ConnectionToolMetadata,+} from "#shared/connection-types.js";import type { ConnectionRegistry } from "#runtime/connections/registry-types.js";import connectionSearch from "#tools/framework/connection-search.js";import type { ResolvedConnectionDefinition } from "#runtime/types.js";@@ -142,6 +145,59 @@ describe("connection dynamic tools", () => {expect(Object.keys(tools)).toEqual(["connection_search", "linear__list_issues"]);expect(Object.values(tools).every(isBrandedToolEntry)).toBe(true);});++ it("forwards the authored tool call ID to connection execution", async () => {+ const linear = connection("linear");+ const executeTool = vi.fn(+ async (_toolName: string, _args: unknown, _options?: ConnectionToolExecuteOptions) => ({+ ok: true,+ }),+ );+ const baseRegistry = registry({+ connections: [linear],+ loadTools: {+ linear: async () => [+ {+ description: "List issues",+ inputSchema: { type: "object" },+ name: "list_issues",+ },+ ],+ },+ });+ const connectionRegistry: ConnectionRegistry = {+ ...baseRegistry,+ getClient: (name) => ({+ ...baseRegistry.getClient(name),+ executeTool,+ }),+ };+ const ctx = new ContextContainer();+ ctx.set(ConnectionRegistryKey, connectionRegistry);+ const abortSignal = {} as AbortSignal;++ await contextStorage.run(ctx, async () => {+ const resolve = getConnectionSearchResolver().events["step.started"]!;+ const resolveContext = {+ channel: {},+ messages: [],+ session: { auth: { current: null, initiator: null }, id: "test-session" },+ } satisfies DynamicResolveContext;+ const initial = (await resolve({}, resolveContext)) as DynamicToolSet;+ await initial["connection_search"]!.execute({ keywords: "list issues" }, {} as ToolContext);+ const tools = (await resolve({}, resolveContext)) as DynamicToolSet;++ for (const callId of ["call-1", "call-2", "call-1"]) {+ await tools["linear__list_issues"]!.execute({}, { abortSignal, callId } as ToolContext);+ }+ });++ expect(executeTool.mock.calls.map(([, , options]) => options?.callId)).toEqual([+ "call-1",+ "call-2",+ "call-1",+ ]);+ });});describe("connection_search", () => {diff --git a/packages/eve/src/execution/tools/connection-search.ts b/packages/eve/src/execution/tools/connection-search.tsindex e7ebfcddc..7fb550bf0 100644--- a/packages/eve/src/execution/tools/connection-search.ts+++ b/packages/eve/src/execution/tools/connection-search.ts@@ -414,6 +414,7 @@ async function executeDiscoveredConnectionTool(const client = registry.getClient(connectionName);return await client.executeTool(toolName, input, {abortSignal: executeCtx.abortSignal,+ callId: executeCtx.callId,});} catch (error) {if (!isConnectionAuthorizationRequiredError(error) || !interactiveAuth) throw error;diff --git a/packages/eve/src/public/definitions/connections/tool-call.ts b/packages/eve/src/public/definitions/connections/tool-call.tsindex 67d384c21..340db10cb 100644--- a/packages/eve/src/public/definitions/connections/tool-call.ts+++ b/packages/eve/src/public/definitions/connections/tool-call.ts@@ -3,6 +3,8 @@ import type { JsonValue } from "#public/types/json.js";/** Context available while resolving an application-provided connection tool argument. */export type ProvidedArgumentContext = SessionContext & {+ /** Replay-stable id of the current connection tool call. */+ readonly callId: string;/** Bare tool or operation name published by the remote connection. */readonly toolName: string;};diff --git a/packages/eve/src/runtime/connections/mcp-client.test.ts b/packages/eve/src/runtime/connections/mcp-client.test.tsindex 4ebe89520..0ac4ed4a9 100644--- a/packages/eve/src/runtime/connections/mcp-client.test.ts+++ b/packages/eve/src/runtime/connections/mcp-client.test.ts@@ -99,7 +99,8 @@ describe("McpConnectionClient", () => {};createMCPClient.mockResolvedValue(client);- const resolver = vi.fn(({ session, toolName }) => ({+ const resolver = vi.fn(({ callId, session, toolName }) => ({+ callId,sessionId: session.id,toolName,}));@@ -121,7 +122,11 @@ describe("McpConnectionClient", () => {}),]);await expect(- mcpClient.executeTool("lookup", { context: { from: "model" }, query: "boots" }),+ mcpClient.executeTool(+ "lookup",+ { context: { from: "model" }, query: "boots" },+ { callId: "call-1" },+ ),).resolves.toEqual({ ok: true });});@@ -139,6 +144,7 @@ describe("McpConnectionClient", () => {expect(execute).toHaveBeenCalledWith({context: {+ callId: "call-1",sessionId: "session-1",toolName: "lookup",},@@ -389,7 +395,7 @@ describe("McpConnectionClient authorization recovery", () => {createMCPClient.mockResolvedValue(client);const mcpClient = new McpConnectionClient(makeConnection());- const err = await mcpClient.executeTool("do_thing", {}).catch((e) => e);+ const err = await mcpClient.executeTool("do_thing", {}, { callId: "call-1" }).catch((e) => e);expect(isConnectionAuthorizationRequiredError(err)).toBe(true);});diff --git a/packages/eve/src/runtime/connections/mcp-client.ts b/packages/eve/src/runtime/connections/mcp-client.tsindex a628e27ec..a7b1d325f 100644--- a/packages/eve/src/runtime/connections/mcp-client.ts+++ b/packages/eve/src/runtime/connections/mcp-client.ts@@ -124,7 +124,7 @@ export class McpConnectionClient implements ConnectionClient {async executeTool(toolName: string,args: unknown,- options?: ConnectionToolExecuteOptions,+ options: ConnectionToolExecuteOptions,): Promise<unknown> {try {const { tools } = await this.#ensureTools();@@ -138,11 +138,12 @@ export class McpConnectionClient implements ConnectionClient {const resolvedArgs = await resolveProvidedArguments({args,+ callId: options.callId,connection: this.#connection,toolName,});- return await sdkTool.execute(resolvedArgs, { abortSignal: options?.abortSignal } as never);+ return await sdkTool.execute(resolvedArgs, { abortSignal: options.abortSignal } as never);} catch (error) {return await this.#rethrowClassified(error);}diff --git a/packages/eve/src/runtime/connections/openapi-client.test.ts b/packages/eve/src/runtime/connections/openapi-client.test.tsindex 475b4874d..10926d9da 100644--- a/packages/eve/src/runtime/connections/openapi-client.test.ts+++ b/packages/eve/src/runtime/connections/openapi-client.test.ts@@ -6,6 +6,8 @@ import type { SessionContext } from "#context/session-context.js";import type { ResolvedConnectionDefinition } from "#runtime/types.js";import { OpenApiConnectionClient } from "#runtime/connections/openapi-client.js";+const EXECUTE_OPTIONS = { callId: "call-1" } as const;+const SPEC: Record<string, unknown> = {openapi: "3.0.3",info: { title: "Test API", version: "1.0.0" },@@ -152,11 +154,19 @@ describe("OpenApiConnectionClient", () => {);vi.stubGlobal("fetch", fetchMock);+ const resolver = vi.fn(({ callId }) => callId);const client = new OpenApiConnectionClient(makeConnection({- toolCall: { providedArguments: { teamId: "team_from_app" } },+ toolCall: { providedArguments: { teamId: resolver } },}),);+ const ctx = new ContextContainer();+ ctx.set(AuthKey, null);+ ctx.set(SessionKey, {+ auth: { current: null, initiator: null },+ sessionId: "session-1",+ turn: { id: "turn-1", sequence: 0 },+ });const metadata = await client.getToolMetadata();expect(metadata.find((item) => item.name === "getProject")?.inputSchema).toMatchObject({@@ -167,15 +177,20 @@ describe("OpenApiConnectionClient", () => {metadata.find((item) => item.name === "getProject")?.inputSchema.properties,).not.toHaveProperty("teamId");- await client.executeTool("getProject", {- id: "prj_1",- teamId: "team_from_model",- });+ await contextStorage.run(ctx, () =>+ client.executeTool(+ "getProject",+ {+ id: "prj_1",+ teamId: "team_from_model",+ },+ { callId: "call-1" },+ ),+ );const [calledUrl] = fetchMock.mock.calls[0]!;- expect(String(calledUrl)).toBe(- "https://api.example.com/v1/projects/prj_1?teamId=team_from_app",- );+ expect(String(calledUrl)).toBe("https://api.example.com/v1/projects/prj_1?teamId=call-1");+ expect(resolver).toHaveBeenCalledWith(expect.objectContaining({ callId: "call-1" }));});it("builds input schemas from Swagger 2.0 top-level parameters", async () => {@@ -297,7 +312,11 @@ describe("OpenApiConnectionClient", () => {}),);- const result = await client.executeTool("getProject", { id: "prj_1", teamId: "team_9" });+ const result = await client.executeTool(+ "getProject",+ { id: "prj_1", teamId: "team_9" },+ EXECUTE_OPTIONS,+ );expect(result).toEqual({ status: 200, statusText: expect.any(String), body: { id: "prj_1" } });@@ -339,7 +358,9 @@ describe("OpenApiConnectionClient", () => {}),);- await contextStorage.run(ctx, () => client.executeTool("getProject", { id: "prj_1" }));+ await contextStorage.run(ctx, () =>+ client.executeTool("getProject", { id: "prj_1" }, EXECUTE_OPTIONS),+ );const [, init] = fetchMock.mock.calls[0]!;expect(init.headers).toMatchObject({@@ -355,7 +376,11 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection());- const result = await client.executeTool("createProject", { body: { name: "demo" } });+ const result = await client.executeTool(+ "createProject",+ { body: { name: "demo" } },+ EXECUTE_OPTIONS,+ );expect(result.status).toBe(201);const [, init] = fetchMock.mock.calls[0]!;@@ -374,7 +399,7 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection());- const result = await client.executeTool("getProject", { id: "missing" });+ const result = await client.executeTool("getProject", { id: "missing" }, EXECUTE_OPTIONS);expect(result.status).toBe(404);expect(result.body).toEqual({ error: "nope" });@@ -382,7 +407,9 @@ describe("OpenApiConnectionClient", () => {it("throws for an unknown tool name", async () => {const client = new OpenApiConnectionClient(makeConnection());- await expect(client.executeTool("nonexistent", {})).rejects.toThrow(/not found/);+ await expect(client.executeTool("nonexistent", {}, EXECUTE_OPTIONS)).rejects.toThrow(+ /not found/,+ );});it("sanitizes operationIds into provider-legal tool names", async () => {@@ -492,7 +519,7 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection({ url: "" }));- await client.executeTool("getProject", { id: "prj_1" });+ await client.executeTool("getProject", { id: "prj_1" }, EXECUTE_OPTIONS);const [calledUrl] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toBe("https://api.example.com/v1/projects/prj_1");@@ -509,11 +536,15 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection({ spec: SWAGGER_SPEC, url: "" }));- await client.executeTool("getItem", {- id: "itm_1",- includeDetails: true,- tags: ["alpha", "beta"],- });+ await client.executeTool(+ "getItem",+ {+ id: "itm_1",+ includeDetails: true,+ tags: ["alpha", "beta"],+ },+ EXECUTE_OPTIONS,+ );const [calledUrl] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toBe(@@ -530,7 +561,7 @@ describe("OpenApiConnectionClient", () => {const client = new OpenApiConnectionClient(makeConnection({ url: "https://override.example.com" }),);- await client.executeTool("getProject", { id: "prj_1" });+ await client.executeTool("getProject", { id: "prj_1" }, EXECUTE_OPTIONS);const [calledUrl] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toBe("https://override.example.com/v1/projects/prj_1");@@ -552,7 +583,7 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection({ spec, url: "" }));- await client.executeTool("getProject", { id: "prj_1" });+ await client.executeTool("getProject", { id: "prj_1" }, EXECUTE_OPTIONS);const [calledUrl] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toBe("https://api.example.com/v1/projects/prj_1");@@ -653,7 +684,7 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection({ spec: specUrl, url: "" }));- await client.executeTool("getPet", { id: "p1" });+ await client.executeTool("getPet", { id: "p1" }, EXECUTE_OPTIONS);const requestCall = fetchMock.mock.calls.find((call) => String(call[0]) !== specUrl);expect(requestCall).toBeDefined();@@ -793,7 +824,7 @@ describe("OpenApiConnectionClient", () => {vi.stubGlobal("fetch", fetchMock);const client = new OpenApiConnectionClient(makeConnection({ spec }));- await client.executeTool("getMe", { session: "abc 123" });+ await client.executeTool("getMe", { session: "abc 123" }, EXECUTE_OPTIONS);const [, init] = fetchMock.mock.calls[0]!;expect((init.headers as Record<string, string>).cookie).toBe("session=abc%20123");@@ -812,7 +843,7 @@ describe("OpenApiConnectionClient", () => {authorization: { getToken: async () => ({ token: "secret" }), principalType: "app" },}),);- await client.executeTool("op", {});+ await client.executeTool("op", {}, EXECUTE_OPTIONS);const [, init] = fetchMock.mock.calls[0]!;const headers = init.headers as Record<string, string>;@@ -833,7 +864,7 @@ describe("OpenApiConnectionClient", () => {authorization: { getToken: async () => ({ token: "secret" }), principalType: "app" },}),);- await client.executeTool("op", {});+ await client.executeTool("op", {}, EXECUTE_OPTIONS);const [calledUrl, init] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toContain("api_key=secret");@@ -853,7 +884,7 @@ describe("OpenApiConnectionClient", () => {authorization: { getToken: async () => ({ token: "dXNlcjpwYXNz" }), principalType: "app" },}),);- await client.executeTool("op", {});+ await client.executeTool("op", {}, EXECUTE_OPTIONS);const [, init] = fetchMock.mock.calls[0]!;expect((init.headers as Record<string, string>).Authorization).toBe("Basic dXNlcjpwYXNz");@@ -877,7 +908,7 @@ describe("OpenApiConnectionClient", () => {authorization: { getToken: async () => ({ token: "secret" }), principalType: "app" },}),);- await client.executeTool("getItem", { id: "itm_1" });+ await client.executeTool("getItem", { id: "itm_1" }, EXECUTE_OPTIONS);const [calledUrl, init] = fetchMock.mock.calls[0]!;expect(String(calledUrl)).toBe("https://api.example.com/v1/items/itm_1?app_key=secret");@@ -897,7 +928,7 @@ describe("OpenApiConnectionClient", () => {authorization: { getToken: async () => ({ token: "secret" }), principalType: "app" },}),);- await client.executeTool("op", {});+ await client.executeTool("op", {}, EXECUTE_OPTIONS);const [, init] = fetchMock.mock.calls[0]!;expect((init.headers as Record<string, string>).Authorization).toBe("Bearer secret");diff --git a/packages/eve/src/runtime/connections/openapi-client.ts b/packages/eve/src/runtime/connections/openapi-client.tsindex 9226beb8e..453acf053 100644--- a/packages/eve/src/runtime/connections/openapi-client.ts+++ b/packages/eve/src/runtime/connections/openapi-client.ts@@ -111,7 +111,7 @@ export class OpenApiConnectionClient implements ConnectionClient {async executeTool(toolName: string,args: unknown,- options?: ConnectionToolExecuteOptions,+ options: ConnectionToolExecuteOptions,): Promise<OpenApiToolResult> {const cache = await this.#ensureTools();const operation = cache.operations.get(toolName);@@ -121,7 +121,8 @@ export class OpenApiConnectionClient implements ConnectionClient {);}return this.#request(operation, cache.baseUrl, isObject(args) ? args : {}, {- abortSignal: options?.abortSignal,+ abortSignal: options.abortSignal,+ callId: options.callId,});}@@ -192,6 +193,7 @@ export class OpenApiConnectionClient implements ConnectionClient {execute: async (input: unknown, toolOptions) =>this.#request(operation, baseUrl, isObject(input) ? input : {}, {abortSignal: toolOptions?.abortSignal,+ callId: toolOptions.toolCallId,}),});}@@ -425,10 +427,11 @@ export class OpenApiConnectionClient implements ConnectionClient {operation: OpenApiOperation,baseUrl: string,args: Record<string, unknown>,- options?: ConnectionToolExecuteOptions,+ options: ConnectionToolExecuteOptions,): Promise<OpenApiToolResult> {const resolvedArgs = await resolveProvidedArguments({args,+ callId: options.callId,connection: this.#connection,toolName: operation.toolName,});diff --git a/packages/eve/src/runtime/connections/provided-arguments.ts b/packages/eve/src/runtime/connections/provided-arguments.tsindex 0e9548aae..840b2ba10 100644--- a/packages/eve/src/runtime/connections/provided-arguments.ts+++ b/packages/eve/src/runtime/connections/provided-arguments.ts@@ -6,6 +6,7 @@ import { parseJsonValue, type JsonValue } from "#shared/json.js";/** Resolves and merges application-provided arguments, with application values winning. */export async function resolveProvidedArguments(input: {readonly args: unknown;+ readonly callId: string;readonly connection: ResolvedConnectionDefinition;readonly toolName: string;}): Promise<Record<string, unknown>> {@@ -21,11 +22,15 @@ export async function resolveProvidedArguments(input: {}let context:- | (ReturnType<typeof buildCallbackContext> & { readonly toolName: string })+ | (ReturnType<typeof buildCallbackContext> & {+ readonly callId: string;+ readonly toolName: string;+ })| undefined;const getContext = () =>(context ??= {...buildCallbackContext(),+ callId: input.callId,toolName: input.toolName,});const provided: Record<string, JsonValue> = {};diff --git a/packages/eve/src/shared/connection-types.ts b/packages/eve/src/shared/connection-types.tsindex 061955e3e..ba729e268 100644--- a/packages/eve/src/shared/connection-types.ts+++ b/packages/eve/src/shared/connection-types.ts@@ -438,6 +438,8 @@ export interface ConnectionToolMetadata {export interface ConnectionToolExecuteOptions {/** Signal forwarded into the underlying transport. */readonly abortSignal?: AbortSignal;+ /** Replay-stable id of the authored tool call. */+ readonly callId: string;}/** A live client for a single connection. */@@ -447,7 +449,7 @@ export interface ConnectionClient {executeTool(toolName: string,args: unknown,- options?: ConnectionToolExecuteOptions,+ options: ConnectionToolExecuteOptions,): Promise<unknown>;getToolMetadata(): Promise<readonly ConnectionToolMetadata[]>;getTools(): Promise<ToolSet>;