import type { Tool as AiTool, ToolSet as AiToolSet } from 'ai'; import type { Runtime } from '../runtime/Runtime.js'; import type { ZodTypeAny } from 'zod'; export type Tool = AiTool; export type ToolSet = AiToolSet; export interface ToolExecutionContext { session?: unknown; sessionId?: string; agentId?: string; step?: number; turn?: number; toolName?: string; toolCallId?: string; idempotencyKey?: string; runtime?: unknown; [key: string]: unknown; } export interface ToolExecutionOptions { toolCallId?: string; messages?: unknown[]; abortSignal?: AbortSignal; experimental_context?: ToolExecutionContext; [key: string]: unknown; } export type ToolExecutionContextWithRuntime = ToolExecutionContext & { runtime: Runtime; }; export declare function isAgentContext(value: unknown): value is ToolExecutionContextWithRuntime; export declare function getRuntimeFromContext(context: ToolExecutionContext | undefined): Runtime | undefined; export interface ToolDefinition { description: string; inputSchema: ZodTypeAny; execute: (input: TInput, options?: ToolExecutionOptions) => Promise | TResult; /** If true (default), failure blocks turn success completion. */ critical?: boolean; /** Action to take on execution error. */ errorPolicy?: 'abort' | 'warn' | 'continue'; } export interface ToolWithFiller extends ToolDefinition { /** Optional filler message to display while tool is executing */ filler?: string; /** Optional estimated duration in ms for showing filler */ estimatedDurationMs?: number; } export declare function createTool(definition: ToolDefinition): Tool & ToolDefinition; export declare function createToolWithFiller(definition: ToolWithFiller): Tool & ToolWithFiller;