@pipelex/mthds-form 0.29.0 → 0.31.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.
@@ -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/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,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AAG,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 { enumLabeler, useFieldPresentation } from '../../react/field-presentation';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { checkedAccentClass, focusOutlineClass } from '../../react/role-tokens';\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 rounded-md px-4 py-3 text-sm font-medium select-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\">\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\n/**\n * A native radio or check box: checked in the accent ink, as every selection\n * reads the accent rather than the button colour, and focused in `--ring`, as\n * everything in the tab order is, never in the browser's own ring.\n */\nconst NATIVE_CHECK = cn('size-4', checkedAccentClass, focusOutlineClass);\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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\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={NATIVE_CHECK}\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{labelOf(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={NATIVE_CHECK}\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 {/* Room for the switch's 44px hit area below `sm`, inside its own row. */}\n <div className=\"flex items-center gap-3 max-sm:py-2.5\">\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 { linkTextClass, selectedFillStrongClass } from '../react/role-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { enumLabeler, useFieldPresentation } from '../react/field-presentation';\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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\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 {labelOf(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 ? cn(selectedFillStrongClass, linkTextClass)\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 whose text is its\n * option as the kernel words it (`enumLabeler`), while the value it writes\n * stays the option. Deselecting is ignored, as shadcn's toggle group does, so\n * the bound 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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\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 {labelOf(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 { linkTextClass, selectedBorderClass, selectedFillClass } from '../react/role-tokens';\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=\"rounded-sm text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden\"\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {props.tag ? (\n <span\n className={cn(\n 'min-w-0 truncate rounded-lg border px-2.5 py-1 font-mono text-[11px]',\n selectedBorderClass,\n selectedFillClass,\n linkTextClass,\n )}\n >\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\n className={cn('mb-4 text-[11px] font-medium tracking-[0.15em] uppercase', linkTextClass)}\n >\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={cn('font-mono text-[12px]', linkTextClass)}>{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"]}
1
+ {"version":3,"sources":["../../src/generative/schema.ts","../../src/generative/shadcn-definitions.ts","../../src/generative/components.ts","../../src/generative/frame-definitions.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/layout-fits.ts","../../src/generative/validate.ts","../../src/generative/designer-run.ts","../../src/generative/brief.ts","../../src/generative/stream.ts","../../src/generative/brand-context.tsx","../../src/generative/frame-host.tsx","../../src/generative/ui/shadcn.tsx","../../src/generative/registry.tsx","../../src/generative/frame-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","fieldAt","resolves","definitionOf","catalog","descend","present","describe","React","React2","jsx","React3","Tag","Switch","jsxs","useBoundProp","useFieldValidation","valueAt","Map","useRepeatScope","Clock","useStateValue","List","React5","LABEL","React6","React7"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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/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 // The page words the label and the line under it, as it words every other control.\n label: z.string().nullable(),\n hint: z.string().nullable(),\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 the descriptor\\'s label and description unless the page words them: \"label\" replaces the label, \"hint\" the line under it. 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 // A column says how its cells read, from the kind the brief states.\n columns: z.array(\n z.object({\n path: z.string(),\n label: z.string(),\n format: z.enum(['text', 'date', 'number']).nullable().optional(),\n }),\n ),\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\"), the header to show for it, and how its cells read: \"date\" for a date path (written \"9 Mar 2025\"), \"number\" for a number path (digits grouped), \"text\" otherwise.',\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 { z } from 'zod';\n\n/**\n * The frames a layout is written for, and the vocabulary each adds.\n *\n * `page` is a whole product page of its own, the frame every layout had\n * before a host drew one around it. `composer` and `result` are the two\n * moments of a host's compose-then-result app: the inputs before a run, in a\n * centred column whose host draws the band above it and the action row's\n * mechanics, and the result after one, under the host's bar restating the\n * request. The two moments carry their own components, found by measuring the\n * designer against hand-drawn screens of three methods: the composer's frame\n * (`Composer`, with the page's h1, the panel and the host's action row) and a\n * group of inputs inside it, and a result's header, a proportion bar, colour\n * swatches, a picture, a fact, a labelled detail, a date in words and a list\n * of short texts. A date range, chips for a list of texts and compact rows\n * for a list of structures were found too, and went to the kernel's own\n * controls instead, since they improve the plain form as much as a designed\n * one: a composer delegates those inputs to `MthdsField`.\n *\n * Zod only, importable from node: `designerCatalog()` renders these into the\n * data the designer method takes. Each description says what the component IS\n * and how it renders, never where a page must put it.\n */\n\n/** The frame a layout is written for: a whole product page, or one of the two moments of a host's compose-then-result app. */\nexport const FRAMES = ['page', 'composer', 'result'] as const;\nexport type Frame = (typeof FRAMES)[number];\n\n/** The components the composer frame adds to the catalog. */\nexport const COMPOSER_COMPONENTS = ['Composer', 'FieldGroup'] as const;\n/** The components the result frame adds to the catalog. */\nexport const RESULT_COMPONENTS = [\n 'ResultHeader',\n 'ProportionBar',\n 'Swatches',\n 'Picture',\n 'Fact',\n 'Detail',\n 'DateText',\n 'TextList',\n] as const;\n/** Every component a frame adds, which the `page` frame's vocabulary leaves out. */\nexport const FRAME_COMPONENTS = [...COMPOSER_COMPONENTS, ...RESULT_COMPONENTS] as const;\n\nexport const frameComponents = {\n Composer: {\n props: z.object({\n headline: z.string(),\n lede: z.string().nullable(),\n runLabel: z.string(),\n columns: z.enum(['1', '2']).nullable(),\n notes: z.array(z.string()).nullable(),\n }),\n slots: ['default'],\n events: ['press'],\n description:\n 'The composer: the page\\'s headline (rendered as the h1) and one muted line under it, then a single raised panel holding its children - the inputs - in one column, or two columns side by side when \"columns\" is \"2\", and at the panel\\'s foot the host\\'s action row: how long a run takes, as the host knows it, and the one button that runs the method, worded by \"runLabel\". The action row stays on screen while a long panel scrolls. It is the control that runs the method: bind on.press to validateForm then run. \"notes\" are a few short lines set under the panel, each after a check mark, in two columns: what one run gives back, in a person\\'s words.',\n example: {\n headline: 'A day-by-day plan for your trip',\n lede: 'Tell us who is going, where and when.',\n runLabel: 'Plan my trip',\n columns: '2',\n },\n },\n FieldGroup: {\n props: z.object({ title: z.string().nullable() }),\n slots: ['default'],\n description:\n 'A quiet group of inputs inside a panel: an optional small h2 title, then its children stacked with even spacing. No box, no rule: the panel around it is the surface.',\n example: { title: 'Where and when' },\n },\n ResultHeader: {\n props: z.object({\n eyebrow: z.string().nullable(),\n title: z.string(),\n subtitle: z.string().nullable(),\n }),\n slots: [],\n description:\n 'The result\\'s heading: a small eyebrow in the accent colour, the title (rendered as the h1) and one muted line under it, with the host\\'s actions on the result (download, share) at the right. Text props may be read from the state with { \"$state\" } or { \"$template\" }.',\n example: {\n eyebrow: 'Your plan',\n title: { $state: '/result/title' },\n subtitle: { $template: '${/result/currency} ${/result/estimated_total} estimated' },\n },\n },\n ProportionBar: {\n props: z.object({\n label: z.string(),\n total: z.number().nullable(),\n of: z.number().nullable(),\n unit: z.string().nullable(),\n items: z.array(z.any()).nullable(),\n labelKey: z.string(),\n valueKey: z.string(),\n }),\n slots: [],\n description:\n 'A labelled total over its parts, in a raised panel: the label and the total in large figures (\"of\" a ceiling when there is one), then one bar split in proportion to each part, and a legend naming each part with its amount. \"items\" is { \"$state\": ... } on a list of structures; \"labelKey\" and \"valueKey\" name the member of one item that labels it and the number that sizes it. \"unit\" is a currency or unit the state carries, read with { \"$state\" }.',\n example: {\n label: 'Estimated cost',\n total: { $state: '/result/estimated_total' },\n unit: { $state: '/result/currency' },\n items: { $state: '/result/costs' },\n labelKey: 'category',\n valueKey: 'amount',\n },\n },\n Swatches: {\n props: z.object({ colors: z.array(z.string()) }),\n slots: [],\n description:\n 'A row of colour swatches, each a small tile filled with the colour and its value written under it in mono. \"colors\" is a list of colour values, each read from a text path ({ \"$state\" }, or { \"$item\" } inside a repeat).',\n example: { colors: [{ $item: 'colors/primary' }, { $item: 'colors/accent' }] },\n },\n Picture: {\n props: z.object({\n path: z.string(),\n alt: z.string().nullable(),\n aspect: z.enum(['16:9', '4:3', '1:1', 'auto']).nullable(),\n }),\n slots: [],\n description:\n 'A picture the run produced, shown whole and edge to edge in its column with a hairline border, cropped to \"aspect\" when one is set. \"path\" is an image path of the brief, literally (\"/result/cover\"), or relative to the item inside a repeat (\"\" for the item itself, when the repeat is over a list of images).',\n example: { path: '/result/cover', alt: 'The cover', aspect: '16:9' },\n },\n Fact: {\n props: z.object({\n label: z.string(),\n value: z.any(),\n detail: z.string().nullable(),\n }),\n slots: [],\n description:\n 'One fact as a small boxed tile: a muted label, the value under it, and an optional muted detail. Several in a Grid make a band of facts. \"value\" is a scalar read with { \"$state\" } or { \"$template\" }.',\n example: { label: 'Order number', value: { $state: '/result/number' } },\n },\n DateText: {\n props: z.object({\n value: z.string().nullable(),\n style: z.enum(['long', 'short', 'weekday']).nullable(),\n tone: z.enum(['default', 'muted', 'accent']).nullable(),\n }),\n slots: [],\n description:\n 'A date written in words: \"long\" is \"Wednesday 14 April 2027\", \"short\" is \"14 Apr 2027\", \"weekday\" is \"Wed 14 April\". \"value\" is a date path read with { \"$state\" } or { \"$item\" }; \"tone\" colours it muted or in the accent colour, as an eyebrow over a title.',\n example: { value: { $item: 'day' }, style: 'weekday', tone: 'accent' },\n },\n TextList: {\n props: z.object({\n items: z.array(z.string()).nullable(),\n marker: z.enum(['bullet', 'number', 'check']).nullable(),\n }),\n slots: [],\n description:\n 'A list of short texts as one list, each entry a line with a small marker before it: a dot, its number or a check. \"items\" reads a list of text path with { \"$state\" }, or { \"$item\" } inside a repeat - the whole list at once, so it needs no repeat of its own.',\n example: { items: { $state: '/result/notes' }, marker: 'bullet' },\n },\n Detail: {\n props: z.object({\n label: z.string(),\n value: z.any(),\n }),\n slots: [],\n description:\n 'A labelled line of text: the label muted in a narrow column at the left, the value wrapping beside it, a hairline under the line. Several in a column read as a list of details. \"value\" is a scalar read with { \"$state\" }, { \"$item\" } or { \"$template\" }; the line hides itself while the value is empty.',\n example: { label: 'Morning', value: { $item: 'morning' } },\n },\n};\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 {\n COMPOSER_COMPONENTS,\n FRAME_COMPONENTS,\n RESULT_COMPONENTS,\n frameComponents,\n type Frame,\n} from './frame-definitions';\nimport type { ComponentRendering, ValidationCatalog } 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 Composer: { heading: { level: 1 }, once: 'the composer' },\n ResultHeader: { heading: { level: 1 }, once: \"the result's header\" },\n FieldGroup: { heading: { level: 2, when: 'title' } },\n};\n\nexport const catalog = Object.assign(\n defineCatalog(generativeSchema, {\n components: { ...generativeComponents, ...product, ...frameComponents },\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\n/**\n * The vocabulary of each frame, in the order the designer method lists it.\n * `page` is the product page: the base vocabulary and the product chrome, with\n * none of the frames' own components. `composer` and `result` are the two\n * moments of a host's compose-then-result app, whose host draws the band, the\n * action row's mechanics, the request bar and the result's actions - so they\n * leave out the product chrome and the side panel (`AppBar`, `Footer`,\n * `Workspace`, `Rail`), the stand-alone run controls (`Cta`, `Button`) and\n * the hero the composer already carries, and each leaves out the other\n * moment's components: a composer reads no result, a result page enters no\n * input.\n */\nconst FRAME_EXCLUDED: Record<Frame, readonly string[]> = {\n page: [...FRAME_COMPONENTS],\n composer: [\n 'AppBar',\n 'Footer',\n 'Workspace',\n 'Rail',\n 'Cta',\n 'Button',\n 'Hero',\n 'SummaryRow',\n 'MthdsResult',\n 'DataTable',\n 'Metric',\n 'Progress',\n // `TextList` stays: a composer may list short texts too, such as what a\n // run gives back.\n ...RESULT_COMPONENTS.filter((name) => name !== 'TextList'),\n ],\n result: [\n 'AppBar',\n 'Footer',\n 'Workspace',\n 'Rail',\n 'Cta',\n 'Button',\n 'Hero',\n 'MthdsField',\n 'Input',\n 'Textarea',\n 'Select',\n 'Radio',\n 'Checkbox',\n 'Switch',\n 'Segmented',\n 'NumberInput',\n 'Steps',\n ...COMPOSER_COMPONENTS,\n ],\n};\n\n/** The component names a layout written for `frame` may use, in the order the designer method lists them. */\nexport function componentNamesFor(frame: Frame): readonly string[] {\n const excluded = new Set(FRAME_EXCLUDED[frame]);\n const own = frame === 'page' ? [] : [...FRAME_COMPONENTS];\n return [...COMPONENT_NAMES, ...own].filter((name) => !excluded.has(name));\n}\n\n/**\n * The catalog a layout written for `frame` is validated against: the same\n * definitions and renderings as `catalog`, held to the frame's vocabulary. A\n * composer that names an `AppBar` is refused here as an unknown component,\n * though the entry's registry could render one, because the host's frame\n * already draws what it stands for.\n */\nexport function frameCatalog(frame: Frame): ValidationCatalog {\n return {\n componentNames: componentNamesFor(frame),\n actionNames: catalog.actionNames,\n data: catalog.data,\n schema: catalog.schema,\n renders: COMPONENT_RENDERINGS,\n };\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 { catalog, componentNamesFor } from './catalog';\nimport type { Frame } from './frame-definitions';\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\n/** What a catalog is built for. */\nexport interface DesignerCatalogOptions {\n /**\n * The frame the layout is written for: `page` (the default), a whole\n * product page; `composer` or `result`, a moment of a host's\n * compose-then-result app, whose vocabulary leaves out what that host draws\n * and adds the frame's own components (`componentNamesFor`).\n */\n frame?: Frame;\n}\n\n/**\n * The catalog as the designer method's `catalog` input, for one frame. The\n * same frame's `frameCatalog` is what the layout it produces is validated\n * against, so the vocabulary a model was shown and the one it is held to are\n * one list.\n */\nexport function designerCatalog({ frame = 'page' }: DesignerCatalogOptions = {}): DesignerCatalog {\n const definitions = catalog.data.components as Record<string, ComponentDefinition>;\n const components = componentNamesFor(frame).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 { designerCatalog } from './designer-catalog';\nimport { FRAMES } from './frame-definitions';\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 of every frame.\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({ frame })`). Both are what a run was\n * actually given, so both are hashed - a reworded rule and a renamed prop each\n * move the pin, exactly as they did when the prompt was rendered here. A run\n * is given the catalog of one frame, and the hash covers all three in a fixed\n * order: one pin a host compares every stored layout with, whichever frame it\n * was written for, and which any frame's vocabulary moving moves. The frame a\n * layout was written for is its own provenance, beside the hash. The brief is\n * not hashed: it is the per-method half, recorded with each layout. 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 = '30cf9bc059f6';\n\n/**\n * What the hash is computed over: the method's text as shipped, then the\n * catalog of each frame as a run request carries it, in `FRAMES` order. The\n * one recipe the test, the fixture pass and a host's producer share, so the\n * pin they check and the stamp they write agree: a producer that runs the\n * method off a checkout hashes this string (SHA-256, the first twelve hex\n * digits) and compares it with `PROMPT_HASH` before it spends anything. It is\n * a string rather than the hash so the entry stays free of a hashing\n * dependency and importable from a browser.\n */\nexport function promptHashSubject(method: string): string {\n const catalogs = FRAMES.map((frame) => designerCatalog({ frame }));\n return `${method}\\n${JSON.stringify(catalogs)}`;\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 { 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 // A share's parts are read by member name, so a list of scalars or a\n // misspelt key would draw an empty bar with nothing to say why; it is\n // refused here instead, and the page falls back.\n const checkShares = (path: string): void => {\n if (element.type !== 'ProportionBar' || !isUnder(root, path)) return;\n const field = fieldAt(path);\n if (field?.kind !== 'list') return;\n if (field.item.kind !== 'object') {\n problems.push(\n `${key}: ProportionBar reads ${path}, a list of ${field.item.kind} values; its parts are structures, each with a label member and a number member`,\n );\n return;\n }\n const members = field.item.fields;\n const { labelKey, valueKey } = (element.props ?? {}) as Record<string, unknown>;\n const member = (name: unknown) =>\n typeof name === 'string' ? members.find((m) => m.name === name) : undefined;\n if (!member(labelKey)) {\n problems.push(\n `${key}: ProportionBar's labelKey ${JSON.stringify(labelKey)} is no member of ${path}'s items`,\n );\n }\n const value = member(valueKey);\n if (!value) {\n problems.push(\n `${key}: ProportionBar's valueKey ${JSON.stringify(valueKey)} is no member of ${path}'s items`,\n );\n } else if (value.kind !== 'number') {\n problems.push(\n `${key}: ProportionBar's valueKey ${JSON.stringify(valueKey)} holds a ${value.kind}, not a number`,\n );\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 const listPath =\n typeof record.$state === 'string'\n ? record.$state\n : typeof record.$item === 'string'\n ? itemPath(record.$item)\n : undefined;\n if (listPath !== undefined) {\n checkList(prop, listPath, items);\n if (prop === 'items') checkShares(listPath);\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 // A repeat renders its element ONCE and that element's children once per\n // item, so a Grid whose only child carries the repeat is a grid of one\n // cell holding every item in a column: three directions in a third of\n // the page, the rest empty. The repeat belongs on the Grid.\n const [onlyKey] = element.children?.length === 1 ? element.children : [];\n const only = onlyKey === undefined ? undefined : spec.elements[onlyKey];\n if (element.type === 'Grid' && element.repeat === undefined && only?.repeat !== undefined) {\n problems.push(\n `${key}: Grid's only child ${onlyKey} carries the repeat, so every item lands in one cell; put the repeat on ${key} itself, with the item's element as its child`,\n );\n }\n // A picture names its path literally, as a hatch does, because an image is\n // a file the kind check refuses to read into a prop; so it is held here to\n // what a hatch is held to, and to the one kind it can show. Inside a repeat\n // over a list of images, \"\" is the item itself.\n if (element.type === 'Picture') {\n const shown = written === '' ? repeatBasePathOf(spec, key, parents) : (path ?? undefined);\n const field =\n shown && descriptor.result ? resultFieldAtPath(descriptor.result, shown) : undefined;\n if (!field) {\n problems.push(`${key}: Picture shows ${JSON.stringify(written)}, which no result has`);\n } else if (field.kind !== 'image') {\n problems.push(`${key}: Picture shows ${shown}, which holds a ${field.kind}, not an image`);\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 { validateSpec } from '@json-render/core';\nimport type { z } from 'zod';\nimport { frameCatalog } 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/** The value a zod issue path points at inside a prop's raw value. */\nfunction valueAt(value: unknown, path: readonly PropertyKey[]): unknown {\n let at: unknown = value;\n for (const step of path) {\n if (typeof at !== 'object' || at === null) return undefined;\n at = (at as Record<PropertyKey, unknown>)[step];\n }\n return at;\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 // A whole page's vocabulary unless the caller names a frame's: the exported\n // `catalog` also defines the frames' own components, which a whole page\n // must not hold.\n catalog: ValidationCatalog = frameCatalog('page'),\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 // json-render resolves an expression wherever it sits in a prop, inside\n // an array or an object included, so an issue raised at a nested\n // expression, or under one (an expression standing for an object draws\n // issues at the object's members), is the literal check misreading it.\n const issues = parsed.success\n ? []\n : parsed.error.issues.filter(\n (issue) =>\n !issue.path.some((_, n) => isExpression(valueAt(value, issue.path.slice(0, n + 1)))),\n );\n if (issues.length > 0) {\n problems.push({\n elementKey: key,\n message: `${element.type}.${name}: ${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 { frameCatalog } from './catalog';\nimport type { Frame } from './frame-definitions';\nimport { layoutProblems, type LayoutDescriptor } from './layout-fits';\nimport { formatProblems, validateAgainstCatalog } from './validate';\n\n/**\n * What a producer of layouts needs beside the method, the catalog and the\n * brief: the line a creative seed travels as, the checks a produced layout is\n * held to, and how many times a refused one goes back to the method's repair\n * pass. Nothing here calls a model; the producer is the host's, on the far\n * side of this seam (docs/generative-ui.md, \"Producing a layout\").\n */\n\n/**\n * The one line a creative seed reaches the designer method as, under its\n * `seed` input. The planner's seed procedure was written against this line,\n * so a host that hands the method a seed sends it, rather than restating it.\n */\nexport function seedLine(seed: string): string {\n return `CREATIVE SEED (derive your direction from it; never reveal it): ${seed}`;\n}\n\n/**\n * How many times a producer hands a refused layout to the method's\n * `repair_layout` pass before it gives up and the host keeps the plain form.\n * The refusals the designer makes are slips of one prop or one heading, which\n * one pass told what it broke fixes; a second covers a fix that broke a rule\n * of its own, and a third would be paying for a page that is not converging.\n */\nexport const REPAIR_ATTEMPTS = 2;\n\n/** What a layout is checked against: the frame it was written for and the descriptor it binds. */\nexport interface LayoutCheck {\n frame: Frame;\n descriptor: LayoutDescriptor;\n}\n\n/**\n * Everything the host's two checks find wrong with a layout written for\n * `frame`, one problem a line, in the words the repair pass reads: first the\n * catalog's verdict against the frame's own vocabulary (`frameCatalog`), then\n * whether it fits the descriptor (`layoutProblems`). Empty means the layout\n * may render. A producer feeds the lines, joined, to `repair_layout` as its\n * `problems`; a host deciding whether a stored layout renders needs only\n * whether the list is empty.\n */\nexport function layoutCheckProblems(spec: Spec, { frame, descriptor }: LayoutCheck): string[] {\n const verdict = validateAgainstCatalog(spec, frameCatalog(frame));\n const invalid = verdict.ok ? [] : formatProblems(verdict.problems).split('\\n');\n // A page that takes inputs is there to start a run, and nothing else in it\n // can: a layout with no control bound to `run` renders a dead page, which\n // the host must refuse rather than show.\n const runless =\n frame !== 'result' && descriptor.inputs && !bindsRun(spec)\n ? [\"the layout has no control that runs the method: bind `run` under a control's `on`\"]\n : [];\n return [...invalid, ...runless, ...layoutProblems(descriptor, spec)];\n}\n\n/**\n * Whether any element binds the `run` action directly under `on`, as the\n * binding itself or as one entry of a list of them, which json-render runs in\n * order. A `run` reached only through an `onSuccess` or `onError` chain is not\n * counted: json-render applies those chains to a handler's actions alone, and\n * never after `validateForm` or a state action, so such a run never fires.\n * The walk is total over whatever a model wrote, since a malformed element is\n * the catalog check's to report, never a reason for this one to throw.\n */\nfunction bindsRun(spec: Spec): boolean {\n const isRun = (binding: unknown): boolean =>\n typeof binding === 'object' &&\n binding !== null &&\n (binding as Record<string, unknown>).action === 'run';\n const elements: unknown = spec.elements;\n if (typeof elements !== 'object' || elements === null) return false;\n return Object.values(elements).some((element) => {\n if (typeof element !== 'object' || element === null) return false;\n const on: unknown = (element as Record<string, unknown>).on;\n if (typeof on !== 'object' || on === null) return false;\n return Object.values(on).some((binding) =>\n Array.isArray(binding) ? binding.some(isRun) : isRun(binding),\n );\n });\n}\n","import type { RunField } from '../core';\nimport {\n isNativeCompositeNode,\n isNativeDateNode,\n isNativeHtmlNode,\n isNativeValueNode,\n} from '../core/native-content';\nimport { APP_STYLES, type AppStyleId } from '../brand/styles';\nimport type { Brief, PathEntry, Style } from '../generated/layout-design/types';\nimport type { Frame } from './frame-definitions';\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/** The style a brief carries: its name and its direction, as `APP_STYLES` states them. */\nexport type DesignerStyle = Style;\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/** In a host's composer frame the composer itself runs the method: its foot is the host's action row. */\nconst COMPOSER_RUN_COMPONENT = 'Composer';\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 *\n * The result frame's vocabulary shows two of them itself: a picture\n * (`Picture`) and a date in words (`DateText`), so on a result page written\n * for that frame neither is delegated. A date with a time stays delegated:\n * `DateText` writes the day alone, and the kernel's result shows the time.\n */\nexport function isDelegatedResult(field: RunField, frame: Frame = 'page'): boolean {\n if (isNativeValueNode(field)) return true;\n if (frame === 'result' && (field.kind === 'image' || (field.kind === 'date' && !field.datetime)))\n return false;\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 frame: Frame = 'page',\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, frame),\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 frame: Frame = 'page',\n): void {\n const entry = entryOf(field, path, depth, side, false, seeded, frame);\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, frame);\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, frame)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(child, child.name, depth + 2, entries, side, frame);\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 side: Side = 'result',\n frame: Frame = 'page',\n): void {\n const entry = entryOf(field, relativePath, depth, side, true, false, frame);\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, side, frame);\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, frame)) {\n entry.item_laid_out = true;\n for (const child of item.fields) {\n describeRelative(\n child,\n joinPath(relativePath, '<i>', child.name),\n depth + 2,\n entries,\n side,\n frame,\n );\n }\n }\n }\n}\n\n/**\n * What one run gives back, one line per member of the result (of one item,\n * for a list), from the result's own titles and descriptions - so a composer\n * can say what comes back before the run.\n */\nfunction returnsOf(result: RunField): string[] {\n const shape = result.kind === 'list' ? result.item : result;\n const members = shape.kind === 'object' ? shape.fields : [shape];\n return members.map((member) => {\n const title = member.title ?? member.name.replace(/_/g, ' ');\n return member.description && member.description !== title\n ? `${title}: ${member.description}`\n : title;\n });\n}\n\n/** The style a brief carries, read off `APP_STYLES`: its name and its direction, as data. */\nfunction styleOf(style: AppStyleId | undefined): DesignerStyle | undefined {\n if (!style) return undefined;\n const { name, direction } = APP_STYLES[style];\n return { name, direction };\n}\n\n/** How an input page's brief is built: the frame it is written for, the team's style, and what a run returns. */\nexport interface InputBriefOptions {\n /** `page` (the default), a whole product page; `composer`, the inputs of a host's compose-then-result app. */\n frame?: Extract<Frame, 'page' | 'composer'>;\n /**\n * The style the team's apps wear. The brief carries its name and its\n * direction, which the composition follows; its faces, radii and panels are\n * the components' to draw and never reach the brief. Absent, the brief\n * names no style.\n */\n style?: AppStyleId;\n /** The result's descriptor, from which a composer's brief says what one run gives back. */\n result?: RunField;\n}\n\n/** How a result page's brief is built: the frame it is written for and the team's style. */\nexport interface ResultBriefOptions {\n /** `page` (the default), a whole product page; `result`, the result page of a host's compose-then-result app. */\n frame?: Extract<Frame, 'page' | 'result'>;\n /** The style the team's apps wear (see `InputBriefOptions.style`). */\n style?: AppStyleId;\n}\n\n/** The brief for an INPUT page: the form a run is started from. */\nexport function inputBrief(\n subject: BriefSubject,\n fields: readonly RunField[],\n { frame = 'page', style, result }: InputBriefOptions = {},\n): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n for (const field of fields) {\n describe(field, joinPath(INPUTS_ROOT, field.name), 0, 'input', paths, false, frame);\n }\n return {\n side: 'input',\n frame,\n pipe_ref: subject.pipeRef,\n description: subject.description,\n name: subject.name,\n paths,\n run_control: frame === 'composer' ? COMPOSER_RUN_COMPONENT : RUN_COMPONENT,\n ...(frame === 'composer' && result ? { returns: returnsOf(result) } : {}),\n ...(style ? { style: styleOf(style) } : {}),\n };\n}\n\n/** The brief for a RESULT page: what one run produced, laid out. */\nexport function resultBrief(\n subject: BriefSubject,\n field: RunField,\n state: unknown,\n { frame = 'page', style }: ResultBriefOptions = {},\n): DesignerBrief {\n const paths: DesignerPathEntry[] = [];\n if (field.kind === 'object' && !isDelegatedResult(field, frame)) {\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, false, frame);\n }\n } else {\n describe(field, RESULT_ROOT, 0, 'result', paths, false, frame);\n }\n return {\n side: 'result',\n frame,\n pipe_ref: subject.pipeRef,\n description: subject.description,\n paths,\n ...(style ? { style: styleOf(style) } : {}),\n sample_state: JSON.stringify(state, null, 2),\n };\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';\n\n/**\n * What a host's compose-then-result frame tells the frame components of a\n * layout - the facts no descriptor carries.\n *\n * A layout written for the `composer` frame places the host's action row\n * through `Composer`, and one written for the `result` frame places the\n * host's actions through `ResultHeader`. What those rows SAY beyond the\n * layout's own words is the host's knowledge: how long a run usually takes,\n * what the result's actions are called and what they do. The layout names\n * where they go; the host fills them.\n */\nexport interface FrameHost {\n /** How long a run usually takes, from the app's past runs: \"Takes about 30 seconds\". */\n eta?: string;\n /** The result's actions, primary first: \"Download PDF\", \"Share\". */\n actions?: readonly string[];\n /** What an action does, by its label. */\n onAction?: (label: string) => void;\n}\n\nconst FrameHostContext = React.createContext<FrameHost>({});\n\nexport function FrameHostProvider({\n host,\n children,\n}: {\n host: FrameHost;\n children: React.ReactNode;\n}) {\n return <FrameHostContext.Provider value={host}>{children}</FrameHostContext.Provider>;\n}\n\nexport function useFrameHost(): FrameHost {\n return React.useContext(FrameHostContext);\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 { enumLabeler, useFieldPresentation } from '../../react/field-presentation';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { checkedAccentClass, focusOutlineClass } from '../../react/role-tokens';\nimport { headingClass, panelFlatShadowClass, panelSurfaceClass } from '../../react/style-tokens';\nimport { cn } from '../../react/utils';\nimport { ChevronDown } from 'lucide-react';\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 // A style's panel: a host writes the style's field fill onto `--input`\n // here, as on its own panel, so the fields inside do not sink into it.\n // A panel's corner is one and a half times a control's, as the rail's is.\n <div\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-6 text-card-foreground',\n panelSurfaceClass,\n panelFlatShadowClass,\n )}\n >\n {props.title || props.description ? (\n <div className=\"mb-4 space-y-1.5\">\n {props.title ? (\n <h3 className={cn('text-lg leading-none', headingClass(600))}>{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 {/* A chevron that turns as it opens: without one the closed section\n read as an empty text field with a placeholder. */}\n <summary className=\"flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-md px-4 py-3 text-sm font-medium select-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset [&::-webkit-details-marker]:hidden\">\n <span>{props.title}</span>\n <ChevronDown\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground transition-transform [details[open]>summary_&]:rotate-180\"\n />\n </summary>\n <div className=\"border-t border-border px-4 py-3\">{children}</div>\n </details>\n );\n}\n\n// ── Content ─────────────────────────────────────────────────────────────────\n\n// Every level reads the page's heading style (`react/style-tokens`), falling\n// back to the weight and tracking it was set in.\nconst HEADING = {\n h1: cn('text-3xl', headingClass(700, true)),\n h2: cn('text-2xl', headingClass(600, true)),\n h3: cn('text-lg', headingClass(600)),\n h4: cn('text-base', headingClass(600)),\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\n/**\n * A native radio or check box: checked in the accent ink, as every selection\n * reads the accent rather than the button colour, and focused in `--ring`, as\n * everything in the tab order is, never in the browser's own ring.\n */\nconst NATIVE_CHECK = cn('size-4 shrink-0', checkedAccentClass, focusOutlineClass);\n\n/**\n * The label a native radio or check box sits in, which is where a finger\n * lands: a tap anywhere on a label activates the control it wraps. The box\n * keeps its 16 pixels, and below `sm` its row grows to 44 pixels tall across\n * the column, so the target is the whole row rather than the box.\n */\nconst NATIVE_CHECK_ROW = 'flex items-center gap-2 text-sm max-sm:min-h-11';\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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <fieldset className=\"space-y-2\" aria-invalid={field.error ? true : undefined}>\n <legend className={LABEL}>{props.label}</legend>\n {/* Rows of 44 pixels need no gap between them on a phone. */}\n <div className=\"space-y-2 max-sm:space-y-0\">\n {(props.options ?? []).map((option, index) => (\n <label key={`${index}-${option}`} className={NATIVE_CHECK_ROW}>\n <input\n type=\"radio\"\n name={id}\n value={option}\n checked={field.value === option}\n className={NATIVE_CHECK}\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{labelOf(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={NATIVE_CHECK_ROW}>\n <input\n id={id}\n name={props.name}\n type=\"checkbox\"\n className={NATIVE_CHECK}\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 {/* Room for the switch's 44px hit area below `sm`, inside its own row. */}\n <div className=\"flex items-center gap-3 max-sm:py-2.5\">\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 { readDateContent } from '../core/native-content';\nimport { FieldRenderer, ResultField, type FieldEnv } from '../react';\nimport { linkTextClass, selectedFillStrongClass } from '../react/role-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { enumLabeler, useFieldPresentation } from '../react/field-presentation';\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\n/** A label without a trailing \"(optional)\", which the kernel's own badge says. */\nfunction withoutOptionalMark(label: string): string {\n return label.replace(/\\s*\\(optional\\)\\s*$/i, '') || label;\n}\n\nfunction MthdsField({\n props,\n}: BaseComponentProps<{ path: string; label?: string | null; hint?: string | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const found = scope.inputs && path ? inputFieldAtPath(scope.inputs, path) : undefined;\n // The page's own words for the label and the line under it, where it wrote them.\n const field = React.useMemo(\n () =>\n found && (props.label || props.hint)\n ? {\n ...found,\n // The control marks an optional field itself, so a label that\n // says \"(optional)\" too would say it twice.\n title: props.label ? withoutOptionalMark(props.label) : found.title,\n description: props.hint || found.description,\n }\n : found,\n [found, props.label, props.hint],\n );\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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\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 {/* As tall as the layer's text input beside it, and the 44 pixels a\n finger needs. */}\n <SelectTrigger id={id} className=\"h-11 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 {labelOf(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\n/** A cell in a column the layout stated a format for. */\nfunction formatColumnCell(value: unknown, format: string | null | undefined): string {\n // The calendar day is the one written: a time beside it (\"2025-03-09\n // 00:30\") must not move it across midnight in the reader's zone, so only the\n // leading day is read, anchored at noon UTC, as `DateText` reads one.\n // The value is the day as text, or a native date's own structure\n // ({ date, time }); either way its day is read, never stringified.\n const written = format === 'date' ? readDateContent(value)?.date : undefined;\n const day = written === undefined ? null : /^\\d{4}-\\d{2}-\\d{2}/.exec(written);\n if (day) {\n const date = new Date(`${day[0]}T12:00:00Z`);\n if (!Number.isNaN(date.getTime()))\n return date.toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n timeZone: 'UTC',\n });\n }\n return formatCell(value);\n}\n\ninterface DataTableProps {\n rows: unknown;\n columns: { path: string; label: string; format?: 'text' | 'date' | 'number' | null }[];\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 {formatColumnCell(valueAt(row, column.path), column.format)}\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 {/* Below `sm` each tab grows to the 44 by 44 pixels a finger needs,\n however short its label, and the list around it with it, wrapping\n onto a second row rather than pushing the page sideways. */}\n <TabsPrimitive.List className=\"inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground max-sm:h-auto max-sm:flex-wrap\">\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 max-sm:min-h-11 max-sm:min-w-11\"\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\n// As tall as the layer's own `Button`, which is the 44 pixels a finger needs.\nconst BUTTON_BASE =\n 'inline-flex min-h-11 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 ? cn(selectedFillStrongClass, linkTextClass)\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 whose text is its\n * option as the kernel words it (`enumLabeler`), while the value it writes\n * stays the option. Deselecting is ignored, as shadcn's toggle group does, so\n * the bound 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 const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\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 // Below `sm`, the 44 pixels a finger needs, as the kernel's own\n // choice control grows there.\n className=\"rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground max-sm:h-11 max-sm:min-w-11\"\n >\n {labelOf(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 // As tall as the layer's text input and the kernel's number field,\n // which is the 44 pixels a finger needs.\n className={cn(\n fieldControlClass,\n 'h-11 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 { type BaseComponentProps, useRepeatScope, useStateValue } from '@json-render/react';\nimport { ArrowRight, Clock } from 'lucide-react';\nimport { readImageContent, viewableUrl } from '../core/native-content';\nimport { useResolveUrl } from '../react';\nimport { focusOutlineClass, linkTextClass } from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelFlatShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { cn } from '../react/utils';\nimport { useFrameHost } from './frame-host';\nimport { useDescriptorScope } from './registry';\n\n/**\n * The renderers of the two frames' vocabularies (`frame-definitions.ts`): the\n * composer of a host's compose-then-result app and its result page.\n *\n * Each reads the theme contract's tokens and the style tokens only, as the\n * product chrome does (`product-registry.tsx`): a title reads the style's\n * heading face, weight and tracking, a raised surface is the style's panel and\n * marks itself `data-style-panel`, the composer's run button wears the\n * style's call-to-action shadow. So a team's style reaches a designed page as\n * it reaches the kernel's controls, and a host that sets no style token sees\n * the look these components had before they read one.\n *\n * What the host knows and no descriptor says - how long a run takes, the\n * result's actions - comes in through `FrameHostProvider`; a picture the run\n * produced goes through the host's resolver and the kernel's URL gate, as\n * every file the result view shows does.\n */\n\nconst RADIUS = 'rounded-[calc(var(--radius,0.5rem)*1.5)]';\n\nfunction useAbsolute(path: string): string {\n const repeat = useRepeatScope();\n if (path.startsWith('/')) return path;\n if (!repeat) return path;\n return path === '' ? repeat.basePath : `${repeat.basePath}/${path}`;\n}\n\n/** A date path's value as a date at noon UTC, so no time zone moves its day; `undefined` for anything else. */\nfunction asDate(value: unknown): Date | undefined {\n if (typeof value !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}/.test(value)) return undefined;\n const date = new Date(`${value.slice(0, 10)}T12:00:00Z`);\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\n// ─── Composer ────────────────────────────────────────────────────────────────\n\ninterface ComposerProps {\n headline: string;\n lede?: string | null;\n runLabel: string;\n columns?: '1' | '2' | null;\n notes?: string[] | null;\n}\n\nfunction Composer({ props, children, emit }: BaseComponentProps<ComposerProps>) {\n const host = useFrameHost();\n // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n const two = props.columns === '2';\n return (\n <div\n className={cn('mx-auto flex w-full flex-col gap-7', two ? 'max-w-[980px]' : 'max-w-[740px]')}\n >\n <div>\n <h1\n className={cn(\n 'text-[32px] leading-[1.1] text-balance text-foreground sm:text-[38px] sm:leading-[1.08]',\n headingClass(700, true),\n )}\n >\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-3.5 max-w-[62ch] text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </div>\n {/* The composer's panel is the host's panel, so with no style it is the\n host's hairline with no shadow, as `quiet` asks, and a style's\n shadow floats it. */}\n <div\n data-style-panel=\"\"\n className={cn(RADIUS, panelSurfaceClass, panelFlatShadowClass, 'p-7 max-sm:p-5')}\n >\n {/* Two columns flow the groups down one column and on into the next,\n balanced, rather than a grid's rows: a row as tall as its tallest\n group left a hole beside every long list. A group may continue into\n the next column between its fields, but never inside a field (a\n list is one, so its last row never opens the next column alone)\n and never right after a title.\n The space between groups is a top margin, which a column break\n truncates. */}\n <div\n className={cn(\n 'grid gap-8',\n two &&\n 'md:block md:columns-2 md:gap-x-10 md:[&>*+*]:mt-8 md:[&>*>h2]:break-after-avoid md:[&>*>*:not(h2)]:break-inside-avoid',\n )}\n >\n {children}\n </div>\n <div className=\"sticky bottom-0 z-[2] -mx-7 -mb-7 mt-7 flex items-center justify-between gap-4 rounded-b-[calc(var(--radius,0.5rem)*1.5)] border-t border-border [background-color:var(--panel-fill,var(--card,hsl(0_0%_100%)))] px-7 pt-[18px] pb-7 max-sm:-mx-5 max-sm:-mb-5 max-sm:flex-col-reverse max-sm:items-stretch max-sm:px-5 max-sm:pb-5\">\n {host.eta ? (\n <span className=\"inline-flex items-center gap-2 text-sm text-muted-foreground max-sm:justify-center\">\n <Clock className=\"size-4\" aria-hidden=\"true\" /> {host.eta}\n </span>\n ) : (\n <span />\n )}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex min-h-11 items-center justify-center gap-2 rounded-[var(--radius,0.5rem)] bg-primary px-[22px] text-[15px] font-semibold text-primary-foreground transition-all hover:bg-primary/90',\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\n )}\n >\n {props.runLabel} <ArrowRight className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n {props.notes && props.notes.length > 0 ? (\n <ul className=\"grid gap-x-8 gap-y-2.5 px-1 sm:grid-cols-2\">\n {props.notes.map((note, index) => (\n <li key={index} className=\"flex items-start gap-2.5 text-sm text-muted-foreground\">\n <span aria-hidden=\"true\" className={linkTextClass}>\n ✓\n </span>\n <span className=\"min-w-0\">{note}</span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\nfunction FieldGroup({ props, children }: BaseComponentProps<{ title?: string | null }>) {\n return (\n <section className=\"flex min-w-0 flex-col gap-5\">\n {props.title ? (\n <h2 className={cn('text-[17px] leading-snug text-foreground', headingClass(600))}>\n {props.title}\n </h2>\n ) : null}\n {children}\n </section>\n );\n}\n\n// ─── Result: ResultHeader ────────────────────────────────────────────────────\n\ninterface ResultHeaderProps {\n eyebrow?: string | null;\n title: string;\n subtitle?: string | null;\n}\n\nfunction ResultHeader({ props }: BaseComponentProps<ResultHeaderProps>) {\n const host = useFrameHost();\n return (\n <div className=\"flex items-start justify-between gap-6 max-sm:flex-col\">\n <div className=\"min-w-0\">\n {props.eyebrow ? (\n <p className={cn('mb-1.5 text-[13px] font-semibold', linkTextClass)}>{props.eyebrow}</p>\n ) : null}\n <h1\n className={cn(\n 'text-[28px] leading-[1.12] text-balance text-foreground sm:text-[32px]',\n headingClass(700, true),\n )}\n >\n {props.title}\n </h1>\n {props.subtitle ? (\n <p className=\"mt-2 text-[15px] text-muted-foreground\">{props.subtitle}</p>\n ) : null}\n </div>\n {host.actions && host.actions.length > 0 && host.onAction ? (\n <div className=\"flex shrink-0 gap-2\">\n {host.actions.map((label, i) => (\n <button\n key={`${i}-${label}`}\n type=\"button\"\n onClick={() => host.onAction?.(label)}\n className={cn(\n 'inline-flex min-h-11 items-center rounded-[var(--radius,0.5rem)] px-4 text-sm font-semibold sm:min-h-9',\n focusOutlineClass,\n i === 0\n ? 'bg-primary text-primary-foreground'\n : 'border border-border bg-background text-foreground',\n )}\n >\n {label}\n </button>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n\n// ─── Result: ProportionBar ───────────────────────────────────────────────────\n\ninterface ProportionBarProps {\n label: string;\n total?: number | null;\n of?: number | null;\n unit?: string | null;\n items?: unknown[] | null;\n labelKey: string;\n valueKey: string;\n}\n\n/**\n * A segment's share of the accent, mixed into the muted fill: an even ramp\n * from the full accent down to a quarter of it, in the order the parts come,\n * so two segments are never a near shade of each other the way a fixed\n * cycle's neighbours (85 after 100, 60 after 70) were.\n */\nfunction segmentMix(index: number, count: number): number {\n return count <= 1 ? 100 : Math.round(100 - (index * 75) / (count - 1));\n}\n\nfunction segmentColor(index: number, count: number): string {\n return `color-mix(in oklab, var(--link, var(--primary, hsl(240 5.9% 10%))) ${segmentMix(index, count)}%, var(--muted, hsl(240 4.8% 95.9%)))`;\n}\n\nfunction amount(value: number, unit: string | null | undefined): string {\n if (unit && /^[A-Z]{3}$/.test(unit)) {\n try {\n return new Intl.NumberFormat('en-GB', {\n style: 'currency',\n currency: unit,\n maximumFractionDigits: 0,\n }).format(value);\n } catch {\n /* not a currency code */\n }\n }\n const n = new Intl.NumberFormat('en-GB', { maximumFractionDigits: 2 }).format(value);\n return unit ? `${n} ${unit}` : n;\n}\n\nfunction ProportionBar({ props }: BaseComponentProps<ProportionBarProps>) {\n const rows = (Array.isArray(props.items) ? props.items : []) as Array<Record<string, unknown>>;\n const parts = rows\n .map((row) => ({\n label: String(row[props.labelKey] ?? ''),\n value: Number(row[props.valueKey] ?? 0),\n }))\n .filter((p) => Number.isFinite(p.value) && p.value > 0);\n const sum = parts.reduce((s, p) => s + p.value, 0);\n const total = typeof props.total === 'number' ? props.total : sum;\n const scale = Math.max(sum, total, typeof props.of === 'number' ? props.of : 0) || 1;\n const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);\n return (\n <div\n data-style-panel=\"\"\n className={cn(\n RADIUS,\n panelSurfaceClass,\n panelFlatShadowClass,\n 'flex flex-col gap-3.5 px-6 py-5',\n )}\n >\n <div className=\"flex flex-wrap items-baseline gap-x-2.5\">\n <span className=\"text-[15px] text-muted-foreground\">{props.label}</span>\n <strong className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {amount(total, props.unit)}\n </strong>\n {typeof props.of === 'number' ? (\n <span className=\"text-[15px] text-muted-foreground\">\n of {amount(props.of, props.unit)}\n </span>\n ) : null}\n </div>\n <div className=\"flex h-2 gap-0.5 overflow-hidden rounded-full bg-muted\" aria-hidden=\"true\">\n {parts.map((p, i) => (\n <span\n key={`${i}-${p.label}`}\n style={{\n width: `${(p.value / scale) * 100}%`,\n background: segmentColor(i, parts.length),\n }}\n />\n ))}\n </div>\n <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n {parts.map((p, i) => (\n <li\n key={`${i}-${p.label}`}\n className=\"inline-flex items-center gap-2 text-sm text-muted-foreground\"\n >\n <span\n className=\"size-2 rounded-[2px]\"\n style={{\n background: segmentColor(i, parts.length),\n }}\n aria-hidden=\"true\"\n />\n {cap(p.label)} {amount(p.value, props.unit)}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n// ─── Result: Swatches, Picture, Fact, Detail ─────────────────────────────────\n\n/**\n * A colour value a swatch may paint: a hex code, a colour function, or a\n * keyword. Anything else is result text a model wrote, and painting it would\n * let `url(…)` or `image-set(…)` fetch on paint, the channel the prose\n * renderer closes for images; such an entry draws no swatch.\n */\nconst COLOR_VALUE =\n /^(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\([\\w\\s.,%/+-]*\\)|[a-z]+)$/i;\n\nfunction Swatches({ props }: BaseComponentProps<{ colors: string[] }>) {\n const colors = (props.colors ?? []).filter(\n (c): c is string => typeof c === 'string' && COLOR_VALUE.test(c.trim()),\n );\n return (\n <div className=\"flex flex-wrap gap-2\">\n {colors.map((color, i) => (\n <div key={`${color}-${i}`} className=\"flex flex-col gap-1\">\n <span\n className=\"h-7 w-11 rounded-[3px] border border-border\"\n style={{ backgroundColor: color.trim() }}\n />\n <span className=\"font-mono text-[11px] text-muted-foreground\">{color}</span>\n </div>\n ))}\n </div>\n );\n}\n\nconst ASPECT: Record<string, string> = {\n '16:9': 'aspect-video',\n '4:3': 'aspect-[4/3]',\n '1:1': 'aspect-square',\n};\n\nfunction Picture({\n props,\n}: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>) {\n const path = useAbsolute(props.path);\n const value = useStateValue<unknown>(path);\n const resolve = useResolveUrl();\n // In the result view's order, each through the kernel's gate: the host's\n // resolver on the stored reference, then the file's own public URL, then the\n // reference itself, so a picture shows wherever the result view shows it.\n const content = readImageContent(value);\n const src = content\n ? (viewableUrl(resolve?.(content.url)) ??\n viewableUrl(content.publicUrl) ??\n viewableUrl(content.url))\n : undefined;\n const aspect = props.aspect && props.aspect !== 'auto' ? ASPECT[props.aspect] : undefined;\n if (!src) return null;\n return (\n <img\n src={src}\n alt={props.alt ?? content?.caption ?? ''}\n // A result's URL is the result's to choose, so the host page's address\n // is never sent to it, as with every other picture the package draws.\n referrerPolicy=\"no-referrer\"\n className={cn(\n 'block w-full rounded-[var(--radius,0.5rem)] border border-border bg-muted object-cover',\n aspect,\n )}\n />\n );\n}\n\nfunction present(value: unknown): boolean {\n return value !== undefined && value !== null && value !== '';\n}\n\nfunction Fact({\n props,\n}: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) {\n return (\n <div className=\"flex flex-col gap-1 rounded-[var(--radius,0.5rem)] border border-border bg-background px-4 py-3\">\n <span className=\"text-[13px] text-muted-foreground\">{props.label}</span>\n <span className=\"text-[16px] font-medium text-foreground tabular-nums\">\n {present(props.value) ? String(props.value) : '—'}\n </span>\n {props.detail ? (\n <span className=\"text-[13px] text-muted-foreground\">{props.detail}</span>\n ) : null}\n </div>\n );\n}\n\nfunction Detail({ props }: BaseComponentProps<{ label: string; value?: unknown }>) {\n if (!present(props.value)) return null;\n return (\n // A rule between the rows of a list of details, never under one set in a\n // row: there it read as an underline on every detail but the last.\n <div className=\"grid grid-cols-[minmax(0,8.5rem)_minmax(0,1fr)] gap-3 border-b border-border py-2.5 text-[14px] last:border-b-0 [.flex-row>&]:border-b-0 [.flex-row>&]:grid-cols-[auto_minmax(0,1fr)]\">\n <span className=\"text-muted-foreground\">{props.label}</span>\n <span className=\"text-foreground\">{String(props.value)}</span>\n </div>\n );\n}\n\nconst DATE_STYLES: Record<string, Intl.DateTimeFormatOptions> = {\n long: { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric', timeZone: 'UTC' },\n short: { day: 'numeric', month: 'short', year: 'numeric', timeZone: 'UTC' },\n weekday: { weekday: 'short', day: 'numeric', month: 'long', timeZone: 'UTC' },\n};\n\ninterface DateTextProps {\n value?: string | null;\n style?: 'long' | 'short' | 'weekday' | null;\n tone?: 'default' | 'muted' | 'accent' | null;\n}\n\nfunction DateText({ props }: BaseComponentProps<DateTextProps>) {\n const date = asDate(props.value);\n if (!date) return null;\n const tone =\n props.tone === 'accent'\n ? cn('text-[13px] font-semibold', linkTextClass)\n : props.tone === 'muted'\n ? 'text-sm text-muted-foreground'\n : 'text-[15px] text-foreground';\n return (\n <span className={cn('block', tone)}>\n {date.toLocaleDateString('en-GB', DATE_STYLES[props.style ?? 'long'])}\n </span>\n );\n}\n\ninterface TextListProps {\n items?: unknown;\n marker?: 'bullet' | 'number' | 'check' | null;\n}\n\nfunction TextList({ props }: BaseComponentProps<TextListProps>) {\n const items = Array.isArray(props.items)\n ? props.items.filter((x) => typeof x === 'string' && x.trim())\n : [];\n if (items.length === 0) return null;\n const marker = props.marker ?? 'bullet';\n // Only numbered items are ordered; bullets and checks are a plain list.\n const List = marker === 'number' ? 'ol' : 'ul';\n return (\n <List className=\"flex flex-col gap-2.5\">\n {items.map((text, index) => (\n <li key={index} className=\"flex gap-3 text-[15px] leading-relaxed text-foreground\">\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mt-[0.55em] shrink-0',\n marker === 'bullet' &&\n 'size-1.5 rounded-full bg-[color:var(--link,var(--primary,hsl(240_5.9%_10%)))]',\n marker === 'number' &&\n cn('mt-0 min-w-5 text-sm font-semibold tabular-nums', linkTextClass),\n marker === 'check' && cn('mt-0', linkTextClass),\n )}\n >\n {marker === 'number' ? `${index + 1}.` : marker === 'check' ? '✓' : null}\n </span>\n <span className=\"min-w-0\">{String(text)}</span>\n </li>\n ))}\n </List>\n );\n}\n\nexport const frameRenderers = {\n TextList: (ctx: BaseComponentProps<TextListProps>) => <TextList {...ctx} />,\n DateText: (ctx: BaseComponentProps<DateTextProps>) => <DateText {...ctx} />,\n Composer: (ctx: BaseComponentProps<ComposerProps>) => <Composer {...ctx} />,\n FieldGroup: (ctx: BaseComponentProps<{ title?: string | null }>) => <FieldGroup {...ctx} />,\n ResultHeader: (ctx: BaseComponentProps<ResultHeaderProps>) => <ResultHeader {...ctx} />,\n ProportionBar: (ctx: BaseComponentProps<ProportionBarProps>) => <ProportionBar {...ctx} />,\n Swatches: (ctx: BaseComponentProps<{ colors: string[] }>) => <Swatches {...ctx} />,\n Picture: (\n ctx: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>,\n ) => <Picture {...ctx} />,\n Fact: (ctx: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) => (\n <Fact {...ctx} />\n ),\n Detail: (ctx: BaseComponentProps<{ label: string; value?: unknown }>) => <Detail {...ctx} />,\n};\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 {\n focusOutlineClass,\n linkTextClass,\n selectedBorderClass,\n selectedFillClass,\n} from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelRaisedShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { cn } from '../react/utils';\nimport { useBrand } from './brand-context';\nimport { catalog } from './catalog';\nimport { frameRenderers } from './frame-registry';\nimport { generativeRenderers, useDescriptorScope } 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 * the page's style panel (`--panel-*`), falling back to `bg-card` on\n * `border-border` and a large shadow; a title reads the style's heading face,\n * weight and tracking; a hairline is `border-border`; the call to action wears\n * the style's `--action-shadow`, falling back to a glow of the button colour\n * (`--primary`) composed with `color-mix()` (see `react/style-tokens`); 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=\"rounded-sm text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden\"\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {props.tag ? (\n <span\n className={cn(\n 'min-w-0 truncate rounded-lg border px-2.5 py-1 font-mono text-[11px]',\n selectedBorderClass,\n selectedFillClass,\n linkTextClass,\n )}\n >\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\n className={cn('mb-4 text-[11px] font-medium tracking-[0.15em] uppercase', linkTextClass)}\n >\n {props.eyebrow}\n </p>\n ) : null}\n <h1\n className={cn(\n 'max-w-2xl text-4xl text-foreground sm:text-[44px] sm:leading-[1.15]',\n headingClass(700, true),\n )}\n >\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={cn('mb-6 text-xl text-foreground', headingClass(600, true))}>\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={cn('font-mono text-[12px]', linkTextClass)}>{props.number}</span>\n ) : null}\n <h2 className={cn('text-xl text-foreground', headingClass(600, true))}>{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\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-7 text-card-foreground',\n panelSurfaceClass,\n panelRaisedShadowClass,\n )}\n >\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 // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n return (\n <div className=\"mt-6\">\n <button\n type=\"button\"\n disabled={busy}\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 transition-all hover:bg-primary/90',\n // The page's call-to-action shadow, or the glow in the button colour\n // it had. Focus is an outline, which no shadow a style sets can\n // replace or hide.\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\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 ...frameRenderers,\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';\nimport { isThenable } from '../react/utils';\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 /**\n * What `run` does. Receives the state at the moment the call to action was\n * pressed. Return the run's promise and a press while it is pending starts\n * nothing.\n */\n onRun?: (state: StateModel) => void | Promise<unknown>;\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 // One run at a time. The run button is held by the host's `env.disabled`,\n // which arrives on a later render: a host that sets it after an await (or\n // never) left a second press inside that wait free to start a second\n // billed run. The guard is held until what `onRun` returns settles, and\n // released at once for an `onRun` that returns nothing, where the host's\n // own state covers the run.\n const running = React.useRef(false);\n const [handlers] = React.useState(() => ({\n run: () => {\n if (running.current) return undefined;\n running.current = true;\n let pending: unknown;\n try {\n pending = latest.current.onRun?.(latest.current.store.getSnapshot());\n } catch (error) {\n running.current = false;\n throw error;\n }\n if (isThenable(pending)) {\n // Any thenable holds the guard, a promise from another realm\n // included, and json-render still receives what the host returned,\n // its rejection included.\n return Promise.resolve(pending).finally(() => {\n running.current = false;\n });\n }\n running.current = false;\n return undefined;\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 { AppStyleId } from '../brand/styles';\nimport type { PagePlan } from '../generated/layout-design/types';\nimport type { Frame } from './frame-definitions';\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 frame it was written for, when not a whole product page: `composer` or `result`. */\n frame?: Exclude<Frame, 'page'>;\n /** The style the brief carried, when it carried one. */\n style?: AppStyleId;\n /**\n * How many times the method's repair pass re-emitted it before it passed\n * the checks, when it needed any: the page as stored is the last pass's.\n */\n repairs?: number;\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\ntype Provenance = Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic' | 'frame' | 'style'>;\n\n/**\n * The id a story and a screenshot are keyed by: producer, model, the frame and\n * the style it was written for, and the two procedures that change what a run\n * is. `pipelex-method--gpt-5.5--seeded`,\n * `pipelex-method--gpt-6.1-sol--composer--soft--seeded`.\n */\nexport function fixtureId(fixture: Provenance) {\n return [\n fixture.producer,\n fixture.model,\n fixture.frame ?? null,\n fixture.style ?? null,\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(fixture: Provenance & Pick<SpecFixture, 'repairs'>): string {\n const parts = [PRODUCER_LABEL[fixture.producer], fixture.model];\n if (fixture.frame) parts.push(`${fixture.frame} frame`);\n if (fixture.style) parts.push(`${fixture.style} style`);\n if (fixture.seed) parts.push('with a seed');\n if (fixture.repairs) parts.push(`repaired × ${fixture.repairs}`);\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"]}