import type { Static, TSchema } from "typebox"; import type { AuthorizedRuntimeTool, AuthorizedWorkspaceTool, LegacyRuntimeTool, LegacyWorkspaceTool, ToolAnnotations, ToolAuthorization, Workspace, WorkspaceCapability } from "./types"; type RuntimeToolDefinition = { description: string; input: S; annotations?: ToolAnnotations; handler: (input: Static, runtime: TRuntime) => Promise | string; }; type WorkspaceToolDefinition = { description: string; input: S; annotations?: ToolAnnotations; capabilities: ReadonlyArray; handler: (input: Static, workspace: Workspace) => Promise | string; }; /** Per-tool generic inference: the input schema types the handler's first * parameter (`Static`); TRuntime is fixed once by the curried factory. * The schema is the ONLY schema — it feeds AI providers and MCP verbatim at * runtime and the handler signature at compile time. * * ```ts * const tool = toolFactory(); * * tool.runtime({ * description: 'Send a transactional email through the configured adapter.', * input: Type.Object({ to: Type.String({ format: 'email' }), subject: Type.String(), text: Type.String() }), * annotations: { openWorldHint: true }, * handler: async (input, dispatcher) => { * const result = await dispatcher.email(input); // input fully typed * return `sent via ${result.provider}`; * } * }); * ``` */ export declare const toolFactory: () => { runtime: { (definition: RuntimeToolDefinition & { authorization: ToolAuthorization; }): AuthorizedRuntimeTool; (definition: RuntimeToolDefinition & { authorization?: never; }): LegacyRuntimeTool; }; workspace: { (definition: WorkspaceToolDefinition & { authorization: ToolAuthorization; }): AuthorizedWorkspaceTool; (definition: WorkspaceToolDefinition & { authorization?: never; }): LegacyWorkspaceTool; }; }; export {};