@pipelex/mthds-form 0.30.0 → 0.32.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,1215 +1,51 @@
1
+ export { BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, ComponentRendering, CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, DesignerAction, DesignerBrief, DesignerCatalog, DesignerCatalogOptions, DesignerComponent, DesignerPathEntry, DesignerStyle, FRAMES, FRAME_COMPONENTS, Frame, GenerativeSpec, ICON_NAMES, INPUTS_ROOT, InputBriefOptions, LayoutCheck, LayoutDescriptor, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, Producer, ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, ResultBriefOptions, SpecFixture, SpecProblem, SpecVerdict, ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog } from './headless/index.js';
1
2
  import * as _json_render_core from '@json-render/core';
2
3
  import { Spec, StateStore, StateModel } from '@json-render/core';
3
- import * as zod from 'zod';
4
- import { z } from 'zod';
5
- import { RunField } from '../core/descriptor.js';
6
- import * as react from 'react';
7
- import * as _json_render_react from '@json-render/react';
8
- import { Components, Renderer } from '@json-render/react';
9
- import { B as BrandManifest } from '../manifest-DUeAWeqa.js';
10
- export { b as brandManifestSchema } from '../manifest-DUeAWeqa.js';
11
- import * as zod_v4_core from 'zod/v4/core';
12
- import { F as FieldEnv } from '../field-renderer-Dz03dpig.js';
13
- export { seedInputs } from '../core/seed.js';
14
- import '../core/contracts.js';
15
- import 'mthds/protocol';
16
- import '../core/file-formats.js';
17
- import '../core/sources.js';
18
-
19
- /**
20
- * Whether a spec is one this catalog can render - the check every source
21
- * passes, whoever wrote it.
22
- *
23
- * Three layers, because json-render's own `catalog.validate()` covers only the
24
- * first two once a catalog has more than one component: it checks the element
25
- * TYPE against the component names, but `propsOf` degrades to "any record"
26
- * when several definitions could apply, so a misspelt or invented prop passes.
27
- * The per-component prop check is therefore this module's, and it has to be
28
- * expression-aware: a bound prop's raw value is `{ "$state": "/path" }`, which
29
- * the component's own zod schema (`z.string()`) would reject, so a dynamic
30
- * expression is accepted wherever the prop EXISTS and a literal is parsed
31
- * against the prop's schema.
32
- *
33
- * The checks are the same whichever catalog a spec was written against; the
34
- * catalog is a parameter, this entry's own by default, so a host that defines
35
- * a vocabulary of its own is validated by the same code and not by a copy of
36
- * it.
37
- *
38
- * What a component renders beyond its schema - the heading its title is, the
39
- * landmark it renders as, the fixed number of children it lays out, the panel
40
- * per entry of one of its props - is a fact about its renderer that no schema
41
- * states, so the catalog carries it as `renders`, declared beside the
42
- * definitions, and the validator reads it off the catalog it is handed rather
43
- * than assuming it from a component's name, which a host's vocabulary may
44
- * reuse for something that renders nothing of the kind. This entry's catalog
45
- * declares its own; a host's declares what its renderers do, or nothing, and
46
- * is then held only to what its schemas and its `Heading` elements say.
47
- */
48
- /**
49
- * What one component renders beyond what its props schema says, and what the
50
- * validator holds a layout to on that account. Every member is optional: a
51
- * component with none is held to its schema alone.
52
- */
53
- interface ComponentRendering {
54
- /**
55
- * The heading its renderer emits, at this level - a `Hero`'s headline is
56
- * the h1 - and, when it emits one only if a prop is set, the prop: a `Card`
57
- * renders its `title` as an h3 and nothing when it has none.
58
- */
59
- heading?: {
60
- level: 1 | 2 | 3 | 4;
61
- when?: string;
62
- };
63
- /** What it renders as that a page has one of - a landmark, in the words a refusal uses: "the page's banner". */
64
- once?: string;
65
- /** The number of children its renderer lays out, dropping the rest in silence, and what they are. */
66
- children?: {
67
- count: number;
68
- roles: string;
69
- };
70
- /** A panelled container: the prop that lists its panels, one child per entry, and what one is called. */
71
- panels?: {
72
- prop: string;
73
- noun: string;
74
- };
75
- }
76
- /** What the validator reads off a catalog: its names, its definitions, and what its components render. */
77
- interface ValidationCatalog {
78
- componentNames: readonly string[];
79
- /** The catalog's own action names. A `defineCatalog` result carries this already. */
80
- actionNames?: readonly string[];
81
- data: unknown;
82
- /** The schema the catalog was defined against, for the actions its runtime handles without a handler. */
83
- schema?: {
84
- builtInActions?: readonly {
85
- name: string;
86
- }[];
87
- };
88
- /** What each component renders beyond its schema, by component name. Absent, no component renders a heading, a landmark or a fixed set of children. */
89
- renders?: Readonly<Record<string, ComponentRendering>>;
90
- }
91
- interface SpecProblem {
92
- elementKey?: string;
93
- message: string;
94
- }
95
- interface SpecVerdict {
96
- ok: boolean;
97
- problems: SpecProblem[];
98
- }
99
- /**
100
- * Whether a spec is one this catalog can render.
101
- *
102
- * The checks live in `checkAgainstCatalog`; this is the boundary that keeps the
103
- * documented promise around them - it answers with problems, not exceptions.
104
- * That promise was not kept: `validateSpec` throws on `repeat: null`, on
105
- * `children: 5`, on `props: 5`, on a null element and on a missing `elements`
106
- * map, all of which a model can emit. A host calls this to decide whether it is
107
- * safe to render, so a throw leaves it with no verdict at the one moment it
108
- * needs one, and the fallback to the plain form never fires.
109
- */
110
- declare function validateAgainstCatalog(spec: Spec, catalog?: ValidationCatalog): SpecVerdict;
111
- /** The problems as one block, for a failing test or a repair prompt. */
112
- declare function formatProblems(problems: readonly SpecProblem[]): string;
113
-
114
- /**
115
- * The catalog: everything the base vocabulary has, plus the chrome of a
116
- * product page - a bar with the logo, a hero, a workspace that puts a panel
117
- * beside the work, a section, a raised rail, the summary rows a rail can be
118
- * made of, a call to action, a footer line. They are vocabulary, not a
119
- * template: the designer method prescribes no composition, and a layout uses
120
- * whichever of them serve it. Each description says what the component IS and
121
- * how it renders - a heading level, a landmark, a fixed child count - and never
122
- * where it must go or whether a page must have it, because the descriptions
123
- * travel to the model as data and would otherwise be the mandate the method
124
- * gave up. The vocabulary names no brand: the logo is whichever the manifest
125
- * carries and the accent is whichever the host's theme tokens set.
126
- *
127
- * Rule 1 holds here as it does everywhere in this entry: a component takes
128
- * copy and bound values, never a schema, and the fields the kernel owns are
129
- * still `MthdsField` elements naming a path.
130
- */
131
- declare const PRODUCT_COMPONENTS: readonly ["AppBar", "Hero", "Workspace", "Section", "Rail", "SummaryRow", "Cta", "Footer"];
132
- type ProductComponentName = (typeof PRODUCT_COMPONENTS)[number];
133
- /**
134
- * What this entry's components render beyond their schemas - the heading a
135
- * title is, the landmark a bar or a footer renders as, the two children a
136
- * split lays out, the panel per tab or step - declared once here, where the
137
- * descriptions above say the same in prose for the model, and carried on the
138
- * catalog so the validator reads it off whichever catalog it is handed. A
139
- * host validating against a vocabulary of its own declares what its
140
- * renderers do, or nothing.
141
- */
142
- declare const COMPONENT_RENDERINGS: Readonly<Record<string, ComponentRendering>>;
143
- declare const catalog: _json_render_core.Catalog<{
144
- spec: _json_render_core.SchemaType<"object", {
145
- root: _json_render_core.SchemaType<"string", unknown>;
146
- elements: _json_render_core.SchemaType<"record", _json_render_core.SchemaType<"object", {
147
- type: _json_render_core.SchemaType<"ref", string>;
148
- props: _json_render_core.SchemaType<"propsOf", string>;
149
- children: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
150
- slots: {
151
- optional: true;
152
- kind: "record";
153
- inner?: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>> | undefined;
154
- };
155
- visible: {
156
- optional: true;
157
- kind: "any";
158
- inner?: unknown;
159
- };
160
- repeat: {
161
- optional: true;
162
- kind: "any";
163
- inner?: unknown;
164
- };
165
- }>>;
166
- }>;
167
- catalog: _json_render_core.SchemaType<"object", {
168
- components: _json_render_core.SchemaType<"map", {
169
- props: _json_render_core.SchemaType<"zod", unknown>;
170
- slots: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
171
- description: _json_render_core.SchemaType<"string", unknown>;
172
- example: _json_render_core.SchemaType<"any", unknown>;
173
- }>;
174
- actions: _json_render_core.SchemaType<"map", {
175
- params: _json_render_core.SchemaType<"zod", unknown>;
176
- description: _json_render_core.SchemaType<"string", unknown>;
177
- }>;
178
- }>;
179
- }, {
180
- components: {
181
- AppBar: {
182
- props: z.ZodObject<{
183
- app: z.ZodString;
184
- links: z.ZodNullable<z.ZodArray<z.ZodString>>;
185
- tag: z.ZodNullable<z.ZodString>;
186
- }, z.core.$strip>;
187
- slots: never[];
188
- description: string;
189
- example: {
190
- app: string;
191
- links: string[];
192
- tag: string;
193
- };
194
- };
195
- Hero: {
196
- props: z.ZodObject<{
197
- headline: z.ZodString;
198
- lede: z.ZodNullable<z.ZodString>;
199
- eyebrow: z.ZodNullable<z.ZodString>;
200
- }, z.core.$strip>;
201
- slots: never[];
202
- description: string;
203
- example: {
204
- headline: string;
205
- lede: string;
206
- };
207
- };
208
- Workspace: {
209
- props: z.ZodObject<{
210
- rail: z.ZodNullable<z.ZodEnum<{
211
- right: "right";
212
- left: "left";
213
- }>>;
214
- }, z.core.$strip>;
215
- slots: string[];
216
- description: string;
217
- example: {
218
- rail: string;
219
- };
220
- };
221
- Section: {
222
- props: z.ZodObject<{
223
- number: z.ZodNullable<z.ZodString>;
224
- title: z.ZodString;
225
- lede: z.ZodNullable<z.ZodString>;
226
- }, z.core.$strip>;
227
- slots: string[];
228
- description: string;
229
- example: {
230
- number: string;
231
- title: string;
232
- };
233
- };
234
- Rail: {
235
- props: z.ZodObject<{
236
- title: z.ZodString;
237
- }, z.core.$strip>;
238
- slots: string[];
239
- description: string;
240
- example: {
241
- title: string;
242
- };
243
- };
244
- SummaryRow: {
245
- props: z.ZodObject<{
246
- label: z.ZodString;
247
- value: z.ZodNullable<z.ZodAny>;
248
- detail: z.ZodNullable<z.ZodAny>;
249
- separator: z.ZodNullable<z.ZodString>;
250
- placeholder: z.ZodNullable<z.ZodString>;
251
- }, z.core.$strip>;
252
- slots: never[];
253
- description: string;
254
- example: {
255
- label: string;
256
- value: {
257
- $state: string;
258
- };
259
- detail: {
260
- $state: string;
261
- };
262
- };
263
- };
264
- Cta: {
265
- props: z.ZodObject<{
266
- label: z.ZodString;
267
- hint: z.ZodNullable<z.ZodString>;
268
- }, z.core.$strip>;
269
- slots: never[];
270
- events: string[];
271
- description: string;
272
- example: {
273
- label: string;
274
- hint: string;
275
- };
276
- };
277
- Footer: {
278
- props: z.ZodObject<{
279
- text: z.ZodString;
280
- tag: z.ZodNullable<z.ZodString>;
281
- }, z.core.$strip>;
282
- slots: never[];
283
- description: string;
284
- example: {
285
- text: string;
286
- tag: string;
287
- };
288
- };
289
- Card: {
290
- props: z.ZodObject<{
291
- description: z.ZodNullable<z.ZodString>;
292
- title: z.ZodNullable<z.ZodString>;
293
- }, z.core.$strip>;
294
- description: string;
295
- slots: string[];
296
- example: {
297
- title: string;
298
- description: string;
299
- };
300
- };
301
- Stack: {
302
- props: z.ZodObject<{
303
- direction: z.ZodNullable<z.ZodEnum<{
304
- horizontal: "horizontal";
305
- vertical: "vertical";
306
- }>>;
307
- gap: z.ZodNullable<z.ZodEnum<{
308
- sm: "sm";
309
- md: "md";
310
- lg: "lg";
311
- none: "none";
312
- xl: "xl";
313
- }>>;
314
- align: z.ZodNullable<z.ZodEnum<{
315
- start: "start";
316
- center: "center";
317
- end: "end";
318
- stretch: "stretch";
319
- }>>;
320
- justify: z.ZodNullable<z.ZodEnum<{
321
- start: "start";
322
- center: "center";
323
- end: "end";
324
- between: "between";
325
- around: "around";
326
- }>>;
327
- }, z.core.$strip>;
328
- slots: string[];
329
- description: string;
330
- example: {
331
- direction: string;
332
- gap: string;
333
- };
334
- };
335
- Grid: {
336
- props: z.ZodObject<{
337
- gap: z.ZodNullable<z.ZodEnum<{
338
- sm: "sm";
339
- md: "md";
340
- lg: "lg";
341
- xl: "xl";
342
- }>>;
343
- columns: z.ZodNullable<z.ZodNumber>;
344
- }, z.core.$strip>;
345
- slots: string[];
346
- description: string;
347
- example: {
348
- columns: number;
349
- gap: string;
350
- };
351
- };
352
- Separator: {
353
- props: z.ZodObject<{
354
- orientation: z.ZodNullable<z.ZodEnum<{
355
- horizontal: "horizontal";
356
- vertical: "vertical";
357
- }>>;
358
- }, z.core.$strip>;
359
- description: string;
360
- };
361
- Collapsible: {
362
- props: z.ZodObject<{
363
- title: z.ZodString;
364
- defaultOpen: z.ZodNullable<z.ZodBoolean>;
365
- }, z.core.$strip>;
366
- slots: string[];
367
- description: string;
368
- };
369
- Heading: {
370
- props: z.ZodObject<{
371
- text: z.ZodString;
372
- level: z.ZodNullable<z.ZodEnum<{
373
- h1: "h1";
374
- h2: "h2";
375
- h3: "h3";
376
- h4: "h4";
377
- }>>;
378
- }, z.core.$strip>;
379
- description: string;
380
- example: {
381
- text: string;
382
- level: string;
383
- };
384
- };
385
- Text: {
386
- props: z.ZodObject<{
387
- text: z.ZodString;
388
- variant: z.ZodNullable<z.ZodEnum<{
389
- body: "body";
390
- caption: "caption";
391
- muted: "muted";
392
- lead: "lead";
393
- code: "code";
394
- }>>;
395
- }, z.core.$strip>;
396
- description: string;
397
- example: {
398
- text: string;
399
- };
400
- };
401
- Badge: {
402
- props: z.ZodObject<{
403
- text: z.ZodString;
404
- variant: z.ZodNullable<z.ZodEnum<{
405
- default: "default";
406
- secondary: "secondary";
407
- destructive: "destructive";
408
- outline: "outline";
409
- }>>;
410
- }, z.core.$strip>;
411
- description: string;
412
- example: {
413
- text: string;
414
- variant: string;
415
- };
416
- };
417
- Alert: {
418
- props: z.ZodObject<{
419
- title: z.ZodString;
420
- message: z.ZodNullable<z.ZodString>;
421
- type: z.ZodNullable<z.ZodEnum<{
422
- success: "success";
423
- info: "info";
424
- warning: "warning";
425
- error: "error";
426
- }>>;
427
- }, z.core.$strip>;
428
- description: string;
429
- example: {
430
- title: string;
431
- message: string;
432
- type: string;
433
- };
434
- };
435
- Progress: {
436
- props: z.ZodObject<{
437
- value: z.ZodNumber;
438
- max: z.ZodNullable<z.ZodNumber>;
439
- label: z.ZodNullable<z.ZodString>;
440
- }, z.core.$strip>;
441
- description: string;
442
- example: {
443
- value: number;
444
- max: number;
445
- label: string;
446
- };
447
- };
448
- Avatar: {
449
- description: string;
450
- props: z.ZodObject<{
451
- src: z.ZodNullable<z.ZodString>;
452
- name: z.ZodString;
453
- size: z.ZodNullable<z.ZodEnum<{
454
- sm: "sm";
455
- md: "md";
456
- lg: "lg";
457
- }>>;
458
- }, z.core.$strip>;
459
- example: {
460
- name: string;
461
- size: string;
462
- };
463
- };
464
- Input: {
465
- props: z.ZodObject<{
466
- label: z.ZodString;
467
- name: z.ZodString;
468
- type: z.ZodNullable<z.ZodEnum<{
469
- number: "number";
470
- text: "text";
471
- email: "email";
472
- password: "password";
473
- }>>;
474
- placeholder: z.ZodNullable<z.ZodString>;
475
- value: z.ZodNullable<z.ZodString>;
476
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
477
- type: z.ZodString;
478
- message: z.ZodString;
479
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
480
- }, z.core.$strip>>>;
481
- validateOn: z.ZodNullable<z.ZodEnum<{
482
- change: "change";
483
- blur: "blur";
484
- submit: "submit";
485
- }>>;
486
- }, z.core.$strip>;
487
- events: string[];
488
- description: string;
489
- example: {
490
- label: string;
491
- name: string;
492
- type: string;
493
- placeholder: string;
494
- };
495
- };
496
- Textarea: {
497
- props: z.ZodObject<{
498
- label: z.ZodString;
499
- name: z.ZodString;
500
- placeholder: z.ZodNullable<z.ZodString>;
501
- rows: z.ZodNullable<z.ZodNumber>;
502
- value: z.ZodNullable<z.ZodString>;
503
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
504
- type: z.ZodString;
505
- message: z.ZodString;
506
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
507
- }, z.core.$strip>>>;
508
- validateOn: z.ZodNullable<z.ZodEnum<{
509
- change: "change";
510
- blur: "blur";
511
- submit: "submit";
512
- }>>;
513
- }, z.core.$strip>;
514
- description: string;
515
- };
516
- Select: {
517
- props: z.ZodObject<{
518
- label: z.ZodString;
519
- name: z.ZodString;
520
- options: z.ZodArray<z.ZodString>;
521
- placeholder: z.ZodNullable<z.ZodString>;
522
- value: z.ZodNullable<z.ZodString>;
523
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
524
- type: z.ZodString;
525
- message: z.ZodString;
526
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
527
- }, z.core.$strip>>>;
528
- validateOn: z.ZodNullable<z.ZodEnum<{
529
- change: "change";
530
- blur: "blur";
531
- submit: "submit";
532
- }>>;
533
- }, z.core.$strip>;
534
- events: string[];
535
- description: string;
536
- };
537
- Radio: {
538
- props: z.ZodObject<{
539
- label: z.ZodString;
540
- name: z.ZodString;
541
- options: z.ZodArray<z.ZodString>;
542
- value: z.ZodNullable<z.ZodString>;
543
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
544
- type: z.ZodString;
545
- message: z.ZodString;
546
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
547
- }, z.core.$strip>>>;
548
- validateOn: z.ZodNullable<z.ZodEnum<{
549
- change: "change";
550
- blur: "blur";
551
- submit: "submit";
552
- }>>;
553
- }, z.core.$strip>;
554
- events: string[];
555
- description: string;
556
- };
557
- Checkbox: {
558
- props: z.ZodObject<{
559
- label: z.ZodString;
560
- name: z.ZodString;
561
- checked: z.ZodNullable<z.ZodBoolean>;
562
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
563
- type: z.ZodString;
564
- message: z.ZodString;
565
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
566
- }, z.core.$strip>>>;
567
- validateOn: z.ZodNullable<z.ZodEnum<{
568
- change: "change";
569
- blur: "blur";
570
- submit: "submit";
571
- }>>;
572
- }, z.core.$strip>;
573
- events: string[];
574
- description: string;
575
- };
576
- Switch: {
577
- props: z.ZodObject<{
578
- label: z.ZodString;
579
- name: z.ZodString;
580
- checked: z.ZodNullable<z.ZodBoolean>;
581
- checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
582
- type: z.ZodString;
583
- message: z.ZodString;
584
- args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
585
- }, z.core.$strip>>>;
586
- validateOn: z.ZodNullable<z.ZodEnum<{
587
- change: "change";
588
- blur: "blur";
589
- submit: "submit";
590
- }>>;
591
- }, z.core.$strip>;
592
- events: string[];
593
- description: string;
594
- };
595
- Button: {
596
- props: z.ZodObject<{
597
- label: z.ZodString;
598
- variant: z.ZodNullable<z.ZodEnum<{
599
- secondary: "secondary";
600
- primary: "primary";
601
- danger: "danger";
602
- }>>;
603
- disabled: z.ZodNullable<z.ZodBoolean>;
604
- }, z.core.$strip>;
605
- events: string[];
606
- description: string;
607
- example: {
608
- label: string;
609
- variant: string;
610
- };
611
- };
612
- Split: {
613
- props: z.ZodObject<{
614
- ratio: z.ZodNullable<z.ZodEnum<{
615
- "1:1": "1:1";
616
- "1:2": "1:2";
617
- "2:1": "2:1";
618
- }>>;
619
- gap: z.ZodNullable<z.ZodEnum<{
620
- md: "md";
621
- lg: "lg";
622
- xl: "xl";
623
- }>>;
624
- }, z.core.$strip>;
625
- slots: string[];
626
- description: string;
627
- example: {
628
- ratio: string;
629
- gap: string;
630
- };
631
- };
632
- Tabs: {
633
- props: z.ZodObject<{
634
- tabs: z.ZodArray<z.ZodObject<{
635
- label: z.ZodString;
636
- value: z.ZodString;
637
- }, z.core.$strip>>;
638
- }, z.core.$strip>;
639
- slots: string[];
640
- description: string;
641
- example: {
642
- tabs: {
643
- label: string;
644
- value: string;
645
- }[];
646
- };
647
- };
648
- Steps: {
649
- props: z.ZodObject<{
650
- steps: z.ZodArray<z.ZodString>;
651
- nextLabel: z.ZodNullable<z.ZodString>;
652
- backLabel: z.ZodNullable<z.ZodString>;
653
- }, z.core.$strip>;
654
- slots: string[];
655
- description: string;
656
- example: {
657
- steps: string[];
658
- nextLabel: string;
659
- };
660
- };
661
- Icon: {
662
- props: z.ZodObject<{
663
- name: z.ZodEnum<{
664
- Sparkles: "Sparkles";
665
- Rocket: "Rocket";
666
- Compass: "Compass";
667
- Map: "Map";
668
- MapPin: "MapPin";
669
- Route: "Route";
670
- Plane: "Plane";
671
- Train: "Train";
672
- Car: "Car";
673
- Ship: "Ship";
674
- Hotel: "Hotel";
675
- Home: "Home";
676
- Building2: "Building2";
677
- Landmark: "Landmark";
678
- Globe: "Globe";
679
- Mountain: "Mountain";
680
- Leaf: "Leaf";
681
- Sun: "Sun";
682
- Moon: "Moon";
683
- Calendar: "Calendar";
684
- Clock: "Clock";
685
- Hourglass: "Hourglass";
686
- Users: "Users";
687
- User: "User";
688
- Baby: "Baby";
689
- Accessibility: "Accessibility";
690
- Heart: "Heart";
691
- Star: "Star";
692
- Utensils: "Utensils";
693
- Coffee: "Coffee";
694
- Music: "Music";
695
- Camera: "Camera";
696
- Image: "Image";
697
- Ticket: "Ticket";
698
- Gift: "Gift";
699
- Wallet: "Wallet";
700
- Banknote: "Banknote";
701
- Coins: "Coins";
702
- Receipt: "Receipt";
703
- Percent: "Percent";
704
- Hash: "Hash";
705
- TrendingUp: "TrendingUp";
706
- BarChart3: "BarChart3";
707
- FileText: "FileText";
708
- Upload: "Upload";
709
- Paperclip: "Paperclip";
710
- Mail: "Mail";
711
- Phone: "Phone";
712
- Tag: "Tag";
713
- Layers: "Layers";
714
- ListChecks: "ListChecks";
715
- CheckCircle2: "CheckCircle2";
716
- AlertCircle: "AlertCircle";
717
- Info: "Info";
718
- Shield: "Shield";
719
- Flag: "Flag";
720
- Bookmark: "Bookmark";
721
- Briefcase: "Briefcase";
722
- Package: "Package";
723
- Truck: "Truck";
724
- Lightbulb: "Lightbulb";
725
- Zap: "Zap";
726
- Pencil: "Pencil";
727
- Send: "Send";
728
- }>;
729
- size: z.ZodNullable<z.ZodEnum<{
730
- sm: "sm";
731
- md: "md";
732
- lg: "lg";
733
- }>>;
734
- }, z.core.$strip>;
735
- slots: never[];
736
- description: string;
737
- example: {
738
- name: string;
739
- size: string;
740
- };
741
- };
742
- Segmented: {
743
- props: z.ZodObject<{
744
- label: z.ZodString;
745
- name: z.ZodString;
746
- options: z.ZodArray<z.ZodString>;
747
- value: z.ZodNullable<z.ZodString>;
748
- }, z.core.$strip>;
749
- slots: never[];
750
- description: string;
751
- example: {
752
- label: string;
753
- name: string;
754
- options: string[];
755
- value: {
756
- $bindState: string;
757
- };
758
- };
759
- };
760
- NumberInput: {
761
- props: z.ZodObject<{
762
- label: z.ZodString;
763
- name: z.ZodString;
764
- value: z.ZodNullable<z.ZodNumber>;
765
- placeholder: z.ZodNullable<z.ZodString>;
766
- unit: z.ZodNullable<z.ZodString>;
767
- min: z.ZodNullable<z.ZodNumber>;
768
- max: z.ZodNullable<z.ZodNumber>;
769
- step: z.ZodNullable<z.ZodNumber>;
770
- }, z.core.$strip>;
771
- slots: never[];
772
- description: string;
773
- example: {
774
- label: string;
775
- name: string;
776
- value: {
777
- $bindState: string;
778
- };
779
- placeholder: string;
780
- };
781
- };
782
- MthdsField: {
783
- props: z.ZodObject<{
784
- path: z.ZodString;
785
- }, z.core.$strip>;
786
- slots: never[];
787
- description: string;
788
- example: {
789
- path: string;
790
- };
791
- };
792
- MthdsResult: {
793
- props: z.ZodObject<{
794
- path: z.ZodString;
795
- hideLabel: z.ZodNullable<z.ZodBoolean>;
796
- }, z.core.$strip>;
797
- slots: never[];
798
- description: string;
799
- example: {
800
- path: string;
801
- };
802
- };
803
- DataTable: {
804
- props: z.ZodObject<{
805
- rows: z.ZodAny;
806
- columns: z.ZodArray<z.ZodObject<{
807
- path: z.ZodString;
808
- label: z.ZodString;
809
- }, z.core.$strip>>;
810
- caption: z.ZodNullable<z.ZodString>;
811
- }, z.core.$strip>;
812
- slots: never[];
813
- description: string;
814
- example: {
815
- rows: {
816
- $state: string;
817
- };
818
- columns: {
819
- path: string;
820
- label: string;
821
- }[];
822
- };
823
- };
824
- Metric: {
825
- props: z.ZodObject<{
826
- label: z.ZodString;
827
- value: z.ZodAny;
828
- unit: z.ZodNullable<z.ZodString>;
829
- format: z.ZodNullable<z.ZodEnum<{
830
- plain: "plain";
831
- integer: "integer";
832
- decimal: "decimal";
833
- compact: "compact";
834
- }>>;
835
- }, z.core.$strip>;
836
- slots: never[];
837
- description: string;
838
- example: {
839
- label: string;
840
- value: {
841
- $state: string;
842
- };
843
- unit: string;
844
- format: string;
845
- };
846
- };
847
- };
848
- actions: {
849
- run: {
850
- params: z.ZodObject<{}, z.core.$strip>;
851
- description: string;
852
- };
853
- };
854
- }> & {
855
- renders: Readonly<Record<string, ComponentRendering>>;
856
- };
857
- /** The spec type a layout is written against. */
858
- type GenerativeSpec = typeof catalog._specType;
859
- /**
860
- * Every component name the catalog knows, the shadcn subset first. This is
861
- * the order the designer method lists them in, since `designerCatalog()`
862
- * walks it; the rules and the direction that name them are the method's own
863
- * prose, in `methods/layout-design.mthds`.
864
- */
865
- declare const COMPONENT_NAMES: readonly string[];
866
-
867
- /** The shadcn subset, by name. The order is the order the prompt lists them. */
868
- declare const PICKED_SHADCN: readonly ["Card", "Stack", "Grid", "Separator", "Heading", "Text", "Badge", "Alert", "Collapsible", "Progress", "Avatar", "Input", "Textarea", "Select", "Radio", "Checkbox", "Switch", "Button"];
869
- /** Our own, by name. */
870
- declare const CUSTOM_COMPONENTS: readonly ["Split", "Tabs", "Steps", "Icon", "Segmented", "NumberInput", "MthdsField", "MthdsResult", "DataTable", "Metric"];
871
- /**
872
- * The value formats a `Metric` can apply. A model picks one; the registry
873
- * formats with `Intl.NumberFormat`.
874
- */
875
- declare const METRIC_FORMATS: readonly ["plain", "integer", "decimal", "compact"];
876
- /**
877
- * The icons a spec may name: lucide's, a closed list so a misspelt name fails
878
- * validation rather than rendering nothing. Chosen for what pages about
879
- * methods talk about - people, places, money, time, files, standing.
880
- */
881
- declare const ICON_NAMES: readonly ["Sparkles", "Rocket", "Compass", "Map", "MapPin", "Route", "Plane", "Train", "Car", "Ship", "Hotel", "Home", "Building2", "Landmark", "Globe", "Mountain", "Leaf", "Sun", "Moon", "Calendar", "Clock", "Hourglass", "Users", "User", "Baby", "Accessibility", "Heart", "Star", "Utensils", "Coffee", "Music", "Camera", "Image", "Ticket", "Gift", "Wallet", "Banknote", "Coins", "Receipt", "Percent", "Hash", "TrendingUp", "BarChart3", "FileText", "Upload", "Paperclip", "Mail", "Phone", "Tag", "Layers", "ListChecks", "CheckCircle2", "AlertCircle", "Info", "Shield", "Flag", "Bookmark", "Briefcase", "Package", "Truck", "Lightbulb", "Zap", "Pencil", "Send"];
882
-
883
- /** One action a page may bind to an event: its name, what it does, and whether the runtime handles it on its own. */
884
- declare const ActionSchema: z.ZodObject<{
885
- name: z.ZodString;
886
- description: z.ZodString;
887
- built_in: z.ZodBoolean;
888
- }, z.core.$strip>;
889
- type Action = z.infer<typeof ActionSchema>;
890
- /** The page's half of the prompt, as data: which page it is and for which pipe, every path in the state with what it is, which paths are delegated and what gates the run, and on a result page the state of one real run - rendered from the method's own descriptor and from nothing else. */
891
- declare const BriefSchema: z.ZodObject<{
892
- side: z.ZodEnum<{
893
- input: "input";
894
- result: "result";
895
- }>;
896
- pipe_ref: z.ZodString;
897
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
898
- name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
899
- paths: z.ZodArray<z.ZodLazy<z.ZodObject<{
900
- depth: z.ZodNumber;
901
- path: z.ZodString;
902
- kind: z.ZodString;
903
- name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
904
- title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
905
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
906
- required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
907
- gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
908
- notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
909
- default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
910
- delegated: z.ZodBoolean;
911
- relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
912
- item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
913
- item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
914
- item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
915
- }, z.core.$strip>>>;
916
- run_control: z.ZodOptional<z.ZodNullable<z.ZodString>>;
917
- sample_state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
918
- }, z.core.$strip>;
919
- type Brief = z.infer<typeof BriefSchema>;
920
- /** The vocabulary a page may be made of: the components a renderer implements and the actions a page may bind to an event, each with its contract. */
921
- declare const CatalogSchema: z.ZodObject<{
922
- components: z.ZodArray<z.ZodLazy<z.ZodObject<{
923
- name: z.ZodString;
924
- props: z.ZodString;
925
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
926
- accepts_children: z.ZodBoolean;
927
- slots: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
928
- events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
929
- }, z.core.$strip>>>;
930
- actions: z.ZodArray<z.ZodLazy<z.ZodObject<{
931
- name: z.ZodString;
932
- description: z.ZodString;
933
- built_in: z.ZodBoolean;
934
- }, z.core.$strip>>>;
935
- }, z.core.$strip>;
936
- type Catalog = z.infer<typeof CatalogSchema>;
937
- /** One component of the catalog: its name, the signature of its props, what it is for, and what it accepts. */
938
- declare const ComponentSchema: z.ZodObject<{
939
- name: z.ZodString;
940
- props: z.ZodString;
941
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
942
- accepts_children: z.ZodBoolean;
943
- slots: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
944
- events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
945
- }, z.core.$strip>;
946
- type Component = z.infer<typeof ComponentSchema>;
947
- /** The designer's plan for one page, settled before any element is written: what the page is for, how it is composed - a decision the plan makes, with no shape given in advance - what each region shows or collects and with which components, what runs the method, and what is delegated. */
948
- declare const PagePlanSchema: z.ZodObject<{
949
- purpose: z.ZodString;
950
- title: z.ZodString;
951
- composition: z.ZodString;
952
- regions: z.ZodArray<z.ZodLazy<z.ZodObject<{
953
- title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
954
- purpose: z.ZodString;
955
- container: z.ZodOptional<z.ZodNullable<z.ZodString>>;
956
- elements: z.ZodArray<z.ZodString>;
957
- }, z.core.$strip>>>;
958
- call_to_action: z.ZodOptional<z.ZodNullable<z.ZodString>>;
959
- defaults: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
960
- delegated: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
961
- }, z.core.$strip>;
962
- type PagePlan = z.infer<typeof PagePlanSchema>;
963
- /** One path of the state, as the brief describes it: where it is, what it holds, what it is called, what constrains it, and whether the page lays it out or hands it back to the kernel's own control. */
964
- declare const PathEntrySchema: z.ZodObject<{
965
- depth: z.ZodNumber;
966
- path: z.ZodString;
967
- kind: z.ZodString;
968
- name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
969
- title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
970
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
971
- required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
972
- gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
973
- notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
974
- default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
975
- delegated: z.ZodBoolean;
976
- relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
977
- item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
978
- item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
979
- item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
980
- }, z.core.$strip>;
981
- type PathEntry = z.infer<typeof PathEntrySchema>;
982
-
983
- /**
984
- * The catalog as the designer method's `catalog` input: the vocabulary as
985
- * DATA, which the method's own prompt lays out.
986
- *
987
- * The prompt a model reads is the method - `methods/layout-design.mthds`
988
- * carries every paragraph of it as prose and loops over these two lists for
989
- * the component and action sections. What this package contributes is what
990
- * only code can state: each component's props signature, rendered from its
991
- * zod schema, beside the description and the slots its definition declares.
992
- * One function so the fixture pass, the briefs and the tests hand over one
993
- * value, and the hash stamped on a captured layout covers what was actually
994
- * sent.
995
- *
996
- * The shapes are the method's own: codegen projects the `Catalog`,
997
- * `Component` and `Action` structures the bundle declares into
998
- * `src/generated/layout-design/`, and the aliases below are those types. So a
999
- * field renamed in the bundle fails the type check on the literals here
1000
- * rather than a run, and the value goes over as the content of a structured
1001
- * input, verbatim. The import is type-only: the generated zod schemas stay
1002
- * out of the entry, which ships no validator for this value.
1003
- */
1004
- /** The `Catalog` structure of `methods/layout-design.mthds`, as codegen projects it. */
1005
- type DesignerCatalog = Catalog;
1006
- /** One component of the catalog: its name, its props signature, what it is for, what it accepts. */
1007
- type DesignerComponent = Component;
1008
- /** One action a page may bind to an event. */
1009
- type DesignerAction = Action;
1010
- /** The concept a run request names for the `catalog` input: the method's own, domain-qualified. */
1011
- declare const DESIGNER_CATALOG_CONCEPT = "generative.Catalog";
1012
- declare function designerCatalog(): DesignerCatalog;
1013
-
1014
- /**
1015
- * The hash that pairs a captured layout with the prompt it was produced
1016
- * against: the first twelve hex digits of the SHA-256 of `promptHashSubject`,
1017
- * which is the designer method's text and the catalog it was handed.
1018
- *
1019
- * The prompt is no longer one string this package renders: it is the method
1020
- * (`methods/layout-design.mthds`, every paragraph as prose) applied to
1021
- * the catalog as data (`designerCatalog()`). Both are what a run was actually
1022
- * given, so both are hashed - a reworded rule and a renamed prop each move
1023
- * the pin, exactly as they did when the prompt was rendered here. The model
1024
- * pin in the method file moves it too, since the file is hashed whole; a
1025
- * fixture records its model on its own, so that costs a regeneration, never a
1026
- * misread.
1027
- *
1028
- * It is a PIN rather than a computation, so that this entry stays importable
1029
- * from a browser (hashing would mean `node:crypto` or an async Web Crypto
1030
- * call, and a host compares this value synchronously while deciding whether a
1031
- * stored layout still stands - and the entry must not read the method file).
1032
- * `__tests__/prompt.test.ts` recomputes it from the file and the catalog and
1033
- * fails on any drift, so the pin cannot go stale quietly: a catalog, rule or
1034
- * direction change is a failing test, which is exactly what it was for.
1035
- *
1036
- * A stored layout whose hash is not this one is not rendered - the host falls
1037
- * back to the kernel's own form - because the vocabulary it was written in is
1038
- * no longer the vocabulary this entry renders.
1039
- */
1040
- declare const PROMPT_HASH = "2b2325fd1231";
1041
-
1042
- /**
1043
- * The brief: the model's view of the descriptor, as DATA.
1044
- *
1045
- * Rule 1, restated for a model. The model's input is the DESCRIPTOR, never JSON
1046
- * Schema: it receives the kinds, the labels, the descriptions, the choices, the
1047
- * presence and what gates the run - projected from `RunField[]` here, and from
1048
- * nowhere else, into the `Brief` structure the designer method declares. On the
1049
- * result side it also receives one real run's loaded state, so it can judge
1050
- * magnitudes, but it never sees the wire: the state it reads is what
1051
- * `payloadToState` produced, with the envelopes already gone.
1052
- *
1053
- * Nothing here is prose. The sentences a model reads - the headings, how a
1054
- * path line is worded, what "delegated" says - are the method's own, in the
1055
- * `render_brief` stage of `methods/layout-design.mthds`: a Jinja2 template
1056
- * over this value, and the one place the brief's wording is edited. What this
1057
- * module contributes is what only code can state: every path, flattened in
1058
- * reading order with its depth, its kind in words, its constraints in words,
1059
- * and which of them the kernel keeps. The shape is the method's own: codegen
1060
- * projects its `Brief` and `PathEntry` structures into
1061
- * `src/generated/layout-design/`, and the aliases below are those types,
1062
- * imported type-only so the generated schemas stay out of the entry. A field
1063
- * renamed in the bundle fails the type check on the literals here rather than
1064
- * a run.
1065
- *
1066
- * Pure, no React, and the only place the descriptor is projected for a model.
1067
- * What a path is marked as (delegated or not) is decided here too, so the
1068
- * projection, the brief and the validator agree on which paths the kernel
1069
- * renders.
1070
- */
1071
- /** The `Brief` structure of `methods/layout-design.mthds`, as codegen projects it. */
1072
- type DesignerBrief = Brief;
1073
- /** One path of the brief: where it is, what it holds, what constrains it, whether the kernel keeps it. */
1074
- type DesignerPathEntry = PathEntry;
1075
- /** The concept a run request names for the `brief` input: the method's own, domain-qualified. */
1076
- declare const DESIGNER_BRIEF_CONCEPT = "generative.Brief";
1077
- interface BriefSubject {
1078
- /** `results.nested_result`. */
1079
- pipeRef: string;
1080
- /** The pipe's description, when the wire carries one. */
1081
- description?: string;
1082
- /**
1083
- * The method's name as a host lists it - an authored method's, since a host
1084
- * has one for every method it lists; absent on a synthesized carrier, which
1085
- * no host lists. The brief hands it to the layout as the one product name
1086
- * the page may carry, because the brand catalog's AppBar asks for a name
1087
- * and a brief that gives none gets one invented.
1088
- */
1089
- name?: string;
1090
- }
1091
- /**
1092
- * On the input side, the kinds the catalog's inputs cannot enter - and one
1093
- * shape of a kind they otherwise can. The standard puts no floor on a choice,
1094
- * so an enum may carry `""`; the catalog's own choices may not, because no
1095
- * dropdown row or pill can offer nothing, and the validator refuses an empty
1096
- * option. A model told to list the brief's choices exactly would copy the
1097
- * empty one into a layout the validator then refuses, so the brief hands the
1098
- * input back to the kernel's own control instead.
1099
- */
1100
- declare function isDelegatedInput(field: RunField): boolean;
1101
- /**
1102
- * On the result side, the kinds and concepts the catalog cannot show.
1103
- *
1104
- * A native value is one of them, and so is a list of one: the native
1105
- * predicates refuse a `list` node, because a list of dates is a list and not a
1106
- * date, but no catalog component reads a date's `{date, time}` either, so the
1107
- * kernel renders the list whole - one value per line, as the result view does.
1108
- */
1109
- declare function isDelegatedResult(field: RunField): boolean;
1110
- /** The brief for an INPUT page: the form a run is started from. */
1111
- declare function inputBrief(subject: BriefSubject, fields: readonly RunField[]): DesignerBrief;
1112
- /** The brief for a RESULT page: what one run produced, laid out. */
1113
- declare function resultBrief(subject: BriefSubject, field: RunField, state: unknown): DesignerBrief;
4
+ export { Spec, StateModel, StateStore, createStateStore } from '@json-render/core';
5
+ import * as react from 'react';
6
+ import * as _json_render_react from '@json-render/react';
7
+ import { Components, Renderer } from '@json-render/react';
8
+ import { B as BrandManifest } from '../manifest-D3DLyNEv.js';
9
+ export { b as brandManifestSchema } from '../manifest-D3DLyNEv.js';
10
+ import * as zod_v4_core from 'zod/v4/core';
11
+ import * as zod from 'zod';
12
+ import { RunField } from '../core/descriptor.js';
13
+ import { F as FieldEnv } from '../field-renderer-Dz03dpig.js';
14
+ export { seedInputs } from '../core/seed.js';
15
+ import '../styles-Bn8byNdo.js';
16
+ import '../core/contracts.js';
17
+ import 'mthds/protocol';
18
+ import '../core/file-formats.js';
19
+ import '../core/sources.js';
1114
20
 
1115
21
  /**
1116
- * Whether a stored layout still fits the descriptor it will be rendered over.
1117
- *
1118
- * A layout is produced once per method version and stored; a descriptor is
1119
- * derived from the method every time it is read. Those two can part company -
1120
- * a method's input is renamed, a structure loses a member - and when they do,
1121
- * a delegated path resolves to nothing and a bound path writes into a corner of
1122
- * the state the run never reads. Neither fails loudly on its own, so the host
1123
- * asks this before it renders and falls back to the kernel's own form when the
1124
- * answer is no.
1125
- *
1126
- * Two directions, and the second is the one a corpus cannot notice. The first
1127
- * is staleness: every path the layout MENTIONS is a path the descriptor still
1128
- * has, which is the corpus test's check lifted out of the test and into the
1129
- * product. The second is coverage: every path the descriptor REQUIRES is one
1130
- * the layout offers somewhere. A layout that simply omits an input is not
1131
- * stale and validates perfectly - it renders a page with no field for a
1132
- * required input, the run gate then refuses the run for that input, and the
1133
- * person has nowhere to type it. A page you cannot complete is worse than the
1134
- * plain form, which is what the fallback is for.
1135
- *
1136
- * It answers with problems, not exceptions, and that is a promise rather than
1137
- * a habit: a host calls this to decide whether it is safe to render, so a
1138
- * throw leaves it with no verdict at the one moment it needs one. A layout is
1139
- * model-produced and may be malformed in ways the walk below trips on
1140
- * (`children: 5`, a null element, no `elements` map at all), and the other
1141
- * gate, which refuses those shapes outright, is exported separately - so
1142
- * neither may assume the other ran first.
1143
- *
1144
- * A third check sits between the two and is about KIND rather than presence:
1145
- * a path a layout shows as a value must be a scalar, and a path it reads into
1146
- * a prop that takes a list must be a list. A `SummaryRow` whose `value` reads
1147
- * `/inputs/document`, a structure of a url and a filename, is not stale - the
1148
- * path exists - and it validates perfectly; it renders `[object Object]`,
1149
- * because the renderer stringifies what it is handed and nothing anywhere said
1150
- * the path was not a value. An `AppBar` whose `links` read that same structure
1151
- * is the mirror image: its renderer maps over what it is handed, renders
1152
- * nothing for a structure and throws for a text. Only the descriptor knows
1153
- * what kind a path is, so this is where that is said.
1154
- *
1155
- * What is NOT checked here is whether the layout validates against the catalog
1156
- * - that is `validateAgainstCatalog`, and a host runs both.
22
+ * How a page tells its host that one of its elements failed to render.
23
+ *
24
+ * json-render wraps every element in a boundary of its own that catches what
25
+ * the element throws, logs it and renders nothing, so a boundary a host puts
26
+ * around the page never fires: the page arrives with an element missing, its
27
+ * call to action perhaps still there, and the host has nothing to act on.
28
+ * Every renderer of the page's registry is wrapped in a boundary of this
29
+ * module's, inside json-render's, and the page's root gets one too, since
30
+ * json-render resolves an element's props before its renderer runs and puts no
31
+ * boundary above the root. When the host passes a handler, the boundary
32
+ * catches the throw first, renders nothing in its place as json-render's
33
+ * would, and hands the error to the host after the commit, once per element
34
+ * that failed. When it passes none, the boundary throws the error on, so the
35
+ * page behaves exactly as json-render alone does: an element's throw is logged
36
+ * and dropped, and a root's reaches the host's own boundary. The wrapping does
37
+ * not depend on whether there is a handler, so a host that starts or stops
38
+ * passing one remounts nothing.
1157
39
  */
1158
- interface LayoutDescriptor {
1159
- /** The input page's top-level fields, for `/inputs/...` paths. */
1160
- inputs?: readonly RunField[];
1161
- /** The result page's descriptor, for `/result/...` paths. */
1162
- result?: RunField;
40
+ /** What a host is told of an element that failed to render. */
41
+ interface ElementErrorInfo {
42
+ /** The component type the element named, or the element whose children threw. */
43
+ type: string;
44
+ /** React's component stack at the throw, when React gave one. */
45
+ componentStack?: string;
1163
46
  }
1164
- /**
1165
- * Every way this layout no longer fits, in the words a host can count by:
1166
- * one line per element or path, empty when it fits.
1167
- *
1168
- * The checks live in `collectLayoutProblems`; this is the boundary that keeps
1169
- * the promise in the header around them. A malformed spec is one line, naming
1170
- * what the walk tripped on, which is a verdict the fallback can act on where a
1171
- * throw was not.
1172
- */
1173
- declare function layoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[];
1174
- /** The predicate: `layoutProblems` is empty. */
1175
- declare function layoutFits(descriptor: LayoutDescriptor, spec: Spec): boolean;
1176
-
1177
- /**
1178
- * A spec as JSONL patches, and back.
1179
- *
1180
- * json-render's wire format is RFC 6902 patches, one per line, root first and
1181
- * parents before children, so a renderer can paint a partial tree at every
1182
- * line. A model emits that format; a projected or authored spec is a finished
1183
- * object. This is the bridge: any of the three sources can be replayed through
1184
- * `specToJsonl`, and what a model emitted is compiled through `specFromJsonl`
1185
- * before it is validated.
1186
- */
1187
- /**
1188
- * The patch lines for a spec: `/root`, then every element reachable from the
1189
- * root in breadth-first order (a parent always precedes its children), then
1190
- * any element the root does not reach (kept, so a validator can report it),
1191
- * then one patch per top-level `state` key.
1192
- */
1193
- declare function specToJsonl(spec: Spec): string;
1194
- /**
1195
- * The spec a JSONL stream compiles to. Blank lines and non-JSON lines are
1196
- * skipped by the compiler; a line whose `path` or `from` would reach a
1197
- * prototype is dropped here, before the compiler sees it; and a line the
1198
- * compiler refuses is dropped too, which is why the stream is applied one line
1199
- * at a time.
1200
- *
1201
- * A batch compile made a single bad line fatal to the whole layout. Two of them
1202
- * are reachable from produced text: a `test` op whose value does not match
1203
- * throws `Test operation failed`, and a non-string `path` throws
1204
- * `path.startsWith is not a function`. A host follows the documented flow -
1205
- * compile, then ask the two gates - so a throw here arrives before there is any
1206
- * verdict to act on, and the fallback that exists for exactly this case never
1207
- * fires. Skipping the line degrades instead: what survives is a partial spec,
1208
- * which the gates then judge on its merits and reject if it is not renderable.
1209
- */
1210
- declare function specFromJsonl(jsonl: string): Spec;
1211
- /** The individual patch lines of a stream, for a replay that feeds them one at a time. */
1212
- declare function jsonlLines(jsonl: string): string[];
47
+ /** The host's hook for an element's render error. */
48
+ type ElementErrorHandler = (error: unknown, info: ElementErrorInfo) => void;
1213
49
 
1214
50
  /**
1215
51
  * The registry: what each catalog entry RENDERS as.
@@ -1248,6 +84,12 @@ declare function DescriptorProvider({ scope, children, }: {
1248
84
  scope: DescriptorScope;
1249
85
  children: react.ReactNode;
1250
86
  }): react.JSX.Element;
87
+ /**
88
+ * Exported for the round-trip test only, not from the entry's index: the pair
89
+ * is only correct together, so a test that could see just one half of it would
90
+ * be no guard at all.
91
+ */
92
+ declare function domIdFor(prefix: string | undefined, path: string): string;
1251
93
  /**
1252
94
  * The inverse of `domIdFor`, for a host's upload seam: the kernel reports a
1253
95
  * drop by the DOM id of the field it landed on, which for a nested one is the
@@ -1259,6 +101,12 @@ declare function DescriptorProvider({ scope, children, }: {
1259
101
  */
1260
102
  declare function pathFromDomId(prefix: string | undefined, id: string): string | undefined;
1261
103
  /** The renderers, for the registry over the catalog that extends this vocabulary. */
104
+ /**
105
+ * Each renderer is handed its props held to the base catalog's definitions
106
+ * (`declared-props.ts`), so an expression that resolved to the wrong type -
107
+ * scratch state holding a structure where a title belongs - draws nothing
108
+ * rather than throwing past both checks.
109
+ */
1262
110
  declare const generativeRenderers: Components<_json_render_core.Catalog<{
1263
111
  spec: _json_render_core.SchemaType<"object", {
1264
112
  root: _json_render_core.SchemaType<"string", unknown>;
@@ -1793,6 +641,8 @@ declare const generativeRenderers: Components<_json_render_core.Catalog<{
1793
641
  MthdsField: {
1794
642
  props: zod.ZodObject<{
1795
643
  path: zod.ZodString;
644
+ label: zod.ZodNullable<zod.ZodString>;
645
+ hint: zod.ZodNullable<zod.ZodString>;
1796
646
  }, zod_v4_core.$strip>;
1797
647
  slots: never[];
1798
648
  description: string;
@@ -1817,6 +667,11 @@ declare const generativeRenderers: Components<_json_render_core.Catalog<{
1817
667
  columns: zod.ZodArray<zod.ZodObject<{
1818
668
  path: zod.ZodString;
1819
669
  label: zod.ZodString;
670
+ format: zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
671
+ number: "number";
672
+ date: "date";
673
+ text: "text";
674
+ }>>>;
1820
675
  }, zod_v4_core.$strip>>;
1821
676
  caption: zod.ZodNullable<zod.ZodString>;
1822
677
  }, zod_v4_core.$strip>;
@@ -1873,8 +728,12 @@ interface GenerativePageProps {
1873
728
  store: StateStore;
1874
729
  /** The descriptor the escape hatches resolve paths against. */
1875
730
  scope: DescriptorScope;
1876
- /** What `run` does. Receives the state at the moment the call to action was pressed. */
1877
- onRun?: (state: StateModel) => void;
731
+ /**
732
+ * What `run` does. Receives the state at the moment the call to action was
733
+ * pressed. Return the run's promise and a press while it is pending starts
734
+ * nothing.
735
+ */
736
+ onRun?: (state: StateModel) => void | Promise<unknown>;
1878
737
  /** Whether a stream is still arriving. */
1879
738
  loading?: boolean;
1880
739
  /** A registry over a catalog that extends this entry's, when a host has one. */
@@ -1887,6 +746,15 @@ interface GenerativePageProps {
1887
746
  * brand components may omit it.
1888
747
  */
1889
748
  brand?: BrandManifest;
749
+ /**
750
+ * Called once for each element that throws while rendering, with the error
751
+ * and the element's component type. json-render drops such an element from
752
+ * the page and catches its throw in a boundary of its own, so a boundary
753
+ * around the page never fires; this is how a host hears of it, and falls
754
+ * back to its plain view if it wants the whole page to. The element renders
755
+ * nothing in its place either way. Without it, json-render logs the error.
756
+ */
757
+ onElementError?: ElementErrorHandler;
1890
758
  }
1891
759
  /**
1892
760
  * One generative page: providers, registry and renderer wired together.
@@ -1896,7 +764,7 @@ interface GenerativePageProps {
1896
764
  * kernel's readiness is computed from, and generation is nowhere in the
1897
765
  * request path: a layout is a data file, and this renders it.
1898
766
  */
1899
- declare function GenerativePage({ spec, store, scope, onRun, loading, registry, brand, }: GenerativePageProps): react.JSX.Element;
767
+ declare function GenerativePage({ spec, store, scope, onRun, loading, registry, brand, onElementError, }: GenerativePageProps): react.JSX.Element;
1900
768
  /** The store's current state, re-rendering on every change. For a receipt beside a page. */
1901
769
  declare function useStoreSnapshot(store: StateStore): StateModel;
1902
770
 
@@ -1946,141 +814,39 @@ declare function BrandProvider({ manifest, children, }: {
1946
814
  }): react.JSX.Element;
1947
815
  declare function useBrand(): BrandManifest;
1948
816
 
1949
- /**
1950
- * The two state trees, and how a path into either maps back onto the
1951
- * descriptor.
1952
- *
1953
- * An input page binds at `/inputs/<name>`, recursing into structures as the
1954
- * descriptor does; a result page binds at `/result/<path>`. Both are JSON
1955
- * Pointers (RFC 6901), because that is what json-render's state store reads.
1956
- * Nothing here knows a value - a path is resolved against the DESCRIPTOR, which
1957
- * is how the two escape hatches find the `RunField` to hand the kernel.
1958
- */
1959
- declare const INPUTS_ROOT = "/inputs";
1960
- declare const RESULT_ROOT = "/result";
1961
- /** `/inputs` + `invoice` + `billed_to` → `/inputs/invoice/billed_to`. */
1962
- declare function joinPath(root: string, ...segments: readonly string[]): string;
1963
- /** The segments of a pointer, root excluded: `/inputs/a/b` under `/inputs` → `['a', 'b']`. */
1964
- declare function segmentsUnder(root: string, path: string): string[] | undefined;
1965
- /**
1966
- * The descriptor node a path names, or `undefined` when the path leaves the
1967
- * tree. An object's children are found by name; a list's are found by index,
1968
- * and every index resolves to the same item descriptor.
1969
- */
1970
- declare function fieldAtSegments(fields: readonly RunField[], segments: readonly string[]): RunField | undefined;
1971
- /** `/inputs/<...>` resolved against a form's top-level fields. */
1972
- declare function inputFieldAtPath(fields: readonly RunField[], path: string): RunField | undefined;
1973
- /** `/result/<...>` resolved against a result descriptor; `/result` itself is the root. */
1974
- declare function resultFieldAtPath(field: RunField, path: string): RunField | undefined;
1975
- /**
1976
- * The base path a relative hatch path resolves against, statically: the chain
1977
- * of `repeat`s from the root down to `key`, each contributing its list path
1978
- * and a first index. `undefined` outside any repeat. Mirrors what
1979
- * `useRepeatScope` gives the hatch at render time, for a test that never
1980
- * renders.
1981
- *
1982
- * The walk up the parent chain STOPS on a key it has already seen. A layout is
1983
- * model-produced, and an element that is its own ancestor - `children: ["self"]`
1984
- * at its simplest - is a shape json-render's `validateSpec` accepts without a
1985
- * word, so without the guard this loop never terminates. Since a host calls
1986
- * this through `layoutFits` precisely to decide whether an untrusted layout is
1987
- * safe to render, the gate hanging is worse than the layout it was asked about.
1988
- */
1989
- declare function repeatBasePathOf(spec: Spec, key: string, parents?: Map<string, string>): string | undefined;
1990
- /** A hatch's path as the layer resolves it: absolute as written, or relative to the repeat it sits in. */
1991
- declare function absoluteHatchPath(spec: Spec, key: string, path: string, parents?: Map<string, string>): string | undefined;
1992
-
1993
- /**
1994
- * A payload, as the result tree a spec binds to at `/result`.
1995
- *
1996
- * - a `date` becomes the ISO string (`2026-03-14`, or `2026-03-14 15:40:00`
1997
- * when a time rides along), whatever envelope it arrived in;
1998
- * - a `list` becomes an array whether the wire sent one or the plural
1999
- * envelope `{items: [...]}`, each item loaded by the item descriptor;
2000
- * - an `object` is loaded member by member, keeping any member the descriptor
2001
- * does not name as it came;
2002
- * - a `document` or `image` passes through verbatim: the pinned content model
2003
- * is what `ResultField` reads, and its member names (`url`, `filename`) are
2004
- * the ones a model would bind to anyway;
2005
- * - the three native concepts the kind vocabulary cannot name (`native.Html`,
2006
- * `native.Date`, `native.Composite`) pass through whole, for the escape
2007
- * hatch to render - and a list of one is still a list, an array of whole
2008
- * values, which is what the kernel renders when the brief delegates it;
2009
- * - a scalar passes through.
2010
- *
2011
- * A top-level scalar's `contentKey` wrapper is NOT unwrapped: `ResultField`
2012
- * unwraps it itself, and the brief names the wrapped path (`/result/text`), so
2013
- * the model and the escape hatch read the same tree.
2014
- */
2015
- declare function payloadToState(field: RunField, payload: unknown): unknown;
817
+ interface BrandBarProps {
818
+ /** The app's name, beside the logo. */
819
+ app: string;
820
+ /** The site's links, drawn as words from the small breakpoint up. */
821
+ links?: readonly string[] | null;
822
+ /** A short code at the end of the bar, such as the pipe's. */
823
+ tag?: string | null;
824
+ }
825
+ declare function BrandBar({ app, links, tag }: BrandBarProps): react.JSX.Element;
2016
826
 
2017
827
  /**
2018
- * A spec with its provenance - the shape every fixture takes, whoever produced
2019
- * it, so a story renders any of them without knowing which it holds.
2020
- *
2021
- * A spec is a payload's twin: the one artifact no projection can produce. So
2022
- * it follows the payload's rules - produced by a pass, committed with its
2023
- * provenance - plus what a spec needs and a payload does not: WHO produced it,
2024
- * on WHICH model, under WHAT prompt (its hash), and, when the run was given
2025
- * one, the creative seed and the critic loop. The stories and the comparison
2026
- * viewer are titled from this record and from nothing else, so a page is
2027
- * never labelled with a role ("authored", "generated") but with what actually
2028
- * made it.
828
+ * What a host's compose-then-result frame tells the frame components of a
829
+ * layout - the facts no descriptor carries.
830
+ *
831
+ * A layout written for the `composer` frame places the host's action row
832
+ * through `Composer`, and one written for the `result` frame places the
833
+ * host's actions through `ResultHeader`. What those rows SAY beyond the
834
+ * layout's own words is the host's knowledge: how long a run usually takes,
835
+ * what the result's actions are called and what they do. The layout names
836
+ * where they go; the host fills them.
2029
837
  */
2030
- /** How a spec came to be. */
2031
- type Producer =
2032
- /** The designer method, `methods/layout-design.mthds`, run on the hosted API. */
2033
- 'pipelex-method'
2034
- /** A Claude Code subagent in a fresh context, given the method, the catalog data and the brief and nothing else. */
2035
- | 'claude-code-subagent'
2036
- /** The Claude Code session working in this repo, writing the spec by hand in TypeScript. */
2037
- | 'claude-code-session';
2038
- interface CriticLoop {
2039
- /** The model that judged the screenshots. */
2040
- model: string;
2041
- /** How many critique-and-revise rounds ran. */
2042
- rounds: number;
2043
- }
2044
- interface SpecFixture {
2045
- /** `results.nested_result`. */
2046
- pipeRef: string;
2047
- producer: Producer;
2048
- /** The model id: the one the method ran with, or the Claude Code model behind the agent. */
2049
- model: string;
2050
- /** The creative seed handed over with the brief, verbatim, when one was. */
2051
- seed?: string;
2052
- /** The critic loop the producer ran, when one did. */
2053
- critic?: CriticLoop;
2054
- /** The first twelve hex digits of the SHA-256 of the catalog prompt at the time. */
2055
- promptHash: string;
2056
- /** The day it was produced, `YYYY-MM-DD`. */
2057
- date: string;
2058
- /** The brief it was produced from, repo-relative. */
2059
- brief: string;
2060
- /** The JSONL patch lines, exactly as emitted, or as `specToJsonl` renders a hand-written spec. */
2061
- jsonl: string;
2062
- /** The compiled spec. */
2063
- spec: Spec;
2064
- /**
2065
- * The planner's plan, when the producer was the designer method: the
2066
- * intermediate the builder was handed, read from the run's working memory.
2067
- * It is what a person reads to see why a page has the shape it has, and it
2068
- * is the one stage a comparison between two runs can be made at. Absent for
2069
- * a producer that plans nowhere the harness can read.
2070
- */
2071
- plan?: PagePlan;
838
+ interface FrameHost {
839
+ /** How long a run usually takes, from the app's past runs: "Takes about 30 seconds". */
840
+ eta?: string;
841
+ /** The result's actions, primary first: "Download PDF", "Share". */
842
+ actions?: readonly string[];
843
+ /** What an action does, by its label. */
844
+ onAction?: (label: string) => void;
2072
845
  }
2073
- /**
2074
- * The id a story and a screenshot are keyed by: producer, model and the two
2075
- * procedures that change what a run is. `pipelex-method--gpt-5.5--seeded`.
2076
- */
2077
- declare function fixtureId(fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>): string;
2078
- /**
2079
- * The honest title: what made the page. `Pipelex method · gpt-5.5 · with a
2080
- * seed`, never a role ("authored", "generated").
2081
- */
2082
- declare function fixtureLabel(fixture: Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic'>): string;
2083
- /** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */
2084
- declare function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string): SpecFixture;
846
+ declare function FrameHostProvider({ host, children, }: {
847
+ host: FrameHost;
848
+ children: react.ReactNode;
849
+ }): react.JSX.Element;
850
+ declare function useFrameHost(): FrameHost;
2085
851
 
2086
- export { BrandManifest, BrandProvider, type BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, CUSTOM_COMPONENTS, type ComponentRendering, type CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, DescriptorProvider, type DescriptorScope, type DesignerAction, type DesignerBrief, type DesignerCatalog, type DesignerComponent, type DesignerPathEntry, GenerativePage, type GenerativePageProps, type GenerativeSpec, ICON_NAMES, INPUTS_ROOT, type LayoutDescriptor, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, type PageRegistry, type Producer, type ProductComponentName, RESULT_ROOT, type ResultSlot, ResultSlotProvider, type SpecFixture, type SpecProblem, type SpecVerdict, type ValidationCatalog, absoluteHatchPath, catalog, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, generativeRegistry, generativeRenderers, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutFits, layoutProblems, pathFromDomId, payloadToState, repeatBasePathOf, resultBrief, resultFieldAtPath, segmentsUnder, specFromJsonl, specToJsonl, useBrand, useDescriptorScope, useResultSlot, useStoreSnapshot, validateAgainstCatalog };
852
+ export { BrandBar, type BrandBarProps, BrandManifest, BrandProvider, DescriptorProvider, type DescriptorScope, type ElementErrorHandler, type ElementErrorInfo, type FrameHost, FrameHostProvider, GenerativePage, type GenerativePageProps, type PageRegistry, type ResultSlot, ResultSlotProvider, domIdFor, generativeRegistry, generativeRenderers, pathFromDomId, useBrand, useDescriptorScope, useFrameHost, useResultSlot, useStoreSnapshot };