import type { ZodType } from 'zod/v4'; /** A single chat-style message in the transport-agnostic repair conversation. */ export interface RepairMessage { role: string; content: string; } export interface RunWithRepairOptions { system: string; user: string; schema: ZodType; /** * Transport-specific call: given the full message list, return the raw * (possibly non-JSON, possibly fenced) response content. Implementations * own their own error handling/logging for the underlying call; this * harness only orchestrates the repair-retry loop and JSON/schema * extraction on top of whatever string comes back. */ transport: (messages: RepairMessage[]) => Promise; /** Initial call + this many repair retries before throwing. Defaults to 2. */ maxRepairRetries?: number; /** * Builds the final error message when all retries are exhausted, given the * last schema/parse error and the retry count actually used. Lets each * transport keep its own provider-specific error phrasing. */ buildError: (lastError: string, retries: number) => string; } /** Initial call + this many repair retries before throwing, when not overridden. */ export declare const DEFAULT_MAX_REPAIR_RETRIES = 2; /** Extract a JSON object from model content: drop fences, slice first { … last }. */ export declare function extractJson(content: string): string; export declare function safeJson(s: string): unknown; /** * Transport-agnostic JSON-extraction + schema-repair-retry harness. Owns the * conversation shape (system/user, then assistant/user repair turns) and the * extract → parse → validate → retry loop; callers supply the actual * request/response transport (HTTP fetch, subprocess spawn, etc.) and how to * phrase the final error. */ export declare function runWithRepair(o: RunWithRepairOptions): Promise; //# sourceMappingURL=json-repair.d.ts.map