@pipelex/mthds-form 0.31.0 → 0.33.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.
Files changed (35) hide show
  1. package/README.md +5 -2
  2. package/dist/brand/index.d.ts +4 -2
  3. package/dist/brand/index.js +4 -2
  4. package/dist/brand/index.js.map +1 -1
  5. package/dist/{chunk-UZNRJWN5.js → chunk-3GO65HWP.js} +3 -31
  6. package/dist/chunk-3GO65HWP.js.map +1 -0
  7. package/dist/chunk-4SRSGZWM.js +2447 -0
  8. package/dist/chunk-4SRSGZWM.js.map +1 -0
  9. package/dist/{chunk-XVGAQ4RK.js → chunk-IBBAJXIO.js} +4 -4
  10. package/dist/{chunk-XVGAQ4RK.js.map → chunk-IBBAJXIO.js.map} +1 -1
  11. package/dist/chunk-QGFR57OH.js +35 -0
  12. package/dist/chunk-QGFR57OH.js.map +1 -0
  13. package/dist/{chunk-ENK5QTUK.js → chunk-UKTYADY3.js} +6 -6
  14. package/dist/{chunk-ENK5QTUK.js.map → chunk-UKTYADY3.js.map} +1 -1
  15. package/dist/{chunk-HVWE3TTC.js → chunk-ZB4RYUKV.js} +3 -3
  16. package/dist/{chunk-HVWE3TTC.js.map → chunk-ZB4RYUKV.js.map} +1 -1
  17. package/dist/{chunk-2UCH4AAO.js → chunk-ZX52CQJ4.js} +3 -3
  18. package/dist/{chunk-2UCH4AAO.js.map → chunk-ZX52CQJ4.js.map} +1 -1
  19. package/dist/core/derive.js +2 -2
  20. package/dist/core/gate.js +3 -3
  21. package/dist/core/index.js +12 -12
  22. package/dist/core/values.js +3 -3
  23. package/dist/{field-renderer-Dz03dpig.d.ts → field-renderer-BYN6YrU-.d.ts} +6 -6
  24. package/dist/generative/headless/index.d.ts +1733 -0
  25. package/dist/generative/headless/index.js +6 -0
  26. package/dist/generative/headless/index.js.map +1 -0
  27. package/dist/generative/index.d.ts +112 -1710
  28. package/dist/generative/index.js +628 -2301
  29. package/dist/generative/index.js.map +1 -1
  30. package/dist/manifest-D3DLyNEv.d.ts +17 -0
  31. package/dist/react/index.d.ts +27 -27
  32. package/dist/react/index.js +7 -7
  33. package/dist/{styles-BoXPBjF4.d.ts → styles-Bn8byNdo.d.ts} +1 -17
  34. package/package.json +5 -1
  35. package/dist/chunk-UZNRJWN5.js.map +0 -1
@@ -0,0 +1,1733 @@
1
+ import * as _json_render_core from '@json-render/core';
2
+ import { Spec } from '@json-render/core';
3
+ export { Spec } from '@json-render/core';
4
+ import { z } from 'zod';
5
+ import { RunField } from '../../core/descriptor.js';
6
+ import { d as AppStyleId } from '../../styles-Bn8byNdo.js';
7
+ import '../../core/contracts.js';
8
+ import 'mthds/protocol';
9
+ import '../../core/file-formats.js';
10
+
11
+ /**
12
+ * The frames a layout is written for, and the vocabulary each adds.
13
+ *
14
+ * `page` is a whole product page of its own, the frame every layout had
15
+ * before a host drew one around it. `composer` and `result` are the two
16
+ * moments of a host's compose-then-result app: the inputs before a run, in a
17
+ * centred column whose host draws the band above it and the action row's
18
+ * mechanics, and the result after one, under the host's bar restating the
19
+ * request. The two moments carry their own components, found by measuring the
20
+ * designer against hand-drawn screens of several methods: the composer's frame
21
+ * (`Composer`, with the page's h1, the panel and the host's action row) and a
22
+ * group of inputs inside it, and a result's header, a proportion bar, colour
23
+ * swatches, a picture, a fact, a labelled detail, a date in words and a list
24
+ * of short texts. A date range, chips for a list of texts and compact rows
25
+ * for a list of structures were found too, and went to the kernel's own
26
+ * controls instead, since they improve the plain form as much as a designed
27
+ * one: a composer delegates those inputs to `MthdsField`.
28
+ *
29
+ * Zod only, importable from node: `designerCatalog()` renders these into the
30
+ * data the designer method takes. Each description says what the component IS
31
+ * and how it renders, never where a page must put it.
32
+ */
33
+ /** 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. */
34
+ declare const FRAMES: readonly ["page", "composer", "result"];
35
+ type Frame = (typeof FRAMES)[number];
36
+ /** The components the composer frame adds to the catalog. */
37
+ declare const COMPOSER_COMPONENTS: readonly ["Composer", "FieldGroup"];
38
+ /** The components the result frame adds to the catalog. */
39
+ declare const RESULT_COMPONENTS: readonly ["ResultHeader", "ProportionBar", "Swatches", "Picture", "Fact", "Detail", "DateText", "TextList"];
40
+ /** Every component a frame adds, which the `page` frame's vocabulary leaves out. */
41
+ declare const FRAME_COMPONENTS: readonly ["Composer", "FieldGroup", "ResultHeader", "ProportionBar", "Swatches", "Picture", "Fact", "Detail", "DateText", "TextList"];
42
+
43
+ /**
44
+ * Whether a spec is one this catalog can render - the check every source
45
+ * passes, whoever wrote it.
46
+ *
47
+ * Three layers, because json-render's own `catalog.validate()` covers only the
48
+ * first two once a catalog has more than one component: it checks the element
49
+ * TYPE against the component names, but `propsOf` degrades to "any record"
50
+ * when several definitions could apply, so a misspelt or invented prop passes.
51
+ * The per-component prop check is therefore this module's, and it has to be
52
+ * expression-aware: a bound prop's raw value is `{ "$state": "/path" }`, which
53
+ * the component's own zod schema (`z.string()`) would reject, so a dynamic
54
+ * expression is accepted wherever the prop EXISTS and a literal is parsed
55
+ * against the prop's schema.
56
+ *
57
+ * The checks are the same whichever catalog a spec was written against; the
58
+ * catalog is a parameter, this entry's own by default, so a host that defines
59
+ * a vocabulary of its own is validated by the same code and not by a copy of
60
+ * it.
61
+ *
62
+ * What a component renders beyond its schema - the heading its title is, the
63
+ * landmark it renders as, the fixed number of children it lays out, the panel
64
+ * per entry of one of its props - is a fact about its renderer that no schema
65
+ * states, so the catalog carries it as `renders`, declared beside the
66
+ * definitions, and the validator reads it off the catalog it is handed rather
67
+ * than assuming it from a component's name, which a host's vocabulary may
68
+ * reuse for something that renders nothing of the kind. This entry's catalog
69
+ * declares its own; a host's declares what its renderers do, or nothing, and
70
+ * is then held only to what its schemas and its `Heading` elements say.
71
+ */
72
+ /**
73
+ * What one component renders beyond what its props schema says, and what the
74
+ * validator holds a layout to on that account. Every member is optional: a
75
+ * component with none is held to its schema alone.
76
+ */
77
+ interface ComponentRendering {
78
+ /**
79
+ * The heading its renderer emits, at this level - a `Hero`'s headline is
80
+ * the h1 - and, when it emits one only if a prop is set, the prop: a `Card`
81
+ * renders its `title` as an h3 and nothing when it has none.
82
+ */
83
+ heading?: {
84
+ level: 1 | 2 | 3 | 4;
85
+ when?: string;
86
+ };
87
+ /** What it renders as that a page has one of - a landmark, in the words a refusal uses: "the page's banner". */
88
+ once?: string;
89
+ /** The number of children its renderer lays out, dropping the rest in silence, and what they are. */
90
+ children?: {
91
+ count: number;
92
+ roles: string;
93
+ };
94
+ /** A panelled container: the prop that lists its panels, one child per entry, and what one is called. */
95
+ panels?: {
96
+ prop: string;
97
+ noun: string;
98
+ };
99
+ }
100
+ /** What the validator reads off a catalog: its names, its definitions, and what its components render. */
101
+ interface ValidationCatalog {
102
+ componentNames: readonly string[];
103
+ /** The catalog's own action names. A `defineCatalog` result carries this already. */
104
+ actionNames?: readonly string[];
105
+ data: unknown;
106
+ /** The schema the catalog was defined against, for the actions its runtime handles without a handler. */
107
+ schema?: {
108
+ builtInActions?: readonly {
109
+ name: string;
110
+ }[];
111
+ };
112
+ /** What each component renders beyond its schema, by component name. Absent, no component renders a heading, a landmark or a fixed set of children. */
113
+ renders?: Readonly<Record<string, ComponentRendering>>;
114
+ }
115
+ interface SpecProblem {
116
+ elementKey?: string;
117
+ message: string;
118
+ }
119
+ interface SpecVerdict {
120
+ ok: boolean;
121
+ problems: SpecProblem[];
122
+ }
123
+ /**
124
+ * Whether a spec is one this catalog can render.
125
+ *
126
+ * The checks live in `checkAgainstCatalog`; this is the boundary that keeps the
127
+ * documented promise around them - it answers with problems, not exceptions.
128
+ * That promise was not kept: `validateSpec` throws on `repeat: null`, on
129
+ * `children: 5`, on `props: 5`, on a null element and on a missing `elements`
130
+ * map, all of which a model can emit. A host calls this to decide whether it is
131
+ * safe to render, so a throw leaves it with no verdict at the one moment it
132
+ * needs one, and the fallback to the plain form never fires.
133
+ */
134
+ declare function validateAgainstCatalog(spec: Spec, catalog?: ValidationCatalog): SpecVerdict;
135
+ /** The problems as one block, for a failing test or a repair prompt. */
136
+ declare function formatProblems(problems: readonly SpecProblem[]): string;
137
+
138
+ /**
139
+ * The catalog: everything the base vocabulary has, plus the chrome of a
140
+ * product page - a bar with the logo, a hero, a workspace that puts a panel
141
+ * beside the work, a section, a raised rail, the summary rows a rail can be
142
+ * made of, a call to action, a footer line. They are vocabulary, not a
143
+ * template: the designer method prescribes no composition, and a layout uses
144
+ * whichever of them serve it. Each description says what the component IS and
145
+ * how it renders - a heading level, a landmark, a fixed child count - and never
146
+ * where it must go or whether a page must have it, because the descriptions
147
+ * travel to the model as data and would otherwise be the mandate the method
148
+ * gave up. The vocabulary names no brand: the logo is whichever the manifest
149
+ * carries and the accent is whichever the host's theme tokens set.
150
+ *
151
+ * Rule 1 holds here as it does everywhere in this entry: a component takes
152
+ * copy and bound values, never a schema, and the fields the kernel owns are
153
+ * still `MthdsField` elements naming a path.
154
+ */
155
+ declare const PRODUCT_COMPONENTS: readonly ["AppBar", "Hero", "Workspace", "Section", "Rail", "SummaryRow", "Cta", "Footer"];
156
+ type ProductComponentName = (typeof PRODUCT_COMPONENTS)[number];
157
+ /**
158
+ * What this entry's components render beyond their schemas - the heading a
159
+ * title is, the landmark a bar or a footer renders as, the two children a
160
+ * split lays out, the panel per tab or step - declared once here, where the
161
+ * descriptions above say the same in prose for the model, and carried on the
162
+ * catalog so the validator reads it off whichever catalog it is handed. A
163
+ * host validating against a vocabulary of its own declares what its
164
+ * renderers do, or nothing.
165
+ */
166
+ declare const COMPONENT_RENDERINGS: Readonly<Record<string, ComponentRendering>>;
167
+ declare const catalog: _json_render_core.Catalog<{
168
+ spec: _json_render_core.SchemaType<"object", {
169
+ root: _json_render_core.SchemaType<"string", unknown>;
170
+ elements: _json_render_core.SchemaType<"record", _json_render_core.SchemaType<"object", {
171
+ type: _json_render_core.SchemaType<"ref", string>;
172
+ props: _json_render_core.SchemaType<"propsOf", string>;
173
+ children: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
174
+ slots: {
175
+ optional: true;
176
+ kind: "record";
177
+ inner?: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>> | undefined;
178
+ };
179
+ visible: {
180
+ optional: true;
181
+ kind: "any";
182
+ inner?: unknown;
183
+ };
184
+ repeat: {
185
+ optional: true;
186
+ kind: "any";
187
+ inner?: unknown;
188
+ };
189
+ }>>;
190
+ }>;
191
+ catalog: _json_render_core.SchemaType<"object", {
192
+ components: _json_render_core.SchemaType<"map", {
193
+ props: _json_render_core.SchemaType<"zod", unknown>;
194
+ slots: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
195
+ description: _json_render_core.SchemaType<"string", unknown>;
196
+ example: _json_render_core.SchemaType<"any", unknown>;
197
+ }>;
198
+ actions: _json_render_core.SchemaType<"map", {
199
+ params: _json_render_core.SchemaType<"zod", unknown>;
200
+ description: _json_render_core.SchemaType<"string", unknown>;
201
+ }>;
202
+ }>;
203
+ }, {
204
+ components: {
205
+ Composer: {
206
+ props: z.ZodObject<{
207
+ headline: z.ZodString;
208
+ lede: z.ZodNullable<z.ZodString>;
209
+ runLabel: z.ZodString;
210
+ columns: z.ZodNullable<z.ZodEnum<{
211
+ 1: "1";
212
+ 2: "2";
213
+ }>>;
214
+ notes: z.ZodNullable<z.ZodArray<z.ZodString>>;
215
+ }, z.core.$strip>;
216
+ slots: string[];
217
+ events: string[];
218
+ description: string;
219
+ example: {
220
+ headline: string;
221
+ lede: string;
222
+ runLabel: string;
223
+ columns: string;
224
+ };
225
+ };
226
+ FieldGroup: {
227
+ props: z.ZodObject<{
228
+ title: z.ZodNullable<z.ZodString>;
229
+ }, z.core.$strip>;
230
+ slots: string[];
231
+ description: string;
232
+ example: {
233
+ title: string;
234
+ };
235
+ };
236
+ ResultHeader: {
237
+ props: z.ZodObject<{
238
+ eyebrow: z.ZodNullable<z.ZodString>;
239
+ title: z.ZodString;
240
+ subtitle: z.ZodNullable<z.ZodString>;
241
+ }, z.core.$strip>;
242
+ slots: never[];
243
+ description: string;
244
+ example: {
245
+ eyebrow: string;
246
+ title: {
247
+ $state: string;
248
+ };
249
+ subtitle: {
250
+ $template: string;
251
+ };
252
+ };
253
+ };
254
+ ProportionBar: {
255
+ props: z.ZodObject<{
256
+ label: z.ZodString;
257
+ total: z.ZodNullable<z.ZodNumber>;
258
+ of: z.ZodNullable<z.ZodNumber>;
259
+ unit: z.ZodNullable<z.ZodString>;
260
+ items: z.ZodNullable<z.ZodArray<z.ZodAny>>;
261
+ labelKey: z.ZodString;
262
+ valueKey: z.ZodString;
263
+ }, z.core.$strip>;
264
+ slots: never[];
265
+ description: string;
266
+ example: {
267
+ label: string;
268
+ total: {
269
+ $state: string;
270
+ };
271
+ unit: {
272
+ $state: string;
273
+ };
274
+ items: {
275
+ $state: string;
276
+ };
277
+ labelKey: string;
278
+ valueKey: string;
279
+ };
280
+ };
281
+ Swatches: {
282
+ props: z.ZodObject<{
283
+ colors: z.ZodArray<z.ZodString>;
284
+ }, z.core.$strip>;
285
+ slots: never[];
286
+ description: string;
287
+ example: {
288
+ colors: {
289
+ $item: string;
290
+ }[];
291
+ };
292
+ };
293
+ Picture: {
294
+ props: z.ZodObject<{
295
+ path: z.ZodString;
296
+ alt: z.ZodNullable<z.ZodString>;
297
+ aspect: z.ZodNullable<z.ZodEnum<{
298
+ "1:1": "1:1";
299
+ "16:9": "16:9";
300
+ "4:3": "4:3";
301
+ auto: "auto";
302
+ }>>;
303
+ }, z.core.$strip>;
304
+ slots: never[];
305
+ description: string;
306
+ example: {
307
+ path: string;
308
+ alt: string;
309
+ aspect: string;
310
+ };
311
+ };
312
+ Fact: {
313
+ props: z.ZodObject<{
314
+ label: z.ZodString;
315
+ value: z.ZodAny;
316
+ detail: z.ZodNullable<z.ZodString>;
317
+ }, z.core.$strip>;
318
+ slots: never[];
319
+ description: string;
320
+ example: {
321
+ label: string;
322
+ value: {
323
+ $state: string;
324
+ };
325
+ };
326
+ };
327
+ DateText: {
328
+ props: z.ZodObject<{
329
+ value: z.ZodNullable<z.ZodString>;
330
+ style: z.ZodNullable<z.ZodEnum<{
331
+ long: "long";
332
+ short: "short";
333
+ weekday: "weekday";
334
+ }>>;
335
+ tone: z.ZodNullable<z.ZodEnum<{
336
+ default: "default";
337
+ muted: "muted";
338
+ accent: "accent";
339
+ }>>;
340
+ }, z.core.$strip>;
341
+ slots: never[];
342
+ description: string;
343
+ example: {
344
+ value: {
345
+ $item: string;
346
+ };
347
+ style: string;
348
+ tone: string;
349
+ };
350
+ };
351
+ TextList: {
352
+ props: z.ZodObject<{
353
+ items: z.ZodNullable<z.ZodArray<z.ZodString>>;
354
+ marker: z.ZodNullable<z.ZodEnum<{
355
+ number: "number";
356
+ check: "check";
357
+ bullet: "bullet";
358
+ }>>;
359
+ }, z.core.$strip>;
360
+ slots: never[];
361
+ description: string;
362
+ example: {
363
+ items: {
364
+ $state: string;
365
+ };
366
+ marker: string;
367
+ };
368
+ };
369
+ Detail: {
370
+ props: z.ZodObject<{
371
+ label: z.ZodString;
372
+ value: z.ZodAny;
373
+ }, z.core.$strip>;
374
+ slots: never[];
375
+ description: string;
376
+ example: {
377
+ label: string;
378
+ value: {
379
+ $item: string;
380
+ };
381
+ };
382
+ };
383
+ AppBar: {
384
+ props: z.ZodObject<{
385
+ app: z.ZodString;
386
+ links: z.ZodNullable<z.ZodArray<z.ZodString>>;
387
+ tag: z.ZodNullable<z.ZodString>;
388
+ }, z.core.$strip>;
389
+ slots: never[];
390
+ description: string;
391
+ example: {
392
+ app: string;
393
+ links: string[];
394
+ tag: string;
395
+ };
396
+ };
397
+ Hero: {
398
+ props: z.ZodObject<{
399
+ headline: z.ZodString;
400
+ lede: z.ZodNullable<z.ZodString>;
401
+ eyebrow: z.ZodNullable<z.ZodString>;
402
+ }, z.core.$strip>;
403
+ slots: never[];
404
+ description: string;
405
+ example: {
406
+ headline: string;
407
+ lede: string;
408
+ };
409
+ };
410
+ Workspace: {
411
+ props: z.ZodObject<{
412
+ rail: z.ZodNullable<z.ZodEnum<{
413
+ right: "right";
414
+ left: "left";
415
+ }>>;
416
+ }, z.core.$strip>;
417
+ slots: string[];
418
+ description: string;
419
+ example: {
420
+ rail: string;
421
+ };
422
+ };
423
+ Section: {
424
+ props: z.ZodObject<{
425
+ number: z.ZodNullable<z.ZodString>;
426
+ title: z.ZodString;
427
+ lede: z.ZodNullable<z.ZodString>;
428
+ }, z.core.$strip>;
429
+ slots: string[];
430
+ description: string;
431
+ example: {
432
+ number: string;
433
+ title: string;
434
+ };
435
+ };
436
+ Rail: {
437
+ props: z.ZodObject<{
438
+ title: z.ZodString;
439
+ }, z.core.$strip>;
440
+ slots: string[];
441
+ description: string;
442
+ example: {
443
+ title: string;
444
+ };
445
+ };
446
+ SummaryRow: {
447
+ props: z.ZodObject<{
448
+ label: z.ZodString;
449
+ value: z.ZodNullable<z.ZodAny>;
450
+ detail: z.ZodNullable<z.ZodAny>;
451
+ separator: z.ZodNullable<z.ZodString>;
452
+ placeholder: z.ZodNullable<z.ZodString>;
453
+ }, z.core.$strip>;
454
+ slots: never[];
455
+ description: string;
456
+ example: {
457
+ label: string;
458
+ value: {
459
+ $state: string;
460
+ };
461
+ detail: {
462
+ $state: string;
463
+ };
464
+ };
465
+ };
466
+ Cta: {
467
+ props: z.ZodObject<{
468
+ label: z.ZodString;
469
+ hint: z.ZodNullable<z.ZodString>;
470
+ }, z.core.$strip>;
471
+ slots: never[];
472
+ events: string[];
473
+ description: string;
474
+ example: {
475
+ label: string;
476
+ hint: string;
477
+ };
478
+ };
479
+ Footer: {
480
+ props: z.ZodObject<{
481
+ text: z.ZodString;
482
+ tag: z.ZodNullable<z.ZodString>;
483
+ }, z.core.$strip>;
484
+ slots: never[];
485
+ description: string;
486
+ example: {
487
+ text: string;
488
+ tag: string;
489
+ };
490
+ };
491
+ Card: {
492
+ props: z.ZodObject<{
493
+ description: z.ZodNullable<z.ZodString>;
494
+ title: z.ZodNullable<z.ZodString>;
495
+ }, z.core.$strip>;
496
+ description: string;
497
+ slots: string[];
498
+ example: {
499
+ title: string;
500
+ description: string;
501
+ };
502
+ };
503
+ Stack: {
504
+ props: z.ZodObject<{
505
+ direction: z.ZodNullable<z.ZodEnum<{
506
+ horizontal: "horizontal";
507
+ vertical: "vertical";
508
+ }>>;
509
+ gap: z.ZodNullable<z.ZodEnum<{
510
+ sm: "sm";
511
+ md: "md";
512
+ lg: "lg";
513
+ none: "none";
514
+ xl: "xl";
515
+ }>>;
516
+ align: z.ZodNullable<z.ZodEnum<{
517
+ start: "start";
518
+ center: "center";
519
+ end: "end";
520
+ stretch: "stretch";
521
+ }>>;
522
+ justify: z.ZodNullable<z.ZodEnum<{
523
+ start: "start";
524
+ center: "center";
525
+ end: "end";
526
+ between: "between";
527
+ around: "around";
528
+ }>>;
529
+ }, z.core.$strip>;
530
+ slots: string[];
531
+ description: string;
532
+ example: {
533
+ direction: string;
534
+ gap: string;
535
+ };
536
+ };
537
+ Grid: {
538
+ props: z.ZodObject<{
539
+ gap: z.ZodNullable<z.ZodEnum<{
540
+ sm: "sm";
541
+ md: "md";
542
+ lg: "lg";
543
+ xl: "xl";
544
+ }>>;
545
+ columns: z.ZodNullable<z.ZodNumber>;
546
+ }, z.core.$strip>;
547
+ slots: string[];
548
+ description: string;
549
+ example: {
550
+ columns: number;
551
+ gap: string;
552
+ };
553
+ };
554
+ Separator: {
555
+ props: z.ZodObject<{
556
+ orientation: z.ZodNullable<z.ZodEnum<{
557
+ horizontal: "horizontal";
558
+ vertical: "vertical";
559
+ }>>;
560
+ }, z.core.$strip>;
561
+ description: string;
562
+ };
563
+ Collapsible: {
564
+ props: z.ZodObject<{
565
+ title: z.ZodString;
566
+ defaultOpen: z.ZodNullable<z.ZodBoolean>;
567
+ }, z.core.$strip>;
568
+ slots: string[];
569
+ description: string;
570
+ };
571
+ Heading: {
572
+ props: z.ZodObject<{
573
+ text: z.ZodString;
574
+ level: z.ZodNullable<z.ZodEnum<{
575
+ h1: "h1";
576
+ h2: "h2";
577
+ h3: "h3";
578
+ h4: "h4";
579
+ }>>;
580
+ }, z.core.$strip>;
581
+ description: string;
582
+ example: {
583
+ text: string;
584
+ level: string;
585
+ };
586
+ };
587
+ Text: {
588
+ props: z.ZodObject<{
589
+ text: z.ZodString;
590
+ variant: z.ZodNullable<z.ZodEnum<{
591
+ body: "body";
592
+ caption: "caption";
593
+ muted: "muted";
594
+ lead: "lead";
595
+ code: "code";
596
+ }>>;
597
+ }, z.core.$strip>;
598
+ description: string;
599
+ example: {
600
+ text: string;
601
+ };
602
+ };
603
+ Badge: {
604
+ props: z.ZodObject<{
605
+ text: z.ZodString;
606
+ variant: z.ZodNullable<z.ZodEnum<{
607
+ default: "default";
608
+ secondary: "secondary";
609
+ destructive: "destructive";
610
+ outline: "outline";
611
+ }>>;
612
+ }, z.core.$strip>;
613
+ description: string;
614
+ example: {
615
+ text: string;
616
+ variant: string;
617
+ };
618
+ };
619
+ Alert: {
620
+ props: z.ZodObject<{
621
+ title: z.ZodString;
622
+ message: z.ZodNullable<z.ZodString>;
623
+ type: z.ZodNullable<z.ZodEnum<{
624
+ success: "success";
625
+ info: "info";
626
+ warning: "warning";
627
+ error: "error";
628
+ }>>;
629
+ }, z.core.$strip>;
630
+ description: string;
631
+ example: {
632
+ title: string;
633
+ message: string;
634
+ type: string;
635
+ };
636
+ };
637
+ Progress: {
638
+ props: z.ZodObject<{
639
+ value: z.ZodNumber;
640
+ max: z.ZodNullable<z.ZodNumber>;
641
+ label: z.ZodNullable<z.ZodString>;
642
+ }, z.core.$strip>;
643
+ description: string;
644
+ example: {
645
+ value: number;
646
+ max: number;
647
+ label: string;
648
+ };
649
+ };
650
+ Avatar: {
651
+ description: string;
652
+ props: z.ZodObject<{
653
+ src: z.ZodNullable<z.ZodString>;
654
+ name: z.ZodString;
655
+ size: z.ZodNullable<z.ZodEnum<{
656
+ sm: "sm";
657
+ md: "md";
658
+ lg: "lg";
659
+ }>>;
660
+ }, z.core.$strip>;
661
+ example: {
662
+ name: string;
663
+ size: string;
664
+ };
665
+ };
666
+ Input: {
667
+ props: z.ZodObject<{
668
+ label: z.ZodString;
669
+ name: z.ZodString;
670
+ type: z.ZodNullable<z.ZodEnum<{
671
+ number: "number";
672
+ text: "text";
673
+ email: "email";
674
+ password: "password";
675
+ }>>;
676
+ placeholder: z.ZodNullable<z.ZodString>;
677
+ value: z.ZodNullable<z.ZodString>;
678
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
679
+ type: z.ZodString;
680
+ message: z.ZodString;
681
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
682
+ }, z.core.$strip>>>;
683
+ validateOn: z.ZodNullable<z.ZodEnum<{
684
+ change: "change";
685
+ blur: "blur";
686
+ submit: "submit";
687
+ }>>;
688
+ }, z.core.$strip>;
689
+ events: string[];
690
+ description: string;
691
+ example: {
692
+ label: string;
693
+ name: string;
694
+ type: string;
695
+ placeholder: string;
696
+ };
697
+ };
698
+ Textarea: {
699
+ props: z.ZodObject<{
700
+ label: z.ZodString;
701
+ name: z.ZodString;
702
+ placeholder: z.ZodNullable<z.ZodString>;
703
+ rows: z.ZodNullable<z.ZodNumber>;
704
+ value: z.ZodNullable<z.ZodString>;
705
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
706
+ type: z.ZodString;
707
+ message: z.ZodString;
708
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
709
+ }, z.core.$strip>>>;
710
+ validateOn: z.ZodNullable<z.ZodEnum<{
711
+ change: "change";
712
+ blur: "blur";
713
+ submit: "submit";
714
+ }>>;
715
+ }, z.core.$strip>;
716
+ description: string;
717
+ };
718
+ Select: {
719
+ props: z.ZodObject<{
720
+ label: z.ZodString;
721
+ name: z.ZodString;
722
+ options: z.ZodArray<z.ZodString>;
723
+ placeholder: z.ZodNullable<z.ZodString>;
724
+ value: z.ZodNullable<z.ZodString>;
725
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
726
+ type: z.ZodString;
727
+ message: z.ZodString;
728
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
729
+ }, z.core.$strip>>>;
730
+ validateOn: z.ZodNullable<z.ZodEnum<{
731
+ change: "change";
732
+ blur: "blur";
733
+ submit: "submit";
734
+ }>>;
735
+ }, z.core.$strip>;
736
+ events: string[];
737
+ description: string;
738
+ };
739
+ Radio: {
740
+ props: z.ZodObject<{
741
+ label: z.ZodString;
742
+ name: z.ZodString;
743
+ options: z.ZodArray<z.ZodString>;
744
+ value: z.ZodNullable<z.ZodString>;
745
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
746
+ type: z.ZodString;
747
+ message: z.ZodString;
748
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
749
+ }, z.core.$strip>>>;
750
+ validateOn: z.ZodNullable<z.ZodEnum<{
751
+ change: "change";
752
+ blur: "blur";
753
+ submit: "submit";
754
+ }>>;
755
+ }, z.core.$strip>;
756
+ events: string[];
757
+ description: string;
758
+ };
759
+ Checkbox: {
760
+ props: z.ZodObject<{
761
+ label: z.ZodString;
762
+ name: z.ZodString;
763
+ checked: z.ZodNullable<z.ZodBoolean>;
764
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
765
+ type: z.ZodString;
766
+ message: z.ZodString;
767
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
768
+ }, z.core.$strip>>>;
769
+ validateOn: z.ZodNullable<z.ZodEnum<{
770
+ change: "change";
771
+ blur: "blur";
772
+ submit: "submit";
773
+ }>>;
774
+ }, z.core.$strip>;
775
+ events: string[];
776
+ description: string;
777
+ };
778
+ Switch: {
779
+ props: z.ZodObject<{
780
+ label: z.ZodString;
781
+ name: z.ZodString;
782
+ checked: z.ZodNullable<z.ZodBoolean>;
783
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
784
+ type: z.ZodString;
785
+ message: z.ZodString;
786
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
787
+ }, z.core.$strip>>>;
788
+ validateOn: z.ZodNullable<z.ZodEnum<{
789
+ change: "change";
790
+ blur: "blur";
791
+ submit: "submit";
792
+ }>>;
793
+ }, z.core.$strip>;
794
+ events: string[];
795
+ description: string;
796
+ };
797
+ Button: {
798
+ props: z.ZodObject<{
799
+ label: z.ZodString;
800
+ variant: z.ZodNullable<z.ZodEnum<{
801
+ secondary: "secondary";
802
+ primary: "primary";
803
+ danger: "danger";
804
+ }>>;
805
+ disabled: z.ZodNullable<z.ZodBoolean>;
806
+ }, z.core.$strip>;
807
+ events: string[];
808
+ description: string;
809
+ example: {
810
+ label: string;
811
+ variant: string;
812
+ };
813
+ };
814
+ Split: {
815
+ props: z.ZodObject<{
816
+ ratio: z.ZodNullable<z.ZodEnum<{
817
+ "1:1": "1:1";
818
+ "1:2": "1:2";
819
+ "2:1": "2:1";
820
+ }>>;
821
+ gap: z.ZodNullable<z.ZodEnum<{
822
+ md: "md";
823
+ lg: "lg";
824
+ xl: "xl";
825
+ }>>;
826
+ }, z.core.$strip>;
827
+ slots: string[];
828
+ description: string;
829
+ example: {
830
+ ratio: string;
831
+ gap: string;
832
+ };
833
+ };
834
+ Tabs: {
835
+ props: z.ZodObject<{
836
+ tabs: z.ZodArray<z.ZodObject<{
837
+ label: z.ZodString;
838
+ value: z.ZodString;
839
+ }, z.core.$strip>>;
840
+ }, z.core.$strip>;
841
+ slots: string[];
842
+ description: string;
843
+ example: {
844
+ tabs: {
845
+ label: string;
846
+ value: string;
847
+ }[];
848
+ };
849
+ };
850
+ Steps: {
851
+ props: z.ZodObject<{
852
+ steps: z.ZodArray<z.ZodString>;
853
+ nextLabel: z.ZodNullable<z.ZodString>;
854
+ backLabel: z.ZodNullable<z.ZodString>;
855
+ }, z.core.$strip>;
856
+ slots: string[];
857
+ description: string;
858
+ example: {
859
+ steps: string[];
860
+ nextLabel: string;
861
+ };
862
+ };
863
+ Icon: {
864
+ props: z.ZodObject<{
865
+ name: z.ZodEnum<{
866
+ Sparkles: "Sparkles";
867
+ Rocket: "Rocket";
868
+ Compass: "Compass";
869
+ Map: "Map";
870
+ MapPin: "MapPin";
871
+ Route: "Route";
872
+ Plane: "Plane";
873
+ Train: "Train";
874
+ Car: "Car";
875
+ Ship: "Ship";
876
+ Hotel: "Hotel";
877
+ Home: "Home";
878
+ Building2: "Building2";
879
+ Landmark: "Landmark";
880
+ Globe: "Globe";
881
+ Mountain: "Mountain";
882
+ Leaf: "Leaf";
883
+ Sun: "Sun";
884
+ Moon: "Moon";
885
+ Calendar: "Calendar";
886
+ Clock: "Clock";
887
+ Hourglass: "Hourglass";
888
+ Users: "Users";
889
+ User: "User";
890
+ Baby: "Baby";
891
+ Accessibility: "Accessibility";
892
+ Heart: "Heart";
893
+ Star: "Star";
894
+ Utensils: "Utensils";
895
+ Coffee: "Coffee";
896
+ Music: "Music";
897
+ Camera: "Camera";
898
+ Image: "Image";
899
+ Ticket: "Ticket";
900
+ Gift: "Gift";
901
+ Wallet: "Wallet";
902
+ Banknote: "Banknote";
903
+ Coins: "Coins";
904
+ Receipt: "Receipt";
905
+ Percent: "Percent";
906
+ Hash: "Hash";
907
+ TrendingUp: "TrendingUp";
908
+ BarChart3: "BarChart3";
909
+ FileText: "FileText";
910
+ Upload: "Upload";
911
+ Paperclip: "Paperclip";
912
+ Mail: "Mail";
913
+ Phone: "Phone";
914
+ Tag: "Tag";
915
+ Layers: "Layers";
916
+ ListChecks: "ListChecks";
917
+ CheckCircle2: "CheckCircle2";
918
+ AlertCircle: "AlertCircle";
919
+ Info: "Info";
920
+ Shield: "Shield";
921
+ Flag: "Flag";
922
+ Bookmark: "Bookmark";
923
+ Briefcase: "Briefcase";
924
+ Package: "Package";
925
+ Truck: "Truck";
926
+ Lightbulb: "Lightbulb";
927
+ Zap: "Zap";
928
+ Pencil: "Pencil";
929
+ Send: "Send";
930
+ }>;
931
+ size: z.ZodNullable<z.ZodEnum<{
932
+ sm: "sm";
933
+ md: "md";
934
+ lg: "lg";
935
+ }>>;
936
+ }, z.core.$strip>;
937
+ slots: never[];
938
+ description: string;
939
+ example: {
940
+ name: string;
941
+ size: string;
942
+ };
943
+ };
944
+ Segmented: {
945
+ props: z.ZodObject<{
946
+ label: z.ZodString;
947
+ name: z.ZodString;
948
+ options: z.ZodArray<z.ZodString>;
949
+ value: z.ZodNullable<z.ZodString>;
950
+ }, z.core.$strip>;
951
+ slots: never[];
952
+ description: string;
953
+ example: {
954
+ label: string;
955
+ name: string;
956
+ options: string[];
957
+ value: {
958
+ $bindState: string;
959
+ };
960
+ };
961
+ };
962
+ NumberInput: {
963
+ props: z.ZodObject<{
964
+ label: z.ZodString;
965
+ name: z.ZodString;
966
+ value: z.ZodNullable<z.ZodNumber>;
967
+ placeholder: z.ZodNullable<z.ZodString>;
968
+ unit: z.ZodNullable<z.ZodString>;
969
+ min: z.ZodNullable<z.ZodNumber>;
970
+ max: z.ZodNullable<z.ZodNumber>;
971
+ step: z.ZodNullable<z.ZodNumber>;
972
+ }, z.core.$strip>;
973
+ slots: never[];
974
+ description: string;
975
+ example: {
976
+ label: string;
977
+ name: string;
978
+ value: {
979
+ $bindState: string;
980
+ };
981
+ placeholder: string;
982
+ };
983
+ };
984
+ MthdsField: {
985
+ props: z.ZodObject<{
986
+ path: z.ZodString;
987
+ label: z.ZodNullable<z.ZodString>;
988
+ hint: z.ZodNullable<z.ZodString>;
989
+ }, z.core.$strip>;
990
+ slots: never[];
991
+ description: string;
992
+ example: {
993
+ path: string;
994
+ };
995
+ };
996
+ MthdsResult: {
997
+ props: z.ZodObject<{
998
+ path: z.ZodString;
999
+ hideLabel: z.ZodNullable<z.ZodBoolean>;
1000
+ }, z.core.$strip>;
1001
+ slots: never[];
1002
+ description: string;
1003
+ example: {
1004
+ path: string;
1005
+ };
1006
+ };
1007
+ DataTable: {
1008
+ props: z.ZodObject<{
1009
+ rows: z.ZodAny;
1010
+ columns: z.ZodArray<z.ZodObject<{
1011
+ path: z.ZodString;
1012
+ label: z.ZodString;
1013
+ format: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1014
+ number: "number";
1015
+ date: "date";
1016
+ text: "text";
1017
+ }>>>;
1018
+ }, z.core.$strip>>;
1019
+ caption: z.ZodNullable<z.ZodString>;
1020
+ }, z.core.$strip>;
1021
+ slots: never[];
1022
+ description: string;
1023
+ example: {
1024
+ rows: {
1025
+ $state: string;
1026
+ };
1027
+ columns: {
1028
+ path: string;
1029
+ label: string;
1030
+ }[];
1031
+ };
1032
+ };
1033
+ Metric: {
1034
+ props: z.ZodObject<{
1035
+ label: z.ZodString;
1036
+ value: z.ZodAny;
1037
+ unit: z.ZodNullable<z.ZodString>;
1038
+ format: z.ZodNullable<z.ZodEnum<{
1039
+ plain: "plain";
1040
+ integer: "integer";
1041
+ decimal: "decimal";
1042
+ compact: "compact";
1043
+ }>>;
1044
+ }, z.core.$strip>;
1045
+ slots: never[];
1046
+ description: string;
1047
+ example: {
1048
+ label: string;
1049
+ value: {
1050
+ $state: string;
1051
+ };
1052
+ unit: string;
1053
+ format: string;
1054
+ };
1055
+ };
1056
+ };
1057
+ actions: {
1058
+ run: {
1059
+ params: z.ZodObject<{}, z.core.$strip>;
1060
+ description: string;
1061
+ };
1062
+ };
1063
+ }> & {
1064
+ renders: Readonly<Record<string, ComponentRendering>>;
1065
+ };
1066
+ /** The spec type a layout is written against. */
1067
+ type GenerativeSpec = typeof catalog._specType;
1068
+ /**
1069
+ * Every component name the catalog knows, the shadcn subset first. This is
1070
+ * the order the designer method lists them in, since `designerCatalog()`
1071
+ * walks it; the rules and the direction that name them are the method's own
1072
+ * prose, in `methods/layout-design.mthds`.
1073
+ */
1074
+ declare const COMPONENT_NAMES: readonly string[];
1075
+ /**
1076
+ * The component names a layout written for `frame` may use, in the order the
1077
+ * designer method lists them. Frozen, like the catalog `frameCatalog` builds
1078
+ * over them: both are shared by every check, so a caller that edited one
1079
+ * would change what every later check accepts.
1080
+ */
1081
+ declare function componentNamesFor(frame: Frame): readonly string[];
1082
+ /**
1083
+ * The catalog a layout written for `frame` is validated against: the same
1084
+ * definitions and renderings as `catalog`, held to the frame's vocabulary.
1085
+ * Built once per frame and shared, so it is frozen with its vocabulary. A
1086
+ * composer that names an `AppBar` is refused here as an unknown component,
1087
+ * though the entry's registry could render one, because the host's frame
1088
+ * already draws what it stands for.
1089
+ */
1090
+ declare function frameCatalog(frame: Frame): ValidationCatalog;
1091
+
1092
+ /** The shadcn subset, by name. The order is the order the prompt lists them. */
1093
+ declare const PICKED_SHADCN: readonly ["Card", "Stack", "Grid", "Separator", "Heading", "Text", "Badge", "Alert", "Collapsible", "Progress", "Avatar", "Input", "Textarea", "Select", "Radio", "Checkbox", "Switch", "Button"];
1094
+ /** Our own, by name. */
1095
+ declare const CUSTOM_COMPONENTS: readonly ["Split", "Tabs", "Steps", "Icon", "Segmented", "NumberInput", "MthdsField", "MthdsResult", "DataTable", "Metric"];
1096
+ /**
1097
+ * The value formats a `Metric` can apply. A model picks one; the registry
1098
+ * formats with `Intl.NumberFormat`.
1099
+ */
1100
+ declare const METRIC_FORMATS: readonly ["plain", "integer", "decimal", "compact"];
1101
+ /**
1102
+ * The icons a spec may name: lucide's, a closed list so a misspelt name fails
1103
+ * validation rather than rendering nothing. Chosen for what pages about
1104
+ * methods talk about - people, places, money, time, files, standing.
1105
+ */
1106
+ 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"];
1107
+
1108
+ /** One action a page may bind to an event: its name, what it does, and whether the runtime handles it on its own. */
1109
+ declare const ActionSchema: z.ZodObject<{
1110
+ name: z.ZodString;
1111
+ description: z.ZodString;
1112
+ built_in: z.ZodBoolean;
1113
+ }, z.core.$strip>;
1114
+ type Action = z.infer<typeof ActionSchema>;
1115
+ /** 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. */
1116
+ declare const BriefSchema: z.ZodObject<{
1117
+ side: z.ZodEnum<{
1118
+ input: "input";
1119
+ result: "result";
1120
+ }>;
1121
+ pipe_ref: z.ZodString;
1122
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1123
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1124
+ paths: z.ZodArray<z.ZodLazy<z.ZodObject<{
1125
+ depth: z.ZodNumber;
1126
+ path: z.ZodString;
1127
+ kind: z.ZodString;
1128
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1129
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1130
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1131
+ required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1132
+ gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1133
+ notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1134
+ default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1135
+ delegated: z.ZodBoolean;
1136
+ relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1137
+ item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1138
+ item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1139
+ item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1140
+ }, z.core.$strip>>>;
1141
+ run_control: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1142
+ returns: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1143
+ frame: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1144
+ page: "page";
1145
+ composer: "composer";
1146
+ result: "result";
1147
+ }>>>;
1148
+ style: z.ZodOptional<z.ZodNullable<z.ZodLazy<z.ZodObject<{
1149
+ name: z.ZodString;
1150
+ direction: z.ZodString;
1151
+ }, z.core.$strip>>>>;
1152
+ sample_state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1153
+ }, z.core.$strip>;
1154
+ type Brief = z.infer<typeof BriefSchema>;
1155
+ /** 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. */
1156
+ declare const CatalogSchema: z.ZodObject<{
1157
+ components: z.ZodArray<z.ZodLazy<z.ZodObject<{
1158
+ name: z.ZodString;
1159
+ props: z.ZodString;
1160
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1161
+ accepts_children: z.ZodBoolean;
1162
+ slots: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1163
+ events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1164
+ }, z.core.$strip>>>;
1165
+ actions: z.ZodArray<z.ZodLazy<z.ZodObject<{
1166
+ name: z.ZodString;
1167
+ description: z.ZodString;
1168
+ built_in: z.ZodBoolean;
1169
+ }, z.core.$strip>>>;
1170
+ }, z.core.$strip>;
1171
+ type Catalog = z.infer<typeof CatalogSchema>;
1172
+ /** One component of the catalog: its name, the signature of its props, what it is for, and what it accepts. */
1173
+ declare const ComponentSchema: z.ZodObject<{
1174
+ name: z.ZodString;
1175
+ props: z.ZodString;
1176
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1177
+ accepts_children: z.ZodBoolean;
1178
+ slots: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1179
+ events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1180
+ }, z.core.$strip>;
1181
+ type Component = z.infer<typeof ComponentSchema>;
1182
+ /** 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. */
1183
+ declare const PagePlanSchema: z.ZodObject<{
1184
+ purpose: z.ZodString;
1185
+ title: z.ZodString;
1186
+ composition: z.ZodString;
1187
+ regions: z.ZodArray<z.ZodLazy<z.ZodObject<{
1188
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1189
+ purpose: z.ZodString;
1190
+ container: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1191
+ elements: z.ZodArray<z.ZodString>;
1192
+ }, z.core.$strip>>>;
1193
+ call_to_action: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1194
+ defaults: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1195
+ delegated: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1196
+ }, z.core.$strip>;
1197
+ type PagePlan = z.infer<typeof PagePlanSchema>;
1198
+ /** 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. */
1199
+ declare const PathEntrySchema: z.ZodObject<{
1200
+ depth: z.ZodNumber;
1201
+ path: z.ZodString;
1202
+ kind: z.ZodString;
1203
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1204
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1205
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1206
+ required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1207
+ gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1208
+ notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1209
+ default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1210
+ delegated: z.ZodBoolean;
1211
+ relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1212
+ item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1213
+ item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1214
+ item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
1215
+ }, z.core.$strip>;
1216
+ type PathEntry = z.infer<typeof PathEntrySchema>;
1217
+ /** An app style: a named look the components draw - faces, weights, radii, panels and rhythm - and the one sentence that says what it is, which the composition follows. */
1218
+ declare const StyleSchema: z.ZodObject<{
1219
+ name: z.ZodString;
1220
+ direction: z.ZodString;
1221
+ }, z.core.$strip>;
1222
+ type Style = z.infer<typeof StyleSchema>;
1223
+
1224
+ /**
1225
+ * The catalog as the designer method's `catalog` input: the vocabulary as
1226
+ * DATA, which the method's own prompt lays out.
1227
+ *
1228
+ * The prompt a model reads is the method - `methods/layout-design.mthds`
1229
+ * carries every paragraph of it as prose and loops over these two lists for
1230
+ * the component and action sections. What this package contributes is what
1231
+ * only code can state: each component's props signature, rendered from its
1232
+ * zod schema, beside the description and the slots its definition declares.
1233
+ * One function so the fixture pass, the briefs and the tests hand over one
1234
+ * value, and the hash stamped on a captured layout covers what was actually
1235
+ * sent.
1236
+ *
1237
+ * The shapes are the method's own: codegen projects the `Catalog`,
1238
+ * `Component` and `Action` structures the bundle declares into
1239
+ * `src/generated/layout-design/`, and the aliases below are those types. So a
1240
+ * field renamed in the bundle fails the type check on the literals here
1241
+ * rather than a run, and the value goes over as the content of a structured
1242
+ * input, verbatim. The import is type-only: the generated zod schemas stay
1243
+ * out of the entry, which ships no validator for this value.
1244
+ */
1245
+ /** The `Catalog` structure of `methods/layout-design.mthds`, as codegen projects it. */
1246
+ type DesignerCatalog = Catalog;
1247
+ /** One component of the catalog: its name, its props signature, what it is for, what it accepts. */
1248
+ type DesignerComponent = Component;
1249
+ /** One action a page may bind to an event. */
1250
+ type DesignerAction = Action;
1251
+ /** The concept a run request names for the `catalog` input: the method's own, domain-qualified. */
1252
+ declare const DESIGNER_CATALOG_CONCEPT = "generative.Catalog";
1253
+ /** What a catalog is built for. */
1254
+ interface DesignerCatalogOptions {
1255
+ /**
1256
+ * The frame the layout is written for: `page` (the default), a whole
1257
+ * product page; `composer` or `result`, a moment of a host's
1258
+ * compose-then-result app, whose vocabulary leaves out what that host draws
1259
+ * and adds the frame's own components (`componentNamesFor`).
1260
+ */
1261
+ frame?: Frame;
1262
+ }
1263
+ /**
1264
+ * The catalog as the designer method's `catalog` input, for one frame. The
1265
+ * same frame's `frameCatalog` is what the layout it produces is validated
1266
+ * against, so the vocabulary a model was shown and the one it is held to are
1267
+ * one list.
1268
+ */
1269
+ declare function designerCatalog({ frame }?: DesignerCatalogOptions): DesignerCatalog;
1270
+
1271
+ /**
1272
+ * The hash that pairs a captured layout with the prompt it was produced
1273
+ * against: the first twelve hex digits of the SHA-256 of `promptHashSubject`,
1274
+ * which is the designer method's text and the catalog of every frame.
1275
+ *
1276
+ * The prompt is no longer one string this package renders: it is the method
1277
+ * (`methods/layout-design.mthds`, every paragraph as prose) applied to
1278
+ * the catalog as data (`designerCatalog({ frame })`). Both are what a run was
1279
+ * actually given, so both are hashed - a reworded rule and a renamed prop each
1280
+ * move the pin, exactly as they did when the prompt was rendered here. A run
1281
+ * is given the catalog of one frame, and the hash covers every frame's in a
1282
+ * fixed order: one pin a host compares every stored layout with, whichever
1283
+ * frame it was written for, and which any frame's vocabulary moving moves. The frame a
1284
+ * layout was written for is its own provenance, beside the hash. The brief is
1285
+ * not hashed: it is the per-method half, recorded with each layout. The model
1286
+ * pin in the method file moves it too, since the file is hashed whole; a
1287
+ * fixture records its model on its own, so that costs a regeneration, never a
1288
+ * misread.
1289
+ *
1290
+ * It is a PIN rather than a computation, so that this entry stays importable
1291
+ * from a browser (hashing would mean `node:crypto` or an async Web Crypto
1292
+ * call, and a host compares this value synchronously while deciding whether a
1293
+ * stored layout still stands - and the entry must not read the method file).
1294
+ * `__tests__/prompt.test.ts` recomputes it from the file and the catalog and
1295
+ * fails on any drift, so the pin cannot go stale quietly: a catalog, rule or
1296
+ * direction change is a failing test, which is exactly what it was for.
1297
+ *
1298
+ * A stored layout whose hash is not this one is not rendered - the host falls
1299
+ * back to the kernel's own form - because the vocabulary it was written in is
1300
+ * no longer the vocabulary this entry renders.
1301
+ */
1302
+ declare const PROMPT_HASH = "30cf9bc059f6";
1303
+ /**
1304
+ * What the hash is computed over: the method's text as shipped, then the
1305
+ * catalog of each frame as a run request carries it, in `FRAMES` order. The
1306
+ * one recipe the test, the fixture pass and a host's producer share, so the
1307
+ * pin they check and the stamp they write agree: a producer that runs the
1308
+ * method off a checkout hashes this string (SHA-256, the first twelve hex
1309
+ * digits) and compares it with `PROMPT_HASH` before it spends anything. It is
1310
+ * a string rather than the hash so the entry stays free of a hashing
1311
+ * dependency and importable from a browser.
1312
+ */
1313
+ declare function promptHashSubject(method: string): string;
1314
+
1315
+ /**
1316
+ * Whether a stored layout still fits the descriptor it will be rendered over.
1317
+ *
1318
+ * A layout is produced once per method version and stored; a descriptor is
1319
+ * derived from the method every time it is read. Those two can part company -
1320
+ * a method's input is renamed, a structure loses a member - and when they do,
1321
+ * a delegated path resolves to nothing and a bound path writes into a corner of
1322
+ * the state the run never reads. Neither fails loudly on its own, so the host
1323
+ * asks this before it renders and falls back to the kernel's own form when the
1324
+ * answer is no.
1325
+ *
1326
+ * Two directions, and the second is the one a corpus cannot notice. The first
1327
+ * is staleness: every path the layout MENTIONS is a path the descriptor still
1328
+ * has, which is the corpus test's check lifted out of the test and into the
1329
+ * product. The second is coverage: every path the descriptor REQUIRES is one
1330
+ * the layout offers somewhere. A layout that simply omits an input is not
1331
+ * stale and validates perfectly - it renders a page with no field for a
1332
+ * required input, the run gate then refuses the run for that input, and the
1333
+ * person has nowhere to type it. A page you cannot complete is worse than the
1334
+ * plain form, which is what the fallback is for.
1335
+ *
1336
+ * It answers with problems, not exceptions, and that is a promise rather than
1337
+ * a habit: a host calls this to decide whether it is safe to render, so a
1338
+ * throw leaves it with no verdict at the one moment it needs one. A layout is
1339
+ * model-produced and may be malformed in ways the walk below trips on
1340
+ * (`children: 5`, a null element, no `elements` map at all), and the other
1341
+ * gate, which refuses those shapes outright, is exported separately - so
1342
+ * neither may assume the other ran first.
1343
+ *
1344
+ * A third check sits between the two and is about KIND rather than presence:
1345
+ * a path a layout shows as a value must be a scalar, and a path it reads into
1346
+ * a prop that takes a list must be a list. A `SummaryRow` whose `value` reads
1347
+ * `/inputs/document`, a structure of a url and a filename, is not stale - the
1348
+ * path exists - and it validates perfectly; it renders `[object Object]`,
1349
+ * because the renderer stringifies what it is handed and nothing anywhere said
1350
+ * the path was not a value. An `AppBar` whose `links` read that same structure
1351
+ * is the mirror image: its renderer maps over what it is handed, renders
1352
+ * nothing for a structure and throws for a text. Only the descriptor knows
1353
+ * what kind a path is, so this is where that is said.
1354
+ *
1355
+ * What is NOT checked here is whether the layout validates against the catalog
1356
+ * - that is `validateAgainstCatalog`, and a host runs both.
1357
+ */
1358
+ interface LayoutDescriptor {
1359
+ /** The input page's top-level fields, for `/inputs/...` paths. */
1360
+ inputs?: readonly RunField[];
1361
+ /** The result page's descriptor, for `/result/...` paths. */
1362
+ result?: RunField;
1363
+ }
1364
+ /**
1365
+ * Every way this layout no longer fits, in the words a host can count by:
1366
+ * one line per element or path, empty when it fits.
1367
+ *
1368
+ * The checks live in `collectLayoutProblems`; this is the boundary that keeps
1369
+ * the promise in the header around them. A malformed spec is one line, naming
1370
+ * what the walk tripped on, which is a verdict the fallback can act on where a
1371
+ * throw was not.
1372
+ */
1373
+ declare function layoutProblems(descriptor: LayoutDescriptor, spec: Spec): string[];
1374
+ /** The predicate: `layoutProblems` is empty. */
1375
+ declare function layoutFits(descriptor: LayoutDescriptor, spec: Spec): boolean;
1376
+
1377
+ /**
1378
+ * What a producer of layouts needs beside the method, the catalog and the
1379
+ * brief: the line a creative seed travels as, the checks a produced layout is
1380
+ * held to, and how many times a refused one goes back to the method's repair
1381
+ * pass. Nothing here calls a model; the producer is the host's, on the far
1382
+ * side of this seam (docs/generative-ui.md, "Producing a layout").
1383
+ */
1384
+ /**
1385
+ * The one line a creative seed reaches the designer method as, under its
1386
+ * `seed` input. The planner's seed procedure was written against this line,
1387
+ * so a host that hands the method a seed sends it, rather than restating it.
1388
+ */
1389
+ declare function seedLine(seed: string): string;
1390
+ /**
1391
+ * How many times a producer hands a refused layout to the method's
1392
+ * `repair_layout` pass before it gives up and the host keeps the plain form.
1393
+ * The refusals the designer makes are slips of one prop or one heading, which
1394
+ * one pass told what it broke fixes; a second covers a fix that broke a rule
1395
+ * of its own, and a third would be paying for a page that is not converging.
1396
+ */
1397
+ declare const REPAIR_ATTEMPTS = 2;
1398
+ /** What a layout is checked against: the frame it was written for and the descriptor it binds. */
1399
+ interface LayoutCheck {
1400
+ frame: Frame;
1401
+ descriptor: LayoutDescriptor;
1402
+ }
1403
+ /**
1404
+ * The checks' answer on a layout: every problem they found, one a line, and
1405
+ * whether they themselves failed on it.
1406
+ */
1407
+ interface LayoutVerdict {
1408
+ /** Every problem, one a line, in the words the repair pass reads; empty means the layout may render. */
1409
+ problems: string[];
1410
+ /**
1411
+ * Whether a check threw on a layout of the right shape: a defect in the
1412
+ * checks, stated among the problems in a line of its own. The layout is
1413
+ * refused all the same - the host keeps the plain form - but a producer
1414
+ * stops here instead of handing the lines to the repair pass, which can
1415
+ * change the layout and not the checks.
1416
+ */
1417
+ checksFailed: boolean;
1418
+ }
1419
+ /**
1420
+ * Everything the host's two checks find wrong with a layout written for
1421
+ * `frame`, and whether the checks themselves failed on it: first the
1422
+ * catalog's verdict against the frame's own vocabulary (`frameCatalog`), then
1423
+ * whether it fits the descriptor (`layoutProblems`). Empty problems mean the
1424
+ * layout may render. A producer feeds the lines, joined, to `repair_layout`
1425
+ * as its `problems`, unless `checksFailed` says no repair can help; a host
1426
+ * deciding whether a stored layout renders needs only whether the list is
1427
+ * empty, which `layoutCheckProblems` answers alone.
1428
+ *
1429
+ * It never throws. Its subject is whatever a model wrote, or a layout and a
1430
+ * frame a host stored and read back, and a throw is the one answer a host
1431
+ * cannot act on: it arrives instead of the problem that would have sent the
1432
+ * page to its fallback. So a frame this package does not draw, a missing or
1433
+ * misshapen descriptor, and anything not shaped like a spec are each a
1434
+ * problem line, and a throw left in a walk below on a layout of the right
1435
+ * shape is the checks' own failure: a line saying so, and `checksFailed`.
1436
+ * The shape is checked once, before either check walks the layout.
1437
+ */
1438
+ declare function layoutCheck(spec: Spec, { frame, descriptor }: LayoutCheck): LayoutVerdict;
1439
+ /**
1440
+ * Everything the host's two checks find wrong with a layout written for
1441
+ * `frame`, one problem a line: `layoutCheck`'s problems alone, for a host
1442
+ * that needs only whether a stored layout renders. Never throws.
1443
+ */
1444
+ declare function layoutCheckProblems(spec: Spec, check: LayoutCheck): string[];
1445
+
1446
+ /**
1447
+ * The brief: the model's view of the descriptor, as DATA.
1448
+ *
1449
+ * Rule 1, restated for a model. The model's input is the DESCRIPTOR, never JSON
1450
+ * Schema: it receives the kinds, the labels, the descriptions, the choices, the
1451
+ * presence and what gates the run - projected from `RunField[]` here, and from
1452
+ * nowhere else, into the `Brief` structure the designer method declares. On the
1453
+ * result side it also receives one real run's loaded state, so it can judge
1454
+ * magnitudes, but it never sees the wire: the state it reads is what
1455
+ * `payloadToState` produced, with the envelopes already gone.
1456
+ *
1457
+ * Nothing here is prose. The sentences a model reads - the headings, how a
1458
+ * path line is worded, what "delegated" says - are the method's own, in the
1459
+ * `render_brief` stage of `methods/layout-design.mthds`: a Jinja2 template
1460
+ * over this value, and the one place the brief's wording is edited. What this
1461
+ * module contributes is what only code can state: every path, flattened in
1462
+ * reading order with its depth, its kind in words, its constraints in words,
1463
+ * and which of them the kernel keeps. The shape is the method's own: codegen
1464
+ * projects its `Brief` and `PathEntry` structures into
1465
+ * `src/generated/layout-design/`, and the aliases below are those types,
1466
+ * imported type-only so the generated schemas stay out of the entry. A field
1467
+ * renamed in the bundle fails the type check on the literals here rather than
1468
+ * a run.
1469
+ *
1470
+ * Pure, no React, and the only place the descriptor is projected for a model.
1471
+ * What a path is marked as (delegated or not) is decided here too, so the
1472
+ * projection, the brief and the validator agree on which paths the kernel
1473
+ * renders.
1474
+ */
1475
+ /** The `Brief` structure of `methods/layout-design.mthds`, as codegen projects it. */
1476
+ type DesignerBrief = Brief;
1477
+ /** One path of the brief: where it is, what it holds, what constrains it, whether the kernel keeps it. */
1478
+ type DesignerPathEntry = PathEntry;
1479
+ /** The style a brief carries: its name and its direction, as `APP_STYLES` states them. */
1480
+ type DesignerStyle = Style;
1481
+ /** The concept a run request names for the `brief` input: the method's own, domain-qualified. */
1482
+ declare const DESIGNER_BRIEF_CONCEPT = "generative.Brief";
1483
+ interface BriefSubject {
1484
+ /** `results.nested_result`. */
1485
+ pipeRef: string;
1486
+ /** The pipe's description, when the wire carries one. */
1487
+ description?: string;
1488
+ /**
1489
+ * The method's name as a host lists it - an authored method's, since a host
1490
+ * has one for every method it lists; absent on a synthesized carrier, which
1491
+ * no host lists. The brief hands it to the layout as the one product name
1492
+ * the page may carry, because the brand catalog's AppBar asks for a name
1493
+ * and a brief that gives none gets one invented.
1494
+ */
1495
+ name?: string;
1496
+ }
1497
+ /**
1498
+ * On the input side, the kinds the catalog's inputs cannot enter - and one
1499
+ * shape of a kind they otherwise can. The standard puts no floor on a choice,
1500
+ * so an enum may carry `""`; the catalog's own choices may not, because no
1501
+ * dropdown row or pill can offer nothing, and the validator refuses an empty
1502
+ * option. A model told to list the brief's choices exactly would copy the
1503
+ * empty one into a layout the validator then refuses, so the brief hands the
1504
+ * input back to the kernel's own control instead.
1505
+ */
1506
+ declare function isDelegatedInput(field: RunField): boolean;
1507
+ /**
1508
+ * On the result side, the kinds and concepts the catalog cannot show.
1509
+ *
1510
+ * A native value is one of them, and so is a list of one: the native
1511
+ * predicates refuse a `list` node, because a list of dates is a list and not a
1512
+ * date, but no catalog component reads a date's `{date, time}` either, so the
1513
+ * kernel renders the list whole - one value per line, as the result view does.
1514
+ *
1515
+ * The result frame's vocabulary shows two of them itself: a picture
1516
+ * (`Picture`) and a date in words (`DateText`), so on a result page written
1517
+ * for that frame neither is delegated. A date with a time stays delegated:
1518
+ * `DateText` writes the day alone, and the kernel's result shows the time.
1519
+ */
1520
+ declare function isDelegatedResult(field: RunField, frame?: Frame): boolean;
1521
+ /** How an input page's brief is built: the frame it is written for, the team's style, and what a run returns. */
1522
+ interface InputBriefOptions {
1523
+ /** `page` (the default), a whole product page; `composer`, the inputs of a host's compose-then-result app. */
1524
+ frame?: Extract<Frame, 'page' | 'composer'>;
1525
+ /**
1526
+ * The style the team's apps wear. The brief carries its name and its
1527
+ * direction, which the composition follows; its faces, radii and panels are
1528
+ * the components' to draw and never reach the brief. Absent, the brief
1529
+ * names no style.
1530
+ */
1531
+ style?: AppStyleId;
1532
+ /** The result's descriptor, from which a composer's brief says what one run gives back. */
1533
+ result?: RunField;
1534
+ }
1535
+ /** How a result page's brief is built: the frame it is written for and the team's style. */
1536
+ interface ResultBriefOptions {
1537
+ /** `page` (the default), a whole product page; `result`, the result page of a host's compose-then-result app. */
1538
+ frame?: Extract<Frame, 'page' | 'result'>;
1539
+ /** The style the team's apps wear (see `InputBriefOptions.style`). */
1540
+ style?: AppStyleId;
1541
+ }
1542
+ /** The brief for an INPUT page: the form a run is started from. */
1543
+ declare function inputBrief(subject: BriefSubject, fields: readonly RunField[], { frame, style, result }?: InputBriefOptions): DesignerBrief;
1544
+ /** The brief for a RESULT page: what one run produced, laid out. */
1545
+ declare function resultBrief(subject: BriefSubject, field: RunField, state: unknown, { frame, style }?: ResultBriefOptions): DesignerBrief;
1546
+
1547
+ /**
1548
+ * A spec as JSONL patches, and back.
1549
+ *
1550
+ * json-render's wire format is RFC 6902 patches, one per line, root first and
1551
+ * parents before children, so a renderer can paint a partial tree at every
1552
+ * line. A model emits that format; a projected or authored spec is a finished
1553
+ * object. This is the bridge: any of the three sources can be replayed through
1554
+ * `specToJsonl`, and what a model emitted is compiled through `specFromJsonl`
1555
+ * before it is validated.
1556
+ */
1557
+ /**
1558
+ * The patch lines for a spec: `/root`, then every element reachable from the
1559
+ * root in breadth-first order (a parent always precedes its children), then
1560
+ * any element the root does not reach (kept, so a validator can report it),
1561
+ * then one patch per top-level `state` key.
1562
+ */
1563
+ declare function specToJsonl(spec: Spec): string;
1564
+ /**
1565
+ * The spec a JSONL stream compiles to. Blank lines and non-JSON lines are
1566
+ * skipped by the compiler; a line whose `path` or `from` would reach a
1567
+ * prototype is dropped here, before the compiler sees it; and a line the
1568
+ * compiler refuses is dropped too, which is why the stream is applied one line
1569
+ * at a time.
1570
+ *
1571
+ * A batch compile made a single bad line fatal to the whole layout. Two of them
1572
+ * are reachable from produced text: a `test` op whose value does not match
1573
+ * throws `Test operation failed`, and a non-string `path` throws
1574
+ * `path.startsWith is not a function`. A host follows the documented flow -
1575
+ * compile, then ask the two gates - so a throw here arrives before there is any
1576
+ * verdict to act on, and the fallback that exists for exactly this case never
1577
+ * fires. Skipping the line degrades instead: what survives is a partial spec,
1578
+ * which the gates then judge on its merits and reject if it is not renderable.
1579
+ */
1580
+ declare function specFromJsonl(jsonl: string): Spec;
1581
+ /** The individual patch lines of a stream, for a replay that feeds them one at a time. */
1582
+ declare function jsonlLines(jsonl: string): string[];
1583
+
1584
+ /**
1585
+ * The two state trees, and how a path into either maps back onto the
1586
+ * descriptor.
1587
+ *
1588
+ * An input page binds at `/inputs/<name>`, recursing into structures as the
1589
+ * descriptor does; a result page binds at `/result/<path>`. Both are JSON
1590
+ * Pointers (RFC 6901), because that is what json-render's state store reads.
1591
+ * Nothing here knows a value - a path is resolved against the DESCRIPTOR, which
1592
+ * is how the two escape hatches find the `RunField` to hand the kernel.
1593
+ */
1594
+ declare const INPUTS_ROOT = "/inputs";
1595
+ declare const RESULT_ROOT = "/result";
1596
+ /** `/inputs` + `invoice` + `billed_to` → `/inputs/invoice/billed_to`. */
1597
+ declare function joinPath(root: string, ...segments: readonly string[]): string;
1598
+ /** The segments of a pointer, root excluded: `/inputs/a/b` under `/inputs` → `['a', 'b']`. */
1599
+ declare function segmentsUnder(root: string, path: string): string[] | undefined;
1600
+ /**
1601
+ * The descriptor node a path names, or `undefined` when the path leaves the
1602
+ * tree. An object's children are found by name; a list's are found by index,
1603
+ * and every index resolves to the same item descriptor.
1604
+ */
1605
+ declare function fieldAtSegments(fields: readonly RunField[], segments: readonly string[]): RunField | undefined;
1606
+ /** `/inputs/<...>` resolved against a form's top-level fields. */
1607
+ declare function inputFieldAtPath(fields: readonly RunField[], path: string): RunField | undefined;
1608
+ /** `/result/<...>` resolved against a result descriptor; `/result` itself is the root. */
1609
+ declare function resultFieldAtPath(field: RunField, path: string): RunField | undefined;
1610
+ /**
1611
+ * The base path a relative hatch path resolves against, statically: the chain
1612
+ * of `repeat`s from the root down to `key`, each contributing its list path
1613
+ * and a first index. `undefined` outside any repeat. Mirrors what
1614
+ * `useRepeatScope` gives the hatch at render time, for a test that never
1615
+ * renders.
1616
+ *
1617
+ * The walk up the parent chain STOPS on a key it has already seen. A layout is
1618
+ * model-produced, and an element that is its own ancestor - `children: ["self"]`
1619
+ * at its simplest - is a shape json-render's `validateSpec` accepts without a
1620
+ * word, so without the guard this loop never terminates. Since a host calls
1621
+ * this through `layoutFits` precisely to decide whether an untrusted layout is
1622
+ * safe to render, the gate hanging is worse than the layout it was asked about.
1623
+ */
1624
+ declare function repeatBasePathOf(spec: Spec, key: string, parents?: Map<string, string>): string | undefined;
1625
+ /** A hatch's path as the layer resolves it: absolute as written, or relative to the repeat it sits in. */
1626
+ declare function absoluteHatchPath(spec: Spec, key: string, path: string, parents?: Map<string, string>): string | undefined;
1627
+
1628
+ /**
1629
+ * A payload, as the result tree a spec binds to at `/result`.
1630
+ *
1631
+ * - a `date` becomes the ISO string (`2026-03-14`, or `2026-03-14 15:40:00`
1632
+ * when a time rides along), whatever envelope it arrived in;
1633
+ * - a `list` becomes an array whether the wire sent one or the plural
1634
+ * envelope `{items: [...]}`, each item loaded by the item descriptor;
1635
+ * - an `object` is loaded member by member, keeping any member the descriptor
1636
+ * does not name as it came;
1637
+ * - a `document` or `image` passes through verbatim: the pinned content model
1638
+ * is what `ResultField` reads, and its member names (`url`, `filename`) are
1639
+ * the ones a model would bind to anyway;
1640
+ * - the three native concepts the kind vocabulary cannot name (`native.Html`,
1641
+ * `native.Date`, `native.Composite`) pass through whole, for the escape
1642
+ * hatch to render - and a list of one is still a list, an array of whole
1643
+ * values, which is what the kernel renders when the brief delegates it;
1644
+ * - a scalar passes through.
1645
+ *
1646
+ * A top-level scalar's `contentKey` wrapper is NOT unwrapped: `ResultField`
1647
+ * unwraps it itself, and the brief names the wrapped path (`/result/text`), so
1648
+ * the model and the escape hatch read the same tree.
1649
+ */
1650
+ declare function payloadToState(field: RunField, payload: unknown): unknown;
1651
+
1652
+ /**
1653
+ * A spec with its provenance - the shape every fixture takes, whoever produced
1654
+ * it, so a story renders any of them without knowing which it holds.
1655
+ *
1656
+ * A spec is a payload's twin: the one artifact no projection can produce. So
1657
+ * it follows the payload's rules - produced by a pass, committed with its
1658
+ * provenance - plus what a spec needs and a payload does not: WHO produced it,
1659
+ * on WHICH model, under WHAT prompt (its hash), and, when the run was given
1660
+ * one, the creative seed and the critic loop. The stories and the comparison
1661
+ * viewer are titled from this record and from nothing else, so a page is
1662
+ * never labelled with a role ("authored", "generated") but with what actually
1663
+ * made it.
1664
+ */
1665
+ /** How a spec came to be. */
1666
+ type Producer =
1667
+ /** The designer method, `methods/layout-design.mthds`, run on the hosted API. */
1668
+ 'pipelex-method'
1669
+ /** A Claude Code subagent in a fresh context, given the method, the catalog data and the brief and nothing else. */
1670
+ | 'claude-code-subagent'
1671
+ /** The Claude Code session working in this repo, writing the spec by hand in TypeScript. */
1672
+ | 'claude-code-session';
1673
+ interface CriticLoop {
1674
+ /** The model that judged the screenshots. */
1675
+ model: string;
1676
+ /** How many critique-and-revise rounds ran. */
1677
+ rounds: number;
1678
+ }
1679
+ interface SpecFixture {
1680
+ /** `results.nested_result`. */
1681
+ pipeRef: string;
1682
+ producer: Producer;
1683
+ /** The model id: the one the method ran with, or the Claude Code model behind the agent. */
1684
+ model: string;
1685
+ /** The creative seed handed over with the brief, verbatim, when one was. */
1686
+ seed?: string;
1687
+ /** The critic loop the producer ran, when one did. */
1688
+ critic?: CriticLoop;
1689
+ /** The frame it was written for, when not a whole product page: `composer` or `result`. */
1690
+ frame?: Exclude<Frame, 'page'>;
1691
+ /** The style the brief carried, when it carried one. */
1692
+ style?: AppStyleId;
1693
+ /**
1694
+ * How many times the method's repair pass re-emitted it before it passed
1695
+ * the checks, when it needed any: the page as stored is the last pass's.
1696
+ */
1697
+ repairs?: number;
1698
+ /** The first twelve hex digits of the SHA-256 of the catalog prompt at the time. */
1699
+ promptHash: string;
1700
+ /** The day it was produced, `YYYY-MM-DD`. */
1701
+ date: string;
1702
+ /** The brief it was produced from, repo-relative. */
1703
+ brief: string;
1704
+ /** The JSONL patch lines, exactly as emitted, or as `specToJsonl` renders a hand-written spec. */
1705
+ jsonl: string;
1706
+ /** The compiled spec. */
1707
+ spec: Spec;
1708
+ /**
1709
+ * The planner's plan, when the producer was the designer method: the
1710
+ * intermediate the builder was handed, read from the run's working memory.
1711
+ * It is what a person reads to see why a page has the shape it has, and it
1712
+ * is the one stage a comparison between two runs can be made at. Absent for
1713
+ * a producer that plans nowhere the harness can read.
1714
+ */
1715
+ plan?: PagePlan;
1716
+ }
1717
+ type Provenance = Pick<SpecFixture, 'producer' | 'model' | 'seed' | 'critic' | 'frame' | 'style'>;
1718
+ /**
1719
+ * The id a story and a screenshot are keyed by: producer, model, the frame and
1720
+ * the style it was written for, and the two procedures that change what a run
1721
+ * is. `pipelex-method--gpt-5.5--seeded`,
1722
+ * `pipelex-method--gpt-6.1-sol--composer--soft--seeded`.
1723
+ */
1724
+ declare function fixtureId(fixture: Provenance): string;
1725
+ /**
1726
+ * The honest title: what made the page. `Pipelex method · gpt-5.5 · with a
1727
+ * seed`, never a role ("authored", "generated").
1728
+ */
1729
+ declare function fixtureLabel(fixture: Provenance & Pick<SpecFixture, 'repairs'>): string;
1730
+ /** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */
1731
+ declare function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string): SpecFixture;
1732
+
1733
+ export { type BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, COMPOSER_COMPONENTS, CUSTOM_COMPONENTS, type ComponentRendering, type CriticLoop, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, type DesignerAction, type DesignerBrief, type DesignerCatalog, type DesignerCatalogOptions, type DesignerComponent, type DesignerPathEntry, type DesignerStyle, FRAMES, FRAME_COMPONENTS, type Frame, type GenerativeSpec, ICON_NAMES, INPUTS_ROOT, type InputBriefOptions, type LayoutCheck, type LayoutDescriptor, type LayoutVerdict, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, type Producer, type ProductComponentName, REPAIR_ATTEMPTS, RESULT_COMPONENTS, RESULT_ROOT, type ResultBriefOptions, type SpecFixture, type SpecProblem, type SpecVerdict, type ValidationCatalog, absoluteHatchPath, catalog, componentNamesFor, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, frameCatalog, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutCheck, layoutCheckProblems, layoutFits, layoutProblems, payloadToState, promptHashSubject, repeatBasePathOf, resultBrief, resultFieldAtPath, seedLine, segmentsUnder, specFromJsonl, specToJsonl, validateAgainstCatalog };