/** * Optional per-surface DATA schema for the A2UI engine — the data-model side of * the registry's prop typing (findings §4.3). A schema declares the shape of the * fields a surface's data model may hold (JSON Pointer → type + optional * enum/format/description). It does two things: * - documents the declared fields in the system prompt (`a2uiDataSchemaSection`), * so the agent knows which paths exist and what they hold; * - validates `updateDataModel` writes against those declarations * (`validateSchemaWrite`), turning a type mismatch on a declared pointer into a * `SCHEMA_TYPE_MISMATCH` error and a write to an undeclared top-level branch * into a `SCHEMA_UNDECLARED_PATH` warning — both relayed through the same * `onValidationError` feedback loop the agent already consumes. * * Pure TS, no Svelte. Deliberately MINIMAL (v1): exact-pointer type/enum checks * and a top-level "did you mean to write here?" warning. Deferred: required * fields, nested object schemas, cross-field constraints, and transporting the * schema inside the envelope. */ import { type A2uiValidationIssue } from './a2ui.types.js'; /** The JSON primitive/shape a declared field holds. */ export type A2uiSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; /** One declared field: its type plus optional enum/format/description for the prompt. */ export interface A2uiSchemaField { type: A2uiSchemaType; /** Agent-facing description; emitted into the prompt verbatim. */ description?: string; /** Allowed literal values (documented + enforced for string/number fields). */ enum?: readonly (string | number)[]; /** A format hint (e.g. `date`, `time`, `email`) — documented, not enforced in v1. */ format?: string; } /** Surface data schema: absolute JSON Pointer → field declaration. */ export type A2uiDataSchema = Readonly>; /** * Validate one `updateDataModel` write against the schema. `pointer` is the * write target (`''`/`'/'`/`undefined` = whole model); `value` is the written * value (`undefined` for a delete — never flagged). Returns any schema issues. */ export declare function validateSchemaWrite(schema: A2uiDataSchema, pointer: string | undefined, value: unknown, surfaceId?: string): A2uiValidationIssue[]; /** * Render the schema as a prompt section listing every declared field, its type * and any enum/format/description. Appended by the app after `a2uiSystemPrompt` * (like the transport section), NOT baked into the generator. */ export declare function a2uiDataSchemaSection(schema: A2uiDataSchema): string;