import type { Json, JsonSchema } from "./ids.js"; /** * v2 spec §3 — * the shape model behind shape-aware binding. A ShapeType is the structural * type of a host tool / fn: response: field names, kinds, and (where the host * declared one) the closed enum. `json` is the unknown type — the defensive * default the spec assigns wherever no shape is known. * * Shapes come from the host's DECLARED schemas ({@link shapeFromJsonSchema}); * the engine hands them to the model as generation context * ({@link describeShape}) and to the wire compiler as `toolShapes` for the * binding type-check (genui/wire/shape-check.ts). Nothing samples the host. */ export type ShapeType = { kind: "string" | "number" | "boolean" | "null" | "json"; enum?: readonly Json[]; } | { kind: "array"; items: ShapeType; } | { kind: "object"; fields: Record; optional?: string[]; }; /** One pointer-walk miss, with the field context per-binding repair needs * (genui/wire/shape-check.ts). */ export interface ShapePointerMiss { message: string; missing?: string[]; available?: string[]; } /** * v2 spec §3 — walk a shape by RFC 6901 JSON Pointer (`""` is the whole * shape), reporting the first miss with the field context repair needs. * `json` stays `json` at any depth (the unknown type is closed under * projection). `null` shape + `null` miss means an undecodable pointer * segment — treated as unknown, not an error (validate layers own pointer * grammar). The pointer must be `""` or start with `/`. */ export declare const walkShapePointer: (shape: ShapeType, pointer: string) => { shape: ShapeType | null; miss: ShapePointerMiss | null; }; /** * v2 spec §3 — the miss-blind view of {@link walkShapePointer}: absent * fields, non-index segments into arrays, and segments past scalars return * `undefined` — the compile-time miss the shape check reports. */ export declare function shapeAtPointer(shape: ShapeType, pointer: string): ShapeType | undefined; /** A declared enum prints its VALUES: the closed vocabulary is the useful fact, * and a model that reads `string` where the host declared `"paid" | "void"` * invents values the host will reject. */ export declare const enumText: (values: readonly Json[] | undefined) => string | undefined; /** v2 spec §3 — the compact notation the engine embeds in the model's tool * context (e.g. `{ month: string, revenue: number }[]`). Deterministic, * depth-bounded (`…` beyond {@link DESCRIBE_MAX_DEPTH}). */ export declare function describeShape(shape: ShapeType): string; /** * A DECLARED JSON Schema in the checks' structural form — the producer of * `toolShapes` now that nothing samples. `allOf` intersects; other unmodelled * constructs (anyOf, $ref, custom keywords) degrade to `{ kind: "json" }`, * never a throw. * `enum`/`const` SURVIVE onto the scalar branch: an enum erased to a bare * `string` is what refused a correct screen at the checks floor (live 2026-08, * demo-bank's spending donut). */ export declare function shapeFromJsonSchema(schema: JsonSchema): ShapeType;