import { z } from "zod"; import { type Json, type TreeNode, VENDO_TREE_FORMAT } from "@vendoai/core"; /** v2 spec §1–2 — * query names are bare identifiers: the query's result lives at JSON Pointer * `"/" + name` by definition, so there is no `path` field to validate. * Shared with the wire compiler (wire/compile.ts), which validates * `` against the same grammar. */ export declare const QUERY_NAME_PATTERN: RegExp; /** v2 spec §1–2 */ export interface TreeQuery { name: string; tool: string; input?: Record; } /** * v2 spec §1–2 — * structural shape only (the types+zod pairing convention). * {@link validateTree} is the normative gate; this schema alone accepts * queries validateTree rejects. */ export declare const treeQuerySchema: z.ZodObject<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>; /** v2 spec §1–2 — * mirrors v1 `Tree` minus `components`: trees never carry component * sources (they live at the app-document level). Nodes are v1 nodes * verbatim. */ export interface Tree { formatVersion: typeof VENDO_TREE_FORMAT; root: string; nodes: TreeNode[]; data?: Record; queries?: TreeQuery[]; } /** * v2 spec §1–2 — * structural shape only (the types+zod pairing convention). * The pinned wire rules (caps, name grammar, root/id integrity, fn: syntax, * the no-components rule) live in {@link validateTree}, which is the * normative gate; this schema alone accepts trees validateTree rejects. */ export declare const treeSchema: z.ZodObject<{ formatVersion: z.ZodLiteral<"vendo-genui/v2">; root: z.ZodString; nodes: z.ZodArray>; props: z.ZodOptional>; children: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">; data: z.ZodOptional>; queries: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ formatVersion: z.ZodLiteral<"vendo-genui/v2">; root: z.ZodString; nodes: z.ZodArray>; props: z.ZodOptional>; children: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">; data: z.ZodOptional>; queries: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ formatVersion: z.ZodLiteral<"vendo-genui/v2">; root: z.ZodString; nodes: z.ZodArray>; props: z.ZodOptional>; children: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; component: z.ZodString; source: z.ZodOptional>; props: z.ZodOptional>; children: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">; data: z.ZodOptional>; queries: z.ZodOptional>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ name: z.ZodString; tool: z.ZodString; input: z.ZodOptional>; }, z.ZodTypeAny, "passthrough">>, "many">>; }, z.ZodTypeAny, "passthrough">>; type TreeValidation = { ok: true; tree: Tree; } | { ok: false; error: { code: "version" | "provision"; message: string; }; }; /** v2 spec §1–2 */ export declare function validateTree(input: unknown): TreeValidation; /** * 06-apps §8 — the pin-drift report is SERVER-AUTHORITATIVE. The stored tree is * model-written or imported from an untrusted `.vendoapp`, so a forged * `pinDrift` riding the document must never reach the client: strip it before * the computed drift (when any) is attached — and strip at persist time too (the * runtime shares this helper), streamed or at rest. * * `inClient` is stripped for a harder reason. In-client native execution is * gone, but the verdict field still exists in the wire schema, and no verdict is * ever authored now — so any `inClient` on a document is a forgery. Left on the * wire it could hand a `granted` verdict to a client that still carries the * executor and make it run native code, so it is always dropped. * * `dataUnavailable` joins them: only the code that ran the queries and watched * them fail may tell the user their data did not load. Document-carried it would * be a claim about a load that never happened, and a transient failure must never * be persisted as one. */ export declare const stripServerAuthoritativeFields: (payload: T) => T; export {}; //# sourceMappingURL=tree.d.ts.map