import type { ToolCallContext } from './types'; export interface ToolCallRecord { tool: string; /** The category the tool was offered from. */ category: string; /** The ids the arguments name - `id`, `…Id`, `ids`, `…Ids` - and nothing else of them. */ targetIds: string[]; /** sha256 of the arguments - the same call is the same hash. */ argsHash: string; /** Characters of the result as JSON; 0 when the tool threw. */ resultSize: number; /** How many rows it carried - `read` of a list read, else the length of its first list; absent when it says none. */ resultCount?: number; resultHash?: string; /** Why it failed: the code a refusal returned (`{ rejected: true, error }`), the thrown error's code, or `tool-threw`. */ errorCode?: string; ok: boolean; durationMs: number; /** The arguments and the result as they were - only for a category the recorder named in `raw`. */ raw?: { args: unknown; result?: unknown; error?: string; }; } export type ToolCallRecorder = (record: ToolCallRecord, context: ToolCallContext) => void | Promise; export interface ToolCallRecorderOptions { /** Categories whose calls the recorder is handed with their arguments and result as they were. */ raw?: string[]; } /** A call as it ran - the registry door's side, before it is cut down for a recorder. */ export interface ToolCallRun { tool: string; category: string; args: unknown; result?: unknown; error?: unknown; durationMs: number; } export declare function registerToolCallRecorder(recorder: ToolCallRecorder, options?: ToolCallRecorderOptions): void; export declare function clearToolCallRecorders(): void; /** A run as a recorder sees it - the digest, and the raw text when its category was asked for. */ export declare function digestOf(run: ToolCallRun, raw?: boolean): ToolCallRecord; export declare function recordToolCall(run: ToolCallRun, context: ToolCallContext): Promise;