import { type AssistantMessage, type JsonSchema } from "./anthropic.js"; export interface ValidationError { kind: "unknown_tool" | "input_not_object" | "schema_violation" | "schema_uncheckable" | "stop_reason_mismatch"; blockIndex: number | null; tool: string | null; path?: string; message: string; } export interface ValidationResult { valid: boolean; errors: ValidationError[]; /** tool_use blocks seen. */ toolUseCount: number; /** * tool_use blocks that could not be schema-checked (declared tool with no * input_schema, or a schema Ajv could not compile). These are failures: without * an executable schema neither the backend call nor a proposed repair can be * proven valid. */ uncheckableCount: number; } /** * Deterministic tool_use gate. NO LLM. Turns a silently-broken tool call (empty * args, wrong schema, hallucinated tool, or a tool_use without the matching * stop_reason) into an explicit result the caller can log (detect mode) or act * on (repair mode, later). */ export declare class ToolUseValidator { private readonly ajv; private readonly cache; private readonly schemaStringCache; constructor(); /** Returns a compiled validator, or null if the schema could not compile. */ private compiledFor; private validateSingleToolBlock; validate(assistant: AssistantMessage, tools: Map): ValidationResult; } /** Order-independent deterministic serialization — schema cache keys here, block comparison in repair.ts. */ export declare function stableStringify(v: unknown): string;