@pipelex/mthds-ui 0.47.0 → 0.49.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 +5 -2
- package/dist/form/brand/index.js.map +1 -1
- package/dist/form/generative/headless/index.d.ts +1 -0
- package/dist/form/generative/headless/index.js +3 -0
- package/dist/form/generative/headless/index.js.map +1 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/form/layout-design.mthds +133 -6
- package/dist/form/react/index.d.ts +10 -36
- package/dist/form/react/index.js +2 -2
- package/dist/form/react/index.js.map +1 -1
- package/dist/standalone/graph-standalone.html +113 -113
- package/dist/standalone/graph-viewer.css +1 -1
- package/dist/standalone/graph-viewer.js +112 -112
- package/dist/timeline/react/index.js +8 -8
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -308,8 +308,9 @@ See `graphConfig.ts` for the full default palette.
|
|
|
308
308
|
| `@pipelex/mthds-ui` | Pure-TS graph logic — types, builders, layout, controllers, config |
|
|
309
309
|
| `@pipelex/mthds-ui/graph/react` | React components — `GraphViewer`, label helpers, type converters |
|
|
310
310
|
| `@pipelex/mthds-ui/form` | The form kernel's React-free surface, re-exported |
|
|
311
|
-
| `@pipelex/mthds-ui/form/brand` | The kernel's brand entry: seed colours
|
|
311
|
+
| `@pipelex/mthds-ui/form/brand` | The kernel's brand entry: seed colours and app styles into roles |
|
|
312
312
|
| `@pipelex/mthds-ui/form/generative` | The kernel's generative layer: a designed page over its controls |
|
|
313
|
+
| `@pipelex/mthds-ui/form/generative/headless` | The same layer's producer and checks, for a server: no React |
|
|
313
314
|
| `@pipelex/mthds-ui/form/layout-design.mthds` | The designer method that produces such a page, as a file |
|
|
314
315
|
| `@pipelex/mthds-ui/form/react` | `RunPanel` — a pipe's input form — and the kernel's controls |
|
|
315
316
|
| `@pipelex/mthds-ui/timeline` | A run's progress snapshot: types, path grammar, rows and time axis |
|
|
@@ -400,9 +401,11 @@ Either way, the shadcn token values are yours to supply, and each must be a **co
|
|
|
400
401
|
|
|
401
402
|
To brand the controls with a team's own colours, `@pipelex/mthds-ui/form/brand` derives colour roles from up to three colours a person picked, every text colour readable on the theme's page: a host writes `action` onto `--primary`, `accentInk` onto the optional `--link` (the accent as text) and onto `--ring` (every focus the controls draw), and `accentFill` onto the optional `--selected` (the pale fill of a selected pill, tag or step). A role the team left unset comes back absent, so the host writes no token for it and keeps its own, and a page that defines neither `--link` nor `--selected` falls back to `--primary` for both.
|
|
402
403
|
|
|
404
|
+
The same entry carries the app styles a team picks from (`quiet`, `soft`, `editorial`, `bold`) and a closed list of typefaces: `deriveStyleRoles(style, typeface)` returns the faces, heading weight and tracking, radius, panel and call-to-action treatment the choice sets, as roles a host writes onto the tokens the controls read: the body face onto `--font-sans` and the radius onto `--radius`, which the controls already read, and the rest onto optional tokens (`--font-heading`, `--heading-weight`, `--heading-tracking`, and a designed page's `--panel-*` and `--action-shadow`), each falling back to what the control painted before. `quiet` with no typeface sets nothing.
|
|
405
|
+
|
|
403
406
|
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).
|
|
404
407
|
|
|
405
|
-
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.
|
|
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).
|
|
406
409
|
|
|
407
410
|
## Run timeline
|
|
408
411
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/brand/index.ts"],"sourcesContent":["/**\n * The `./form/brand` entry — the form kernel's `./brand` entry, re-exported.\n *\n * A host that brands its pages reaches the kernel's colour derivation here:\n * `deriveBrandRoles` turns up to three seed colours a person picked into the\n * roles a page paints with, every text role readable at WCAG AA, and returns\n * only the roles a set colour produces, so a host keeps its own token wherever\n * the team set nothing. `resolveDarkSeeds`, `isActionFaint`, `isAccentAdjusted`\n * and `readableTextOn` are the rules around it. The same entry carries the rest
|
|
1
|
+
{"version":3,"sources":["../../../src/form/brand/index.ts"],"sourcesContent":["/**\n * The `./form/brand` entry — the form kernel's `./brand` entry, re-exported.\n *\n * A host that brands its pages reaches the kernel's colour derivation here:\n * `deriveBrandRoles` turns up to three seed colours a person picked into the\n * roles a page paints with, every text role readable at WCAG AA, and returns\n * only the roles a set colour produces, so a host keeps its own token wherever\n * the team set nothing. `resolveDarkSeeds`, `isActionFaint`, `isAccentAdjusted`\n * and `readableTextOn` are the rules around it. A team's app style and\n * typeface come through it too: `deriveStyleRoles` turns the two ids a host\n * stored into the faces, heading weight and tracking, radius, panel and\n * call-to-action treatment the choice sets, as roles rather than custom\n * property names, beside `APP_STYLES`, `TYPEFACES`, `isAppStyle`, `isTypeface`\n * and `resolveRoleColor`. The same entry carries the rest of the kernel's\n * brand surface: the theme contract, the token file's validator, and the\n * manifest, provenance and compiler a full brand goes through.\n *\n * It is its own entry rather than part of `./form` because the kernel keeps it\n * apart from its `.` entry, and for the same reason: it is isomorphic and\n * network-free, with no React and no DOM, so a settings screen, a server action\n * and a build script all import it. Re-exported wholesale, it follows the\n * 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.\n *\n * Mapping the roles onto the tokens the kernel's controls read — `--primary`,\n * `--primary-foreground`, `--link`, `--selected` and `--ring` for the colours,\n * `--font-heading`, `--heading-weight`, `--heading-tracking`, `--panel-*` and\n * `--action-shadow` for a style — is described in `docs/run-form-panel.md`.\n */\n\nexport * from \"@pipelex/mthds-form/brand\";\n"],"mappings":";AAgCA,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@pipelex/mthds-form/generative/headless';
|
|
@@ -0,0 +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":[]}
|
package/dist/form/index.d.ts
CHANGED
|
@@ -29,6 +29,14 @@ main_pipe = "design_layout"
|
|
|
29
29
|
# - `emit_page` builds exactly that page: it is handed the plan, the catalog
|
|
30
30
|
# with every props signature, and the brief, and emits the JSONL patches.
|
|
31
31
|
#
|
|
32
|
+
# A second entry, `repair_layout`, takes a page the host's own checks refused
|
|
33
|
+
# - the JSONL as emitted and the problems in words - lays the brief out the same
|
|
34
|
+
# way and has `emit_repair` emit the whole page again with those problems
|
|
35
|
+
# fixed. The checks are the package's TypeScript (`validateAgainstCatalog`
|
|
36
|
+
# and `layoutProblems`), so the loop is the caller's: run `design_layout`,
|
|
37
|
+
# check, and on a refusal run `repair_layout` with what the checks said, a
|
|
38
|
+
# bounded number of times.
|
|
39
|
+
#
|
|
32
40
|
# The split is the point. A single completion asked for a whole page decides
|
|
33
41
|
# the page and writes every patch in the same breath, and nothing in between
|
|
34
42
|
# can be read; the plan can. The seed reaches the planner only, because the
|
|
@@ -75,7 +83,9 @@ main_pipe = "design_layout"
|
|
|
75
83
|
# text, and fails loudly on any issue, so a repair is a change HERE, never to
|
|
76
84
|
# the fixture.
|
|
77
85
|
#
|
|
78
|
-
#
|
|
86
|
+
# Every model stage pins the same model: gpt-6.1-sol since the designer-reach
|
|
87
|
+
# spike, where a blind critic scored it level with claude-5.5-opus at about a
|
|
88
|
+
# third of the cost per page, with every layout valid. The specs pass takes MODEL=<id> to
|
|
79
89
|
# override every pin at once for a comparative run (and TEMPERATURE=<n> for a
|
|
80
90
|
# model that fixes its own), and records which model produced each fixture.
|
|
81
91
|
#
|
|
@@ -120,8 +130,18 @@ description = { type = "text", description = "One sentence on what the page is
|
|
|
120
130
|
name = { type = "text", description = "On an input page, the method's name as the host lists it - the one product name the page may carry. Absent when the host lists none." }
|
|
121
131
|
paths = { type = "list", item_type = "concept", item_concept_ref = "PathEntry", description = "Every path in the state the page binds or reads, in reading order and flattened: a structure's members follow it one level deeper, and a list's item members follow the list, spelled relative to one item.", required = true }
|
|
122
132
|
run_control = { type = "text", description = "On an input page, the catalog component that runs the method, by name; the page has exactly one of it." }
|
|
133
|
+
returns = { type = "list", item_type = "text", description = "On a composer, what one run gives back, one line per member of the result, read from the result's own titles and descriptions. Absent elsewhere." }
|
|
134
|
+
frame = { choices = ["page", "composer", "result"], description = "Where the page sits: `page`, a whole product page of its own; `composer`, the inputs of a host's compose-then-result app, before a run; `result`, the result page of that app, after one. Absent reads as `page`." }
|
|
135
|
+
style = { type = "concept", concept_ref = "Style", description = "The app style the team chose, which the page will wear: its name and its direction. Absent when the team chose none." }
|
|
123
136
|
sample_state = { type = "text", description = "On a result page, the state of one real run as the host loads it, as JSON - what `/result` held after one actual run, so magnitudes and lengths can be judged. Never copied into a page." }
|
|
124
137
|
|
|
138
|
+
[concept.Style]
|
|
139
|
+
description = "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."
|
|
140
|
+
|
|
141
|
+
[concept.Style.structure]
|
|
142
|
+
name = { type = "text", description = "The style's name, as a team picks it: `Quiet`, `Soft`, `Editorial`, `Bold`.", required = true }
|
|
143
|
+
direction = { type = "text", description = "The style's direction in one sentence, as a designer reads it.", required = true }
|
|
144
|
+
|
|
125
145
|
[concept.PathEntry]
|
|
126
146
|
description = "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."
|
|
127
147
|
|
|
@@ -202,6 +222,42 @@ The result of a method, described below.
|
|
|
202
222
|
|
|
203
223
|
The method is called «{{ brief.name }}», 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.
|
|
204
224
|
|
|
225
|
+
{% endif %}
|
|
226
|
+
{% if brief.frame == "composer" %}
|
|
227
|
+
## Frame
|
|
228
|
+
|
|
229
|
+
This page is the composer of an app that is composed, then shows its result. The host draws what surrounds it: a band across the top with the team's logo and the app's name, which is not a heading, and below the page nothing. There is no side panel, no app bar, no footer and no summary of the inputs to build: the page is one centred column.
|
|
230
|
+
|
|
231
|
+
The column opens on a headline that says what the person gets from the app, in their words (the page's h1), and one line under it. Then the inputs, in one raised panel whose foot is the host's action row: how long a run takes, which the host knows, and the one control that runs the method, worded with the job. Inside the panel, group the inputs the way a person thinks about the request, under a few short titles, and set them in two columns when there are enough to fill two. Nothing restates an input, and nothing is said twice.
|
|
232
|
+
|
|
233
|
+
The action row stays on screen, so the first screen holds the headline and the first rows of the panel: put first the inputs a person decides first, and any the headline promises. Every word the page writes is fixed when the page is written, while the inputs change as a person fills them: never write a line about the state of an input or of the run, such as "Waiting on the topic" or "Add a document to start" - the controls show their own state.
|
|
234
|
+
{% if brief.returns %}
|
|
235
|
+
|
|
236
|
+
What one run gives back, read from the result's own description:
|
|
237
|
+
{% for line in brief.returns %}
|
|
238
|
+
- {{ line }}
|
|
239
|
+
{% endfor %}
|
|
240
|
+
|
|
241
|
+
A person runs a tool more readily when they know what comes back: the page may say it once, in their words, as the Composer's notes - a few short lines, never the list above copied out.
|
|
242
|
+
{% endif %}
|
|
243
|
+
|
|
244
|
+
{% elif brief.frame == "result" %}
|
|
245
|
+
## Frame
|
|
246
|
+
|
|
247
|
+
This page is the result page of an app that is composed, then shows its result: what the person sees after one run. The host draws what surrounds it: the band with the team's logo and the app's name, then a bar restating the request with a way back to edit it and to run again. The host also owns the actions on the result, such as downloading or sharing it, and places them where the page's header puts them. There is no side panel, no app bar and no footer to build, and nothing restates the request.
|
|
248
|
+
|
|
249
|
+
The page is the result across the full width. It opens on its header, which names the result in a person's words, read from the result itself where it can be (the page's h1). Then the figure or the fact a person looks for first, then the body of the result in the shape it naturally has: a plan day by day, options side by side to compare, a record's details. Lay out what a person reads; leave out what only a machine would.
|
|
250
|
+
|
|
251
|
+
Show each value once: a figure a component already states, such as the total inside a ProportionBar, is not repeated beside it. When the result carries the request back - the same facts the person entered, such as the topic or the tone they chose - leave that part out: the host's bar already restates the request. Write a value as a person reads it: a date in words, an amount beside its currency when the result has one.
|
|
252
|
+
|
|
253
|
+
{% endif %}
|
|
254
|
+
{% if brief.style %}
|
|
255
|
+
## Style
|
|
256
|
+
|
|
257
|
+
The team's apps wear the {{ brief.style.name }} style: {{ brief.style.direction }}
|
|
258
|
+
|
|
259
|
+
The components already draw its faces, weights, radii and panels, so the page sets none of them. What the page decides is its composition, and the composition should read as this style too: how much air there is between the groups, how large and how long the headline is, how many groups the inputs fall into and whether they are titled, how much the page says around them. A calm style asks for few groups and generous air, a literary one for a headline that reads like a title and a measured rhythm, a graphic one for a dense, firm page with short labels.
|
|
260
|
+
|
|
205
261
|
{% endif %}
|
|
206
262
|
## State
|
|
207
263
|
|
|
@@ -252,7 +308,11 @@ None. Emit no `/state` patches.
|
|
|
252
308
|
## Run
|
|
253
309
|
|
|
254
310
|
{% if gating %}
|
|
311
|
+
{% if brief.frame == "composer" %}
|
|
312
|
+
The run waits for `{{ gating | map(attribute="name") | join("`, `") }}`. The host's action row says so by itself, so the page writes nothing about it.
|
|
313
|
+
{% else %}
|
|
255
314
|
The run waits for `{{ gating | map(attribute="name") | join("`, `") }}`; say so near the {{ brief.run_control }}, briefly.
|
|
315
|
+
{% endif %}
|
|
256
316
|
{% else %}
|
|
257
317
|
Nothing gates the run.
|
|
258
318
|
{% endif %}
|
|
@@ -274,7 +334,7 @@ type = "PipeLLM"
|
|
|
274
334
|
description = "Read the brief and plan the page: what it is for, how it is composed, what each region holds and with which components, what runs the method, and what is delegated."
|
|
275
335
|
inputs = { catalog = "Catalog", brief_text = "Text", seed = "Text?" }
|
|
276
336
|
output = "PagePlan"
|
|
277
|
-
model = { model = "
|
|
337
|
+
model = { model = "gpt-6.1-sol", temperature = 0.5, max_tokens = 8192 }
|
|
278
338
|
system_prompt = """
|
|
279
339
|
You are a product designer with taste. You plan ONE page for a method - its inputs, or its result - to be built from a fixed catalog of components and bound to state the host provides. The page must read as a small, purpose-built web app, never as a form. Its shape is yours to decide: nothing here prescribes one. You write the plan and a second designer builds the page from it, so every decision you leave open is one they will make without you.
|
|
280
340
|
"""
|
|
@@ -293,6 +353,8 @@ DESIGN DIRECTION:
|
|
|
293
353
|
- Restraint reads premium. No label that restates the obvious, no card inside a card, no paragraph that explains the form, no more than two levels of heading. Every element must earn its place; when in doubt, remove it.
|
|
294
354
|
- Write copy a person would say: short labels, one helper sentence where a label is not enough and none where it is. The control that runs names the job ("Plan my trip"), never "Submit".
|
|
295
355
|
- Every value binds to a path the brief lists, and the page reads clearly in both a light and a dark theme.
|
|
356
|
+
- When the brief has a Frame section, the host has already drawn the rest of the screen: plan only the page that section describes, inside that frame - never a side panel, never a bar or a footer the host draws, never a second place the method is run from or a second copy of the request.
|
|
357
|
+
- When the brief has a Style section, the team's apps wear that style, and the composition follows its direction: how much air the page takes, how large the headline reads, how dense the inputs sit and how they are grouped are yours to set in its spirit. The look itself - faces, radii, panels, colour - is the components', never the page's.
|
|
296
358
|
|
|
297
359
|
AVAILABLE COMPONENTS ({{ catalog.components | length }}):
|
|
298
360
|
|
|
@@ -337,12 +399,13 @@ type = "PipeLLM"
|
|
|
337
399
|
description = "Build the page the plan describes: emit the JSONL patches of a spec over the catalog, bound to the host's state at the paths the brief lists."
|
|
338
400
|
inputs = { plan = "PagePlan", catalog = "Catalog", brief_text = "Text" }
|
|
339
401
|
output = "Text"
|
|
340
|
-
# The object form, because the default output cap (4096 tokens on
|
|
341
|
-
# is not enough for a page over a
|
|
342
|
-
#
|
|
402
|
+
# The object form, because the default output cap (4096 tokens on
|
|
403
|
+
# claude-5-sonnet, where this was learned) is not enough for a page over a
|
|
404
|
+
# deeply nested result: the Company hero's first run spent exactly 4096
|
|
405
|
+
# tokens and came back empty. The object form
|
|
343
406
|
# requires a temperature; this is the runtime's own default, so the setting
|
|
344
407
|
# the earlier captures ran under is unchanged.
|
|
345
|
-
model = { model = "
|
|
408
|
+
model = { model = "gpt-6.1-sol", temperature = 0.5, max_tokens = 16384 }
|
|
346
409
|
system_prompt = """
|
|
347
410
|
You are a product designer with taste, building ONE page for a method - its inputs, or its result - as a JSON spec over a fixed catalog of components, bound to state the host provides. A designer has planned the page; you build exactly that page, and it must read as a small, purpose-built web app, never as a form.
|
|
348
411
|
"""
|
|
@@ -402,6 +465,7 @@ EXECUTION:
|
|
|
402
465
|
- Restraint reads premium. No label that restates the obvious, no card inside a card, no paragraph that explains the form, no more than two levels of heading. Every element must earn its place; when in doubt, remove it.
|
|
403
466
|
- Write copy a person would say: short labels, one helper sentence where a label is not enough and none where it is. The control that runs names the job ("Plan my trip"), never "Submit".
|
|
404
467
|
- Every value binds to a path the brief lists, and the page reads clearly in both a light and a dark theme.
|
|
468
|
+
- When the brief has a Style section, build the plan's composition in its spirit: where the plan is silent - a gap, a column count, whether a group is titled - decide as that style would.
|
|
405
469
|
|
|
406
470
|
AVAILABLE COMPONENTS ({{ catalog.components | length }}):
|
|
407
471
|
|
|
@@ -450,3 +514,66 @@ Below is the brief for the page you are building. It is the ONLY source of paths
|
|
|
450
514
|
|
|
451
515
|
Build this page as the plan describes. Bind every value; inline nothing the state carries. Output only the JSONL patch lines - no prose before or after, no code fence.
|
|
452
516
|
"""
|
|
517
|
+
|
|
518
|
+
[pipe.repair_layout]
|
|
519
|
+
type = "PipeSequence"
|
|
520
|
+
description = "Repair a page the host's checks refused: lay the brief out, then emit the whole page again with every problem the checks named fixed."
|
|
521
|
+
inputs = { catalog = "Catalog", brief = "Brief", page = "Text", problems = "Text" }
|
|
522
|
+
output = "Text"
|
|
523
|
+
steps = [
|
|
524
|
+
{ pipe = "render_brief", result = "brief_text" },
|
|
525
|
+
{ pipe = "emit_repair", result = "repaired" },
|
|
526
|
+
]
|
|
527
|
+
|
|
528
|
+
[pipe.emit_repair]
|
|
529
|
+
type = "PipeLLM"
|
|
530
|
+
description = "Emit a refused page again, whole, as JSONL patches over the catalog, with every problem the host's checks named fixed and nothing else changed."
|
|
531
|
+
inputs = { page = "Text", problems = "Text", catalog = "Catalog", brief_text = "Text" }
|
|
532
|
+
output = "Text"
|
|
533
|
+
model = { model = "gpt-6.1-sol", temperature = 0.5, max_tokens = 16384 }
|
|
534
|
+
system_prompt = """
|
|
535
|
+
You are a product designer with taste, repairing ONE page that was built as a JSON spec over a fixed catalog of components, bound to state the host provides. The host checked the page before rendering it and refused it; you fix what it refused and keep everything else exactly as it was designed.
|
|
536
|
+
"""
|
|
537
|
+
prompt = """
|
|
538
|
+
OUTPUT FORMAT (JSONL, RFC 6902 JSON Patch):
|
|
539
|
+
Output ONLY JSONL: one JSON object per line, no prose, no markdown, no code fences. Emit the WHOLE page again, every line of it, as the page below is written: first /root, then each element under /elements/<key>, parents before children, then the /state patches it had, if any.
|
|
540
|
+
|
|
541
|
+
WHAT THE HOST'S CHECKS FOUND:
|
|
542
|
+
Each line names an element by its key and the rule it breaks.
|
|
543
|
+
|
|
544
|
+
@problems
|
|
545
|
+
|
|
546
|
+
THE PAGE AS IT WAS EMITTED:
|
|
547
|
+
|
|
548
|
+
@page
|
|
549
|
+
|
|
550
|
+
HOW TO REPAIR IT:
|
|
551
|
+
1. Fix every problem listed, at the element it names, in the smallest way that satisfies the rule: a prop the component does not declare is removed or replaced by one it declares; a missing required prop is added; a second h1 becomes the next level down; a heading that skips a level takes the level it should have; a Tabs or Steps with one panel becomes that panel alone; a path the brief does not list is replaced by the one the brief lists for that value, or the element is removed.
|
|
552
|
+
2. Change nothing the problems do not name: every other element keeps its key, its type, its props, its copy and its place in the tree, and the page keeps its composition.
|
|
553
|
+
3. A fix must not break another rule: one h1, heading levels that increase by one, only the components and props below, every child emitted as its own element, every path one the brief lists, one control that runs the method on an input page.
|
|
554
|
+
|
|
555
|
+
AVAILABLE COMPONENTS ({{ catalog.components | length }}):
|
|
556
|
+
|
|
557
|
+
{% for component in catalog.components -%}
|
|
558
|
+
- {{ component.name }}: {{ component.props }}
|
|
559
|
+
{%- if component.description %} - {{ component.description }}{% endif %}
|
|
560
|
+
{%- if component.accepts_children and component.slots %} [accepts children; slots: {{ component.slots | join(", ") }}]
|
|
561
|
+
{%- elif component.accepts_children %} [accepts children]
|
|
562
|
+
{%- elif component.slots %} [slots: {{ component.slots | join(", ") }}]{% endif %}
|
|
563
|
+
{%- if component.events %} [events: {{ component.events | join(", ") }}]{% endif %}
|
|
564
|
+
{% endfor %}
|
|
565
|
+
AVAILABLE ACTIONS:
|
|
566
|
+
|
|
567
|
+
{% for action in catalog.actions -%}
|
|
568
|
+
- {{ action.name }}: {{ action.description }}{% if action.built_in %} [built-in]{% endif %}
|
|
569
|
+
{% endfor %}
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
Below is the brief the page was built for. It is the ONLY source of paths: every value the page shows or binds must be at a path the brief lists, spelled exactly as written.
|
|
573
|
+
|
|
574
|
+
@brief_text
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
Emit the repaired page, whole. Output only the JSONL patch lines - no prose before or after, no code fence.
|
|
579
|
+
"""
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldEnv, FilePickerSource, ExamplePickerSource } from '@pipelex/mthds-form/react';
|
|
1
|
+
import { FieldEnv, UploadedFile, FilePickerSource, ExamplePickerSource } from '@pipelex/mthds-form/react';
|
|
2
2
|
export * from '@pipelex/mthds-form/react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ValidationMessageKey, PipeIOContract, RunField, RunInputError, PipeInputFormDescriptor, FormExample } from '@pipelex/mthds-form';
|
|
@@ -89,34 +89,6 @@ declare function summarizeVerdict(missingInputs: string[], errors: RunInputError
|
|
|
89
89
|
*/
|
|
90
90
|
declare function runSubmitGate(contract: PipeIOContract, fields: RunField[], values: Record<string, unknown>, t?: RunPanelTranslate): RunGateOutcome;
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* One upload the run panel runs for a dropped file: from the host's
|
|
94
|
-
* `uploadFile` to the value written at the field's path, and the promise of that
|
|
95
|
-
* value the panel hands back to the kernel's field as `onDropFile`'s answer.
|
|
96
|
-
*
|
|
97
|
-
* It is React-free and kept out of the component so that what the panel
|
|
98
|
-
* promises the field can be tested on its own. The promise goes to the kernel's
|
|
99
|
-
* control and to nothing else, so no story can hold it; the stories prove what
|
|
100
|
-
* the field does with it.
|
|
101
|
-
*
|
|
102
|
-
* Why the panel answers at all (kernel `0.22.0`, docs/upload-seam.md in the
|
|
103
|
-
* kernel, "The local preview belongs to the value it was made for"): a dropped
|
|
104
|
-
* file is shown from an object URL until its upload lands, and the field must
|
|
105
|
-
* then tell its upload's result from a file someone else wrote there. Told
|
|
106
|
-
* nothing, it goes by when the value lands, which asks the host to write the
|
|
107
|
-
* value in the very render it ends the flight. The panel cannot promise that:
|
|
108
|
-
* the values are the host's, and a host applying them through a store, a
|
|
109
|
-
* transition or a store that renders on write puts them on screen a render
|
|
110
|
-
* after or before the panel's own mark goes, and the field then drops the
|
|
111
|
-
* preview. Answered with the file the upload wrote, the field matches its URL
|
|
112
|
-
* whichever render it lands in.
|
|
113
|
-
*/
|
|
114
|
-
/** What a host's upload returns: the stored URL, and optionally a display name. */
|
|
115
|
-
interface UploadedFile {
|
|
116
|
-
url: string;
|
|
117
|
-
filename?: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
92
|
interface RunPanelProps {
|
|
121
93
|
/**
|
|
122
94
|
* The pipe's IO contract — the kernel's type, supplied by the host.
|
|
@@ -202,12 +174,14 @@ interface RunPanelProps {
|
|
|
202
174
|
*/
|
|
203
175
|
env?: FieldEnv;
|
|
204
176
|
/**
|
|
205
|
-
* Stores a dropped file and returns its URL
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* the
|
|
209
|
-
* the
|
|
210
|
-
*
|
|
177
|
+
* Stores a dropped file and returns its URL, or its URL and a display name:
|
|
178
|
+
* the kernel's `UploadedFile`, the type its own `MethodForm` takes. The host
|
|
179
|
+
* performs the upload — this library never touches an API client — while
|
|
180
|
+
* the panel owns the bookkeeping around it: marking the field busy, writing
|
|
181
|
+
* the result back at the field's dotted path (named after the dropped file
|
|
182
|
+
* when the host gave no name), and answering the field with the file it
|
|
183
|
+
* wrote, so the dropped file's preview stays whichever render your values
|
|
184
|
+
* reach the screen in.
|
|
211
185
|
*/
|
|
212
186
|
uploadFile?: (file: File, fieldId: string) => Promise<UploadedFile>;
|
|
213
187
|
/**
|
|
@@ -321,4 +295,4 @@ interface RunPanelProps {
|
|
|
321
295
|
*/
|
|
322
296
|
declare function RunPanel({ contract, descriptor, values, onValuesChange, onRun, running, env, uploadFile, fileSource, exampleSource, onFill, title, theme, translate, idPrefix, className, }: RunPanelProps): react_jsx_runtime.JSX.Element;
|
|
323
297
|
|
|
324
|
-
export { type RunGateOutcome, RunPanel, type RunPanelMessageKey, type RunPanelProps, type RunPanelTranslate,
|
|
298
|
+
export { type RunGateOutcome, RunPanel, type RunPanelMessageKey, type RunPanelProps, type RunPanelTranslate, defaultValidationTranslate, runSubmitGate, summarizeVerdict };
|
package/dist/form/react/index.js
CHANGED
|
@@ -82,14 +82,14 @@ function runPanelUpload({
|
|
|
82
82
|
endFlight,
|
|
83
83
|
reportBug = surfaceAsUnhandledRejection
|
|
84
84
|
}) {
|
|
85
|
-
const landed = (async () => await start())().then((
|
|
85
|
+
const landed = (async () => await start())().then((uploaded) => {
|
|
86
86
|
if (!isCurrent()) {
|
|
87
87
|
throw new Error(
|
|
88
88
|
`The form moved on before the upload dropped at "${id}" landed, so it wrote nothing.`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
try {
|
|
92
|
-
return write(
|
|
92
|
+
return write(typeof uploaded === "string" ? { url: uploaded } : uploaded);
|
|
93
93
|
} catch (bug) {
|
|
94
94
|
reportBug(bug);
|
|
95
95
|
throw bug;
|