/**
 * JSON Schema Validator for Structured Output
 *
 * Validates LLM responses against JSON schemas to ensure reliable tool calling
 * and structured output. Supports retry logic and fallback parsing.
 */
import { EventEmitter } from 'events';
export interface JSONSchema {
    type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'null';
    properties?: Record<string, JSONSchemaProperty>;
    items?: JSONSchemaProperty;
    required?: string[];
    enum?: unknown[];
    const?: unknown;
    minimum?: number;
    maximum?: number;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    minItems?: number;
    maxItems?: number;
    additionalProperties?: boolean | JSONSchemaProperty;
    description?: string;
    default?: unknown;
}
export interface JSONSchemaProperty {
    type?: JSONSchema['type'] | JSONSchema['type'][];
    properties?: Record<string, JSONSchemaProperty>;
    items?: JSONSchemaProperty;
    required?: string[];
    enum?: unknown[];
    const?: unknown;
    minimum?: number;
    maximum?: number;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    minItems?: number;
    maxItems?: number;
    additionalProperties?: boolean | JSONSchemaProperty;
    description?: string;
    default?: unknown;
    oneOf?: JSONSchemaProperty[];
    anyOf?: JSONSchemaProperty[];
    allOf?: JSONSchemaProperty[];
}
export interface ValidationResult {
    valid: boolean;
    errors: ValidationError[];
    data?: unknown;
    coerced?: boolean;
}
export interface ValidationError {
    path: string;
    message: string;
    expected?: string;
    received?: string;
}
export interface SchemaValidatorConfig {
    /** Attempt to coerce types (e.g., "123" -> 123) */
    coerceTypes?: boolean;
    /** Remove additional properties not in schema */
    removeAdditional?: boolean;
    /** Use default values for missing properties */
    useDefaults?: boolean;
    /** Max retry attempts for extraction */
    maxRetries?: number;
}
export declare class SchemaValidator extends EventEmitter {
    private config;
    constructor(config?: SchemaValidatorConfig);
    /**
     * Validate data against a JSON schema
     */
    validate(data: unknown, schema: JSONSchema): ValidationResult;
    /**
     * Extract JSON from LLM response text
     */
    extractJSON(text: string): {
        json: unknown;
        extracted: boolean;
    } | null;
    /**
     * Validate and extract structured output from LLM response
     */
    validateResponse(response: string, schema: JSONSchema): ValidationResult & {
        raw: string;
    };
    /**
     * Create a prompt suffix that instructs the LLM to output valid JSON
     */
    createSchemaPrompt(schema: JSONSchema): string;
}
/**
 * Schema for tool call selection
 */
export declare const TOOL_CALL_SCHEMA: JSONSchema;
/**
 * Schema for action plan
 */
export declare const ACTION_PLAN_SCHEMA: JSONSchema;
/**
 * Schema for code edit
 */
export declare const CODE_EDIT_SCHEMA: JSONSchema;
export declare function getSchemaValidator(config?: SchemaValidatorConfig): SchemaValidator;
export declare function resetSchemaValidator(): void;
