import { type Tool as AiTool, type ToolSet } from 'ai'; import type { z } from 'zod'; import type { Tool, AnyTool } from '../../types/effectTool.js'; import type { ToolContext } from '../../types/run-context.js'; import type { StandardSchemaV1 } from '../../types/standard-schema.js'; type InferToolInput = S extends z.ZodTypeAny ? z.infer : S extends StandardSchemaV1 ? I : unknown; export declare function defineTool(config: { name?: string; description: string; input?: S; output?: Tool, R>['output']; needsApproval?: boolean; interruptible?: boolean; interim?: string; interimAfterMs?: number; /** @deprecated Use `interim`. */ filler?: string; /** @deprecated Use `interimAfterMs`. */ estimatedDurationMs?: number; timeoutMs?: number; replay?: boolean; /** * Safe to run concurrently with sibling calls in the same model-emitted batch. A function * form receives the RAW (unvalidated) model args — classification happens before schema * validation — and must not throw; a throw or a non-boolean return is treated as NOT * parallel-safe. Never model-controlled: the model cannot assert this, only the tool author. */ parallelSafe?: boolean | ((args: InferToolInput) => boolean); idempotencyKey?: (args: InferToolInput) => string; execute: (args: InferToolInput, ctx?: ToolContext) => Promise | AsyncIterable; /** * Turns a thrown error into a result the model can act on, instead of a generic failure. * Return a value to recover; rethrow (or omit this) to let the error propagate. * * Runs only for genuine failures — never for a timeout, an abort, an input/output schema * violation, or a control-flow signal, all of which must stay distinguishable from a * result the tool chose to return. */ onError?: (error: Error, args: InferToolInput) => Promise | R; }): Tool, R>; export declare function toolToAiSdk(def: Tool): AiTool; export declare function buildToolSet(tools: Record): ToolSet; /** Recover the raw effect tools (with executors) from a `buildToolSet` output. */ export declare function rawToolsFromSet(set: ToolSet): Record | undefined; export {};