@pipelex/mthds-form 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/brand/index.d.ts +287 -0
- package/dist/brand/index.js +487 -0
- package/dist/brand/index.js.map +1 -0
- package/dist/{chunk-2EGRONBV.js → chunk-2HIYTIQ6.js} +5 -5
- package/dist/{chunk-2EGRONBV.js.map → chunk-2HIYTIQ6.js.map} +1 -1
- package/dist/{chunk-7JRT6ZII.js → chunk-3KK2DO7T.js} +5 -5
- package/dist/{chunk-7JRT6ZII.js.map → chunk-3KK2DO7T.js.map} +1 -1
- package/dist/{chunk-GCXV76WU.js → chunk-HQMXXK5X.js} +3 -3
- package/dist/{chunk-GCXV76WU.js.map → chunk-HQMXXK5X.js.map} +1 -1
- package/dist/{chunk-VT5E5W4E.js → chunk-MEXWXLR7.js} +3 -3
- package/dist/{chunk-VT5E5W4E.js.map → chunk-MEXWXLR7.js.map} +1 -1
- package/dist/chunk-QFX332LE.js +22 -0
- package/dist/chunk-QFX332LE.js.map +1 -0
- package/dist/core/gate.js +5 -5
- package/dist/core/index.js +9 -9
- package/dist/core/values.js +3 -3
- package/dist/core/wire-format.js +2 -2
- package/dist/generative/index.d.ts +3 -15
- package/dist/generative/index.js +7 -21
- package/dist/generative/index.js.map +1 -1
- package/dist/manifest-DUeAWeqa.d.ts +17 -0
- package/dist/react/index.js +5 -5
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generative/schema.ts","../../src/generative/shadcn-definitions.ts","../../src/generative/components.ts","../../src/generative/catalog.ts","../../src/generative/props-signature.ts","../../src/generative/designer-catalog.ts","../../src/generative/prompt-hash.ts","../../src/generative/paths.ts","../../src/generative/brief.ts","../../src/generative/validate.ts","../../src/generative/layout-fits.ts","../../src/generative/stream.ts","../../src/generative/brand-context.tsx","../../src/generative/ui/shadcn.tsx","../../src/generative/registry.tsx","../../src/generative/result-slot.tsx","../../src/generative/product-registry.tsx","../../src/generative/page.tsx","../../src/generative/manifest.ts","../../src/generative/state.ts","../../src/generative/fixture.ts"],"names":["z","defineCatalog","components","definitionOf","catalog","descend","present","describe","fieldAt","resolves","React","React2","jsx","Tag","Switch","jsxs","useBoundProp","useFieldValidation","Map","React4","LABEL","React5","React6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqBO,IAAM,gBAAA,GAAmB,YAAA;AAAA,EAC9B,CAAC,CAAA,MAAO;AAAA,IACN,IAAA,EAAM,EAAE,MAAA,CAAO;AAAA,MACb,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,MACf,UAAU,CAAA,CAAE,MAAA;AAAA,QACV,EAAE,MAAA,CAAO;AAAA,UACP,IAAA,EAAM,CAAA,CAAE,GAAA,CAAI,oBAAoB,CAAA;AAAA,UAChC,KAAA,EAAO,CAAA,CAAE,OAAA,CAAQ,oBAAoB,CAAA;AAAA,UACrC,QAAA,EAAU,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA;AAAA,UAC5B,KAAA,EAAO,EAAE,GAAG,CAAA,CAAE,OAAO,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,MAAA,EAAQ,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,UAAS,EAAE;AAAA,UAC3D,OAAA,EAAS,EAAE,GAAG,CAAA,CAAE,KAAI,EAAG,GAAG,CAAA,CAAE,QAAA,EAAS,EAAE;AAAA,UACvC,MAAA,EAAQ,EAAE,GAAG,CAAA,CAAE,KAAI,EAAG,GAAG,CAAA,CAAE,QAAA,EAAS;AAAE,SACvC;AAAA;AACH,KACD,CAAA;AAAA,IACD,OAAA,EAAS,EAAE,MAAA,CAAO;AAAA,MAChB,UAAA,EAAY,EAAE,GAAA,CAAI;AAAA,QAChB,KAAA,EAAO,EAAE,GAAA,EAAI;AAAA,QACb,KAAA,EAAO,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,C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AA,MACJ,CAAA,EAAG,OAAA,CAAQ,MAAA,CAAO,KAAK,gBAAa,OAAA,CAAQ,MAAA,CAAO,MAAM,CAAA,MAAA,EAAS,OAAA,CAAQ,MAAA,CAAO,MAAA,KAAW,CAAA,GAAI,KAAK,GAAG,CAAA;AAAA,KAC1G;AAAA,EACF;AACA,EAAA,OAAO,KAAA,CAAM,KAAK,QAAK,CAAA;AACzB;AAGO,SAAS,WAAA,CAAY,QAAA,EAAkC,OAAA,EAAiB,EAAA,EAAY;AACzF,EAAA,MAAM,QAAQ,QAAA,CAAS,IAAA;AAAA,IACrB,CAAC,OAAA,KAAY,OAAA,CAAQ,YAAY,OAAA,IAAW,SAAA,CAAU,OAAO,CAAA,KAAM;AAAA,GACrE;AACA,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,KAAA,GAAQ,QAAA,CACX,MAAA,CAAO,CAAC,OAAA,KAAY,OAAA,CAAQ,OAAA,KAAY,OAAO,CAAA,CAC/C,GAAA,CAAI,SAAS,CAAA,CACb,KAAK,IAAI,CAAA;AACZ,IAAA,MAAM,IAAI,MAAM,CAAA,gBAAA,EAAmB,EAAE,QAAQ,OAAO,CAAA,SAAA,EAAY,KAAA,IAAS,MAAM,CAAA,CAAA,CAAG,CAAA;AAAA,EACpF;AACA,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["import { defineSchema } from '@json-render/core';\n\n/**\n * Our own json-render schema: the React schema's SHAPE and built-in actions,\n * verbatim, and nothing about prompting.\n *\n * Why not `@json-render/react`'s `schema`: it carries a prompt written for a\n * model that INVENTS data - an \"INITIAL STATE\" section demanding `/state`\n * patches for every bound path, and default rules asking three times for\n * realistic sample data. This layer's posture is the opposite: every value is\n * bound to a path the HOST loads. So the schema here declares no rules and no\n * prompt template at all. The prompt is the designer method's own\n * (`methods/layout-design.mthds`), which receives the catalog as data\n * (`designerCatalog()`) and lays it out in its own prose; `catalog.prompt()`\n * on a catalog over this schema renders json-render's stock text and is not\n * what any model is handed.\n *\n * The spec shape is unchanged because the renderer, the stream compiler and the\n * validator read it, and because a spec written against it renders through any\n * json-render registry.\n */\nexport const generativeSchema = defineSchema(\n (s) => ({\n spec: s.object({\n root: s.string(),\n elements: s.record(\n s.object({\n type: s.ref('catalog.components'),\n props: s.propsOf('catalog.components'),\n children: s.array(s.string()),\n slots: { ...s.record(s.array(s.string())), ...s.optional() },\n visible: { ...s.any(), ...s.optional() },\n repeat: { ...s.any(), ...s.optional() },\n }),\n ),\n }),\n catalog: s.object({\n components: s.map({\n props: s.zod(),\n slots: s.array(s.string()),\n description: s.string(),\n example: s.any(),\n }),\n actions: s.map({\n params: s.zod(),\n description: s.string(),\n }),\n }),\n }),\n {\n // The runtime handles these four without a registry handler; the names and\n // the wording are the React schema's, so a model that has seen json-render\n // before recognises them. The validator reads them to know which actions\n // need no handler, and `designerCatalog()` lists them first, marked\n // built-in, so the method's prompt names them beside the catalog's own.\n builtInActions: [\n {\n name: 'setState',\n description:\n 'Update a value in the state model at the given statePath. Params: { statePath: string, value: any }',\n },\n {\n name: 'pushState',\n description:\n 'Append an item to an array in state. Params: { statePath: string, value: any, clearStatePath?: string }.',\n },\n {\n name: 'removeState',\n description:\n 'Remove an item from an array in state by index. Params: { statePath: string, index: number }',\n },\n {\n name: 'validateForm',\n description:\n 'Validate all registered form fields and write the result to state. Params: { statePath?: string }. Defaults to /formValidation.',\n },\n ],\n },\n);\n","import { z } from 'zod';\n\n/**\n * The component DEFINITIONS the catalog picks from shadcn/ui, vendored.\n *\n * They are json-render's shadcn catalog entries, copied verbatim from\n * `@json-render/shadcn` at `0.20.0` for the subset `components.ts` picks and\n * nothing else. Vendoring them is what keeps the package off that dependency:\n * the definitions are zod and prose, the renderers are React over radix, and a\n * consumer of this entry should install neither. The controls vendor their\n * primitives for the same reason; see `docs/dependency-budget.md`.\n *\n * These strings ARE the prompt: `designerCatalog()` hands them to the designer\n * method as data, and the prompt hash is computed over the result.\n * `docs/generative-ui.md` states the pin, and `__tests__/prompt.test.ts` fails\n * the moment a character here moves - which is also what proves this copy\n * faithful to the definitions the captured layouts were produced against.\n */\n\nconst validationCheckSchema = z\n .array(\n z.object({\n type: z.string(),\n message: z.string(),\n args: z.record(z.string(), z.unknown()).optional(),\n }),\n )\n .nullable();\n\nconst validateOnSchema = z.enum(['change', 'blur', 'submit']).nullable();\n\nexport const shadcnComponentDefinitions = {\n // ── Layout ────────────────────────────────────────────────────────────────\n Card: {\n props: z.object({\n title: z.string().nullable(),\n description: z.string().nullable(),\n maxWidth: z.enum(['sm', 'md', 'lg', 'full']).nullable(),\n centered: z.boolean().nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description:\n 'Container card for content sections. Use for forms/content boxes, NOT for page headers.',\n example: { title: 'Overview', description: 'Your account summary' },\n },\n Stack: {\n props: z.object({\n direction: z.enum(['horizontal', 'vertical']).nullable(),\n gap: z.enum(['none', 'sm', 'md', 'lg', 'xl']).nullable(),\n align: z.enum(['start', 'center', 'end', 'stretch']).nullable(),\n justify: z.enum(['start', 'center', 'end', 'between', 'around']).nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description: 'Flex container for layouts',\n example: { direction: 'vertical', gap: 'md' },\n },\n Grid: {\n props: z.object({\n columns: z.number().nullable(),\n gap: z.enum(['sm', 'md', 'lg', 'xl']).nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description: 'Grid layout (1-6 columns)',\n example: { columns: 3, gap: 'md' },\n },\n Separator: {\n props: z.object({\n orientation: z.enum(['horizontal', 'vertical']).nullable(),\n }),\n description: 'Visual separator line',\n },\n Collapsible: {\n props: z.object({\n title: z.string(),\n defaultOpen: z.boolean().nullable(),\n }),\n slots: ['default'],\n description: 'Collapsible section with trigger. Children render inside.',\n },\n // ── Content ───────────────────────────────────────────────────────────────\n Heading: {\n props: z.object({\n text: z.string(),\n level: z.enum(['h1', 'h2', 'h3', 'h4']).nullable(),\n }),\n description: 'Heading text (h1-h4)',\n example: { text: 'Welcome', level: 'h1' },\n },\n Text: {\n props: z.object({\n text: z.string(),\n variant: z.enum(['body', 'caption', 'muted', 'lead', 'code']).nullable(),\n }),\n description: 'Paragraph text',\n example: { text: 'Hello, world!' },\n },\n Avatar: {\n props: z.object({\n src: z.string().nullable(),\n name: z.string(),\n size: z.enum(['sm', 'md', 'lg']).nullable(),\n }),\n description: 'User avatar with fallback initials',\n example: { name: 'Jane Doe', size: 'md' },\n },\n Badge: {\n props: z.object({\n text: z.string(),\n variant: z.enum(['default', 'secondary', 'destructive', 'outline']).nullable(),\n }),\n description: 'Status badge',\n example: { text: 'Active', variant: 'default' },\n },\n Alert: {\n props: z.object({\n title: z.string(),\n message: z.string().nullable(),\n type: z.enum(['info', 'success', 'warning', 'error']).nullable(),\n }),\n description: 'Alert banner',\n example: {\n title: 'Note',\n message: 'Your changes have been saved.',\n type: 'success',\n },\n },\n Progress: {\n props: z.object({\n value: z.number(),\n max: z.number().nullable(),\n label: z.string().nullable(),\n }),\n description: 'Progress bar (value 0-100)',\n example: { value: 65, max: 100, label: 'Upload progress' },\n },\n // ── Inputs ────────────────────────────────────────────────────────────────\n Input: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n type: z.enum(['text', 'email', 'password', 'number']).nullable(),\n placeholder: z.string().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['submit', 'focus', 'blur'],\n description:\n 'Text input field. Use { $bindState } on value for two-way binding. Use checks for validation (e.g. required, email, minLength). validateOn controls timing (default: blur).',\n example: {\n label: 'Email',\n name: 'email',\n type: 'email',\n placeholder: 'you@example.com',\n },\n },\n Textarea: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n placeholder: z.string().nullable(),\n rows: z.number().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n description:\n 'Multi-line text input. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: blur).',\n },\n Select: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)),\n placeholder: z.string().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Dropdown select input. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Radio: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Radio button group. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Checkbox: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n checked: z.boolean().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Checkbox input. Use { $bindState } on checked for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Switch: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n checked: z.boolean().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Toggle switch. Use { $bindState } on checked for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n // ── Actions ───────────────────────────────────────────────────────────────\n Button: {\n props: z.object({\n label: z.string(),\n variant: z.enum(['primary', 'secondary', 'danger']).nullable(),\n disabled: z.boolean().nullable(),\n }),\n events: ['press'],\n description: 'Clickable button. Bind on.press for handler.',\n example: { label: 'Submit', variant: 'primary' },\n },\n};\n","import { defineCatalog } from '@json-render/core';\nimport { z } from 'zod';\nimport { generativeSchema } from './schema';\nimport { shadcnComponentDefinitions } from './shadcn-definitions';\n\n/**\n * The base vocabulary: what a spec may be made of, before the product page's\n * own components are added on top of it in `catalog.ts`.\n *\n * Two layers. From shadcn/ui's catalog, the subset a page needs and nothing\n * that cannot bind: not its `Tabs` (its panels do not follow the active tab),\n * not `Accordion` (its items are strings and cannot hold a subtree), not\n * `Table` (rows as inline strings), not `Slider` (a slider needs bounds, and\n * the standard states none on a number - a range a model invents narrows the\n * input). Then the layer's own: the two escape hatches, the bound equivalents\n * of what a model most wants to inline (`DataTable`, `Metric`), and the\n * vocabulary of an APP rather than a form - `Tabs` whose panels follow the\n * active tab, `Steps` for a journey, `Split` for a rail beside the work,\n * `Segmented` for a choice as pills, `NumberInput` that writes a number, and\n * `Icon` to give a section a face.\n *\n * `className` is omitted from every picked definition: an arbitrary utility a\n * model invents is one the Storybook build never compiled, and a colour it\n * invents is one that ignores the theme.\n *\n * Zod only, importable from node with no DOM: `designerCatalog()` renders\n * these definitions into the data the designer method takes, and the prompt\n * hash is computed over the result, so what is written here is part of the\n * pinned prompt. Erasable syntax only (no enums, no namespaces, no parameter\n * properties), because node strips the types itself.\n */\n\nconst shadcn = shadcnComponentDefinitions;\n\n/** The shadcn subset, by name. The order is the order the prompt lists them. */\nexport const PICKED_SHADCN = [\n 'Card',\n 'Stack',\n 'Grid',\n 'Separator',\n 'Heading',\n 'Text',\n 'Badge',\n 'Alert',\n 'Collapsible',\n 'Progress',\n 'Avatar',\n 'Input',\n 'Textarea',\n 'Select',\n 'Radio',\n 'Checkbox',\n 'Switch',\n 'Button',\n] as const;\n\nexport type PickedShadcnName = (typeof PICKED_SHADCN)[number];\n\n/** Our own, by name. */\nexport const CUSTOM_COMPONENTS = [\n 'Split',\n 'Tabs',\n 'Steps',\n 'Icon',\n 'Segmented',\n 'NumberInput',\n 'MthdsField',\n 'MthdsResult',\n 'DataTable',\n 'Metric',\n] as const;\n\nexport type CustomComponentName = (typeof CUSTOM_COMPONENTS)[number];\n\n/**\n * The value formats a `Metric` can apply. A model picks one; the registry\n * formats with `Intl.NumberFormat`.\n */\nexport const METRIC_FORMATS = ['plain', 'integer', 'decimal', 'compact'] as const;\n\n/**\n * The icons a spec may name: lucide's, a closed list so a misspelt name fails\n * validation rather than rendering nothing. Chosen for what pages about\n * methods talk about - people, places, money, time, files, standing.\n */\nexport const ICON_NAMES = [\n 'Sparkles',\n 'Rocket',\n 'Compass',\n 'Map',\n 'MapPin',\n 'Route',\n 'Plane',\n 'Train',\n 'Car',\n 'Ship',\n 'Hotel',\n 'Home',\n 'Building2',\n 'Landmark',\n 'Globe',\n 'Mountain',\n 'Leaf',\n 'Sun',\n 'Moon',\n 'Calendar',\n 'Clock',\n 'Hourglass',\n 'Users',\n 'User',\n 'Baby',\n 'Accessibility',\n 'Heart',\n 'Star',\n 'Utensils',\n 'Coffee',\n 'Music',\n 'Camera',\n 'Image',\n 'Ticket',\n 'Gift',\n 'Wallet',\n 'Banknote',\n 'Coins',\n 'Receipt',\n 'Percent',\n 'Hash',\n 'TrendingUp',\n 'BarChart3',\n 'FileText',\n 'Upload',\n 'Paperclip',\n 'Mail',\n 'Phone',\n 'Tag',\n 'Layers',\n 'ListChecks',\n 'CheckCircle2',\n 'AlertCircle',\n 'Info',\n 'Shield',\n 'Flag',\n 'Bookmark',\n 'Briefcase',\n 'Package',\n 'Truck',\n 'Lightbulb',\n 'Zap',\n 'Pencil',\n 'Send',\n] as const;\n\nexport type IconName = (typeof ICON_NAMES)[number];\n\nconst components = {\n // ── Layout (shadcn) ────────────────────────────────────────────────────\n Card: {\n ...shadcn.Card,\n props: shadcn.Card.props.omit({ className: true, maxWidth: true, centered: true }),\n description:\n 'Container card for content sections. Use for forms/content boxes, NOT for page headers. Its optional \"title\" renders as an h3, so a titled Card sits under an h2.',\n },\n Stack: { ...shadcn.Stack, props: shadcn.Stack.props.omit({ className: true }) },\n Grid: { ...shadcn.Grid, props: shadcn.Grid.props.omit({ className: true }) },\n Separator: shadcn.Separator,\n Collapsible: shadcn.Collapsible,\n // ── Content (shadcn) ───────────────────────────────────────────────────\n Heading: shadcn.Heading,\n Text: shadcn.Text,\n Badge: shadcn.Badge,\n Alert: shadcn.Alert,\n Progress: shadcn.Progress,\n Avatar: {\n ...shadcn.Avatar,\n description:\n 'A round avatar showing the initials of \"name\" - bind it to a person\\'s name in the state ({ \"$state\" } or { \"$item\" }); never set \"src\".',\n },\n // ── Inputs (shadcn) ────────────────────────────────────────────────────\n Input: shadcn.Input,\n Textarea: shadcn.Textarea,\n Select: shadcn.Select,\n Radio: shadcn.Radio,\n Checkbox: shadcn.Checkbox,\n Switch: shadcn.Switch,\n Button: shadcn.Button,\n // ── Layout (ours) ──────────────────────────────────────────────────────\n Split: {\n props: z.object({\n ratio: z.enum(['1:1', '1:2', '2:1']).nullable(),\n gap: z.enum(['md', 'lg', 'xl']).nullable(),\n }),\n slots: ['default'],\n description:\n 'Two columns side by side, from exactly two children: the first is the left column. \"1:2\" puts a narrow rail (a summary, the essentials, the run) beside the work; \"2:1\" the reverse; \"1:1\" two halves. Columns stack on a narrow screen.',\n example: { ratio: '1:2', gap: 'lg' },\n },\n Tabs: {\n props: z.object({\n tabs: z.array(z.object({ label: z.string(), value: z.string() })).min(2),\n }),\n slots: ['default'],\n description:\n \"Concerns of equal weight, one visible at a time. Exactly one child per tab, in the same order - each child is that tab's panel (usually a Stack). The first tab opens. The active tab is the component's own state, never /state.\",\n example: {\n tabs: [\n { label: 'The trip', value: 'trip' },\n { label: 'Who is going', value: 'people' },\n ],\n },\n },\n Steps: {\n props: z.object({\n steps: z.array(z.string()).min(2),\n nextLabel: z.string().nullable(),\n backLabel: z.string().nullable(),\n }),\n slots: ['default'],\n description:\n \"A journey with a natural order: a numbered indicator, one panel at a time, and its own Back and Next. Exactly one child per step, in order - each child is that step's panel. Put the Button that runs inside the LAST panel; Next disappears there. The current step is the component's own state, never /state.\",\n example: { steps: ['Where', 'Who', 'How'], nextLabel: 'Continue' },\n },\n Icon: {\n props: z.object({\n name: z.enum(ICON_NAMES),\n size: z.enum(['sm', 'md', 'lg']).nullable(),\n }),\n slots: [],\n description:\n 'A decorative icon, one of the listed lucide names, to give a section or a figure a face: put it in a horizontal Stack beside a Heading or a Metric. It carries no meaning on its own and no text.',\n example: { name: 'Plane', size: 'md' },\n },\n // ── Inputs (ours) ──────────────────────────────────────────────────────\n Segmented: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)).min(2).max(6),\n value: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A choice of two to six options as a row of pills, one selected - the app\\'s answer to a short Select. \"options\" are EXACTLY the brief\\'s choices, spelled exactly; bind \"value\" with { \"$bindState\": \"/inputs/...\" }.',\n example: {\n label: 'Pace',\n name: 'pace',\n options: ['slow', 'balanced', 'packed'],\n value: { $bindState: '/inputs/request/pace' },\n },\n },\n NumberInput: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n value: z.number().nullable(),\n placeholder: z.string().nullable(),\n unit: z.string().nullable(),\n min: z.number().nullable(),\n max: z.number().nullable(),\n step: z.number().nullable(),\n }),\n slots: [],\n description:\n 'A figure the person types: writes a NUMBER to the bound path, which Input type \"number\" does not (it writes text). Bind \"value\" with { \"$bindState\": \"/inputs/...\" }. \"unit\" is a short suffix ONLY when the brief states one; \"min\", \"max\" and \"step\" only when the brief states them.',\n example: {\n label: 'Budget',\n name: 'budget',\n value: { $bindState: '/inputs/request/budget' },\n placeholder: '2500',\n },\n },\n // ── The escape hatches and the bound equivalents (ours) ────────────────\n MthdsField: {\n props: z.object({\n path: z.string(),\n }),\n slots: [],\n description:\n 'The kernel\\'s own control for ONE input, bound two-way at \"path\" (a /inputs path from the brief). Use it for every path the brief marks as delegated - a file, a date, a list, a structure you would rather not lay out - and for any scalar you would rather not style. It renders its own label and description. Inside a repeat, \"path\" is the item\\'s field name relative to the item (\"lines\"), never an $item expression.',\n example: { path: '/inputs/source' },\n },\n MthdsResult: {\n props: z.object({\n path: z.string(),\n hideLabel: z.boolean().nullable(),\n }),\n slots: [],\n description:\n 'The kernel\\'s own read-only rendering of ONE result subtree at \"path\" (a /result path from the brief). Use it for every path the brief marks as delegated - a file, a date, a document, prose, markup - and for any structure you choose not to lay out. It renders its own label unless hideLabel is true. Inside a repeat, \"path\" is the item\\'s field name relative to the item (\"teams\"), never an $item expression - the way to delegate one subtree of every item.',\n example: { path: '/result/issued_on' },\n },\n DataTable: {\n props: z.object({\n rows: z.any(),\n columns: z.array(z.object({ path: z.string(), label: z.string() })),\n caption: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A table over a list of structures. \"rows\" MUST be { \"$state\": \"/path/to/the/list\" } (never inline rows); each column names a field of one item by its relative path (\"label\", \"unit_price\") and the header to show for it.',\n example: {\n rows: { $state: '/result/lines' },\n columns: [\n { path: 'label', label: 'Item' },\n { path: 'quantity', label: 'Qty' },\n ],\n },\n },\n Metric: {\n props: z.object({\n label: z.string(),\n value: z.any(),\n unit: z.string().nullable(),\n format: z.enum(METRIC_FORMATS).nullable(),\n }),\n slots: [],\n description:\n 'A labelled figure - the one number a reader looks for first. \"value\" is bound with { \"$state\": \"/path\" } (never inline); \"unit\" is a short suffix and ONLY one the brief states (a currency the structure carries, \"%\" for a rate, \"M\" when the brief says \"in millions\") - never invent a currency the state does not carry; \"format\" is plain, integer, decimal (two places) or compact.',\n example: { label: 'Total', value: { $state: '/result/total' }, unit: 'EUR', format: 'decimal' },\n },\n};\n\nconst actions = {\n run: {\n params: z.object({}),\n description:\n 'Start the run with the current /inputs. The host handles it; an input page binds it to its one Button after validateForm.',\n },\n};\n\n/**\n * The base catalog, for the renderers in `registry.tsx` to be typed against.\n * It renders no prompt: the catalog a model is handed is `catalog.ts`'s, which\n * extends this vocabulary with the product page's own.\n */\nexport const baseCatalog = defineCatalog(generativeSchema, { components, actions });\n\n/**\n * The two maps, for the catalog that EXTENDS this vocabulary. Exporting them\n * changes nothing about the prompt or its hash.\n */\nexport const generativeComponents = components;\nexport const generativeActions = actions;\n","import { defineCatalog } from '@json-render/core';\nimport { z } from 'zod';\nimport {\n CUSTOM_COMPONENTS,\n PICKED_SHADCN,\n generativeActions,\n generativeComponents,\n} from './components';\nimport { generativeSchema } from './schema';\nimport type { ComponentRendering } from './validate';\n\n/**\n * The catalog: everything the base vocabulary has, plus the chrome of a\n * product page - a bar with the logo, a hero, a workspace that puts a panel\n * beside the work, a section, a raised rail, the summary rows a rail can be\n * made of, a call to action, a footer line. They are vocabulary, not a\n * template: the designer method prescribes no composition, and a layout uses\n * whichever of them serve it. Each description says what the component IS and\n * how it renders - a heading level, a landmark, a fixed child count - and never\n * where it must go or whether a page must have it, because the descriptions\n * travel to the model as data and would otherwise be the mandate the method\n * gave up. The vocabulary names no brand: the logo is whichever the manifest\n * carries and the accent is whichever the host's theme tokens set.\n *\n * Rule 1 holds here as it does everywhere in this entry: a component takes\n * copy and bound values, never a schema, and the fields the kernel owns are\n * still `MthdsField` elements naming a path.\n */\n\nexport const PRODUCT_COMPONENTS = [\n 'AppBar',\n 'Hero',\n 'Workspace',\n 'Section',\n 'Rail',\n 'SummaryRow',\n 'Cta',\n 'Footer',\n] as const;\n\nexport type ProductComponentName = (typeof PRODUCT_COMPONENTS)[number];\n\nconst product = {\n AppBar: {\n props: z.object({\n app: z.string(),\n links: z.array(z.string()).nullable(),\n tag: z.string().nullable(),\n }),\n slots: [],\n description:\n \"A bar across the top of the page: the brand's logo, the name of this app beside it, a few muted links, and a small mono tag at the right (the method behind the page). It renders as the page's banner, so at most one.\",\n example: { app: 'Trip planner', links: ['Methods', 'Runs'], tag: 'plan_trip' },\n },\n Hero: {\n props: z.object({\n headline: z.string(),\n lede: z.string().nullable(),\n eyebrow: z.string().nullable(),\n }),\n slots: [],\n description:\n 'An opening: one bold headline that says what happens here, one muted line under it at most, and an optional small eyebrow in the accent colour above. The headline renders as an h1, so at most one on a page.',\n example: { headline: 'Plan a trip worth taking.', lede: 'Tell us where and who is coming.' },\n },\n Workspace: {\n props: z.object({ rail: z.enum(['right', 'left']).nullable() }),\n slots: ['default'],\n description:\n 'Two children side by side on a wide screen and stacked on a narrow one: the work, and beside it a narrower panel that stays sticky while the work scrolls. Exactly two children; \"rail\" says which side the panel takes, right by default.',\n example: { rail: 'right' },\n },\n Section: {\n props: z.object({\n number: z.string().nullable(),\n title: z.string(),\n lede: z.string().nullable(),\n }),\n slots: ['default'],\n description:\n 'A titled stage of the work: an optional small mono number in the accent colour, an h2 title, an optional muted line, then its children - flat, spaced, separated from the next Section by a hairline, never boxed.',\n example: { number: '01', title: 'Where and when' },\n },\n Rail: {\n props: z.object({ title: z.string() }),\n slots: ['default'],\n description:\n 'A raised, boxed panel: a small uppercase h2 title, then its children in a column. Made to stand beside the work as the panel of a Workspace, and the one boxed surface in this vocabulary.',\n example: { title: 'Your trip' },\n },\n SummaryRow: {\n props: z.object({\n label: z.string(),\n value: z.any().nullable(),\n detail: z.any().nullable(),\n separator: z.string().nullable(),\n placeholder: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A line that restates a value: a muted label at the left, a bound value at the right. \"value\" and the optional \"detail\" are read with { \"$state\": \"/inputs/...\" } and joined by \"separator\" (a space by default); each is a scalar path - text, number, boolean, date or choice - never a structure, a list or a file. While both are empty the row shows \"placeholder\", or a dash.',\n example: {\n label: 'Budget',\n value: { $state: '/inputs/request/budget' },\n detail: { $state: '/inputs/request/currency' },\n },\n },\n Cta: {\n props: z.object({ label: z.string(), hint: z.string().nullable() }),\n slots: [],\n events: ['press'],\n description:\n 'A call to action: a full-width button in the accent colour that runs the method, with an optional one-line hint under it. Bind on.press to validateForm then run.',\n example: { label: 'Plan my trip', hint: 'Nothing runs until the request is complete.' },\n },\n Footer: {\n props: z.object({ text: z.string(), tag: z.string().nullable() }),\n slots: [],\n description:\n \"A closing line, muted, with an optional mono tag at the right. It renders as the page's contentinfo, so at most one.\",\n example: { text: 'Runs on Pipelex.', tag: 'MTHDS' },\n },\n};\n\n/**\n * What this entry's components render beyond their schemas - the heading a\n * title is, the landmark a bar or a footer renders as, the two children a\n * split lays out, the panel per tab or step - declared once here, where the\n * descriptions above say the same in prose for the model, and carried on the\n * catalog so the validator reads it off whichever catalog it is handed. A\n * host validating against a vocabulary of its own declares what its\n * renderers do, or nothing.\n */\nexport const COMPONENT_RENDERINGS: Readonly<Record<string, ComponentRendering>> = {\n Hero: { heading: { level: 1 } },\n Section: { heading: { level: 2 } },\n Rail: { heading: { level: 2 } },\n Card: { heading: { level: 3, when: 'title' } },\n AppBar: { once: \"the page's banner\" },\n Footer: { once: \"the page's contentinfo\" },\n Split: { children: { count: 2, roles: 'left, right' } },\n Workspace: { children: { count: 2, roles: 'work, rail' } },\n Tabs: { panels: { prop: 'tabs', noun: 'tab' } },\n Steps: { panels: { prop: 'steps', noun: 'step' } },\n};\n\nexport const catalog = Object.assign(\n defineCatalog(generativeSchema, {\n components: { ...generativeComponents, ...product },\n actions: generativeActions,\n }),\n { renders: COMPONENT_RENDERINGS },\n);\n\n/** The spec type a layout is written against. */\nexport type GenerativeSpec = typeof catalog._specType;\n\n/**\n * Every component name the catalog knows, the shadcn subset first. This is\n * the order the designer method lists them in, since `designerCatalog()`\n * walks it; the rules and the direction that name them are the method's own\n * prose, in `methods/layout-design.mthds`.\n */\nexport const COMPONENT_NAMES: readonly string[] = [\n ...PICKED_SHADCN,\n ...CUSTOM_COMPONENTS,\n ...PRODUCT_COMPONENTS,\n];\n","import type { z } from 'zod';\n\n/**\n * A component's props, as the one-line signature the designer method lists it\n * under: `{ text: string, tag?: string }` for a `Footer`, whose `tag` is\n * declared `.nullable()`, or `{ label: string, value: unknown, unit?: string,\n * format?: \"plain\" | \"integer\" | \"decimal\" | \"compact\" }` for a `Metric`.\n *\n * It renders the SAME text json-render's own prompt renders for a zod schema,\n * case for case - a prop wrapped in `nullable` or `optional` gets a `?` and\n * never a `| null`, an enum lists its values, `z.any()` prints as `unknown` -\n * so a model that has\n * seen json-render's prompt reads a familiar shape. json-render does not export\n * its formatter (it hands it to a prompt template as a context member), and\n * the catalog travels to the method as data rather than as a rendered prompt,\n * so the formatter lives here; `__tests__/prompt.test.ts` holds it to the\n * package's own output over every component in the catalog.\n *\n * Reads zod v4's `_zod.def`, the definition every schema class carries: `type`\n * names the kind, and the members read below are the ones that kind holds.\n */\n\ninterface ZodDefinition {\n type: string;\n innerType?: z.ZodType;\n element?: z.ZodType;\n shape?: Record<string, z.ZodType>;\n entries?: Record<string, unknown>;\n values?: readonly unknown[];\n options?: readonly z.ZodType[];\n keyType?: z.ZodType;\n valueType?: z.ZodType;\n}\n\nfunction definitionOf(schema: z.ZodType): ZodDefinition {\n return (schema as unknown as { _zod: { def: ZodDefinition } })._zod.def;\n}\n\nexport function propsSignature(schema: z.ZodType): string {\n const def = definitionOf(schema);\n switch (def.type) {\n case 'string':\n return 'string';\n case 'number':\n return 'number';\n case 'boolean':\n return 'boolean';\n case 'literal':\n return JSON.stringify(def.values?.[0]);\n case 'enum':\n return Object.values(def.entries ?? {})\n .map((value) => `\"${String(value)}\"`)\n .join(' | ');\n case 'array':\n return `Array<${def.element ? propsSignature(def.element) : 'unknown'}>`;\n case 'object': {\n const props = Object.entries(def.shape ?? {}).map(([key, value]) => {\n const inner = definitionOf(value).type;\n const optional = inner === 'optional' || inner === 'nullable';\n return `${key}${optional ? '?' : ''}: ${propsSignature(value)}`;\n });\n return `{ ${props.join(', ')} }`;\n }\n case 'optional':\n case 'nullable':\n case 'default':\n return def.innerType ? propsSignature(def.innerType) : 'unknown';\n case 'union':\n return def.options\n ? def.options.map((option) => propsSignature(option)).join(' | ')\n : 'unknown';\n case 'record': {\n const key = def.keyType ? propsSignature(def.keyType) : 'string';\n const value = def.valueType ? propsSignature(def.valueType) : 'unknown';\n return `Record<${key}, ${value}>`;\n }\n default:\n return 'unknown';\n }\n}\n","import type { z } from 'zod';\nimport type { Action, Catalog, Component } from '../generated/layout-design/types';\nimport { COMPONENT_NAMES, catalog } from './catalog';\nimport { propsSignature } from './props-signature';\nimport { generativeSchema } from './schema';\n\n/**\n * The catalog as the designer method's `catalog` input: the vocabulary as\n * DATA, which the method's own prompt lays out.\n *\n * The prompt a model reads is the method - `methods/layout-design.mthds`\n * carries every paragraph of it as prose and loops over these two lists for\n * the component and action sections. What this package contributes is what\n * only code can state: each component's props signature, rendered from its\n * zod schema, beside the description and the slots its definition declares.\n * One function so the fixture pass, the briefs and the tests hand over one\n * value, and the hash stamped on a captured layout covers what was actually\n * sent.\n *\n * The shapes are the method's own: codegen projects the `Catalog`,\n * `Component` and `Action` structures the bundle declares into\n * `src/generated/layout-design/`, and the aliases below are those types. So a\n * field renamed in the bundle fails the type check on the literals here\n * rather than a run, and the value goes over as the content of a structured\n * input, verbatim. The import is type-only: the generated zod schemas stay\n * out of the entry, which ships no validator for this value.\n */\n\n/** The `Catalog` structure of `methods/layout-design.mthds`, as codegen projects it. */\nexport type DesignerCatalog = Catalog;\n/** One component of the catalog: its name, its props signature, what it is for, what it accepts. */\nexport type DesignerComponent = Component;\n/** One action a page may bind to an event. */\nexport type DesignerAction = Action;\n\n/** The concept a run request names for the `catalog` input: the method's own, domain-qualified. */\nexport const DESIGNER_CATALOG_CONCEPT = 'generative.Catalog';\n\ninterface ComponentDefinition {\n props: z.ZodType;\n slots?: readonly string[];\n events?: readonly string[];\n description?: string;\n}\n\nexport function designerCatalog(): DesignerCatalog {\n const definitions = catalog.data.components as Record<string, ComponentDefinition>;\n const components = COMPONENT_NAMES.map((name): DesignerComponent => {\n const definition = definitions[name];\n if (!definition) throw new Error(`the catalog defines no component named '${name}'`);\n const slots = definition.slots ?? [];\n return {\n name,\n props: propsSignature(definition.props),\n description: definition.description,\n accepts_children: slots.includes('default'),\n slots: slots.filter((slot) => slot !== 'default'),\n events: [...(definition.events ?? [])],\n };\n });\n\n const builtIn = (generativeSchema.builtInActions ?? []).map((action): DesignerAction => ({\n name: action.name,\n description: action.description,\n built_in: true,\n }));\n const own = Object.entries(catalog.data.actions as Record<string, { description: string }>).map(\n ([name, action]): DesignerAction => ({\n name,\n description: action.description,\n built_in: false,\n }),\n );\n\n return { components, actions: [...builtIn, ...own] };\n}\n","import type { DesignerCatalog } from './designer-catalog';\n\n/**\n * The hash that pairs a captured layout with the prompt it was produced\n * against: the first twelve hex digits of the SHA-256 of `promptHashSubject`,\n * which is the designer method's text and the catalog it was handed.\n *\n * The prompt is no longer one string this package renders: it is the method\n * (`methods/layout-design.mthds`, every paragraph as prose) applied to\n * the catalog as data (`designerCatalog()`). Both are what a run was actually\n * given, so both are hashed - a reworded rule and a renamed prop each move\n * the pin, exactly as they did when the prompt was rendered here. The model\n * pin in the method file moves it too, since the file is hashed whole; a\n * fixture records its model on its own, so that costs a regeneration, never a\n * misread.\n *\n * It is a PIN rather than a computation, so that this entry stays importable\n * from a browser (hashing would mean `node:crypto` or an async Web Crypto\n * call, and a host compares this value synchronously while deciding whether a\n * stored layout still stands - and the entry must not read the method file).\n * `__tests__/prompt.test.ts` recomputes it from the file and the catalog and\n * fails on any drift, so the pin cannot go stale quietly: a catalog, rule or\n * direction change is a failing test, which is exactly what it was for.\n *\n * A stored layout whose hash is not this one is not rendered - the host falls\n * back to the kernel's own form - because the vocabulary it was written in is\n * no longer the vocabulary this entry renders.\n */\nexport const PROMPT_HASH = '2b2325fd1231';\n\n/**\n * What the hash is computed over: the method's text as shipped, then the\n * catalog as the run request carries it. The one recipe the test and the\n * fixture pass share, so the pin they check and the stamp they write agree.\n */\nexport function promptHashSubject(method: string, catalog: DesignerCatalog): string {\n return `${method}\\n${JSON.stringify(catalog)}`;\n}\n","import type { Spec } from '@json-render/core';\nimport type { RunField } from '../core';\n\n/**\n * The two state trees, and how a path into either maps back onto the\n * descriptor.\n *\n * An input page binds at `/inputs/<name>`, recursing into structures as the\n * descriptor does; a result page binds at `/result/<path>`. Both are JSON\n * Pointers (RFC 6901), because that is what json-render's state store reads.\n * Nothing here knows a value - a path is resolved against the DESCRIPTOR, which\n * is how the two escape hatches find the `RunField` to hand the kernel.\n */\n\nexport const INPUTS_ROOT = '/inputs';\nexport const RESULT_ROOT = '/result';\n\n/** `/inputs` + `invoice` + `billed_to` → `/inputs/invoice/billed_to`. */\nexport function joinPath(root: string, ...segments: readonly string[]): string {\n return segments.reduce<string>((path, segment) => `${path}/${escapeSegment(segment)}`, root);\n}\n\n/**\n * RFC 6901: `~` is `~0`, `/` is `~1`. Field names are identifiers, so this\n * rarely fires. Exported for the stream module, which writes an element key\n * into a patch path: the escaping is spelled once, because the second spelling\n * was a copy and a copy drifts.\n */\nexport function escapeSegment(segment: string): string {\n return segment.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\n/**\n * The inverse, in the order the RFC requires - `~1` first, then `~0`, so `~01`\n * reads back as `~1` and not as `/`. The stream's prototype guard unescapes a\n * patch path through this same function before it compares segments, so the\n * order that guard relies on is decided here and nowhere else.\n */\nexport function unescapeSegment(segment: string): string {\n return segment.replace(/~1/g, '/').replace(/~0/g, '~');\n}\n\n/** The segments of a pointer, root excluded: `/inputs/a/b` under `/inputs` → `['a', 'b']`. */\nexport function segmentsUnder(root: string, path: string): string[] | undefined {\n if (path === root) return [];\n if (!path.startsWith(`${root}/`)) return undefined;\n return path\n .slice(root.length + 1)\n .split('/')\n .map(unescapeSegment);\n}\n\n/**\n * The descriptor node a path names, or `undefined` when the path leaves the\n * tree. An object's children are found by name; a list's are found by index,\n * and every index resolves to the same item descriptor.\n */\nexport function fieldAtSegments(\n fields: readonly RunField[],\n segments: readonly string[],\n): RunField | undefined {\n const [head, ...rest] = segments;\n if (head === undefined) return undefined;\n const field = fields.find((candidate) => candidate.name === head);\n if (!field) return undefined;\n return rest.length === 0 ? field : descend(field, rest);\n}\n\nfunction descend(field: RunField, segments: readonly string[]): RunField | undefined {\n const [head, ...rest] = segments;\n if (head === undefined) return field;\n if (field.kind === 'object') return fieldAtSegments(field.fields, segments);\n if (field.kind === 'list' && /^\\d+$/.test(head)) return descend(field.item, rest);\n return undefined;\n}\n\n/** `/inputs/<...>` resolved against a form's top-level fields. */\nexport function inputFieldAtPath(fields: readonly RunField[], path: string): RunField | undefined {\n const segments = segmentsUnder(INPUTS_ROOT, path);\n return segments && segments.length > 0 ? fieldAtSegments(fields, segments) : undefined;\n}\n\n/** `/result/<...>` resolved against a result descriptor; `/result` itself is the root. */\nexport function resultFieldAtPath(field: RunField, path: string): RunField | undefined {\n const segments = segmentsUnder(RESULT_ROOT, path);\n if (!segments) return undefined;\n return segments.length === 0 ? field : descend(field, segments);\n}\n\n/**\n * The child-to-parent map of a spec's element tree.\n *\n * Built once and passed down rather than rebuilt per lookup: `layoutProblems`\n * resolves one relative hatch path per element that carries one, and each\n * resolution walks the chain of parents above it. Rebuilding the map inside\n * that walk made the whole pass quadratic in element count.\n */\nexport function parentMapOf(spec: Spec): Map<string, string> {\n const parents = new Map<string, string>();\n for (const [parentKey, element] of Object.entries(spec.elements)) {\n for (const child of element.children ?? []) parents.set(child, parentKey);\n }\n return parents;\n}\n\n/**\n * The base path a relative hatch path resolves against, statically: the chain\n * of `repeat`s from the root down to `key`, each contributing its list path\n * and a first index. `undefined` outside any repeat. Mirrors what\n * `useRepeatScope` gives the hatch at render time, for a test that never\n * renders.\n *\n * The walk up the parent chain STOPS on a key it has already seen. A layout is\n * model-produced, and an element that is its own ancestor - `children: [\"self\"]`\n * at its simplest - is a shape json-render's `validateSpec` accepts without a\n * word, so without the guard this loop never terminates. Since a host calls\n * this through `layoutFits` precisely to decide whether an untrusted layout is\n * safe to render, the gate hanging is worse than the layout it was asked about.\n */\nexport function repeatBasePathOf(\n spec: Spec,\n key: string,\n parents: Map<string, string> = parentMapOf(spec),\n): string | undefined {\n const chain: string[] = [];\n const seen = new Set<string>();\n let current: string | undefined = key;\n while (current !== undefined && !seen.has(current)) {\n seen.add(current);\n chain.unshift(current);\n current = parents.get(current);\n }\n let base: string | undefined;\n for (const elementKey of chain) {\n const repeat = spec.elements[elementKey]?.repeat;\n if (!repeat) continue;\n const statePath = repeat.statePath;\n if (typeof statePath === 'string') {\n base = `${statePath}/0`;\n continue;\n }\n // A relative `repeat` names the item's field, and only a string is one. A\n // layout is model-produced, so `statePath` can be null or an object here -\n // and reading `.$item` off either produced a throw or a path with\n // \"[object Object]\" in it, reported later as an ordinary staleness problem\n // that named the wrong cause.\n const item = (statePath as { $item?: unknown } | null)?.$item;\n if (base === undefined || typeof item !== 'string') return undefined;\n base = `${joinPath(base, item)}/0`;\n }\n return base;\n}\n\n/** A hatch's path as the layer resolves it: absolute as written, or relative to the repeat it sits in. */\nexport function absoluteHatchPath(\n spec: Spec,\n key: string,\n path: string,\n parents?: Map<string, string>,\n): string | undefined {\n if (path.startsWith('/')) return path;\n const base = repeatBasePathOf(spec, key, parents);\n // Raw, not `joinPath`: a relative hatch path is written by the producer and\n // may name several segments (`billed_to/city`), so its `/` are separators\n // already and escaping them would name one segment that does not exist.\n return base ? `${base}/${path}` : undefined;\n}\n\n/**\n * The list a `repeat` lays out, as an absolute path: its `statePath` when that\n * is written absolute, or, for a relative `{ $item }` one, the item's field\n * under the repeat above it - the same chain `repeatBasePathOf` walks, stopped\n * one level short. `undefined` when there is nothing to be relative to, or\n * when `statePath` is neither form. It is the path a repeat READS, which is\n * how the fit gate asks whether the descriptor still has the list.\n */\nexport function repeatListPathOf(\n spec: Spec,\n key: string,\n parents: Map<string, string> = parentMapOf(spec),\n): string | undefined {\n const statePath = spec.elements[key]?.repeat?.statePath;\n if (typeof statePath === 'string') return statePath;\n const item = (statePath as { $item?: unknown } | null | undefined)?.$item;\n const parent = parents.get(key);\n const outer = parent === undefined ? undefined : repeatBasePathOf(spec, parent, parents);\n return outer !== undefined && typeof item === 'string' ? joinPath(outer, item) : undefined;\n}\n","import type { RunField } from '../core';\nimport {\n isNativeCompositeNode,\n isNativeDateNode,\n isNativeHtmlNode,\n isNativeValueNode,\n} from '../core/native-content';\nimport type { Brief, PathEntry } from '../generated/layout-design/types';\nimport { INPUTS_ROOT, RESULT_ROOT, joinPath } from './paths';\n\n/**\n * The brief: the model's view of the descriptor, as DATA.\n *\n * Rule 1, restated for a model. The model's input is the DESCRIPTOR, never JSON\n * Schema: it receives the kinds, the labels, the descriptions, the choices, the\n * presence and what gates the run - projected from `RunField[]` here, and from\n * nowhere else, into the `Brief` structure the designer method declares. On the\n * result side it also receives one real run's loaded state, so it can judge\n * magnitudes, but it never sees the wire: the state it reads is what\n * `payloadToState` produced, with the envelopes already gone.\n *\n * Nothing here is prose. The sentences a model reads - the headings, how a\n * path line is worded, what \"delegated\" says - are the method's own, in the\n * `render_brief` stage of `methods/layout-design.mthds`: a Jinja2 template\n * over this value, and the one place the brief's wording is edited. What this\n * module contributes is what only code can state: every path, flattened in\n * reading order with its depth, its kind in words, its constraints in words,\n * and which of them the kernel keeps. The shape is the method's own: codegen\n * projects its `Brief` and `PathEntry` structures into\n * `src/generated/layout-design/`, and the aliases below are those types,\n * imported type-only so the generated schemas stay out of the entry. A field\n * renamed in the bundle fails the type check on the literals here rather than\n * a run.\n *\n * Pure, no React, and the only place the descriptor is projected for a model.\n * What a path is marked as (delegated or not) is decided here too, so the\n * projection, the brief and the validator agree on which paths the kernel\n * renders.\n */\n\n/** The `Brief` structure of `methods/layout-design.mthds`, as codegen projects it. */\nexport type DesignerBrief = Brief;\n/** One path of the brief: where it is, what it holds, what constrains it, whether the kernel keeps it. */\nexport type DesignerPathEntry = PathEntry;\n\n/** The concept a run request names for the `brief` input: the method's own, domain-qualified. */\nexport const DESIGNER_BRIEF_CONCEPT = 'generative.Brief';\n\n/**\n * The component that runs the page, handed over as the brief's `run_control`\n * so the brief and the catalog agree on which one it is - and so the method's\n * own prose can go on naming none of the catalog's chrome. A rename in the\n * catalog does not have to be caught here: a brief asking for a component the\n * catalog no longer has produces a layout the validator refuses, loudly, on\n * the pass that made it.\n */\nconst RUN_COMPONENT = 'Cta';\n\nexport interface BriefSubject {\n /** `results.nested_result`. */\n pipeRef: string;\n /** The pipe's description, when the wire carries one. */\n description?: string;\n /**\n * The method's name as a host lists it - an authored method's, since a host\n * has one for every method it lists; absent on a synthesized carrier, which\n * no host lists. The brief hands it to the layout as the one product name\n * the page may carry, because the brand catalog's AppBar asks for a name\n * and a brief that gives none gets one invented.\n */\n name?: string;\n}\n\n/**\n * On the input side, the kinds the catalog's inputs cannot enter - and one\n * shape of a kind they otherwise can. The standard puts no floor on a choice,\n * so an enum may carry `\"\"`; the catalog's own choices may not, because no\n * dropdown row or pill can offer nothing, and the validator refuses an empty\n * option. A model told to list the brief's choices exactly would copy the\n * empty one into a layout the validator then refuses, so the brief hands the\n * input back to the kernel's own control instead.\n */\nexport function isDelegatedInput(field: RunField): boolean {\n return (\n field.kind === 'document' ||\n field.kind === 'image' ||\n field.kind === 'date' ||\n field.kind === 'list' ||\n field.kind === 'unknown' ||\n (field.kind === 'enum' && field.options.includes(''))\n );\n}\n\n/**\n * On the result side, the kinds and concepts the catalog cannot show.\n *\n * A native value is one of them, and so is a list of one: the native\n * predicates refuse a `list` node, because a list of dates is a list and not a\n * date, but no catalog component reads a date's `{date, time}` either, so the\n * kernel renders the list whole - one value per line, as the result view does.\n */\nexport function isDelegatedResult(field: RunField): boolean {\n if (isNativeValueNode(field)) return true;\n if (field.kind === 'list' && isNativeValueNode(field.item)) return true;\n return (\n field.kind === 'document' ||\n field.kind === 'image' ||\n field.kind === 'date' ||\n field.kind === 'prose' ||\n field.kind === 'unknown'\n );\n}\n\n/** What a path holds, in words - the one rendering of a kind the brief carries. */\nfunction kindLabel(field: RunField): string {\n if (isNativeHtmlNode(field)) return 'markup (native.Html)';\n if (isNativeDateNode(field)) return 'date (native.Date)';\n if (isNativeCompositeNode(field)) return 'composite (native.Composite)';\n switch (field.kind) {\n case 'text':\n return 'text';\n case 'prose':\n return 'prose (markdown)';\n case 'number':\n return field.integer ? 'integer' : 'number';\n case 'boolean':\n return 'boolean';\n case 'enum':\n return `choice of ${field.options.map((option) => JSON.stringify(option)).join(' | ')}`;\n case 'date':\n return field.datetime ? 'date with time' : 'date';\n case 'document':\n return 'document (a file)';\n case 'image':\n return 'image (a file)';\n case 'object':\n return `structure${field.conceptRef ? ` ${field.conceptRef}` : ''}`;\n case 'list':\n return `list of ${kindLabel(field.item)}`;\n case 'unknown':\n return 'unknown';\n default:\n return field satisfies never;\n }\n}\n\n/** The constraints and hints of a field, each one fact in words. */\nfunction constraints(field: RunField): string[] {\n const notes: string[] = [];\n if (field.kind === 'number') {\n if (field.min !== undefined) notes.push(`min ${field.min}`);\n if (field.max !== undefined) notes.push(`max ${field.max}`);\n }\n if (field.kind === 'text' || field.kind === 'prose') {\n if (field.minLength !== undefined) notes.push(`at least ${field.minLength} characters`);\n if (field.maxLength !== undefined) notes.push(`at most ${field.maxLength} characters`);\n if (field.format) notes.push(`format ${field.format}`);\n }\n if (field.kind === 'list') {\n if (field.itemCount !== undefined) notes.push(`at least ${field.itemCount} items`);\n if (field.maxItemCount !== undefined) notes.push(`at most ${field.maxItemCount} items`);\n }\n if (field.defaultValue !== undefined) notes.push(`default ${JSON.stringify(field.defaultValue)}`);\n if (field.examples && field.examples.length > 0) {\n notes.push(`examples ${field.examples.map((example) => JSON.stringify(example)).join(', ')}`);\n }\n if (field.hints && Object.keys(field.hints).length > 0) {\n notes.push(\n `hints ${Object.entries(field.hints)\n .map(([key, value]) => `${key}=${value}`)\n .join(', ')}`,\n );\n }\n return notes;\n}\n\ntype Side = 'input' | 'result';\n\n/**\n * One path as the brief carries it. Presence is an input-page fact, so it is\n * stated on that side only; `relative` marks a path spelled from one item of\n * the list above, which is how a DataTable column or `$item` reads it.\n * `seeded` says an ancestor already carries a default: the seed is the\n * OUTERMOST default, exactly as `seedInputs` seeds it, so a member beneath a\n * defaulted structure lists none of its own - two `/state` patches on one\n * subtree would make the seed depend on the order a model emits them in -\n * while its notes still state it, as a fact about the field rather than an\n * instruction. An optional structure with no default of its own seeds nothing\n * beneath it, for the same reason `seedInputs` leaves it absent.\n */\nfunction entryOf(\n field: RunField,\n path: string,\n depth: number,\n side: Side,\n relative: boolean,\n seeded: boolean,\n): DesignerPathEntry {\n const notes = constraints(field);\n return {\n depth,\n path,\n kind: kindLabel(field),\n name: field.name,\n title: field.title && field.title !== field.name ? field.title : undefined,\n description: field.description,\n required: side === 'input' ? field.required : undefined,\n gating: side === 'input' && field.gating ? true : undefined,\n notes: notes.length > 0 ? notes : undefined,\n default:\n seeded || field.defaultValue === undefined ? undefined : JSON.stringify(field.defaultValue),\n delegated: side === 'input' ? isDelegatedInput(field) : isDelegatedResult(field),\n relative: relative ? true : undefined,\n };\n}\n\n/**\n * A path and, beneath it, what the page can lay out: a structure's members at\n * their own paths, and - on a result page - a list's item, whose members\n * follow spelled relative to one item. A delegated path ends the walk: the\n * kernel renders it whole, so its members are nobody else's to bind.\n */\nfunction describe(\n field: RunField,\n path: string,\n depth: number,\n side: Side,\n entries: DesignerPathEntry[],\n seeded = false,\n): void {\n const entry = entryOf(field, path, depth, side, false, seeded);\n entries.push(entry);\n if (entry.delegated) return;\n if (field.kind === 'object') {\n // Beneath an optional structure with no default of its own nothing is\n // seeded either: whether it is there at all is the person's choice, made\n // with its disclosure, and `seedInputs` leaves it absent. Listing its\n // members' defaults as seeds would have a layout open it.\n const seededBelow =\n seeded || field.defaultValue !== undefined || (side === 'input' && !field.required);\n for (const child of field.fields) {\n describe(child, joinPath(path, child.name), depth + 1, side, entries, seededBelow);\n }\n }\n if (field.kind === 'list' && side === 'result') {\n const item = field.item;\n entry.item_kind = kindLabel(item);\n entry.item_description = item.description;\n if (item.kind === 'object' && !isDelegatedResult(item)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(child, child.name, depth + 2, entries);\n }\n }\n }\n}\n\n/** A member of a list's item, spelled relative to that item; a nested list's members go through `<i>`. */\nfunction describeRelative(\n field: RunField,\n relativePath: string,\n depth: number,\n entries: DesignerPathEntry[],\n): void {\n const entry = entryOf(field, relativePath, depth, 'result', true, false);\n entries.push(entry);\n if (entry.delegated) return;\n if (field.kind === 'object') {\n for (const child of field.fields) {\n describeRelative(child, joinPath(relativePath, child.name), depth + 1, entries);\n }\n }\n if (field.kind === 'list') {\n const item = field.item;\n entry.item_kind = kindLabel(item);\n entry.item_description = item.description;\n if (item.kind === 'object' && !isDelegatedResult(item)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(child, joinPath(relativePath, '<i>', child.name), depth + 2, entries);\n }\n }\n }\n}\n\n/** The brief for an INPUT page: the form a run is started from. */\nexport function inputBrief(subject: BriefSubject, fields: readonly RunField[]): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n for (const field of fields) describe(field, joinPath(INPUTS_ROOT, field.name), 0, 'input', paths);\n return {\n side: 'input',\n pipe_ref: subject.pipeRef,\n description: subject.description,\n name: subject.name,\n paths,\n run_control: RUN_COMPONENT,\n };\n}\n\n/** The brief for a RESULT page: what one run produced, laid out. */\nexport function resultBrief(subject: BriefSubject, field: RunField, state: unknown): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n if (field.kind === 'object' && !isDelegatedResult(field)) {\n // The result itself is the root, and its line names no member: it IS the\n // structure, whose members then follow one level down.\n paths.push({\n depth: 0,\n path: RESULT_ROOT,\n kind: kindLabel(field),\n description: field.description,\n delegated: false,\n });\n for (const child of field.fields) {\n describe(child, joinPath(RESULT_ROOT, child.name), 1, 'result', paths);\n }\n } else {\n describe(field, RESULT_ROOT, 0, 'result', paths);\n }\n return {\n side: 'result',\n pipe_ref: subject.pipeRef,\n description: subject.description,\n paths,\n sample_state: JSON.stringify(state, null, 2),\n };\n}\n","import type { Spec } from '@json-render/core';\nimport { validateSpec } from '@json-render/core';\nimport type { z } from 'zod';\nimport { catalog as defaultCatalog } from './catalog';\nimport { INPUTS_ROOT, RESULT_ROOT } from './paths';\nimport { hasOwnProp } from '../core/own-property';\n\n/**\n * Whether a spec is one this catalog can render - the check every source\n * passes, whoever wrote it.\n *\n * Three layers, because json-render's own `catalog.validate()` covers only the\n * first two once a catalog has more than one component: it checks the element\n * TYPE against the component names, but `propsOf` degrades to \"any record\"\n * when several definitions could apply, so a misspelt or invented prop passes.\n * The per-component prop check is therefore this module's, and it has to be\n * expression-aware: a bound prop's raw value is `{ \"$state\": \"/path\" }`, which\n * the component's own zod schema (`z.string()`) would reject, so a dynamic\n * expression is accepted wherever the prop EXISTS and a literal is parsed\n * against the prop's schema.\n *\n * The checks are the same whichever catalog a spec was written against; the\n * catalog is a parameter, this entry's own by default, so a host that defines\n * a vocabulary of its own is validated by the same code and not by a copy of\n * it.\n *\n * What a component renders beyond its schema - the heading its title is, the\n * landmark it renders as, the fixed number of children it lays out, the panel\n * per entry of one of its props - is a fact about its renderer that no schema\n * states, so the catalog carries it as `renders`, declared beside the\n * definitions, and the validator reads it off the catalog it is handed rather\n * than assuming it from a component's name, which a host's vocabulary may\n * reuse for something that renders nothing of the kind. This entry's catalog\n * declares its own; a host's declares what its renderers do, or nothing, and\n * is then held only to what its schemas and its `Heading` elements say.\n */\n\n/**\n * What one component renders beyond what its props schema says, and what the\n * validator holds a layout to on that account. Every member is optional: a\n * component with none is held to its schema alone.\n */\nexport interface ComponentRendering {\n /**\n * The heading its renderer emits, at this level - a `Hero`'s headline is\n * the h1 - and, when it emits one only if a prop is set, the prop: a `Card`\n * renders its `title` as an h3 and nothing when it has none.\n */\n heading?: { level: 1 | 2 | 3 | 4; when?: string };\n /** What it renders as that a page has one of - a landmark, in the words a refusal uses: \"the page's banner\". */\n once?: string;\n /** The number of children its renderer lays out, dropping the rest in silence, and what they are. */\n children?: { count: number; roles: string };\n /** A panelled container: the prop that lists its panels, one child per entry, and what one is called. */\n panels?: { prop: string; noun: string };\n}\n\n/** What the validator reads off a catalog: its names, its definitions, and what its components render. */\nexport interface ValidationCatalog {\n componentNames: readonly string[];\n /** The catalog's own action names. A `defineCatalog` result carries this already. */\n actionNames?: readonly string[];\n data: unknown;\n /** The schema the catalog was defined against, for the actions its runtime handles without a handler. */\n schema?: { builtInActions?: readonly { name: string }[] };\n /** What each component renders beyond its schema, by component name. Absent, no component renders a heading, a landmark or a fixed set of children. */\n renders?: Readonly<Record<string, ComponentRendering>>;\n}\n\nexport interface SpecProblem {\n elementKey?: string;\n message: string;\n}\n\nexport interface SpecVerdict {\n ok: boolean;\n problems: SpecProblem[];\n}\n\nconst EXPRESSION_KEYS = [\n '$state',\n '$item',\n '$index',\n '$bindState',\n '$bindItem',\n '$cond',\n '$computed',\n '$template',\n];\n\n/** The two escape hatches: their `path` is resolved by the layer, so it is never an expression. */\nconst HATCHES = new Set(['MthdsField', 'MthdsResult']);\n\nfunction isExpression(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.keys(value).some((key) => EXPRESSION_KEYS.includes(key))\n );\n}\n\n/**\n * The closed vocabularies a prop can be declared with, unwrapped through the\n * `.optional()` / `.nullable()` most of them carry.\n *\n * An expression-valued prop skips the literal check below, which is right for a\n * value the host supplies at render - but not for a prop whose whole meaning is\n * that it is one of a fixed set. A `{ \"$template\": \"script\" }` carries no\n * interpolation, so json-render resolves it to the literal string `script`,\n * and a renderer that trusted the prop's declared union turned that into a DOM\n * tag name. A closed vocabulary has no dynamic form: if the value is not one of\n * the names, no expression can make it one.\n */\nfunction isClosedVocabulary(schema: z.ZodType): boolean {\n let current: unknown = schema;\n for (let depth = 0; depth < 8; depth += 1) {\n const def = (current as { def?: { type?: string; innerType?: unknown } }).def;\n if (!def) return false;\n if (def.type === 'enum' || def.type === 'literal') return true;\n if (def.innerType === undefined) return false;\n current = def.innerType;\n }\n return false;\n}\n\n/** The catalog's definition of one component, or nothing for a type it does not have. */\nfunction definitionOf(\n catalog: ValidationCatalog,\n type: string,\n): { props?: unknown; events?: unknown } | undefined {\n const components = (catalog.data as { components: Record<string, { props?: unknown }> })\n .components;\n // `hasOwnProp`, because the type is model-written and a prototype key would\n // find a function where a definition belongs.\n return hasOwnProp(components, type) ? components[type] : undefined;\n}\n\n/** The zod object each component's props are declared with, by component name. */\nfunction propsSchemaOf(catalog: ValidationCatalog, type: string): z.ZodObject | undefined {\n const props = definitionOf(catalog, type)?.props;\n return props && typeof props === 'object' && 'shape' in props\n ? (props as z.ZodObject)\n : undefined;\n}\n\n/**\n * The events a component's renderer emits, as its definition declares them -\n * an empty list for a component that emits nothing. `undefined` only for a\n * type the catalog does not have, which section 2 reports on its own.\n */\nfunction eventsOf(catalog: ValidationCatalog, type: string): readonly string[] | undefined {\n const definition = definitionOf(catalog, type);\n if (!definition) return undefined;\n return Array.isArray(definition.events)\n ? definition.events.filter((event): event is string => typeof event === 'string')\n : [];\n}\n\n/**\n * The deepest element chain this entry judges.\n *\n * Every walk below recurses, json-render's `validateSpec` included, so a deep\n * enough chain overflows the stack inside the gate: a chain of a thousand\n * elements validates in about no time, six thousand throws. The stack limit is\n * a property of the engine and not of the layout, so without a cap the same\n * stored bytes can pass under node and fail in a browser - and a stored artifact\n * deserves one verdict wherever it is checked. The number is far past any page\n * a person reads and far short of where any engine's stack gives out.\n */\nconst MAX_ELEMENT_DEPTH = 512;\n\nfunction childKeysOf(spec: Spec, key: string): string[] {\n const element = spec.elements[key] as { children?: unknown; slots?: unknown } | null | undefined;\n if (!element) return [];\n const children = Array.isArray(element.children) ? (element.children as string[]) : [];\n const slots =\n typeof element.slots === 'object' && element.slots !== null\n ? Object.values(element.slots as Record<string, unknown>).flatMap((slot) =>\n Array.isArray(slot) ? (slot as string[]) : [],\n )\n : [];\n return [...children, ...slots].filter((child) => typeof child === 'string');\n}\n\n/**\n * The longest chain of elements in the spec, measured without recursing.\n *\n * Iterative on purpose: a check whose whole job is to catch a walk that\n * overflows must not be able to overflow itself. Post-order with a memo, so it\n * is linear in the tree rather than in its paths, and a back edge is ignored\n * for depth - a cycle is section 1b's to report, not this one's.\n */\nfunction deepestChain(spec: Spec): number {\n const below = new Map<string, number>();\n const onPath = new Set<string>();\n let deepest = 0;\n for (const start of Object.keys(spec.elements)) {\n if (below.has(start)) continue;\n const stack: string[] = [start];\n while (stack.length > 0) {\n const key = stack[stack.length - 1] as string;\n if (below.has(key)) {\n onPath.delete(key);\n stack.pop();\n continue;\n }\n const children = childKeysOf(spec, key).filter((child) => !onPath.has(child));\n const pending = children.filter((child) => !below.has(child));\n if (pending.length > 0) {\n onPath.add(key);\n stack.push(...pending);\n continue;\n }\n below.set(\n key,\n children.reduce((tallest, child) => Math.max(tallest, below.get(child) ?? 0), 0) + 1,\n );\n onPath.delete(key);\n stack.pop();\n }\n deepest = Math.max(deepest, below.get(start) ?? 0);\n }\n return deepest;\n}\n\n/**\n * Whether a spec is one this catalog can render.\n *\n * The checks live in `checkAgainstCatalog`; this is the boundary that keeps the\n * documented promise around them - it answers with problems, not exceptions.\n * That promise was not kept: `validateSpec` throws on `repeat: null`, on\n * `children: 5`, on `props: 5`, on a null element and on a missing `elements`\n * map, all of which a model can emit. A host calls this to decide whether it is\n * safe to render, so a throw leaves it with no verdict at the one moment it\n * needs one, and the fallback to the plain form never fires.\n */\nexport function validateAgainstCatalog(\n spec: Spec,\n catalog: ValidationCatalog = defaultCatalog,\n): SpecVerdict {\n try {\n return checkAgainstCatalog(spec, catalog);\n } catch (error) {\n return {\n ok: false,\n problems: [{ message: `the layout is not a well-formed spec: ${String(error)}` }],\n };\n }\n}\n\nfunction checkAgainstCatalog(spec: Spec, catalog: ValidationCatalog): SpecVerdict {\n const problems: SpecProblem[] = [];\n\n // 0. Depth, before anything that recurses - including json-render's own walk.\n const depth = deepestChain(spec);\n if (depth > MAX_ELEMENT_DEPTH) {\n return {\n ok: false,\n problems: [\n {\n message: `the element tree is ${depth} deep; this entry renders at most ${MAX_ELEMENT_DEPTH}.`,\n },\n ],\n };\n }\n\n // 1. Structure: root, children, misplaced fields, and the elements the root\n // never reaches. json-render reports an orphan at `warning` severity, so\n // forwarding errors alone made `checkOrphans` a flag with no effect on the\n // verdict - while `stream.ts` deliberately keeps an unreachable element in\n // the JSONL \"so a validator can report it\". An orphan is a branch of the\n // page the model wrote and never attached: it renders as nothing at all,\n // which is exactly the silent half-page the fallback exists for.\n const structure = validateSpec(spec, { checkOrphans: true });\n for (const issue of structure.issues) {\n if (issue.severity === 'error' || issue.code === 'orphaned_element') {\n problems.push({ elementKey: issue.elementKey, message: issue.message });\n }\n }\n\n // 1b. No element is its own ancestor.\n //\n // json-render's `validateSpec` guards its OWN walks against a cycle but\n // reports nothing about one, so `children: [\"self\"]` passes it in silence.\n // What follows is not silent: the renderer walks children to paint the\n // page and recurses until the stack goes. Catching it here is what makes\n // the fallback fire instead, and it is the reason `repeatBasePathOf` also\n // carries a `seen` guard of its own - the two predicates are exported\n // separately, so neither may assume the other ran first.\n const cyclic = new Set<string>();\n const state = new Map<string, 'open' | 'done'>();\n const descend = (key: string): void => {\n const mark = state.get(key);\n if (mark === 'done') return;\n if (mark === 'open') {\n cyclic.add(key);\n return;\n }\n state.set(key, 'open');\n const element = spec.elements[key];\n for (const child of element?.children ?? []) descend(child);\n for (const slot of Object.values(element?.slots ?? {}))\n for (const child of slot) descend(child);\n state.set(key, 'done');\n };\n for (const key of Object.keys(spec.elements)) descend(key);\n for (const key of cyclic) {\n problems.push({\n elementKey: key,\n message: `\"${key}\" is its own descendant: an element tree may not contain a cycle.`,\n });\n }\n\n // 2. Every type is in the catalog.\n const known = new Set(catalog.componentNames);\n for (const [key, element] of Object.entries(spec.elements)) {\n if (!known.has(element.type)) {\n problems.push({ elementKey: key, message: `unknown component type \"${element.type}\"` });\n }\n }\n\n // 3. Every prop exists on its component, and every literal parses.\n for (const [key, element] of Object.entries(spec.elements)) {\n const schema = propsSchemaOf(catalog, element.type);\n if (!schema) continue;\n const shape = schema.shape as Record<string, z.ZodType>;\n const props = (element.props ?? {}) as Record<string, unknown>;\n for (const [name, value] of Object.entries(props)) {\n const propSchema = shape[name];\n if (!propSchema) {\n problems.push({\n elementKey: key,\n message: `${element.type} has no prop \"${name}\" (known: ${Object.keys(shape).join(', ')})`,\n });\n continue;\n }\n if (isExpression(value)) {\n if (HATCHES.has(element.type) && name === 'path') {\n problems.push({\n elementKey: key,\n message: `${element.type}.path must be a literal string - absolute, or the item's field name inside a repeat - never an expression.`,\n });\n } else if (isClosedVocabulary(propSchema)) {\n problems.push({\n elementKey: key,\n message: `${element.type}.${name} is one of a fixed set of names, so it must be written as a literal, never as an expression.`,\n });\n }\n continue;\n }\n const parsed = propSchema.safeParse(value);\n if (!parsed.success) {\n problems.push({\n elementKey: key,\n message: `${element.type}.${name}: ${parsed.error.issues.map((issue) => issue.message).join('; ')}`,\n });\n }\n }\n // A required prop that is absent. Optional ones are `.nullable()` in the\n // shadcn definitions, so \"required\" here means neither optional nor nullable.\n for (const [name, propSchema] of Object.entries(shape)) {\n if (name in props) continue;\n if (propSchema.safeParse(undefined).success || propSchema.safeParse(null).success) continue;\n problems.push({\n elementKey: key,\n message: `${element.type} is missing required prop \"${name}\"`,\n });\n }\n }\n\n // What each component renders beyond its schema, read off the catalog under\n // validation. `hasOwnProp`, because the type is model-written and a\n // prototype key would find a function where a rendering belongs.\n const renders = catalog.renders ?? {};\n const renderingOf = (type: string): ComponentRendering | undefined =>\n hasOwnProp(renders, type) ? renders[type] : undefined;\n\n // 4. A panelled container has one child per panel, in order. The renderer\n // would silently show fewer panels than tabs, or a step with nothing in\n // it; the validator says so instead.\n for (const [key, element] of Object.entries(spec.elements)) {\n const panelled = renderingOf(element.type)?.panels;\n if (!panelled) continue;\n const props = (element.props ?? {}) as Record<string, unknown>;\n const listed = props[panelled.prop];\n if (!Array.isArray(listed)) continue;\n const panels = listed.length;\n const children = element.children?.length ?? 0;\n if (children !== panels) {\n problems.push({\n elementKey: key,\n message: `${element.type} declares ${panels} panel${panels === 1 ? '' : 's'} but has ${children} child${children === 1 ? '' : 'ren'}: exactly one child per ${panelled.noun}, in order.`,\n });\n }\n const runs = (element.children ?? []).filter(\n (child) => spec.elements[child]?.type === 'Button',\n );\n if (runs.length > 0) {\n problems.push({\n elementKey: key,\n message: `${element.type} has a Button as a direct child; a panel is a container (a Stack), and the Button belongs inside the last one.`,\n });\n }\n }\n // 5. Exactly one h1, and heading levels that increase by one, in render\n // order. The Storybook a11y gate runs axe's `heading-order` at error, and\n // a page that jumps from h1 to h3 fails it; saying so here makes it a\n // rejected spec with a re-run rather than a failing story with a fixture\n // nobody may edit. A `Heading` is not the only element that renders one:\n // a component renders its title as a heading too, at the level its\n // rendering declares - which is what its description states to the\n // model - and the walk counts it where it renders, before its children,\n // since a title comes first. Counting `Heading` elements alone let a page\n // with no h1 through, and one with a Hero over a Section over a titled\n // Card was three headings the check never saw.\n // A Card renders its title as a heading only when it has one; a bound title\n // counts, since it renders whenever the value is set.\n const present = (value: unknown) => value !== undefined && value !== null && value !== '';\n const levels: { key: string; type: string; level: number }[] = [];\n // The elements of each component a page has at most one of, in render order.\n const onlyOnce = new Map<string, { reason: string; keys: string[] }>();\n const seen = new Set<string>();\n const walk = (key: string) => {\n if (seen.has(key)) return;\n seen.add(key);\n const element = spec.elements[key];\n if (!element) return;\n const props = (element.props ?? {}) as Record<string, unknown>;\n const rendering = renderingOf(element.type);\n if (element.type === 'Heading') {\n const level = String(props.level ?? 'h2');\n const match = /^h([1-4])$/.exec(level);\n if (match) levels.push({ key, type: 'Heading', level: Number(match[1]) });\n } else if (rendering?.heading) {\n const rendered = rendering.heading;\n const has = rendered.when === undefined || present(props[rendered.when]);\n if (has) levels.push({ key, type: element.type, level: rendered.level });\n }\n if (rendering?.once !== undefined) {\n const entry = onlyOnce.get(element.type) ?? { reason: rendering.once, keys: [] };\n entry.keys.push(key);\n onlyOnce.set(element.type, entry);\n }\n for (const child of element.children ?? []) walk(child);\n for (const slot of Object.values(element.slots ?? {})) for (const child of slot) walk(child);\n };\n if (spec.root) walk(spec.root);\n const describe = (heading: { type: string; level: number }) =>\n heading.type === 'Heading' ? `h${heading.level}` : `${heading.type}'s h${heading.level}`;\n // Every heading after the first may go deeper than the one before it by\n // one at most, as axe reads it.\n let previous: { type: string; level: number } | undefined;\n for (const heading of levels) {\n if (previous !== undefined && heading.level > previous.level + 1) {\n problems.push({\n elementKey: heading.key,\n message: `${describe(heading)} jumps after ${describe(previous)}: heading levels increase by one, never by more.`,\n });\n }\n previous = heading;\n }\n // One h1, which is the page's title: a page without one has no name for a\n // screen reader to announce, and a page with two has two. A page is asked\n // for one only where its catalog can express one - a `Heading` at level\n // h1, or a component whose rendering declares one - since a vocabulary\n // with neither could never satisfy the rule.\n const firsts = levels.filter((heading) => heading.level === 1);\n const h1Ways = [\n ...(known.has('Heading') ? ['as a Heading at level h1'] : []),\n ...Object.entries(renders)\n .filter(([, rendering]) => rendering.heading?.level === 1)\n .map(([type]) => `as the heading a ${type} renders`),\n ];\n if (firsts.length === 0 && spec.root && h1Ways.length > 0) {\n problems.push({\n elementKey: spec.root,\n message: `the page has no h1: exactly one, ${h1Ways.join(' or ')}.`,\n });\n }\n for (const extra of firsts.slice(1)) {\n problems.push({\n elementKey: extra.key,\n message: `a second h1 (${describe(extra)}, after ${describe(firsts[0]!)} at [${firsts[0]!.key}]): exactly one on a page.`,\n });\n }\n // A component that renders as one of the page's landmarks - its banner, its\n // contentinfo - is one a page has at most one of. axe says so of the DOM\n // (`landmark-no-duplicate-banner`), but the stories switch that rule off\n // because their pair view renders every page twice, so this is the one\n // place a second bar or footer is refused.\n for (const [type, { reason, keys }] of onlyOnce) {\n for (const extra of keys.slice(1)) {\n problems.push({\n elementKey: extra,\n message: `a second ${type} (after [${keys[0]}]): at most one on a page, since it renders as ${reason}.`,\n });\n }\n }\n\n // 6. A container that takes a fixed number of children, and would drop the\n // rest in silence: its renderer destructures the ones it lays out and\n // paints nothing for a third. The product rules state the count for a\n // Workspace, and this is where a layout is held to it.\n for (const [key, element] of Object.entries(spec.elements)) {\n const rule = renderingOf(element.type)?.children;\n if (!rule) continue;\n const children = element.children?.length ?? 0;\n if (children !== rule.count) {\n problems.push({\n elementKey: key,\n message: `${element.type} takes exactly ${rule.count} children (${rule.roles}); this one has ${children}.`,\n });\n }\n }\n\n // 7. The `on` field, which nothing looked at before.\n //\n // `props` was checked exhaustively while the other half of what a layout\n // can say went unread, and the failures that hid there are ends of the\n // same gap. An action name the catalog does not have is accepted, so a\n // `Cta` bound to a misspelt `run` renders a page that validates, fits,\n // and whose only button does nothing - with no fallback, because both\n // checks said yes. An EVENT name the component never emits is the same\n // dead button by the other door: a `Cta` emits `press` and nothing else,\n // so `on.click` bound to a perfectly good `run` fires never, and the\n // action check alone waved it through. And json-render's runtime applies\n // `setState` to whatever `statePath` it is handed, so a layout could write\n // a value the person never saw into `/inputs` and have it leave in the run\n // payload. That is rule 1 inverted: a layout names a path, and the two\n // trees the descriptor owns are the host's to fill - `/inputs` from the\n // person through the controls and `seedInputs`, `/result` from the run.\n // Scratch state of the layout's own, at any other path, stays its business.\n //\n // The write ban covers EVERY destination an action writes, not the one\n // parameter that happens to be named `statePath` on the obvious three:\n // `validateForm` writes its verdict at its own `statePath`, and\n // `pushState` clears a second path, `clearStatePath`, after it appends.\n // Both went unread, and either put a value into `/inputs` through an\n // action the ban never looked at. And the runtime's pointer parser treats\n // `inputs/city` exactly as `/inputs/city` - a missing leading slash is\n // supplied, never refused - so a destination is judged with the slash the\n // runtime will give it, not the one the model wrote.\n //\n // The name check needs a catalog that declares its actions. Both fields are\n // optional on `ValidationCatalog` and a `defineCatalog` result carries\n // both, so this entry's catalog is always checked - but a host that hands\n // in a vocabulary of its own without them gets the write ban and no\n // unknown-action verdict, rather than every action refused for want of a\n // list to check against.\n //\n // And a binding does not only sit under `on`. A `watch` fires its\n // bindings when the state at its key changes, with no event and no\n // person in between; and any binding may carry an `onSuccess` and an\n // `onError`, which the runtime applies after the handler returns or\n // throws: a `set` there writes each key straight into the state with\n // no handler between, and an `action` there is a binding of its own,\n // run through the same executor. Every one of those is a door into\n // `/inputs` that the walk over `on` never saw, so a binding is checked\n // wherever it sits, and a chain is followed as far as it goes.\n const declared = [\n ...(catalog.actionNames ?? []),\n ...(catalog.schema?.builtInActions ?? []).map((action) => action.name),\n ];\n const knownActions = declared.length > 0 ? new Set(declared) : undefined;\n // Every parameter each state-writing action writes to. A destination the\n // runtime falls back on when the parameter is absent (`validateForm` writes\n // `/formValidation`; `pushState` clears nothing) is not the layout's to name,\n // so those are `optional`; the others are refused when they are not a literal.\n const STATE_WRITES: Record<string, readonly { param: string; optional?: boolean }[]> = {\n setState: [{ param: 'statePath' }],\n pushState: [{ param: 'statePath' }, { param: 'clearStatePath', optional: true }],\n removeState: [{ param: 'statePath' }],\n validateForm: [{ param: 'statePath', optional: true }],\n };\n const OWNED_ROOTS = [INPUTS_ROOT, RESULT_ROOT];\n /** The owned root a destination lands in, judged with the leading slash the runtime supplies. */\n const ownedRootOf = (written: string): string | undefined => {\n const statePath = written.startsWith('/') ? written : `/${written}`;\n return OWNED_ROOTS.find((root) => statePath === root || statePath.startsWith(`${root}/`));\n };\n const bindingsOf = (binding: unknown): unknown[] =>\n Array.isArray(binding) ? binding : [binding];\n const refusal = (owned: string, statePath: string): string =>\n `a layout may not write into ${owned}, which the host fills. Bind the value with { \"$bindState\": \"${statePath}\" } or delegate it with MthdsField instead.`;\n\n /**\n * One binding, wherever it sits - under `on.<event>`, under `watch.<path>`,\n * or as the `onSuccess` or `onError` of another - held to the name check,\n * the write ban, and then to its own callbacks. `site` is the spelling a\n * problem names the binding by.\n */\n const checkBinding = (key: string, site: string, entry: unknown): void => {\n const action = (entry as { action?: unknown } | null)?.action;\n if (typeof action !== 'string') {\n problems.push({ elementKey: key, message: `${site} has an entry with no \"action\" name.` });\n return;\n }\n if (knownActions && !knownActions.has(action)) {\n problems.push({\n elementKey: key,\n message: `${site} names the unknown action \"${action}\" (known: ${[...knownActions].join(', ')}); nothing would handle it.`,\n });\n return;\n }\n // `hasOwnProp`: the action is model-written, and `constructor` would\n // find a function where a list of destinations belongs.\n const writes = hasOwnProp(STATE_WRITES, action) ? STATE_WRITES[action] : undefined;\n if (writes) {\n const params = (entry as { params?: unknown }).params;\n for (const { param, optional } of writes) {\n const written =\n typeof params === 'object' && params !== null\n ? (params as Record<string, unknown>)[param]\n : undefined;\n if (written === undefined || written === null) {\n if (!optional) {\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} without a literal \"${param}\".`,\n });\n }\n continue;\n }\n if (typeof written !== 'string') {\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} with a \"${param}\" that is not a literal string; where an action writes must be named, never computed.`,\n });\n continue;\n }\n const owned = ownedRootOf(written);\n if (owned) {\n const where = param === 'statePath' ? `on \"${written}\"` : `with ${param} \"${written}\"`;\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} ${where}: ${refusal(owned, written.startsWith('/') ? written : `/${written}`)}`,\n });\n }\n }\n }\n // What the runtime does once the handler has returned or thrown. A `set`\n // writes each of its keys straight into the state, with no handler in\n // between; an `action` is a binding of its own, run through the same\n // executor, so it is checked as one - callbacks included.\n for (const hook of ['onSuccess', 'onError'] as const) {\n const follow = (entry as Record<string, unknown>)[hook];\n if (follow === undefined || follow === null) continue;\n const hookSite = `${site}.${hook}`;\n if (typeof follow !== 'object' || Array.isArray(follow)) {\n problems.push({\n elementKey: key,\n message: `${hookSite} must be an object: a { \"set\" } of state paths to values, or an { \"action\" } binding.`,\n });\n continue;\n }\n const record = follow as Record<string, unknown>;\n if (record.set !== undefined && record.set !== null) {\n if (typeof record.set !== 'object' || Array.isArray(record.set)) {\n problems.push({\n elementKey: key,\n message: `${hookSite}.set must be an object mapping a state path to its value.`,\n });\n } else {\n for (const written of Object.keys(record.set as Record<string, unknown>)) {\n const owned = ownedRootOf(written);\n if (owned) {\n problems.push({\n elementKey: key,\n message: `${hookSite} sets \"${written}\": ${refusal(owned, written.startsWith('/') ? written : `/${written}`)}`,\n });\n }\n }\n }\n }\n if (record.action !== undefined) checkBinding(key, hookSite, record);\n }\n };\n\n for (const [key, element] of Object.entries(spec.elements)) {\n const on = (element as { on?: unknown }).on;\n if (on !== undefined && on !== null) {\n if (typeof on !== 'object' || Array.isArray(on)) {\n problems.push({\n elementKey: key,\n message: '\"on\" must be an object mapping an event name to its actions.',\n });\n } else {\n const emitted = eventsOf(catalog, element.type);\n for (const [event, binding] of Object.entries(on as Record<string, unknown>)) {\n if (emitted && !emitted.includes(event)) {\n problems.push({\n elementKey: key,\n message:\n emitted.length > 0\n ? `on.${event}: ${element.type} never emits \"${event}\" (it emits: ${emitted.join(', ')}), so nothing bound there would ever fire.`\n : `on.${event}: ${element.type} emits no events, so nothing bound there would ever fire.`,\n });\n }\n for (const entry of bindingsOf(binding)) checkBinding(key, `on.${event}`, entry);\n }\n }\n }\n // A watch has no event to check against a definition: its key is the\n // state path whose change fires it. Its bindings are held to everything\n // else.\n const watch = (element as { watch?: unknown }).watch;\n if (watch !== undefined && watch !== null) {\n if (typeof watch !== 'object' || Array.isArray(watch)) {\n problems.push({\n elementKey: key,\n message:\n '\"watch\" must be an object mapping a state path to the actions its change fires.',\n });\n } else {\n for (const [path, binding] of Object.entries(watch as Record<string, unknown>)) {\n for (const entry of bindingsOf(binding)) checkBinding(key, `watch.${path}`, entry);\n }\n }\n }\n }\n\n return { ok: problems.length === 0, problems };\n}\n\n/** The problems as one block, for a failing test or a repair prompt. */\nexport function formatProblems(problems: readonly SpecProblem[]): string {\n return problems\n .map((problem) =>\n problem.elementKey ? `[${problem.elementKey}] ${problem.message}` : problem.message,\n )\n .join('\\n');\n}\n","import type { Spec } from '@json-render/core';\nimport type { RunField, RunFieldKind } from '../core';\nimport { hasOwnProp } from '../core/own-property';\nimport { catalog } from './catalog';\nimport {\n INPUTS_ROOT,\n RESULT_ROOT,\n absoluteHatchPath,\n inputFieldAtPath,\n joinPath,\n parentMapOf,\n repeatBasePathOf,\n repeatListPathOf,\n resultFieldAtPath,\n} from './paths';\n\n/**\n * Whether a stored layout still fits the descriptor it will be rendered over.\n *\n * A layout is produced once per method version and stored; a descriptor is\n * derived from the method every time it is read. Those two can part company -\n * a method's input is renamed, a structure loses a member - and when they do,\n * a delegated path resolves to nothing and a bound path writes into a corner of\n * the state the run never reads. Neither fails loudly on its own, so the host\n * asks this before it renders and falls back to the kernel's own form when the\n * answer is no.\n *\n * Two directions, and the second is the one a corpus cannot notice. The first\n * is staleness: every path the layout MENTIONS is a path the descriptor still\n * has, which is the corpus test's check lifted out of the test and into the\n * product. The second is coverage: every path the descriptor REQUIRES is one\n * the layout offers somewhere. A layout that simply omits an input is not\n * stale and validates perfectly - it renders a page with no field for a\n * required input, the run gate then refuses the run for that input, and the\n * person has nowhere to type it. A page you cannot complete is worse than the\n * plain form, which is what the fallback is for.\n *\n * It answers with problems, not exceptions, and that is a promise rather than\n * a habit: a host calls this to decide whether it is safe to render, so a\n * throw leaves it with no verdict at the one moment it needs one. A layout is\n * model-produced and may be malformed in ways the walk below trips on\n * (`children: 5`, a null element, no `elements` map at all), and the other\n * gate, which refuses those shapes outright, is exported separately - so\n * neither may assume the other ran first.\n *\n * A third check sits between the two and is about KIND rather than presence:\n * a path a layout shows as a value must be a scalar, and a path it reads into\n * a prop that takes a list must be a list. A `SummaryRow` whose `value` reads\n * `/inputs/document`, a structure of a url and a filename, is not stale - the\n * path exists - and it validates perfectly; it renders `[object Object]`,\n * because the renderer stringifies what it is handed and nothing anywhere said\n * the path was not a value. An `AppBar` whose `links` read that same structure\n * is the mirror image: its renderer maps over what it is handed, renders\n * nothing for a structure and throws for a text. Only the descriptor knows\n * what kind a path is, so this is where that is said.\n *\n * What is NOT checked here is whether the layout validates against the catalog\n * - that is `validateAgainstCatalog`, and a host runs both.\n */\n\nexport interface LayoutDescriptor {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n}\n\n/** Whether `path` is `root` itself or lies under it. */\nfunction isUnder(root: string, path: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\n/**\n * Every state path the layout mentions, sorted by what it does with it.\n *\n * `bound` is what it WRITES: `{ \"$bindState\": \"/path\" }`, and inside a repeat\n * `{ \"$bindItem\": \"field\" }`, which binds a member of the current item. `read`\n * is the rest. A binding is not the only way a layout names a path: the prompt\n * teaches `{ \"$state\": \"/path\" }` for a read-only value, `$cond` for a\n * condition (whose own condition object is a `$state`, so the same walk finds\n * it), `{ \"$template\": \"Total ${/result/amount}\" }` for an interpolation, a\n * top-level `visible` condition on the ELEMENT rather than in its props - which\n * is why `element.visible` is walked here beside `element.props` - and, inside\n * a repeat, `{ \"$item\": \"field\" }` for a member of the current item.\n *\n * Missing any of these was not cosmetic. A read that has gone stale renders a\n * placeholder where a value belongs; a stale `visible` condition compares\n * against nothing, never holds, and hides its element for good - so a section\n * carrying a required input silently never appears, while the coverage half\n * below still counts that input as offered because the binding is right there\n * in the props of an element nobody can see.\n *\n * The two item forms are RELATIVE, and json-render resolves them against the\n * item of the nearest repeat above the element: `$item: \"name\"` inside a\n * repeat over `/result/lines` reads `/result/lines/<i>/name`. They are resolved\n * here the way a relative hatch path is - through `repeatBasePathOf`, at the\n * first index, since every index resolves to the same descriptor node - so a\n * renamed member of a repeated item is the same stale path as a renamed input,\n * and a `$bindItem` under `/result` is the same forbidden write as a\n * `$bindState` there. One outside any repeat resolves to nothing at all; the\n * runtime warns and renders nothing, and `adrift` names the element so the\n * gate can say so.\n *\n * A `repeat` is a read too, and it is resolved separately (`staleRepeats`)\n * because a relative one names its list through the repeat above it.\n */\ninterface Mentioned {\n bound: string[];\n read: string[];\n /** The elements that read or bind the current item with no repeat above them. */\n adrift: string[];\n}\n\n/**\n * The absolute path an item-relative field of one element resolves to, or\n * nothing outside any repeat. Resolved lazily: most elements sit in no repeat\n * and mention no item.\n */\nfunction itemPathResolver(\n spec: Spec,\n key: string,\n parents: Map<string, string>,\n): (field: string) => string | undefined {\n let base: string | undefined;\n let resolvedBase = false;\n return (field) => {\n if (!resolvedBase) {\n base = repeatBasePathOf(spec, key, parents);\n resolvedBase = true;\n }\n if (base === undefined) return undefined;\n // The runtime joins the field under the item's own path, and reads\n // `\"\"` (or `\"/\"`) as the item itself.\n const under = field.startsWith('/') ? field.slice(1) : field;\n return under === '' ? base : `${base}/${under}`;\n };\n}\n\n/**\n * The paths a template interpolates, resolved the way json-render resolves\n * them: `${/result/amount}` is absolute and read as written; a bare\n * `${amount}` is read off the item of the nearest repeat above the element,\n * and outside any repeat off the root of the state, as `/amount`. Inside a\n * repeat the runtime falls back to the root when the item has no such member,\n * but a layout that writes `${name}` in a repeat means the item's `name`, so\n * it is read as one here and a member the item has lost is stale rather than\n * quietly a root path. The pattern is json-render's own - one or more\n * characters - so an empty `${}` is the literal text it renders as, not an\n * interpolation of nothing.\n */\nfunction interpolatedPaths(\n template: string,\n itemPath: (field: string) => string | undefined,\n): string[] {\n return [...template.matchAll(/\\$\\{([^}]+)\\}/g)].flatMap((match) => {\n const raw = match[1];\n if (raw === undefined) return [];\n if (raw.startsWith('/')) return [raw];\n return [itemPath(raw) ?? `/${raw}`];\n });\n}\n\nfunction mentionedPaths(spec: Spec, parents: Map<string, string>): Mentioned {\n const found: Mentioned = { bound: [], read: [], adrift: [] };\n for (const [key, element] of Object.entries(spec.elements)) {\n const itemPath = itemPathResolver(spec, key, parents);\n const walk = (value: unknown): void => {\n if (Array.isArray(value)) {\n value.forEach(walk);\n return;\n }\n if (typeof value !== 'object' || value === null) return;\n const record = value as Record<string, unknown>;\n if (typeof record.$bindState === 'string') found.bound.push(record.$bindState);\n if (typeof record.$state === 'string') found.read.push(record.$state);\n if (typeof record.$template === 'string') {\n found.read.push(...interpolatedPaths(record.$template, itemPath));\n }\n if (typeof record.$bindItem === 'string') {\n const path = itemPath(record.$bindItem);\n if (path === undefined) found.adrift.push(key);\n else found.bound.push(path);\n }\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path === undefined) found.adrift.push(key);\n else found.read.push(path);\n }\n Object.values(record).forEach(walk);\n };\n walk(element.props);\n walk(element.visible);\n }\n return found;\n}\n\n/**\n * The read paths this descriptor answers for, deduplicated.\n *\n * Only paths under the root in question: a layout may hold scratch state of its\n * own (a `$state` an element writes and reads back), and that is its business,\n * not the descriptor's. What the descriptor owns is `/inputs` on an input page\n * and `/result` on a result one, and a path under either that no longer\n * resolves is the staleness this predicate exists to catch. One line per path,\n * however many elements mention it.\n */\nfunction staleReads(\n read: readonly string[],\n root: string,\n resolves: (path: string) => boolean,\n): string[] {\n const under = read.filter((path) => isUnder(root, path));\n return [...new Set(under)].filter((path) => !resolves(path));\n}\n\n/**\n * The repeats whose list the descriptor no longer has.\n *\n * A repeat over a list the method has renamed renders nothing at all, and\n * nothing else notices: on a result page there is no coverage to miss it, and\n * on an input page an optional list is asked for by nobody. A required one was\n * caught, by the coverage half and for the wrong reason. The list is resolved\n * the way a hatch inside the repeat resolves its own path - through the chain\n * of repeats above it - and, as with every read, only under the root the\n * descriptor owns: a repeat over the layout's own scratch state is its\n * business.\n */\nfunction staleRepeats(\n spec: Spec,\n parents: Map<string, string>,\n root: string,\n resolves: (path: string) => boolean,\n side: 'input' | 'result',\n): string[] {\n const problems: string[] = [];\n for (const [key, element] of Object.entries(spec.elements)) {\n if (!element.repeat) continue;\n const listPath = repeatListPathOf(spec, key, parents);\n if (listPath === undefined || !isUnder(root, listPath)) continue;\n if (!resolves(listPath)) {\n problems.push(`${key}: repeats over ${listPath}, which no ${side} has`);\n }\n }\n return problems;\n}\n\n/**\n * What a path of each kind is, in the words of the refusal, for the kinds a\n * value cannot be. A scalar - text, prose, a date, a number, a boolean, a\n * choice - is left out, and so is `unknown`, which the descriptor cannot\n * speak for.\n */\nconst NOT_A_VALUE: Partial<Record<RunFieldKind, { what: string; instead: string }>> = {\n object: { what: 'a structure', instead: 'a structure is shown through its members' },\n list: { what: 'a list', instead: 'a list is laid out as a repeat or a DataTable' },\n document: { what: 'a file', instead: \"a file is delegated to the kernel's own control\" },\n image: { what: 'a file', instead: \"a file is delegated to the kernel's own control\" },\n};\n\n/**\n * What the items of a list-taking prop may be: values alone, for a prop\n * declared as an array of strings or numbers (an `AppBar`'s links), or\n * anything, for one declared over structures or left open (a `DataTable`'s\n * rows). What a list of the wrong item kind is, in the words of the refusal,\n * is `NOT_VALUES`: a `Steps` handed a list of structures for its step names\n * renders `[object Object]` per step, and a renderer that maps a structure\n * into a React child throws.\n */\ntype ListItems = 'values' | 'anything';\nconst NOT_VALUES: Partial<Record<RunFieldKind, string>> = {\n object: 'structures',\n list: 'lists',\n document: 'files',\n image: 'files',\n};\n\n/**\n * The props that take a list rather than a value, by component, and what their\n * items may be: every prop the catalog declares as an array, read from the\n * schemas so a new one is never a missing entry here, plus the rows a\n * `DataTable` lays out, declared `any` because their shape is the\n * descriptor's. A `$state` read into one of these must be the list it wants;\n * into any other prop it is shown as a value.\n */\nlet listPropsCache: Map<string, Map<string, ListItems>> | undefined;\nfunction listProps(): Map<string, Map<string, ListItems>> {\n if (listPropsCache) return listPropsCache;\n const found = new Map<string, Map<string, ListItems>>([\n ['DataTable', new Map([['rows', 'anything']])],\n ]);\n const components = catalog.data.components as Record<string, { props?: unknown }>;\n for (const [type, definition] of Object.entries(components)) {\n const shape = (definition.props as { shape?: Record<string, unknown> } | undefined)?.shape;\n for (const [prop, schema] of Object.entries(shape ?? {})) {\n const items = listItemsOf(schema);\n if (items === undefined) continue;\n if (!found.has(type)) found.set(type, new Map());\n found.get(type)!.set(prop, items);\n }\n }\n listPropsCache = found;\n return found;\n}\n\n/** The zod schemas whose values a list-taking prop can render as they are. */\nconst VALUE_SCHEMAS = new Set(['string', 'number', 'boolean', 'enum', 'literal']);\n\n/** A zod definition, under the `.nullable()` / `.optional()` / `.default()` most props carry. */\nfunction unwrapped(schema: unknown): { type?: string; element?: unknown } | undefined {\n let current: unknown = schema;\n for (let depth = 0; depth < 8; depth += 1) {\n const def = (current as { def?: { type?: string; innerType?: unknown; element?: unknown } })\n .def;\n if (!def) return undefined;\n if (def.innerType === undefined) return def;\n current = def.innerType;\n }\n return undefined;\n}\n\n/** What a prop declared as an array takes as its items, or nothing for a prop that is not one. */\nfunction listItemsOf(schema: unknown): ListItems | undefined {\n const def = unwrapped(schema);\n if (def?.type !== 'array') return undefined;\n const element = unwrapped(def.element);\n return element?.type !== undefined && VALUE_SCHEMAS.has(element.type) ? 'values' : 'anything';\n}\n\n/**\n * The reads that show a path of the wrong kind as a value, or read one of the\n * wrong kind into a prop that takes a list.\n *\n * A read sits in one of two places. In a CONDITION - the object under a\n * `$cond`, or the element's own `visible` - it asks whether a value is set,\n * and any path may be asked; the `visible` field is not walked here at all.\n * Anywhere else in a prop it is shown: the renderer receives what the path\n * holds and stringifies it, and for a structure, a list or a file that is\n * `[object Object]`, a comma-joined list or a url where a name belongs. Every\n * form that shows a value is held to it - `$state`, the item-relative `$item`\n * resolved through the repeat above it, and every interpolation of a\n * `$template`, which stringifies what it interpolates, resolved the same way.\n *\n * A prop that takes a list is held the other way round. Written as one\n * expression, it reads a whole list, and the path must be one: a renderer\n * maps over what it is handed, so a structure or a file there renders nothing\n * and a text throws, and a list of structures where the prop takes values is\n * `[object Object]` per item or a throw, both past every gate. Written as an\n * array literal, each entry is a value and is walked as one. A path the\n * descriptor does not have is not repeated here: the staleness check names it.\n */\nfunction nonScalarReads(\n spec: Spec,\n parents: Map<string, string>,\n root: string,\n fieldAt: (path: string) => RunField | undefined,\n): string[] {\n const problems: string[] = [];\n const lists = listProps();\n for (const [key, element] of Object.entries(spec.elements)) {\n const itemPath = itemPathResolver(spec, key, parents);\n const listy = lists.get(element.type);\n const check = (prop: string, path: string): void => {\n if (!isUnder(root, path)) return;\n const field = fieldAt(path);\n if (!field) return;\n const wrong = hasOwnProp(NOT_A_VALUE, field.kind) ? NOT_A_VALUE[field.kind] : undefined;\n if (!wrong) return;\n problems.push(\n `${key}: ${prop} shows ${path}, which is ${wrong.what} and not a value; a prop that shows a value takes a scalar path, and ${wrong.instead}`,\n );\n };\n const checkList = (prop: string, path: string, items: ListItems): void => {\n if (!isUnder(root, path)) return;\n const field = fieldAt(path);\n if (!field || field.kind === 'unknown') return;\n if (field.kind !== 'list') {\n const what = hasOwnProp(NOT_A_VALUE, field.kind)\n ? NOT_A_VALUE[field.kind]!.what\n : 'a value';\n problems.push(\n `${key}: ${prop} takes a list, and ${path} is ${what}; a prop that takes a list reads a list path`,\n );\n return;\n }\n if (items !== 'values') return;\n const of = hasOwnProp(NOT_VALUES, field.item.kind) ? NOT_VALUES[field.item.kind] : undefined;\n if (!of) return;\n problems.push(\n `${key}: ${prop} takes a list of values, and ${path} is a list of ${of}; a list of ${of} is laid out as a repeat or a DataTable`,\n );\n };\n const walk = (prop: string, value: unknown): void => {\n if (Array.isArray(value)) {\n value.forEach((entry) => walk(prop, entry));\n return;\n }\n if (typeof value !== 'object' || value === null) return;\n const record = value as Record<string, unknown>;\n if (typeof record.$state === 'string') check(prop, record.$state);\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path !== undefined) check(prop, path);\n }\n if (typeof record.$template === 'string') {\n for (const path of interpolatedPaths(record.$template, itemPath)) check(prop, path);\n }\n for (const [name, entry] of Object.entries(record)) {\n if (name !== '$cond') walk(prop, entry);\n }\n };\n for (const [prop, value] of Object.entries(element.props ?? {})) {\n const items = listy?.get(prop);\n if (items === undefined || Array.isArray(value)) {\n walk(prop, value);\n continue;\n }\n if (typeof value !== 'object' || value === null) continue;\n const record = value as Record<string, unknown>;\n if (typeof record.$state === 'string') checkList(prop, record.$state, items);\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path !== undefined) checkList(prop, path, items);\n }\n }\n }\n return problems;\n}\n\n/**\n * The bound paths a layout may not write, under one rule for both pages - the\n * rule the read side above and the validator's `setState` check already apply.\n * `/inputs` is the person's: on an input page a binding there must name an\n * input the descriptor has, and a result page, which writes nothing, may not\n * bind there at all. `/result` is the run's, and no page may bind into it.\n * Anything else is the layout's own scratch state - a `Switch` bound to\n * `/ui/showDetails` is the natural way to drive a `visible` condition - and it\n * is left alone, as a read of it is.\n */\nfunction boundProblems(\n bound: readonly string[],\n inputs: readonly RunField[] | undefined,\n): string[] {\n const problems: string[] = [];\n const underInputs = bound.filter((path) => isUnder(INPUTS_ROOT, path));\n if (!inputs) {\n if (underInputs.length > 0) {\n problems.push(`a result page binds ${underInputs.join(', ')}; a result page writes nothing`);\n }\n } else {\n for (const path of underInputs) {\n if (!inputFieldAtPath(inputs, path)) {\n problems.push(`${path} is bound, and no input has it`);\n }\n }\n }\n for (const path of bound) {\n if (isUnder(RESULT_ROOT, path)) {\n problems.push(\n `${path} is bound; a layout may not write into ${RESULT_ROOT}, which the run fills`,\n );\n }\n }\n return problems;\n}\n\n/** The list path of every `repeat` in the spec: how a layout lays a list out. */\nfunction repeatPaths(spec: Spec): string[] {\n const found: string[] = [];\n for (const element of Object.values(spec.elements)) {\n const statePath = element.repeat?.statePath;\n if (typeof statePath === 'string') found.push(statePath);\n }\n return found;\n}\n\n/**\n * Where a person can enter this path: bound to a control, laid out as a\n * repeat, or delegated to the kernel's own control at this path or at any\n * ancestor of it - an `MthdsField` on a structure renders the whole subtree.\n */\nfunction isOffered(path: string, offered: Offered): boolean {\n if (offered.bound.has(path) || offered.repeated.has(path)) return true;\n return offered.delegated.some((at) => path === at || path.startsWith(`${at}/`));\n}\n\ninterface Offered {\n bound: Set<string>;\n repeated: Set<string>;\n delegated: string[];\n}\n\n/**\n * The required paths under `field` that the layout offers nowhere.\n *\n * A structure is covered by covering what it requires, so a layout may leave\n * out an optional member and still fit; a list is covered whole, by a repeat\n * or by delegation, because its items are the layout's business and not this\n * predicate's.\n */\nfunction uncoveredUnder(field: RunField, path: string, offered: Offered): string[] {\n if (isOffered(path, offered)) return [];\n if (field.kind === 'object') {\n return field.fields\n .filter((child) => child.required)\n .flatMap((child) => uncoveredUnder(child, joinPath(path, child.name), offered));\n }\n return [path];\n}\n\n/**\n * Every way this layout no longer fits, in the words a host can count by:\n * one line per element or path, empty when it fits.\n *\n * The checks live in `collectLayoutProblems`; this is the boundary that keeps\n * the promise in the header around them. A malformed spec is one line, naming\n * what the walk tripped on, which is a verdict the fallback can act on where a\n * throw was not.\n */\nexport function layoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[] {\n try {\n return collectLayoutProblems(descriptor, spec);\n } catch (error) {\n return [`the layout is not a well-formed spec: ${String(error)}`];\n }\n}\n\nfunction collectLayoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[] {\n const problems: string[] = [];\n const delegated: string[] = [];\n const parents = parentMapOf(spec);\n\n for (const [key, element] of Object.entries(spec.elements)) {\n const written = (element.props as { path?: unknown } | undefined)?.path;\n const path =\n typeof written === 'string' ? absoluteHatchPath(spec, key, written, parents) : undefined;\n if (element.type === 'MthdsField') {\n if (!path || !inputFieldAtPath(descriptor.inputs ?? [], path)) {\n problems.push(`${key}: MthdsField delegates ${String(written)}, which no input has`);\n } else {\n delegated.push(path);\n }\n }\n if (element.type === 'MthdsResult') {\n if (!path || !descriptor.result || !resultFieldAtPath(descriptor.result, path)) {\n problems.push(`${key}: MthdsResult delegates ${String(written)}, which no result has`);\n }\n }\n }\n\n const { bound, read, adrift } = mentionedPaths(spec, parents);\n for (const key of new Set(adrift)) {\n problems.push(`${key}: reads the current item, and no repeat above it has one`);\n }\n problems.push(...boundProblems(bound, descriptor.inputs));\n\n if (!descriptor.inputs) {\n const result = descriptor.result;\n const fieldAt = (path: string): RunField | undefined =>\n result ? resultFieldAtPath(result, path) : undefined;\n const resolves = (path: string): boolean => fieldAt(path) !== undefined;\n problems.push(...staleRepeats(spec, parents, RESULT_ROOT, resolves, 'result'));\n for (const path of staleReads(read, RESULT_ROOT, resolves)) {\n problems.push(`${path} is read, and no result has it`);\n }\n problems.push(...nonScalarReads(spec, parents, RESULT_ROOT, fieldAt));\n return problems;\n }\n\n const inputs = descriptor.inputs;\n const fieldAt = (path: string): RunField | undefined => inputFieldAtPath(inputs, path);\n const resolves = (path: string): boolean => fieldAt(path) !== undefined;\n problems.push(...staleRepeats(spec, parents, INPUTS_ROOT, resolves, 'input'));\n for (const path of staleReads(read, INPUTS_ROOT, resolves)) {\n problems.push(`${path} is read, and no input has it`);\n }\n problems.push(...nonScalarReads(spec, parents, INPUTS_ROOT, fieldAt));\n\n const offered: Offered = {\n bound: new Set(bound),\n repeated: new Set(repeatPaths(spec)),\n delegated,\n };\n for (const field of inputs) {\n if (!field.required) continue;\n for (const path of uncoveredUnder(field, joinPath(INPUTS_ROOT, field.name), offered)) {\n problems.push(`${path} is required, and the layout offers nowhere to enter it`);\n }\n }\n\n return problems;\n}\n\n/** The predicate: `layoutProblems` is empty. */\nexport function layoutFits(descriptor: LayoutDescriptor, spec: Spec): boolean {\n return layoutProblems(descriptor, spec).length === 0;\n}\n","import type { Spec } from '@json-render/core';\nimport { compileSpecStream } from '@json-render/core';\nimport { escapeSegment, unescapeSegment } from './paths';\n\n/**\n * A spec as JSONL patches, and back.\n *\n * json-render's wire format is RFC 6902 patches, one per line, root first and\n * parents before children, so a renderer can paint a partial tree at every\n * line. A model emits that format; a projected or authored spec is a finished\n * object. This is the bridge: any of the three sources can be replayed through\n * `specToJsonl`, and what a model emitted is compiled through `specFromJsonl`\n * before it is validated.\n */\n\n/**\n * The patch lines for a spec: `/root`, then every element reachable from the\n * root in breadth-first order (a parent always precedes its children), then\n * any element the root does not reach (kept, so a validator can report it),\n * then one patch per top-level `state` key.\n */\nexport function specToJsonl(spec: Spec): string {\n const lines: string[] = [];\n const push = (op: 'add', path: string, value: unknown) =>\n lines.push(JSON.stringify({ op, path, value }));\n\n push('add', '/root', spec.root);\n\n const emitted = new Set<string>();\n const queue = [spec.root];\n while (queue.length > 0) {\n const key = queue.shift()!;\n if (emitted.has(key)) continue;\n const element = spec.elements[key];\n if (!element) continue;\n emitted.add(key);\n push('add', `/elements/${escapeSegment(key)}`, element);\n for (const child of element.children ?? []) queue.push(child);\n for (const slotChildren of Object.values(element.slots ?? {})) queue.push(...slotChildren);\n }\n for (const key of Object.keys(spec.elements)) {\n if (!emitted.has(key)) push('add', `/elements/${escapeSegment(key)}`, spec.elements[key]);\n }\n for (const [key, value] of Object.entries(spec.state ?? {})) {\n push('add', `/state/${escapeSegment(key)}`, value);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/**\n * The segments a patch path may not contain.\n *\n * json-render's patch applier walks a pointer with `if (!(segment in current)\n * || typeof current[segment] !== 'object') current[segment] = {}` and then\n * steps into it. `'__proto__' in {}` is true and its value is an object, so a\n * line naming `/__proto__/<key>` walks onto `Object.prototype` and assigns\n * there - polluting every object in the realm.\n *\n * This is the only place that can stop it. Compiling happens BEFORE\n * `validateAgainstCatalog` and before `layoutFits`, so by the time either gate\n * has a spec to judge, the damage is done and no verdict and no fallback can\n * undo it. A produced layout is untrusted text, and this is where it first\n * becomes objects.\n *\n * A `copy` or a `move` names a SECOND pointer, `from`, and the applier reads\n * it with the same walk: `getByPath(spec, '/__proto__')` answers\n * `Object.prototype` itself, and a `copy` of it to `/scratch` parks a\n * reference to the prototype inside the spec - not a clone - so the next\n * `add` at `/scratch/<key>` lands on every object in the realm through a path\n * that names no forbidden segment at all. Both pointers are checked, for the\n * same reason `path` is.\n */\nconst FORBIDDEN_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/** Whether a pointer would walk onto a prototype. */\nfunction pointerReachesPrototype(pointer: unknown): boolean {\n return (\n typeof pointer === 'string' &&\n pointer.split('/').some((segment) => FORBIDDEN_SEGMENTS.has(unescapeSegment(segment)))\n );\n}\n\n/** Whether a patch line names a pointer - its `path`, or a copy's or move's `from` - that would walk onto a prototype. */\nfunction reachesPrototype(line: string): boolean {\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return false; // Not JSON: the compiler skips it, and so do we.\n }\n const patch = parsed as { path?: unknown; from?: unknown } | null;\n return pointerReachesPrototype(patch?.path) || pointerReachesPrototype(patch?.from);\n}\n\n/**\n * The spec a JSONL stream compiles to. Blank lines and non-JSON lines are\n * skipped by the compiler; a line whose `path` or `from` would reach a\n * prototype is dropped here, before the compiler sees it; and a line the\n * compiler refuses is dropped too, which is why the stream is applied one line\n * at a time.\n *\n * A batch compile made a single bad line fatal to the whole layout. Two of them\n * are reachable from produced text: a `test` op whose value does not match\n * throws `Test operation failed`, and a non-string `path` throws\n * `path.startsWith is not a function`. A host follows the documented flow -\n * compile, then ask the two gates - so a throw here arrives before there is any\n * verdict to act on, and the fallback that exists for exactly this case never\n * fires. Skipping the line degrades instead: what survives is a partial spec,\n * which the gates then judge on its merits and reject if it is not renderable.\n */\nexport function specFromJsonl(jsonl: string): Spec {\n let spec: Record<string, unknown> = { root: '', elements: {} };\n for (const line of jsonl.split('\\n')) {\n if (reachesPrototype(line)) continue;\n try {\n spec = compileSpecStream<Record<string, unknown>>(line, spec) as Record<string, unknown>;\n } catch {\n continue; // A patch that will not apply is skipped, as a non-JSON line is.\n }\n }\n return spec as unknown as Spec;\n}\n\n/** The individual patch lines of a stream, for a replay that feeds them one at a time. */\nexport function jsonlLines(jsonl: string): string[] {\n return jsonl.split('\\n').filter((line) => line.trim().length > 0);\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { BrandManifest } from './manifest';\n\n/**\n * The manifest, handed down to the brand components: the app bar reads the\n * logo pair and the name off it, and nothing on the page names a brand\n * itself. The provider also loads the manifest's web font, once per family,\n * by appending the Google Fonts link a host would put in its document head -\n * so a brand story needs nothing in `.storybook/preview-head.html`, and the\n * Storybook carries no font any story did not ask for.\n */\n\nconst BrandContext = React.createContext<BrandManifest | null>(null);\n\nexport function BrandProvider({\n manifest,\n children,\n}: {\n manifest: BrandManifest;\n children: React.ReactNode;\n}) {\n useWebfont(manifest.webfont);\n return <BrandContext.Provider value={manifest}>{children}</BrandContext.Provider>;\n}\n\nexport function useBrand(): BrandManifest {\n const manifest = React.useContext(BrandContext);\n if (!manifest)\n throw new Error(\n 'useBrand: no brand in scope. Pass `brand` to GenerativePage, or wrap the tree in BrandProvider.',\n );\n return manifest;\n}\n\n/** The weights the page sets: regular, medium, semibold, bold. */\nconst WEIGHTS = '400;500;600;700';\n\nfunction useWebfont(webfont: BrandManifest['webfont']) {\n const provider = webfont?.provider;\n const family = webfont?.family;\n React.useEffect(() => {\n if (!provider || !family) return;\n const key = `${provider}:${family}`;\n if (document.head.querySelector(`link[data-brand-webfont=\"${CSS.escape(key)}\"]`)) return;\n for (const origin of ['https://fonts.googleapis.com', 'https://fonts.gstatic.com']) {\n if (document.head.querySelector(`link[rel=\"preconnect\"][href=\"${origin}\"]`)) continue;\n const preconnect = document.createElement('link');\n preconnect.rel = 'preconnect';\n preconnect.href = origin;\n if (origin.endsWith('gstatic.com')) preconnect.crossOrigin = 'anonymous';\n document.head.appendChild(preconnect);\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n // Percent-encoded, then spaces back to the `+` Google Fonts expects: a\n // family carrying an `&` would otherwise inject query parameters of its own.\n const encoded = encodeURIComponent(family).replace(/%20/g, '+');\n link.href = `https://fonts.googleapis.com/css2?family=${encoded}:wght@${WEIGHTS}&display=swap`;\n link.dataset.brandWebfont = key;\n document.head.appendChild(link);\n }, [provider, family]);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, useBoundProp, useFieldValidation } from '@json-render/react';\nimport { hasOwnProp } from '../../core/own-property';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { cn } from '../../react/utils';\nimport { Switch as SwitchPrimitive } from '../../react/ui/switch';\n\n/**\n * The renderers for the shadcn subset the catalog picks.\n *\n * They are the package's own, over the same theme tokens the kernel's controls\n * read, for the same reason the controls vendor their primitives: a consumer\n * of `./generative` installs this package and a handful of radix primitives,\n * never a component library. The DEFINITIONS these implement live in\n * `../shadcn-definitions.ts`, and `docs/dependency-budget.md` states the pair.\n *\n * A bound prop is read through `useBoundProp` and written back at the path the\n * spec named, so what the person types lands in the host's store and nowhere\n * else. An unbound one falls back to component state, which is what lets a\n * layout be rendered over an empty store while it is being read.\n */\n\ntype Check = { type: string; message: string; args?: Record<string, unknown> };\ntype ValidateOn = 'change' | 'blur' | 'submit';\n\ninterface BoundFieldProps {\n checks?: Check[] | null;\n validateOn?: ValidateOn | null;\n}\n\n/**\n * The one piece of binding every input repeats: the value the control shows,\n * the setter that writes it back, and the checks the spec attached to it.\n * `useFieldValidation` is given a binding only when there is both a path and a\n * check, so an unbound control never registers a validator the run would wait\n * on.\n */\nfunction useBoundField<T>(\n literal: T | null | undefined,\n binding: string | undefined,\n empty: T,\n { checks, validateOn }: BoundFieldProps,\n) {\n const [boundValue, setBoundValue] = useBoundProp<T>(literal ?? undefined, binding);\n const [localValue, setLocalValue] = React.useState<T>(literal ?? empty);\n const isBound = Boolean(binding);\n const hasValidation = Boolean(binding && checks?.length);\n const when = validateOn ?? 'change';\n const { errors, validate } = useFieldValidation(\n binding ?? '',\n hasValidation ? { checks: checks ?? [], validateOn: when } : undefined,\n );\n return {\n value: isBound ? (boundValue ?? empty) : localValue,\n setValue: (next: T) => {\n if (isBound) setBoundValue(next);\n else setLocalValue(next);\n },\n error: errors[0],\n validateOnChange: () => {\n if (hasValidation && when === 'change') validate();\n },\n validateOnBlur: () => {\n if (hasValidation && when === 'blur') validate();\n },\n };\n}\n\nconst LABEL = 'block text-sm leading-none font-medium';\n\nfunction FieldError({ message }: { message?: string }) {\n return message ? <p className=\"text-sm text-destructive\">{message}</p> : null;\n}\n\n/**\n * The key a closed map answers to, or the fallback.\n *\n * Every map below is keyed by a prop the catalog declares as an enum, and a\n * renderer must not trust that: an expression-valued prop skips the zod check,\n * and a `$template` with nothing to interpolate resolves to a literal, so the\n * string can be anything a layout wrote - `constructor` included, which a bare\n * lookup answers with a function off `Object.prototype`. Both gates refuse the\n * shape; the prop's own type stays the contract; this is what happens when a\n * stored artifact disagrees with it. The read is `hasOwnProp`, the kernel's one\n * spelling of an own-property read (and `Object.hasOwn` is ES2022, past the\n * package's ES2020 target), so an inherited name is not a hit; the fallback is\n * typed as one of the map's own keys.\n */\nexport function pickKey<K extends string>(\n table: Record<K, unknown>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): K {\n return key != null && hasOwnProp(table, key) ? (key as K) : fallback;\n}\n\n/** The value a closed map holds for `key`, or for the fallback when `key` is not one of its own. */\nexport function pick<K extends string, T>(\n table: Record<K, T>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): T {\n return table[pickKey(table, key, fallback)];\n}\n\n// ── Layout ──────────────────────────────────────────────────────────────────\n\nexport function Card({\n props,\n children,\n}: BaseComponentProps<{ title?: string | null; description?: string | null }>) {\n return (\n <div className=\"rounded-lg border border-border bg-card p-6 text-card-foreground\">\n {props.title || props.description ? (\n <div className=\"mb-4 space-y-1.5\">\n {props.title ? (\n <h3 className=\"text-lg leading-none font-semibold\">{props.title}</h3>\n ) : null}\n {props.description ? (\n <p className=\"text-sm text-muted-foreground\">{props.description}</p>\n ) : null}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst GAP = {\n none: 'gap-0',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n};\n\nconst ALIGN = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport function Stack({\n props,\n children,\n}: BaseComponentProps<{\n direction?: 'horizontal' | 'vertical' | null;\n gap?: keyof typeof GAP | null;\n align?: keyof typeof ALIGN | null;\n justify?: keyof typeof JUSTIFY | null;\n}>) {\n const horizontal = props.direction === 'horizontal';\n return (\n <div\n className={cn(\n 'flex',\n horizontal ? 'flex-row' : 'flex-col',\n pick(GAP, props.gap, 'md'),\n pick(ALIGN, props.align, horizontal ? 'start' : 'stretch'),\n props.justify ? pick(JUSTIFY, props.justify, 'start') : undefined,\n )}\n >\n {children}\n </div>\n );\n}\n\n/** Enumerated rather than interpolated: Tailwind compiles the class names it can see. */\nconst COLUMNS: Record<number, string> = {\n 1: 'grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-2 lg:grid-cols-3',\n 4: 'sm:grid-cols-2 lg:grid-cols-4',\n 5: 'sm:grid-cols-2 lg:grid-cols-5',\n 6: 'sm:grid-cols-2 lg:grid-cols-6',\n};\n\nexport function Grid({\n props,\n children,\n}: BaseComponentProps<{ columns?: number | null; gap?: keyof typeof GAP | null }>) {\n const columns = Math.min(Math.max(Math.round(props.columns ?? 2), 1), 6);\n return (\n <div className={cn('grid grid-cols-1', COLUMNS[columns], pick(GAP, props.gap, 'md'))}>\n {children}\n </div>\n );\n}\n\nexport function Separator({\n props,\n}: BaseComponentProps<{ orientation?: 'horizontal' | 'vertical' | null }>) {\n const vertical = props.orientation === 'vertical';\n return (\n <div\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={cn('shrink-0 bg-border', vertical ? 'h-full w-px' : 'h-px w-full')}\n />\n );\n}\n\n/**\n * `details`/`summary` rather than a disclosure primitive: the open state is the\n * element's own, which is what the catalog asks for (a page's UI state never\n * reaches `/state`), and a closed section still exists for find-in-page.\n */\nexport function Collapsible({\n props,\n children,\n}: BaseComponentProps<{ title: string; defaultOpen?: boolean | null }>) {\n return (\n <details\n className=\"rounded-md border border-border\"\n open={props.defaultOpen ?? false}\n data-slot=\"collapsible\"\n >\n <summary className=\"cursor-pointer list-none px-4 py-3 text-sm font-medium select-none\">\n {props.title}\n </summary>\n <div className=\"border-t border-border px-4 py-3\">{children}</div>\n </details>\n );\n}\n\n// ── Content ─────────────────────────────────────────────────────────────────\n\nconst HEADING = {\n h1: 'text-3xl font-bold tracking-tight',\n h2: 'text-2xl font-semibold tracking-tight',\n h3: 'text-lg font-semibold',\n h4: 'text-base font-semibold',\n};\n\nexport function Heading({\n props,\n}: BaseComponentProps<{ text: string; level?: 'h1' | 'h2' | 'h3' | 'h4' | null }>) {\n // The tag is looked up in the same closed map the class comes from, never\n // taken from the prop. `const Tag = level` made an arbitrary string a DOM tag\n // name, and a prop can carry one (`pickKey` says how): a server-rendered host\n // emitted `<script>` from a layout that passed both gates.\n const Tag = pickKey(HEADING, props.level, 'h2');\n return <Tag className={cn('text-foreground', HEADING[Tag])}>{props.text}</Tag>;\n}\n\nconst TEXT = {\n body: 'text-sm text-foreground',\n caption: 'text-xs text-muted-foreground',\n muted: 'text-sm text-muted-foreground',\n lead: 'text-lg text-muted-foreground',\n code: 'font-mono text-[13px] text-foreground',\n};\n\nexport function Text({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'body' | 'caption' | 'muted' | 'lead' | 'code' | null;\n}>) {\n return <p className={pick(TEXT, props.variant, 'body')}>{props.text}</p>;\n}\n\nconst AVATAR_SIZE = {\n sm: 'size-8 text-[11px]',\n md: 'size-10 text-xs',\n lg: 'size-12 text-sm',\n};\n\n/** Initials only: the catalog's description tells a model never to set `src`. */\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '?';\n const first = words[0]?.[0] ?? '';\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? '') : '';\n return (first + last).toUpperCase();\n}\n\nexport function Avatar({\n props,\n}: BaseComponentProps<{ name: string; size?: 'sm' | 'md' | 'lg' | null }>) {\n const name = String(props.name ?? '');\n return (\n <span\n className={cn(\n 'inline-flex shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground',\n pick(AVATAR_SIZE, props.size, 'md'),\n )}\n aria-label={name || undefined}\n role=\"img\"\n >\n {initialsOf(name)}\n </span>\n );\n}\n\nconst BADGE = {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n destructive: 'bg-destructive text-white',\n outline: 'border border-border text-foreground',\n};\n\nexport function Badge({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}>) {\n return (\n <span\n className={cn(\n 'inline-flex w-fit items-center rounded-md px-2 py-0.5 text-xs font-medium',\n pick(BADGE, props.variant, 'default'),\n )}\n >\n {props.text}\n </span>\n );\n}\n\nconst ALERT = {\n info: 'border-border bg-muted text-foreground',\n success: 'border-border bg-muted text-foreground',\n warning: 'border-border bg-muted text-foreground',\n error: 'border-destructive/50 bg-destructive/10 text-foreground',\n};\n\nexport function Alert({\n props,\n}: BaseComponentProps<{\n title: string;\n message?: string | null;\n type?: 'info' | 'success' | 'warning' | 'error' | null;\n}>) {\n const type = pickKey(ALERT, props.type, 'info');\n return (\n <div\n role={type === 'error' ? 'alert' : 'status'}\n className={cn('rounded-md border px-4 py-3 text-sm', ALERT[type])}\n >\n <p className=\"font-medium\">{props.title}</p>\n {props.message ? <p className=\"mt-1 text-muted-foreground\">{props.message}</p> : null}\n </div>\n );\n}\n\nexport function Progress({\n props,\n}: BaseComponentProps<{ value: number; max?: number | null; label?: string | null }>) {\n const max = props.max ?? 100;\n const value = Math.min(Math.max(Number(props.value) || 0, 0), max);\n const percent = max > 0 ? (value / max) * 100 : 0;\n return (\n <div className=\"space-y-1.5\">\n {props.label ? <p className=\"text-sm text-muted-foreground\">{props.label}</p> : null}\n <div\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-label={props.label ?? undefined}\n className=\"h-2 w-full overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary transition-all\" style={{ width: `${percent}%` }} />\n </div>\n </div>\n );\n}\n\n// ── Inputs ──────────────────────────────────────────────────────────────────\n\n/**\n * A stable id per mounted control, for the label that names it.\n *\n * `useId` rather than a module-level counter, for the reason\n * `src/react/field-dom-id.tsx` already gives: it is unique per instance within\n * a React root AND hydration-stable. A counter is neither. It is module state\n * that lives as long as the process, so a server module that has served earlier\n * requests is already advanced while the freshly loaded client module starts at\n * zero - and these controls carry `'use client'`, which means they are still\n * server-rendered and then hydrated. `useMemo` is documented as a hint a\n * renderer may discard, so the id was not guaranteed stable within one session\n * either; when it changed, the label stopped naming its input and the control\n * lost its accessible name, which no story test can see because none of them\n * render on a server.\n */\nexport function useControlId(name: string): string {\n return `jr-${name}-${React.useId()}`;\n}\n\nexport function Input({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n type?: 'text' | 'email' | 'password' | 'number' | null;\n placeholder?: string | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n className={cn(fieldControlClass, 'min-h-11 px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onFocus={() => emit('focus')}\n onBlur={() => {\n field.validateOnBlur();\n emit('blur');\n }}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Textarea({\n props,\n bindings,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n placeholder?: string | null;\n rows?: number | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 4}\n className={cn(fieldControlClass, 'px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onBlur={field.validateOnBlur}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Radio({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; options: string[]; value?: string | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <fieldset className=\"space-y-2\" aria-invalid={field.error ? true : undefined}>\n <legend className={LABEL}>{props.label}</legend>\n <div className=\"space-y-2\">\n {(props.options ?? []).map((option, index) => (\n <label key={`${index}-${option}`} className=\"flex items-center gap-2 text-sm\">\n <input\n type=\"radio\"\n name={id}\n value={option}\n checked={field.value === option}\n className=\"size-4 accent-primary\"\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{option}</span>\n </label>\n ))}\n </div>\n <FieldError message={field.error} />\n </fieldset>\n );\n}\n\nexport function Checkbox({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"flex items-center gap-2 text-sm\">\n <input\n id={id}\n name={props.name}\n type=\"checkbox\"\n className=\"size-4 accent-primary\"\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.checked);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{props.label}</span>\n </label>\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Switch({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-3\">\n <SwitchPrimitive\n id={id}\n name={props.name}\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onCheckedChange={(next) => {\n field.setValue(next);\n field.validateOnChange();\n emit('change');\n }}\n />\n <label htmlFor={id} className=\"text-sm\">\n {props.label}\n </label>\n </div>\n <FieldError message={field.error} />\n </div>\n );\n}\n\n// ── Actions ─────────────────────────────────────────────────────────────────\n\nconst BUTTON = {\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n danger: 'bg-destructive text-white hover:bg-destructive/90',\n};\n\nexport function Button({\n props,\n emit,\n}: BaseComponentProps<{\n label: string;\n variant?: 'primary' | 'secondary' | 'danger' | null;\n disabled?: boolean | null;\n}>) {\n return (\n <button\n type=\"button\"\n disabled={props.disabled ?? false}\n className={cn(\n 'inline-flex min-h-11 w-fit items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:pointer-events-none disabled:opacity-50',\n pick(BUTTON, props.variant, 'primary'),\n )}\n onClick={() => emit('press')}\n >\n {props.label}\n </button>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n type Components,\n useBoundProp,\n useFieldValidation,\n useRepeatScope,\n useStateStore,\n useStateValue,\n} from '@json-render/react';\nimport {\n Accessibility,\n AlertCircle,\n Baby,\n Banknote,\n BarChart3,\n Bookmark,\n Briefcase,\n Building2,\n Calendar,\n Camera,\n Car,\n CheckCircle2,\n Clock,\n Coffee,\n Coins,\n Compass,\n FileText,\n Flag,\n Gift,\n Globe,\n Hash,\n Heart,\n Home,\n Hotel,\n Hourglass,\n Image,\n Info,\n Landmark,\n Layers,\n Leaf,\n Lightbulb,\n ListChecks,\n type LucideIcon,\n Mail,\n Map,\n MapPin,\n Moon,\n Mountain,\n Music,\n Package,\n Paperclip,\n Pencil,\n Percent,\n Phone,\n Plane,\n Receipt,\n Rocket,\n Route,\n Send,\n Shield,\n Ship,\n Sparkles,\n Star,\n Sun,\n Tag,\n Ticket,\n Train,\n TrendingUp,\n Truck,\n Upload,\n User,\n Users,\n Utensils,\n Wallet,\n Zap,\n} from 'lucide-react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport type { RunField } from '../core';\nimport { FieldRenderer, ResultField, type FieldEnv } from '../react';\nimport { fieldControlClass } from '../react/field-styles';\nimport { ResultRoot } from '../react/result-location';\nimport {\n Select as SelectRoot,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../react/ui/select';\nimport { ToggleGroup, ToggleGroupItem } from '../react/ui/toggle-group';\nimport { cn } from '../react/utils';\nimport { baseCatalog, type ICON_NAMES, type METRIC_FORMATS } from './components';\nimport * as shadcn from './ui/shadcn';\nimport { inputFieldAtPath, RESULT_ROOT, resultFieldAtPath, segmentsUnder } from './paths';\n\n/**\n * The registry: what each catalog entry RENDERS as.\n *\n * The shadcn subset binds the package's own implementations. The custom\n * components are implemented here over this package's controls and vendored\n * primitives - the vocabulary of an app (Split, Tabs, Steps, Icon, Segmented,\n * NumberInput), the bound equivalents of what a model most wants to inline\n * (DataTable, Metric), and the two escape hatches the design rests on:\n *\n * - `MthdsField` renders ONE input through `FieldRenderer`, two-way at the\n * path the spec names. It is the arm for the kinds the catalog cannot\n * enter, and it is always available for a scalar the model would rather\n * not style.\n * - `MthdsResult` renders ONE result subtree through `ResultField`, reading\n * state at the path the spec names.\n *\n * Both resolve the path against the DESCRIPTOR, through `DescriptorProvider`,\n * which is what keeps rule 1: the spec names a path and nothing more, and the\n * kernel is handed the `RunField` the host already holds. A spec never\n * restates what a field is.\n */\n\nexport interface DescriptorScope {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n /** What the host injects into the controls: upload, disabled, resolver. */\n env?: FieldEnv;\n /** Prefix for the DOM ids `MthdsField` mints; two pages on one screen need two. */\n idPrefix?: string;\n}\n\nconst DescriptorContext = React.createContext<DescriptorScope>({});\n\n/** The scope the nearest `DescriptorProvider` set - for a renderer defined outside this file. */\nexport function useDescriptorScope(): DescriptorScope {\n return React.useContext(DescriptorContext);\n}\n\nexport function DescriptorProvider({\n scope,\n children,\n}: {\n scope: DescriptorScope;\n children: React.ReactNode;\n}) {\n return <DescriptorContext.Provider value={scope}>{children}</DescriptorContext.Provider>;\n}\n\nfunction Unresolved({ path, side }: { path: string; side: 'input' | 'result' }) {\n return (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/50 px-2.5 py-1.5 text-[12px] text-destructive\"\n >\n {side === 'input' ? 'No input' : 'No result'} at <span className=\"font-mono\">{path}</span>\n </p>\n );\n}\n\n/**\n * A pointer segment as one piece of a DOM id, and back.\n *\n * The id is built by joining the pointer's segments with `-`, so a segment that\n * contains a `-` of its own would make the join ambiguous: `/inputs/a-b` and\n * `/inputs/a/b` mint the same id, and the inverse below then hands a host the\n * wrong path to write an uploaded file to - plausible-looking, silent, and\n * wrong. This used to rest on a comment asserting that a field's name carries\n * no `-`; nothing here can enforce that, because a name reaches the descriptor\n * from a JSON Schema property. So the separator is escaped instead.\n *\n * `_` goes first, which is what makes the pass unambiguous: every `_` in the\n * output that is not one this function wrote has already been doubled, so the\n * single left-to-right decode below cannot mistake one for the other. Names\n * without `_`, `-` or `~` - which is every name in practice - pass through\n * untouched, so the ids this mints are the ids it always minted.\n */\nfunction encodeSegment(segment: string): string {\n return segment.replace(/_/g, '_u').replace(/-/g, '_d').replace(/~/g, '_t');\n}\n\nfunction decodeSegment(segment: string): string {\n return segment.replace(/_([udt])/g, (_match, code: string) =>\n code === 'u' ? '_' : code === 'd' ? '-' : '~',\n );\n}\n\n/**\n * Exported for the round-trip test only, not from the entry's index: the pair\n * is only correct together, so a test that could see just one half of it would\n * be no guard at all.\n */\nexport function domIdFor(prefix: string | undefined, path: string): string {\n return `${prefix ?? 'gen'}${path.split('/').map(encodeSegment).join('-')}`;\n}\n\n/**\n * The inverse of `domIdFor`, for a host's upload seam: the kernel reports a\n * drop by the DOM id of the field it landed on, which for a nested one is the\n * hatch's id with the child's name or index joined by `.` (the kernel's own\n * composition, `FieldRenderer` through `ObjectField` and `ListField`), and\n * the host writes the file at the store path that id was minted from. Kept\n * beside `domIdFor` so the two cannot drift, and exact for any name by\n * construction rather than by assumption.\n */\nexport function pathFromDomId(prefix: string | undefined, id: string): string | undefined {\n const head = prefix ?? 'gen';\n if (!id.startsWith(head)) return undefined;\n const [own = '', ...children] = id.slice(head.length).split('.');\n if (!own.startsWith('-')) return undefined;\n const path = own.split('-').map(decodeSegment).join('/');\n return `${path}${children.map((child) => `/${child}`).join('')}`;\n}\n\n/**\n * The path a hatch resolves: absolute as written, or, inside a repeat, the\n * item's field name joined onto the current item's base path. A relative path\n * outside any repeat resolves to nothing, and the hatch says so.\n */\nfunction useAbsolutePath(path: string): string | undefined {\n const repeat = useRepeatScope();\n if (path.startsWith('/')) return path;\n // Raw, not `joinPath`: the same reason `absoluteHatchPath` gives - a relative\n // hatch path may name several segments, so its `/` are separators already.\n return repeat ? `${repeat.basePath}/${path}` : undefined;\n}\n\n// ─── The escape hatches ──────────────────────────────────────────────────────\n\nfunction MthdsField({ props }: BaseComponentProps<{ path: string }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.inputs && path ? inputFieldAtPath(scope.inputs, path) : undefined;\n const value = useStateValue<unknown>(path);\n const { set } = useStateStore();\n const onChange = React.useCallback((next: unknown) => set(path, next), [set, path]);\n if (!field) return <Unresolved path={props.path} side=\"input\" />;\n return (\n <FieldRenderer\n field={field}\n value={value}\n onChange={onChange}\n id={domIdFor(scope.idPrefix, path)}\n env={scope.env}\n />\n );\n}\n\nfunction MthdsResult({ props }: BaseComponentProps<{ path: string; hideLabel?: boolean | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.result && path ? resultFieldAtPath(scope.result, path) : undefined;\n const value = useStateValue<unknown>(path);\n if (!field || !scope.result) return <Unresolved path={props.path} side=\"result\" />;\n // The subtree's place in the whole result, so a file inside it saves under\n // the name the whole-result download gives it. Left to itself, `ResultField`\n // would root the location at its own node's name, and every entry of a\n // repeat would save as `image.png`.\n const place = [scope.result.name, ...(segmentsUnder(RESULT_ROOT, path) ?? [])];\n return (\n <ResultRoot baseName={scope.result.name} path={place}>\n <ResultField field={field} value={value} hideLabel={props.hideLabel ?? false} />\n </ResultRoot>\n );\n}\n\n// ─── A Select with an accessible name ────────────────────────────────────────\n\ninterface SelectProps {\n label: string;\n name: string;\n options: string[];\n placeholder?: string | null;\n value?: string | null;\n checks?: { type: string; message: string; args?: Record<string, unknown> }[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction AccessibleSelect({ props, bindings, emit }: BaseComponentProps<SelectProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'change';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useFieldValidation(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <SelectRoot\n value={value}\n onValueChange={(next) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n emit('change');\n }}\n >\n <SelectTrigger id={id} className=\"w-full\">\n <SelectValue placeholder={props.placeholder ?? 'Select...'} />\n </SelectTrigger>\n <SelectContent>\n {/* Written exactly as listed. The primitive throws on an empty value,\n and the fallback that used to stand in for one wrote a value the\n descriptor's enum never listed; the definition refuses an empty\n option now, upstream of every renderer. */}\n {(props.options ?? []).map((option, index) => (\n <SelectItem key={`${index}-${option}`} value={option}>\n {option}\n </SelectItem>\n ))}\n </SelectContent>\n </SelectRoot>\n {errors.length > 0 ? <p className=\"text-sm text-destructive\">{errors[0]}</p> : null}\n </div>\n );\n}\n\n// ─── The bound equivalents of what a model most wants to inline ──────────────\n\nfunction valueAt(row: unknown, relativePath: string): unknown {\n let current: unknown = row;\n for (const segment of relativePath.split('/').filter((part) => part.length > 0)) {\n if (typeof current !== 'object' || current === null) return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** A cell shows a number as it is: grouped, with the places it has, never padded. */\nconst CELL_NUMBER = new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 });\n\nfunction formatCell(value: unknown): string {\n if (value === null || value === undefined || value === '') return '—';\n if (typeof value === 'boolean') return value ? 'yes' : 'no';\n if (typeof value === 'number') return CELL_NUMBER.format(value);\n if (typeof value === 'string') return value;\n if (Array.isArray(value)) return value.map(formatCell).join(', ');\n return JSON.stringify(value);\n}\n\ninterface DataTableProps {\n rows: unknown;\n columns: { path: string; label: string }[];\n caption?: string | null;\n}\n\nfunction DataTable({ props }: BaseComponentProps<DataTableProps>) {\n const rows = Array.isArray(props.rows) ? props.rows : [];\n const columns = props.columns ?? [];\n return (\n <div className=\"overflow-x-auto rounded-md border border-border\">\n <table className=\"w-full min-w-full border-collapse text-[13px]\">\n {props.caption ? (\n <caption className=\"px-2.5 py-1.5 text-start text-[12px] text-muted-foreground\">\n {props.caption}\n </caption>\n ) : null}\n <thead>\n <tr className=\"border-b border-border bg-muted\">\n {columns.map((column) => (\n <th\n key={column.path}\n scope=\"col\"\n className=\"whitespace-nowrap px-2.5 py-1.5 text-start font-semibold text-foreground\"\n >\n {column.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => (\n <tr key={index} className=\"border-b border-border/60 last:border-b-0\">\n {columns.map((column) => (\n <td key={column.path} className=\"px-2.5 py-1.5 align-top text-foreground\">\n {formatCell(valueAt(row, column.path))}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\ntype MetricFormat = (typeof METRIC_FORMATS)[number];\n\nfunction numberFormat(format: MetricFormat): Intl.NumberFormat {\n switch (format) {\n case 'integer':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });\n case 'decimal':\n return new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n case 'compact':\n return new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 });\n case 'plain':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 20, useGrouping: false });\n default:\n return format satisfies never;\n }\n}\n\ninterface MetricProps {\n label: string;\n value: unknown;\n unit?: string | null;\n format?: MetricFormat | null;\n}\n\nfunction Metric({ props }: BaseComponentProps<MetricProps>) {\n const value = props.value;\n const text =\n typeof value === 'number'\n ? numberFormat(props.format ?? 'plain').format(value)\n : value === null || value === undefined || value === ''\n ? '—'\n : String(value);\n return (\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wider text-muted-foreground\">\n {props.label}\n </span>\n <span className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {text}\n {props.unit ? (\n <span className=\"ml-1 text-sm font-normal text-muted-foreground\">{props.unit}</span>\n ) : null}\n </span>\n </div>\n );\n}\n\n// ─── The vocabulary of an app ────────────────────────────────────────────────\n\ntype SplitRatio = '1:1' | '1:2' | '2:1';\n\nconst SPLIT_COLUMNS: Record<SplitRatio, string> = {\n '1:1': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]',\n '1:2': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]',\n '2:1': 'sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]',\n};\n\nconst SPLIT_GAP: Record<'md' | 'lg' | 'xl', string> = { md: 'gap-4', lg: 'gap-6', xl: 'gap-8' };\n\n/** Two columns from two children, stacking under the `sm` breakpoint. */\nfunction Split({\n props,\n children,\n}: BaseComponentProps<{ ratio?: SplitRatio | null; gap?: 'md' | 'lg' | 'xl' | null }>) {\n return (\n <div\n className={cn(\n 'grid grid-cols-1 items-start',\n shadcn.pick(SPLIT_COLUMNS, props.ratio, '1:2'),\n shadcn.pick(SPLIT_GAP, props.gap, 'lg'),\n )}\n >\n {children}\n </div>\n );\n}\n\ninterface TabsProps {\n tabs: { label: string; value: string }[];\n}\n\n/**\n * Tabs whose panels follow the active tab - the reason shadcn's is not in the\n * catalog. The nth child is the nth tab's panel; the active tab is local\n * state, so a spec never touches /state for it. Radix unmounts an inactive\n * panel, and the inputs in it keep their values in the store.\n */\nfunction Tabs({ props, children }: BaseComponentProps<TabsProps>) {\n const tabs = props.tabs ?? [];\n const panels = React.Children.toArray(children);\n const [value, setValue] = React.useState(tabs[0]?.value ?? '');\n return (\n <TabsPrimitive.Root value={value} onValueChange={setValue} className=\"w-full\">\n <TabsPrimitive.List className=\"inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground\">\n {tabs.map((tab) => (\n <TabsPrimitive.Trigger\n key={tab.value}\n value={tab.value}\n className=\"inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\"\n >\n {tab.label}\n </TabsPrimitive.Trigger>\n ))}\n </TabsPrimitive.List>\n {tabs.map((tab, index) => (\n <TabsPrimitive.Content\n key={tab.value}\n value={tab.value}\n className=\"mt-4 focus-visible:outline-hidden\"\n >\n {panels[index] ?? null}\n </TabsPrimitive.Content>\n ))}\n </TabsPrimitive.Root>\n );\n}\n\nconst BUTTON_BASE =\n 'inline-flex h-10 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50';\nconst PRIMARY_BUTTON = cn(BUTTON_BASE, 'bg-primary text-primary-foreground hover:bg-primary/90');\nconst SECONDARY_BUTTON = cn(\n BUTTON_BASE,\n 'border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground',\n);\n\ninterface StepsProps {\n steps: string[];\n nextLabel?: string | null;\n backLabel?: string | null;\n}\n\n/**\n * A journey: a numbered indicator, one panel at a time, and its own Back and\n * Next. The nth child is the nth step's panel; the spec's one Button sits\n * inside the last one, which is why Next disappears there. The current step\n * is local state. A hidden panel is unmounted, and its inputs keep their\n * values in the store - a step hides from the eye, never from the run.\n */\nfunction Steps({ props, children }: BaseComponentProps<StepsProps>) {\n const steps = props.steps ?? [];\n const panels = React.Children.toArray(children);\n const [index, setIndex] = React.useState(0);\n const last = steps.length - 1;\n return (\n <div className=\"flex flex-col gap-5\">\n <ol className=\"flex flex-wrap items-center gap-x-5 gap-y-2\">\n {steps.map((label, position) => (\n <li\n key={`${position}-${label}`}\n aria-current={position === index ? 'step' : undefined}\n className={cn(\n 'flex items-center gap-2 text-sm',\n position === index ? 'font-medium text-foreground' : 'text-muted-foreground',\n )}\n >\n <span\n className={cn(\n 'flex h-6 w-6 items-center justify-center rounded-full text-[12px] font-semibold tabular-nums',\n position < index\n ? 'bg-primary/15 text-primary'\n : position === index\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground',\n )}\n >\n {position + 1}\n </span>\n {label}\n </li>\n ))}\n </ol>\n <div>{panels[index] ?? null}</div>\n {index > 0 || index < last ? (\n <div className=\"flex items-center justify-between gap-3\">\n {index > 0 ? (\n <button\n type=\"button\"\n data-testid=\"steps-back\"\n onClick={() => setIndex((current) => Math.max(0, current - 1))}\n className={SECONDARY_BUTTON}\n >\n {props.backLabel ?? 'Back'}\n </button>\n ) : (\n <span />\n )}\n {index < last ? (\n <button\n type=\"button\"\n data-testid=\"steps-next\"\n onClick={() => setIndex((current) => Math.min(last, current + 1))}\n className={PRIMARY_BUTTON}\n >\n {props.nextLabel ?? 'Next'}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\ntype IconName = (typeof ICON_NAMES)[number];\n\n/** The closed list the catalog names, each bound to its lucide component. */\nconst ICONS: Record<IconName, LucideIcon> = {\n Sparkles,\n Rocket,\n Compass,\n Map,\n MapPin,\n Route,\n Plane,\n Train,\n Car,\n Ship,\n Hotel,\n Home,\n Building2,\n Landmark,\n Globe,\n Mountain,\n Leaf,\n Sun,\n Moon,\n Calendar,\n Clock,\n Hourglass,\n Users,\n User,\n Baby,\n Accessibility,\n Heart,\n Star,\n Utensils,\n Coffee,\n Music,\n Camera,\n Image,\n Ticket,\n Gift,\n Wallet,\n Banknote,\n Coins,\n Receipt,\n Percent,\n Hash,\n TrendingUp,\n BarChart3,\n FileText,\n Upload,\n Paperclip,\n Mail,\n Phone,\n Tag,\n Layers,\n ListChecks,\n CheckCircle2,\n AlertCircle,\n Info,\n Shield,\n Flag,\n Bookmark,\n Briefcase,\n Package,\n Truck,\n Lightbulb,\n Zap,\n Pencil,\n Send,\n};\n\n/** Decorative: hidden from assistive technology, because it carries no text. */\nfunction Icon({ props }: BaseComponentProps<{ name: IconName; size?: 'sm' | 'md' | 'lg' | null }>) {\n const Glyph = ICONS[props.name];\n if (!Glyph) return null;\n const size = props.size === 'lg' ? 'h-7 w-7' : props.size === 'sm' ? 'h-4 w-4' : 'h-5 w-5';\n return <Glyph aria-hidden=\"true\" className={cn(size, 'shrink-0 text-muted-foreground')} />;\n}\n\ninterface SegmentedProps {\n label: string;\n name: string;\n options: string[];\n value?: string | null;\n}\n\n/**\n * A choice as a row of pills, over the package's own toggle group. The group\n * is named by its visible label; each pill is a button with its option as its\n * text. Deselecting is ignored, as shadcn's toggle group does, so the bound\n * path never holds an empty string.\n */\nfunction Segmented({ props, bindings, emit }: BaseComponentProps<SegmentedProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const labelId = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <span id={labelId} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </span>\n <ToggleGroup\n type=\"single\"\n aria-labelledby={labelId}\n value={value}\n onValueChange={(next: string) => {\n if (!next) return;\n setValue(next);\n emit('change');\n }}\n className=\"flex-wrap justify-start gap-1.5\"\n >\n {(props.options ?? []).map((option) => (\n <ToggleGroupItem\n key={option}\n value={option}\n variant=\"outline\"\n size=\"sm\"\n className=\"rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground\"\n >\n {option}\n </ToggleGroupItem>\n ))}\n </ToggleGroup>\n </div>\n );\n}\n\ninterface NumberInputProps {\n label: string;\n name: string;\n value?: number | null;\n placeholder?: string | null;\n unit?: string | null;\n min?: number | null;\n max?: number | null;\n step?: number | null;\n}\n\n/**\n * A figure that writes a NUMBER to state - the gap Checkpoint 3 recorded\n * against shadcn's `Input type=\"number\"`, which writes the DOM's string. An\n * emptied field writes `undefined`, which the kernel's readiness reads as\n * absent, exactly as its own number control does.\n */\nfunction NumberInput({ props, bindings, emit }: BaseComponentProps<NumberInputProps>) {\n const [boundValue, setBoundValue] = useBoundProp<number | undefined>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState<number | undefined>(undefined);\n const isBound = Boolean(bindings?.value);\n const value = isBound ? boundValue : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id={id}\n type=\"number\"\n inputMode=\"decimal\"\n value={typeof value === 'number' ? value : ''}\n min={props.min ?? undefined}\n max={props.max ?? undefined}\n step={props.step ?? 'any'}\n placeholder={props.placeholder ?? undefined}\n onChange={(event) => {\n const raw = event.target.value;\n setValue(raw === '' ? undefined : Number(raw));\n emit('change');\n }}\n className={cn(\n fieldControlClass,\n 'h-10 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none',\n )}\n />\n {props.unit ? <span className=\"text-sm text-muted-foreground\">{props.unit}</span> : null}\n </div>\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/**\n * Each renderer is MOUNTED rather than called: they are React components that\n * use hooks, and a render function calling hooks itself would run them inside\n * the registry's wrapper and break the moment the wrapper re-ordered them.\n */\nconst components: Components<typeof baseCatalog> = {\n Card: (ctx) => <shadcn.Card {...ctx} />,\n // A vertical Stack stretches its children unless the spec says otherwise:\n // hugging the content is the one layout a result page never wants, since a\n // table or a grid inside it would stop short of the page's width.\n Stack: (ctx) => <shadcn.Stack {...ctx} />,\n Grid: (ctx) => <shadcn.Grid {...ctx} />,\n Separator: (ctx) => <shadcn.Separator {...ctx} />,\n Collapsible: (ctx) => <shadcn.Collapsible {...ctx} />,\n Heading: (ctx) => <shadcn.Heading {...ctx} />,\n Text: (ctx) => <shadcn.Text {...ctx} />,\n Badge: (ctx) => <shadcn.Badge {...ctx} />,\n Alert: (ctx) => <shadcn.Alert {...ctx} />,\n Progress: (ctx) => <shadcn.Progress {...ctx} />,\n Avatar: (ctx) => <shadcn.Avatar {...ctx} />,\n Input: (ctx) => <shadcn.Input {...ctx} />,\n Textarea: (ctx) => <shadcn.Textarea {...ctx} />,\n // A plain label beside a trigger leaves the trigger with no accessible name,\n // which axe reports as a button without one (`a11y` runs at error). This one\n // is the package's own vendored select under a label that names the trigger.\n Select: (ctx) => <AccessibleSelect {...ctx} />,\n Radio: (ctx) => <shadcn.Radio {...ctx} />,\n Checkbox: (ctx) => <shadcn.Checkbox {...ctx} />,\n Switch: (ctx) => <shadcn.Switch {...ctx} />,\n Button: (ctx) => <shadcn.Button {...ctx} />,\n Split: (ctx) => <Split {...ctx} />,\n Tabs: (ctx) => <Tabs {...ctx} />,\n Steps: (ctx) => <Steps {...ctx} />,\n Icon: (ctx) => <Icon {...ctx} />,\n Segmented: (ctx) => <Segmented {...ctx} />,\n NumberInput: (ctx) => <NumberInput {...ctx} />,\n // Ours are React components (they use hooks), so each is MOUNTED rather than\n // called: a render function that called hooks itself would run them inside\n // the registry's wrapper and break the moment the wrapper re-ordered them.\n MthdsField: (ctx) => <MthdsField {...ctx} />,\n MthdsResult: (ctx) => <MthdsResult {...ctx} />,\n DataTable: (ctx) => <DataTable {...ctx} />,\n Metric: (ctx) => <Metric {...ctx} />,\n};\n\n/** The renderers, for the registry over the catalog that extends this vocabulary. */\nexport const generativeRenderers = components;\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What the page paints under the work column, when there is anything to paint.\n *\n * No spec names a result: the layout a model writes is the INPUT page, and the\n * result has shapes of its own. So the page leaves a slot instead, and the host\n * fills it with whatever the run yielded - the kernel's own viewer over the\n * output descriptor, a line while the run is in flight, a failure. The slot is\n * a React node and nothing more: this entry knows how to place it in the page's\n * grammar and nothing about how a run is started, followed or delivered.\n *\n * A host that provides nothing gets a page with no result section at all, which\n * is what an input page is before its first run.\n */\n\nexport interface ResultSlot {\n /** What to paint. Nothing is painted at all while this is absent or `null`. */\n content: React.ReactNode;\n /** The heading above it. \"Result\" unless the host names it. */\n title?: string;\n}\n\nconst ResultSlotContext = React.createContext<ResultSlot | null>(null);\n\nexport function ResultSlotProvider({\n slot,\n children,\n}: {\n slot: ResultSlot | null;\n children: React.ReactNode;\n}) {\n return <ResultSlotContext.Provider value={slot}>{children}</ResultSlotContext.Provider>;\n}\n\n/** The slot the nearest page provides, or `null` on a page with no result yet. */\nexport function useResultSlot(): ResultSlot | null {\n return React.useContext(ResultSlotContext);\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n defineRegistry,\n useBoundProp,\n useFieldValidation,\n} from '@json-render/react';\nimport { fieldControlClass } from '../react/field-styles';\nimport { cn } from '../react/utils';\nimport { useBrand } from './brand-context';\nimport { catalog } from './catalog';\nimport { generativeRenderers } from './registry';\nimport { useResultSlot } from './result-slot';\nimport { useControlId } from './ui/shadcn';\n\n/**\n * What the brand catalog's components RENDER as - the product page's chrome,\n * over the same tokens the kernel's controls read, and over NOTHING else: no\n * literal colour, no literal radius, no literal typeface. The rail's panel is\n * `bg-card` on `border-border`, a hairline is `border-border`, the call to\n * action's glow is the accent composed with `color-mix()`, the corners are\n * `--radius` and its multiples, the logo is the manifest's pair. That is what\n * lets one set of components render any brand the build produces - and what\n * makes anything the tokens cannot state absent from the page by\n * construction.\n *\n * The layer's renderers are reused as they are; two of shadcn's are replaced\n * (`Input`, `Textarea`) so that every text field on the page is drawn on the\n * kernel's own control surface (`fieldControlClass`) and reads as one family\n * with the dates, the lists and the upload the kernel renders itself.\n *\n * Nothing here ships, and nothing here reads a schema - a brand component\n * takes copy and bound values, and that is all.\n */\n\nconst CONTAINER = 'mx-auto w-full max-w-6xl px-6 sm:px-8';\n\n/** The kernel's app-presentation label, so a brand field and a kernel field read alike. */\nconst LABEL = 'block text-[13.5px] leading-none font-medium text-foreground';\n\n// ─── The page's chrome ───────────────────────────────────────────────────────\n\ninterface AppBarProps {\n app: string;\n links?: string[] | null;\n tag?: string | null;\n}\n\nfunction AppBar({ props }: BaseComponentProps<AppBarProps>) {\n const brand = useBrand();\n return (\n <header className=\"border-b border-border\">\n <div className={cn(CONTAINER, 'flex h-16 items-center gap-5')}>\n {/* `no-referrer` on both, as on every image this package paints: the\n scheme is already checked where the manifest is parsed, and a brand\n asset has no more business learning where it was drawn than a\n payload's picture does.\n\n This pair is the one place a `dark:` variant and the token fallbacks\n disagree. A fallback is frozen per utility and cannot vary by scope,\n so a host that defines no tokens renders LIGHT inside `.dark` - but\n the variant still flips, so that host gets the dark-ground asset on\n a light surface. Documented in `docs/theming.md` rather than worked\n around: the swap is right for every host that defines tokens, which\n is every host that sets `.dark` deliberately. */}\n <img\n src={brand.logo.onLight}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"h-7 w-auto dark:hidden\"\n />\n <img\n src={brand.logo.onDark}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"hidden h-7 w-auto dark:block\"\n />\n <span aria-hidden=\"true\" className=\"h-5 w-px bg-border\" />\n <span className=\"text-sm font-medium text-foreground/80\">{props.app}</span>\n {/* `min-w-0` down to the pill: a pipe's code is one long word, and\n at phone width an unshrinkable pill pushed the row past the viewport. */}\n <div className=\"ml-auto flex min-w-0 items-center gap-6\">\n {props.links && props.links.length > 0 ? (\n <nav aria-label=\"Site\" className=\"hidden items-center gap-6 sm:flex\">\n {props.links.map((link) => (\n <a\n key={link}\n href=\"#\"\n onClick={(event) => event.preventDefault()}\n className=\"text-sm text-muted-foreground transition-colors hover:text-foreground\"\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {props.tag ? (\n <span className=\"min-w-0 truncate rounded-lg border border-primary/40 bg-primary/10 px-2.5 py-1 font-mono text-[11px] text-primary\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </div>\n </header>\n );\n}\n\ninterface HeroProps {\n headline: string;\n lede?: string | null;\n eyebrow?: string | null;\n}\n\nfunction Hero({ props }: BaseComponentProps<HeroProps>) {\n return (\n <section className=\"pt-12 pb-10 sm:pt-14 sm:pb-12\">\n {props.eyebrow ? (\n <p className=\"mb-4 text-[11px] font-medium tracking-[0.15em] text-primary uppercase\">\n {props.eyebrow}\n </p>\n ) : null}\n <h1 className=\"max-w-2xl text-4xl font-bold tracking-tight text-foreground sm:text-[44px] sm:leading-[1.15]\">\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-4 max-w-2xl text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </section>\n );\n}\n\nfunction Workspace({ props, children }: BaseComponentProps<{ rail?: 'right' | 'left' | null }>) {\n const [work, rail] = React.Children.toArray(children);\n const railLeft = props.rail === 'left';\n return (\n <div\n className={cn(\n CONTAINER,\n 'grid grid-cols-1 gap-10 pb-16 lg:gap-14',\n railLeft ? 'lg:grid-cols-[360px_minmax(0,1fr)]' : 'lg:grid-cols-[minmax(0,1fr)_360px]',\n )}\n >\n <div className={cn('min-w-0', railLeft && 'lg:order-2')}>\n {work}\n <ResultPanel />\n </div>\n <aside\n className={cn(\n 'lg:sticky lg:top-6 lg:self-start lg:pt-12 sm:lg:pt-14',\n railLeft && 'lg:order-1',\n )}\n >\n {rail}\n </aside>\n </div>\n );\n}\n\n/**\n * What the host paints under the work column, in the page's own grammar and\n * in the container it gives everything else. No spec names it - no layout was\n * written for a result - so the page leaves the slot and places what it is\n * given; an input page before its first run is given nothing and shows none of\n * this.\n */\nfunction ResultPanel() {\n const slot = useResultSlot();\n if (!slot?.content) return null;\n return (\n <section className=\"border-t border-border py-9\" data-testid=\"result-panel\" aria-live=\"polite\">\n <h2 className=\"mb-6 text-xl font-semibold tracking-tight text-foreground\">\n {slot.title ?? 'Result'}\n </h2>\n {slot.content}\n </section>\n );\n}\n\ninterface SectionProps {\n number?: string | null;\n title: string;\n lede?: string | null;\n}\n\nfunction Section({ props, children }: BaseComponentProps<SectionProps>) {\n return (\n <section className=\"border-t border-border py-9 first:border-t-0 first:pt-0\">\n <div className=\"mb-6\">\n <div className=\"flex items-baseline gap-3\">\n {props.number ? (\n <span className=\"font-mono text-[12px] text-primary\">{props.number}</span>\n ) : null}\n <h2 className=\"text-xl font-semibold tracking-tight text-foreground\">{props.title}</h2>\n </div>\n {props.lede ? <p className=\"mt-1.5 text-sm text-muted-foreground\">{props.lede}</p> : null}\n </div>\n {/* The rules put a concern's inputs flat inside the Section, so the\n Section spaces them: the gap the hand-written spec's Stack gave its. */}\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n\nfunction Rail({ props, children }: BaseComponentProps<{ title: string }>) {\n return (\n // An arbitrary value reads the token directly, so it does NOT go through\n // the `@theme inline` mapping and does not inherit its fallback - it has to\n // carry its own, or a host that defines no tokens loses the declaration\n // outright. See src/styles/tailwind-entry.css.\n <div className=\"rounded-[calc(var(--radius,0.5rem)*1.5)] border border-border bg-card p-7 text-card-foreground shadow-xl\">\n <h2 className=\"text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase\">\n {props.title}\n </h2>\n <div className=\"mt-4 flex flex-col\">{children}</div>\n </div>\n );\n}\n\ninterface SummaryRowProps {\n label: string;\n value?: unknown;\n detail?: unknown;\n separator?: string | null;\n placeholder?: string | null;\n}\n\nfunction present(value: unknown): value is string | number | boolean {\n return value !== undefined && value !== null && value !== '';\n}\n\nfunction SummaryRow({ props }: BaseComponentProps<SummaryRowProps>) {\n const text = [props.value, props.detail]\n .filter(present)\n .map(String)\n .join(props.separator ?? ' ');\n return (\n <div className=\"flex items-baseline justify-between gap-4 border-b border-border/60 py-3 first:pt-0 last:border-b-0\">\n <span className=\"shrink-0 text-[13px] text-muted-foreground\">{props.label}</span>\n {text ? (\n <span className=\"text-right text-[13px] font-medium text-foreground\">{text}</span>\n ) : (\n <span className=\"text-[13px] text-muted-foreground/50\">{props.placeholder ?? '—'}</span>\n )}\n </div>\n );\n}\n\nfunction Cta({ props, emit }: BaseComponentProps<{ label: string; hint?: string | null }>) {\n return (\n <div className=\"mt-6\">\n <button\n type=\"button\"\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground',\n // The fallback is not decoration here either - see Rail above.\n 'shadow-[0_0_28px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_35%,transparent)] transition-all hover:bg-primary/90 hover:shadow-[0_0_44px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_50%,transparent)]',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden',\n )}\n >\n {props.label}\n </button>\n {props.hint ? (\n <p className=\"mt-3 text-center text-[12px] leading-relaxed text-muted-foreground\">\n {props.hint}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction Footer({ props }: BaseComponentProps<{ text: string; tag?: string | null }>) {\n return (\n <footer className=\"border-t border-border\">\n <div\n className={cn(\n CONTAINER,\n // Wraps, and the tag may break anywhere: a pipe's code is one long\n // word, and at phone width an unbreakable one widened the document\n // past the viewport.\n 'flex flex-wrap items-center justify-between gap-x-6 gap-y-2 py-6 text-[12px] text-muted-foreground',\n )}\n >\n <span>{props.text}</span>\n {props.tag ? (\n <span className=\"min-w-0 font-mono text-[11px] tracking-wider break-all text-muted-foreground/70 uppercase\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </footer>\n );\n}\n\n// ─── Text fields on the kernel's own surface ─────────────────────────────────\n\ninterface Check {\n type: string;\n message: string;\n args?: Record<string, unknown>;\n}\n\ninterface TextFieldProps {\n label: string;\n name: string;\n placeholder?: string | null;\n value?: string | null;\n checks?: Check[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction useTextField(\n props: TextFieldProps,\n bindings: BaseComponentProps<TextFieldProps>['bindings'],\n) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'blur';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useFieldValidation(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const onChange = (next: string) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n };\n const onBlur = () => {\n if (hasValidation && validateOn === 'blur') validate();\n };\n return { value, errors, onChange, onBlur };\n}\n\nfunction BrandInput({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n TextFieldProps & { type?: 'text' | 'email' | 'password' | 'number' | null }\n>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={() => {\n field.onBlur();\n emit('blur');\n }}\n onFocus={() => emit('focus')}\n onKeyDown={(event) => {\n if (event.key === 'Enter') emit('submit');\n }}\n className={cn(fieldControlClass, 'h-11 px-3.5')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BrandTextarea({\n props,\n bindings,\n}: BaseComponentProps<TextFieldProps & { rows?: number | null }>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 3}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={field.onBlur}\n className={cn(fieldControlClass, 'px-3.5 py-2.5 leading-relaxed')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/** What `defineRegistry` takes for this catalog. */\ntype RegistryOptions = Parameters<typeof defineRegistry<typeof catalog>>[1];\n\n/**\n * The registry over the product catalog: components only. `run` is supplied\n * by `GenerativePage`, which hands it to `JSONUIProvider` as a handler closing\n * over the host's `onRun`, or by a host's own provider; json-render's type\n * asks for an `actions` entry because the catalog declares one, but only the\n * `handlers` factory this destructure discards would ever read it, so the\n * entry is stated absent rather than filled with a no-op a reader would take\n * for the handler.\n *\n * Its `AppBar` reads the brand, so the page it renders in needs one:\n * `GenerativePage`'s `brand` prop, or a `BrandProvider` above the tree.\n */\nexport const { registry: generativeRegistry } = defineRegistry(catalog, {\n components: {\n ...generativeRenderers,\n Input: (ctx) => <BrandInput {...ctx} />,\n Textarea: (ctx) => <BrandTextarea {...ctx} />,\n AppBar: (ctx) => <AppBar {...ctx} />,\n Hero: (ctx) => <Hero {...ctx} />,\n Workspace: (ctx) => <Workspace {...ctx} />,\n Section: (ctx) => <Section {...ctx} />,\n Rail: (ctx) => <Rail {...ctx} />,\n SummaryRow: (ctx) => <SummaryRow {...ctx} />,\n Cta: (ctx) => <Cta {...ctx} />,\n Footer: (ctx) => <Footer {...ctx} />,\n },\n} as RegistryOptions);\n","'use client';\n\nimport * as React from 'react';\nimport type { Spec, StateModel, StateStore } from '@json-render/core';\nimport { JSONUIProvider, Renderer } from '@json-render/react';\nimport { BrandProvider } from './brand-context';\nimport type { BrandManifest } from './manifest';\nimport { generativeRegistry } from './product-registry';\nimport { DescriptorProvider, type DescriptorScope } from './registry';\n\n/** What a page renders through: this entry's registry unless a host brings its own. */\nexport type PageRegistry = React.ComponentProps<typeof Renderer>['registry'];\n\nexport interface GenerativePageProps {\n /** The layout to render; `null` while a stream has produced nothing yet. */\n spec: Spec | null;\n /** The state the layout binds to. The host owns it; the page reads and writes it. */\n store: StateStore;\n /** The descriptor the escape hatches resolve paths against. */\n scope: DescriptorScope;\n /** What `run` does. Receives the state at the moment the call to action was pressed. */\n onRun?: (state: StateModel) => void;\n /** Whether a stream is still arriving. */\n loading?: boolean;\n /** A registry over a catalog that extends this entry's, when a host has one. */\n registry?: PageRegistry;\n /**\n * The brand the product chrome renders: the app bar's logo pair and name,\n * the web font. Required by this entry's own registry, whose `AppBar` reads\n * it - without one the bar throws, json-render's element boundary drops it\n * from the page, and the console names the cure. A host registry with no\n * brand components may omit it.\n */\n brand?: BrandManifest;\n}\n\n/**\n * One generative page: providers, registry and renderer wired together.\n *\n * The store is CONTROLLED - the host creates it, seeds it (`seedInputs`) and\n * reads it back to start the run - so what the page writes is exactly what the\n * kernel's readiness is computed from, and generation is nowhere in the\n * request path: a layout is a data file, and this renders it.\n */\nexport function GenerativePage({\n spec,\n store,\n scope,\n onRun,\n loading,\n registry = generativeRegistry,\n brand,\n}: GenerativePageProps) {\n // The scope reaches every control through context, so a fresh object on each\n // render re-renders every field on the page - and a host naturally writes it\n // as a literal beside the store it just read. Memoised on its members, so an\n // inline `scope={{ inputs: fields, env }}` costs a keystroke nothing. Rebuilt\n // from the members it names rather than returning `scope` itself, so no\n // member this list leaves out can be frozen at its first value: a required\n // member added to `DescriptorScope` is a type error here, and an optional one\n // is at least legible as absent from the literal.\n const { inputs, result, env, idPrefix } = scope;\n const stableScope = React.useMemo<DescriptorScope>(\n () => ({ inputs, result, env, idPrefix }),\n [inputs, result, env, idPrefix],\n );\n // json-render's `ActionProvider` reads `handlers` ONCE, into a `useState`,\n // and never looks at the prop again - so a handler object rebuilt on a new\n // `onRun` or `store` was rebuilt for nobody, and Run kept calling the\n // callback and reading the store from the first render. A host writes\n // `onRun` as an inline closure over its own state as naturally as it writes\n // the scope literal above, and every one of those closures after the first\n // went unused. So the handler is created once and reads the latest pair\n // through a ref, which is refreshed after each commit; the handler only ever\n // fires from a click, which is after the commit that installed the values.\n const latest = React.useRef({ onRun, store });\n React.useEffect(() => {\n latest.current = { onRun, store };\n });\n const [handlers] = React.useState(() => ({\n run: () => {\n latest.current.onRun?.(latest.current.store.getSnapshot());\n },\n }));\n const page = (\n <DescriptorProvider scope={stableScope}>\n <JSONUIProvider registry={registry} store={store} handlers={handlers}>\n <Renderer spec={spec} registry={registry} loading={loading} />\n </JSONUIProvider>\n </DescriptorProvider>\n );\n return brand ? <BrandProvider manifest={brand}>{page}</BrandProvider> : page;\n}\n\n/** The store's current state, re-rendering on every change. For a receipt beside a page. */\nexport function useStoreSnapshot(store: StateStore): StateModel {\n return React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot ?? store.getSnapshot,\n );\n}\n","import { z } from 'zod';\n\n/**\n * The brand manifest, `brand.json`: what the page needs from a brand that is\n * not a token - its name, its site, the logo pair, the web font to load. The\n * schema is rendered into the contract brief as JSON Schema, so a producer\n * reads exactly what the build will check.\n */\n/**\n * Every URL in a manifest is http(s) and nothing else.\n *\n * A bare `z.url()` accepts any scheme - `javascript:`, `data:`, `file:` - and\n * the two logo URLs are handed straight to an `<img src>` in the app bar. A\n * manifest is produced content with the same provenance as a layout, so the\n * scheme is checked where the manifest is parsed rather than trusted at the\n * point it reaches the DOM.\n */\nconst httpUrl = z.url({ protocol: /^https?$/ });\n\nexport const brandManifestSchema = z.strictObject({\n name: z.string().min(1),\n website: httpUrl,\n logo: z.strictObject({\n /** The mark drawn on the light canvas: usually the dark version of the logo. */\n onLight: httpUrl,\n /** The mark drawn on the dark canvas: usually the light version of the logo. */\n onDark: httpUrl,\n }),\n webfont: z\n .strictObject({\n provider: z.literal('google-fonts'),\n family: z.string().min(1),\n })\n .nullable(),\n});\n\nexport type BrandManifest = z.infer<typeof brandManifestSchema>;\n","import type { RunField } from '../core';\nimport { hasOwnProp } from '../core/own-property';\nimport { formatDateContent, isNativeValueNode, readDateContent } from '../core/native-content';\n\n/**\n * The two state loaders - what fills the trees a spec binds to.\n *\n * It is the LOADER, not the model, that knows the wire. A result payload\n * arrives with the runtime's serialization quirks - a date inside a structure\n * in a typed envelope, a plural result under `items` - and a model laying out\n * an invoice must not have to know either. This walks the result descriptor BY\n * STATED KIND, through the kernel's own readers, and hands the spec a tree it\n * can bind to naively. Working out what a value is by looking at it stays\n * forbidden on this side of the seam too: every branch below is keyed by what\n * the descriptor says, never by the shape of the payload.\n */\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * A payload, as the result tree a spec binds to at `/result`.\n *\n * - a `date` becomes the ISO string (`2026-03-14`, or `2026-03-14 15:40:00`\n * when a time rides along), whatever envelope it arrived in;\n * - a `list` becomes an array whether the wire sent one or the plural\n * envelope `{items: [...]}`, each item loaded by the item descriptor;\n * - an `object` is loaded member by member, keeping any member the descriptor\n * does not name as it came;\n * - a `document` or `image` passes through verbatim: the pinned content model\n * is what `ResultField` reads, and its member names (`url`, `filename`) are\n * the ones a model would bind to anyway;\n * - the three native concepts the kind vocabulary cannot name (`native.Html`,\n * `native.Date`, `native.Composite`) pass through whole, for the escape\n * hatch to render - and a list of one is still a list, an array of whole\n * values, which is what the kernel renders when the brief delegates it;\n * - a scalar passes through.\n *\n * A top-level scalar's `contentKey` wrapper is NOT unwrapped: `ResultField`\n * unwraps it itself, and the brief names the wrapped path (`/result/text`), so\n * the model and the escape hatch read the same tree.\n */\nexport function payloadToState(field: RunField, payload: unknown): unknown {\n if (payload === undefined || payload === null) return payload;\n if (isNativeValueNode(field)) return payload;\n switch (field.kind) {\n case 'date': {\n const content = readDateContent(payload);\n return content ? formatDateContent(content) : payload;\n }\n case 'list': {\n const items = Array.isArray(payload)\n ? payload\n : isRecord(payload) && Array.isArray(payload.items)\n ? payload.items\n : undefined;\n if (!items) return payload;\n return items.map((item) => payloadToState(field.item, item));\n }\n case 'object': {\n if (!isRecord(payload)) return payload;\n const out: Record<string, unknown> = { ...payload };\n for (const child of field.fields) {\n if (hasOwnProp(payload, child.name)) {\n out[child.name] = payloadToState(child, payload[child.name]);\n }\n }\n return out;\n }\n case 'document':\n case 'image':\n case 'text':\n case 'prose':\n case 'number':\n case 'boolean':\n case 'enum':\n case 'unknown':\n return payload;\n default:\n return field satisfies never;\n }\n}\n","import type { Spec } from '@json-render/core';\nimport type { PagePlan } from '../generated/layout-design/types';\n\n/**\n * A spec with its provenance - the shape every fixture takes, whoever produced\n * it, so a story renders any of them without knowing which it holds.\n *\n * A spec is a payload's twin: the one artifact no projection can produce. So\n * it follows the payload's rules - produced by a pass, committed with its\n * provenance - plus what a spec needs and a payload does not: WHO produced it,\n * on WHICH model, under WHAT prompt (its hash), and, when the run was given\n * one, the creative seed and the critic loop. The stories and the comparison\n * viewer are titled from this record and from nothing else, so a page is\n * never labelled with a role (\"authored\", \"generated\") but with what actually\n * made it.\n */\n\n/** How a spec came to be. */\nexport type Producer =\n /** The designer method, `methods/layout-design.mthds`, run on the hosted API. */\n | 'pipelex-method'\n /** A Claude Code subagent in a fresh context, given the method, the catalog data and the brief and nothing else. */\n | 'claude-code-subagent'\n /** The Claude Code session working in this repo, writing the spec by hand in TypeScript. */\n | 'claude-code-session';\n\nexport interface CriticLoop {\n /** The model that judged the screenshots. */\n model: string;\n /** How many critique-and-revise rounds ran. */\n rounds: number;\n}\n\nexport interface SpecFixture {\n /** `results.nested_result`. */\n pipeRef: string;\n producer: Producer;\n /** The model id: the one the method ran with, or the Claude Code model behind the agent. */\n model: string;\n /** The creative seed handed over with the brief, verbatim, when one was. */\n seed?: string;\n /** The critic loop the producer ran, when one did. */\n critic?: CriticLoop;\n /** The first twelve hex digits of the SHA-256 of the catalog prompt at the time. */\n promptHash: string;\n /** The day it was produced, `YYYY-MM-DD`. */\n date: string;\n /** The brief it was produced from, repo-relative. */\n brief: string;\n /** The JSONL patch lines, exactly as emitted, or as `specToJsonl` renders a hand-written spec. */\n jsonl: string;\n /** The compiled spec. */\n spec: Spec;\n /**\n * The planner's plan, when the producer was the designer method: the\n * intermediate the builder was handed, read from the run's working memory.\n * It is what a person reads to see why a page has the shape it has, and it\n * is the one stage a comparison between two runs can be made at. Absent for\n * a producer that plans nowhere the harness can read.\n */\n plan?: PagePlan;\n}\n\n/**\n * The id a story and a screenshot are keyed by: producer, model and the two\n * procedures that change what a run is. `pipelex-method--gpt-5.5--seeded`.\n */\nexport function fixtureId(fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>) {\n return [\n fixture.producer,\n fixture.model,\n fixture.seed ? 'seeded' : null,\n fixture.critic ? 'critic' : null,\n ]\n .filter((part): part is string => part !== null)\n .join('--');\n}\n\nconst PRODUCER_LABEL: Record<Producer, string> = {\n 'pipelex-method': 'Pipelex method',\n 'claude-code-subagent': 'Claude Code subagent',\n 'claude-code-session': 'Claude Code session, by hand',\n};\n\n/**\n * The honest title: what made the page. `Pipelex method · gpt-5.5 · with a\n * seed`, never a role (\"authored\", \"generated\").\n */\nexport function fixtureLabel(\n fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>,\n): string {\n const parts = [PRODUCER_LABEL[fixture.producer], fixture.model];\n if (fixture.seed) parts.push('with a seed');\n if (fixture.critic) {\n parts.push(\n `${fixture.critic.model} critic × ${fixture.critic.rounds} round${fixture.critic.rounds === 1 ? '' : 's'}`,\n );\n }\n return parts.join(' · ');\n}\n\n/** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */\nexport function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string) {\n const found = fixtures.find(\n (fixture) => fixture.pipeRef === pipeRef && fixtureId(fixture) === id,\n );\n if (!found) {\n const known = fixtures\n .filter((fixture) => fixture.pipeRef === pipeRef)\n .map(fixtureId)\n .join(', ');\n throw new Error(`No spec fixture ${id} for ${pipeRef}. Known: ${known || 'none'}.`);\n }\n return found;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/generative/schema.ts","../../src/generative/shadcn-definitions.ts","../../src/generative/components.ts","../../src/generative/catalog.ts","../../src/generative/props-signature.ts","../../src/generative/designer-catalog.ts","../../src/generative/prompt-hash.ts","../../src/generative/paths.ts","../../src/generative/brief.ts","../../src/generative/validate.ts","../../src/generative/layout-fits.ts","../../src/generative/stream.ts","../../src/generative/brand-context.tsx","../../src/generative/ui/shadcn.tsx","../../src/generative/registry.tsx","../../src/generative/result-slot.tsx","../../src/generative/product-registry.tsx","../../src/generative/page.tsx","../../src/generative/state.ts","../../src/generative/fixture.ts"],"names":["z","defineCatalog","components","definitionOf","catalog","descend","present","describe","fieldAt","resolves","React","React2","jsx","Tag","Switch","jsxs","useBoundProp","useFieldValidation","Map","React4","LABEL","React5","React6"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBO,IAAM,gBAAA,GAAmB,YAAA;AAAA,EAC9B,CAAC,CAAA,MAAO;AAAA,IACN,IAAA,EAAM,EAAE,MAAA,CAAO;AAAA,MACb,IAAA,EAAM,EAAE,MAAA,EAAO;AAAA,MACf,UAAU,CAAA,CAAE,MAAA;AAAA,QACV,EAAE,MAAA,CAAO;AAAA,UACP,IAAA,EAAM,CAAA,CAAE,GAAA,CAAI,oBAAoB,CAAA;AAAA,UAChC,KAAA,EAAO,CAAA,CAAE,OAAA,CAAQ,oBAAoB,CAAA;AAAA,UACrC,QAAA,EAAU,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA;AAAA,UAC5B,KAAA,EAAO,EAAE,GAAG,CAAA,CAAE,OAAO,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,MAAA,EAAQ,CAAC,CAAA,EAAG,GAAG,CAAA,CAAE,UAAS,EAAE;AAAA,UAC3D,OAAA,EAAS,EAAE,GAAG,CAAA,CAAE,KAAI,EAAG,GAAG,CAAA,CAAE,QAAA,EAAS,EAAE;AAAA,UACvC,MAAA,EAAQ,EAAE,GAAG,CAAA,CAAE,KAAI,EAAG,GAAG,CAAA,CAAE,QAAA,EAAS;AAAE,SACvC;AAAA;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S,IAAA;AAAA,IACrB,CAAC,OAAA,KAAY,OAAA,CAAQ,YAAY,OAAA,IAAW,SAAA,CAAU,OAAO,CAAA,KAAM;AAAA,GACrE;AACA,EAAA,IAAI,CAAC,KAAA,EAAO;AACV,IAAA,MAAM,KAAA,GAAQ,QAAA,CACX,MAAA,CAAO,CAAC,OAAA,KAAY,OAAA,CAAQ,OAAA,KAAY,OAAO,CAAA,CAC/C,GAAA,CAAI,SAAS,CAAA,CACb,KAAK,IAAI,CAAA;AACZ,IAAA,MAAM,IAAI,MAAM,CAAA,gBAAA,EAAmB,EAAE,QAAQ,OAAO,CAAA,SAAA,EAAY,KAAA,IAAS,MAAM,CAAA,CAAA,CAAG,CAAA;AAAA,EACpF;AACA,EAAA,OAAO,KAAA;AACT","file":"index.js","sourcesContent":["import { defineSchema } from '@json-render/core';\n\n/**\n * Our own json-render schema: the React schema's SHAPE and built-in actions,\n * verbatim, and nothing about prompting.\n *\n * Why not `@json-render/react`'s `schema`: it carries a prompt written for a\n * model that INVENTS data - an \"INITIAL STATE\" section demanding `/state`\n * patches for every bound path, and default rules asking three times for\n * realistic sample data. This layer's posture is the opposite: every value is\n * bound to a path the HOST loads. So the schema here declares no rules and no\n * prompt template at all. The prompt is the designer method's own\n * (`methods/layout-design.mthds`), which receives the catalog as data\n * (`designerCatalog()`) and lays it out in its own prose; `catalog.prompt()`\n * on a catalog over this schema renders json-render's stock text and is not\n * what any model is handed.\n *\n * The spec shape is unchanged because the renderer, the stream compiler and the\n * validator read it, and because a spec written against it renders through any\n * json-render registry.\n */\nexport const generativeSchema = defineSchema(\n (s) => ({\n spec: s.object({\n root: s.string(),\n elements: s.record(\n s.object({\n type: s.ref('catalog.components'),\n props: s.propsOf('catalog.components'),\n children: s.array(s.string()),\n slots: { ...s.record(s.array(s.string())), ...s.optional() },\n visible: { ...s.any(), ...s.optional() },\n repeat: { ...s.any(), ...s.optional() },\n }),\n ),\n }),\n catalog: s.object({\n components: s.map({\n props: s.zod(),\n slots: s.array(s.string()),\n description: s.string(),\n example: s.any(),\n }),\n actions: s.map({\n params: s.zod(),\n description: s.string(),\n }),\n }),\n }),\n {\n // The runtime handles these four without a registry handler; the names and\n // the wording are the React schema's, so a model that has seen json-render\n // before recognises them. The validator reads them to know which actions\n // need no handler, and `designerCatalog()` lists them first, marked\n // built-in, so the method's prompt names them beside the catalog's own.\n builtInActions: [\n {\n name: 'setState',\n description:\n 'Update a value in the state model at the given statePath. Params: { statePath: string, value: any }',\n },\n {\n name: 'pushState',\n description:\n 'Append an item to an array in state. Params: { statePath: string, value: any, clearStatePath?: string }.',\n },\n {\n name: 'removeState',\n description:\n 'Remove an item from an array in state by index. Params: { statePath: string, index: number }',\n },\n {\n name: 'validateForm',\n description:\n 'Validate all registered form fields and write the result to state. Params: { statePath?: string }. Defaults to /formValidation.',\n },\n ],\n },\n);\n","import { z } from 'zod';\n\n/**\n * The component DEFINITIONS the catalog picks from shadcn/ui, vendored.\n *\n * They are json-render's shadcn catalog entries, copied verbatim from\n * `@json-render/shadcn` at `0.20.0` for the subset `components.ts` picks and\n * nothing else. Vendoring them is what keeps the package off that dependency:\n * the definitions are zod and prose, the renderers are React over radix, and a\n * consumer of this entry should install neither. The controls vendor their\n * primitives for the same reason; see `docs/dependency-budget.md`.\n *\n * These strings ARE the prompt: `designerCatalog()` hands them to the designer\n * method as data, and the prompt hash is computed over the result.\n * `docs/generative-ui.md` states the pin, and `__tests__/prompt.test.ts` fails\n * the moment a character here moves - which is also what proves this copy\n * faithful to the definitions the captured layouts were produced against.\n */\n\nconst validationCheckSchema = z\n .array(\n z.object({\n type: z.string(),\n message: z.string(),\n args: z.record(z.string(), z.unknown()).optional(),\n }),\n )\n .nullable();\n\nconst validateOnSchema = z.enum(['change', 'blur', 'submit']).nullable();\n\nexport const shadcnComponentDefinitions = {\n // ── Layout ────────────────────────────────────────────────────────────────\n Card: {\n props: z.object({\n title: z.string().nullable(),\n description: z.string().nullable(),\n maxWidth: z.enum(['sm', 'md', 'lg', 'full']).nullable(),\n centered: z.boolean().nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description:\n 'Container card for content sections. Use for forms/content boxes, NOT for page headers.',\n example: { title: 'Overview', description: 'Your account summary' },\n },\n Stack: {\n props: z.object({\n direction: z.enum(['horizontal', 'vertical']).nullable(),\n gap: z.enum(['none', 'sm', 'md', 'lg', 'xl']).nullable(),\n align: z.enum(['start', 'center', 'end', 'stretch']).nullable(),\n justify: z.enum(['start', 'center', 'end', 'between', 'around']).nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description: 'Flex container for layouts',\n example: { direction: 'vertical', gap: 'md' },\n },\n Grid: {\n props: z.object({\n columns: z.number().nullable(),\n gap: z.enum(['sm', 'md', 'lg', 'xl']).nullable(),\n className: z.string().nullable().describe('Additional CSS classes'),\n }),\n slots: ['default'],\n description: 'Grid layout (1-6 columns)',\n example: { columns: 3, gap: 'md' },\n },\n Separator: {\n props: z.object({\n orientation: z.enum(['horizontal', 'vertical']).nullable(),\n }),\n description: 'Visual separator line',\n },\n Collapsible: {\n props: z.object({\n title: z.string(),\n defaultOpen: z.boolean().nullable(),\n }),\n slots: ['default'],\n description: 'Collapsible section with trigger. Children render inside.',\n },\n // ── Content ───────────────────────────────────────────────────────────────\n Heading: {\n props: z.object({\n text: z.string(),\n level: z.enum(['h1', 'h2', 'h3', 'h4']).nullable(),\n }),\n description: 'Heading text (h1-h4)',\n example: { text: 'Welcome', level: 'h1' },\n },\n Text: {\n props: z.object({\n text: z.string(),\n variant: z.enum(['body', 'caption', 'muted', 'lead', 'code']).nullable(),\n }),\n description: 'Paragraph text',\n example: { text: 'Hello, world!' },\n },\n Avatar: {\n props: z.object({\n src: z.string().nullable(),\n name: z.string(),\n size: z.enum(['sm', 'md', 'lg']).nullable(),\n }),\n description: 'User avatar with fallback initials',\n example: { name: 'Jane Doe', size: 'md' },\n },\n Badge: {\n props: z.object({\n text: z.string(),\n variant: z.enum(['default', 'secondary', 'destructive', 'outline']).nullable(),\n }),\n description: 'Status badge',\n example: { text: 'Active', variant: 'default' },\n },\n Alert: {\n props: z.object({\n title: z.string(),\n message: z.string().nullable(),\n type: z.enum(['info', 'success', 'warning', 'error']).nullable(),\n }),\n description: 'Alert banner',\n example: {\n title: 'Note',\n message: 'Your changes have been saved.',\n type: 'success',\n },\n },\n Progress: {\n props: z.object({\n value: z.number(),\n max: z.number().nullable(),\n label: z.string().nullable(),\n }),\n description: 'Progress bar (value 0-100)',\n example: { value: 65, max: 100, label: 'Upload progress' },\n },\n // ── Inputs ────────────────────────────────────────────────────────────────\n Input: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n type: z.enum(['text', 'email', 'password', 'number']).nullable(),\n placeholder: z.string().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['submit', 'focus', 'blur'],\n description:\n 'Text input field. Use { $bindState } on value for two-way binding. Use checks for validation (e.g. required, email, minLength). validateOn controls timing (default: blur).',\n example: {\n label: 'Email',\n name: 'email',\n type: 'email',\n placeholder: 'you@example.com',\n },\n },\n Textarea: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n placeholder: z.string().nullable(),\n rows: z.number().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n description:\n 'Multi-line text input. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: blur).',\n },\n Select: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)),\n placeholder: z.string().nullable(),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Dropdown select input. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Radio: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)),\n value: z.string().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Radio button group. Use { $bindState } on value for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Checkbox: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n checked: z.boolean().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Checkbox input. Use { $bindState } on checked for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n Switch: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n checked: z.boolean().nullable(),\n checks: validationCheckSchema,\n validateOn: validateOnSchema,\n }),\n events: ['change'],\n description:\n 'Toggle switch. Use { $bindState } on checked for binding. Use checks for validation. validateOn controls timing (default: change).',\n },\n // ── Actions ───────────────────────────────────────────────────────────────\n Button: {\n props: z.object({\n label: z.string(),\n variant: z.enum(['primary', 'secondary', 'danger']).nullable(),\n disabled: z.boolean().nullable(),\n }),\n events: ['press'],\n description: 'Clickable button. Bind on.press for handler.',\n example: { label: 'Submit', variant: 'primary' },\n },\n};\n","import { defineCatalog } from '@json-render/core';\nimport { z } from 'zod';\nimport { generativeSchema } from './schema';\nimport { shadcnComponentDefinitions } from './shadcn-definitions';\n\n/**\n * The base vocabulary: what a spec may be made of, before the product page's\n * own components are added on top of it in `catalog.ts`.\n *\n * Two layers. From shadcn/ui's catalog, the subset a page needs and nothing\n * that cannot bind: not its `Tabs` (its panels do not follow the active tab),\n * not `Accordion` (its items are strings and cannot hold a subtree), not\n * `Table` (rows as inline strings), not `Slider` (a slider needs bounds, and\n * the standard states none on a number - a range a model invents narrows the\n * input). Then the layer's own: the two escape hatches, the bound equivalents\n * of what a model most wants to inline (`DataTable`, `Metric`), and the\n * vocabulary of an APP rather than a form - `Tabs` whose panels follow the\n * active tab, `Steps` for a journey, `Split` for a rail beside the work,\n * `Segmented` for a choice as pills, `NumberInput` that writes a number, and\n * `Icon` to give a section a face.\n *\n * `className` is omitted from every picked definition: an arbitrary utility a\n * model invents is one the Storybook build never compiled, and a colour it\n * invents is one that ignores the theme.\n *\n * Zod only, importable from node with no DOM: `designerCatalog()` renders\n * these definitions into the data the designer method takes, and the prompt\n * hash is computed over the result, so what is written here is part of the\n * pinned prompt. Erasable syntax only (no enums, no namespaces, no parameter\n * properties), because node strips the types itself.\n */\n\nconst shadcn = shadcnComponentDefinitions;\n\n/** The shadcn subset, by name. The order is the order the prompt lists them. */\nexport const PICKED_SHADCN = [\n 'Card',\n 'Stack',\n 'Grid',\n 'Separator',\n 'Heading',\n 'Text',\n 'Badge',\n 'Alert',\n 'Collapsible',\n 'Progress',\n 'Avatar',\n 'Input',\n 'Textarea',\n 'Select',\n 'Radio',\n 'Checkbox',\n 'Switch',\n 'Button',\n] as const;\n\nexport type PickedShadcnName = (typeof PICKED_SHADCN)[number];\n\n/** Our own, by name. */\nexport const CUSTOM_COMPONENTS = [\n 'Split',\n 'Tabs',\n 'Steps',\n 'Icon',\n 'Segmented',\n 'NumberInput',\n 'MthdsField',\n 'MthdsResult',\n 'DataTable',\n 'Metric',\n] as const;\n\nexport type CustomComponentName = (typeof CUSTOM_COMPONENTS)[number];\n\n/**\n * The value formats a `Metric` can apply. A model picks one; the registry\n * formats with `Intl.NumberFormat`.\n */\nexport const METRIC_FORMATS = ['plain', 'integer', 'decimal', 'compact'] as const;\n\n/**\n * The icons a spec may name: lucide's, a closed list so a misspelt name fails\n * validation rather than rendering nothing. Chosen for what pages about\n * methods talk about - people, places, money, time, files, standing.\n */\nexport const ICON_NAMES = [\n 'Sparkles',\n 'Rocket',\n 'Compass',\n 'Map',\n 'MapPin',\n 'Route',\n 'Plane',\n 'Train',\n 'Car',\n 'Ship',\n 'Hotel',\n 'Home',\n 'Building2',\n 'Landmark',\n 'Globe',\n 'Mountain',\n 'Leaf',\n 'Sun',\n 'Moon',\n 'Calendar',\n 'Clock',\n 'Hourglass',\n 'Users',\n 'User',\n 'Baby',\n 'Accessibility',\n 'Heart',\n 'Star',\n 'Utensils',\n 'Coffee',\n 'Music',\n 'Camera',\n 'Image',\n 'Ticket',\n 'Gift',\n 'Wallet',\n 'Banknote',\n 'Coins',\n 'Receipt',\n 'Percent',\n 'Hash',\n 'TrendingUp',\n 'BarChart3',\n 'FileText',\n 'Upload',\n 'Paperclip',\n 'Mail',\n 'Phone',\n 'Tag',\n 'Layers',\n 'ListChecks',\n 'CheckCircle2',\n 'AlertCircle',\n 'Info',\n 'Shield',\n 'Flag',\n 'Bookmark',\n 'Briefcase',\n 'Package',\n 'Truck',\n 'Lightbulb',\n 'Zap',\n 'Pencil',\n 'Send',\n] as const;\n\nexport type IconName = (typeof ICON_NAMES)[number];\n\nconst components = {\n // ── Layout (shadcn) ────────────────────────────────────────────────────\n Card: {\n ...shadcn.Card,\n props: shadcn.Card.props.omit({ className: true, maxWidth: true, centered: true }),\n description:\n 'Container card for content sections. Use for forms/content boxes, NOT for page headers. Its optional \"title\" renders as an h3, so a titled Card sits under an h2.',\n },\n Stack: { ...shadcn.Stack, props: shadcn.Stack.props.omit({ className: true }) },\n Grid: { ...shadcn.Grid, props: shadcn.Grid.props.omit({ className: true }) },\n Separator: shadcn.Separator,\n Collapsible: shadcn.Collapsible,\n // ── Content (shadcn) ───────────────────────────────────────────────────\n Heading: shadcn.Heading,\n Text: shadcn.Text,\n Badge: shadcn.Badge,\n Alert: shadcn.Alert,\n Progress: shadcn.Progress,\n Avatar: {\n ...shadcn.Avatar,\n description:\n 'A round avatar showing the initials of \"name\" - bind it to a person\\'s name in the state ({ \"$state\" } or { \"$item\" }); never set \"src\".',\n },\n // ── Inputs (shadcn) ────────────────────────────────────────────────────\n Input: shadcn.Input,\n Textarea: shadcn.Textarea,\n Select: shadcn.Select,\n Radio: shadcn.Radio,\n Checkbox: shadcn.Checkbox,\n Switch: shadcn.Switch,\n Button: shadcn.Button,\n // ── Layout (ours) ──────────────────────────────────────────────────────\n Split: {\n props: z.object({\n ratio: z.enum(['1:1', '1:2', '2:1']).nullable(),\n gap: z.enum(['md', 'lg', 'xl']).nullable(),\n }),\n slots: ['default'],\n description:\n 'Two columns side by side, from exactly two children: the first is the left column. \"1:2\" puts a narrow rail (a summary, the essentials, the run) beside the work; \"2:1\" the reverse; \"1:1\" two halves. Columns stack on a narrow screen.',\n example: { ratio: '1:2', gap: 'lg' },\n },\n Tabs: {\n props: z.object({\n tabs: z.array(z.object({ label: z.string(), value: z.string() })).min(2),\n }),\n slots: ['default'],\n description:\n \"Concerns of equal weight, one visible at a time. Exactly one child per tab, in the same order - each child is that tab's panel (usually a Stack). The first tab opens. The active tab is the component's own state, never /state.\",\n example: {\n tabs: [\n { label: 'The trip', value: 'trip' },\n { label: 'Who is going', value: 'people' },\n ],\n },\n },\n Steps: {\n props: z.object({\n steps: z.array(z.string()).min(2),\n nextLabel: z.string().nullable(),\n backLabel: z.string().nullable(),\n }),\n slots: ['default'],\n description:\n \"A journey with a natural order: a numbered indicator, one panel at a time, and its own Back and Next. Exactly one child per step, in order - each child is that step's panel. Put the Button that runs inside the LAST panel; Next disappears there. The current step is the component's own state, never /state.\",\n example: { steps: ['Where', 'Who', 'How'], nextLabel: 'Continue' },\n },\n Icon: {\n props: z.object({\n name: z.enum(ICON_NAMES),\n size: z.enum(['sm', 'md', 'lg']).nullable(),\n }),\n slots: [],\n description:\n 'A decorative icon, one of the listed lucide names, to give a section or a figure a face: put it in a horizontal Stack beside a Heading or a Metric. It carries no meaning on its own and no text.',\n example: { name: 'Plane', size: 'md' },\n },\n // ── Inputs (ours) ──────────────────────────────────────────────────────\n Segmented: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n options: z.array(z.string().min(1)).min(2).max(6),\n value: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A choice of two to six options as a row of pills, one selected - the app\\'s answer to a short Select. \"options\" are EXACTLY the brief\\'s choices, spelled exactly; bind \"value\" with { \"$bindState\": \"/inputs/...\" }.',\n example: {\n label: 'Pace',\n name: 'pace',\n options: ['slow', 'balanced', 'packed'],\n value: { $bindState: '/inputs/request/pace' },\n },\n },\n NumberInput: {\n props: z.object({\n label: z.string(),\n name: z.string(),\n value: z.number().nullable(),\n placeholder: z.string().nullable(),\n unit: z.string().nullable(),\n min: z.number().nullable(),\n max: z.number().nullable(),\n step: z.number().nullable(),\n }),\n slots: [],\n description:\n 'A figure the person types: writes a NUMBER to the bound path, which Input type \"number\" does not (it writes text). Bind \"value\" with { \"$bindState\": \"/inputs/...\" }. \"unit\" is a short suffix ONLY when the brief states one; \"min\", \"max\" and \"step\" only when the brief states them.',\n example: {\n label: 'Budget',\n name: 'budget',\n value: { $bindState: '/inputs/request/budget' },\n placeholder: '2500',\n },\n },\n // ── The escape hatches and the bound equivalents (ours) ────────────────\n MthdsField: {\n props: z.object({\n path: z.string(),\n }),\n slots: [],\n description:\n 'The kernel\\'s own control for ONE input, bound two-way at \"path\" (a /inputs path from the brief). Use it for every path the brief marks as delegated - a file, a date, a list, a structure you would rather not lay out - and for any scalar you would rather not style. It renders its own label and description. Inside a repeat, \"path\" is the item\\'s field name relative to the item (\"lines\"), never an $item expression.',\n example: { path: '/inputs/source' },\n },\n MthdsResult: {\n props: z.object({\n path: z.string(),\n hideLabel: z.boolean().nullable(),\n }),\n slots: [],\n description:\n 'The kernel\\'s own read-only rendering of ONE result subtree at \"path\" (a /result path from the brief). Use it for every path the brief marks as delegated - a file, a date, a document, prose, markup - and for any structure you choose not to lay out. It renders its own label unless hideLabel is true. Inside a repeat, \"path\" is the item\\'s field name relative to the item (\"teams\"), never an $item expression - the way to delegate one subtree of every item.',\n example: { path: '/result/issued_on' },\n },\n DataTable: {\n props: z.object({\n rows: z.any(),\n columns: z.array(z.object({ path: z.string(), label: z.string() })),\n caption: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A table over a list of structures. \"rows\" MUST be { \"$state\": \"/path/to/the/list\" } (never inline rows); each column names a field of one item by its relative path (\"label\", \"unit_price\") and the header to show for it.',\n example: {\n rows: { $state: '/result/lines' },\n columns: [\n { path: 'label', label: 'Item' },\n { path: 'quantity', label: 'Qty' },\n ],\n },\n },\n Metric: {\n props: z.object({\n label: z.string(),\n value: z.any(),\n unit: z.string().nullable(),\n format: z.enum(METRIC_FORMATS).nullable(),\n }),\n slots: [],\n description:\n 'A labelled figure - the one number a reader looks for first. \"value\" is bound with { \"$state\": \"/path\" } (never inline); \"unit\" is a short suffix and ONLY one the brief states (a currency the structure carries, \"%\" for a rate, \"M\" when the brief says \"in millions\") - never invent a currency the state does not carry; \"format\" is plain, integer, decimal (two places) or compact.',\n example: { label: 'Total', value: { $state: '/result/total' }, unit: 'EUR', format: 'decimal' },\n },\n};\n\nconst actions = {\n run: {\n params: z.object({}),\n description:\n 'Start the run with the current /inputs. The host handles it; an input page binds it to its one Button after validateForm.',\n },\n};\n\n/**\n * The base catalog, for the renderers in `registry.tsx` to be typed against.\n * It renders no prompt: the catalog a model is handed is `catalog.ts`'s, which\n * extends this vocabulary with the product page's own.\n */\nexport const baseCatalog = defineCatalog(generativeSchema, { components, actions });\n\n/**\n * The two maps, for the catalog that EXTENDS this vocabulary. Exporting them\n * changes nothing about the prompt or its hash.\n */\nexport const generativeComponents = components;\nexport const generativeActions = actions;\n","import { defineCatalog } from '@json-render/core';\nimport { z } from 'zod';\nimport {\n CUSTOM_COMPONENTS,\n PICKED_SHADCN,\n generativeActions,\n generativeComponents,\n} from './components';\nimport { generativeSchema } from './schema';\nimport type { ComponentRendering } from './validate';\n\n/**\n * The catalog: everything the base vocabulary has, plus the chrome of a\n * product page - a bar with the logo, a hero, a workspace that puts a panel\n * beside the work, a section, a raised rail, the summary rows a rail can be\n * made of, a call to action, a footer line. They are vocabulary, not a\n * template: the designer method prescribes no composition, and a layout uses\n * whichever of them serve it. Each description says what the component IS and\n * how it renders - a heading level, a landmark, a fixed child count - and never\n * where it must go or whether a page must have it, because the descriptions\n * travel to the model as data and would otherwise be the mandate the method\n * gave up. The vocabulary names no brand: the logo is whichever the manifest\n * carries and the accent is whichever the host's theme tokens set.\n *\n * Rule 1 holds here as it does everywhere in this entry: a component takes\n * copy and bound values, never a schema, and the fields the kernel owns are\n * still `MthdsField` elements naming a path.\n */\n\nexport const PRODUCT_COMPONENTS = [\n 'AppBar',\n 'Hero',\n 'Workspace',\n 'Section',\n 'Rail',\n 'SummaryRow',\n 'Cta',\n 'Footer',\n] as const;\n\nexport type ProductComponentName = (typeof PRODUCT_COMPONENTS)[number];\n\nconst product = {\n AppBar: {\n props: z.object({\n app: z.string(),\n links: z.array(z.string()).nullable(),\n tag: z.string().nullable(),\n }),\n slots: [],\n description:\n \"A bar across the top of the page: the brand's logo, the name of this app beside it, a few muted links, and a small mono tag at the right (the method behind the page). It renders as the page's banner, so at most one.\",\n example: { app: 'Trip planner', links: ['Methods', 'Runs'], tag: 'plan_trip' },\n },\n Hero: {\n props: z.object({\n headline: z.string(),\n lede: z.string().nullable(),\n eyebrow: z.string().nullable(),\n }),\n slots: [],\n description:\n 'An opening: one bold headline that says what happens here, one muted line under it at most, and an optional small eyebrow in the accent colour above. The headline renders as an h1, so at most one on a page.',\n example: { headline: 'Plan a trip worth taking.', lede: 'Tell us where and who is coming.' },\n },\n Workspace: {\n props: z.object({ rail: z.enum(['right', 'left']).nullable() }),\n slots: ['default'],\n description:\n 'Two children side by side on a wide screen and stacked on a narrow one: the work, and beside it a narrower panel that stays sticky while the work scrolls. Exactly two children; \"rail\" says which side the panel takes, right by default.',\n example: { rail: 'right' },\n },\n Section: {\n props: z.object({\n number: z.string().nullable(),\n title: z.string(),\n lede: z.string().nullable(),\n }),\n slots: ['default'],\n description:\n 'A titled stage of the work: an optional small mono number in the accent colour, an h2 title, an optional muted line, then its children - flat, spaced, separated from the next Section by a hairline, never boxed.',\n example: { number: '01', title: 'Where and when' },\n },\n Rail: {\n props: z.object({ title: z.string() }),\n slots: ['default'],\n description:\n 'A raised, boxed panel: a small uppercase h2 title, then its children in a column. Made to stand beside the work as the panel of a Workspace, and the one boxed surface in this vocabulary.',\n example: { title: 'Your trip' },\n },\n SummaryRow: {\n props: z.object({\n label: z.string(),\n value: z.any().nullable(),\n detail: z.any().nullable(),\n separator: z.string().nullable(),\n placeholder: z.string().nullable(),\n }),\n slots: [],\n description:\n 'A line that restates a value: a muted label at the left, a bound value at the right. \"value\" and the optional \"detail\" are read with { \"$state\": \"/inputs/...\" } and joined by \"separator\" (a space by default); each is a scalar path - text, number, boolean, date or choice - never a structure, a list or a file. While both are empty the row shows \"placeholder\", or a dash.',\n example: {\n label: 'Budget',\n value: { $state: '/inputs/request/budget' },\n detail: { $state: '/inputs/request/currency' },\n },\n },\n Cta: {\n props: z.object({ label: z.string(), hint: z.string().nullable() }),\n slots: [],\n events: ['press'],\n description:\n 'A call to action: a full-width button in the accent colour that runs the method, with an optional one-line hint under it. Bind on.press to validateForm then run.',\n example: { label: 'Plan my trip', hint: 'Nothing runs until the request is complete.' },\n },\n Footer: {\n props: z.object({ text: z.string(), tag: z.string().nullable() }),\n slots: [],\n description:\n \"A closing line, muted, with an optional mono tag at the right. It renders as the page's contentinfo, so at most one.\",\n example: { text: 'Runs on Pipelex.', tag: 'MTHDS' },\n },\n};\n\n/**\n * What this entry's components render beyond their schemas - the heading a\n * title is, the landmark a bar or a footer renders as, the two children a\n * split lays out, the panel per tab or step - declared once here, where the\n * descriptions above say the same in prose for the model, and carried on the\n * catalog so the validator reads it off whichever catalog it is handed. A\n * host validating against a vocabulary of its own declares what its\n * renderers do, or nothing.\n */\nexport const COMPONENT_RENDERINGS: Readonly<Record<string, ComponentRendering>> = {\n Hero: { heading: { level: 1 } },\n Section: { heading: { level: 2 } },\n Rail: { heading: { level: 2 } },\n Card: { heading: { level: 3, when: 'title' } },\n AppBar: { once: \"the page's banner\" },\n Footer: { once: \"the page's contentinfo\" },\n Split: { children: { count: 2, roles: 'left, right' } },\n Workspace: { children: { count: 2, roles: 'work, rail' } },\n Tabs: { panels: { prop: 'tabs', noun: 'tab' } },\n Steps: { panels: { prop: 'steps', noun: 'step' } },\n};\n\nexport const catalog = Object.assign(\n defineCatalog(generativeSchema, {\n components: { ...generativeComponents, ...product },\n actions: generativeActions,\n }),\n { renders: COMPONENT_RENDERINGS },\n);\n\n/** The spec type a layout is written against. */\nexport type GenerativeSpec = typeof catalog._specType;\n\n/**\n * Every component name the catalog knows, the shadcn subset first. This is\n * the order the designer method lists them in, since `designerCatalog()`\n * walks it; the rules and the direction that name them are the method's own\n * prose, in `methods/layout-design.mthds`.\n */\nexport const COMPONENT_NAMES: readonly string[] = [\n ...PICKED_SHADCN,\n ...CUSTOM_COMPONENTS,\n ...PRODUCT_COMPONENTS,\n];\n","import type { z } from 'zod';\n\n/**\n * A component's props, as the one-line signature the designer method lists it\n * under: `{ text: string, tag?: string }` for a `Footer`, whose `tag` is\n * declared `.nullable()`, or `{ label: string, value: unknown, unit?: string,\n * format?: \"plain\" | \"integer\" | \"decimal\" | \"compact\" }` for a `Metric`.\n *\n * It renders the SAME text json-render's own prompt renders for a zod schema,\n * case for case - a prop wrapped in `nullable` or `optional` gets a `?` and\n * never a `| null`, an enum lists its values, `z.any()` prints as `unknown` -\n * so a model that has\n * seen json-render's prompt reads a familiar shape. json-render does not export\n * its formatter (it hands it to a prompt template as a context member), and\n * the catalog travels to the method as data rather than as a rendered prompt,\n * so the formatter lives here; `__tests__/prompt.test.ts` holds it to the\n * package's own output over every component in the catalog.\n *\n * Reads zod v4's `_zod.def`, the definition every schema class carries: `type`\n * names the kind, and the members read below are the ones that kind holds.\n */\n\ninterface ZodDefinition {\n type: string;\n innerType?: z.ZodType;\n element?: z.ZodType;\n shape?: Record<string, z.ZodType>;\n entries?: Record<string, unknown>;\n values?: readonly unknown[];\n options?: readonly z.ZodType[];\n keyType?: z.ZodType;\n valueType?: z.ZodType;\n}\n\nfunction definitionOf(schema: z.ZodType): ZodDefinition {\n return (schema as unknown as { _zod: { def: ZodDefinition } })._zod.def;\n}\n\nexport function propsSignature(schema: z.ZodType): string {\n const def = definitionOf(schema);\n switch (def.type) {\n case 'string':\n return 'string';\n case 'number':\n return 'number';\n case 'boolean':\n return 'boolean';\n case 'literal':\n return JSON.stringify(def.values?.[0]);\n case 'enum':\n return Object.values(def.entries ?? {})\n .map((value) => `\"${String(value)}\"`)\n .join(' | ');\n case 'array':\n return `Array<${def.element ? propsSignature(def.element) : 'unknown'}>`;\n case 'object': {\n const props = Object.entries(def.shape ?? {}).map(([key, value]) => {\n const inner = definitionOf(value).type;\n const optional = inner === 'optional' || inner === 'nullable';\n return `${key}${optional ? '?' : ''}: ${propsSignature(value)}`;\n });\n return `{ ${props.join(', ')} }`;\n }\n case 'optional':\n case 'nullable':\n case 'default':\n return def.innerType ? propsSignature(def.innerType) : 'unknown';\n case 'union':\n return def.options\n ? def.options.map((option) => propsSignature(option)).join(' | ')\n : 'unknown';\n case 'record': {\n const key = def.keyType ? propsSignature(def.keyType) : 'string';\n const value = def.valueType ? propsSignature(def.valueType) : 'unknown';\n return `Record<${key}, ${value}>`;\n }\n default:\n return 'unknown';\n }\n}\n","import type { z } from 'zod';\nimport type { Action, Catalog, Component } from '../generated/layout-design/types';\nimport { COMPONENT_NAMES, catalog } from './catalog';\nimport { propsSignature } from './props-signature';\nimport { generativeSchema } from './schema';\n\n/**\n * The catalog as the designer method's `catalog` input: the vocabulary as\n * DATA, which the method's own prompt lays out.\n *\n * The prompt a model reads is the method - `methods/layout-design.mthds`\n * carries every paragraph of it as prose and loops over these two lists for\n * the component and action sections. What this package contributes is what\n * only code can state: each component's props signature, rendered from its\n * zod schema, beside the description and the slots its definition declares.\n * One function so the fixture pass, the briefs and the tests hand over one\n * value, and the hash stamped on a captured layout covers what was actually\n * sent.\n *\n * The shapes are the method's own: codegen projects the `Catalog`,\n * `Component` and `Action` structures the bundle declares into\n * `src/generated/layout-design/`, and the aliases below are those types. So a\n * field renamed in the bundle fails the type check on the literals here\n * rather than a run, and the value goes over as the content of a structured\n * input, verbatim. The import is type-only: the generated zod schemas stay\n * out of the entry, which ships no validator for this value.\n */\n\n/** The `Catalog` structure of `methods/layout-design.mthds`, as codegen projects it. */\nexport type DesignerCatalog = Catalog;\n/** One component of the catalog: its name, its props signature, what it is for, what it accepts. */\nexport type DesignerComponent = Component;\n/** One action a page may bind to an event. */\nexport type DesignerAction = Action;\n\n/** The concept a run request names for the `catalog` input: the method's own, domain-qualified. */\nexport const DESIGNER_CATALOG_CONCEPT = 'generative.Catalog';\n\ninterface ComponentDefinition {\n props: z.ZodType;\n slots?: readonly string[];\n events?: readonly string[];\n description?: string;\n}\n\nexport function designerCatalog(): DesignerCatalog {\n const definitions = catalog.data.components as Record<string, ComponentDefinition>;\n const components = COMPONENT_NAMES.map((name): DesignerComponent => {\n const definition = definitions[name];\n if (!definition) throw new Error(`the catalog defines no component named '${name}'`);\n const slots = definition.slots ?? [];\n return {\n name,\n props: propsSignature(definition.props),\n description: definition.description,\n accepts_children: slots.includes('default'),\n slots: slots.filter((slot) => slot !== 'default'),\n events: [...(definition.events ?? [])],\n };\n });\n\n const builtIn = (generativeSchema.builtInActions ?? []).map((action): DesignerAction => ({\n name: action.name,\n description: action.description,\n built_in: true,\n }));\n const own = Object.entries(catalog.data.actions as Record<string, { description: string }>).map(\n ([name, action]): DesignerAction => ({\n name,\n description: action.description,\n built_in: false,\n }),\n );\n\n return { components, actions: [...builtIn, ...own] };\n}\n","import type { DesignerCatalog } from './designer-catalog';\n\n/**\n * The hash that pairs a captured layout with the prompt it was produced\n * against: the first twelve hex digits of the SHA-256 of `promptHashSubject`,\n * which is the designer method's text and the catalog it was handed.\n *\n * The prompt is no longer one string this package renders: it is the method\n * (`methods/layout-design.mthds`, every paragraph as prose) applied to\n * the catalog as data (`designerCatalog()`). Both are what a run was actually\n * given, so both are hashed - a reworded rule and a renamed prop each move\n * the pin, exactly as they did when the prompt was rendered here. The model\n * pin in the method file moves it too, since the file is hashed whole; a\n * fixture records its model on its own, so that costs a regeneration, never a\n * misread.\n *\n * It is a PIN rather than a computation, so that this entry stays importable\n * from a browser (hashing would mean `node:crypto` or an async Web Crypto\n * call, and a host compares this value synchronously while deciding whether a\n * stored layout still stands - and the entry must not read the method file).\n * `__tests__/prompt.test.ts` recomputes it from the file and the catalog and\n * fails on any drift, so the pin cannot go stale quietly: a catalog, rule or\n * direction change is a failing test, which is exactly what it was for.\n *\n * A stored layout whose hash is not this one is not rendered - the host falls\n * back to the kernel's own form - because the vocabulary it was written in is\n * no longer the vocabulary this entry renders.\n */\nexport const PROMPT_HASH = '2b2325fd1231';\n\n/**\n * What the hash is computed over: the method's text as shipped, then the\n * catalog as the run request carries it. The one recipe the test and the\n * fixture pass share, so the pin they check and the stamp they write agree.\n */\nexport function promptHashSubject(method: string, catalog: DesignerCatalog): string {\n return `${method}\\n${JSON.stringify(catalog)}`;\n}\n","import type { Spec } from '@json-render/core';\nimport type { RunField } from '../core';\n\n/**\n * The two state trees, and how a path into either maps back onto the\n * descriptor.\n *\n * An input page binds at `/inputs/<name>`, recursing into structures as the\n * descriptor does; a result page binds at `/result/<path>`. Both are JSON\n * Pointers (RFC 6901), because that is what json-render's state store reads.\n * Nothing here knows a value - a path is resolved against the DESCRIPTOR, which\n * is how the two escape hatches find the `RunField` to hand the kernel.\n */\n\nexport const INPUTS_ROOT = '/inputs';\nexport const RESULT_ROOT = '/result';\n\n/** `/inputs` + `invoice` + `billed_to` → `/inputs/invoice/billed_to`. */\nexport function joinPath(root: string, ...segments: readonly string[]): string {\n return segments.reduce<string>((path, segment) => `${path}/${escapeSegment(segment)}`, root);\n}\n\n/**\n * RFC 6901: `~` is `~0`, `/` is `~1`. Field names are identifiers, so this\n * rarely fires. Exported for the stream module, which writes an element key\n * into a patch path: the escaping is spelled once, because the second spelling\n * was a copy and a copy drifts.\n */\nexport function escapeSegment(segment: string): string {\n return segment.replace(/~/g, '~0').replace(/\\//g, '~1');\n}\n\n/**\n * The inverse, in the order the RFC requires - `~1` first, then `~0`, so `~01`\n * reads back as `~1` and not as `/`. The stream's prototype guard unescapes a\n * patch path through this same function before it compares segments, so the\n * order that guard relies on is decided here and nowhere else.\n */\nexport function unescapeSegment(segment: string): string {\n return segment.replace(/~1/g, '/').replace(/~0/g, '~');\n}\n\n/** The segments of a pointer, root excluded: `/inputs/a/b` under `/inputs` → `['a', 'b']`. */\nexport function segmentsUnder(root: string, path: string): string[] | undefined {\n if (path === root) return [];\n if (!path.startsWith(`${root}/`)) return undefined;\n return path\n .slice(root.length + 1)\n .split('/')\n .map(unescapeSegment);\n}\n\n/**\n * The descriptor node a path names, or `undefined` when the path leaves the\n * tree. An object's children are found by name; a list's are found by index,\n * and every index resolves to the same item descriptor.\n */\nexport function fieldAtSegments(\n fields: readonly RunField[],\n segments: readonly string[],\n): RunField | undefined {\n const [head, ...rest] = segments;\n if (head === undefined) return undefined;\n const field = fields.find((candidate) => candidate.name === head);\n if (!field) return undefined;\n return rest.length === 0 ? field : descend(field, rest);\n}\n\nfunction descend(field: RunField, segments: readonly string[]): RunField | undefined {\n const [head, ...rest] = segments;\n if (head === undefined) return field;\n if (field.kind === 'object') return fieldAtSegments(field.fields, segments);\n if (field.kind === 'list' && /^\\d+$/.test(head)) return descend(field.item, rest);\n return undefined;\n}\n\n/** `/inputs/<...>` resolved against a form's top-level fields. */\nexport function inputFieldAtPath(fields: readonly RunField[], path: string): RunField | undefined {\n const segments = segmentsUnder(INPUTS_ROOT, path);\n return segments && segments.length > 0 ? fieldAtSegments(fields, segments) : undefined;\n}\n\n/** `/result/<...>` resolved against a result descriptor; `/result` itself is the root. */\nexport function resultFieldAtPath(field: RunField, path: string): RunField | undefined {\n const segments = segmentsUnder(RESULT_ROOT, path);\n if (!segments) return undefined;\n return segments.length === 0 ? field : descend(field, segments);\n}\n\n/**\n * The child-to-parent map of a spec's element tree.\n *\n * Built once and passed down rather than rebuilt per lookup: `layoutProblems`\n * resolves one relative hatch path per element that carries one, and each\n * resolution walks the chain of parents above it. Rebuilding the map inside\n * that walk made the whole pass quadratic in element count.\n */\nexport function parentMapOf(spec: Spec): Map<string, string> {\n const parents = new Map<string, string>();\n for (const [parentKey, element] of Object.entries(spec.elements)) {\n for (const child of element.children ?? []) parents.set(child, parentKey);\n }\n return parents;\n}\n\n/**\n * The base path a relative hatch path resolves against, statically: the chain\n * of `repeat`s from the root down to `key`, each contributing its list path\n * and a first index. `undefined` outside any repeat. Mirrors what\n * `useRepeatScope` gives the hatch at render time, for a test that never\n * renders.\n *\n * The walk up the parent chain STOPS on a key it has already seen. A layout is\n * model-produced, and an element that is its own ancestor - `children: [\"self\"]`\n * at its simplest - is a shape json-render's `validateSpec` accepts without a\n * word, so without the guard this loop never terminates. Since a host calls\n * this through `layoutFits` precisely to decide whether an untrusted layout is\n * safe to render, the gate hanging is worse than the layout it was asked about.\n */\nexport function repeatBasePathOf(\n spec: Spec,\n key: string,\n parents: Map<string, string> = parentMapOf(spec),\n): string | undefined {\n const chain: string[] = [];\n const seen = new Set<string>();\n let current: string | undefined = key;\n while (current !== undefined && !seen.has(current)) {\n seen.add(current);\n chain.unshift(current);\n current = parents.get(current);\n }\n let base: string | undefined;\n for (const elementKey of chain) {\n const repeat = spec.elements[elementKey]?.repeat;\n if (!repeat) continue;\n const statePath = repeat.statePath;\n if (typeof statePath === 'string') {\n base = `${statePath}/0`;\n continue;\n }\n // A relative `repeat` names the item's field, and only a string is one. A\n // layout is model-produced, so `statePath` can be null or an object here -\n // and reading `.$item` off either produced a throw or a path with\n // \"[object Object]\" in it, reported later as an ordinary staleness problem\n // that named the wrong cause.\n const item = (statePath as { $item?: unknown } | null)?.$item;\n if (base === undefined || typeof item !== 'string') return undefined;\n base = `${joinPath(base, item)}/0`;\n }\n return base;\n}\n\n/** A hatch's path as the layer resolves it: absolute as written, or relative to the repeat it sits in. */\nexport function absoluteHatchPath(\n spec: Spec,\n key: string,\n path: string,\n parents?: Map<string, string>,\n): string | undefined {\n if (path.startsWith('/')) return path;\n const base = repeatBasePathOf(spec, key, parents);\n // Raw, not `joinPath`: a relative hatch path is written by the producer and\n // may name several segments (`billed_to/city`), so its `/` are separators\n // already and escaping them would name one segment that does not exist.\n return base ? `${base}/${path}` : undefined;\n}\n\n/**\n * The list a `repeat` lays out, as an absolute path: its `statePath` when that\n * is written absolute, or, for a relative `{ $item }` one, the item's field\n * under the repeat above it - the same chain `repeatBasePathOf` walks, stopped\n * one level short. `undefined` when there is nothing to be relative to, or\n * when `statePath` is neither form. It is the path a repeat READS, which is\n * how the fit gate asks whether the descriptor still has the list.\n */\nexport function repeatListPathOf(\n spec: Spec,\n key: string,\n parents: Map<string, string> = parentMapOf(spec),\n): string | undefined {\n const statePath = spec.elements[key]?.repeat?.statePath;\n if (typeof statePath === 'string') return statePath;\n const item = (statePath as { $item?: unknown } | null | undefined)?.$item;\n const parent = parents.get(key);\n const outer = parent === undefined ? undefined : repeatBasePathOf(spec, parent, parents);\n return outer !== undefined && typeof item === 'string' ? joinPath(outer, item) : undefined;\n}\n","import type { RunField } from '../core';\nimport {\n isNativeCompositeNode,\n isNativeDateNode,\n isNativeHtmlNode,\n isNativeValueNode,\n} from '../core/native-content';\nimport type { Brief, PathEntry } from '../generated/layout-design/types';\nimport { INPUTS_ROOT, RESULT_ROOT, joinPath } from './paths';\n\n/**\n * The brief: the model's view of the descriptor, as DATA.\n *\n * Rule 1, restated for a model. The model's input is the DESCRIPTOR, never JSON\n * Schema: it receives the kinds, the labels, the descriptions, the choices, the\n * presence and what gates the run - projected from `RunField[]` here, and from\n * nowhere else, into the `Brief` structure the designer method declares. On the\n * result side it also receives one real run's loaded state, so it can judge\n * magnitudes, but it never sees the wire: the state it reads is what\n * `payloadToState` produced, with the envelopes already gone.\n *\n * Nothing here is prose. The sentences a model reads - the headings, how a\n * path line is worded, what \"delegated\" says - are the method's own, in the\n * `render_brief` stage of `methods/layout-design.mthds`: a Jinja2 template\n * over this value, and the one place the brief's wording is edited. What this\n * module contributes is what only code can state: every path, flattened in\n * reading order with its depth, its kind in words, its constraints in words,\n * and which of them the kernel keeps. The shape is the method's own: codegen\n * projects its `Brief` and `PathEntry` structures into\n * `src/generated/layout-design/`, and the aliases below are those types,\n * imported type-only so the generated schemas stay out of the entry. A field\n * renamed in the bundle fails the type check on the literals here rather than\n * a run.\n *\n * Pure, no React, and the only place the descriptor is projected for a model.\n * What a path is marked as (delegated or not) is decided here too, so the\n * projection, the brief and the validator agree on which paths the kernel\n * renders.\n */\n\n/** The `Brief` structure of `methods/layout-design.mthds`, as codegen projects it. */\nexport type DesignerBrief = Brief;\n/** One path of the brief: where it is, what it holds, what constrains it, whether the kernel keeps it. */\nexport type DesignerPathEntry = PathEntry;\n\n/** The concept a run request names for the `brief` input: the method's own, domain-qualified. */\nexport const DESIGNER_BRIEF_CONCEPT = 'generative.Brief';\n\n/**\n * The component that runs the page, handed over as the brief's `run_control`\n * so the brief and the catalog agree on which one it is - and so the method's\n * own prose can go on naming none of the catalog's chrome. A rename in the\n * catalog does not have to be caught here: a brief asking for a component the\n * catalog no longer has produces a layout the validator refuses, loudly, on\n * the pass that made it.\n */\nconst RUN_COMPONENT = 'Cta';\n\nexport interface BriefSubject {\n /** `results.nested_result`. */\n pipeRef: string;\n /** The pipe's description, when the wire carries one. */\n description?: string;\n /**\n * The method's name as a host lists it - an authored method's, since a host\n * has one for every method it lists; absent on a synthesized carrier, which\n * no host lists. The brief hands it to the layout as the one product name\n * the page may carry, because the brand catalog's AppBar asks for a name\n * and a brief that gives none gets one invented.\n */\n name?: string;\n}\n\n/**\n * On the input side, the kinds the catalog's inputs cannot enter - and one\n * shape of a kind they otherwise can. The standard puts no floor on a choice,\n * so an enum may carry `\"\"`; the catalog's own choices may not, because no\n * dropdown row or pill can offer nothing, and the validator refuses an empty\n * option. A model told to list the brief's choices exactly would copy the\n * empty one into a layout the validator then refuses, so the brief hands the\n * input back to the kernel's own control instead.\n */\nexport function isDelegatedInput(field: RunField): boolean {\n return (\n field.kind === 'document' ||\n field.kind === 'image' ||\n field.kind === 'date' ||\n field.kind === 'list' ||\n field.kind === 'unknown' ||\n (field.kind === 'enum' && field.options.includes(''))\n );\n}\n\n/**\n * On the result side, the kinds and concepts the catalog cannot show.\n *\n * A native value is one of them, and so is a list of one: the native\n * predicates refuse a `list` node, because a list of dates is a list and not a\n * date, but no catalog component reads a date's `{date, time}` either, so the\n * kernel renders the list whole - one value per line, as the result view does.\n */\nexport function isDelegatedResult(field: RunField): boolean {\n if (isNativeValueNode(field)) return true;\n if (field.kind === 'list' && isNativeValueNode(field.item)) return true;\n return (\n field.kind === 'document' ||\n field.kind === 'image' ||\n field.kind === 'date' ||\n field.kind === 'prose' ||\n field.kind === 'unknown'\n );\n}\n\n/** What a path holds, in words - the one rendering of a kind the brief carries. */\nfunction kindLabel(field: RunField): string {\n if (isNativeHtmlNode(field)) return 'markup (native.Html)';\n if (isNativeDateNode(field)) return 'date (native.Date)';\n if (isNativeCompositeNode(field)) return 'composite (native.Composite)';\n switch (field.kind) {\n case 'text':\n return 'text';\n case 'prose':\n return 'prose (markdown)';\n case 'number':\n return field.integer ? 'integer' : 'number';\n case 'boolean':\n return 'boolean';\n case 'enum':\n return `choice of ${field.options.map((option) => JSON.stringify(option)).join(' | ')}`;\n case 'date':\n return field.datetime ? 'date with time' : 'date';\n case 'document':\n return 'document (a file)';\n case 'image':\n return 'image (a file)';\n case 'object':\n return `structure${field.conceptRef ? ` ${field.conceptRef}` : ''}`;\n case 'list':\n return `list of ${kindLabel(field.item)}`;\n case 'unknown':\n return 'unknown';\n default:\n return field satisfies never;\n }\n}\n\n/** The constraints and hints of a field, each one fact in words. */\nfunction constraints(field: RunField): string[] {\n const notes: string[] = [];\n if (field.kind === 'number') {\n if (field.min !== undefined) notes.push(`min ${field.min}`);\n if (field.max !== undefined) notes.push(`max ${field.max}`);\n }\n if (field.kind === 'text' || field.kind === 'prose') {\n if (field.minLength !== undefined) notes.push(`at least ${field.minLength} characters`);\n if (field.maxLength !== undefined) notes.push(`at most ${field.maxLength} characters`);\n if (field.format) notes.push(`format ${field.format}`);\n }\n if (field.kind === 'list') {\n if (field.itemCount !== undefined) notes.push(`at least ${field.itemCount} items`);\n if (field.maxItemCount !== undefined) notes.push(`at most ${field.maxItemCount} items`);\n }\n if (field.defaultValue !== undefined) notes.push(`default ${JSON.stringify(field.defaultValue)}`);\n if (field.examples && field.examples.length > 0) {\n notes.push(`examples ${field.examples.map((example) => JSON.stringify(example)).join(', ')}`);\n }\n if (field.hints && Object.keys(field.hints).length > 0) {\n notes.push(\n `hints ${Object.entries(field.hints)\n .map(([key, value]) => `${key}=${value}`)\n .join(', ')}`,\n );\n }\n return notes;\n}\n\ntype Side = 'input' | 'result';\n\n/**\n * One path as the brief carries it. Presence is an input-page fact, so it is\n * stated on that side only; `relative` marks a path spelled from one item of\n * the list above, which is how a DataTable column or `$item` reads it.\n * `seeded` says an ancestor already carries a default: the seed is the\n * OUTERMOST default, exactly as `seedInputs` seeds it, so a member beneath a\n * defaulted structure lists none of its own - two `/state` patches on one\n * subtree would make the seed depend on the order a model emits them in -\n * while its notes still state it, as a fact about the field rather than an\n * instruction. An optional structure with no default of its own seeds nothing\n * beneath it, for the same reason `seedInputs` leaves it absent.\n */\nfunction entryOf(\n field: RunField,\n path: string,\n depth: number,\n side: Side,\n relative: boolean,\n seeded: boolean,\n): DesignerPathEntry {\n const notes = constraints(field);\n return {\n depth,\n path,\n kind: kindLabel(field),\n name: field.name,\n title: field.title && field.title !== field.name ? field.title : undefined,\n description: field.description,\n required: side === 'input' ? field.required : undefined,\n gating: side === 'input' && field.gating ? true : undefined,\n notes: notes.length > 0 ? notes : undefined,\n default:\n seeded || field.defaultValue === undefined ? undefined : JSON.stringify(field.defaultValue),\n delegated: side === 'input' ? isDelegatedInput(field) : isDelegatedResult(field),\n relative: relative ? true : undefined,\n };\n}\n\n/**\n * A path and, beneath it, what the page can lay out: a structure's members at\n * their own paths, and - on a result page - a list's item, whose members\n * follow spelled relative to one item. A delegated path ends the walk: the\n * kernel renders it whole, so its members are nobody else's to bind.\n */\nfunction describe(\n field: RunField,\n path: string,\n depth: number,\n side: Side,\n entries: DesignerPathEntry[],\n seeded = false,\n): void {\n const entry = entryOf(field, path, depth, side, false, seeded);\n entries.push(entry);\n if (entry.delegated) return;\n if (field.kind === 'object') {\n // Beneath an optional structure with no default of its own nothing is\n // seeded either: whether it is there at all is the person's choice, made\n // with its disclosure, and `seedInputs` leaves it absent. Listing its\n // members' defaults as seeds would have a layout open it.\n const seededBelow =\n seeded || field.defaultValue !== undefined || (side === 'input' && !field.required);\n for (const child of field.fields) {\n describe(child, joinPath(path, child.name), depth + 1, side, entries, seededBelow);\n }\n }\n if (field.kind === 'list' && side === 'result') {\n const item = field.item;\n entry.item_kind = kindLabel(item);\n entry.item_description = item.description;\n if (item.kind === 'object' && !isDelegatedResult(item)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(child, child.name, depth + 2, entries);\n }\n }\n }\n}\n\n/** A member of a list's item, spelled relative to that item; a nested list's members go through `<i>`. */\nfunction describeRelative(\n field: RunField,\n relativePath: string,\n depth: number,\n entries: DesignerPathEntry[],\n): void {\n const entry = entryOf(field, relativePath, depth, 'result', true, false);\n entries.push(entry);\n if (entry.delegated) return;\n if (field.kind === 'object') {\n for (const child of field.fields) {\n describeRelative(child, joinPath(relativePath, child.name), depth + 1, entries);\n }\n }\n if (field.kind === 'list') {\n const item = field.item;\n entry.item_kind = kindLabel(item);\n entry.item_description = item.description;\n if (item.kind === 'object' && !isDelegatedResult(item)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(child, joinPath(relativePath, '<i>', child.name), depth + 2, entries);\n }\n }\n }\n}\n\n/** The brief for an INPUT page: the form a run is started from. */\nexport function inputBrief(subject: BriefSubject, fields: readonly RunField[]): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n for (const field of fields) describe(field, joinPath(INPUTS_ROOT, field.name), 0, 'input', paths);\n return {\n side: 'input',\n pipe_ref: subject.pipeRef,\n description: subject.description,\n name: subject.name,\n paths,\n run_control: RUN_COMPONENT,\n };\n}\n\n/** The brief for a RESULT page: what one run produced, laid out. */\nexport function resultBrief(subject: BriefSubject, field: RunField, state: unknown): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n if (field.kind === 'object' && !isDelegatedResult(field)) {\n // The result itself is the root, and its line names no member: it IS the\n // structure, whose members then follow one level down.\n paths.push({\n depth: 0,\n path: RESULT_ROOT,\n kind: kindLabel(field),\n description: field.description,\n delegated: false,\n });\n for (const child of field.fields) {\n describe(child, joinPath(RESULT_ROOT, child.name), 1, 'result', paths);\n }\n } else {\n describe(field, RESULT_ROOT, 0, 'result', paths);\n }\n return {\n side: 'result',\n pipe_ref: subject.pipeRef,\n description: subject.description,\n paths,\n sample_state: JSON.stringify(state, null, 2),\n };\n}\n","import type { Spec } from '@json-render/core';\nimport { validateSpec } from '@json-render/core';\nimport type { z } from 'zod';\nimport { catalog as defaultCatalog } from './catalog';\nimport { INPUTS_ROOT, RESULT_ROOT } from './paths';\nimport { hasOwnProp } from '../core/own-property';\n\n/**\n * Whether a spec is one this catalog can render - the check every source\n * passes, whoever wrote it.\n *\n * Three layers, because json-render's own `catalog.validate()` covers only the\n * first two once a catalog has more than one component: it checks the element\n * TYPE against the component names, but `propsOf` degrades to \"any record\"\n * when several definitions could apply, so a misspelt or invented prop passes.\n * The per-component prop check is therefore this module's, and it has to be\n * expression-aware: a bound prop's raw value is `{ \"$state\": \"/path\" }`, which\n * the component's own zod schema (`z.string()`) would reject, so a dynamic\n * expression is accepted wherever the prop EXISTS and a literal is parsed\n * against the prop's schema.\n *\n * The checks are the same whichever catalog a spec was written against; the\n * catalog is a parameter, this entry's own by default, so a host that defines\n * a vocabulary of its own is validated by the same code and not by a copy of\n * it.\n *\n * What a component renders beyond its schema - the heading its title is, the\n * landmark it renders as, the fixed number of children it lays out, the panel\n * per entry of one of its props - is a fact about its renderer that no schema\n * states, so the catalog carries it as `renders`, declared beside the\n * definitions, and the validator reads it off the catalog it is handed rather\n * than assuming it from a component's name, which a host's vocabulary may\n * reuse for something that renders nothing of the kind. This entry's catalog\n * declares its own; a host's declares what its renderers do, or nothing, and\n * is then held only to what its schemas and its `Heading` elements say.\n */\n\n/**\n * What one component renders beyond what its props schema says, and what the\n * validator holds a layout to on that account. Every member is optional: a\n * component with none is held to its schema alone.\n */\nexport interface ComponentRendering {\n /**\n * The heading its renderer emits, at this level - a `Hero`'s headline is\n * the h1 - and, when it emits one only if a prop is set, the prop: a `Card`\n * renders its `title` as an h3 and nothing when it has none.\n */\n heading?: { level: 1 | 2 | 3 | 4; when?: string };\n /** What it renders as that a page has one of - a landmark, in the words a refusal uses: \"the page's banner\". */\n once?: string;\n /** The number of children its renderer lays out, dropping the rest in silence, and what they are. */\n children?: { count: number; roles: string };\n /** A panelled container: the prop that lists its panels, one child per entry, and what one is called. */\n panels?: { prop: string; noun: string };\n}\n\n/** What the validator reads off a catalog: its names, its definitions, and what its components render. */\nexport interface ValidationCatalog {\n componentNames: readonly string[];\n /** The catalog's own action names. A `defineCatalog` result carries this already. */\n actionNames?: readonly string[];\n data: unknown;\n /** The schema the catalog was defined against, for the actions its runtime handles without a handler. */\n schema?: { builtInActions?: readonly { name: string }[] };\n /** What each component renders beyond its schema, by component name. Absent, no component renders a heading, a landmark or a fixed set of children. */\n renders?: Readonly<Record<string, ComponentRendering>>;\n}\n\nexport interface SpecProblem {\n elementKey?: string;\n message: string;\n}\n\nexport interface SpecVerdict {\n ok: boolean;\n problems: SpecProblem[];\n}\n\nconst EXPRESSION_KEYS = [\n '$state',\n '$item',\n '$index',\n '$bindState',\n '$bindItem',\n '$cond',\n '$computed',\n '$template',\n];\n\n/** The two escape hatches: their `path` is resolved by the layer, so it is never an expression. */\nconst HATCHES = new Set(['MthdsField', 'MthdsResult']);\n\nfunction isExpression(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Object.keys(value).some((key) => EXPRESSION_KEYS.includes(key))\n );\n}\n\n/**\n * The closed vocabularies a prop can be declared with, unwrapped through the\n * `.optional()` / `.nullable()` most of them carry.\n *\n * An expression-valued prop skips the literal check below, which is right for a\n * value the host supplies at render - but not for a prop whose whole meaning is\n * that it is one of a fixed set. A `{ \"$template\": \"script\" }` carries no\n * interpolation, so json-render resolves it to the literal string `script`,\n * and a renderer that trusted the prop's declared union turned that into a DOM\n * tag name. A closed vocabulary has no dynamic form: if the value is not one of\n * the names, no expression can make it one.\n */\nfunction isClosedVocabulary(schema: z.ZodType): boolean {\n let current: unknown = schema;\n for (let depth = 0; depth < 8; depth += 1) {\n const def = (current as { def?: { type?: string; innerType?: unknown } }).def;\n if (!def) return false;\n if (def.type === 'enum' || def.type === 'literal') return true;\n if (def.innerType === undefined) return false;\n current = def.innerType;\n }\n return false;\n}\n\n/** The catalog's definition of one component, or nothing for a type it does not have. */\nfunction definitionOf(\n catalog: ValidationCatalog,\n type: string,\n): { props?: unknown; events?: unknown } | undefined {\n const components = (catalog.data as { components: Record<string, { props?: unknown }> })\n .components;\n // `hasOwnProp`, because the type is model-written and a prototype key would\n // find a function where a definition belongs.\n return hasOwnProp(components, type) ? components[type] : undefined;\n}\n\n/** The zod object each component's props are declared with, by component name. */\nfunction propsSchemaOf(catalog: ValidationCatalog, type: string): z.ZodObject | undefined {\n const props = definitionOf(catalog, type)?.props;\n return props && typeof props === 'object' && 'shape' in props\n ? (props as z.ZodObject)\n : undefined;\n}\n\n/**\n * The events a component's renderer emits, as its definition declares them -\n * an empty list for a component that emits nothing. `undefined` only for a\n * type the catalog does not have, which section 2 reports on its own.\n */\nfunction eventsOf(catalog: ValidationCatalog, type: string): readonly string[] | undefined {\n const definition = definitionOf(catalog, type);\n if (!definition) return undefined;\n return Array.isArray(definition.events)\n ? definition.events.filter((event): event is string => typeof event === 'string')\n : [];\n}\n\n/**\n * The deepest element chain this entry judges.\n *\n * Every walk below recurses, json-render's `validateSpec` included, so a deep\n * enough chain overflows the stack inside the gate: a chain of a thousand\n * elements validates in about no time, six thousand throws. The stack limit is\n * a property of the engine and not of the layout, so without a cap the same\n * stored bytes can pass under node and fail in a browser - and a stored artifact\n * deserves one verdict wherever it is checked. The number is far past any page\n * a person reads and far short of where any engine's stack gives out.\n */\nconst MAX_ELEMENT_DEPTH = 512;\n\nfunction childKeysOf(spec: Spec, key: string): string[] {\n const element = spec.elements[key] as { children?: unknown; slots?: unknown } | null | undefined;\n if (!element) return [];\n const children = Array.isArray(element.children) ? (element.children as string[]) : [];\n const slots =\n typeof element.slots === 'object' && element.slots !== null\n ? Object.values(element.slots as Record<string, unknown>).flatMap((slot) =>\n Array.isArray(slot) ? (slot as string[]) : [],\n )\n : [];\n return [...children, ...slots].filter((child) => typeof child === 'string');\n}\n\n/**\n * The longest chain of elements in the spec, measured without recursing.\n *\n * Iterative on purpose: a check whose whole job is to catch a walk that\n * overflows must not be able to overflow itself. Post-order with a memo, so it\n * is linear in the tree rather than in its paths, and a back edge is ignored\n * for depth - a cycle is section 1b's to report, not this one's.\n */\nfunction deepestChain(spec: Spec): number {\n const below = new Map<string, number>();\n const onPath = new Set<string>();\n let deepest = 0;\n for (const start of Object.keys(spec.elements)) {\n if (below.has(start)) continue;\n const stack: string[] = [start];\n while (stack.length > 0) {\n const key = stack[stack.length - 1] as string;\n if (below.has(key)) {\n onPath.delete(key);\n stack.pop();\n continue;\n }\n const children = childKeysOf(spec, key).filter((child) => !onPath.has(child));\n const pending = children.filter((child) => !below.has(child));\n if (pending.length > 0) {\n onPath.add(key);\n stack.push(...pending);\n continue;\n }\n below.set(\n key,\n children.reduce((tallest, child) => Math.max(tallest, below.get(child) ?? 0), 0) + 1,\n );\n onPath.delete(key);\n stack.pop();\n }\n deepest = Math.max(deepest, below.get(start) ?? 0);\n }\n return deepest;\n}\n\n/**\n * Whether a spec is one this catalog can render.\n *\n * The checks live in `checkAgainstCatalog`; this is the boundary that keeps the\n * documented promise around them - it answers with problems, not exceptions.\n * That promise was not kept: `validateSpec` throws on `repeat: null`, on\n * `children: 5`, on `props: 5`, on a null element and on a missing `elements`\n * map, all of which a model can emit. A host calls this to decide whether it is\n * safe to render, so a throw leaves it with no verdict at the one moment it\n * needs one, and the fallback to the plain form never fires.\n */\nexport function validateAgainstCatalog(\n spec: Spec,\n catalog: ValidationCatalog = defaultCatalog,\n): SpecVerdict {\n try {\n return checkAgainstCatalog(spec, catalog);\n } catch (error) {\n return {\n ok: false,\n problems: [{ message: `the layout is not a well-formed spec: ${String(error)}` }],\n };\n }\n}\n\nfunction checkAgainstCatalog(spec: Spec, catalog: ValidationCatalog): SpecVerdict {\n const problems: SpecProblem[] = [];\n\n // 0. Depth, before anything that recurses - including json-render's own walk.\n const depth = deepestChain(spec);\n if (depth > MAX_ELEMENT_DEPTH) {\n return {\n ok: false,\n problems: [\n {\n message: `the element tree is ${depth} deep; this entry renders at most ${MAX_ELEMENT_DEPTH}.`,\n },\n ],\n };\n }\n\n // 1. Structure: root, children, misplaced fields, and the elements the root\n // never reaches. json-render reports an orphan at `warning` severity, so\n // forwarding errors alone made `checkOrphans` a flag with no effect on the\n // verdict - while `stream.ts` deliberately keeps an unreachable element in\n // the JSONL \"so a validator can report it\". An orphan is a branch of the\n // page the model wrote and never attached: it renders as nothing at all,\n // which is exactly the silent half-page the fallback exists for.\n const structure = validateSpec(spec, { checkOrphans: true });\n for (const issue of structure.issues) {\n if (issue.severity === 'error' || issue.code === 'orphaned_element') {\n problems.push({ elementKey: issue.elementKey, message: issue.message });\n }\n }\n\n // 1b. No element is its own ancestor.\n //\n // json-render's `validateSpec` guards its OWN walks against a cycle but\n // reports nothing about one, so `children: [\"self\"]` passes it in silence.\n // What follows is not silent: the renderer walks children to paint the\n // page and recurses until the stack goes. Catching it here is what makes\n // the fallback fire instead, and it is the reason `repeatBasePathOf` also\n // carries a `seen` guard of its own - the two predicates are exported\n // separately, so neither may assume the other ran first.\n const cyclic = new Set<string>();\n const state = new Map<string, 'open' | 'done'>();\n const descend = (key: string): void => {\n const mark = state.get(key);\n if (mark === 'done') return;\n if (mark === 'open') {\n cyclic.add(key);\n return;\n }\n state.set(key, 'open');\n const element = spec.elements[key];\n for (const child of element?.children ?? []) descend(child);\n for (const slot of Object.values(element?.slots ?? {}))\n for (const child of slot) descend(child);\n state.set(key, 'done');\n };\n for (const key of Object.keys(spec.elements)) descend(key);\n for (const key of cyclic) {\n problems.push({\n elementKey: key,\n message: `\"${key}\" is its own descendant: an element tree may not contain a cycle.`,\n });\n }\n\n // 2. Every type is in the catalog.\n const known = new Set(catalog.componentNames);\n for (const [key, element] of Object.entries(spec.elements)) {\n if (!known.has(element.type)) {\n problems.push({ elementKey: key, message: `unknown component type \"${element.type}\"` });\n }\n }\n\n // 3. Every prop exists on its component, and every literal parses.\n for (const [key, element] of Object.entries(spec.elements)) {\n const schema = propsSchemaOf(catalog, element.type);\n if (!schema) continue;\n const shape = schema.shape as Record<string, z.ZodType>;\n const props = (element.props ?? {}) as Record<string, unknown>;\n for (const [name, value] of Object.entries(props)) {\n const propSchema = shape[name];\n if (!propSchema) {\n problems.push({\n elementKey: key,\n message: `${element.type} has no prop \"${name}\" (known: ${Object.keys(shape).join(', ')})`,\n });\n continue;\n }\n if (isExpression(value)) {\n if (HATCHES.has(element.type) && name === 'path') {\n problems.push({\n elementKey: key,\n message: `${element.type}.path must be a literal string - absolute, or the item's field name inside a repeat - never an expression.`,\n });\n } else if (isClosedVocabulary(propSchema)) {\n problems.push({\n elementKey: key,\n message: `${element.type}.${name} is one of a fixed set of names, so it must be written as a literal, never as an expression.`,\n });\n }\n continue;\n }\n const parsed = propSchema.safeParse(value);\n if (!parsed.success) {\n problems.push({\n elementKey: key,\n message: `${element.type}.${name}: ${parsed.error.issues.map((issue) => issue.message).join('; ')}`,\n });\n }\n }\n // A required prop that is absent. Optional ones are `.nullable()` in the\n // shadcn definitions, so \"required\" here means neither optional nor nullable.\n for (const [name, propSchema] of Object.entries(shape)) {\n if (name in props) continue;\n if (propSchema.safeParse(undefined).success || propSchema.safeParse(null).success) continue;\n problems.push({\n elementKey: key,\n message: `${element.type} is missing required prop \"${name}\"`,\n });\n }\n }\n\n // What each component renders beyond its schema, read off the catalog under\n // validation. `hasOwnProp`, because the type is model-written and a\n // prototype key would find a function where a rendering belongs.\n const renders = catalog.renders ?? {};\n const renderingOf = (type: string): ComponentRendering | undefined =>\n hasOwnProp(renders, type) ? renders[type] : undefined;\n\n // 4. A panelled container has one child per panel, in order. The renderer\n // would silently show fewer panels than tabs, or a step with nothing in\n // it; the validator says so instead.\n for (const [key, element] of Object.entries(spec.elements)) {\n const panelled = renderingOf(element.type)?.panels;\n if (!panelled) continue;\n const props = (element.props ?? {}) as Record<string, unknown>;\n const listed = props[panelled.prop];\n if (!Array.isArray(listed)) continue;\n const panels = listed.length;\n const children = element.children?.length ?? 0;\n if (children !== panels) {\n problems.push({\n elementKey: key,\n message: `${element.type} declares ${panels} panel${panels === 1 ? '' : 's'} but has ${children} child${children === 1 ? '' : 'ren'}: exactly one child per ${panelled.noun}, in order.`,\n });\n }\n const runs = (element.children ?? []).filter(\n (child) => spec.elements[child]?.type === 'Button',\n );\n if (runs.length > 0) {\n problems.push({\n elementKey: key,\n message: `${element.type} has a Button as a direct child; a panel is a container (a Stack), and the Button belongs inside the last one.`,\n });\n }\n }\n // 5. Exactly one h1, and heading levels that increase by one, in render\n // order. The Storybook a11y gate runs axe's `heading-order` at error, and\n // a page that jumps from h1 to h3 fails it; saying so here makes it a\n // rejected spec with a re-run rather than a failing story with a fixture\n // nobody may edit. A `Heading` is not the only element that renders one:\n // a component renders its title as a heading too, at the level its\n // rendering declares - which is what its description states to the\n // model - and the walk counts it where it renders, before its children,\n // since a title comes first. Counting `Heading` elements alone let a page\n // with no h1 through, and one with a Hero over a Section over a titled\n // Card was three headings the check never saw.\n // A Card renders its title as a heading only when it has one; a bound title\n // counts, since it renders whenever the value is set.\n const present = (value: unknown) => value !== undefined && value !== null && value !== '';\n const levels: { key: string; type: string; level: number }[] = [];\n // The elements of each component a page has at most one of, in render order.\n const onlyOnce = new Map<string, { reason: string; keys: string[] }>();\n const seen = new Set<string>();\n const walk = (key: string) => {\n if (seen.has(key)) return;\n seen.add(key);\n const element = spec.elements[key];\n if (!element) return;\n const props = (element.props ?? {}) as Record<string, unknown>;\n const rendering = renderingOf(element.type);\n if (element.type === 'Heading') {\n const level = String(props.level ?? 'h2');\n const match = /^h([1-4])$/.exec(level);\n if (match) levels.push({ key, type: 'Heading', level: Number(match[1]) });\n } else if (rendering?.heading) {\n const rendered = rendering.heading;\n const has = rendered.when === undefined || present(props[rendered.when]);\n if (has) levels.push({ key, type: element.type, level: rendered.level });\n }\n if (rendering?.once !== undefined) {\n const entry = onlyOnce.get(element.type) ?? { reason: rendering.once, keys: [] };\n entry.keys.push(key);\n onlyOnce.set(element.type, entry);\n }\n for (const child of element.children ?? []) walk(child);\n for (const slot of Object.values(element.slots ?? {})) for (const child of slot) walk(child);\n };\n if (spec.root) walk(spec.root);\n const describe = (heading: { type: string; level: number }) =>\n heading.type === 'Heading' ? `h${heading.level}` : `${heading.type}'s h${heading.level}`;\n // Every heading after the first may go deeper than the one before it by\n // one at most, as axe reads it.\n let previous: { type: string; level: number } | undefined;\n for (const heading of levels) {\n if (previous !== undefined && heading.level > previous.level + 1) {\n problems.push({\n elementKey: heading.key,\n message: `${describe(heading)} jumps after ${describe(previous)}: heading levels increase by one, never by more.`,\n });\n }\n previous = heading;\n }\n // One h1, which is the page's title: a page without one has no name for a\n // screen reader to announce, and a page with two has two. A page is asked\n // for one only where its catalog can express one - a `Heading` at level\n // h1, or a component whose rendering declares one - since a vocabulary\n // with neither could never satisfy the rule.\n const firsts = levels.filter((heading) => heading.level === 1);\n const h1Ways = [\n ...(known.has('Heading') ? ['as a Heading at level h1'] : []),\n ...Object.entries(renders)\n .filter(([, rendering]) => rendering.heading?.level === 1)\n .map(([type]) => `as the heading a ${type} renders`),\n ];\n if (firsts.length === 0 && spec.root && h1Ways.length > 0) {\n problems.push({\n elementKey: spec.root,\n message: `the page has no h1: exactly one, ${h1Ways.join(' or ')}.`,\n });\n }\n for (const extra of firsts.slice(1)) {\n problems.push({\n elementKey: extra.key,\n message: `a second h1 (${describe(extra)}, after ${describe(firsts[0]!)} at [${firsts[0]!.key}]): exactly one on a page.`,\n });\n }\n // A component that renders as one of the page's landmarks - its banner, its\n // contentinfo - is one a page has at most one of. axe says so of the DOM\n // (`landmark-no-duplicate-banner`), but the stories switch that rule off\n // because their pair view renders every page twice, so this is the one\n // place a second bar or footer is refused.\n for (const [type, { reason, keys }] of onlyOnce) {\n for (const extra of keys.slice(1)) {\n problems.push({\n elementKey: extra,\n message: `a second ${type} (after [${keys[0]}]): at most one on a page, since it renders as ${reason}.`,\n });\n }\n }\n\n // 6. A container that takes a fixed number of children, and would drop the\n // rest in silence: its renderer destructures the ones it lays out and\n // paints nothing for a third. The product rules state the count for a\n // Workspace, and this is where a layout is held to it.\n for (const [key, element] of Object.entries(spec.elements)) {\n const rule = renderingOf(element.type)?.children;\n if (!rule) continue;\n const children = element.children?.length ?? 0;\n if (children !== rule.count) {\n problems.push({\n elementKey: key,\n message: `${element.type} takes exactly ${rule.count} children (${rule.roles}); this one has ${children}.`,\n });\n }\n }\n\n // 7. The `on` field, which nothing looked at before.\n //\n // `props` was checked exhaustively while the other half of what a layout\n // can say went unread, and the failures that hid there are ends of the\n // same gap. An action name the catalog does not have is accepted, so a\n // `Cta` bound to a misspelt `run` renders a page that validates, fits,\n // and whose only button does nothing - with no fallback, because both\n // checks said yes. An EVENT name the component never emits is the same\n // dead button by the other door: a `Cta` emits `press` and nothing else,\n // so `on.click` bound to a perfectly good `run` fires never, and the\n // action check alone waved it through. And json-render's runtime applies\n // `setState` to whatever `statePath` it is handed, so a layout could write\n // a value the person never saw into `/inputs` and have it leave in the run\n // payload. That is rule 1 inverted: a layout names a path, and the two\n // trees the descriptor owns are the host's to fill - `/inputs` from the\n // person through the controls and `seedInputs`, `/result` from the run.\n // Scratch state of the layout's own, at any other path, stays its business.\n //\n // The write ban covers EVERY destination an action writes, not the one\n // parameter that happens to be named `statePath` on the obvious three:\n // `validateForm` writes its verdict at its own `statePath`, and\n // `pushState` clears a second path, `clearStatePath`, after it appends.\n // Both went unread, and either put a value into `/inputs` through an\n // action the ban never looked at. And the runtime's pointer parser treats\n // `inputs/city` exactly as `/inputs/city` - a missing leading slash is\n // supplied, never refused - so a destination is judged with the slash the\n // runtime will give it, not the one the model wrote.\n //\n // The name check needs a catalog that declares its actions. Both fields are\n // optional on `ValidationCatalog` and a `defineCatalog` result carries\n // both, so this entry's catalog is always checked - but a host that hands\n // in a vocabulary of its own without them gets the write ban and no\n // unknown-action verdict, rather than every action refused for want of a\n // list to check against.\n //\n // And a binding does not only sit under `on`. A `watch` fires its\n // bindings when the state at its key changes, with no event and no\n // person in between; and any binding may carry an `onSuccess` and an\n // `onError`, which the runtime applies after the handler returns or\n // throws: a `set` there writes each key straight into the state with\n // no handler between, and an `action` there is a binding of its own,\n // run through the same executor. Every one of those is a door into\n // `/inputs` that the walk over `on` never saw, so a binding is checked\n // wherever it sits, and a chain is followed as far as it goes.\n const declared = [\n ...(catalog.actionNames ?? []),\n ...(catalog.schema?.builtInActions ?? []).map((action) => action.name),\n ];\n const knownActions = declared.length > 0 ? new Set(declared) : undefined;\n // Every parameter each state-writing action writes to. A destination the\n // runtime falls back on when the parameter is absent (`validateForm` writes\n // `/formValidation`; `pushState` clears nothing) is not the layout's to name,\n // so those are `optional`; the others are refused when they are not a literal.\n const STATE_WRITES: Record<string, readonly { param: string; optional?: boolean }[]> = {\n setState: [{ param: 'statePath' }],\n pushState: [{ param: 'statePath' }, { param: 'clearStatePath', optional: true }],\n removeState: [{ param: 'statePath' }],\n validateForm: [{ param: 'statePath', optional: true }],\n };\n const OWNED_ROOTS = [INPUTS_ROOT, RESULT_ROOT];\n /** The owned root a destination lands in, judged with the leading slash the runtime supplies. */\n const ownedRootOf = (written: string): string | undefined => {\n const statePath = written.startsWith('/') ? written : `/${written}`;\n return OWNED_ROOTS.find((root) => statePath === root || statePath.startsWith(`${root}/`));\n };\n const bindingsOf = (binding: unknown): unknown[] =>\n Array.isArray(binding) ? binding : [binding];\n const refusal = (owned: string, statePath: string): string =>\n `a layout may not write into ${owned}, which the host fills. Bind the value with { \"$bindState\": \"${statePath}\" } or delegate it with MthdsField instead.`;\n\n /**\n * One binding, wherever it sits - under `on.<event>`, under `watch.<path>`,\n * or as the `onSuccess` or `onError` of another - held to the name check,\n * the write ban, and then to its own callbacks. `site` is the spelling a\n * problem names the binding by.\n */\n const checkBinding = (key: string, site: string, entry: unknown): void => {\n const action = (entry as { action?: unknown } | null)?.action;\n if (typeof action !== 'string') {\n problems.push({ elementKey: key, message: `${site} has an entry with no \"action\" name.` });\n return;\n }\n if (knownActions && !knownActions.has(action)) {\n problems.push({\n elementKey: key,\n message: `${site} names the unknown action \"${action}\" (known: ${[...knownActions].join(', ')}); nothing would handle it.`,\n });\n return;\n }\n // `hasOwnProp`: the action is model-written, and `constructor` would\n // find a function where a list of destinations belongs.\n const writes = hasOwnProp(STATE_WRITES, action) ? STATE_WRITES[action] : undefined;\n if (writes) {\n const params = (entry as { params?: unknown }).params;\n for (const { param, optional } of writes) {\n const written =\n typeof params === 'object' && params !== null\n ? (params as Record<string, unknown>)[param]\n : undefined;\n if (written === undefined || written === null) {\n if (!optional) {\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} without a literal \"${param}\".`,\n });\n }\n continue;\n }\n if (typeof written !== 'string') {\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} with a \"${param}\" that is not a literal string; where an action writes must be named, never computed.`,\n });\n continue;\n }\n const owned = ownedRootOf(written);\n if (owned) {\n const where = param === 'statePath' ? `on \"${written}\"` : `with ${param} \"${written}\"`;\n problems.push({\n elementKey: key,\n message: `${site} calls ${action} ${where}: ${refusal(owned, written.startsWith('/') ? written : `/${written}`)}`,\n });\n }\n }\n }\n // What the runtime does once the handler has returned or thrown. A `set`\n // writes each of its keys straight into the state, with no handler in\n // between; an `action` is a binding of its own, run through the same\n // executor, so it is checked as one - callbacks included.\n for (const hook of ['onSuccess', 'onError'] as const) {\n const follow = (entry as Record<string, unknown>)[hook];\n if (follow === undefined || follow === null) continue;\n const hookSite = `${site}.${hook}`;\n if (typeof follow !== 'object' || Array.isArray(follow)) {\n problems.push({\n elementKey: key,\n message: `${hookSite} must be an object: a { \"set\" } of state paths to values, or an { \"action\" } binding.`,\n });\n continue;\n }\n const record = follow as Record<string, unknown>;\n if (record.set !== undefined && record.set !== null) {\n if (typeof record.set !== 'object' || Array.isArray(record.set)) {\n problems.push({\n elementKey: key,\n message: `${hookSite}.set must be an object mapping a state path to its value.`,\n });\n } else {\n for (const written of Object.keys(record.set as Record<string, unknown>)) {\n const owned = ownedRootOf(written);\n if (owned) {\n problems.push({\n elementKey: key,\n message: `${hookSite} sets \"${written}\": ${refusal(owned, written.startsWith('/') ? written : `/${written}`)}`,\n });\n }\n }\n }\n }\n if (record.action !== undefined) checkBinding(key, hookSite, record);\n }\n };\n\n for (const [key, element] of Object.entries(spec.elements)) {\n const on = (element as { on?: unknown }).on;\n if (on !== undefined && on !== null) {\n if (typeof on !== 'object' || Array.isArray(on)) {\n problems.push({\n elementKey: key,\n message: '\"on\" must be an object mapping an event name to its actions.',\n });\n } else {\n const emitted = eventsOf(catalog, element.type);\n for (const [event, binding] of Object.entries(on as Record<string, unknown>)) {\n if (emitted && !emitted.includes(event)) {\n problems.push({\n elementKey: key,\n message:\n emitted.length > 0\n ? `on.${event}: ${element.type} never emits \"${event}\" (it emits: ${emitted.join(', ')}), so nothing bound there would ever fire.`\n : `on.${event}: ${element.type} emits no events, so nothing bound there would ever fire.`,\n });\n }\n for (const entry of bindingsOf(binding)) checkBinding(key, `on.${event}`, entry);\n }\n }\n }\n // A watch has no event to check against a definition: its key is the\n // state path whose change fires it. Its bindings are held to everything\n // else.\n const watch = (element as { watch?: unknown }).watch;\n if (watch !== undefined && watch !== null) {\n if (typeof watch !== 'object' || Array.isArray(watch)) {\n problems.push({\n elementKey: key,\n message:\n '\"watch\" must be an object mapping a state path to the actions its change fires.',\n });\n } else {\n for (const [path, binding] of Object.entries(watch as Record<string, unknown>)) {\n for (const entry of bindingsOf(binding)) checkBinding(key, `watch.${path}`, entry);\n }\n }\n }\n }\n\n return { ok: problems.length === 0, problems };\n}\n\n/** The problems as one block, for a failing test or a repair prompt. */\nexport function formatProblems(problems: readonly SpecProblem[]): string {\n return problems\n .map((problem) =>\n problem.elementKey ? `[${problem.elementKey}] ${problem.message}` : problem.message,\n )\n .join('\\n');\n}\n","import type { Spec } from '@json-render/core';\nimport type { RunField, RunFieldKind } from '../core';\nimport { hasOwnProp } from '../core/own-property';\nimport { catalog } from './catalog';\nimport {\n INPUTS_ROOT,\n RESULT_ROOT,\n absoluteHatchPath,\n inputFieldAtPath,\n joinPath,\n parentMapOf,\n repeatBasePathOf,\n repeatListPathOf,\n resultFieldAtPath,\n} from './paths';\n\n/**\n * Whether a stored layout still fits the descriptor it will be rendered over.\n *\n * A layout is produced once per method version and stored; a descriptor is\n * derived from the method every time it is read. Those two can part company -\n * a method's input is renamed, a structure loses a member - and when they do,\n * a delegated path resolves to nothing and a bound path writes into a corner of\n * the state the run never reads. Neither fails loudly on its own, so the host\n * asks this before it renders and falls back to the kernel's own form when the\n * answer is no.\n *\n * Two directions, and the second is the one a corpus cannot notice. The first\n * is staleness: every path the layout MENTIONS is a path the descriptor still\n * has, which is the corpus test's check lifted out of the test and into the\n * product. The second is coverage: every path the descriptor REQUIRES is one\n * the layout offers somewhere. A layout that simply omits an input is not\n * stale and validates perfectly - it renders a page with no field for a\n * required input, the run gate then refuses the run for that input, and the\n * person has nowhere to type it. A page you cannot complete is worse than the\n * plain form, which is what the fallback is for.\n *\n * It answers with problems, not exceptions, and that is a promise rather than\n * a habit: a host calls this to decide whether it is safe to render, so a\n * throw leaves it with no verdict at the one moment it needs one. A layout is\n * model-produced and may be malformed in ways the walk below trips on\n * (`children: 5`, a null element, no `elements` map at all), and the other\n * gate, which refuses those shapes outright, is exported separately - so\n * neither may assume the other ran first.\n *\n * A third check sits between the two and is about KIND rather than presence:\n * a path a layout shows as a value must be a scalar, and a path it reads into\n * a prop that takes a list must be a list. A `SummaryRow` whose `value` reads\n * `/inputs/document`, a structure of a url and a filename, is not stale - the\n * path exists - and it validates perfectly; it renders `[object Object]`,\n * because the renderer stringifies what it is handed and nothing anywhere said\n * the path was not a value. An `AppBar` whose `links` read that same structure\n * is the mirror image: its renderer maps over what it is handed, renders\n * nothing for a structure and throws for a text. Only the descriptor knows\n * what kind a path is, so this is where that is said.\n *\n * What is NOT checked here is whether the layout validates against the catalog\n * - that is `validateAgainstCatalog`, and a host runs both.\n */\n\nexport interface LayoutDescriptor {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n}\n\n/** Whether `path` is `root` itself or lies under it. */\nfunction isUnder(root: string, path: string): boolean {\n return path === root || path.startsWith(`${root}/`);\n}\n\n/**\n * Every state path the layout mentions, sorted by what it does with it.\n *\n * `bound` is what it WRITES: `{ \"$bindState\": \"/path\" }`, and inside a repeat\n * `{ \"$bindItem\": \"field\" }`, which binds a member of the current item. `read`\n * is the rest. A binding is not the only way a layout names a path: the prompt\n * teaches `{ \"$state\": \"/path\" }` for a read-only value, `$cond` for a\n * condition (whose own condition object is a `$state`, so the same walk finds\n * it), `{ \"$template\": \"Total ${/result/amount}\" }` for an interpolation, a\n * top-level `visible` condition on the ELEMENT rather than in its props - which\n * is why `element.visible` is walked here beside `element.props` - and, inside\n * a repeat, `{ \"$item\": \"field\" }` for a member of the current item.\n *\n * Missing any of these was not cosmetic. A read that has gone stale renders a\n * placeholder where a value belongs; a stale `visible` condition compares\n * against nothing, never holds, and hides its element for good - so a section\n * carrying a required input silently never appears, while the coverage half\n * below still counts that input as offered because the binding is right there\n * in the props of an element nobody can see.\n *\n * The two item forms are RELATIVE, and json-render resolves them against the\n * item of the nearest repeat above the element: `$item: \"name\"` inside a\n * repeat over `/result/lines` reads `/result/lines/<i>/name`. They are resolved\n * here the way a relative hatch path is - through `repeatBasePathOf`, at the\n * first index, since every index resolves to the same descriptor node - so a\n * renamed member of a repeated item is the same stale path as a renamed input,\n * and a `$bindItem` under `/result` is the same forbidden write as a\n * `$bindState` there. One outside any repeat resolves to nothing at all; the\n * runtime warns and renders nothing, and `adrift` names the element so the\n * gate can say so.\n *\n * A `repeat` is a read too, and it is resolved separately (`staleRepeats`)\n * because a relative one names its list through the repeat above it.\n */\ninterface Mentioned {\n bound: string[];\n read: string[];\n /** The elements that read or bind the current item with no repeat above them. */\n adrift: string[];\n}\n\n/**\n * The absolute path an item-relative field of one element resolves to, or\n * nothing outside any repeat. Resolved lazily: most elements sit in no repeat\n * and mention no item.\n */\nfunction itemPathResolver(\n spec: Spec,\n key: string,\n parents: Map<string, string>,\n): (field: string) => string | undefined {\n let base: string | undefined;\n let resolvedBase = false;\n return (field) => {\n if (!resolvedBase) {\n base = repeatBasePathOf(spec, key, parents);\n resolvedBase = true;\n }\n if (base === undefined) return undefined;\n // The runtime joins the field under the item's own path, and reads\n // `\"\"` (or `\"/\"`) as the item itself.\n const under = field.startsWith('/') ? field.slice(1) : field;\n return under === '' ? base : `${base}/${under}`;\n };\n}\n\n/**\n * The paths a template interpolates, resolved the way json-render resolves\n * them: `${/result/amount}` is absolute and read as written; a bare\n * `${amount}` is read off the item of the nearest repeat above the element,\n * and outside any repeat off the root of the state, as `/amount`. Inside a\n * repeat the runtime falls back to the root when the item has no such member,\n * but a layout that writes `${name}` in a repeat means the item's `name`, so\n * it is read as one here and a member the item has lost is stale rather than\n * quietly a root path. The pattern is json-render's own - one or more\n * characters - so an empty `${}` is the literal text it renders as, not an\n * interpolation of nothing.\n */\nfunction interpolatedPaths(\n template: string,\n itemPath: (field: string) => string | undefined,\n): string[] {\n return [...template.matchAll(/\\$\\{([^}]+)\\}/g)].flatMap((match) => {\n const raw = match[1];\n if (raw === undefined) return [];\n if (raw.startsWith('/')) return [raw];\n return [itemPath(raw) ?? `/${raw}`];\n });\n}\n\nfunction mentionedPaths(spec: Spec, parents: Map<string, string>): Mentioned {\n const found: Mentioned = { bound: [], read: [], adrift: [] };\n for (const [key, element] of Object.entries(spec.elements)) {\n const itemPath = itemPathResolver(spec, key, parents);\n const walk = (value: unknown): void => {\n if (Array.isArray(value)) {\n value.forEach(walk);\n return;\n }\n if (typeof value !== 'object' || value === null) return;\n const record = value as Record<string, unknown>;\n if (typeof record.$bindState === 'string') found.bound.push(record.$bindState);\n if (typeof record.$state === 'string') found.read.push(record.$state);\n if (typeof record.$template === 'string') {\n found.read.push(...interpolatedPaths(record.$template, itemPath));\n }\n if (typeof record.$bindItem === 'string') {\n const path = itemPath(record.$bindItem);\n if (path === undefined) found.adrift.push(key);\n else found.bound.push(path);\n }\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path === undefined) found.adrift.push(key);\n else found.read.push(path);\n }\n Object.values(record).forEach(walk);\n };\n walk(element.props);\n walk(element.visible);\n }\n return found;\n}\n\n/**\n * The read paths this descriptor answers for, deduplicated.\n *\n * Only paths under the root in question: a layout may hold scratch state of its\n * own (a `$state` an element writes and reads back), and that is its business,\n * not the descriptor's. What the descriptor owns is `/inputs` on an input page\n * and `/result` on a result one, and a path under either that no longer\n * resolves is the staleness this predicate exists to catch. One line per path,\n * however many elements mention it.\n */\nfunction staleReads(\n read: readonly string[],\n root: string,\n resolves: (path: string) => boolean,\n): string[] {\n const under = read.filter((path) => isUnder(root, path));\n return [...new Set(under)].filter((path) => !resolves(path));\n}\n\n/**\n * The repeats whose list the descriptor no longer has.\n *\n * A repeat over a list the method has renamed renders nothing at all, and\n * nothing else notices: on a result page there is no coverage to miss it, and\n * on an input page an optional list is asked for by nobody. A required one was\n * caught, by the coverage half and for the wrong reason. The list is resolved\n * the way a hatch inside the repeat resolves its own path - through the chain\n * of repeats above it - and, as with every read, only under the root the\n * descriptor owns: a repeat over the layout's own scratch state is its\n * business.\n */\nfunction staleRepeats(\n spec: Spec,\n parents: Map<string, string>,\n root: string,\n resolves: (path: string) => boolean,\n side: 'input' | 'result',\n): string[] {\n const problems: string[] = [];\n for (const [key, element] of Object.entries(spec.elements)) {\n if (!element.repeat) continue;\n const listPath = repeatListPathOf(spec, key, parents);\n if (listPath === undefined || !isUnder(root, listPath)) continue;\n if (!resolves(listPath)) {\n problems.push(`${key}: repeats over ${listPath}, which no ${side} has`);\n }\n }\n return problems;\n}\n\n/**\n * What a path of each kind is, in the words of the refusal, for the kinds a\n * value cannot be. A scalar - text, prose, a date, a number, a boolean, a\n * choice - is left out, and so is `unknown`, which the descriptor cannot\n * speak for.\n */\nconst NOT_A_VALUE: Partial<Record<RunFieldKind, { what: string; instead: string }>> = {\n object: { what: 'a structure', instead: 'a structure is shown through its members' },\n list: { what: 'a list', instead: 'a list is laid out as a repeat or a DataTable' },\n document: { what: 'a file', instead: \"a file is delegated to the kernel's own control\" },\n image: { what: 'a file', instead: \"a file is delegated to the kernel's own control\" },\n};\n\n/**\n * What the items of a list-taking prop may be: values alone, for a prop\n * declared as an array of strings or numbers (an `AppBar`'s links), or\n * anything, for one declared over structures or left open (a `DataTable`'s\n * rows). What a list of the wrong item kind is, in the words of the refusal,\n * is `NOT_VALUES`: a `Steps` handed a list of structures for its step names\n * renders `[object Object]` per step, and a renderer that maps a structure\n * into a React child throws.\n */\ntype ListItems = 'values' | 'anything';\nconst NOT_VALUES: Partial<Record<RunFieldKind, string>> = {\n object: 'structures',\n list: 'lists',\n document: 'files',\n image: 'files',\n};\n\n/**\n * The props that take a list rather than a value, by component, and what their\n * items may be: every prop the catalog declares as an array, read from the\n * schemas so a new one is never a missing entry here, plus the rows a\n * `DataTable` lays out, declared `any` because their shape is the\n * descriptor's. A `$state` read into one of these must be the list it wants;\n * into any other prop it is shown as a value.\n */\nlet listPropsCache: Map<string, Map<string, ListItems>> | undefined;\nfunction listProps(): Map<string, Map<string, ListItems>> {\n if (listPropsCache) return listPropsCache;\n const found = new Map<string, Map<string, ListItems>>([\n ['DataTable', new Map([['rows', 'anything']])],\n ]);\n const components = catalog.data.components as Record<string, { props?: unknown }>;\n for (const [type, definition] of Object.entries(components)) {\n const shape = (definition.props as { shape?: Record<string, unknown> } | undefined)?.shape;\n for (const [prop, schema] of Object.entries(shape ?? {})) {\n const items = listItemsOf(schema);\n if (items === undefined) continue;\n if (!found.has(type)) found.set(type, new Map());\n found.get(type)!.set(prop, items);\n }\n }\n listPropsCache = found;\n return found;\n}\n\n/** The zod schemas whose values a list-taking prop can render as they are. */\nconst VALUE_SCHEMAS = new Set(['string', 'number', 'boolean', 'enum', 'literal']);\n\n/** A zod definition, under the `.nullable()` / `.optional()` / `.default()` most props carry. */\nfunction unwrapped(schema: unknown): { type?: string; element?: unknown } | undefined {\n let current: unknown = schema;\n for (let depth = 0; depth < 8; depth += 1) {\n const def = (current as { def?: { type?: string; innerType?: unknown; element?: unknown } })\n .def;\n if (!def) return undefined;\n if (def.innerType === undefined) return def;\n current = def.innerType;\n }\n return undefined;\n}\n\n/** What a prop declared as an array takes as its items, or nothing for a prop that is not one. */\nfunction listItemsOf(schema: unknown): ListItems | undefined {\n const def = unwrapped(schema);\n if (def?.type !== 'array') return undefined;\n const element = unwrapped(def.element);\n return element?.type !== undefined && VALUE_SCHEMAS.has(element.type) ? 'values' : 'anything';\n}\n\n/**\n * The reads that show a path of the wrong kind as a value, or read one of the\n * wrong kind into a prop that takes a list.\n *\n * A read sits in one of two places. In a CONDITION - the object under a\n * `$cond`, or the element's own `visible` - it asks whether a value is set,\n * and any path may be asked; the `visible` field is not walked here at all.\n * Anywhere else in a prop it is shown: the renderer receives what the path\n * holds and stringifies it, and for a structure, a list or a file that is\n * `[object Object]`, a comma-joined list or a url where a name belongs. Every\n * form that shows a value is held to it - `$state`, the item-relative `$item`\n * resolved through the repeat above it, and every interpolation of a\n * `$template`, which stringifies what it interpolates, resolved the same way.\n *\n * A prop that takes a list is held the other way round. Written as one\n * expression, it reads a whole list, and the path must be one: a renderer\n * maps over what it is handed, so a structure or a file there renders nothing\n * and a text throws, and a list of structures where the prop takes values is\n * `[object Object]` per item or a throw, both past every gate. Written as an\n * array literal, each entry is a value and is walked as one. A path the\n * descriptor does not have is not repeated here: the staleness check names it.\n */\nfunction nonScalarReads(\n spec: Spec,\n parents: Map<string, string>,\n root: string,\n fieldAt: (path: string) => RunField | undefined,\n): string[] {\n const problems: string[] = [];\n const lists = listProps();\n for (const [key, element] of Object.entries(spec.elements)) {\n const itemPath = itemPathResolver(spec, key, parents);\n const listy = lists.get(element.type);\n const check = (prop: string, path: string): void => {\n if (!isUnder(root, path)) return;\n const field = fieldAt(path);\n if (!field) return;\n const wrong = hasOwnProp(NOT_A_VALUE, field.kind) ? NOT_A_VALUE[field.kind] : undefined;\n if (!wrong) return;\n problems.push(\n `${key}: ${prop} shows ${path}, which is ${wrong.what} and not a value; a prop that shows a value takes a scalar path, and ${wrong.instead}`,\n );\n };\n const checkList = (prop: string, path: string, items: ListItems): void => {\n if (!isUnder(root, path)) return;\n const field = fieldAt(path);\n if (!field || field.kind === 'unknown') return;\n if (field.kind !== 'list') {\n const what = hasOwnProp(NOT_A_VALUE, field.kind)\n ? NOT_A_VALUE[field.kind]!.what\n : 'a value';\n problems.push(\n `${key}: ${prop} takes a list, and ${path} is ${what}; a prop that takes a list reads a list path`,\n );\n return;\n }\n if (items !== 'values') return;\n const of = hasOwnProp(NOT_VALUES, field.item.kind) ? NOT_VALUES[field.item.kind] : undefined;\n if (!of) return;\n problems.push(\n `${key}: ${prop} takes a list of values, and ${path} is a list of ${of}; a list of ${of} is laid out as a repeat or a DataTable`,\n );\n };\n const walk = (prop: string, value: unknown): void => {\n if (Array.isArray(value)) {\n value.forEach((entry) => walk(prop, entry));\n return;\n }\n if (typeof value !== 'object' || value === null) return;\n const record = value as Record<string, unknown>;\n if (typeof record.$state === 'string') check(prop, record.$state);\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path !== undefined) check(prop, path);\n }\n if (typeof record.$template === 'string') {\n for (const path of interpolatedPaths(record.$template, itemPath)) check(prop, path);\n }\n for (const [name, entry] of Object.entries(record)) {\n if (name !== '$cond') walk(prop, entry);\n }\n };\n for (const [prop, value] of Object.entries(element.props ?? {})) {\n const items = listy?.get(prop);\n if (items === undefined || Array.isArray(value)) {\n walk(prop, value);\n continue;\n }\n if (typeof value !== 'object' || value === null) continue;\n const record = value as Record<string, unknown>;\n if (typeof record.$state === 'string') checkList(prop, record.$state, items);\n if (typeof record.$item === 'string') {\n const path = itemPath(record.$item);\n if (path !== undefined) checkList(prop, path, items);\n }\n }\n }\n return problems;\n}\n\n/**\n * The bound paths a layout may not write, under one rule for both pages - the\n * rule the read side above and the validator's `setState` check already apply.\n * `/inputs` is the person's: on an input page a binding there must name an\n * input the descriptor has, and a result page, which writes nothing, may not\n * bind there at all. `/result` is the run's, and no page may bind into it.\n * Anything else is the layout's own scratch state - a `Switch` bound to\n * `/ui/showDetails` is the natural way to drive a `visible` condition - and it\n * is left alone, as a read of it is.\n */\nfunction boundProblems(\n bound: readonly string[],\n inputs: readonly RunField[] | undefined,\n): string[] {\n const problems: string[] = [];\n const underInputs = bound.filter((path) => isUnder(INPUTS_ROOT, path));\n if (!inputs) {\n if (underInputs.length > 0) {\n problems.push(`a result page binds ${underInputs.join(', ')}; a result page writes nothing`);\n }\n } else {\n for (const path of underInputs) {\n if (!inputFieldAtPath(inputs, path)) {\n problems.push(`${path} is bound, and no input has it`);\n }\n }\n }\n for (const path of bound) {\n if (isUnder(RESULT_ROOT, path)) {\n problems.push(\n `${path} is bound; a layout may not write into ${RESULT_ROOT}, which the run fills`,\n );\n }\n }\n return problems;\n}\n\n/** The list path of every `repeat` in the spec: how a layout lays a list out. */\nfunction repeatPaths(spec: Spec): string[] {\n const found: string[] = [];\n for (const element of Object.values(spec.elements)) {\n const statePath = element.repeat?.statePath;\n if (typeof statePath === 'string') found.push(statePath);\n }\n return found;\n}\n\n/**\n * Where a person can enter this path: bound to a control, laid out as a\n * repeat, or delegated to the kernel's own control at this path or at any\n * ancestor of it - an `MthdsField` on a structure renders the whole subtree.\n */\nfunction isOffered(path: string, offered: Offered): boolean {\n if (offered.bound.has(path) || offered.repeated.has(path)) return true;\n return offered.delegated.some((at) => path === at || path.startsWith(`${at}/`));\n}\n\ninterface Offered {\n bound: Set<string>;\n repeated: Set<string>;\n delegated: string[];\n}\n\n/**\n * The required paths under `field` that the layout offers nowhere.\n *\n * A structure is covered by covering what it requires, so a layout may leave\n * out an optional member and still fit; a list is covered whole, by a repeat\n * or by delegation, because its items are the layout's business and not this\n * predicate's.\n */\nfunction uncoveredUnder(field: RunField, path: string, offered: Offered): string[] {\n if (isOffered(path, offered)) return [];\n if (field.kind === 'object') {\n return field.fields\n .filter((child) => child.required)\n .flatMap((child) => uncoveredUnder(child, joinPath(path, child.name), offered));\n }\n return [path];\n}\n\n/**\n * Every way this layout no longer fits, in the words a host can count by:\n * one line per element or path, empty when it fits.\n *\n * The checks live in `collectLayoutProblems`; this is the boundary that keeps\n * the promise in the header around them. A malformed spec is one line, naming\n * what the walk tripped on, which is a verdict the fallback can act on where a\n * throw was not.\n */\nexport function layoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[] {\n try {\n return collectLayoutProblems(descriptor, spec);\n } catch (error) {\n return [`the layout is not a well-formed spec: ${String(error)}`];\n }\n}\n\nfunction collectLayoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[] {\n const problems: string[] = [];\n const delegated: string[] = [];\n const parents = parentMapOf(spec);\n\n for (const [key, element] of Object.entries(spec.elements)) {\n const written = (element.props as { path?: unknown } | undefined)?.path;\n const path =\n typeof written === 'string' ? absoluteHatchPath(spec, key, written, parents) : undefined;\n if (element.type === 'MthdsField') {\n if (!path || !inputFieldAtPath(descriptor.inputs ?? [], path)) {\n problems.push(`${key}: MthdsField delegates ${String(written)}, which no input has`);\n } else {\n delegated.push(path);\n }\n }\n if (element.type === 'MthdsResult') {\n if (!path || !descriptor.result || !resultFieldAtPath(descriptor.result, path)) {\n problems.push(`${key}: MthdsResult delegates ${String(written)}, which no result has`);\n }\n }\n }\n\n const { bound, read, adrift } = mentionedPaths(spec, parents);\n for (const key of new Set(adrift)) {\n problems.push(`${key}: reads the current item, and no repeat above it has one`);\n }\n problems.push(...boundProblems(bound, descriptor.inputs));\n\n if (!descriptor.inputs) {\n const result = descriptor.result;\n const fieldAt = (path: string): RunField | undefined =>\n result ? resultFieldAtPath(result, path) : undefined;\n const resolves = (path: string): boolean => fieldAt(path) !== undefined;\n problems.push(...staleRepeats(spec, parents, RESULT_ROOT, resolves, 'result'));\n for (const path of staleReads(read, RESULT_ROOT, resolves)) {\n problems.push(`${path} is read, and no result has it`);\n }\n problems.push(...nonScalarReads(spec, parents, RESULT_ROOT, fieldAt));\n return problems;\n }\n\n const inputs = descriptor.inputs;\n const fieldAt = (path: string): RunField | undefined => inputFieldAtPath(inputs, path);\n const resolves = (path: string): boolean => fieldAt(path) !== undefined;\n problems.push(...staleRepeats(spec, parents, INPUTS_ROOT, resolves, 'input'));\n for (const path of staleReads(read, INPUTS_ROOT, resolves)) {\n problems.push(`${path} is read, and no input has it`);\n }\n problems.push(...nonScalarReads(spec, parents, INPUTS_ROOT, fieldAt));\n\n const offered: Offered = {\n bound: new Set(bound),\n repeated: new Set(repeatPaths(spec)),\n delegated,\n };\n for (const field of inputs) {\n if (!field.required) continue;\n for (const path of uncoveredUnder(field, joinPath(INPUTS_ROOT, field.name), offered)) {\n problems.push(`${path} is required, and the layout offers nowhere to enter it`);\n }\n }\n\n return problems;\n}\n\n/** The predicate: `layoutProblems` is empty. */\nexport function layoutFits(descriptor: LayoutDescriptor, spec: Spec): boolean {\n return layoutProblems(descriptor, spec).length === 0;\n}\n","import type { Spec } from '@json-render/core';\nimport { compileSpecStream } from '@json-render/core';\nimport { escapeSegment, unescapeSegment } from './paths';\n\n/**\n * A spec as JSONL patches, and back.\n *\n * json-render's wire format is RFC 6902 patches, one per line, root first and\n * parents before children, so a renderer can paint a partial tree at every\n * line. A model emits that format; a projected or authored spec is a finished\n * object. This is the bridge: any of the three sources can be replayed through\n * `specToJsonl`, and what a model emitted is compiled through `specFromJsonl`\n * before it is validated.\n */\n\n/**\n * The patch lines for a spec: `/root`, then every element reachable from the\n * root in breadth-first order (a parent always precedes its children), then\n * any element the root does not reach (kept, so a validator can report it),\n * then one patch per top-level `state` key.\n */\nexport function specToJsonl(spec: Spec): string {\n const lines: string[] = [];\n const push = (op: 'add', path: string, value: unknown) =>\n lines.push(JSON.stringify({ op, path, value }));\n\n push('add', '/root', spec.root);\n\n const emitted = new Set<string>();\n const queue = [spec.root];\n while (queue.length > 0) {\n const key = queue.shift()!;\n if (emitted.has(key)) continue;\n const element = spec.elements[key];\n if (!element) continue;\n emitted.add(key);\n push('add', `/elements/${escapeSegment(key)}`, element);\n for (const child of element.children ?? []) queue.push(child);\n for (const slotChildren of Object.values(element.slots ?? {})) queue.push(...slotChildren);\n }\n for (const key of Object.keys(spec.elements)) {\n if (!emitted.has(key)) push('add', `/elements/${escapeSegment(key)}`, spec.elements[key]);\n }\n for (const [key, value] of Object.entries(spec.state ?? {})) {\n push('add', `/state/${escapeSegment(key)}`, value);\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/**\n * The segments a patch path may not contain.\n *\n * json-render's patch applier walks a pointer with `if (!(segment in current)\n * || typeof current[segment] !== 'object') current[segment] = {}` and then\n * steps into it. `'__proto__' in {}` is true and its value is an object, so a\n * line naming `/__proto__/<key>` walks onto `Object.prototype` and assigns\n * there - polluting every object in the realm.\n *\n * This is the only place that can stop it. Compiling happens BEFORE\n * `validateAgainstCatalog` and before `layoutFits`, so by the time either gate\n * has a spec to judge, the damage is done and no verdict and no fallback can\n * undo it. A produced layout is untrusted text, and this is where it first\n * becomes objects.\n *\n * A `copy` or a `move` names a SECOND pointer, `from`, and the applier reads\n * it with the same walk: `getByPath(spec, '/__proto__')` answers\n * `Object.prototype` itself, and a `copy` of it to `/scratch` parks a\n * reference to the prototype inside the spec - not a clone - so the next\n * `add` at `/scratch/<key>` lands on every object in the realm through a path\n * that names no forbidden segment at all. Both pointers are checked, for the\n * same reason `path` is.\n */\nconst FORBIDDEN_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/** Whether a pointer would walk onto a prototype. */\nfunction pointerReachesPrototype(pointer: unknown): boolean {\n return (\n typeof pointer === 'string' &&\n pointer.split('/').some((segment) => FORBIDDEN_SEGMENTS.has(unescapeSegment(segment)))\n );\n}\n\n/** Whether a patch line names a pointer - its `path`, or a copy's or move's `from` - that would walk onto a prototype. */\nfunction reachesPrototype(line: string): boolean {\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return false; // Not JSON: the compiler skips it, and so do we.\n }\n const patch = parsed as { path?: unknown; from?: unknown } | null;\n return pointerReachesPrototype(patch?.path) || pointerReachesPrototype(patch?.from);\n}\n\n/**\n * The spec a JSONL stream compiles to. Blank lines and non-JSON lines are\n * skipped by the compiler; a line whose `path` or `from` would reach a\n * prototype is dropped here, before the compiler sees it; and a line the\n * compiler refuses is dropped too, which is why the stream is applied one line\n * at a time.\n *\n * A batch compile made a single bad line fatal to the whole layout. Two of them\n * are reachable from produced text: a `test` op whose value does not match\n * throws `Test operation failed`, and a non-string `path` throws\n * `path.startsWith is not a function`. A host follows the documented flow -\n * compile, then ask the two gates - so a throw here arrives before there is any\n * verdict to act on, and the fallback that exists for exactly this case never\n * fires. Skipping the line degrades instead: what survives is a partial spec,\n * which the gates then judge on its merits and reject if it is not renderable.\n */\nexport function specFromJsonl(jsonl: string): Spec {\n let spec: Record<string, unknown> = { root: '', elements: {} };\n for (const line of jsonl.split('\\n')) {\n if (reachesPrototype(line)) continue;\n try {\n spec = compileSpecStream<Record<string, unknown>>(line, spec) as Record<string, unknown>;\n } catch {\n continue; // A patch that will not apply is skipped, as a non-JSON line is.\n }\n }\n return spec as unknown as Spec;\n}\n\n/** The individual patch lines of a stream, for a replay that feeds them one at a time. */\nexport function jsonlLines(jsonl: string): string[] {\n return jsonl.split('\\n').filter((line) => line.trim().length > 0);\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { BrandManifest } from '../brand/manifest';\n\n/**\n * The manifest, handed down to the brand components: the app bar reads the\n * logo pair and the name off it, and nothing on the page names a brand\n * itself. The provider also loads the manifest's web font, once per family,\n * by appending the Google Fonts link a host would put in its document head -\n * so a brand story needs nothing in `.storybook/preview-head.html`, and the\n * Storybook carries no font any story did not ask for.\n */\n\nconst BrandContext = React.createContext<BrandManifest | null>(null);\n\nexport function BrandProvider({\n manifest,\n children,\n}: {\n manifest: BrandManifest;\n children: React.ReactNode;\n}) {\n useWebfont(manifest.webfont);\n return <BrandContext.Provider value={manifest}>{children}</BrandContext.Provider>;\n}\n\nexport function useBrand(): BrandManifest {\n const manifest = React.useContext(BrandContext);\n if (!manifest)\n throw new Error(\n 'useBrand: no brand in scope. Pass `brand` to GenerativePage, or wrap the tree in BrandProvider.',\n );\n return manifest;\n}\n\n/** The weights the page sets: regular, medium, semibold, bold. */\nconst WEIGHTS = '400;500;600;700';\n\nfunction useWebfont(webfont: BrandManifest['webfont']) {\n const provider = webfont?.provider;\n const family = webfont?.family;\n React.useEffect(() => {\n if (!provider || !family) return;\n const key = `${provider}:${family}`;\n if (document.head.querySelector(`link[data-brand-webfont=\"${CSS.escape(key)}\"]`)) return;\n for (const origin of ['https://fonts.googleapis.com', 'https://fonts.gstatic.com']) {\n if (document.head.querySelector(`link[rel=\"preconnect\"][href=\"${origin}\"]`)) continue;\n const preconnect = document.createElement('link');\n preconnect.rel = 'preconnect';\n preconnect.href = origin;\n if (origin.endsWith('gstatic.com')) preconnect.crossOrigin = 'anonymous';\n document.head.appendChild(preconnect);\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n // Percent-encoded, then spaces back to the `+` Google Fonts expects: a\n // family carrying an `&` would otherwise inject query parameters of its own.\n const encoded = encodeURIComponent(family).replace(/%20/g, '+');\n link.href = `https://fonts.googleapis.com/css2?family=${encoded}:wght@${WEIGHTS}&display=swap`;\n link.dataset.brandWebfont = key;\n document.head.appendChild(link);\n }, [provider, family]);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, useBoundProp, useFieldValidation } from '@json-render/react';\nimport { hasOwnProp } from '../../core/own-property';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { cn } from '../../react/utils';\nimport { Switch as SwitchPrimitive } from '../../react/ui/switch';\n\n/**\n * The renderers for the shadcn subset the catalog picks.\n *\n * They are the package's own, over the same theme tokens the kernel's controls\n * read, for the same reason the controls vendor their primitives: a consumer\n * of `./generative` installs this package and a handful of radix primitives,\n * never a component library. The DEFINITIONS these implement live in\n * `../shadcn-definitions.ts`, and `docs/dependency-budget.md` states the pair.\n *\n * A bound prop is read through `useBoundProp` and written back at the path the\n * spec named, so what the person types lands in the host's store and nowhere\n * else. An unbound one falls back to component state, which is what lets a\n * layout be rendered over an empty store while it is being read.\n */\n\ntype Check = { type: string; message: string; args?: Record<string, unknown> };\ntype ValidateOn = 'change' | 'blur' | 'submit';\n\ninterface BoundFieldProps {\n checks?: Check[] | null;\n validateOn?: ValidateOn | null;\n}\n\n/**\n * The one piece of binding every input repeats: the value the control shows,\n * the setter that writes it back, and the checks the spec attached to it.\n * `useFieldValidation` is given a binding only when there is both a path and a\n * check, so an unbound control never registers a validator the run would wait\n * on.\n */\nfunction useBoundField<T>(\n literal: T | null | undefined,\n binding: string | undefined,\n empty: T,\n { checks, validateOn }: BoundFieldProps,\n) {\n const [boundValue, setBoundValue] = useBoundProp<T>(literal ?? undefined, binding);\n const [localValue, setLocalValue] = React.useState<T>(literal ?? empty);\n const isBound = Boolean(binding);\n const hasValidation = Boolean(binding && checks?.length);\n const when = validateOn ?? 'change';\n const { errors, validate } = useFieldValidation(\n binding ?? '',\n hasValidation ? { checks: checks ?? [], validateOn: when } : undefined,\n );\n return {\n value: isBound ? (boundValue ?? empty) : localValue,\n setValue: (next: T) => {\n if (isBound) setBoundValue(next);\n else setLocalValue(next);\n },\n error: errors[0],\n validateOnChange: () => {\n if (hasValidation && when === 'change') validate();\n },\n validateOnBlur: () => {\n if (hasValidation && when === 'blur') validate();\n },\n };\n}\n\nconst LABEL = 'block text-sm leading-none font-medium';\n\nfunction FieldError({ message }: { message?: string }) {\n return message ? <p className=\"text-sm text-destructive\">{message}</p> : null;\n}\n\n/**\n * The key a closed map answers to, or the fallback.\n *\n * Every map below is keyed by a prop the catalog declares as an enum, and a\n * renderer must not trust that: an expression-valued prop skips the zod check,\n * and a `$template` with nothing to interpolate resolves to a literal, so the\n * string can be anything a layout wrote - `constructor` included, which a bare\n * lookup answers with a function off `Object.prototype`. Both gates refuse the\n * shape; the prop's own type stays the contract; this is what happens when a\n * stored artifact disagrees with it. The read is `hasOwnProp`, the kernel's one\n * spelling of an own-property read (and `Object.hasOwn` is ES2022, past the\n * package's ES2020 target), so an inherited name is not a hit; the fallback is\n * typed as one of the map's own keys.\n */\nexport function pickKey<K extends string>(\n table: Record<K, unknown>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): K {\n return key != null && hasOwnProp(table, key) ? (key as K) : fallback;\n}\n\n/** The value a closed map holds for `key`, or for the fallback when `key` is not one of its own. */\nexport function pick<K extends string, T>(\n table: Record<K, T>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): T {\n return table[pickKey(table, key, fallback)];\n}\n\n// ── Layout ──────────────────────────────────────────────────────────────────\n\nexport function Card({\n props,\n children,\n}: BaseComponentProps<{ title?: string | null; description?: string | null }>) {\n return (\n <div className=\"rounded-lg border border-border bg-card p-6 text-card-foreground\">\n {props.title || props.description ? (\n <div className=\"mb-4 space-y-1.5\">\n {props.title ? (\n <h3 className=\"text-lg leading-none font-semibold\">{props.title}</h3>\n ) : null}\n {props.description ? (\n <p className=\"text-sm text-muted-foreground\">{props.description}</p>\n ) : null}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst GAP = {\n none: 'gap-0',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n};\n\nconst ALIGN = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport function Stack({\n props,\n children,\n}: BaseComponentProps<{\n direction?: 'horizontal' | 'vertical' | null;\n gap?: keyof typeof GAP | null;\n align?: keyof typeof ALIGN | null;\n justify?: keyof typeof JUSTIFY | null;\n}>) {\n const horizontal = props.direction === 'horizontal';\n return (\n <div\n className={cn(\n 'flex',\n horizontal ? 'flex-row' : 'flex-col',\n pick(GAP, props.gap, 'md'),\n pick(ALIGN, props.align, horizontal ? 'start' : 'stretch'),\n props.justify ? pick(JUSTIFY, props.justify, 'start') : undefined,\n )}\n >\n {children}\n </div>\n );\n}\n\n/** Enumerated rather than interpolated: Tailwind compiles the class names it can see. */\nconst COLUMNS: Record<number, string> = {\n 1: 'grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-2 lg:grid-cols-3',\n 4: 'sm:grid-cols-2 lg:grid-cols-4',\n 5: 'sm:grid-cols-2 lg:grid-cols-5',\n 6: 'sm:grid-cols-2 lg:grid-cols-6',\n};\n\nexport function Grid({\n props,\n children,\n}: BaseComponentProps<{ columns?: number | null; gap?: keyof typeof GAP | null }>) {\n const columns = Math.min(Math.max(Math.round(props.columns ?? 2), 1), 6);\n return (\n <div className={cn('grid grid-cols-1', COLUMNS[columns], pick(GAP, props.gap, 'md'))}>\n {children}\n </div>\n );\n}\n\nexport function Separator({\n props,\n}: BaseComponentProps<{ orientation?: 'horizontal' | 'vertical' | null }>) {\n const vertical = props.orientation === 'vertical';\n return (\n <div\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={cn('shrink-0 bg-border', vertical ? 'h-full w-px' : 'h-px w-full')}\n />\n );\n}\n\n/**\n * `details`/`summary` rather than a disclosure primitive: the open state is the\n * element's own, which is what the catalog asks for (a page's UI state never\n * reaches `/state`), and a closed section still exists for find-in-page.\n */\nexport function Collapsible({\n props,\n children,\n}: BaseComponentProps<{ title: string; defaultOpen?: boolean | null }>) {\n return (\n <details\n className=\"rounded-md border border-border\"\n open={props.defaultOpen ?? false}\n data-slot=\"collapsible\"\n >\n <summary className=\"cursor-pointer list-none px-4 py-3 text-sm font-medium select-none\">\n {props.title}\n </summary>\n <div className=\"border-t border-border px-4 py-3\">{children}</div>\n </details>\n );\n}\n\n// ── Content ─────────────────────────────────────────────────────────────────\n\nconst HEADING = {\n h1: 'text-3xl font-bold tracking-tight',\n h2: 'text-2xl font-semibold tracking-tight',\n h3: 'text-lg font-semibold',\n h4: 'text-base font-semibold',\n};\n\nexport function Heading({\n props,\n}: BaseComponentProps<{ text: string; level?: 'h1' | 'h2' | 'h3' | 'h4' | null }>) {\n // The tag is looked up in the same closed map the class comes from, never\n // taken from the prop. `const Tag = level` made an arbitrary string a DOM tag\n // name, and a prop can carry one (`pickKey` says how): a server-rendered host\n // emitted `<script>` from a layout that passed both gates.\n const Tag = pickKey(HEADING, props.level, 'h2');\n return <Tag className={cn('text-foreground', HEADING[Tag])}>{props.text}</Tag>;\n}\n\nconst TEXT = {\n body: 'text-sm text-foreground',\n caption: 'text-xs text-muted-foreground',\n muted: 'text-sm text-muted-foreground',\n lead: 'text-lg text-muted-foreground',\n code: 'font-mono text-[13px] text-foreground',\n};\n\nexport function Text({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'body' | 'caption' | 'muted' | 'lead' | 'code' | null;\n}>) {\n return <p className={pick(TEXT, props.variant, 'body')}>{props.text}</p>;\n}\n\nconst AVATAR_SIZE = {\n sm: 'size-8 text-[11px]',\n md: 'size-10 text-xs',\n lg: 'size-12 text-sm',\n};\n\n/** Initials only: the catalog's description tells a model never to set `src`. */\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '?';\n const first = words[0]?.[0] ?? '';\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? '') : '';\n return (first + last).toUpperCase();\n}\n\nexport function Avatar({\n props,\n}: BaseComponentProps<{ name: string; size?: 'sm' | 'md' | 'lg' | null }>) {\n const name = String(props.name ?? '');\n return (\n <span\n className={cn(\n 'inline-flex shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground',\n pick(AVATAR_SIZE, props.size, 'md'),\n )}\n aria-label={name || undefined}\n role=\"img\"\n >\n {initialsOf(name)}\n </span>\n );\n}\n\nconst BADGE = {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n destructive: 'bg-destructive text-white',\n outline: 'border border-border text-foreground',\n};\n\nexport function Badge({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}>) {\n return (\n <span\n className={cn(\n 'inline-flex w-fit items-center rounded-md px-2 py-0.5 text-xs font-medium',\n pick(BADGE, props.variant, 'default'),\n )}\n >\n {props.text}\n </span>\n );\n}\n\nconst ALERT = {\n info: 'border-border bg-muted text-foreground',\n success: 'border-border bg-muted text-foreground',\n warning: 'border-border bg-muted text-foreground',\n error: 'border-destructive/50 bg-destructive/10 text-foreground',\n};\n\nexport function Alert({\n props,\n}: BaseComponentProps<{\n title: string;\n message?: string | null;\n type?: 'info' | 'success' | 'warning' | 'error' | null;\n}>) {\n const type = pickKey(ALERT, props.type, 'info');\n return (\n <div\n role={type === 'error' ? 'alert' : 'status'}\n className={cn('rounded-md border px-4 py-3 text-sm', ALERT[type])}\n >\n <p className=\"font-medium\">{props.title}</p>\n {props.message ? <p className=\"mt-1 text-muted-foreground\">{props.message}</p> : null}\n </div>\n );\n}\n\nexport function Progress({\n props,\n}: BaseComponentProps<{ value: number; max?: number | null; label?: string | null }>) {\n const max = props.max ?? 100;\n const value = Math.min(Math.max(Number(props.value) || 0, 0), max);\n const percent = max > 0 ? (value / max) * 100 : 0;\n return (\n <div className=\"space-y-1.5\">\n {props.label ? <p className=\"text-sm text-muted-foreground\">{props.label}</p> : null}\n <div\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-label={props.label ?? undefined}\n className=\"h-2 w-full overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary transition-all\" style={{ width: `${percent}%` }} />\n </div>\n </div>\n );\n}\n\n// ── Inputs ──────────────────────────────────────────────────────────────────\n\n/**\n * A stable id per mounted control, for the label that names it.\n *\n * `useId` rather than a module-level counter, for the reason\n * `src/react/field-dom-id.tsx` already gives: it is unique per instance within\n * a React root AND hydration-stable. A counter is neither. It is module state\n * that lives as long as the process, so a server module that has served earlier\n * requests is already advanced while the freshly loaded client module starts at\n * zero - and these controls carry `'use client'`, which means they are still\n * server-rendered and then hydrated. `useMemo` is documented as a hint a\n * renderer may discard, so the id was not guaranteed stable within one session\n * either; when it changed, the label stopped naming its input and the control\n * lost its accessible name, which no story test can see because none of them\n * render on a server.\n */\nexport function useControlId(name: string): string {\n return `jr-${name}-${React.useId()}`;\n}\n\nexport function Input({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n type?: 'text' | 'email' | 'password' | 'number' | null;\n placeholder?: string | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n className={cn(fieldControlClass, 'min-h-11 px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onFocus={() => emit('focus')}\n onBlur={() => {\n field.validateOnBlur();\n emit('blur');\n }}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Textarea({\n props,\n bindings,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n placeholder?: string | null;\n rows?: number | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 4}\n className={cn(fieldControlClass, 'px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onBlur={field.validateOnBlur}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Radio({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; options: string[]; value?: string | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <fieldset className=\"space-y-2\" aria-invalid={field.error ? true : undefined}>\n <legend className={LABEL}>{props.label}</legend>\n <div className=\"space-y-2\">\n {(props.options ?? []).map((option, index) => (\n <label key={`${index}-${option}`} className=\"flex items-center gap-2 text-sm\">\n <input\n type=\"radio\"\n name={id}\n value={option}\n checked={field.value === option}\n className=\"size-4 accent-primary\"\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{option}</span>\n </label>\n ))}\n </div>\n <FieldError message={field.error} />\n </fieldset>\n );\n}\n\nexport function Checkbox({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"flex items-center gap-2 text-sm\">\n <input\n id={id}\n name={props.name}\n type=\"checkbox\"\n className=\"size-4 accent-primary\"\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.checked);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{props.label}</span>\n </label>\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Switch({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-3\">\n <SwitchPrimitive\n id={id}\n name={props.name}\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onCheckedChange={(next) => {\n field.setValue(next);\n field.validateOnChange();\n emit('change');\n }}\n />\n <label htmlFor={id} className=\"text-sm\">\n {props.label}\n </label>\n </div>\n <FieldError message={field.error} />\n </div>\n );\n}\n\n// ── Actions ─────────────────────────────────────────────────────────────────\n\nconst BUTTON = {\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n danger: 'bg-destructive text-white hover:bg-destructive/90',\n};\n\nexport function Button({\n props,\n emit,\n}: BaseComponentProps<{\n label: string;\n variant?: 'primary' | 'secondary' | 'danger' | null;\n disabled?: boolean | null;\n}>) {\n return (\n <button\n type=\"button\"\n disabled={props.disabled ?? false}\n className={cn(\n 'inline-flex min-h-11 w-fit items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:pointer-events-none disabled:opacity-50',\n pick(BUTTON, props.variant, 'primary'),\n )}\n onClick={() => emit('press')}\n >\n {props.label}\n </button>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n type Components,\n useBoundProp,\n useFieldValidation,\n useRepeatScope,\n useStateStore,\n useStateValue,\n} from '@json-render/react';\nimport {\n Accessibility,\n AlertCircle,\n Baby,\n Banknote,\n BarChart3,\n Bookmark,\n Briefcase,\n Building2,\n Calendar,\n Camera,\n Car,\n CheckCircle2,\n Clock,\n Coffee,\n Coins,\n Compass,\n FileText,\n Flag,\n Gift,\n Globe,\n Hash,\n Heart,\n Home,\n Hotel,\n Hourglass,\n Image,\n Info,\n Landmark,\n Layers,\n Leaf,\n Lightbulb,\n ListChecks,\n type LucideIcon,\n Mail,\n Map,\n MapPin,\n Moon,\n Mountain,\n Music,\n Package,\n Paperclip,\n Pencil,\n Percent,\n Phone,\n Plane,\n Receipt,\n Rocket,\n Route,\n Send,\n Shield,\n Ship,\n Sparkles,\n Star,\n Sun,\n Tag,\n Ticket,\n Train,\n TrendingUp,\n Truck,\n Upload,\n User,\n Users,\n Utensils,\n Wallet,\n Zap,\n} from 'lucide-react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport type { RunField } from '../core';\nimport { FieldRenderer, ResultField, type FieldEnv } from '../react';\nimport { fieldControlClass } from '../react/field-styles';\nimport { ResultRoot } from '../react/result-location';\nimport {\n Select as SelectRoot,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../react/ui/select';\nimport { ToggleGroup, ToggleGroupItem } from '../react/ui/toggle-group';\nimport { cn } from '../react/utils';\nimport { baseCatalog, type ICON_NAMES, type METRIC_FORMATS } from './components';\nimport * as shadcn from './ui/shadcn';\nimport { inputFieldAtPath, RESULT_ROOT, resultFieldAtPath, segmentsUnder } from './paths';\n\n/**\n * The registry: what each catalog entry RENDERS as.\n *\n * The shadcn subset binds the package's own implementations. The custom\n * components are implemented here over this package's controls and vendored\n * primitives - the vocabulary of an app (Split, Tabs, Steps, Icon, Segmented,\n * NumberInput), the bound equivalents of what a model most wants to inline\n * (DataTable, Metric), and the two escape hatches the design rests on:\n *\n * - `MthdsField` renders ONE input through `FieldRenderer`, two-way at the\n * path the spec names. It is the arm for the kinds the catalog cannot\n * enter, and it is always available for a scalar the model would rather\n * not style.\n * - `MthdsResult` renders ONE result subtree through `ResultField`, reading\n * state at the path the spec names.\n *\n * Both resolve the path against the DESCRIPTOR, through `DescriptorProvider`,\n * which is what keeps rule 1: the spec names a path and nothing more, and the\n * kernel is handed the `RunField` the host already holds. A spec never\n * restates what a field is.\n */\n\nexport interface DescriptorScope {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n /** What the host injects into the controls: upload, disabled, resolver. */\n env?: FieldEnv;\n /** Prefix for the DOM ids `MthdsField` mints; two pages on one screen need two. */\n idPrefix?: string;\n}\n\nconst DescriptorContext = React.createContext<DescriptorScope>({});\n\n/** The scope the nearest `DescriptorProvider` set - for a renderer defined outside this file. */\nexport function useDescriptorScope(): DescriptorScope {\n return React.useContext(DescriptorContext);\n}\n\nexport function DescriptorProvider({\n scope,\n children,\n}: {\n scope: DescriptorScope;\n children: React.ReactNode;\n}) {\n return <DescriptorContext.Provider value={scope}>{children}</DescriptorContext.Provider>;\n}\n\nfunction Unresolved({ path, side }: { path: string; side: 'input' | 'result' }) {\n return (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/50 px-2.5 py-1.5 text-[12px] text-destructive\"\n >\n {side === 'input' ? 'No input' : 'No result'} at <span className=\"font-mono\">{path}</span>\n </p>\n );\n}\n\n/**\n * A pointer segment as one piece of a DOM id, and back.\n *\n * The id is built by joining the pointer's segments with `-`, so a segment that\n * contains a `-` of its own would make the join ambiguous: `/inputs/a-b` and\n * `/inputs/a/b` mint the same id, and the inverse below then hands a host the\n * wrong path to write an uploaded file to - plausible-looking, silent, and\n * wrong. This used to rest on a comment asserting that a field's name carries\n * no `-`; nothing here can enforce that, because a name reaches the descriptor\n * from a JSON Schema property. So the separator is escaped instead.\n *\n * `_` goes first, which is what makes the pass unambiguous: every `_` in the\n * output that is not one this function wrote has already been doubled, so the\n * single left-to-right decode below cannot mistake one for the other. Names\n * without `_`, `-` or `~` - which is every name in practice - pass through\n * untouched, so the ids this mints are the ids it always minted.\n */\nfunction encodeSegment(segment: string): string {\n return segment.replace(/_/g, '_u').replace(/-/g, '_d').replace(/~/g, '_t');\n}\n\nfunction decodeSegment(segment: string): string {\n return segment.replace(/_([udt])/g, (_match, code: string) =>\n code === 'u' ? '_' : code === 'd' ? '-' : '~',\n );\n}\n\n/**\n * Exported for the round-trip test only, not from the entry's index: the pair\n * is only correct together, so a test that could see just one half of it would\n * be no guard at all.\n */\nexport function domIdFor(prefix: string | undefined, path: string): string {\n return `${prefix ?? 'gen'}${path.split('/').map(encodeSegment).join('-')}`;\n}\n\n/**\n * The inverse of `domIdFor`, for a host's upload seam: the kernel reports a\n * drop by the DOM id of the field it landed on, which for a nested one is the\n * hatch's id with the child's name or index joined by `.` (the kernel's own\n * composition, `FieldRenderer` through `ObjectField` and `ListField`), and\n * the host writes the file at the store path that id was minted from. Kept\n * beside `domIdFor` so the two cannot drift, and exact for any name by\n * construction rather than by assumption.\n */\nexport function pathFromDomId(prefix: string | undefined, id: string): string | undefined {\n const head = prefix ?? 'gen';\n if (!id.startsWith(head)) return undefined;\n const [own = '', ...children] = id.slice(head.length).split('.');\n if (!own.startsWith('-')) return undefined;\n const path = own.split('-').map(decodeSegment).join('/');\n return `${path}${children.map((child) => `/${child}`).join('')}`;\n}\n\n/**\n * The path a hatch resolves: absolute as written, or, inside a repeat, the\n * item's field name joined onto the current item's base path. A relative path\n * outside any repeat resolves to nothing, and the hatch says so.\n */\nfunction useAbsolutePath(path: string): string | undefined {\n const repeat = useRepeatScope();\n if (path.startsWith('/')) return path;\n // Raw, not `joinPath`: the same reason `absoluteHatchPath` gives - a relative\n // hatch path may name several segments, so its `/` are separators already.\n return repeat ? `${repeat.basePath}/${path}` : undefined;\n}\n\n// ─── The escape hatches ──────────────────────────────────────────────────────\n\nfunction MthdsField({ props }: BaseComponentProps<{ path: string }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.inputs && path ? inputFieldAtPath(scope.inputs, path) : undefined;\n const value = useStateValue<unknown>(path);\n const { set } = useStateStore();\n const onChange = React.useCallback((next: unknown) => set(path, next), [set, path]);\n if (!field) return <Unresolved path={props.path} side=\"input\" />;\n return (\n <FieldRenderer\n field={field}\n value={value}\n onChange={onChange}\n id={domIdFor(scope.idPrefix, path)}\n env={scope.env}\n />\n );\n}\n\nfunction MthdsResult({ props }: BaseComponentProps<{ path: string; hideLabel?: boolean | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.result && path ? resultFieldAtPath(scope.result, path) : undefined;\n const value = useStateValue<unknown>(path);\n if (!field || !scope.result) return <Unresolved path={props.path} side=\"result\" />;\n // The subtree's place in the whole result, so a file inside it saves under\n // the name the whole-result download gives it. Left to itself, `ResultField`\n // would root the location at its own node's name, and every entry of a\n // repeat would save as `image.png`.\n const place = [scope.result.name, ...(segmentsUnder(RESULT_ROOT, path) ?? [])];\n return (\n <ResultRoot baseName={scope.result.name} path={place}>\n <ResultField field={field} value={value} hideLabel={props.hideLabel ?? false} />\n </ResultRoot>\n );\n}\n\n// ─── A Select with an accessible name ────────────────────────────────────────\n\ninterface SelectProps {\n label: string;\n name: string;\n options: string[];\n placeholder?: string | null;\n value?: string | null;\n checks?: { type: string; message: string; args?: Record<string, unknown> }[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction AccessibleSelect({ props, bindings, emit }: BaseComponentProps<SelectProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'change';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useFieldValidation(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <SelectRoot\n value={value}\n onValueChange={(next) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n emit('change');\n }}\n >\n <SelectTrigger id={id} className=\"w-full\">\n <SelectValue placeholder={props.placeholder ?? 'Select...'} />\n </SelectTrigger>\n <SelectContent>\n {/* Written exactly as listed. The primitive throws on an empty value,\n and the fallback that used to stand in for one wrote a value the\n descriptor's enum never listed; the definition refuses an empty\n option now, upstream of every renderer. */}\n {(props.options ?? []).map((option, index) => (\n <SelectItem key={`${index}-${option}`} value={option}>\n {option}\n </SelectItem>\n ))}\n </SelectContent>\n </SelectRoot>\n {errors.length > 0 ? <p className=\"text-sm text-destructive\">{errors[0]}</p> : null}\n </div>\n );\n}\n\n// ─── The bound equivalents of what a model most wants to inline ──────────────\n\nfunction valueAt(row: unknown, relativePath: string): unknown {\n let current: unknown = row;\n for (const segment of relativePath.split('/').filter((part) => part.length > 0)) {\n if (typeof current !== 'object' || current === null) return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** A cell shows a number as it is: grouped, with the places it has, never padded. */\nconst CELL_NUMBER = new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 });\n\nfunction formatCell(value: unknown): string {\n if (value === null || value === undefined || value === '') return '—';\n if (typeof value === 'boolean') return value ? 'yes' : 'no';\n if (typeof value === 'number') return CELL_NUMBER.format(value);\n if (typeof value === 'string') return value;\n if (Array.isArray(value)) return value.map(formatCell).join(', ');\n return JSON.stringify(value);\n}\n\ninterface DataTableProps {\n rows: unknown;\n columns: { path: string; label: string }[];\n caption?: string | null;\n}\n\nfunction DataTable({ props }: BaseComponentProps<DataTableProps>) {\n const rows = Array.isArray(props.rows) ? props.rows : [];\n const columns = props.columns ?? [];\n return (\n <div className=\"overflow-x-auto rounded-md border border-border\">\n <table className=\"w-full min-w-full border-collapse text-[13px]\">\n {props.caption ? (\n <caption className=\"px-2.5 py-1.5 text-start text-[12px] text-muted-foreground\">\n {props.caption}\n </caption>\n ) : null}\n <thead>\n <tr className=\"border-b border-border bg-muted\">\n {columns.map((column) => (\n <th\n key={column.path}\n scope=\"col\"\n className=\"whitespace-nowrap px-2.5 py-1.5 text-start font-semibold text-foreground\"\n >\n {column.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => (\n <tr key={index} className=\"border-b border-border/60 last:border-b-0\">\n {columns.map((column) => (\n <td key={column.path} className=\"px-2.5 py-1.5 align-top text-foreground\">\n {formatCell(valueAt(row, column.path))}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\ntype MetricFormat = (typeof METRIC_FORMATS)[number];\n\nfunction numberFormat(format: MetricFormat): Intl.NumberFormat {\n switch (format) {\n case 'integer':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });\n case 'decimal':\n return new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n case 'compact':\n return new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 });\n case 'plain':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 20, useGrouping: false });\n default:\n return format satisfies never;\n }\n}\n\ninterface MetricProps {\n label: string;\n value: unknown;\n unit?: string | null;\n format?: MetricFormat | null;\n}\n\nfunction Metric({ props }: BaseComponentProps<MetricProps>) {\n const value = props.value;\n const text =\n typeof value === 'number'\n ? numberFormat(props.format ?? 'plain').format(value)\n : value === null || value === undefined || value === ''\n ? '—'\n : String(value);\n return (\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wider text-muted-foreground\">\n {props.label}\n </span>\n <span className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {text}\n {props.unit ? (\n <span className=\"ml-1 text-sm font-normal text-muted-foreground\">{props.unit}</span>\n ) : null}\n </span>\n </div>\n );\n}\n\n// ─── The vocabulary of an app ────────────────────────────────────────────────\n\ntype SplitRatio = '1:1' | '1:2' | '2:1';\n\nconst SPLIT_COLUMNS: Record<SplitRatio, string> = {\n '1:1': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]',\n '1:2': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]',\n '2:1': 'sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]',\n};\n\nconst SPLIT_GAP: Record<'md' | 'lg' | 'xl', string> = { md: 'gap-4', lg: 'gap-6', xl: 'gap-8' };\n\n/** Two columns from two children, stacking under the `sm` breakpoint. */\nfunction Split({\n props,\n children,\n}: BaseComponentProps<{ ratio?: SplitRatio | null; gap?: 'md' | 'lg' | 'xl' | null }>) {\n return (\n <div\n className={cn(\n 'grid grid-cols-1 items-start',\n shadcn.pick(SPLIT_COLUMNS, props.ratio, '1:2'),\n shadcn.pick(SPLIT_GAP, props.gap, 'lg'),\n )}\n >\n {children}\n </div>\n );\n}\n\ninterface TabsProps {\n tabs: { label: string; value: string }[];\n}\n\n/**\n * Tabs whose panels follow the active tab - the reason shadcn's is not in the\n * catalog. The nth child is the nth tab's panel; the active tab is local\n * state, so a spec never touches /state for it. Radix unmounts an inactive\n * panel, and the inputs in it keep their values in the store.\n */\nfunction Tabs({ props, children }: BaseComponentProps<TabsProps>) {\n const tabs = props.tabs ?? [];\n const panels = React.Children.toArray(children);\n const [value, setValue] = React.useState(tabs[0]?.value ?? '');\n return (\n <TabsPrimitive.Root value={value} onValueChange={setValue} className=\"w-full\">\n <TabsPrimitive.List className=\"inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground\">\n {tabs.map((tab) => (\n <TabsPrimitive.Trigger\n key={tab.value}\n value={tab.value}\n className=\"inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\"\n >\n {tab.label}\n </TabsPrimitive.Trigger>\n ))}\n </TabsPrimitive.List>\n {tabs.map((tab, index) => (\n <TabsPrimitive.Content\n key={tab.value}\n value={tab.value}\n className=\"mt-4 focus-visible:outline-hidden\"\n >\n {panels[index] ?? null}\n </TabsPrimitive.Content>\n ))}\n </TabsPrimitive.Root>\n );\n}\n\nconst BUTTON_BASE =\n 'inline-flex h-10 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50';\nconst PRIMARY_BUTTON = cn(BUTTON_BASE, 'bg-primary text-primary-foreground hover:bg-primary/90');\nconst SECONDARY_BUTTON = cn(\n BUTTON_BASE,\n 'border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground',\n);\n\ninterface StepsProps {\n steps: string[];\n nextLabel?: string | null;\n backLabel?: string | null;\n}\n\n/**\n * A journey: a numbered indicator, one panel at a time, and its own Back and\n * Next. The nth child is the nth step's panel; the spec's one Button sits\n * inside the last one, which is why Next disappears there. The current step\n * is local state. A hidden panel is unmounted, and its inputs keep their\n * values in the store - a step hides from the eye, never from the run.\n */\nfunction Steps({ props, children }: BaseComponentProps<StepsProps>) {\n const steps = props.steps ?? [];\n const panels = React.Children.toArray(children);\n const [index, setIndex] = React.useState(0);\n const last = steps.length - 1;\n return (\n <div className=\"flex flex-col gap-5\">\n <ol className=\"flex flex-wrap items-center gap-x-5 gap-y-2\">\n {steps.map((label, position) => (\n <li\n key={`${position}-${label}`}\n aria-current={position === index ? 'step' : undefined}\n className={cn(\n 'flex items-center gap-2 text-sm',\n position === index ? 'font-medium text-foreground' : 'text-muted-foreground',\n )}\n >\n <span\n className={cn(\n 'flex h-6 w-6 items-center justify-center rounded-full text-[12px] font-semibold tabular-nums',\n position < index\n ? 'bg-primary/15 text-primary'\n : position === index\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground',\n )}\n >\n {position + 1}\n </span>\n {label}\n </li>\n ))}\n </ol>\n <div>{panels[index] ?? null}</div>\n {index > 0 || index < last ? (\n <div className=\"flex items-center justify-between gap-3\">\n {index > 0 ? (\n <button\n type=\"button\"\n data-testid=\"steps-back\"\n onClick={() => setIndex((current) => Math.max(0, current - 1))}\n className={SECONDARY_BUTTON}\n >\n {props.backLabel ?? 'Back'}\n </button>\n ) : (\n <span />\n )}\n {index < last ? (\n <button\n type=\"button\"\n data-testid=\"steps-next\"\n onClick={() => setIndex((current) => Math.min(last, current + 1))}\n className={PRIMARY_BUTTON}\n >\n {props.nextLabel ?? 'Next'}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\ntype IconName = (typeof ICON_NAMES)[number];\n\n/** The closed list the catalog names, each bound to its lucide component. */\nconst ICONS: Record<IconName, LucideIcon> = {\n Sparkles,\n Rocket,\n Compass,\n Map,\n MapPin,\n Route,\n Plane,\n Train,\n Car,\n Ship,\n Hotel,\n Home,\n Building2,\n Landmark,\n Globe,\n Mountain,\n Leaf,\n Sun,\n Moon,\n Calendar,\n Clock,\n Hourglass,\n Users,\n User,\n Baby,\n Accessibility,\n Heart,\n Star,\n Utensils,\n Coffee,\n Music,\n Camera,\n Image,\n Ticket,\n Gift,\n Wallet,\n Banknote,\n Coins,\n Receipt,\n Percent,\n Hash,\n TrendingUp,\n BarChart3,\n FileText,\n Upload,\n Paperclip,\n Mail,\n Phone,\n Tag,\n Layers,\n ListChecks,\n CheckCircle2,\n AlertCircle,\n Info,\n Shield,\n Flag,\n Bookmark,\n Briefcase,\n Package,\n Truck,\n Lightbulb,\n Zap,\n Pencil,\n Send,\n};\n\n/** Decorative: hidden from assistive technology, because it carries no text. */\nfunction Icon({ props }: BaseComponentProps<{ name: IconName; size?: 'sm' | 'md' | 'lg' | null }>) {\n const Glyph = ICONS[props.name];\n if (!Glyph) return null;\n const size = props.size === 'lg' ? 'h-7 w-7' : props.size === 'sm' ? 'h-4 w-4' : 'h-5 w-5';\n return <Glyph aria-hidden=\"true\" className={cn(size, 'shrink-0 text-muted-foreground')} />;\n}\n\ninterface SegmentedProps {\n label: string;\n name: string;\n options: string[];\n value?: string | null;\n}\n\n/**\n * A choice as a row of pills, over the package's own toggle group. The group\n * is named by its visible label; each pill is a button with its option as its\n * text. Deselecting is ignored, as shadcn's toggle group does, so the bound\n * path never holds an empty string.\n */\nfunction Segmented({ props, bindings, emit }: BaseComponentProps<SegmentedProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const labelId = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <span id={labelId} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </span>\n <ToggleGroup\n type=\"single\"\n aria-labelledby={labelId}\n value={value}\n onValueChange={(next: string) => {\n if (!next) return;\n setValue(next);\n emit('change');\n }}\n className=\"flex-wrap justify-start gap-1.5\"\n >\n {(props.options ?? []).map((option) => (\n <ToggleGroupItem\n key={option}\n value={option}\n variant=\"outline\"\n size=\"sm\"\n className=\"rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground\"\n >\n {option}\n </ToggleGroupItem>\n ))}\n </ToggleGroup>\n </div>\n );\n}\n\ninterface NumberInputProps {\n label: string;\n name: string;\n value?: number | null;\n placeholder?: string | null;\n unit?: string | null;\n min?: number | null;\n max?: number | null;\n step?: number | null;\n}\n\n/**\n * A figure that writes a NUMBER to state - the gap Checkpoint 3 recorded\n * against shadcn's `Input type=\"number\"`, which writes the DOM's string. An\n * emptied field writes `undefined`, which the kernel's readiness reads as\n * absent, exactly as its own number control does.\n */\nfunction NumberInput({ props, bindings, emit }: BaseComponentProps<NumberInputProps>) {\n const [boundValue, setBoundValue] = useBoundProp<number | undefined>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState<number | undefined>(undefined);\n const isBound = Boolean(bindings?.value);\n const value = isBound ? boundValue : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id={id}\n type=\"number\"\n inputMode=\"decimal\"\n value={typeof value === 'number' ? value : ''}\n min={props.min ?? undefined}\n max={props.max ?? undefined}\n step={props.step ?? 'any'}\n placeholder={props.placeholder ?? undefined}\n onChange={(event) => {\n const raw = event.target.value;\n setValue(raw === '' ? undefined : Number(raw));\n emit('change');\n }}\n className={cn(\n fieldControlClass,\n 'h-10 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none',\n )}\n />\n {props.unit ? <span className=\"text-sm text-muted-foreground\">{props.unit}</span> : null}\n </div>\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/**\n * Each renderer is MOUNTED rather than called: they are React components that\n * use hooks, and a render function calling hooks itself would run them inside\n * the registry's wrapper and break the moment the wrapper re-ordered them.\n */\nconst components: Components<typeof baseCatalog> = {\n Card: (ctx) => <shadcn.Card {...ctx} />,\n // A vertical Stack stretches its children unless the spec says otherwise:\n // hugging the content is the one layout a result page never wants, since a\n // table or a grid inside it would stop short of the page's width.\n Stack: (ctx) => <shadcn.Stack {...ctx} />,\n Grid: (ctx) => <shadcn.Grid {...ctx} />,\n Separator: (ctx) => <shadcn.Separator {...ctx} />,\n Collapsible: (ctx) => <shadcn.Collapsible {...ctx} />,\n Heading: (ctx) => <shadcn.Heading {...ctx} />,\n Text: (ctx) => <shadcn.Text {...ctx} />,\n Badge: (ctx) => <shadcn.Badge {...ctx} />,\n Alert: (ctx) => <shadcn.Alert {...ctx} />,\n Progress: (ctx) => <shadcn.Progress {...ctx} />,\n Avatar: (ctx) => <shadcn.Avatar {...ctx} />,\n Input: (ctx) => <shadcn.Input {...ctx} />,\n Textarea: (ctx) => <shadcn.Textarea {...ctx} />,\n // A plain label beside a trigger leaves the trigger with no accessible name,\n // which axe reports as a button without one (`a11y` runs at error). This one\n // is the package's own vendored select under a label that names the trigger.\n Select: (ctx) => <AccessibleSelect {...ctx} />,\n Radio: (ctx) => <shadcn.Radio {...ctx} />,\n Checkbox: (ctx) => <shadcn.Checkbox {...ctx} />,\n Switch: (ctx) => <shadcn.Switch {...ctx} />,\n Button: (ctx) => <shadcn.Button {...ctx} />,\n Split: (ctx) => <Split {...ctx} />,\n Tabs: (ctx) => <Tabs {...ctx} />,\n Steps: (ctx) => <Steps {...ctx} />,\n Icon: (ctx) => <Icon {...ctx} />,\n Segmented: (ctx) => <Segmented {...ctx} />,\n NumberInput: (ctx) => <NumberInput {...ctx} />,\n // Ours are React components (they use hooks), so each is MOUNTED rather than\n // called: a render function that called hooks itself would run them inside\n // the registry's wrapper and break the moment the wrapper re-ordered them.\n MthdsField: (ctx) => <MthdsField {...ctx} />,\n MthdsResult: (ctx) => <MthdsResult {...ctx} />,\n DataTable: (ctx) => <DataTable {...ctx} />,\n Metric: (ctx) => <Metric {...ctx} />,\n};\n\n/** The renderers, for the registry over the catalog that extends this vocabulary. */\nexport const generativeRenderers = components;\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What the page paints under the work column, when there is anything to paint.\n *\n * No spec names a result: the layout a model writes is the INPUT page, and the\n * result has shapes of its own. So the page leaves a slot instead, and the host\n * fills it with whatever the run yielded - the kernel's own viewer over the\n * output descriptor, a line while the run is in flight, a failure. The slot is\n * a React node and nothing more: this entry knows how to place it in the page's\n * grammar and nothing about how a run is started, followed or delivered.\n *\n * A host that provides nothing gets a page with no result section at all, which\n * is what an input page is before its first run.\n */\n\nexport interface ResultSlot {\n /** What to paint. Nothing is painted at all while this is absent or `null`. */\n content: React.ReactNode;\n /** The heading above it. \"Result\" unless the host names it. */\n title?: string;\n}\n\nconst ResultSlotContext = React.createContext<ResultSlot | null>(null);\n\nexport function ResultSlotProvider({\n slot,\n children,\n}: {\n slot: ResultSlot | null;\n children: React.ReactNode;\n}) {\n return <ResultSlotContext.Provider value={slot}>{children}</ResultSlotContext.Provider>;\n}\n\n/** The slot the nearest page provides, or `null` on a page with no result yet. */\nexport function useResultSlot(): ResultSlot | null {\n return React.useContext(ResultSlotContext);\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n defineRegistry,\n useBoundProp,\n useFieldValidation,\n} from '@json-render/react';\nimport { fieldControlClass } from '../react/field-styles';\nimport { cn } from '../react/utils';\nimport { useBrand } from './brand-context';\nimport { catalog } from './catalog';\nimport { generativeRenderers } from './registry';\nimport { useResultSlot } from './result-slot';\nimport { useControlId } from './ui/shadcn';\n\n/**\n * What the brand catalog's components RENDER as - the product page's chrome,\n * over the same tokens the kernel's controls read, and over NOTHING else: no\n * literal colour, no literal radius, no literal typeface. The rail's panel is\n * `bg-card` on `border-border`, a hairline is `border-border`, the call to\n * action's glow is the accent composed with `color-mix()`, the corners are\n * `--radius` and its multiples, a tag is `font-mono`, the logo is the\n * manifest's pair. The running text names no face at all: it inherits the\n * page's, which a brand's compiled stylesheet sets on its scope from\n * `--font-sans` (docs/brand.md). That is what lets one set of components\n * render any brand the `./brand` entry compiles - and what makes anything the\n * tokens cannot state absent from the page by construction.\n *\n * The layer's renderers are reused as they are; two of shadcn's are replaced\n * (`Input`, `Textarea`) so that every text field on the page is drawn on the\n * kernel's own control surface (`fieldControlClass`) and reads as one family\n * with the dates, the lists and the upload the kernel renders itself.\n *\n * Nothing here reads a schema - a brand component takes copy and bound values,\n * and that is all.\n */\n\nconst CONTAINER = 'mx-auto w-full max-w-6xl px-6 sm:px-8';\n\n/** The kernel's app-presentation label, so a brand field and a kernel field read alike. */\nconst LABEL = 'block text-[13.5px] leading-none font-medium text-foreground';\n\n// ─── The page's chrome ───────────────────────────────────────────────────────\n\ninterface AppBarProps {\n app: string;\n links?: string[] | null;\n tag?: string | null;\n}\n\nfunction AppBar({ props }: BaseComponentProps<AppBarProps>) {\n const brand = useBrand();\n return (\n <header className=\"border-b border-border\">\n <div className={cn(CONTAINER, 'flex h-16 items-center gap-5')}>\n {/* `no-referrer` on both, as on every image this package paints: the\n scheme is already checked where the manifest is parsed, and a brand\n asset has no more business learning where it was drawn than a\n payload's picture does.\n\n This pair is the one place a `dark:` variant and the token fallbacks\n disagree. A fallback is frozen per utility and cannot vary by scope,\n so a host that defines no tokens renders LIGHT inside `.dark` - but\n the variant still flips, so that host gets the dark-ground asset on\n a light surface. Documented in `docs/theming.md` rather than worked\n around: the swap is right for every host that defines tokens, which\n is every host that sets `.dark` deliberately. */}\n <img\n src={brand.logo.onLight}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"h-7 w-auto dark:hidden\"\n />\n <img\n src={brand.logo.onDark}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"hidden h-7 w-auto dark:block\"\n />\n <span aria-hidden=\"true\" className=\"h-5 w-px bg-border\" />\n <span className=\"text-sm font-medium text-foreground/80\">{props.app}</span>\n {/* `min-w-0` down to the pill: a pipe's code is one long word, and\n at phone width an unshrinkable pill pushed the row past the viewport. */}\n <div className=\"ml-auto flex min-w-0 items-center gap-6\">\n {props.links && props.links.length > 0 ? (\n <nav aria-label=\"Site\" className=\"hidden items-center gap-6 sm:flex\">\n {props.links.map((link) => (\n <a\n key={link}\n href=\"#\"\n onClick={(event) => event.preventDefault()}\n className=\"text-sm text-muted-foreground transition-colors hover:text-foreground\"\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {props.tag ? (\n <span className=\"min-w-0 truncate rounded-lg border border-primary/40 bg-primary/10 px-2.5 py-1 font-mono text-[11px] text-primary\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </div>\n </header>\n );\n}\n\ninterface HeroProps {\n headline: string;\n lede?: string | null;\n eyebrow?: string | null;\n}\n\nfunction Hero({ props }: BaseComponentProps<HeroProps>) {\n return (\n <section className=\"pt-12 pb-10 sm:pt-14 sm:pb-12\">\n {props.eyebrow ? (\n <p className=\"mb-4 text-[11px] font-medium tracking-[0.15em] text-primary uppercase\">\n {props.eyebrow}\n </p>\n ) : null}\n <h1 className=\"max-w-2xl text-4xl font-bold tracking-tight text-foreground sm:text-[44px] sm:leading-[1.15]\">\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-4 max-w-2xl text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </section>\n );\n}\n\nfunction Workspace({ props, children }: BaseComponentProps<{ rail?: 'right' | 'left' | null }>) {\n const [work, rail] = React.Children.toArray(children);\n const railLeft = props.rail === 'left';\n return (\n <div\n className={cn(\n CONTAINER,\n 'grid grid-cols-1 gap-10 pb-16 lg:gap-14',\n railLeft ? 'lg:grid-cols-[360px_minmax(0,1fr)]' : 'lg:grid-cols-[minmax(0,1fr)_360px]',\n )}\n >\n <div className={cn('min-w-0', railLeft && 'lg:order-2')}>\n {work}\n <ResultPanel />\n </div>\n <aside\n className={cn(\n 'lg:sticky lg:top-6 lg:self-start lg:pt-12 sm:lg:pt-14',\n railLeft && 'lg:order-1',\n )}\n >\n {rail}\n </aside>\n </div>\n );\n}\n\n/**\n * What the host paints under the work column, in the page's own grammar and\n * in the container it gives everything else. No spec names it - no layout was\n * written for a result - so the page leaves the slot and places what it is\n * given; an input page before its first run is given nothing and shows none of\n * this.\n */\nfunction ResultPanel() {\n const slot = useResultSlot();\n if (!slot?.content) return null;\n return (\n <section className=\"border-t border-border py-9\" data-testid=\"result-panel\" aria-live=\"polite\">\n <h2 className=\"mb-6 text-xl font-semibold tracking-tight text-foreground\">\n {slot.title ?? 'Result'}\n </h2>\n {slot.content}\n </section>\n );\n}\n\ninterface SectionProps {\n number?: string | null;\n title: string;\n lede?: string | null;\n}\n\nfunction Section({ props, children }: BaseComponentProps<SectionProps>) {\n return (\n <section className=\"border-t border-border py-9 first:border-t-0 first:pt-0\">\n <div className=\"mb-6\">\n <div className=\"flex items-baseline gap-3\">\n {props.number ? (\n <span className=\"font-mono text-[12px] text-primary\">{props.number}</span>\n ) : null}\n <h2 className=\"text-xl font-semibold tracking-tight text-foreground\">{props.title}</h2>\n </div>\n {props.lede ? <p className=\"mt-1.5 text-sm text-muted-foreground\">{props.lede}</p> : null}\n </div>\n {/* The rules put a concern's inputs flat inside the Section, so the\n Section spaces them: the gap the hand-written spec's Stack gave its. */}\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n\nfunction Rail({ props, children }: BaseComponentProps<{ title: string }>) {\n return (\n // An arbitrary value reads the token directly, so it does NOT go through\n // the `@theme inline` mapping and does not inherit its fallback - it has to\n // carry its own, or a host that defines no tokens loses the declaration\n // outright. See src/styles/tailwind-entry.css.\n <div className=\"rounded-[calc(var(--radius,0.5rem)*1.5)] border border-border bg-card p-7 text-card-foreground shadow-xl\">\n <h2 className=\"text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase\">\n {props.title}\n </h2>\n <div className=\"mt-4 flex flex-col\">{children}</div>\n </div>\n );\n}\n\ninterface SummaryRowProps {\n label: string;\n value?: unknown;\n detail?: unknown;\n separator?: string | null;\n placeholder?: string | null;\n}\n\nfunction present(value: unknown): value is string | number | boolean {\n return value !== undefined && value !== null && value !== '';\n}\n\nfunction SummaryRow({ props }: BaseComponentProps<SummaryRowProps>) {\n const text = [props.value, props.detail]\n .filter(present)\n .map(String)\n .join(props.separator ?? ' ');\n return (\n <div className=\"flex items-baseline justify-between gap-4 border-b border-border/60 py-3 first:pt-0 last:border-b-0\">\n <span className=\"shrink-0 text-[13px] text-muted-foreground\">{props.label}</span>\n {text ? (\n <span className=\"text-right text-[13px] font-medium text-foreground\">{text}</span>\n ) : (\n <span className=\"text-[13px] text-muted-foreground/50\">{props.placeholder ?? '—'}</span>\n )}\n </div>\n );\n}\n\nfunction Cta({ props, emit }: BaseComponentProps<{ label: string; hint?: string | null }>) {\n return (\n <div className=\"mt-6\">\n <button\n type=\"button\"\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground',\n // The fallback is not decoration here either - see Rail above.\n 'shadow-[0_0_28px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_35%,transparent)] transition-all hover:bg-primary/90 hover:shadow-[0_0_44px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_50%,transparent)]',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden',\n )}\n >\n {props.label}\n </button>\n {props.hint ? (\n <p className=\"mt-3 text-center text-[12px] leading-relaxed text-muted-foreground\">\n {props.hint}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction Footer({ props }: BaseComponentProps<{ text: string; tag?: string | null }>) {\n return (\n <footer className=\"border-t border-border\">\n <div\n className={cn(\n CONTAINER,\n // Wraps, and the tag may break anywhere: a pipe's code is one long\n // word, and at phone width an unbreakable one widened the document\n // past the viewport.\n 'flex flex-wrap items-center justify-between gap-x-6 gap-y-2 py-6 text-[12px] text-muted-foreground',\n )}\n >\n <span>{props.text}</span>\n {props.tag ? (\n <span className=\"min-w-0 font-mono text-[11px] tracking-wider break-all text-muted-foreground/70 uppercase\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </footer>\n );\n}\n\n// ─── Text fields on the kernel's own surface ─────────────────────────────────\n\ninterface Check {\n type: string;\n message: string;\n args?: Record<string, unknown>;\n}\n\ninterface TextFieldProps {\n label: string;\n name: string;\n placeholder?: string | null;\n value?: string | null;\n checks?: Check[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction useTextField(\n props: TextFieldProps,\n bindings: BaseComponentProps<TextFieldProps>['bindings'],\n) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'blur';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useFieldValidation(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const onChange = (next: string) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n };\n const onBlur = () => {\n if (hasValidation && validateOn === 'blur') validate();\n };\n return { value, errors, onChange, onBlur };\n}\n\nfunction BrandInput({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n TextFieldProps & { type?: 'text' | 'email' | 'password' | 'number' | null }\n>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={() => {\n field.onBlur();\n emit('blur');\n }}\n onFocus={() => emit('focus')}\n onKeyDown={(event) => {\n if (event.key === 'Enter') emit('submit');\n }}\n className={cn(fieldControlClass, 'h-11 px-3.5')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BrandTextarea({\n props,\n bindings,\n}: BaseComponentProps<TextFieldProps & { rows?: number | null }>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 3}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={field.onBlur}\n className={cn(fieldControlClass, 'px-3.5 py-2.5 leading-relaxed')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/** What `defineRegistry` takes for this catalog. */\ntype RegistryOptions = Parameters<typeof defineRegistry<typeof catalog>>[1];\n\n/**\n * The registry over the product catalog: components only. `run` is supplied\n * by `GenerativePage`, which hands it to `JSONUIProvider` as a handler closing\n * over the host's `onRun`, or by a host's own provider; json-render's type\n * asks for an `actions` entry because the catalog declares one, but only the\n * `handlers` factory this destructure discards would ever read it, so the\n * entry is stated absent rather than filled with a no-op a reader would take\n * for the handler.\n *\n * Its `AppBar` reads the brand, so the page it renders in needs one:\n * `GenerativePage`'s `brand` prop, or a `BrandProvider` above the tree.\n */\nexport const { registry: generativeRegistry } = defineRegistry(catalog, {\n components: {\n ...generativeRenderers,\n Input: (ctx) => <BrandInput {...ctx} />,\n Textarea: (ctx) => <BrandTextarea {...ctx} />,\n AppBar: (ctx) => <AppBar {...ctx} />,\n Hero: (ctx) => <Hero {...ctx} />,\n Workspace: (ctx) => <Workspace {...ctx} />,\n Section: (ctx) => <Section {...ctx} />,\n Rail: (ctx) => <Rail {...ctx} />,\n SummaryRow: (ctx) => <SummaryRow {...ctx} />,\n Cta: (ctx) => <Cta {...ctx} />,\n Footer: (ctx) => <Footer {...ctx} />,\n },\n} as RegistryOptions);\n","'use client';\n\nimport * as React from 'react';\nimport type { Spec, StateModel, StateStore } from '@json-render/core';\nimport { JSONUIProvider, Renderer } from '@json-render/react';\nimport { BrandProvider } from './brand-context';\nimport type { BrandManifest } from '../brand/manifest';\nimport { generativeRegistry } from './product-registry';\nimport { DescriptorProvider, type DescriptorScope } from './registry';\n\n/** What a page renders through: this entry's registry unless a host brings its own. */\nexport type PageRegistry = React.ComponentProps<typeof Renderer>['registry'];\n\nexport interface GenerativePageProps {\n /** The layout to render; `null` while a stream has produced nothing yet. */\n spec: Spec | null;\n /** The state the layout binds to. The host owns it; the page reads and writes it. */\n store: StateStore;\n /** The descriptor the escape hatches resolve paths against. */\n scope: DescriptorScope;\n /** What `run` does. Receives the state at the moment the call to action was pressed. */\n onRun?: (state: StateModel) => void;\n /** Whether a stream is still arriving. */\n loading?: boolean;\n /** A registry over a catalog that extends this entry's, when a host has one. */\n registry?: PageRegistry;\n /**\n * The brand the product chrome renders: the app bar's logo pair and name,\n * the web font. Required by this entry's own registry, whose `AppBar` reads\n * it - without one the bar throws, json-render's element boundary drops it\n * from the page, and the console names the cure. A host registry with no\n * brand components may omit it.\n */\n brand?: BrandManifest;\n}\n\n/**\n * One generative page: providers, registry and renderer wired together.\n *\n * The store is CONTROLLED - the host creates it, seeds it (`seedInputs`) and\n * reads it back to start the run - so what the page writes is exactly what the\n * kernel's readiness is computed from, and generation is nowhere in the\n * request path: a layout is a data file, and this renders it.\n */\nexport function GenerativePage({\n spec,\n store,\n scope,\n onRun,\n loading,\n registry = generativeRegistry,\n brand,\n}: GenerativePageProps) {\n // The scope reaches every control through context, so a fresh object on each\n // render re-renders every field on the page - and a host naturally writes it\n // as a literal beside the store it just read. Memoised on its members, so an\n // inline `scope={{ inputs: fields, env }}` costs a keystroke nothing. Rebuilt\n // from the members it names rather than returning `scope` itself, so no\n // member this list leaves out can be frozen at its first value: a required\n // member added to `DescriptorScope` is a type error here, and an optional one\n // is at least legible as absent from the literal.\n const { inputs, result, env, idPrefix } = scope;\n const stableScope = React.useMemo<DescriptorScope>(\n () => ({ inputs, result, env, idPrefix }),\n [inputs, result, env, idPrefix],\n );\n // json-render's `ActionProvider` reads `handlers` ONCE, into a `useState`,\n // and never looks at the prop again - so a handler object rebuilt on a new\n // `onRun` or `store` was rebuilt for nobody, and Run kept calling the\n // callback and reading the store from the first render. A host writes\n // `onRun` as an inline closure over its own state as naturally as it writes\n // the scope literal above, and every one of those closures after the first\n // went unused. So the handler is created once and reads the latest pair\n // through a ref, which is refreshed after each commit; the handler only ever\n // fires from a click, which is after the commit that installed the values.\n const latest = React.useRef({ onRun, store });\n React.useEffect(() => {\n latest.current = { onRun, store };\n });\n const [handlers] = React.useState(() => ({\n run: () => {\n latest.current.onRun?.(latest.current.store.getSnapshot());\n },\n }));\n const page = (\n <DescriptorProvider scope={stableScope}>\n <JSONUIProvider registry={registry} store={store} handlers={handlers}>\n <Renderer spec={spec} registry={registry} loading={loading} />\n </JSONUIProvider>\n </DescriptorProvider>\n );\n return brand ? <BrandProvider manifest={brand}>{page}</BrandProvider> : page;\n}\n\n/** The store's current state, re-rendering on every change. For a receipt beside a page. */\nexport function useStoreSnapshot(store: StateStore): StateModel {\n return React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot ?? store.getSnapshot,\n );\n}\n","import type { RunField } from '../core';\nimport { hasOwnProp } from '../core/own-property';\nimport { formatDateContent, isNativeValueNode, readDateContent } from '../core/native-content';\n\n/**\n * The two state loaders - what fills the trees a spec binds to.\n *\n * It is the LOADER, not the model, that knows the wire. A result payload\n * arrives with the runtime's serialization quirks - a date inside a structure\n * in a typed envelope, a plural result under `items` - and a model laying out\n * an invoice must not have to know either. This walks the result descriptor BY\n * STATED KIND, through the kernel's own readers, and hands the spec a tree it\n * can bind to naively. Working out what a value is by looking at it stays\n * forbidden on this side of the seam too: every branch below is keyed by what\n * the descriptor says, never by the shape of the payload.\n */\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * A payload, as the result tree a spec binds to at `/result`.\n *\n * - a `date` becomes the ISO string (`2026-03-14`, or `2026-03-14 15:40:00`\n * when a time rides along), whatever envelope it arrived in;\n * - a `list` becomes an array whether the wire sent one or the plural\n * envelope `{items: [...]}`, each item loaded by the item descriptor;\n * - an `object` is loaded member by member, keeping any member the descriptor\n * does not name as it came;\n * - a `document` or `image` passes through verbatim: the pinned content model\n * is what `ResultField` reads, and its member names (`url`, `filename`) are\n * the ones a model would bind to anyway;\n * - the three native concepts the kind vocabulary cannot name (`native.Html`,\n * `native.Date`, `native.Composite`) pass through whole, for the escape\n * hatch to render - and a list of one is still a list, an array of whole\n * values, which is what the kernel renders when the brief delegates it;\n * - a scalar passes through.\n *\n * A top-level scalar's `contentKey` wrapper is NOT unwrapped: `ResultField`\n * unwraps it itself, and the brief names the wrapped path (`/result/text`), so\n * the model and the escape hatch read the same tree.\n */\nexport function payloadToState(field: RunField, payload: unknown): unknown {\n if (payload === undefined || payload === null) return payload;\n if (isNativeValueNode(field)) return payload;\n switch (field.kind) {\n case 'date': {\n const content = readDateContent(payload);\n return content ? formatDateContent(content) : payload;\n }\n case 'list': {\n const items = Array.isArray(payload)\n ? payload\n : isRecord(payload) && Array.isArray(payload.items)\n ? payload.items\n : undefined;\n if (!items) return payload;\n return items.map((item) => payloadToState(field.item, item));\n }\n case 'object': {\n if (!isRecord(payload)) return payload;\n const out: Record<string, unknown> = { ...payload };\n for (const child of field.fields) {\n if (hasOwnProp(payload, child.name)) {\n out[child.name] = payloadToState(child, payload[child.name]);\n }\n }\n return out;\n }\n case 'document':\n case 'image':\n case 'text':\n case 'prose':\n case 'number':\n case 'boolean':\n case 'enum':\n case 'unknown':\n return payload;\n default:\n return field satisfies never;\n }\n}\n","import type { Spec } from '@json-render/core';\nimport type { PagePlan } from '../generated/layout-design/types';\n\n/**\n * A spec with its provenance - the shape every fixture takes, whoever produced\n * it, so a story renders any of them without knowing which it holds.\n *\n * A spec is a payload's twin: the one artifact no projection can produce. So\n * it follows the payload's rules - produced by a pass, committed with its\n * provenance - plus what a spec needs and a payload does not: WHO produced it,\n * on WHICH model, under WHAT prompt (its hash), and, when the run was given\n * one, the creative seed and the critic loop. The stories and the comparison\n * viewer are titled from this record and from nothing else, so a page is\n * never labelled with a role (\"authored\", \"generated\") but with what actually\n * made it.\n */\n\n/** How a spec came to be. */\nexport type Producer =\n /** The designer method, `methods/layout-design.mthds`, run on the hosted API. */\n | 'pipelex-method'\n /** A Claude Code subagent in a fresh context, given the method, the catalog data and the brief and nothing else. */\n | 'claude-code-subagent'\n /** The Claude Code session working in this repo, writing the spec by hand in TypeScript. */\n | 'claude-code-session';\n\nexport interface CriticLoop {\n /** The model that judged the screenshots. */\n model: string;\n /** How many critique-and-revise rounds ran. */\n rounds: number;\n}\n\nexport interface SpecFixture {\n /** `results.nested_result`. */\n pipeRef: string;\n producer: Producer;\n /** The model id: the one the method ran with, or the Claude Code model behind the agent. */\n model: string;\n /** The creative seed handed over with the brief, verbatim, when one was. */\n seed?: string;\n /** The critic loop the producer ran, when one did. */\n critic?: CriticLoop;\n /** The first twelve hex digits of the SHA-256 of the catalog prompt at the time. */\n promptHash: string;\n /** The day it was produced, `YYYY-MM-DD`. */\n date: string;\n /** The brief it was produced from, repo-relative. */\n brief: string;\n /** The JSONL patch lines, exactly as emitted, or as `specToJsonl` renders a hand-written spec. */\n jsonl: string;\n /** The compiled spec. */\n spec: Spec;\n /**\n * The planner's plan, when the producer was the designer method: the\n * intermediate the builder was handed, read from the run's working memory.\n * It is what a person reads to see why a page has the shape it has, and it\n * is the one stage a comparison between two runs can be made at. Absent for\n * a producer that plans nowhere the harness can read.\n */\n plan?: PagePlan;\n}\n\n/**\n * The id a story and a screenshot are keyed by: producer, model and the two\n * procedures that change what a run is. `pipelex-method--gpt-5.5--seeded`.\n */\nexport function fixtureId(fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>) {\n return [\n fixture.producer,\n fixture.model,\n fixture.seed ? 'seeded' : null,\n fixture.critic ? 'critic' : null,\n ]\n .filter((part): part is string => part !== null)\n .join('--');\n}\n\nconst PRODUCER_LABEL: Record<Producer, string> = {\n 'pipelex-method': 'Pipelex method',\n 'claude-code-subagent': 'Claude Code subagent',\n 'claude-code-session': 'Claude Code session, by hand',\n};\n\n/**\n * The honest title: what made the page. `Pipelex method · gpt-5.5 · with a\n * seed`, never a role (\"authored\", \"generated\").\n */\nexport function fixtureLabel(\n fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>,\n): string {\n const parts = [PRODUCER_LABEL[fixture.producer], fixture.model];\n if (fixture.seed) parts.push('with a seed');\n if (fixture.critic) {\n parts.push(\n `${fixture.critic.model} critic × ${fixture.critic.rounds} round${fixture.critic.rounds === 1 ? '' : 's'}`,\n );\n }\n return parts.join(' · ');\n}\n\n/** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */\nexport function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string) {\n const found = fixtures.find(\n (fixture) => fixture.pipeRef === pipeRef && fixtureId(fixture) === id,\n );\n if (!found) {\n const known = fixtures\n .filter((fixture) => fixture.pipeRef === pipeRef)\n .map(fixtureId)\n .join(', ');\n throw new Error(`No spec fixture ${id} for ${pipeRef}. Known: ${known || 'none'}.`);\n }\n return found;\n}\n"]}
|