/** * DocumentGraph node well-formedness — the ONE declarative trust gate. * * A `DocumentGraphNode` that arrives from an UNTRUSTED source (a serialized * graph lowered onto the runtime, OR a model-proposed `GraphPatch` op) is just * JSON until its SHAPE is verified. `sealNode` only recomputes a node's content * address; it does NOT check that the payload conforms to its family's fields. * * This module factors that check OUT of `ai-cast.ts` (where it began life * gating model proposals) so BOTH the AI seam AND the runtime graph loader * (`@czap/astro`'s `loadGraphRuntime`) share ONE trust gate — a node the loader * accepts is a node the AI validator would accept, and vice versa. There is no * second, drifting copy of "is this a well-formed node?". * * Each family is a `Schema.Struct`; the union over all EIGHT families is the * single source of truth. The compile-time exhaustiveness check makes "added a * family to document-graph.ts but not a schema here" a BUILD error — closing the * "validator missed a family" class for good (no runtime table to forget). * * Branded string types (ContentAddress / SignalInput / StateName / * AddressedDigest) validate as plain `Schema.String`: the brand is a * compile-time refinement and the address FORMAT is an invariant, not a wire * law. `meta` and the structurally-opaque fields (CapSet, the digests, * ProjectionKeys, the evaluate cache) are `Schema.Unknown` — presence is the * contract; their shape is sealed/derived elsewhere. * * @module */ import { Schema } from 'effect'; import type { DocumentGraphNode } from './document-graph.js'; /** * The single source of truth for "is this a well-formed DocumentGraph node?". * Carries the Standard Schema V1 `~standard` interop property, so any * Standard-Schema-aware consumer can use the same node gate directly. * `Schema.is` / {@link isWellFormedNode} behavior is unchanged. */ export declare const DocumentGraphNodeSchema: import("@standard-schema/spec").StandardSchemaV1<{ readonly id: string; readonly input: string; readonly _tag: "DocGraphSignalNode"; readonly _version: 1; readonly family: "signal"; readonly meta: unknown; readonly range?: readonly [number, number] | undefined; } | { readonly id: string; readonly _tag: "DocGraphEntityNode"; readonly _version: 1; readonly family: "entity"; readonly meta: unknown; readonly components: readonly string[]; } | { readonly id: string; readonly _tag: "DocGraphComponentNode"; readonly _version: 1; readonly family: "component"; readonly meta: unknown; readonly name: string; readonly states?: readonly string[] | undefined; readonly thresholds?: readonly unknown[] | undefined; readonly boundaryRef?: string | undefined; } | { readonly state: string; readonly id: string; readonly _tag: "DocGraphPoseNode"; readonly _version: 1; readonly family: "pose"; readonly meta: unknown; readonly bindings: { readonly [x: string]: string | number; }; readonly entityRef: string; readonly evaluated?: unknown; } | { readonly id: string; readonly _tag: "DocGraphTransitionNode"; readonly _version: 1; readonly family: "transition"; readonly meta: unknown; readonly routing: "seq" | "par" | "choice_then" | "choice_else"; readonly fromPose: string; readonly toPose: string; readonly durationMs?: number | undefined; } | { readonly keys: unknown; readonly id: string; readonly _tag: "DocGraphProjectionNode"; readonly _version: 1; readonly family: "projection"; readonly meta: unknown; readonly target: "css" | "glsl" | "wgsl" | "aria" | "ai" | "config" | "svg"; readonly sourceRef: string; readonly resultDigest: unknown; } | { readonly id: string; readonly _tag: "DocGraphPolicyNode"; readonly _version: 1; readonly family: "policy"; readonly meta: unknown; readonly appliesTo: readonly string[]; readonly sites: readonly ("node" | "browser" | "worker" | "edge")[]; readonly requires: "static" | "styled" | "reactive" | "animated" | "gpu"; readonly grants: { readonly _tag: "CapSet"; readonly levels: readonly ("static" | "styled" | "reactive" | "animated" | "gpu")[]; }; readonly budgets?: unknown; } | { readonly id: string; readonly _tag: "DocGraphExportNode"; readonly _version: 1; readonly family: "export"; readonly meta: unknown; readonly carrier: "svg" | "astro-page" | "video" | "ship-capsule" | "receipt"; readonly sourceRefs: readonly string[]; readonly artifactDigest: unknown; readonly receiptHash?: string | undefined; }, { readonly id: string; readonly input: string; readonly _tag: "DocGraphSignalNode"; readonly _version: 1; readonly family: "signal"; readonly meta: unknown; readonly range?: readonly [number, number] | undefined; } | { readonly id: string; readonly _tag: "DocGraphEntityNode"; readonly _version: 1; readonly family: "entity"; readonly meta: unknown; readonly components: readonly string[]; } | { readonly id: string; readonly _tag: "DocGraphComponentNode"; readonly _version: 1; readonly family: "component"; readonly meta: unknown; readonly name: string; readonly states?: readonly string[] | undefined; readonly thresholds?: readonly unknown[] | undefined; readonly boundaryRef?: string | undefined; } | { readonly state: string; readonly id: string; readonly _tag: "DocGraphPoseNode"; readonly _version: 1; readonly family: "pose"; readonly meta: unknown; readonly bindings: { readonly [x: string]: string | number; }; readonly entityRef: string; readonly evaluated?: unknown; } | { readonly id: string; readonly _tag: "DocGraphTransitionNode"; readonly _version: 1; readonly family: "transition"; readonly meta: unknown; readonly routing: "seq" | "par" | "choice_then" | "choice_else"; readonly fromPose: string; readonly toPose: string; readonly durationMs?: number | undefined; } | { readonly keys: unknown; readonly id: string; readonly _tag: "DocGraphProjectionNode"; readonly _version: 1; readonly family: "projection"; readonly meta: unknown; readonly target: "css" | "glsl" | "wgsl" | "aria" | "ai" | "config" | "svg"; readonly sourceRef: string; readonly resultDigest: unknown; } | { readonly id: string; readonly _tag: "DocGraphPolicyNode"; readonly _version: 1; readonly family: "policy"; readonly meta: unknown; readonly appliesTo: readonly string[]; readonly sites: readonly ("node" | "browser" | "worker" | "edge")[]; readonly requires: "static" | "styled" | "reactive" | "animated" | "gpu"; readonly grants: { readonly _tag: "CapSet"; readonly levels: readonly ("static" | "styled" | "reactive" | "animated" | "gpu")[]; }; readonly budgets?: unknown; } | { readonly id: string; readonly _tag: "DocGraphExportNode"; readonly _version: 1; readonly family: "export"; readonly meta: unknown; readonly carrier: "svg" | "astro-page" | "video" | "ship-capsule" | "receipt"; readonly sourceRefs: readonly string[]; readonly artifactDigest: unknown; readonly receiptHash?: string | undefined; }> & Schema.Union; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"signal">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly input: Schema.String; readonly range: Schema.optional>; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphEntityNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"entity">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly components: Schema.$Array; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphComponentNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"component">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly name: Schema.String; readonly boundaryRef: Schema.optional; readonly thresholds: Schema.optional>; readonly states: Schema.optional>; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphPoseNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"pose">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly entityRef: Schema.String; readonly state: Schema.String; readonly bindings: Schema.$Record>; readonly evaluated: Schema.optional; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphTransitionNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"transition">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly fromPose: Schema.String; readonly toPose: Schema.String; readonly routing: Schema.Union, Schema.Literal<"par">, Schema.Literal<"choice_then">, Schema.Literal<"choice_else">]>; readonly durationMs: Schema.optional; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphProjectionNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"projection">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly target: Schema.Union, Schema.Literal<"glsl">, Schema.Literal<"wgsl">, Schema.Literal<"aria">, Schema.Literal<"ai">, Schema.Literal<"config">, Schema.Literal<"svg">]>; readonly sourceRef: Schema.String; readonly keys: Schema.Unknown; readonly resultDigest: Schema.Unknown; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphPolicyNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"policy">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly appliesTo: Schema.$Array; readonly requires: Schema.Union, Schema.Literal<"styled">, Schema.Literal<"reactive">, Schema.Literal<"animated">, Schema.Literal<"gpu">]>; readonly grants: Schema.Struct<{ readonly _tag: Schema.Literal<"CapSet">; readonly levels: Schema.$Array, Schema.Literal<"styled">, Schema.Literal<"reactive">, Schema.Literal<"animated">, Schema.Literal<"gpu">]>>; }>; readonly sites: Schema.$Array, Schema.Literal<"browser">, Schema.Literal<"worker">, Schema.Literal<"edge">]>>; readonly budgets: Schema.optional; }>, Schema.Struct<{ readonly _tag: Schema.Literal<"DocGraphExportNode">; readonly _version: Schema.Literal<1>; readonly family: Schema.Literal<"export">; readonly id: Schema.String; readonly meta: Schema.Unknown; readonly carrier: Schema.Union, Schema.Literal<"video">, Schema.Literal<"svg">, Schema.Literal<"ship-capsule">, Schema.Literal<"receipt">]>; readonly sourceRefs: Schema.$Array; readonly artifactDigest: Schema.Unknown; readonly receiptHash: Schema.optional; }>]>; /** * Type guard: does this untrusted value conform to ONE of the eight * `DocumentGraphNode` family schemas (correct `_tag`/`_version`/`family` and the * family's required, correctly-typed fields)? The shared trust gate both the AI * proposal validator and the runtime graph loader read. */ export declare const isWellFormedNode: (value: unknown) => value is DocumentGraphNode; //# sourceMappingURL=document-graph-schema.d.ts.map