@pipelex/mthds-ui 0.50.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -312,6 +312,7 @@ See `graphConfig.ts` for the full default palette.
312
312
  | `@pipelex/mthds-ui/form/generative` | The kernel's generative layer: a designed page over its controls |
313
313
  | `@pipelex/mthds-ui/form/generative/headless` | The same layer's producer and checks, for a server: no React |
314
314
  | `@pipelex/mthds-ui/form/layout-design.mthds` | The designer method that produces such a page, as a file |
315
+ | `@pipelex/mthds-ui/form/layout-sample.mthds` | Its entry for a result page with no run to read, as a file |
315
316
  | `@pipelex/mthds-ui/form/react` | `RunPanel` — a pipe's input form — and the kernel's controls |
316
317
  | `@pipelex/mthds-ui/timeline` | A run's progress snapshot: types, path grammar, rows and time axis |
317
318
  | `@pipelex/mthds-ui/timeline/react` | `RunTimeline` — a run's progress as growing bars or a checklist |
@@ -405,7 +406,7 @@ The same entry carries the app styles a team picks from (`quiet`, `soft`, `edito
405
406
 
406
407
  Full contract, why this package stopped loading the kernel's stylesheet itself, the `.dark` bridge, the `mthds-run-panel` token hook and the brand tokens: [docs/run-form-panel.md](./docs/run-form-panel.md).
407
408
 
408
- To show a method's form or its result as a designed page, `@pipelex/mthds-ui/form/generative` carries the kernel's generative layer: `GenerativePage` renders a layout a model wrote once for the method over the same controls, after the checks that decide whether the layout can be trusted, and the kernel's plain form renders whenever it cannot. The method that designs such a page ships beside it as `@pipelex/mthds-ui/form/layout-design.mthds`, a file a producer reads and hands to a runner with the catalog and the brief the entry builds. The entry is a client module, so a server component or a server action builds those inputs and checks a stored layout through `@pipelex/mthds-ui/form/generative/headless`, the same functions with no React and no `"use client"`. Which entry to import where, and what keeps the file the kernel's own: [docs/generative-layout.md](./docs/generative-layout.md).
409
+ To show a method's form or its result as a designed page, `@pipelex/mthds-ui/form/generative` carries the kernel's generative layer: `GenerativePage` renders a layout a model wrote once for the method over the same controls, after the checks that decide whether the layout can be trusted, and the kernel's plain form renders whenever it cannot. The method that designs such a page ships beside it as `@pipelex/mthds-ui/form/layout-design.mthds`, a file a producer reads and hands to a runner with the catalog and the brief the entry builds, and `@pipelex/mthds-ui/form/layout-sample.mthds` is that method's entry for a result page with no run to read, sent with it. The entry is a client module, so a server component or a server action builds those inputs and checks a stored layout through `@pipelex/mthds-ui/form/generative/headless`, the same functions with no React and no `"use client"`. Which entry to import where, and what keeps the files the kernel's own: [docs/generative-layout.md](./docs/generative-layout.md).
409
410
 
410
411
  ## Run timeline
411
412
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/form/generative/headless/index.ts"],"sourcesContent":["/**\n * The `./form/generative/headless` entry — the form kernel's\n * `./generative/headless` entry, re-exported.\n *\n * A host that produces a designed page, or checks a stored one, on its server\n * reaches the half of the generative layer that renders nothing here: the\n * designer's catalog as data and the frames' vocabularies (`designerCatalog`,\n * `frameCatalog`), the brief projected from the descriptor (`inputBrief`,\n * `resultBrief`), the concepts the designer's inputs travel under, the prompt\n * pin (`PROMPT_HASH`), `seedLine`, the JSONL compiler (`specFromJsonl`,\n * `specToJsonl`) and the checks (`validateAgainstCatalog`, `layoutFits`,\n * `layoutProblems`, `layoutCheckProblems`, `REPAIR_ATTEMPTS`).\n *\n * It is its own entry, with no `\"use client\"` directive, because the kernel\n * keeps it apart from its `./generative` entry for exactly that reason. In a\n * host running React Server Components, every export of `./form/generative`,\n * its plain functions included, reaches the server as a client reference that\n * throws when called, so a server component or a server action that builds a\n * brief or checks a layout imports these from here instead. It has no React,\n * so it also runs in a script or a worker with nothing else installed. Nothing\n * a client imports moves: `./form/generative` still carries all of it beside\n * the page that renders a layout.\n *\n * Re-exported wholesale, it follows the kernel from release to release with\n * nothing to edit here. The rule `./form` states holds here too: a host imports\n * the kernel through this package, never directly, so its tree holds one copy\n * of it.\n *\n * Which half a host imports where, and what each check refuses, are described\n * in `docs/generative-layout.md`.\n */\n\nexport * from \"@pipelex/mthds-form/generative/headless\";\n"],"mappings":";AAgCA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/form/generative/headless/index.ts"],"sourcesContent":["/**\n * The `./form/generative/headless` entry — the form kernel's\n * `./generative/headless` entry, re-exported.\n *\n * A host that produces a designed page, or checks a stored one, on its server\n * reaches the half of the generative layer that renders nothing here: the\n * designer's catalog as data and the frames' vocabularies (`designerCatalog`,\n * `frameCatalog`), the brief projected from the descriptor (`inputBrief`,\n * `resultBrief`), the concepts the designer's inputs travel under, the prompt\n * pin (`PROMPT_HASH`), `seedLine`, the JSONL compiler (`specFromJsonl`,\n * `specToJsonl`), the checks (`validateAgainstCatalog`, `layoutFits`,\n * `layoutProblems`, `layoutCheckProblems`, `REPAIR_ATTEMPTS`) and the check on\n * a sample the designer wrote for itself (`writtenSampleOf`).\n *\n * It is its own entry, with no `\"use client\"` directive, because the kernel\n * keeps it apart from its `./generative` entry for exactly that reason. In a\n * host running React Server Components, every export of `./form/generative`,\n * its plain functions included, reaches the server as a client reference that\n * throws when called, so a server component or a server action that builds a\n * brief or checks a layout imports these from here instead. It has no React,\n * so it also runs in a script or a worker with nothing else installed. Nothing\n * a client imports moves: `./form/generative` still carries all of it beside\n * the page that renders a layout.\n *\n * Re-exported wholesale, it follows the kernel from release to release with\n * nothing to edit here. The rule `./form` states holds here too: a host imports\n * the kernel through this package, never directly, so its tree holds one copy\n * of it.\n *\n * Which half a host imports where, and what each check refuses, are described\n * in `docs/generative-layout.md`.\n */\n\nexport * from \"@pipelex/mthds-form/generative/headless\";\n"],"mappings":";AAiCA,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/form/generative/index.ts"],"sourcesContent":["\"use client\";\n\n/**\n * The `./form/generative` entry — the form kernel's `./generative` entry,\n * re-exported.\n *\n * A host that shows a method's form or its result as a designed page reaches\n * the kernel's generative layer here: `GenerativePage` renders a stored layout\n * over the kernel's own controls, `specFromJsonl` compiles the JSONL a layout\n * is stored as, and `validateAgainstCatalog`, `layoutFits` and `PROMPT_HASH`\n * are the three checks a host runs before it renders one, falling back to the\n * kernel's plain form when any fails. The same entry carries what a producer\n * hands the designer method: the catalog as data (`designerCatalog`), the brief\n * projected from the descriptor (`inputBrief`, `resultBrief`) and the concepts\n * each travels under. The method itself is a file rather than code, shipped\n * beside this entry as `@pipelex/mthds-ui/form/layout-design.mthds`.\n *\n * It is its own entry rather than part of `./form/react` because the kernel\n * keeps it apart from its `./react` entry: it brings json-render and zod, which\n * a host rendering only the plain form never loads. It renders, so it is a\n * client module, as the kernel's entry is. Re-exported wholesale, it follows\n * the kernel from release to release with nothing to edit here.\n *\n * The rule `./form` states holds here too: a host imports the kernel through\n * this package, never directly, so its tree holds one copy of it — and with it\n * one copy of the React contexts a produced page and the plain form share.\n *\n * What the entry carries, the method file and why it is a copy are described\n * in `docs/generative-layout.md`.\n */\n\nexport * from \"@pipelex/mthds-form/generative\";\n"],"mappings":";;;AA+BA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/form/generative/index.ts"],"sourcesContent":["\"use client\";\n\n/**\n * The `./form/generative` entry — the form kernel's `./generative` entry,\n * re-exported.\n *\n * A host that shows a method's form or its result as a designed page reaches\n * the kernel's generative layer here: `GenerativePage` renders a stored layout\n * over the kernel's own controls, `specFromJsonl` compiles the JSONL a layout\n * is stored as, and `validateAgainstCatalog`, `layoutFits` and `PROMPT_HASH`\n * are the three checks a host runs before it renders one, falling back to the\n * kernel's plain form when any fails. The same entry carries what a producer\n * hands the designer method: the catalog as data (`designerCatalog`), the brief\n * projected from the descriptor (`inputBrief`, `resultBrief`) and the concepts\n * each travels under. The method itself is a file rather than code, shipped\n * beside this entry as `@pipelex/mthds-ui/form/layout-design.mthds`, with\n * `@pipelex/mthds-ui/form/layout-sample.mthds`, its entry for a result page\n * with no run to read.\n *\n * It is its own entry rather than part of `./form/react` because the kernel\n * keeps it apart from its `./react` entry: it brings json-render and zod, which\n * a host rendering only the plain form never loads. It renders, so it is a\n * client module, as the kernel's entry is. Re-exported wholesale, it follows\n * the kernel from release to release with nothing to edit here.\n *\n * The rule `./form` states holds here too: a host imports the kernel through\n * this package, never directly, so its tree holds one copy of it — and with it\n * one copy of the React contexts a produced page and the plain form share.\n *\n * What the entry carries, the method file and why it is a copy are described\n * in `docs/generative-layout.md`.\n */\n\nexport * from \"@pipelex/mthds-form/generative\";\n"],"mappings":";;;AAiCA,cAAc;","names":[]}
@@ -0,0 +1,85 @@
1
+ domain = "layout_sample"
2
+ description = "Designs a result page when no run exists: writes an invented sample of the result, then hands the designer the brief with that sample in it."
3
+ main_pipe = "design_from_written_sample"
4
+
5
+ # The designer's second entry, kept in a file of its own. A layout records the
6
+ # hash of `layout-design.mthds`, whose text is hashed whole, so any edit to that
7
+ # file stales every stored layout. Writing the sample here leaves that file and
8
+ # its hash exactly as they were, and keeps one run per design: a host sends both
9
+ # files, starts this entry, and reads the page from the run as it reads any other
10
+ # design.
11
+ #
12
+ # The sample is INVENTED. It holds no customer data, which is why a host may
13
+ # store it beside a layout, where a real run's output may never go, and why it
14
+ # leaves out files and images, since a made-up link would draw nothing. A host
15
+ # checks it with `writtenSampleOf`, reading it out of the run's working memory
16
+ # under `written_sample`; a sample with problems never blocks a layout.
17
+ #
18
+ # Every stage past the sample is the designer's own, by reference: this bundle
19
+ # states nothing about how a page is designed, and a change to how a page is
20
+ # designed is made in `layout-design.mthds`.
21
+
22
+ [pipe.design_from_written_sample]
23
+ type = "PipeSequence"
24
+ description = "Design one result page with no run to read: write a sample of the result, put it in the brief, then lay the brief out, plan the page and build it."
25
+ inputs = { catalog = "generative.Catalog", brief = "generative.Brief", seed = "Text?" }
26
+ output = "Text"
27
+ steps = [
28
+ { pipe = "write_sample", result = "written_sample" },
29
+ { pipe = "brief_with_sample", result = "brief" },
30
+ { pipe = "generative.render_brief", result = "brief_text" },
31
+ { pipe = "generative.plan_page", result = "plan" },
32
+ { pipe = "generative.emit_page", result = "page" },
33
+ ]
34
+
35
+ [pipe.write_sample]
36
+ type = "PipeLLM"
37
+ description = "Invent one plausible state of the result, as JSON, from the brief's paths and description."
38
+ inputs = { brief = "generative.Brief" }
39
+ output = "Text"
40
+ model = { model = "gpt-6.1-sol", temperature = 0.5, max_tokens = 8192 }
41
+ system_prompt = """
42
+ You write realistic sample data. You are given the description of what a method returns, and you write one invented example of it, as JSON, so a designer can see how long its texts run and how large its figures are before anyone has run the method.
43
+ """
44
+ prompt = """
45
+ WHAT THE METHOD DOES:
46
+ {% if brief.description %}{{ brief.description }}{% else %}Nothing is said about it beyond the paths below; read its purpose off them.{% endif %}
47
+
48
+ WHAT ONE RUN RETURNS, AS PATHS:
49
+ {% for entry in brief.paths -%}
50
+ {{ " " * entry.depth }}- `{{ entry.path }}` - {{ entry.kind }}{% if entry.title %} - {{ entry.title }}{% endif %}{% if entry.description %}: {{ entry.description }}{% endif %}{% if entry.notes %} ({{ entry.notes | join("; ") }}){% endif %}{% if entry.delegated %} [LEAVE OUT]{% endif +%}
51
+ {% if entry.item_kind %}
52
+ {{ " " * (entry.depth + 1) }}- each item is a {{ entry.item_kind }}{% if entry.item_description %} ({{ entry.item_description }}){% endif %}{% if entry.item_laid_out %}, with these members, named relative to one item:{% endif +%}
53
+ {% endif %}
54
+ {% endfor %}
55
+
56
+ HOW TO WRITE IT:
57
+ 1. Write the value of `/result`, and nothing around it. Where the first path is a structure, write one JSON object whose keys are its members; where it is a list, write a JSON array; where it is a single value, write that value.
58
+ 2. A member of a structure is a key of that structure's object, and a path spelled relative to one item of a list is a key of each of that list's items. A key is the last part of a path. Write no key the paths do not list.
59
+ 3. Fill every path unless it says LEAVE OUT.
60
+ 4. Leave out every path marked LEAVE OUT, and every path that holds a file or an image, as a document or an image is, and every list of them. Leave the key out altogether: no null, no empty value, no placeholder and no link.
61
+ 5. Give a value the kind its path states: a text as a JSON string, a number or an integer as a JSON number, a boolean as true or false, a date as "YYYY-MM-DD", and a choice as exactly one of the words it lists, spelled exactly. Respect every minimum, maximum and length that is stated.
62
+ 6. Write two to four items for a list, unless its stated bounds ask for something else.
63
+ 7. Make it read like one real outcome of this method: the texts as long as a real one would be, the figures of a realistic size that agree with each other, a total that is the sum of its parts.
64
+ 8. Invent everything. Name no real person, company, brand, product, place or address: make up plausible ones.
65
+
66
+ Output only the JSON value: no prose before or after it, no code fence.
67
+ """
68
+
69
+ [pipe.brief_with_sample]
70
+ type = "PipeCompose"
71
+ description = "Build the brief again as it was given, with the written sample as the state the designer reads."
72
+ inputs = { brief = "generative.Brief", written_sample = "Text" }
73
+ output = "generative.Brief"
74
+
75
+ [pipe.brief_with_sample.construct]
76
+ side = { from = "brief.side" }
77
+ pipe_ref = { from = "brief.pipe_ref" }
78
+ description = { from = "brief.description" }
79
+ name = { from = "brief.name" }
80
+ paths = { from = "brief.paths" }
81
+ run_control = { from = "brief.run_control" }
82
+ returns = { from = "brief.returns" }
83
+ frame = { from = "brief.frame" }
84
+ style = { from = "brief.style" }
85
+ sample_state = { from = "written_sample" }