/** * `BlueprintSource` — the single provenance vocabulary for blueprints. * * One discriminated union, replacing the flat provenance strings that * previously lived on three separate seams (catalog entries, screen * blueprints, and the runtime cache registry). The discriminant is * `kind`; the `llm` arm carries the engine provenance that the flat * strings could never express. * * Arms: * * - `llm` — engine-generated. `generator` is the slug of the * {@link UiGenerator} that produced the component code; `model` is * the route the engine called, as a `ModelRef`. Both REQUIRED: every * generation mint site has them in scope, and an engine-generated * artifact without them is not a real state. * - `user` — developer-registered / hand-authored. Covers * manifest-declared UIs, operator-registered blueprints, and * imported artifacts that carry no engine claim. No engine * provenance exists for these, so the arm carries none. * - `curated` — hand-authored system blueprint shipped with a * deployment's screen-blueprint catalog (a design call made by the * catalog author, ranked above generated output by the matcher). * * Dead-arm verdict (2026-06 provenance trace): the legacy flat * vocabularies also declared a `heuristic` arm ("rule-based composer"). * A repo-wide mint trace found ZERO sites that ever produced it, so the * arm is deleted rather than carried. There is intentionally NO * legacy/unlabeled arm and NO optional provenance: blueprints are a * cache (invalidation = regeneration, never data loss), so unlabeled * rows are dropped at the trust boundary, never coerced. */ import { type ModelRef } from "./llm-route.js"; /** Closed list of `BlueprintSource` discriminants. */ export declare const BLUEPRINT_SOURCE_KINDS: readonly ["llm", "user", "curated"]; /** Discriminant of {@link BlueprintSource}. */ export type BlueprintSourceKind = (typeof BLUEPRINT_SOURCE_KINDS)[number]; /** * The de-modeled generator identity (ggui#924): `ui-gen-` + ONE tier token * — `ui-gen-default`, `ui-gen-advanced`, or an operator-defined tier. No * model segment: the model is its own field, so a model retirement never * renames an identity or re-keys a stored record. The template admits any * `ui-gen-*` at the type level; {@link isGeneratorId} is the grammar. */ export declare const GENERATOR_ID_PATTERN: RegExp; /** A generator identity — see {@link GENERATOR_ID_PATTERN}. */ export type GeneratorId = `ui-gen-${string}`; /** Whether `value` is a generator identity: one tier token, no model segment. */ export declare function isGeneratorId(value: string): value is GeneratorId; /** Engine-generated — full engine provenance is mandatory. */ export interface LlmBlueprintSource { readonly kind: "llm"; /** * The generator identity that produced the component code (e.g. * `'ui-gen-default'`), de-modeled — see {@link GENERATOR_ID_PATTERN}. * The server's `GeneratorRegistry` is the authority for which * identities exist on a given deployment. */ readonly generator: GeneratorId; /** * The route the generator's LLM call used, rendered in the registry's * spelling (`/`; {@link ModelRef}, composed only by * `modelRefOfRoute`). Registry ids (`'anthropic/claude-haiku-4-5'`) are * the subset the registry lists; a self-hoster's bedrock or OpenRouter * route is a ref too. One spelling per route: a dated wire id is refused. */ readonly model: ModelRef; } /** Developer-registered / hand-authored — no engine provenance exists. */ export interface UserBlueprintSource { readonly kind: "user"; } /** Hand-authored system blueprint shipped with a deployment's catalog. */ export interface CuratedBlueprintSource { readonly kind: "curated"; } export type BlueprintSource = LlmBlueprintSource | UserBlueprintSource | CuratedBlueprintSource; /** * Validating narrower for trust boundaries (DB row → union, JSON * artifact → union). Returns a CANONICAL rebuild of the union value — * stray keys on the input do not ride through — or `null` when the * value is not a well-formed `BlueprintSource`. Callers at load seams * drop-with-log or reject loudly on `null`; coercing a malformed value * into an arm is banned. */ export declare function parseBlueprintSource(value: unknown): BlueprintSource | null; /** Type-guard form of {@link parseBlueprintSource}. */ export declare function isBlueprintSource(value: unknown): value is BlueprintSource; /** * Flat-encoded provenance: the SINGLE key vocabulary every store uses * when it persists a {@link BlueprintSource} as scalar columns / * attributes (vector-store metadata, key-value rows, …). The union is * the code shape; storage stays flat — and every store flattens and * rebuilds through THIS codec, never through hand-rolled key names. * * Key vocabulary: `sourceKind` / `sourceGenerator` / `sourceModel`. * The `source`-prefixed triple is deliberate: flat rows mix provenance * with arbitrary other attributes, and bare `generator` / `model` keys * collide with row-level fields that legitimately carry their own * generator/model semantics (e.g. a generation-result row). The prefix * keeps the provenance keys self-describing, collision-free, and * greppable, and mirrors the union access path (`source.kind` → * `sourceKind`). No storage engine ergonomics argue against it — * attribute names are free-form in every store we target. */ export declare const FLAT_BLUEPRINT_SOURCE_KEYS: { readonly kind: "sourceKind"; readonly generator: "sourceGenerator"; readonly model: "sourceModel"; }; /** * Flat (storage) shape of a {@link BlueprintSource}. `sourceGenerator` * / `sourceModel` are present exactly when `sourceKind === 'llm'` — * {@link blueprintSourceToFlat} never writes them for other arms, and * {@link flatToBlueprintSource} sheds stray values on non-llm rows. */ export interface FlatBlueprintSource { readonly sourceKind: BlueprintSourceKind; readonly sourceGenerator?: string; readonly sourceModel?: string; } /** Flatten a canonical {@link BlueprintSource} into storage keys. */ export declare function blueprintSourceToFlat(source: BlueprintSource): FlatBlueprintSource; /** * Validating narrower at the flat-row trust boundary: reassemble the * `sourceKind` / `sourceGenerator` / `sourceModel` scalars of an * UNTRUSTED row into a canonical {@link BlueprintSource}, or `null` * when the row carries no valid provenance (rows written under a * retired vocabulary, foreign rows, malformed writes). Callers drop * the row — coercing into an arm is banned. Delegates the union * rebuild to {@link parseBlueprintSource}, so stray keys never ride * through and a non-llm row carrying vestigial generator/model * scalars rebuilds to its bare arm. * * Accepts any object-shaped row (metadata records, unmarshalled rows); * only the three codec keys are read. */ export declare function flatToBlueprintSource(row: { readonly sourceKind?: unknown; readonly sourceGenerator?: unknown; readonly sourceModel?: unknown; }): BlueprintSource | null; //# sourceMappingURL=blueprint-source.d.ts.map