import type { TraceEmitter } from "../observability/request-context.js"; import type { RawToolDefinition, ResolvedToolContext } from "./tool.helpers.js"; export type ToolTimeoutClass = "fast" | "bounded_slow" | "async_candidate" | "interactive"; export type ToolRuntimeErrorCode = "TOOL_TIMEOUT" | "TOOL_CANCELLED" | "TOOL_OUTPUT_TOO_LARGE"; export interface ToolTimeoutPolicy { class: ToolTimeoutClass; timeoutMs: number; maxOutputBytes: number; } export interface ToolInvocationRuntimeInput { toolName: string; tool: Pick; context: ResolvedToolContext; query: unknown; signal?: AbortSignal; traceEmitter?: TraceEmitter; timeoutMs?: number; maxOutputBytes?: number; } export declare function getToolTimeoutPolicy(toolName: string): ToolTimeoutPolicy; export declare class ToolRuntimeError extends Error { readonly code: ToolRuntimeErrorCode; readonly toolName: string; readonly policy: ToolTimeoutPolicy; constructor(code: ToolRuntimeErrorCode, message: string, toolName: string, policy: ToolTimeoutPolicy); } export declare function invokeToolRuntime(input: ToolInvocationRuntimeInput): Promise; export declare function toolRuntimeErrorToResult(err: unknown): string | null;