/** * Minimal JSON Schema validator — covers the subset needed for plugin * configSchema validation and tool inputSchema sanity checks. Intentionally * small (~80 lines, zero deps) and tolerant: unknown keywords are ignored so * authors can mix in non-standard extensions without breaking validation. * * NOT for full JSON Schema 2020-12 conformance. If a plugin needs $ref, * conditional schemas, format validation, or anything else exotic, it should * bring its own ajv-based validator and call this only for the cheap path. */ import type { JSONSchema } from '../types/tool.js'; export interface ValidationError { path: string; message: string; } export interface ValidationResult { ok: boolean; errors: ValidationError[]; } export declare function validateAgainstSchema(value: unknown, schema: JSONSchema): ValidationResult; export interface CoercionResult { value: unknown; /** True when at least one leaf was rewritten. */ changed: boolean; } /** * Best-effort, lossless coercion of a value toward a JSON Schema. Models — * especially through OpenAI-compatible proxies — frequently deliver * arguments with the right *content* in the wrong *type*: numbers and * booleans encoded as strings ("5", "true"), scalars where a string is * expected, or a whole nested object serialized into a JSON string. * * Only conversions that cannot lose information are applied: * - string → number/integer when the whole trimmed string parses cleanly * - string "true"/"false" → boolean * - number/boolean → string when a string is expected * - JSON-serialized string → object/array when the parse yields that shape * Recurses into `properties`/`items`. Returns the (possibly new) value and * whether anything changed — callers should re-validate before trusting it. */ export declare function coerceAgainstSchema(value: unknown, schema: JSONSchema): CoercionResult; //# sourceMappingURL=json-schema-validate.d.ts.map