/** * Layer B (inner JSON Schema meta-validation) for a `DataContract`. * * Walks the six inner JSON Schema fields the agent authors: * 1. `propsSpec.properties[*].schema` * 2. `actionSpec[*].schema` (optional per entry) * 3. `streamSpec[*].schema` * 4. `contextSpec[*].schema` * 5. `agentCapabilities.tools[*].toolInfo.inputSchema` (required per entry) * 6. `agentCapabilities.tools[*].toolInfo.outputSchema` (optional per entry) * * For each present schema, runs `compileForValidation()` from * `ajv-runtime`. Ajv's `strict: true` mode throws on malformed JSON * Schemas at compile-time — unknown keywords, missing `items` on * array nodes, properties values that are not schemas, etc. This is * the meta-validation pass: it asserts the contract's own type * descriptions are well-formed BEFORE any runtime data flows. * * Failures collect into a single throw with every malformed field * named — agents fix all of them in one round rather than retry- * per-field. * * Designed to slot at: * - `ggui_handshake` entry — validates `blueprintDraft.contract` * before the negotiator runs. * - `ggui_render` entry — validates the `effectiveContract` (either * synth-amended or override) before any state mutation. * * Both call sites already run cross-reference and name-invariant * assertions for the same author-recoverable failure class; this * sits alongside them. */ import type { DataContract } from '../types/data-contract.js'; export interface SchemaMetaViolation { /** Path to the malformed schema field (e.g., `propsSpec.properties.todos.schema`). */ field: string; /** Ajv's compile-error message (truncated to fit the wire). */ message: string; } /** * Typed error for contract schema meta-validation failures. Mirrors * the shape of `CrossReferenceError` / `ContractViolationError` for * symmetry — render/handshake catch and surface a structured * `contract_schema_invalid` error to the agent. */ export declare class ContractSchemaMetaError extends Error { readonly code: "contract_schema_invalid"; readonly violations: readonly SchemaMetaViolation[]; readonly hint: string; constructor(violations: readonly SchemaMetaViolation[]); } /** * Walks the contract's six inner JSON Schema fields and collects a * {@link SchemaMetaViolation} for each that does not compile cleanly * under Ajv's strict mode (unknown keyword, missing `items`, a * non-schema `properties` value, or a missing `schema:` wrapper). Pure * check — returns the full list so callers can either repair (the * handshake repair loop) or throw (see {@link assertContractSchemasValid}). * * This is the inner-schema validity check folded into the unified * `validateContract` gate (lint-contract.ts `phaseSchemaMeta`) — the * one check the strict linter was previously missing relative to the * render/handshake assert set. */ export declare function checkContractSchemasValid(contract: DataContract): SchemaMetaViolation[]; /** * Throwable wrapper around {@link checkContractSchemasValid}. Throws * {@link ContractSchemaMetaError} (collecting every malformed schema in * one pass) when any inner JSON Schema fails Ajv strict-mode * compilation. No-op when all schemas are well-formed. */ export declare function assertContractSchemasValid(contract: DataContract): void; //# sourceMappingURL=schema-meta-validation.d.ts.map