@pipelex/mthds-form 0.9.0 → 0.10.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 (50) hide show
  1. package/README.md +3 -0
  2. package/dist/{chunk-S4CB423P.js → chunk-4JQAJT7C.js} +3 -3
  3. package/dist/{chunk-S4CB423P.js.map → chunk-4JQAJT7C.js.map} +1 -1
  4. package/dist/{chunk-YABRYTQ4.js → chunk-4KGQ65TQ.js} +3 -3
  5. package/dist/{chunk-YABRYTQ4.js.map → chunk-4KGQ65TQ.js.map} +1 -1
  6. package/dist/chunk-CAKQ5VFT.js +35 -0
  7. package/dist/chunk-CAKQ5VFT.js.map +1 -0
  8. package/dist/{chunk-25I6JDIK.js → chunk-FABY3DEY.js} +2 -2
  9. package/dist/chunk-FABY3DEY.js.map +1 -0
  10. package/dist/{chunk-KG4IYFWI.js → chunk-G6BWZUGV.js} +165 -46
  11. package/dist/chunk-G6BWZUGV.js.map +1 -0
  12. package/dist/{chunk-AZZAAGNX.js → chunk-TID7ZN63.js} +7 -3
  13. package/dist/chunk-TID7ZN63.js.map +1 -0
  14. package/dist/chunk-XCO6GTEC.js +38 -0
  15. package/dist/chunk-XCO6GTEC.js.map +1 -0
  16. package/dist/{chunk-KIEOLP2L.js → chunk-ZB4RYUKV.js} +4 -4
  17. package/dist/chunk-ZB4RYUKV.js.map +1 -0
  18. package/dist/core/derive.d.ts +1 -0
  19. package/dist/core/derive.js +2 -2
  20. package/dist/core/descriptor.d.ts +13 -2
  21. package/dist/core/descriptor.js +1 -1
  22. package/dist/core/file-formats.d.ts +34 -7
  23. package/dist/core/file-formats.js +1 -1
  24. package/dist/core/gating-fields.d.ts +1 -0
  25. package/dist/core/index.d.ts +2 -1
  26. package/dist/core/index.js +7 -6
  27. package/dist/core/narrow-file-formats.d.ts +50 -0
  28. package/dist/core/narrow-file-formats.js +4 -0
  29. package/dist/core/narrow-file-formats.js.map +1 -0
  30. package/dist/core/native-content.d.ts +20 -11
  31. package/dist/core/native-content.js +1 -1
  32. package/dist/core/readiness.d.ts +1 -0
  33. package/dist/core/stuff-files.d.ts +1 -0
  34. package/dist/core/stuff-files.js +2 -2
  35. package/dist/core/values.d.ts +1 -0
  36. package/dist/core/values.js +3 -3
  37. package/dist/generative/index.d.ts +105 -12
  38. package/dist/generative/index.js +79 -157
  39. package/dist/generative/index.js.map +1 -1
  40. package/dist/{ui-designer.mthds → layout-design.mthds} +177 -29
  41. package/dist/react/index.d.ts +66 -10
  42. package/dist/react/index.js +5 -5
  43. package/dist/styles.css +1 -1
  44. package/package.json +3 -3
  45. package/dist/chunk-25I6JDIK.js.map +0 -1
  46. package/dist/chunk-2JWRG53S.js +0 -33
  47. package/dist/chunk-2JWRG53S.js.map +0 -1
  48. package/dist/chunk-AZZAAGNX.js.map +0 -1
  49. package/dist/chunk-KG4IYFWI.js.map +0 -1
  50. package/dist/chunk-KIEOLP2L.js.map +0 -1
@@ -10,6 +10,7 @@ import * as zod_v4_core from 'zod/v4/core';
10
10
  import { F as FieldEnv } from '../field-renderer-BSU2hMf6.js';
11
11
  import '../core/contracts.js';
12
12
  import 'mthds/protocol';
13
+ import '../core/file-formats.js';
13
14
 
14
15
  /**
15
16
  * Whether a spec is one this catalog can render - the check every source
@@ -855,7 +856,7 @@ type GenerativeSpec = typeof catalog._specType;
855
856
  * Every component name the catalog knows, the shadcn subset first. This is
856
857
  * the order the designer method lists them in, since `designerCatalog()`
857
858
  * walks it; the rules and the direction that name them are the method's own
858
- * prose, in `data/generative/ui-designer.mthds`.
859
+ * prose, in `methods/layout-design.mthds`.
859
860
  */
860
861
  declare const COMPONENT_NAMES: readonly string[];
861
862
 
@@ -882,6 +883,36 @@ declare const ActionSchema: z.ZodObject<{
882
883
  built_in: z.ZodBoolean;
883
884
  }, z.core.$strip>;
884
885
  type Action = z.infer<typeof ActionSchema>;
886
+ /** 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. */
887
+ declare const BriefSchema: z.ZodObject<{
888
+ side: z.ZodEnum<{
889
+ input: "input";
890
+ result: "result";
891
+ }>;
892
+ pipe_ref: z.ZodString;
893
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
894
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
895
+ paths: z.ZodArray<z.ZodLazy<z.ZodObject<{
896
+ depth: z.ZodNumber;
897
+ path: z.ZodString;
898
+ kind: z.ZodString;
899
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
900
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
901
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
902
+ required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
903
+ gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
904
+ notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
905
+ default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
906
+ delegated: z.ZodBoolean;
907
+ relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
908
+ item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
909
+ item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
910
+ item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
911
+ }, z.core.$strip>>>;
912
+ run_control: z.ZodOptional<z.ZodNullable<z.ZodString>>;
913
+ sample_state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
914
+ }, z.core.$strip>;
915
+ type Brief = z.infer<typeof BriefSchema>;
885
916
  /** 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. */
886
917
  declare const CatalogSchema: z.ZodObject<{
887
918
  components: z.ZodArray<z.ZodLazy<z.ZodObject<{
@@ -925,12 +956,31 @@ declare const PagePlanSchema: z.ZodObject<{
925
956
  delegated: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
926
957
  }, z.core.$strip>;
927
958
  type PagePlan = z.infer<typeof PagePlanSchema>;
959
+ /** 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. */
960
+ declare const PathEntrySchema: z.ZodObject<{
961
+ depth: z.ZodNumber;
962
+ path: z.ZodString;
963
+ kind: z.ZodString;
964
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
965
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
966
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
967
+ required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
968
+ gating: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
969
+ notes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
970
+ default: z.ZodOptional<z.ZodNullable<z.ZodString>>;
971
+ delegated: z.ZodBoolean;
972
+ relative: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
973
+ item_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
974
+ item_description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
975
+ item_laid_out: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
976
+ }, z.core.$strip>;
977
+ type PathEntry = z.infer<typeof PathEntrySchema>;
928
978
 
929
979
  /**
930
980
  * The catalog as the designer method's `catalog` input: the vocabulary as
931
981
  * DATA, which the method's own prompt lays out.
932
982
  *
933
- * The prompt a model reads is the method - `data/generative/ui-designer.mthds`
983
+ * The prompt a model reads is the method - `methods/layout-design.mthds`
934
984
  * carries every paragraph of it as prose and loops over these two lists for
935
985
  * the component and action sections. What this package contributes is what
936
986
  * only code can state: each component's props signature, rendered from its
@@ -941,13 +991,13 @@ type PagePlan = z.infer<typeof PagePlanSchema>;
941
991
  *
942
992
  * The shapes are the method's own: codegen projects the `Catalog`,
943
993
  * `Component` and `Action` structures the bundle declares into
944
- * `src/generated/ui-designer/`, and the aliases below are those types. So a
994
+ * `src/generated/layout-design/`, and the aliases below are those types. So a
945
995
  * field renamed in the bundle fails the type check on the literals here
946
996
  * rather than a run, and the value goes over as the content of a structured
947
997
  * input, verbatim. The import is type-only: the generated zod schemas stay
948
998
  * out of the entry, which ships no validator for this value.
949
999
  */
950
- /** The `Catalog` structure of `data/generative/ui-designer.mthds`, as codegen projects it. */
1000
+ /** The `Catalog` structure of `methods/layout-design.mthds`, as codegen projects it. */
951
1001
  type DesignerCatalog = Catalog;
952
1002
  /** One component of the catalog: its name, its props signature, what it is for, what it accepts. */
953
1003
  type DesignerComponent = Component;
@@ -963,7 +1013,7 @@ declare function designerCatalog(): DesignerCatalog;
963
1013
  * which is the designer method's text and the catalog it was handed.
964
1014
  *
965
1015
  * The prompt is no longer one string this package renders: it is the method
966
- * (`data/generative/ui-designer.mthds`, every paragraph as prose) applied to
1016
+ * (`methods/layout-design.mthds`, every paragraph as prose) applied to
967
1017
  * the catalog as data (`designerCatalog()`). Both are what a run was actually
968
1018
  * given, so both are hashed - a reworded rule and a renamed prop each move
969
1019
  * the pin, exactly as they did when the prompt was rendered here. The model
@@ -983,8 +1033,43 @@ declare function designerCatalog(): DesignerCatalog;
983
1033
  * back to the kernel's own form - because the vocabulary it was written in is
984
1034
  * no longer the vocabulary this entry renders.
985
1035
  */
986
- declare const PROMPT_HASH = "15d195df65f3";
1036
+ declare const PROMPT_HASH = "2b2325fd1231";
987
1037
 
1038
+ /**
1039
+ * The brief: the model's view of the descriptor, as DATA.
1040
+ *
1041
+ * Rule 1, restated for a model. The model's input is the DESCRIPTOR, never JSON
1042
+ * Schema: it receives the kinds, the labels, the descriptions, the choices, the
1043
+ * presence and what gates the run - projected from `RunField[]` here, and from
1044
+ * nowhere else, into the `Brief` structure the designer method declares. On the
1045
+ * result side it also receives one real run's loaded state, so it can judge
1046
+ * magnitudes, but it never sees the wire: the state it reads is what
1047
+ * `payloadToState` produced, with the envelopes already gone.
1048
+ *
1049
+ * Nothing here is prose. The sentences a model reads - the headings, how a
1050
+ * path line is worded, what "delegated" says - are the method's own, in the
1051
+ * `render_brief` stage of `methods/layout-design.mthds`: a Jinja2 template
1052
+ * over this value, and the one place the brief's wording is edited. What this
1053
+ * module contributes is what only code can state: every path, flattened in
1054
+ * reading order with its depth, its kind in words, its constraints in words,
1055
+ * and which of them the kernel keeps. The shape is the method's own: codegen
1056
+ * projects its `Brief` and `PathEntry` structures into
1057
+ * `src/generated/layout-design/`, and the aliases below are those types,
1058
+ * imported type-only so the generated schemas stay out of the entry. A field
1059
+ * renamed in the bundle fails the type check on the literals here rather than
1060
+ * a run.
1061
+ *
1062
+ * Pure, no React, and the only place the descriptor is projected for a model.
1063
+ * What a path is marked as (delegated or not) is decided here too, so the
1064
+ * projection, the brief and the validator agree on which paths the kernel
1065
+ * renders.
1066
+ */
1067
+ /** The `Brief` structure of `methods/layout-design.mthds`, as codegen projects it. */
1068
+ type DesignerBrief = Brief;
1069
+ /** One path of the brief: where it is, what it holds, what constrains it, whether the kernel keeps it. */
1070
+ type DesignerPathEntry = PathEntry;
1071
+ /** The concept a run request names for the `brief` input: the method's own, domain-qualified. */
1072
+ declare const DESIGNER_BRIEF_CONCEPT = "generative.Brief";
988
1073
  interface BriefSubject {
989
1074
  /** `results.nested_result`. */
990
1075
  pipeRef: string;
@@ -1009,12 +1094,19 @@ interface BriefSubject {
1009
1094
  * input back to the kernel's own control instead.
1010
1095
  */
1011
1096
  declare function isDelegatedInput(field: RunField): boolean;
1012
- /** On the result side, the kinds and concepts the catalog cannot show. */
1097
+ /**
1098
+ * On the result side, the kinds and concepts the catalog cannot show.
1099
+ *
1100
+ * A native value is one of them, and so is a list of one: the native
1101
+ * predicates refuse a `list` node, because a list of dates is a list and not a
1102
+ * date, but no catalog component reads a date's `{date, time}` either, so the
1103
+ * kernel renders the list whole - one value per line, as the result view does.
1104
+ */
1013
1105
  declare function isDelegatedResult(field: RunField): boolean;
1014
1106
  /** The brief for an INPUT page: the form a run is started from. */
1015
- declare function renderInputBrief(subject: BriefSubject, fields: readonly RunField[]): string;
1107
+ declare function inputBrief(subject: BriefSubject, fields: readonly RunField[]): DesignerBrief;
1016
1108
  /** The brief for a RESULT page: what one run produced, laid out. */
1017
- declare function renderResultBrief(subject: BriefSubject, field: RunField, state: unknown): string;
1109
+ declare function resultBrief(subject: BriefSubject, field: RunField, state: unknown): DesignerBrief;
1018
1110
 
1019
1111
  /**
1020
1112
  * Whether a stored layout still fits the descriptor it will be rendered over.
@@ -1922,7 +2014,8 @@ declare function absoluteHatchPath(spec: Spec, key: string, path: string, parent
1922
2014
  * the ones a model would bind to anyway;
1923
2015
  * - the three native concepts the kind vocabulary cannot name (`native.Html`,
1924
2016
  * `native.Date`, `native.Composite`) pass through whole, for the escape
1925
- * hatch to render;
2017
+ * hatch to render - and a list of one is still a list, an array of whole
2018
+ * values, which is what the kernel renders when the brief delegates it;
1926
2019
  * - a scalar passes through.
1927
2020
  *
1928
2021
  * A top-level scalar's `contentKey` wrapper is NOT unwrapped: `ResultField`
@@ -1956,7 +2049,7 @@ declare function seedInputs(fields: readonly RunField[]): Record<string, unknown
1956
2049
  */
1957
2050
  /** How a spec came to be. */
1958
2051
  type Producer =
1959
- /** The designer method, `data/generative/ui-designer.mthds`, run on the hosted API. */
2052
+ /** The designer method, `methods/layout-design.mthds`, run on the hosted API. */
1960
2053
  'pipelex-method'
1961
2054
  /** A Claude Code subagent in a fresh context, given the method, the catalog data and the brief and nothing else. */
1962
2055
  | 'claude-code-subagent'
@@ -2010,4 +2103,4 @@ declare function fixtureLabel(fixture: Pick<SpecFixture, 'producer' | 'model' |
2010
2103
  /** The fixture a story asks for, or a loud failure: a story must never render a page it did not name. */
2011
2104
  declare function findFixture(fixtures: readonly SpecFixture[], pipeRef: string, id: string): SpecFixture;
2012
2105
 
2013
- export { type BrandManifest, BrandProvider, type BriefSubject, COMPONENT_NAMES, COMPONENT_RENDERINGS, CUSTOM_COMPONENTS, type ComponentRendering, type CriticLoop, DESIGNER_CATALOG_CONCEPT, DescriptorProvider, type DescriptorScope, type DesignerAction, type DesignerCatalog, type DesignerComponent, 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, brandManifestSchema, catalog, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, generativeRegistry, generativeRenderers, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutFits, layoutProblems, pathFromDomId, payloadToState, renderInputBrief, renderResultBrief, repeatBasePathOf, resultFieldAtPath, seedInputs, segmentsUnder, specFromJsonl, specToJsonl, useBrand, useDescriptorScope, useResultSlot, useStoreSnapshot, validateAgainstCatalog };
2106
+ export { type 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, brandManifestSchema, catalog, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, generativeRegistry, generativeRenderers, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutFits, layoutProblems, pathFromDomId, payloadToState, repeatBasePathOf, resultBrief, resultFieldAtPath, seedInputs, segmentsUnder, specFromJsonl, specToJsonl, useBrand, useDescriptorScope, useResultSlot, useStoreSnapshot, validateAgainstCatalog };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { cn, fieldControlClass, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-KG4IYFWI.js';
3
- import '../chunk-S4CB423P.js';
4
- import { isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode, readDateContent, formatDateContent } from '../chunk-AZZAAGNX.js';
5
- import '../chunk-25I6JDIK.js';
6
- import '../chunk-2JWRG53S.js';
2
+ import { cn, fieldControlClass, ResultField, FieldRenderer, ToggleGroup, ToggleGroupItem, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-G6BWZUGV.js';
3
+ import '../chunk-4JQAJT7C.js';
4
+ import { isNativeValueNode, readDateContent, formatDateContent, isNativeHtmlNode, isNativeDateNode, isNativeCompositeNode } from '../chunk-TID7ZN63.js';
5
+ import '../chunk-FABY3DEY.js';
6
+ import '../chunk-XCO6GTEC.js';
7
7
  import '../chunk-PM55AHRO.js';
8
8
  import '../chunk-GKV77RAS.js';
9
9
  import { hasOwnProp } from '../chunk-V3OV2XQT.js';
@@ -725,7 +725,7 @@ function designerCatalog() {
725
725
  }
726
726
 
727
727
  // src/generative/prompt-hash.ts
728
- var PROMPT_HASH = "15d195df65f3";
728
+ var PROMPT_HASH = "2b2325fd1231";
729
729
 
730
730
  // src/generative/paths.ts
731
731
  var INPUTS_ROOT = "/inputs";
@@ -813,14 +813,14 @@ function repeatListPathOf(spec, key, parents = parentMapOf(spec)) {
813
813
  }
814
814
 
815
815
  // src/generative/brief.ts
816
+ var DESIGNER_BRIEF_CONCEPT = "generative.Brief";
816
817
  var RUN_COMPONENT = "Cta";
817
818
  function isDelegatedInput(field) {
818
819
  return field.kind === "document" || field.kind === "image" || field.kind === "date" || field.kind === "list" || field.kind === "unknown" || field.kind === "enum" && field.options.includes("");
819
820
  }
820
821
  function isDelegatedResult(field) {
821
- if (isNativeHtmlNode(field) || isNativeDateNode(field) || isNativeCompositeNode(field)) {
822
- return true;
823
- }
822
+ if (isNativeValueNode(field)) return true;
823
+ if (field.kind === "list" && isNativeValueNode(field.item)) return true;
824
824
  return field.kind === "document" || field.kind === "image" || field.kind === "date" || field.kind === "prose" || field.kind === "unknown";
825
825
  }
826
826
  function kindLabel(field) {
@@ -854,9 +854,6 @@ function kindLabel(field) {
854
854
  return field;
855
855
  }
856
856
  }
857
- function labelOf(field) {
858
- return field.title && field.title !== field.name ? `${field.title} (\`${field.name}\`)` : `\`${field.name}\``;
859
- }
860
857
  function constraints(field) {
861
858
  const notes = [];
862
859
  if (field.kind === "number") {
@@ -883,174 +880,101 @@ function constraints(field) {
883
880
  }
884
881
  return notes;
885
882
  }
886
- function describe(field, path, depth, side, lines) {
887
- const delegated = side === "input" ? isDelegatedInput(field) : isDelegatedResult(field);
888
- const parts = [`\`${path}\` \u2014 ${kindLabel(field)}`];
889
- if (side === "input") {
890
- parts.push(field.required ? "required" : "optional");
891
- if (field.gating) parts.push("gates the run");
892
- }
893
- const head = parts.join(", ");
894
- const tail = [labelOf(field), field.description ?? ""].filter(Boolean).join(": ");
883
+ function entryOf(field, path, depth, side, relative, seeded) {
895
884
  const notes = constraints(field);
896
- const delegation = delegated ? ` **[delegate: ${side === "input" ? "MthdsField" : "MthdsResult"}]**` : "";
897
- lines.push({
885
+ return {
898
886
  depth,
899
- text: `${head} \u2014 ${tail}${notes.length > 0 ? ` (${notes.join("; ")})` : ""}${delegation}`
900
- });
901
- if (delegated) return;
887
+ path,
888
+ kind: kindLabel(field),
889
+ name: field.name,
890
+ title: field.title && field.title !== field.name ? field.title : void 0,
891
+ description: field.description,
892
+ required: side === "input" ? field.required : void 0,
893
+ gating: side === "input" && field.gating ? true : void 0,
894
+ notes: notes.length > 0 ? notes : void 0,
895
+ default: seeded || field.defaultValue === void 0 ? void 0 : JSON.stringify(field.defaultValue),
896
+ delegated: side === "input" ? isDelegatedInput(field) : isDelegatedResult(field),
897
+ relative: relative ? true : void 0
898
+ };
899
+ }
900
+ function describe(field, path, depth, side, entries, seeded = false) {
901
+ const entry = entryOf(field, path, depth, side, false, seeded);
902
+ entries.push(entry);
903
+ if (entry.delegated) return;
902
904
  if (field.kind === "object") {
905
+ const seededBelow = seeded || field.defaultValue !== void 0;
903
906
  for (const child of field.fields) {
904
- describe(child, joinPath(path, child.name), depth + 1, side, lines);
907
+ describe(child, joinPath(path, child.name), depth + 1, side, entries, seededBelow);
905
908
  }
906
909
  }
907
910
  if (field.kind === "list" && side === "result") {
908
911
  const item = field.item;
912
+ entry.item_kind = kindLabel(item);
913
+ entry.item_description = item.description;
909
914
  if (item.kind === "object" && !isDelegatedResult(item)) {
910
- lines.push({
911
- depth: depth + 1,
912
- text: `each item is a ${kindLabel(item)}${item.description ? ` (${item.description})` : ""}, with these members (paths relative to one item, for DataTable columns or $item):`
913
- });
915
+ entry.item_laid_out = true;
914
916
  for (const child of item.fields) {
915
- describeRelative(child, child.name, depth + 2, lines);
917
+ describeRelative(child, child.name, depth + 2, entries);
916
918
  }
917
- } else {
918
- lines.push({ depth: depth + 1, text: `each item is a ${kindLabel(item)}` });
919
919
  }
920
920
  }
921
921
  }
922
- function describeRelative(field, relativePath, depth, lines) {
923
- const notes = constraints(field);
924
- lines.push({
925
- depth,
926
- text: `\`${relativePath}\` \u2014 ${kindLabel(field)} \u2014 ${[labelOf(field), field.description ?? ""].filter(Boolean).join(": ")}${notes.length > 0 ? ` (${notes.join("; ")})` : ""}${isDelegatedResult(field) ? " (a DataTable prints it as text; delegate the whole list to MthdsResult to render it properly)" : ""}`
927
- });
922
+ function describeRelative(field, relativePath, depth, entries) {
923
+ const entry = entryOf(field, relativePath, depth, "result", true, false);
924
+ entries.push(entry);
925
+ if (entry.delegated) return;
928
926
  if (field.kind === "object") {
929
- for (const child of field.fields)
930
- describeRelative(child, joinPath(relativePath, child.name), depth + 1, lines);
931
- }
932
- if (field.kind === "list" && field.item.kind === "object") {
933
- lines.push({ depth: depth + 1, text: `each item is a ${kindLabel(field.item)}, with:` });
934
- for (const child of field.item.fields) {
935
- describeRelative(child, joinPath(relativePath, "<i>", child.name), depth + 2, lines);
927
+ for (const child of field.fields) {
928
+ describeRelative(child, joinPath(relativePath, child.name), depth + 1, entries);
936
929
  }
937
930
  }
938
- }
939
- function render(lines) {
940
- return lines.map((line) => `${" ".repeat(line.depth)}- ${line.text}`).join("\n");
941
- }
942
- function collectDelegated(fields, root, side) {
943
- const out = [];
944
- const walk = (field, path) => {
945
- const delegated = side === "input" ? isDelegatedInput(field) : isDelegatedResult(field);
946
- if (delegated) {
947
- out.push(`\`${path}\` (${kindLabel(field)})`);
948
- return;
949
- }
950
- if (field.kind === "object") {
951
- for (const child of field.fields) walk(child, joinPath(path, child.name));
931
+ if (field.kind === "list") {
932
+ const item = field.item;
933
+ entry.item_kind = kindLabel(item);
934
+ entry.item_description = item.description;
935
+ if (item.kind === "object" && !isDelegatedResult(item)) {
936
+ entry.item_laid_out = true;
937
+ for (const child of item.fields) {
938
+ describeRelative(child, joinPath(relativePath, "<i>", child.name), depth + 2, entries);
939
+ }
952
940
  }
953
- };
954
- for (const field of fields) walk(field, joinPath(root, field.name));
955
- return out;
941
+ }
956
942
  }
957
- function collectDefaults(fields, root) {
958
- const out = [];
959
- const walk = (field, path) => {
960
- if (field.defaultValue !== void 0) {
961
- out.push(`\`${path}\` = ${JSON.stringify(field.defaultValue)}`);
962
- return;
963
- }
964
- if (field.kind === "object") {
965
- for (const child of field.fields) walk(child, joinPath(path, child.name));
966
- }
943
+ function inputBrief(subject, fields) {
944
+ const paths = [];
945
+ for (const field of fields) describe(field, joinPath(INPUTS_ROOT, field.name), 0, "input", paths);
946
+ return {
947
+ side: "input",
948
+ pipe_ref: subject.pipeRef,
949
+ description: subject.description,
950
+ name: subject.name,
951
+ paths,
952
+ run_control: RUN_COMPONENT
967
953
  };
968
- for (const field of fields) walk(field, joinPath(root, field.name));
969
- return out;
970
954
  }
971
- function renderInputBrief(subject, fields) {
972
- const lines = [];
973
- for (const field of fields) describe(field, joinPath(INPUTS_ROOT, field.name), 0, "input", lines);
974
- const delegated = collectDelegated(fields, INPUTS_ROOT, "input");
975
- const defaults = collectDefaults(fields, INPUTS_ROOT);
976
- const gating = fields.filter((field) => field.gating).map((field) => `\`${field.name}\``);
977
- return [
978
- `# Input page: ${subject.pipeRef}`,
979
- "",
980
- subject.description ?? "A method with the inputs below.",
981
- "",
982
- ...subject.name ? [
983
- "## Name",
984
- "",
985
- `The method is called \xAB${subject.name}\xBB, as the host lists it. That is the app's name wherever the layout asks for one; invent no other. Links, if the layout carries any, name this page's own sections. The page states nothing the method does not: no promise about storage, privacy, speed, or what happens after the run.`,
986
- ""
987
- ] : [],
988
- "## State",
989
- "",
990
- `The form's values live under \`${INPUTS_ROOT}\`, one member per input, exactly as listed. Bind each input with \`$bindState\` at its path; a structure's members bind at their own paths beneath it.`,
991
- "",
992
- render(lines),
993
- "",
994
- "## Delegated",
995
- "",
996
- delegated.length > 0 ? `Render these with \`MthdsField\` at the path, and nothing else:
997
-
998
- ${delegated.map((entry) => `- ${entry}`).join("\n")}` : "None: every input can be entered with the catalog's own inputs. `MthdsField` remains available for any you would rather not style.",
999
- "",
1000
- "## Defaults",
1001
- "",
1002
- defaults.length > 0 ? `Seed these, and only these, with \`/state\` patches (\`{"op":"add","path":"/state/inputs/...","value":...}\`):
1003
-
1004
- ${defaults.map((entry) => `- ${entry}`).join("\n")}` : "None. Emit no `/state` patches.",
1005
- "",
1006
- "## Run",
1007
- "",
1008
- gating.length > 0 ? `The run waits for ${gating.join(", ")}; say so near the ${RUN_COMPONENT}, briefly.` : "Nothing gates the run.",
1009
- `The page has exactly one \`${RUN_COMPONENT}\`, \`on.press\` bound to \`validateForm\` then \`run\`; label it with what the method does, in a person's words.`,
1010
- ""
1011
- ].join("\n");
1012
- }
1013
- function renderResultBrief(subject, field, state) {
1014
- const lines = [];
1015
- const delegatedWhole = isDelegatedResult(field);
1016
- if (field.kind === "object" && !delegatedWhole) {
1017
- lines.push({
955
+ function resultBrief(subject, field, state) {
956
+ const paths = [];
957
+ if (field.kind === "object" && !isDelegatedResult(field)) {
958
+ paths.push({
1018
959
  depth: 0,
1019
- text: `\`${RESULT_ROOT}\` \u2014 ${kindLabel(field)}${field.description ? `: ${field.description}` : ""}`
960
+ path: RESULT_ROOT,
961
+ kind: kindLabel(field),
962
+ description: field.description,
963
+ delegated: false
1020
964
  });
1021
965
  for (const child of field.fields) {
1022
- describe(child, joinPath(RESULT_ROOT, child.name), 1, "result", lines);
966
+ describe(child, joinPath(RESULT_ROOT, child.name), 1, "result", paths);
1023
967
  }
1024
968
  } else {
1025
- describe(field, RESULT_ROOT, 0, "result", lines);
969
+ describe(field, RESULT_ROOT, 0, "result", paths);
1026
970
  }
1027
- const delegated = field.kind === "object" && !delegatedWhole ? collectDelegated(field.fields, RESULT_ROOT, "result") : delegatedWhole ? [`\`${RESULT_ROOT}\` (${kindLabel(field)})`] : [];
1028
- return [
1029
- `# Result page: ${subject.pipeRef}`,
1030
- "",
1031
- subject.description ?? "The result of a method, described below.",
1032
- "",
1033
- "## State",
1034
- "",
1035
- `The host loads the run's result under \`${RESULT_ROOT}\` before the page renders. Read every value with \`$state\`; emit no \`/state\` patches. Paths:`,
1036
- "",
1037
- render(lines),
1038
- "",
1039
- "## Delegated",
1040
- "",
1041
- delegated.length > 0 ? `Render these with \`MthdsResult\` at the path - they are kinds the catalog cannot show properly:
1042
-
1043
- ${delegated.map((entry) => `- ${entry}`).join("\n")}` : "None. `MthdsResult` remains available for any structure you choose not to lay out.",
1044
- "",
1045
- "## One real run, as loaded",
1046
- "",
1047
- "The state of one actual run, so you can judge magnitudes and lengths. Bind to the paths; do not copy these values into the spec.",
1048
- "",
1049
- "```json",
1050
- JSON.stringify(state, null, 2),
1051
- "```",
1052
- ""
1053
- ].join("\n");
971
+ return {
972
+ side: "result",
973
+ pipe_ref: subject.pipeRef,
974
+ description: subject.description,
975
+ paths,
976
+ sample_state: JSON.stringify(state, null, 2)
977
+ };
1054
978
  }
1055
979
  var EXPRESSION_KEYS = [
1056
980
  "$state",
@@ -3082,9 +3006,7 @@ function isRecord(value) {
3082
3006
  }
3083
3007
  function payloadToState(field, payload) {
3084
3008
  if (payload === void 0 || payload === null) return payload;
3085
- if (isNativeHtmlNode(field) || isNativeDateNode(field) || isNativeCompositeNode(field)) {
3086
- return payload;
3087
- }
3009
+ if (isNativeValueNode(field)) return payload;
3088
3010
  switch (field.kind) {
3089
3011
  case "date": {
3090
3012
  const content = readDateContent(payload);
@@ -3166,6 +3088,6 @@ function findFixture(fixtures, pipeRef, id) {
3166
3088
  return found;
3167
3089
  }
3168
3090
 
3169
- export { BrandProvider, COMPONENT_NAMES, COMPONENT_RENDERINGS, CUSTOM_COMPONENTS, DESIGNER_CATALOG_CONCEPT, DescriptorProvider, GenerativePage, ICON_NAMES, INPUTS_ROOT, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, RESULT_ROOT, ResultSlotProvider, absoluteHatchPath, brandManifestSchema, catalog, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, generativeRegistry, generativeRenderers, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutFits, layoutProblems, pathFromDomId, payloadToState, renderInputBrief, renderResultBrief, repeatBasePathOf, resultFieldAtPath, seedInputs, segmentsUnder, specFromJsonl, specToJsonl, useBrand, useDescriptorScope, useResultSlot, useStoreSnapshot, validateAgainstCatalog };
3091
+ export { BrandProvider, COMPONENT_NAMES, COMPONENT_RENDERINGS, CUSTOM_COMPONENTS, DESIGNER_BRIEF_CONCEPT, DESIGNER_CATALOG_CONCEPT, DescriptorProvider, GenerativePage, ICON_NAMES, INPUTS_ROOT, METRIC_FORMATS, PICKED_SHADCN, PRODUCT_COMPONENTS, PROMPT_HASH, RESULT_ROOT, ResultSlotProvider, absoluteHatchPath, brandManifestSchema, catalog, designerCatalog, fieldAtSegments, findFixture, fixtureId, fixtureLabel, formatProblems, generativeRegistry, generativeRenderers, inputBrief, inputFieldAtPath, isDelegatedInput, isDelegatedResult, joinPath, jsonlLines, layoutFits, layoutProblems, pathFromDomId, payloadToState, repeatBasePathOf, resultBrief, resultFieldAtPath, seedInputs, segmentsUnder, specFromJsonl, specToJsonl, useBrand, useDescriptorScope, useResultSlot, useStoreSnapshot, validateAgainstCatalog };
3170
3092
  //# sourceMappingURL=index.js.map
3171
3093
  //# sourceMappingURL=index.js.map