import { z } from 'zod';

/**
 * Error thrown when JSON repair fails.
 */
declare class JsonFixError extends Error {
    raw: string;
    constructor(msg: string, raw: string);
}
/**
 * Attempts to repair and parse "almost-JSON" text from LLMs.
 * Optionally validates with a Zod schema.
 */
declare function ensureJson<T = unknown>(raw: string, schema?: z.ZodType<T>): T;
/**
 * Async version of ensureJson.
 */
declare function ensureJsonAsync<T = unknown>(raw: string, schema?: z.ZodType<T>): Promise<T>;

export { JsonFixError, ensureJson, ensureJsonAsync };
