import type { ToolCall } from '../../../types/message/index.js'; import type { ToolCallRepair } from '../../../types/tool/repair.js'; import type { Logger } from '../../../utils/logger.js'; import type { EmitEvent, PreToolHookOutcome, PreparedDirectCall, ToolExecutorConfig } from '../executor.js'; /** * One provider tool call, from raw to admitted. * * The executor's job is to run tools; this is the gate every call passes * before one runs. A call arrives as the model streamed it — possibly not * valid JSON, possibly cut off mid-argument, possibly naming a tool that does * not exist — and leaves as a prepared, plugin-approved, authorized call, or * as a synthetic failure that answers the model with what was wrong. Nothing * here dispatches a tool, and nothing here writes a result: that is the * executor's half. * * The family reads exactly three things off the executor it serves, and they * arrive as one value rather than as a captured reference: the tool registry * config, the event sink and the logger. `config` in particular is read * per call and never held — `ToolExecutor.setSandbox` REPLACES it, so a host * captured once would hand the next admission a stale sandbox. */ export interface ToolAdmissionHost { readonly config: ToolExecutorConfig; readonly emitEvent: EmitEvent; readonly log: Logger; } export declare function runPreToolHook(host: ToolAdmissionHost, toolName: string, input: unknown, signal?: AbortSignal): Promise; export declare function prepareDirectCall(host: ToolAdmissionHost, toolCall: ToolCall): Promise; /** * Turn the call the model issued into a name and a parsed input, giving * a configured repairer one chance to fix it first. * * Exactly one chance: a repairer that produces a call which is still * broken will not do better on a second look, and an unbounded loop * here is a hang rather than a degradation. * * `invalid_json` is the ONLY failure that stops the call here, and it * stopped it before this function existed too. `unknown_tool` and * `schema_validation` merely OFFER the repair and otherwise fall * through to the registry, which reports both with better messages — * its schema error already ships a "Required: : " hint the * model can self-correct from. So with no repairer configured this is * behaviorally identical to the bare `JSON.parse` it replaced. */ export declare function resolveCall(host: ToolAdmissionHost, toolCall: ToolCall): Promise<{ ok: true; toolName: string; input: unknown; } | { ok: false; toolName: string; message: string; }>; export declare function repairTruncatedCall(host: ToolAdmissionHost, toolCall: ToolCall, toolName: string): Promise; export declare function formatFailedToolOutput(output: string | undefined, error: string | undefined): string; export declare function truncatedToolInputMessage(toolName: string): string; //# sourceMappingURL=tool-call-admission.d.ts.map