import { Effect } from "effect"; import type { Executor, InvokeOptions } from "@executor-js/sdk/core"; import type { SandboxToolInvoker } from "@executor-js/codemode-core"; import { ExecutionToolError } from "./errors"; type DescribedTool = { readonly path: string; readonly name: string; readonly description?: string; readonly inputTypeScript?: string; readonly outputTypeScript?: string; readonly outputTypeScriptNote?: string; readonly typeScriptDefinitions?: Record; /** The tool's declared annotations, when it carries any. Lets code inside * `execute` branch on approval posture without parsing the description. */ readonly annotations?: { readonly requiresApproval?: boolean; readonly approvalDescription?: string; readonly mayElicit?: boolean; }; /** Set when the path resolves to no tool — mirrors invoke's tool_not_found. */ readonly error?: { readonly code: "tool_not_found"; readonly message: string; readonly suggestions?: readonly string[]; }; }; /** * Bridges QuickJS `tools....(args)` calls * into `executor.execute(address, args)`. * * Wrapped in `Effect.fn("mcp.tool.dispatch")` so every tool call becomes a * span in the Effect tracer. Attributes: * - `mcp.tool.name` — full tool path (e.g. "github.org.main.getRepo") * - `mcp.tool.integration` — first segment of the path (namespace) * * `mcp.tool.kind` (openapi | mcp | graphql | code) is NOT annotated here * because it would require an `integrations.list()` lookup on every invocation. * Callers that already know the integration kind can annotate at their own span. */ export declare const makeExecutorToolInvoker: (executor: Executor, options: { readonly invokeOptions: InvokeOptions; readonly onConnectedToolCall?: (path: string) => void; }) => SandboxToolInvoker; export type ToolDiscoveryResult = { readonly path: string; readonly name: string; readonly description?: string; readonly integration: string; readonly score: number; }; export type ExecutorIntegrationListItem = { readonly id: string; readonly name: string; readonly description?: string; readonly kind: string; readonly canRemove?: boolean; readonly canRefresh?: boolean; readonly toolCount: number; }; export type ToolDiscoveryInput = { readonly executor: Executor; readonly query: string; readonly namespace?: string; readonly limit: number; readonly offset: number; }; export interface ToolDiscoveryProvider { readonly searchTools: (input: ToolDiscoveryInput) => Effect.Effect, ExecutionToolError>; } /** * Page of results from a list-style discovery tool. Shared by * `tools.search` and `tools.executor.integrations.list` so the model sees one * consistent shape: * * - `items` — the page (slice). * - `total` — count after filtering, before pagination. The model * can use this to detect truncation. * - `hasMore` — convenience flag for `(offset + items.length) < total`. * - `nextOffset` — concrete offset for the next page when `hasMore`, * `null` otherwise. Pre-computing it removes a class of * off-by-one mistakes when the model paginates. */ export type PagedResult = { readonly items: readonly T[]; readonly total: number; readonly hasMore: boolean; readonly nextOffset: number | null; }; /** What `tools.search()` calls inside the sandbox. */ export declare const searchTools: (executor: { readonly tools: Pick; }, query: string, limit?: any, options?: { readonly namespace?: string; readonly offset?: number; } | undefined) => Effect.Effect, ExecutionToolError, never>; export declare const defaultToolDiscoveryProvider: ToolDiscoveryProvider; /** What `tools.executor.integrations.list()` calls inside the sandbox. v2: the * integrations are the integration catalog; tool counts come from the * per-connection tool list. */ export declare const listExecutorIntegrations: (executor: Executor, options?: { readonly query?: string; readonly limit?: number; readonly offset?: number; } | undefined) => Effect.Effect, ExecutionToolError, never>; /** What `tools.describe.tool()` calls inside the sandbox. */ export declare const describeTool: (executor: Executor, path: string) => Effect.Effect; export {}; //# sourceMappingURL=tool-invoker.d.ts.map