create-pmos 0.606.0 → 0.608.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/package.json +27 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +2 -1
- package/workspace/guide/cli.md +2 -0
- package/workspace/guide/settings-and-switches.md +8 -0
- package/workspace/lib/idle-lab.js +3 -1
- package/workspace/lib/lab-cli.js +29 -1
- package/workspace/lib/live-round.js +121 -9
- package/workspace/lib/proto-runtime.js +35 -2
- package/workspace/lib/prototype-rules.js +176 -0
- package/workspace/lib/routes-lab.js +24 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-proto.css +18 -0
- package/workspace/public/pm/cozy-proto.js +45 -6
- package/workspace/public/pm/cozy-settings.js +31 -4
- package/workspace/test-lists/prototype-rules.json +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.608.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.608.0",
|
|
38
|
+
"at": "2026-11-18T14:09:00.418Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1356,
|
|
43
|
+
"t": "Prototype rules: each correction becomes a check before a version opens",
|
|
44
|
+
"s": "Prototype rules: each correction becomes a check before a version opens",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.607.0",
|
|
51
|
+
"at": "2026-11-18T11:44:39.758Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1351,
|
|
56
|
+
"t": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
57
|
+
"s": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
58
|
+
"k": "fix"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.606.0",
|
|
38
64
|
"at": "2026-11-18T11:27:58.320Z",
|
|
@@ -290,32 +316,6 @@
|
|
|
290
316
|
"k": "new"
|
|
291
317
|
}
|
|
292
318
|
]
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"v": "0.588.0",
|
|
296
|
-
"at": "2026-11-17T10:44:25.596Z",
|
|
297
|
-
"f": 4,
|
|
298
|
-
"prs": [
|
|
299
|
-
{
|
|
300
|
-
"n": 1324,
|
|
301
|
-
"t": "Share a meeting note with people who have no PMOS",
|
|
302
|
-
"s": "Share a meeting note with people who have no PMOS",
|
|
303
|
-
"k": "new"
|
|
304
|
-
}
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"v": "0.587.0",
|
|
309
|
-
"at": "2026-11-17T10:24:56.955Z",
|
|
310
|
-
"f": 4,
|
|
311
|
-
"prs": [
|
|
312
|
-
{
|
|
313
|
-
"n": 1322,
|
|
314
|
-
"t": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
315
|
-
"s": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
316
|
-
"k": "fix"
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
319
|
}
|
|
320
320
|
]
|
|
321
321
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T14:08:57Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T14:08:57Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T14:08:57Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.608.0",
|
|
4
|
+
"at": "2026-11-18T14:09:00.418Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1356,
|
|
9
|
+
"t": "Prototype rules: each correction becomes a check before a version opens",
|
|
10
|
+
"s": "Prototype rules: each correction becomes a check before a version opens",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.607.0",
|
|
17
|
+
"at": "2026-11-18T11:44:39.758Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1351,
|
|
22
|
+
"t": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
23
|
+
"s": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
24
|
+
"k": "fix"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.606.0",
|
|
4
30
|
"at": "2026-11-18T11:27:58.320Z",
|
|
@@ -195,7 +195,7 @@ Not proven yet: the compare view's Production and Design columns stay left out u
|
|
|
195
195
|
You can ask to see an idea at any moment: alone while you work on an initiative, or with stakeholders in the room. It works like design work with Claude Code: you say what you want, PMOS makes or changes the one prototype, the Viewer shows it, and the chat says what changed.
|
|
196
196
|
|
|
197
197
|
1. **Ask in the initiative's chat.** Say, for example, "prototype this" or "mock this up". PMOS starts one prototype at once. Nothing to press. It opens in the Viewer beside the chat as soon as it opens and renders in a headless browser, in about a minute. The chat answers with a **Version 1** tag and says what was made and for whom. Tap a Version tag to show that version again.
|
|
198
|
-
2. **The Viewer is one canvas, like a design tool.** The prototype is in the middle, at its own size. Three panels sit around it:
|
|
198
|
+
2. **The Viewer is one canvas, like a design tool.** The prototype is in the middle, at its own size. Only the design shows: there is no browser frame around it, and the canvas is cut to the design itself. A version puts no notes on its screens (a format's name and size, "sample data", the other option to compare). It writes them as notes instead, and the notes sit beside the design as numbered annotations for the screen shown. Tap a note about one block to flash that block on the design. Three panels sit around it:
|
|
199
199
|
- **Pages, screens and layers** (left). A page is one format or page of the prototype, for example "One Raffles Place LED". A page has screens: its states, for example "Default" and "Sponsor sold". Layers lists the blocks of the screen shown. Tap a screen to show it, or tap a layer to select it. Press [ to hide or show this panel.
|
|
200
200
|
- **Exact values** (right): the inspector for the selected layer. Set its text, font, size, weight, line height, letter spacing, colour, fill, corner, padding and alignment. The prototype changes at once. PMOS keeps the change with the version, and the next version keeps it. The chat shows one quiet line, for example "You set Temperature to 56px · Bold. Kept as yours." The undo press in the panel clears that layer's changes. Press ] to hide or show the inspector.
|
|
201
201
|
- **Page copy, The flow and Who does what**: one press each in the toolbar, closed by default. One opens at a time, in the inspector's place. Page copy lists every word on the screen: edit a line in place. The flow shows screens as cards, decisions as diamonds and branches to the other scenarios: tap a screen to see it, or a side branch to play that scenario. Who does what has one column for each role, with the steps going down in order. The role names stay at the top when you scroll. Both diagrams show at the normal text size. A long one scrolls in the panel. Press the arrows at the top of the panel to make it wider. A press with a dot, or a panel that says **Updated**, is what the last version changed.
|
|
@@ -216,6 +216,7 @@ What each part does:
|
|
|
216
216
|
- **What the run gets.** Each run gets the product's token sheet and the start of its component sheet (or PMOS's own), the initiative's name and the product's Intent, the files you attached, the element you pointed at, and your copy edits and sliders. A prototype must fit a 390 px phone screen.
|
|
217
217
|
- **What the run can do.** A run can only read and write in its own folder in the runtime folder, plus the last version and the files you attached. It has no shell, no web and nothing that sends. Nothing goes into a product repository before your ✓.
|
|
218
218
|
- **What the canvas can do.** The prototype runs in a sandboxed frame. It cannot reach PMOS. The canvas talks to it only to show a screen, point, pin, play and apply your edits.
|
|
219
|
+
- **Your prototype rules.** After a version renders and before it opens, PMOS checks it against your prototype rules: no device or browser frame, no instructions on the screen, no sample copy, and each rule PMOS learns from your corrections. When a correction is true of every prototype (for example "no device frame"), the chat adds it as a rule (`pmos lab rule add`). PMOS keeps a rule only when it fails a bad example and passes a good one, so a button such as "See the week" is never read as an instruction. A change to one version ("make the alert orange") or a taste ("calmer") never becomes a rule. A version that breaks a rule gets one fix run, given only the lines that broke it. You see only the fixed version, with one quiet line: "PMOS fixed 3 things before showing you this." When the fix does not reach a rule, the version still opens and the line names the rule it breaks. When nothing was fixed, there is no line. Settings › PMOS › Prototype rules lists the rules with Undo.
|
|
219
220
|
- **No time limit.** A version takes as long as the ask needs. While PMOS makes it, the Viewer shows what it is doing now (for example "Building screen 3 of 7"), the steps done, a progress bar and the time so far, with a Stop press. A run that writes nothing for 10 minutes is stuck: PMOS stops it. A version that does not render, that is stuck or that you stop is "not made" with the reason, and the chat says so. The Viewer still opens it: it says why and shows the version it was made from. While a version is being made, a new ask on the same initiative waits: PMOS says what is running.
|
|
220
221
|
- **Lessons.** Each change sentence, ✓ and ✕ is a Lessons line of the experiment (`pmos artefacts show`). Each version that rendered is a Specimens line. The one you keep is the kept specimen.
|
|
221
222
|
- **The grill runs after the session, not during it.** When you keep a version, the grill runs once on the kept specimen, as the Review step. Its findings wait under the ✦ (D60 as amended on 2026-11-17).
|
package/workspace/guide/cli.md
CHANGED
|
@@ -243,6 +243,8 @@ The idle lab run uses only the first three commands:
|
|
|
243
243
|
- `pmos lab round <initiative> --brief "<what to show>" [--one] [--base B] [--dirs "A: …|B: …|C: …"] [--of <round> [--from n]] [--propose] [--chat] [--ws <id>]`: a live round. With `--one`, PMOS makes one version with its flow, swimlane and copy, and shows it on the Viewer's canvas as soon as it renders; without it, PMOS starts three runs at once, one version each, side by side. With `--base B`, PMOS makes one new round of B from the brief: of the current prototype, or of the round that `--of` names (and its version n with `--from n`). With `--propose`, PMOS files the ✦ ask instead, and your ✓ starts it. With `--chat`, the initiative chat started it: the chat is told when the version renders, and the version becomes the initiative's prototype (a round from a terminal without it waits for your ✓). A background lab run cannot use this command. See [The live round](agent-capabilities.md).
|
|
244
244
|
- `pmos lab delete <initiative> [--file <round>/<A>/<a>.html | --version <n> [--key A]] [--ws <id>]`: delete one prototype version. Without `--file` or `--version`, PMOS deletes the prototype now. The version goes out of the Viewer and is not used for the next version. Its folder, with your edits, is kept aside, so the command prints the Undo. The Viewer's trash in the version bar does the same. A background lab run cannot use this command.
|
|
245
245
|
- `pmos lab undo <batch> [--ws <id>]`: bring a deleted version back, with its edits.
|
|
246
|
+
- `pmos lab rule add --json - [--again]`: add one of your prototype rules from a correction. The JSON is `{ "title", "words", "tests": [{ "in": "text" | "attr" | "source", "re", "flags"? }], "bad", "good" }`: `text` reads the screen's words without buttons and links, `attr` reads each element's class and id, and `bad` and `good` are two small HTML pages. PMOS keeps the rule only when it fails `bad` and passes `good`. `--again` adds a rule you undid, only when you say it again. The initiative chat runs it; a background lab run cannot.
|
|
247
|
+
- `pmos lab rule list`: the rules every prototype version is checked against before it opens. The same list is in Settings › PMOS › Prototype rules.
|
|
246
248
|
|
|
247
249
|
### pmos outcomes: expected outcomes
|
|
248
250
|
|
|
@@ -76,6 +76,14 @@ PMOS grills an initiative by itself and files what it finds under the initiative
|
|
|
76
76
|
|
|
77
77
|
**Monthly credit for checks.** The most PMOS's checks may spend in a month: $5, $10, $20 or $50. The bar under it shows what this month used. At the limit PMOS pauses and the row says so; it never spends beyond the limit. `pmos grill mode` and `pmos grill cap` change the same two settings.
|
|
78
78
|
|
|
79
|
+
## PMOS › Prototype rules: what every prototype version is checked for
|
|
80
|
+
|
|
81
|
+
PMOS checks each prototype version against these rules after it renders and before it opens in the Viewer (see [The live round](agent-capabilities.md)). A version that breaks one gets one fix run, and you see only the fixed version. Each rule comes from your own words: the row shows the rule, what you said and the date. There is no button to run the checks and nothing to pick: PMOS adds a rule from a correction in the chat that is true of every prototype.
|
|
82
|
+
|
|
83
|
+
The first three come from the corrections of 18 Nov: **No device or browser frame**, **No instructions on the screen** and **No sample or placeholder copy**.
|
|
84
|
+
|
|
85
|
+
**Undo** stops PMOS from checking that rule. The rule stays in the list, with **Bring back**. PMOS does not add an undone rule again unless you say it again. `pmos lab rule list` shows the same list.
|
|
86
|
+
|
|
79
87
|
## Where the settings are kept
|
|
80
88
|
|
|
81
89
|
Each setting is saved when you change it. The settings are kept in the PMOS state directory, in `settings.json` for this computer and in `settings-ws/<workspace>.json` for each workspace. Only you can read these files. `GET /api/settings` returns every setting with its value and default. A change goes through `POST /api/settings` and must come from the workspace page. A variable in the environment where PMOS starts, such as `PMOS_GRILL=off`, wins over the page, and the row says so.
|
|
@@ -303,7 +303,9 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
|
|
|
303
303
|
...(file ? { file } : {}), ...(lost ? { notMade: lost.why || (lost.state === 'working' ? 'its run stopped before it finished' : 'it did not render'), ...(fromFile ? { fallback: fromFile, fallbackN: p.data.from } : {}) } : {}), ...(upd ? { updated: upd, also: p.data.also || '' } : {}), ...(slotNow && slotNow.parts ? { parts: slotNow.parts } : {}),
|
|
304
304
|
...(live ? { live: true, run: p.data.live.id || '', startedAt: p.data.live.startedAt || '', working: (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving' || Object.values(s.parts || {}).includes('working')) } : {}),
|
|
305
305
|
// what the run is doing now (its progress.json, lib/live-round.js progressOf): the Viewer's progress line while it is made
|
|
306
|
-
...(slotNow && slotNow.progress && making ? { progress: slotNow.progress } : {})
|
|
306
|
+
...(slotNow && slotNow.progress && making ? { progress: slotNow.progress } : {}),
|
|
307
|
+
// the PM's prototype rules (lib/prototype-rules.js): how many PMOS fixed before it opened, and any it still breaks (never hidden)
|
|
308
|
+
...(slotNow && !making && (slotNow.fixed || (slotNow.missed || []).length) ? { checks: { fixed: slotNow.fixed || 0, missed: (slotNow.missed || []).slice(0, 6) } } : {}) };
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
/** PURE. The initiative's prototype rounds, newest first, open or not: a kept or dropped round stays reachable from the initiative page
|
package/workspace/lib/lab-cli.js
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* --chat: the initiative chat's own agent started it, so the chat is told when the version renders
|
|
13
13
|
* the live round (lib/live-round.js): the running server starts three runs now, or one on B; --propose
|
|
14
14
|
* files its ✦ ask for the PM's ✓ instead (the initiative chat's way)
|
|
15
|
+
* pmos lab rule add --json - [--again] | rule list the PM's prototype rules (lib/prototype-rules.js): the chat's agent turns a correction
|
|
16
|
+
* that is true of every prototype into a check. PMOS keeps it only when it fails its bad example and
|
|
17
|
+
* passes its good one; --again re-adds a rule the PM undid, only when the PM says it again
|
|
15
18
|
*
|
|
16
19
|
* The run verbs need the run's environment (PMOS_LAB_RUN, _KIND, _PENDING, and _PAGES or _SPECIMENS, set by the server); outside a run they
|
|
17
20
|
* refuse. Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent. */
|
|
@@ -20,7 +23,7 @@ const path = require('path');
|
|
|
20
23
|
const dns = require('dns');
|
|
21
24
|
const E = require('./idle-lab-engine.js');
|
|
22
25
|
|
|
23
|
-
const COMMANDS = { lab: ['page', 'file', 'status', 'round', 'delete', 'undo'] };
|
|
26
|
+
const COMMANDS = { lab: ['page', 'file', 'status', 'round', 'delete', 'undo', 'rule'] };
|
|
24
27
|
const GROUPS = { 'prototype-new': ['prototyped'], 'prototype-improve': ['improved'], 'scan-new': ['scanned', 'scan'], 'scan-improve': ['scanned', 'scan'] };
|
|
25
28
|
const USAGE = [
|
|
26
29
|
'usage: pmos lab page|file|status — the idle lab: PMOS prototypes and scans while you are away; each result waits under ✦ for your ✓',
|
|
@@ -38,6 +41,9 @@ const USAGE = [
|
|
|
38
41
|
' pmos lab delete <initiative> [--file <round>/<A>/<a>.html | --version <n> [--key A]] [--ws <id>]',
|
|
39
42
|
' delete one prototype version (no --file or --version: the prototype now). It prints the batch',
|
|
40
43
|
' pmos lab undo <batch> [--ws <id>] bring a deleted version back',
|
|
44
|
+
' pmos lab rule add --json - [--again] a prototype rule from the PM\'s correction: { "title", "words", "tests": [{ "in": "text"|"attr"|"source", "re", "flags"? }],',
|
|
45
|
+
' "bad": "<html that breaks it>", "good": "<html that keeps it>" }. Kept only when it fails bad and passes good',
|
|
46
|
+
' pmos lab rule list the rules every prototype version is checked against before it opens',
|
|
41
47
|
'A specimen must open and render; every claim must quote what was read. What is not proven is dropped. Nothing is sent.',
|
|
42
48
|
];
|
|
43
49
|
const flag = (args, k) => { const i = args.indexOf('--' + k); return i >= 0 ? (args[i + 1] === undefined || args[i + 1].startsWith('--') ? true : args[i + 1]) : undefined; };
|
|
@@ -176,6 +182,28 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
176
182
|
return 0;
|
|
177
183
|
}
|
|
178
184
|
|
|
185
|
+
if (verb === 'rule') {
|
|
186
|
+
// the PM's prototype rules: the chat's agent adds one from a correction; a background lab run never does
|
|
187
|
+
if (run) { say('✗ a lab run cannot change the PM\'s prototype rules'); return 1; }
|
|
188
|
+
const sub = args[1];
|
|
189
|
+
if (sub !== 'add' && sub !== 'list') { say('usage: pmos lab rule add --json - [--again] | pmos lab rule list'); return 2; }
|
|
190
|
+
if (typeof call !== 'function') { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
|
|
191
|
+
if (sub === 'list') {
|
|
192
|
+
let r = null; try { r = await call('GET', '/api/lab/rules'); } catch { r = null; }
|
|
193
|
+
if (!r || !r.ok) { say('✗ ' + ((r && r.error) || 'no PMOS server answers: start PMOS, then ask again')); return 1; }
|
|
194
|
+
for (const x of r.rules || []) say(`${x.on ? '✓' : '·'} ${x.id} · ${x.title}${x.on ? '' : ' (undone by the PM)'}${x.words ? ' · "' + one(x.words, 120) + '"' : ''}`);
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
const src = flag(args, 'json'); if (typeof src !== 'string') { say('usage: pmos lab rule add --json <file|-> [--again]'); return 2; }
|
|
198
|
+
const j = readJson(src, stdin); if (j.error) { say('✗ ' + j.error); return 1; }
|
|
199
|
+
let by = ''; try { by = require('./actor.js').fromCli({ env }).by || ''; } catch { by = ''; }
|
|
200
|
+
let r = null; try { r = await call('POST', '/api/lab/rules', { op: 'add', rule: j.body, ...(flag(args, 'again') ? { again: true } : {}), ...(by ? { by } : {}) }); } catch { r = null; }
|
|
201
|
+
if (!r) { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
|
|
202
|
+
if (!r.ok) { say('✗ ' + (r.error || 'the rule was not added')); return 1; }
|
|
203
|
+
say(`✓ ${r.replaced ? 'updated' : 'added'} "${r.rule.title}": every prototype version is checked against it before it opens. The PM can undo it in Settings › PMOS › Prototype rules.`);
|
|
204
|
+
return 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
179
207
|
if (verb === 'status') {
|
|
180
208
|
if (run && env.PMOS_LAB_PENDING) {
|
|
181
209
|
let lines = [];
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* as it renders, and the chat says in one line what was made (deps.tell: the version's own <meta name="pmos-changed"> sentence goes to the
|
|
10
10
|
* chat's session). Any change sentence while that one version is open ("make the alert orange") is the next round of it, the same way.
|
|
11
11
|
* PROTOTYPE BY CHATTING (design agreed 2026-11-17 23:31, https://claude.ai/artifact/9fxuukKr3XixwkGFMTfeba): the run that makes a version
|
|
12
|
-
* also writes its companions as DATA next to it (PARTS: flow.json, lanes.json, tweaks.json; PMOS writes copy.json from the prototype's
|
|
12
|
+
* also writes its companions as DATA next to it (PARTS: flow.json, lanes.json, tweaks.json, notes.json; PMOS writes copy.json from the prototype's
|
|
13
13
|
* data-copy text), and the Viewer draws them as one canvas (pm/cozy-proto.js). The chat is told once per round, "Version n" first, with
|
|
14
14
|
* what the version changed beside the prototype (changesOf: "Also updated: step 3, the swimlane and the copy"). The canvas's marks before
|
|
15
15
|
* the PM's words (marksOf: the element pointed at, Continue from version n) and the PM's in-place edits (edits.json) reach the next run.
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
* PROOF PER FILE (proven-only rule). PMOS watches each run's folder. When a file lands and stops growing it opens it in a headless browser
|
|
31
31
|
* (lib/idle-lab-engine.js renderCheck, at desk width and at 390 px: a version wider than the phone is not proven) and only then puts it on the card. The card exists from the start, so the PM sees honest state: a
|
|
32
32
|
* slot is working, made (a thumbnail) or not made (why). Nothing is written to a product repository before ✓ (D60, D65).
|
|
33
|
+
* THE PM'S RULES (initiative prototype-rules, step 2 of "Prototypes right on the first try", agreed 2026-11-18). After a version renders and
|
|
34
|
+
* before it opens, PMOS runs the PM's prototype rules on it (lib/prototype-rules.js: no device frame, no instructions, no sample copy, and
|
|
35
|
+
* each rule the chat's agent adds from a correction). A version that breaks one gets ONE fix run (fixPromptOf) given only the failed lines;
|
|
36
|
+
* then it is rendered and checked again. It opens either way: fixed ("PMOS fixed n things before showing you this"), or with the rule it
|
|
37
|
+
* still breaks, never hidden. A fix that breaks the render puts the draft back. The draft is kept next to it as <key>.draft.html.
|
|
33
38
|
* LESSONS. Every feedback sentence is a Lessons line of the experiment (lib/artefacts.js); ✓ and ✕ add theirs (lib/routes-proposals.js).
|
|
34
39
|
* The specimens a round made are Specimens lines; the one the PM keeps is its `kept` field.
|
|
35
40
|
*
|
|
@@ -56,6 +61,7 @@ const crypto = require('crypto');
|
|
|
56
61
|
const PR = require('./proposals.js');
|
|
57
62
|
const LAB = require('./idle-lab.js');
|
|
58
63
|
const E = require('./idle-lab-engine.js');
|
|
64
|
+
const RULES = require('./prototype-rules.js');
|
|
59
65
|
|
|
60
66
|
const JOB = 'live-round';
|
|
61
67
|
const ORIGIN = 'live-round';
|
|
@@ -83,6 +89,9 @@ const PARTS = Object.freeze([
|
|
|
83
89
|
Object.freeze({ kind: 'flow', title: 'The flow', name: 'flow.json' }),
|
|
84
90
|
Object.freeze({ kind: 'lanes', title: 'Who does what', name: 'lanes.json' }),
|
|
85
91
|
Object.freeze({ kind: 'tweaks', title: 'Tweaks', name: 'tweaks.json', optional: true }),
|
|
92
|
+
// the notes beside the design (Wawan 2026-11-18, batch 31: "the design part should only show the actual design, without any
|
|
93
|
+
// instruction. In case of instruction, it should be put as comment or annotation"): what the run wants the PM to know, never on a screen
|
|
94
|
+
Object.freeze({ kind: 'notes', title: 'Notes', name: 'notes.json', optional: true }),
|
|
86
95
|
]);
|
|
87
96
|
const SCAFFOLD_MAX = 12000;
|
|
88
97
|
const FROM = Object.freeze({ chat: 'Your ask in the initiative chat', cli: 'pmos lab round', meeting: 'Said in the meeting' });
|
|
@@ -247,7 +256,7 @@ function promptOf(o) {
|
|
|
247
256
|
for (const r of o.refs || []) L.push(`The PM attached a reference (an image, a sketch or a file): ${r}. Read it first with the Read tool. Build from it (its layout, hierarchy and colours) unless the PM's words above say otherwise ("only the colours", "ignore the layout"). In your pmos-changed line, say what you took from it.`);
|
|
248
257
|
if (o.base) {
|
|
249
258
|
L.push('', `This is a new version of prototype ${o.key} (${one(o.base.title, 140)}). Read the last version first: ${o.base.abs}`,
|
|
250
|
-
`and its companions next to it (flow.json, lanes.json, tweaks.json in ${path.dirname(o.base.abs)}). Change what the PM asked for in the idea above, usually one thing, and keep the rest as it was, ids and copy keys included.`);
|
|
259
|
+
`and its companions next to it (flow.json, lanes.json, tweaks.json, notes.json in ${path.dirname(o.base.abs)}). Change what the PM asked for in the idea above, usually one thing, and keep the rest as it was, ids and copy keys included.`);
|
|
251
260
|
} else if (o.alone) L.push('', 'This is the one version the PM sees: make the plainest honest version of the idea, not a showcase.');
|
|
252
261
|
else L.push('', `Your direction, ${o.key}: ${one(o.title, 200)}. Other runs take the other directions: keep yours clearly different.`);
|
|
253
262
|
if (o.point && (o.point.el || o.point.label)) L.push('', `The PM pointed at one element: ${o.point.el ? 'data-el="' + one(o.point.el, 60) + '"' : ''}${o.point.label ? ' ("' + one(o.point.label, 80) + '")' : ''}. Their words are about that element: change it, and only what must follow from it.`);
|
|
@@ -266,6 +275,8 @@ function promptOf(o) {
|
|
|
266
275
|
`1. ${o.file}: the prototype. Write it FIRST: the PM sees it as soon as it lands.`,
|
|
267
276
|
' - One self-contained HTML page: inline CSS only, no script, no network, no image files. Real draft copy, never lorem ipsum or a placeholder.',
|
|
268
277
|
` - In <head>, one line for the PM: <meta name="pmos-changed" content="…"> with ONE short sentence of what ${o.base ? 'you changed' : 'you made and for whom'}, in plain words, under 140 characters.`,
|
|
278
|
+
' - Show ONLY the design: each screen is the product exactly as its user sees it. Nothing about the prototype on a screen: no format names or sizes ("Format 1 · 7680 × 1550"), no headings that name the option ("One view: …"), no "sample data" or "placeholder" notes, no notes to the PM, and no buttons that only move between your own options or formats ("See the two-panel option", "All formats"): PMOS lists the pages and screens. Write each such note in notes.json instead.',
|
|
279
|
+
' - No frame around the design: no browser bar, no device, no extra page or card behind it. Body margin 0; the page background is the design\'s own background.',
|
|
269
280
|
' - Each screen is a <section data-screen="<id>" data-label="<screen name>">; the first one is where the user starts. PMOS shows one screen at a time.',
|
|
270
281
|
' - When several screens are states of one page or format (default, sponsor sold, rain alert), give each data-page="<that page\'s name>": the PM sees them as one page with its screens.',
|
|
271
282
|
' - What the user taps to move on carries data-go="<screen id>" (a button, a row, a link with href="#<screen id>").',
|
|
@@ -279,11 +290,27 @@ function promptOf(o) {
|
|
|
279
290
|
' - Scenarios: the main path first, then one per branch (2 to 4 in all). Each step names its screen and the data-el the user taps there to move on ("tap"); the last step has no tap.',
|
|
280
291
|
`3. ${path.join(dir, 'lanes.json')}: who does what. JSON: { "lanes": [{ "id", "name", "steps": [{ "n", "title", "screen"? }] }] }. One lane per actor (the user, the product, and the people or systems the initiative names). n numbers the steps across all lanes in the order they happen (1, 2, 3 …); "screen" is the data-screen the step shows, when it shows one.`,
|
|
281
292
|
`4. ${path.join(dir, 'tweaks.json')} (optional): { "tweaks": [{ "var": "--gap", "label": "Spacing", "min": 4, "max": 32, "step": 1, "unit": "px", "value": 16, "el"? }] }, at most 6, for the custom properties the prototype reads. "el" is the data-el a tweak belongs to; without it, it is for the whole screen.`,
|
|
293
|
+
`5. ${path.join(dir, 'notes.json')} (optional): { "notes": [{ "text", "screen"?, "el"? }] }, at most 8: what the PM should know that is not part of the design (the format and its size, that the data is sample data, what a placeholder stands for, the other option to compare). PMOS shows them as annotations beside the design. "screen" is the data-screen a note is about, "el" the data-el it points at; without them, it is for the whole prototype.`,
|
|
282
294
|
'Write nothing else and do not read anything else' + (o.base || (o.refs || []).length ? ' but what is named above.' : '.'));
|
|
283
295
|
if (o.scaffold && o.scaffold.css) L.push('', 'The stylesheet:', '```css', o.scaffold.css, '```');
|
|
284
296
|
return L.join('\n');
|
|
285
297
|
}
|
|
286
298
|
|
|
299
|
+
/** PURE. The one fix run's prompt: only the rules the version broke and the lines that broke them (failed: lib/prototype-rules.js run). */
|
|
300
|
+
function fixPromptOf({ file, dir, failed }) {
|
|
301
|
+
const L = ['You fix ONE prototype before the product manager sees it. It renders, but it breaks rules the PM set for every prototype. Be quick: no planning, no questions, no summary.',
|
|
302
|
+
'', `The prototype: ${file}. Read it, then overwrite it with the Write tool.`, '', 'The rules it breaks, each with the lines that broke it:'];
|
|
303
|
+
for (const f of failed || []) {
|
|
304
|
+
L.push(`- ${one(f.title, 80)}${f.words ? ' (the PM said: "' + one(f.words, 200) + '")' : ''}`);
|
|
305
|
+
for (const l of f.lines || []) L.push(` > ${one(l, 160)}`);
|
|
306
|
+
}
|
|
307
|
+
L.push('', 'Change only what these lines need. Keep everything else as it is: the screens, their ids, every data-* attribute and copy key, the CSS and <meta name="pmos-changed">.',
|
|
308
|
+
`A line that is a note for the PM (a format or its size, that the data is sample data, how to use the prototype) moves to ${path.join(dir, 'notes.json')} as { "notes": [{ "text", "screen"? }] }, keeping the notes already there. Never just delete it.`,
|
|
309
|
+
'Sample or placeholder copy becomes real copy about the prototype\'s own subject. A frame (a device, a browser bar, a status bar) goes: the design is the page itself.',
|
|
310
|
+
'Write nothing else.');
|
|
311
|
+
return L.join('\n');
|
|
312
|
+
}
|
|
313
|
+
|
|
287
314
|
/* ── the companions as data (PARTS): each check is PURE and keeps only what is well formed ── */
|
|
288
315
|
const ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,59}$/;
|
|
289
316
|
const arr = (v, n) => (Array.isArray(v) ? v.slice(0, n) : []);
|
|
@@ -326,6 +353,18 @@ function lanesOf(j, { screens = null } = {}) {
|
|
|
326
353
|
if (!lanes.length || !ns.size) return { error: 'lanes.json has no lanes with steps' };
|
|
327
354
|
return { lanes };
|
|
328
355
|
}
|
|
356
|
+
/** PURE. notes.json → { notes: [{ text, screen?, el? }] } | { error }: the annotations beside the design, at most 8, each text once. */
|
|
357
|
+
function notesOf(j) {
|
|
358
|
+
if (!isObj(j)) return { error: 'notes.json is not a JSON object' };
|
|
359
|
+
const seen = new Set();
|
|
360
|
+
const notes = arr(j.notes, 12).map((n) => {
|
|
361
|
+
const text = isObj(n) ? one(n.text, 240) : '';
|
|
362
|
+
if (!text || seen.has(text)) return null;
|
|
363
|
+
seen.add(text);
|
|
364
|
+
return { text, ...(ID.test(str(n.screen)) ? { screen: n.screen } : {}), ...(ID.test(str(n.el)) ? { el: n.el } : {}) };
|
|
365
|
+
}).filter(Boolean).slice(0, 8);
|
|
366
|
+
return { notes };
|
|
367
|
+
}
|
|
329
368
|
/** PURE. tweaks.json → { tweaks: [{ var, label, min, max, step, unit, value, el? }] } | { error }. */
|
|
330
369
|
function tweaksOf(j) {
|
|
331
370
|
if (!isObj(j)) return { error: 'tweaks.json is not a JSON object' };
|
|
@@ -377,6 +416,7 @@ function partsAt(abs) {
|
|
|
377
416
|
const f = flowOf(rd('flow.json')); if (!f.error) out.flow = f;
|
|
378
417
|
const l = lanesOf(rd('lanes.json'), { screens: out.flow ? new Set(out.flow.screens.map((x) => x.id)) : null }); if (!l.error) out.lanes = l;
|
|
379
418
|
const t = tweaksOf(rd('tweaks.json')); if (!t.error && t.tweaks.length) out.tweaks = t;
|
|
419
|
+
const nt = notesOf(rd('notes.json')); if (!nt.error && nt.notes.length) out.notes = nt;
|
|
380
420
|
const c = rd('copy.json'); if (isObj(c)) out.copy = c;
|
|
381
421
|
const e = editsOf(rd('edits.json')); if (Object.keys(e.copy).length || Object.keys(e.vars).length || Object.keys(e.styles).length) out.edits = e;
|
|
382
422
|
return out;
|
|
@@ -423,7 +463,12 @@ function saidOf(abs) {
|
|
|
423
463
|
function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
|
|
424
464
|
if (!ini) return '';
|
|
425
465
|
const wsf = ws ? ` --ws ${ws}` : '';
|
|
426
|
-
|
|
466
|
+
// every correction that is true of EVERY prototype becomes a check (initiative prototype-rules, lib/prototype-rules.js): the agent adds it
|
|
467
|
+
// itself, with no button, and PMOS keeps it only when it fails its bad example and passes its good one
|
|
468
|
+
const never = 'Never write the prototype yourself, never write an HTML file in the repository, a scratchpad or elsewhere, and never use `pmos lab file`: that is for the background lab only. '
|
|
469
|
+
+ 'When the PM\'s words are a rule for every prototype that a page can be checked for (e.g. "no device frame", "no instructions on the screen"), not a change to this version only and not a taste ("calmer"), '
|
|
470
|
+
+ 'also run `pmos lab rule add --json -` with { "title", "words": "<the PM\'s own words>", "tests": [{ "in": "text" | "attr" | "source", "re", "flags"? }], "bad": "<a small HTML page that breaks it>", "good": "<one that keeps it>" }. '
|
|
471
|
+
+ 'PMOS checks every version against it before it opens, and the PM sees it in Settings › PMOS › Prototype rules with Undo. Say so in one line.';
|
|
427
472
|
if (!cur || !cur.file) {
|
|
428
473
|
// no version is the prototype yet: list what exists, so "improve the prototype" continues the one the PM means, never a new file
|
|
429
474
|
const vs = (versions || []).filter((v) => v && v.file).slice(0, 6);
|
|
@@ -440,7 +485,7 @@ function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
|
|
|
440
485
|
+ 'never delete the folder by hand, and say in one line what was deleted and that "undo" brings it back (`pmos lab undo <batch>`, the batch it prints). ';
|
|
441
486
|
const abs = (rt && LAB.specimenPath(rt, cur.file)) || cur.file, dir = path.dirname(abs);
|
|
442
487
|
return `[PMOS] This initiative's prototype is Version ${cur.n} (${cur.key}${cur.said ? ': "' + one(cur.said, 140) + '"' : ''}), open in the Viewer beside this chat. `
|
|
443
|
-
+ `Its files are in ${dir}: ${path.basename(abs)} (the prototype), flow.json, lanes.json, copy.json, tweaks.json, and edits.json (the PM's own edits in the Viewer). Read them to answer questions about it. `
|
|
488
|
+
+ `Its files are in ${dir}: ${path.basename(abs)} (the prototype), flow.json, lanes.json, copy.json, tweaks.json, notes.json, and edits.json (the PM's own edits in the Viewer). Read them to answer questions about it. `
|
|
444
489
|
+ `To change, improve or rebuild it, in any words, run exactly: \`pmos lab round ${ini}${wsf} --base ${cur.key} --chat --brief "<what to change, with the PM's words and anything you read, under 600 characters>"\` `
|
|
445
490
|
+ `and say in one line what will change: PMOS makes Version ${cur.n + 1} in about a minute and tells you when it is in the Viewer. ` + del(cur) + never;
|
|
446
491
|
}
|
|
@@ -449,7 +494,8 @@ function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
|
|
|
449
494
|
const fin = (x) => x.state === 'ok' || x.state === 'not made' || x.state === 'none';
|
|
450
495
|
const partsLine = (s) => Object.fromEntries((s.parts || []).map((x) => [x.kind, x.state === 'not made' ? 'not made: ' + one(x.why, 120) : x.state]));
|
|
451
496
|
function roundLine(R, now) {
|
|
452
|
-
const slots = R.slots.map((s) => ({ key: s.key, title: s.title, state: s.state, ...(s.file && s.state === 'ok' ? { file: s.file } : {}), ...(s.why ? { why: one(s.why, 200) } : {}), ...(s.dims ? { dims: s.dims } : {}), ...(s.said ? { said: s.said } : {}), ...(s.progress && s.state === 'working' ? { progress: s.progress } : {}), ...((s.parts || []).length ? { parts: partsLine(s) } : {})
|
|
497
|
+
const slots = R.slots.map((s) => ({ key: s.key, title: s.title, state: s.state, ...(s.file && s.state === 'ok' ? { file: s.file } : {}), ...(s.why ? { why: one(s.why, 200) } : {}), ...(s.dims ? { dims: s.dims } : {}), ...(s.said ? { said: s.said } : {}), ...(s.progress && (s.state === 'working' || s.state === 'proving') ? { progress: s.progress } : {}), ...((s.parts || []).length ? { parts: partsLine(s) } : {}),
|
|
498
|
+
...(s.fixed ? { fixed: s.fixed } : {}), ...(s.missed && s.missed.length ? { missed: s.missed.slice(0, 6) } : {}) }));
|
|
453
499
|
const ok = R.slots.filter((s) => s.state === 'ok');
|
|
454
500
|
const done = R.slots.every((s) => fin(s) && (s.parts || []).every(fin));
|
|
455
501
|
const checked = ok.length ? (ok.length === 1 ? 'It opened and rendered' : `All ${ok.length} opened and rendered`) + ' in a headless browser (' + ok.map((s) => s.dims).join(', ') + ')' : '';
|
|
@@ -477,6 +523,8 @@ function create(deps) {
|
|
|
477
523
|
const warn = deps.warn || (() => {});
|
|
478
524
|
const now = () => (deps.now ? deps.now() : Date.now());
|
|
479
525
|
const render = deps.render || ((abs) => E.renderCheck(abs, { phone: true })); // proven at 390 px too: the viewport pin
|
|
526
|
+
// the PM's prototype rules (lib/prototype-rules.js), read for each version so an Undo in Settings counts at once
|
|
527
|
+
const rulesOf = deps.rules || (() => { try { return RULES.active(deps.runtimeDir ? deps.runtimeDir() : null); } catch (e) { warn('prototype rules', e); return []; } });
|
|
480
528
|
const pollMs = deps.pollMs || 1000;
|
|
481
529
|
const rounds = new Map(); // id → round
|
|
482
530
|
|
|
@@ -614,13 +662,37 @@ function create(deps) {
|
|
|
614
662
|
async function prove(R, s, cost = null) {
|
|
615
663
|
if (s.state !== 'working') return;
|
|
616
664
|
s.state = 'proving';
|
|
665
|
+
return verify(R, s, cost);
|
|
666
|
+
}
|
|
667
|
+
/** Render the version, then run the PM's rules on it. A first failure starts the one fix run; after it, the version opens either way. */
|
|
668
|
+
async function verify(R, s, cost = null) {
|
|
617
669
|
let st = null; try { st = fs.statSync(s.abs); } catch { st = null; }
|
|
618
670
|
let v;
|
|
619
671
|
if (!st || !st.isFile()) v = { ok: false, why: 'the run ended without writing its file' };
|
|
620
672
|
else if (st.size > 2e6) v = { ok: false, why: 'the file is over 2 MB' };
|
|
621
673
|
else { try { v = await render(s.abs); } catch (e) { v = { ok: false, why: 'it did not open: ' + one(e && e.message, 120) }; } }
|
|
622
674
|
if (s.state !== 'proving') return; // stopped while it rendered (Undo, the budget)
|
|
675
|
+
const fx = s.fixing || null;
|
|
676
|
+
if ((!v || !v.ok) && fx && fx.draft) {
|
|
677
|
+
// the fix broke the render: the draft that rendered comes back, and the version opens with the rules it breaks
|
|
678
|
+
try { fs.copyFileSync(fx.draft, s.abs); } catch (e) { warn('prototype rules draft', e); }
|
|
679
|
+
v = fx.v; fx.left = fx.failed;
|
|
680
|
+
}
|
|
623
681
|
if (!v || !v.ok) { s.state = 'working'; return notMade(R, s, 'not proven: ' + ((v && v.why) || 'it did not render')); }
|
|
682
|
+
if (!fx) {
|
|
683
|
+
let failed = []; try { failed = RULES.run(fs.readFileSync(s.abs, 'utf8'), rulesOf()); } catch (e) { warn('prototype rules', e); failed = []; }
|
|
684
|
+
if (failed.length && fix(R, s, failed, v, cost)) return;
|
|
685
|
+
} else if (!fx.left) {
|
|
686
|
+
try { fx.left = RULES.run(fs.readFileSync(s.abs, 'utf8'), fx.failed.map((f) => rulesOf().find((r) => r.id === f.id)).filter(Boolean)); } catch (e) { warn('prototype rules', e); fx.left = fx.failed; }
|
|
687
|
+
}
|
|
688
|
+
const fd = s.fixing || null; // set by fix(), also when its run could not start
|
|
689
|
+
if (fd) {
|
|
690
|
+
const left = new Set((fd.left || []).map((f) => f.id));
|
|
691
|
+
s.fixed = fd.failed.filter((f) => !left.has(f.id)).length;
|
|
692
|
+
s.missed = (fd.left || []).map((f) => f.title);
|
|
693
|
+
s.progress = null;
|
|
694
|
+
if (fd.cost !== null) cost = cost === null ? fd.cost : Math.round((cost + fd.cost) * 10000) / 10000;
|
|
695
|
+
}
|
|
624
696
|
s.state = 'ok'; s.dims = `${v.w}×${v.h}`; s.said = saidOf(s.abs);
|
|
625
697
|
// copy.json is PMOS's, read from the prototype's own words, so the Page copy card can never disagree with the screen
|
|
626
698
|
try { fs.writeFileSync(path.join(path.dirname(s.abs), 'copy.json'), JSON.stringify(copyOf(fs.readFileSync(s.abs, 'utf8')), null, 1)); } catch (e) { warn('live round copy', e); }
|
|
@@ -631,12 +703,47 @@ function create(deps) {
|
|
|
631
703
|
if (deps.artefact && R.slots.length === 1 && R.from !== 'cli') try { deps.artefact(R.dir, { scope: 'experiment:' + R.ini, artefact: 'specimens', field: 'kept', text: one(`Version ${R.n}: ${s.said || s.title} (${LAB.specimenUrl(s.file)})`, 600), sources: [{ label: 'live round', ref: LAB.specimenUrl(s.file) }] }, 'agent:live-round'); } catch (e) { warn('live round kept', e); }
|
|
632
704
|
write(R); settle(R);
|
|
633
705
|
}
|
|
634
|
-
/**
|
|
706
|
+
/** The one fix run: the draft is kept, the run gets only the failed lines and writes the same file. false when it could not start. */
|
|
707
|
+
function fix(R, s, failed, v, cost) {
|
|
708
|
+
const fx = { failed, v, cost: Number.isFinite(cost) ? cost : null, draft: s.abs.replace(/\.html$/, '.draft.html'), session: null, run: s.run + '-fix', done: false, left: null };
|
|
709
|
+
try { fs.copyFileSync(s.abs, fx.draft); } catch (e) { warn('prototype rules draft', e); fx.draft = ''; }
|
|
710
|
+
s.fixing = fx;
|
|
711
|
+
s.progress = { now: `Fixing ${failed.length === 1 ? '1 thing' : failed.length + ' things'} before you see it`, done: 0, total: 0 };
|
|
712
|
+
try { s.size = fs.statSync(s.abs).size; } catch { s.size = -1; }
|
|
713
|
+
E.appendRun(R.rt, { kind: 'start', run: fx.run, job: JOB, ws: R.ws, ini: R.ini, key: `live:${R.id}:${s.key}:fix`, budget: 0, step: R.step, from: R.from }, now());
|
|
714
|
+
let session = null;
|
|
715
|
+
try {
|
|
716
|
+
session = deps.spawn({ name: 'Fixing ' + s.key + ' · ' + one(failed.map((f) => f.title).join(', '), 50), agent: 'claude', ws: R.ws, origin: `${ORIGIN}:${R.ws}:${R.ini}:${fx.run}:${s.key}`,
|
|
717
|
+
initialInput: fixPromptOf({ file: s.abs, dir: path.dirname(s.abs), failed }) + '\r', initiative: R.ini, writePaths: [path.dirname(s.abs)], addDirs: [],
|
|
718
|
+
onDone: (res) => { fixEnded(R, s, res).catch((e) => warn('prototype rules fix end', e)); } });
|
|
719
|
+
} catch (e) { warn('prototype rules fix spawn', e); }
|
|
720
|
+
if (!session || session.state === 'exited' || session.headless !== JOB) {
|
|
721
|
+
if (session && session.state !== 'exited' && deps.stop) try { deps.stop(session); } catch { /* best effort */ }
|
|
722
|
+
s.fixing = null; s.progress = null;
|
|
723
|
+
try { E.appendRun(R.rt, { kind: 'end', run: fx.run, ok: false, cost: null, ms: 0, filed: 0, dropped: ['the fix run could not start'] }, now()); } catch { /* the version opens anyway */ }
|
|
724
|
+
s.fixing = { ...fx, left: failed, draft: '' }; // it opens with the rules it breaks, never hidden
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
fx.session = session;
|
|
728
|
+
write(R);
|
|
729
|
+
return true;
|
|
730
|
+
}
|
|
731
|
+
async function fixEnded(R, s, res = {}) {
|
|
732
|
+
const fx = s.fixing; if (!fx || fx.done) return;
|
|
733
|
+
fx.done = true;
|
|
734
|
+
const out = (res && res.result) || {};
|
|
735
|
+
const c = Number.isFinite(out.costUsd) ? Math.round(out.costUsd * 10000) / 10000 : null;
|
|
736
|
+
if (c !== null) fx.cost = fx.cost === null ? c : fx.cost + c;
|
|
737
|
+
try { E.appendRun(R.rt, { kind: 'end', run: fx.run, ok: true, cost: c, ms: Math.max(0, now() - R.start), filed: 0, dropped: [] }, now()); } catch { /* the card says it */ }
|
|
738
|
+
if (s.state !== 'proving') return;
|
|
739
|
+
return verify(R, s, null);
|
|
740
|
+
}
|
|
741
|
+
/** A companion lands: it must parse and be well formed (flowOf, lanesOf, tweaksOf, notesOf), else it is "not made" with the reason. */
|
|
635
742
|
function provePart(R, s, x) {
|
|
636
743
|
if (x.state !== 'working') return;
|
|
637
744
|
let j = null, err = '';
|
|
638
745
|
try { j = JSON.parse(fs.readFileSync(x.abs, 'utf8')); } catch (e) { err = x.name + ' is not JSON'; }
|
|
639
|
-
if (!err) { const v = x.kind === 'flow' ? flowOf(j) : x.kind === 'lanes' ? lanesOf(j) : tweaksOf(j); if (v.error) err = v.error; }
|
|
746
|
+
if (!err) { const v = x.kind === 'flow' ? flowOf(j) : x.kind === 'lanes' ? lanesOf(j) : x.kind === 'notes' ? notesOf(j) : tweaksOf(j); if (v.error) err = v.error; }
|
|
640
747
|
if (err) return partNotMade(R, s, x, err);
|
|
641
748
|
x.state = 'ok';
|
|
642
749
|
write(R); settle(R);
|
|
@@ -648,6 +755,8 @@ function create(deps) {
|
|
|
648
755
|
let pj = null; try { pj = progressOf(JSON.parse(fs.readFileSync(path.join(path.dirname(s.abs), 'progress.json'), 'utf8'))); } catch { pj = null; }
|
|
649
756
|
if (pj && JSON.stringify(pj) !== JSON.stringify(s.progress || null)) { s.progress = pj; R.seen = now(); write(R); }
|
|
650
757
|
}
|
|
758
|
+
// a fix run that writes is making progress
|
|
759
|
+
if (s.fixing && !s.fixing.done && s.abs) { let z = -1; try { z = fs.statSync(s.abs).size; } catch { z = -1; } if (z !== s.size) { s.size = z; R.seen = now(); } }
|
|
651
760
|
for (const x of s.state === 'not made' ? [] : [s, ...(s.parts || [])]) {
|
|
652
761
|
if (x.state !== 'working') continue;
|
|
653
762
|
let size = -1; try { size = fs.statSync(x.abs).size; } catch { size = -1; }
|
|
@@ -678,6 +787,8 @@ function create(deps) {
|
|
|
678
787
|
const busy = [s, ...(s.parts || [])].some((x) => x.state === 'working');
|
|
679
788
|
if (busy && s.session && s.session.state !== 'exited' && deps.stop) try { deps.stop(s.session); } catch { /* best effort */ }
|
|
680
789
|
if (s.state === 'working') notMade(R, s, why); // a file being proven finishes its proof
|
|
790
|
+
// a fix run that stalls ends: the version opens as the fix left it, or as the draft
|
|
791
|
+
if (s.fixing && !s.fixing.done) { if (s.fixing.session && s.fixing.session.state !== 'exited' && deps.stop) try { deps.stop(s.fixing.session); } catch { /* best effort */ } fixEnded(R, s, { stopped: true }).catch((e) => warn('prototype rules fix end', e)); }
|
|
681
792
|
for (const x of s.parts || []) partNotMade(R, s, x, why);
|
|
682
793
|
}
|
|
683
794
|
}
|
|
@@ -714,6 +825,7 @@ function create(deps) {
|
|
|
714
825
|
const R = rounds.get(id);
|
|
715
826
|
if (R) for (const s of R.slots) {
|
|
716
827
|
if (s.session && s.session.state !== 'exited' && deps.stop && [s, ...(s.parts || [])].some((x) => x.state === 'working' || x.state === 'proving')) try { deps.stop(s.session); } catch { /* best effort */ }
|
|
828
|
+
if (s.fixing && s.fixing.session && !s.fixing.done && s.fixing.session.state !== 'exited' && deps.stop) { s.fixing.done = true; try { deps.stop(s.fixing.session); } catch { /* best effort */ } }
|
|
717
829
|
if (s.state === 'working' || s.state === 'proving') { s.state = 'working'; notMade(R, s, why); }
|
|
718
830
|
for (const x of s.parts || []) partNotMade(R, s, x, why);
|
|
719
831
|
}
|
|
@@ -750,6 +862,6 @@ function running(ini) { return inst ? inst.running(ini) : false; }
|
|
|
750
862
|
function stopRound(id) { return inst ? inst.stop(id) : { ok: false, error: NOT_READY }; }
|
|
751
863
|
function status() { return inst ? inst.status() : []; }
|
|
752
864
|
|
|
753
|
-
module.exports = { DELETE_RE, JOB, ORIGIN, STALL_MS, progressOf, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, saidOf, roundLine,
|
|
754
|
-
flowOf, lanesOf, tweaksOf, copyOf, changesOf, partsAt, editsOf, styleWords, STYLE_OK,
|
|
865
|
+
module.exports = { DELETE_RE, JOB, ORIGIN, STALL_MS, progressOf, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, fixPromptOf, saidOf, roundLine,
|
|
866
|
+
flowOf, lanesOf, tweaksOf, notesOf, copyOf, changesOf, partsAt, editsOf, styleWords, STYLE_OK,
|
|
755
867
|
create, install, round, startNow, proposeNow, cancel, stopRound, dropCard, running, status };
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* data-screen one screen shows at a time; the first is the start data-go a tap moves to that screen
|
|
8
8
|
* data-el what the PM can point at, comment on or tap in Play data-label its name in plain words
|
|
9
9
|
* data-copy text the Page copy card edits in place :root vars what Tweaks change
|
|
10
|
-
* Parent → frame { pmos: 1, t }: mode (view | point | comment | play), screen, copy, copyAll, vars, styles (the inspector's, all of them), hint, sel, pins.
|
|
11
|
-
* Frame → parent { pmos: 1, t }: ready (screens with their data-page, els with their screen and copy key, copy), screen,
|
|
10
|
+
* Parent → frame { pmos: 1, t }: mode (view | point | comment | play), screen, copy, copyAll, vars, styles (the inspector's, all of them), hint, sel, pins, box (measure again).
|
|
11
|
+
* Frame → parent { pmos: 1, t }: ready (screens with their data-page, els with their screen and copy key, copy), screen, box (the design's
|
|
12
|
+
* own box on the screen shown, and the page's size: Design crops the frame to it), point (with looks: the
|
|
12
13
|
* selected element's current styles), looks (after styles), pin, tap.
|
|
13
14
|
*
|
|
14
15
|
* withRuntime(html) → html with the runtime's <script> before </body> (or at the end) */
|
|
@@ -31,6 +32,32 @@ function runtime() {
|
|
|
31
32
|
all.forEach(function (s) { s.classList.toggle('pmos-on', s === on); });
|
|
32
33
|
window.scrollTo(0, 0);
|
|
33
34
|
post({ t: 'screen', id: on.getAttribute('data-screen') });
|
|
35
|
+
box();
|
|
36
|
+
};
|
|
37
|
+
// the design's own box on the screen shown (Wawan 2026-11-18: Design shows only the actual design): the union of what draws something
|
|
38
|
+
// (text, a fill, a border, an image or a control), so the canvas can crop the frame to it. The page's own background does not count.
|
|
39
|
+
var drawn = function (e, cs) {
|
|
40
|
+
if (/^(IMG|SVG|CANVAS|VIDEO|INPUT|BUTTON|SELECT|TEXTAREA|HR)$/i.test(e.tagName)) return true;
|
|
41
|
+
if (cs.backgroundImage !== 'none' || (cs.backgroundColor && !/^(transparent|rgba\(0, 0, 0, 0\))$/.test(cs.backgroundColor))) return true;
|
|
42
|
+
if (parseFloat(cs.borderTopWidth) || parseFloat(cs.borderLeftWidth) || parseFloat(cs.borderBottomWidth) || parseFloat(cs.borderRightWidth)) return true;
|
|
43
|
+
for (var n = e.firstChild; n; n = n.nextSibling) if (n.nodeType === 3 && /\S/.test(n.nodeValue)) return true;
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
var lastBox = '', box = function () {
|
|
47
|
+
var on = document.querySelector('[data-screen].pmos-on') || document.body; if (!on) return;
|
|
48
|
+
var x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
49
|
+
var list = [on].concat(Array.prototype.slice.call(on.querySelectorAll('*')));
|
|
50
|
+
list.forEach(function (e) {
|
|
51
|
+
if (e.closest && e.closest('.pmos-pin')) return;
|
|
52
|
+
var cs = window.getComputedStyle(e); if (cs.display === 'none' || cs.visibility === 'hidden' || !drawn(e, cs)) return;
|
|
53
|
+
var r = e.getBoundingClientRect(); if (r.width < 1 || r.height < 1) return;
|
|
54
|
+
x0 = Math.min(x0, r.left + window.scrollX); y0 = Math.min(y0, r.top + window.scrollY);
|
|
55
|
+
x1 = Math.max(x1, r.right + window.scrollX); y1 = Math.max(y1, r.bottom + window.scrollY);
|
|
56
|
+
});
|
|
57
|
+
var W = document.documentElement.scrollWidth, H = document.documentElement.scrollHeight;
|
|
58
|
+
var m = { t: 'box', docW: W, docH: H };
|
|
59
|
+
if (x0 !== Infinity) { var pad = 12; m.x = Math.max(0, Math.floor(x0 - pad)); m.y = Math.max(0, Math.floor(y0 - pad)); m.w = Math.min(W, Math.ceil(x1 + pad)) - m.x; m.h = Math.min(H, Math.ceil(y1 + pad)) - m.y; }
|
|
60
|
+
var k = JSON.stringify(m); if (k === lastBox) return; lastBox = k; post(m);
|
|
34
61
|
};
|
|
35
62
|
var elOf = function (n) { return n && n.closest ? n.closest('[data-el]') : null; };
|
|
36
63
|
var info = function (e) {
|
|
@@ -120,12 +147,18 @@ function runtime() {
|
|
|
120
147
|
var se = document.querySelector('.pmos-sel'); if (se) post({ t: 'looks', el: se.getAttribute('data-el') || '', looks: looks(se) });
|
|
121
148
|
}
|
|
122
149
|
else if (m.t === 'pins') pins(m.pins);
|
|
150
|
+
else if (m.t === 'box') { lastBox = ''; box(); }
|
|
151
|
+
if (m.t === 'copy' || m.t === 'copyAll' || m.t === 'vars' || m.t === 'styles') box();
|
|
123
152
|
});
|
|
124
153
|
var start = function () {
|
|
125
154
|
var all = screens(); if (all.length) all[0].classList.add('pmos-on');
|
|
126
155
|
var copy = {}; Array.prototype.forEach.call(document.querySelectorAll('[data-copy]'), function (x) { var k = x.getAttribute('data-copy'); if (!(k in copy)) copy[k] = (x.textContent || '').trim(); });
|
|
127
156
|
post({ t: 'ready', screens: all.map(function (s) { return { id: s.getAttribute('data-screen'), label: s.getAttribute('data-label') || '', page: s.getAttribute('data-page') || '' }; }),
|
|
128
157
|
els: Array.prototype.map.call(document.querySelectorAll('[data-el]'), function (e) { return info(e); }), copy: copy });
|
|
158
|
+
box();
|
|
159
|
+
// fonts, images and the PM's own edits can move the design: measure again when the page settles or changes size
|
|
160
|
+
window.addEventListener('load', box); window.addEventListener('resize', box);
|
|
161
|
+
if (window.ResizeObserver) try { new ResizeObserver(function () { box(); }).observe(document.body); } catch (e) { /* old browser */ }
|
|
129
162
|
};
|
|
130
163
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
131
164
|
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* prototype-rules.js — the PM's prototype rules as checks (initiative prototype-rules, step 2 of the design "Prototypes right on the first
|
|
3
|
+
* try", agreed by Wawan 2026-11-18; Exploring 2 page pgFt, boards FtA and FtB). Each correction the PM makes that is true of EVERY prototype
|
|
4
|
+
* ("it should not have the desktop container") becomes a check. lib/live-round.js runs the list on each version after it renders
|
|
5
|
+
* (renderCheck) and before it opens; a version that fails gets ONE automatic fix run that quotes the failed lines.
|
|
6
|
+
*
|
|
7
|
+
* A CHECK EARNS ITS PLACE. A rule carries one bad and one good example. add() refuses a rule that does not fail its bad example AND pass its
|
|
8
|
+
* good one (the design's own first test called the button "See the week" an instruction and failed a clean version). Buttons and links are
|
|
9
|
+
* never read as instructions: their words are what the user taps.
|
|
10
|
+
*
|
|
11
|
+
* A RULE IS DATA, never code: each test is a regular expression over one part of the page:
|
|
12
|
+
* text the screen's visible words, one block per line, WITHOUT buttons, links, the head, scripts, styles and comments
|
|
13
|
+
* attr the class and id of every element in the body ("device-frame", "status-bar")
|
|
14
|
+
* source the whole file
|
|
15
|
+
* A rule fails when any of its tests matches; the matched line is quoted to the fix run and kept with the version.
|
|
16
|
+
*
|
|
17
|
+
* THE LEDGER. <runtime>/prototype-rules.jsonl, append-only: { at, by, kind: add | undo | restore, rule? | id }. The newest line for an id
|
|
18
|
+
* wins, so the PM's later words win. The three seed rules are today's corrections (2026-11-18) and are in effect unless the PM undoes them.
|
|
19
|
+
* An undone rule is not added again unless the PM says it again (add with again: true). Settings › PMOS › Prototype rules lists them with Undo.
|
|
20
|
+
*
|
|
21
|
+
* SEED · file(rt) · read(rt) → { rules: [rule + { on, seed, undoneAt? }] } · active(rt) → [rule]
|
|
22
|
+
* screenText(html) PURE → [line] · attrsOf(html) PURE → [quote] · run(html, rules) PURE → [{ id, title, words, lines }] (the failed ones)
|
|
23
|
+
* validate(rule) PURE → { rule } | { error } · earn(rule) PURE → { ok } | { ok: false, error }
|
|
24
|
+
* add(rt, rule, { by, again }) → { ok, rule } | { ok: false, error } · undo(rt, id, { by }) · restore(rt, id, { by }) */
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
|
|
28
|
+
const FILE = 'prototype-rules.jsonl';
|
|
29
|
+
const IN = Object.freeze(['text', 'attr', 'source']);
|
|
30
|
+
const MAX_TESTS = 6, MAX_RE = 300, MAX_EXAMPLE = 20000, MAX_QUOTES = 3;
|
|
31
|
+
const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
32
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
33
|
+
const ID_RE = /^[a-z0-9][a-z0-9-]{1,59}$/;
|
|
34
|
+
|
|
35
|
+
/* ── today's corrections (Wawan 2026-11-18, batch 31 and the design's Weather strip): each proven on its bad and good example (tests) ── */
|
|
36
|
+
const WEATHER = (body) => `<!doctype html><html><head><title>Weather strip</title><meta name="pmos-changed" content="The forecast for planners"><style>body{margin:0}</style></head><body>${body}</body></html>`;
|
|
37
|
+
const GOOD = WEATHER('<section data-screen="today" data-label="Today"><h1 data-copy="title">Jurong West, 31°</h1><p data-copy="detail">Light rain from 2 pm. Standees stay indoors.</p><button data-go="week">See the week</button><a href="#alerts">Tap for alerts</a></section>');
|
|
38
|
+
const SEED = Object.freeze([
|
|
39
|
+
Object.freeze({ id: 'no-frame', title: 'No device or browser frame', words: 'should not have the desktop container', at: '2026-11-18T00:00:00.000Z', by: 'pm:wawan',
|
|
40
|
+
tests: [{ in: 'attr', re: '(^|[^a-z0-9])(device|bezel|notch|status-?bar|phone-?(frame|shell|case)|browser-?(bar|chrome|frame|window)|window-?chrome|traffic-?lights?|home-?indicator|dynamic-?island|desktop-?(frame|container|window))([^a-z0-9]|$)', flags: 'i' },
|
|
41
|
+
{ in: 'text', re: '^9:41( ?[ap]m)?$', flags: 'i' }],
|
|
42
|
+
bad: WEATHER('<div class="device-frame"><div class="status-bar"><span>9:41</span></div><section data-screen="today"><h1>Jurong West, 31°</h1></section></div>'), good: GOOD }),
|
|
43
|
+
Object.freeze({ id: 'no-instructions', title: 'No instructions on the screen', words: 'In case of instruction, it should be put as comment or annotation.', at: '2026-11-18T00:00:00.000Z', by: 'pm:wawan',
|
|
44
|
+
tests: [{ in: 'text', re: '^(tap|click|press|swipe|scroll|drag|hover|try)\\b', flags: 'i' }, { in: 'text', re: '\\b\\d{3,5} ?[×x] ?\\d{3,5}\\b', flags: 'i' },
|
|
45
|
+
{ in: 'text', re: '\\bformat \\d+\\b|^(note|annotation|instructions?)\\s*:|\\bthis (screen|page|prototype|mock ?up) (shows|is)\\b', flags: 'i' }],
|
|
46
|
+
bad: WEATHER('<section data-screen="today"><p>Format 1 · 7680 × 1550</p><h1>Jurong West, 31°</h1><p>Tap a day to see the hours</p></section>'), good: GOOD }),
|
|
47
|
+
Object.freeze({ id: 'no-sample-copy', title: 'No sample or placeholder copy', words: 'From the 18 Nov corrections: no "Sample data" or placeholder notes on a screen.', at: '2026-11-18T00:00:00.000Z', by: 'pm:wawan',
|
|
48
|
+
tests: [{ in: 'text', re: 'lorem ipsum|\\bsample (data|text|copy|content)\\b|\\bplaceholder\\b|\\bdummy (data|text|copy)\\b|\\b(tbd|todo)\\b|\\b(john|jane) doe\\b|\\bexample\\.com\\b', flags: 'i' }],
|
|
49
|
+
bad: WEATHER('<section data-screen="today"><h1>Jurong West, 31°</h1><p>Sample data</p><p>Lorem ipsum dolor sit amet</p></section>'), good: GOOD }),
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
/* ── a page, read the way the checks read it ── */
|
|
53
|
+
const ENT = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ', mdash: '—', ndash: '–', hellip: '…', times: '×', middot: '·', deg: '°', rsquo: '’', lsquo: '‘', rdquo: '”', ldquo: '“' };
|
|
54
|
+
function decode(s) {
|
|
55
|
+
return String(s).replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (m, e) => {
|
|
56
|
+
if (e[0] === '#') { const n = e[1] === 'x' || e[1] === 'X' ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10); try { return String.fromCodePoint(n); } catch { return ' '; } }
|
|
57
|
+
return ENT[e.toLowerCase()] !== undefined ? ENT[e.toLowerCase()] : m;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const bodyOf = (html) => { const h = String(html || ''); const m = /<body\b[^>]*>([\s\S]*)$/i.exec(h); return (m ? m[1] : h.replace(/<head\b[\s\S]*?<\/head>/i, '')).replace(/<!--[\s\S]*?-->/g, ' '); };
|
|
61
|
+
/** PURE. The screen's visible words, one block per line: no head, scripts, styles or comments, and no buttons or links (what the user taps
|
|
62
|
+
* is never an instruction to the PM: the design's "See the week" false alarm). */
|
|
63
|
+
function screenText(html) {
|
|
64
|
+
let h = bodyOf(html).replace(/<(script|style|noscript|template|svg|title|button|a|select|textarea)\b[\s\S]*?<\/\1\s*>/gi, '\n');
|
|
65
|
+
h = h.replace(/<(br|hr)\b[^>]*>/gi, '\n').replace(/<\/?(p|div|li|ul|ol|h[1-6]|tr|td|th|table|section|article|header|footer|nav|main|aside|blockquote|pre|dd|dt|dl|figure|figcaption)\b[^>]*>/gi, '\n');
|
|
66
|
+
h = decode(h.replace(/<[^>]+>/g, ' '));
|
|
67
|
+
return h.split('\n').map((l) => l.replace(/\s+/g, ' ').trim()).filter(Boolean);
|
|
68
|
+
}
|
|
69
|
+
/** PURE. The class and id of every element in the body, each quoted as its opening tag (cut at 120 characters). */
|
|
70
|
+
function attrsOf(html) {
|
|
71
|
+
const out = [], re = /<([a-z][a-z0-9-]*)\b([^>]*)>/gi, b = bodyOf(html);
|
|
72
|
+
let m;
|
|
73
|
+
while ((m = re.exec(b)) && out.length < 5000) {
|
|
74
|
+
const a = m[2], vals = [];
|
|
75
|
+
for (const k of ['class', 'id']) { const x = new RegExp('\\b' + k + '\\s*=\\s*("([^"]*)"|\'([^\']*)\'|([^\\s>]+))', 'i').exec(a); if (x) vals.push(x[2] != null ? x[2] : x[3] != null ? x[3] : x[4]); }
|
|
76
|
+
if (vals.length) out.push({ value: vals.join(' '), quote: one(m[0], 120) });
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function regexOf(t) { try { return new RegExp(t.re, (t.flags || '').replace(/[^imsu]/g, '')); } catch { return null; } }
|
|
81
|
+
/** PURE. The rules a page breaks: [{ id, title, words, lines: [quoted line] }], in the rules' order; [] when it passes them all. */
|
|
82
|
+
function run(html, rules) {
|
|
83
|
+
const failed = [];
|
|
84
|
+
let text = null, attrs = null;
|
|
85
|
+
for (const r of rules || []) {
|
|
86
|
+
const lines = [];
|
|
87
|
+
for (const t of r.tests || []) {
|
|
88
|
+
const re = regexOf(t); if (!re) continue;
|
|
89
|
+
if (t.in === 'text') { text = text || screenText(html); for (const l of text) if (re.test(l) && !lines.includes(one(l, 160))) lines.push(one(l, 160)); }
|
|
90
|
+
else if (t.in === 'attr') { attrs = attrs || attrsOf(html); for (const a of attrs) if (re.test(a.value) && !lines.includes(a.quote)) lines.push(a.quote); }
|
|
91
|
+
else if (t.in === 'source') { const m = re.exec(String(html || '')); if (m) lines.push(one(m[0], 160)); }
|
|
92
|
+
if (lines.length >= MAX_QUOTES) break;
|
|
93
|
+
}
|
|
94
|
+
if (lines.length) failed.push({ id: r.id, title: r.title, words: r.words || '', lines: lines.slice(0, MAX_QUOTES) });
|
|
95
|
+
}
|
|
96
|
+
return failed;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* ── a rule ── */
|
|
100
|
+
/** PURE. A rule as the agent wrote it → { rule } | { error }: an id, a title, the PM's words, 1 to 6 tests that compile, both examples. */
|
|
101
|
+
function validate(r) {
|
|
102
|
+
if (!isObj(r)) return { error: 'a rule is a JSON object' };
|
|
103
|
+
const title = one(r.title, 80), words = one(r.words, 300);
|
|
104
|
+
const id = ID_RE.test(String(r.id || '')) ? r.id : one(title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''), 60);
|
|
105
|
+
if (!title) return { error: 'title names the rule in a few plain words, e.g. "No device or browser frame"' };
|
|
106
|
+
if (!words) return { error: 'words are the PM\'s own sentence the rule comes from' };
|
|
107
|
+
if (!ID_RE.test(id)) return { error: 'id is a short kebab-case name' };
|
|
108
|
+
const tests = Array.isArray(r.tests) ? r.tests.slice(0, MAX_TESTS + 1) : [];
|
|
109
|
+
if (!tests.length || tests.length > MAX_TESTS) return { error: `tests are 1 to ${MAX_TESTS} of { "in": "text" | "attr" | "source", "re": "<regular expression>", "flags"?: "i" }` };
|
|
110
|
+
const out = [];
|
|
111
|
+
for (const t of tests) {
|
|
112
|
+
if (!isObj(t) || !IN.includes(t.in)) return { error: 'each test reads "text" (the screen\'s words, no buttons or links), "attr" (class and id) or "source"' };
|
|
113
|
+
const re = String(t.re || ''); if (!re || re.length > MAX_RE) return { error: `each test has a regular expression under ${MAX_RE} characters` };
|
|
114
|
+
const flags = String(t.flags || '').replace(/[^imsu]/g, '');
|
|
115
|
+
if (!regexOf({ re, flags })) return { error: 'this is not a regular expression: ' + one(re, 80) };
|
|
116
|
+
out.push({ in: t.in, re, ...(flags ? { flags } : {}) });
|
|
117
|
+
}
|
|
118
|
+
const bad = String(r.bad || ''), good = String(r.good || '');
|
|
119
|
+
if (!bad || !good || bad.length > MAX_EXAMPLE || good.length > MAX_EXAMPLE) return { error: 'bad and good are two small HTML pages: one the rule must fail, one it must pass' };
|
|
120
|
+
return { rule: { id, title, words, tests: out, bad, good } };
|
|
121
|
+
}
|
|
122
|
+
/** PURE. A rule earns its place when it fails its bad example and passes its good one. */
|
|
123
|
+
function earn(rule) {
|
|
124
|
+
const bad = run(rule.bad, [rule]), good = run(rule.good, [rule]);
|
|
125
|
+
if (!bad.length) return { ok: false, error: 'the rule does not catch its bad example, so it would catch nothing' };
|
|
126
|
+
if (good.length) return { ok: false, error: 'the rule fails its good example (a false alarm on "' + one(good[0].lines[0], 80) + '"): narrow it' };
|
|
127
|
+
return { ok: true };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* ── the ledger ── */
|
|
131
|
+
const file = (rt) => path.join(rt, FILE);
|
|
132
|
+
function lines(rt) {
|
|
133
|
+
if (!rt) return [];
|
|
134
|
+
let raw = ''; try { raw = fs.readFileSync(file(rt), 'utf8'); } catch { return []; }
|
|
135
|
+
const out = [];
|
|
136
|
+
for (const l of raw.split('\n')) { if (!l) continue; try { const j = JSON.parse(l); if (isObj(j)) out.push(j); } catch { /* a torn line */ } }
|
|
137
|
+
return out;
|
|
138
|
+
}
|
|
139
|
+
/** Every rule, seeds first, then the PM's own, with its state: on, seed, undoneAt. */
|
|
140
|
+
function read(rt) {
|
|
141
|
+
const m = new Map();
|
|
142
|
+
for (const s of SEED) m.set(s.id, { ...s, tests: s.tests.map((t) => ({ ...t })), on: true, seed: true });
|
|
143
|
+
for (const l of lines(rt)) {
|
|
144
|
+
if (l.kind === 'add' && isObj(l.rule)) { const v = validate(l.rule); if (v.rule) m.set(v.rule.id, { ...v.rule, at: l.at, by: l.by || null, on: true, seed: false }); }
|
|
145
|
+
else if ((l.kind === 'undo' || l.kind === 'restore') && m.has(l.id)) { const r = m.get(l.id); r.on = l.kind === 'restore'; if (l.kind === 'undo') r.undoneAt = l.at; else delete r.undoneAt; }
|
|
146
|
+
}
|
|
147
|
+
return { rules: [...m.values()] };
|
|
148
|
+
}
|
|
149
|
+
const active = (rt) => read(rt).rules.filter((r) => r.on);
|
|
150
|
+
function append(rt, line) { fs.mkdirSync(rt, { recursive: true }); fs.appendFileSync(file(rt), JSON.stringify(line) + '\n'); }
|
|
151
|
+
/** Add (or, with the same id, replace: the PM's later words win) a rule, once it earns its place. An undone rule needs again: true. */
|
|
152
|
+
function add(rt, raw, { by = 'agent:cli', again = false, now = Date.now() } = {}) {
|
|
153
|
+
if (!rt) return { ok: false, error: 'no runtime state folder' };
|
|
154
|
+
const v = validate(raw); if (v.error) return { ok: false, error: v.error };
|
|
155
|
+
const e = earn(v.rule); if (!e.ok) return e;
|
|
156
|
+
const cur = read(rt).rules.find((r) => r.id === v.rule.id);
|
|
157
|
+
if (cur && !cur.on && !again) return { ok: false, error: `the PM undid "${cur.title}". Add it again only when the PM says it again (again: true, --again)` };
|
|
158
|
+
append(rt, { at: new Date(now).toISOString(), by, kind: 'add', rule: v.rule });
|
|
159
|
+
if (cur && !cur.on) append(rt, { at: new Date(now).toISOString(), by, kind: 'restore', id: v.rule.id });
|
|
160
|
+
return { ok: true, rule: { id: v.rule.id, title: v.rule.title }, replaced: !!cur };
|
|
161
|
+
}
|
|
162
|
+
function turn(kind) {
|
|
163
|
+
return (rt, id, { by = 'pm:page', now = Date.now() } = {}) => {
|
|
164
|
+
if (!rt) return { ok: false, error: 'no runtime state folder' };
|
|
165
|
+
const cur = read(rt).rules.find((r) => r.id === id);
|
|
166
|
+
if (!cur) return { ok: false, error: 'there is no such prototype rule' };
|
|
167
|
+
if (cur.on === (kind === 'restore')) return { ok: true, rule: { id, title: cur.title }, same: true };
|
|
168
|
+
append(rt, { at: new Date(now).toISOString(), by, kind, id });
|
|
169
|
+
return { ok: true, rule: { id, title: cur.title } };
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
const undo = turn('undo'), restore = turn('restore');
|
|
173
|
+
/** What the page shows: no tests or examples, only what the PM reads. */
|
|
174
|
+
const listOf = (rt) => read(rt).rules.map((r) => ({ id: r.id, title: r.title, words: r.words, at: r.at, on: r.on, seed: !!r.seed, ...(r.undoneAt ? { undoneAt: r.undoneAt } : {}) }));
|
|
175
|
+
|
|
176
|
+
module.exports = { FILE, SEED, file, read, active, listOf, screenText, attrsOf, run, validate, earn, add, undo, restore };
|
|
@@ -16,13 +16,16 @@
|
|
|
16
16
|
* POST /api/lab/round { ws?, board?, ini, brief, base?, dirs?, propose? } → the live round (lib/live-round.js): `pmos lab round` starts one,
|
|
17
17
|
* or with propose: true files its ✦ ask. No page press needed (D98); it writes no record.
|
|
18
18
|
* Prototype by chatting (initiative live-round-iterative): the compare view of a live round carries its version's companions as data
|
|
19
|
-
* (data: { flow, lanes, copy, tweaks, edits }, lib/live-round.js partsAt) and the initiative's comments; GET /api/lab/specimen with rt=1
|
|
19
|
+
* (data: { flow, lanes, copy, tweaks, notes, edits }, lib/live-round.js partsAt) and the initiative's comments; GET /api/lab/specimen with rt=1
|
|
20
20
|
* adds the canvas runtime (lib/proto-runtime.js) inside the same sandbox, so the canvas can point, pin, play and edit through postMessage.
|
|
21
21
|
* POST /api/lab/edit { ws, file, copy?: { key: text }, vars?: { --var: value }, styles?: { el: { prop: value } | null } } → { ok } the PM's in-place copy edits, tweaks and inspector styles,
|
|
22
22
|
* kept with the version (edits.json next to it); the next version reads them
|
|
23
23
|
* POST /api/lab/delete { ws, ini, file? | n?, key? } → { ok, batch, said, deleted, next } delete one prototype version (no file and no n:
|
|
24
24
|
* the prototype now); next: what the Viewer opens instead, or null. `pmos lab delete` reaches it too
|
|
25
25
|
* POST /api/lab/restore { ws, batch } → { ok, said, back } Undo of that delete (`pmos lab undo <batch>`)
|
|
26
|
+
* GET /api/lab/rules → { ok, rules: [{ id, title, words, at, on, seed, undoneAt? }] } the PM's prototype rules (lib/prototype-rules.js)
|
|
27
|
+
* POST /api/lab/rules { op: add, rule, again? } | { op: undo | restore, id } → { ok, rule } add: `pmos lab rule add` (the chat's agent, no
|
|
28
|
+
* Origin, D98); undo and restore: Settings › PMOS › Prototype rules (a page press)
|
|
26
29
|
* POST /api/lab/comment { ws, ini, file, el?, label?, text, x?, y?, send? } → { ok, id } a comment pinned to an element (send: it was
|
|
27
30
|
* sent to PMOS as the next change; else it is kept for the team)
|
|
28
31
|
*
|
|
@@ -109,6 +112,7 @@ function others(ctx, w, dir, T, now) {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
const READS = {
|
|
115
|
+
'/api/lab/rules': (ctx, res) => { ctx.json(res, { ok: true, rules: require('./prototype-rules.js').listOf(ctx.runtimeDir) }); return true; },
|
|
112
116
|
'/api/lab': (ctx, res, url) => {
|
|
113
117
|
const w = wsOf(ctx, url.searchParams.get('ws')); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
114
118
|
const dir = dirOf(ctx, w); if (!dir) { ctx.json(res, { ok: true, lab: null }); return true; }
|
|
@@ -326,6 +330,17 @@ function liveRound(ctx, res, b) {
|
|
|
326
330
|
ctx.json(res, r);
|
|
327
331
|
return true;
|
|
328
332
|
}
|
|
333
|
+
/** POST /api/lab/rules: add (once it earns its place), undo or restore one of the PM's prototype rules. */
|
|
334
|
+
function protoRules(ctx, res, b, by) {
|
|
335
|
+
const RU = require('./prototype-rules.js'), rt = ctx.runtimeDir;
|
|
336
|
+
if (!rt) return fail(ctx, res, 409, 'no runtime state folder');
|
|
337
|
+
const op = String(b.op || '');
|
|
338
|
+
const r = op === 'add' ? RU.add(rt, b.rule, { by, again: b.again === true })
|
|
339
|
+
: op === 'undo' || op === 'restore' ? RU[op](rt, String(b.id || ''), { by }) : { ok: false, error: 'op is add, undo or restore' };
|
|
340
|
+
if (!r.ok) return fail(ctx, res, op === 'add' ? 422 : 404, r.error);
|
|
341
|
+
ctx.json(res, r);
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
329
344
|
const readsDrop = (dir, b) => LAB.readLines(LAB.ledgerFile(dir)).some((l) => l.kind === 'drop' && l.batch === b);
|
|
330
345
|
|
|
331
346
|
module.exports = {
|
|
@@ -335,12 +350,19 @@ module.exports = {
|
|
|
335
350
|
if (req.method === 'GET') { const fn = READS[p0]; if (!fn) return fail(ctx, res, 404, 'not found'); return fn(ctx, res, url); }
|
|
336
351
|
if (req.method !== 'POST') return fail(ctx, res, 405, 'GET or POST only');
|
|
337
352
|
const fn = WRITES[p0];
|
|
338
|
-
if (!fn && !['/api/lab/round', '/api/lab/delete', '/api/lab/restore'].includes(p0)) return fail(ctx, res, 404, 'not found');
|
|
353
|
+
if (!fn && !['/api/lab/round', '/api/lab/delete', '/api/lab/restore', '/api/lab/rules'].includes(p0)) return fail(ctx, res, 404, 'not found');
|
|
339
354
|
const got = await ctx.readJson(req);
|
|
340
355
|
if (!got.ok || !isObj(got.body)) return fail(ctx, res, 400, 'the body must be a JSON object');
|
|
341
356
|
// the live round (lib/live-round.js): `pmos lab round` reaches it with no Origin (D98: an agent does what it was asked; the PM's own
|
|
342
357
|
// terminal too). It starts a round, or with propose: true only files the ✦ ask the PM's ✓ starts. Never a write of a record.
|
|
343
358
|
if (p0 === '/api/lab/round') return liveRound(ctx, res, got.body);
|
|
359
|
+
// the PM's prototype rules: the chat's agent adds one (no Origin, D98, like the live round); a page's Undo and Restore are page presses
|
|
360
|
+
if (p0 === '/api/lab/rules') {
|
|
361
|
+
let by;
|
|
362
|
+
if (req.headers.origin) { const g = guard.requirePagePress(req, got.body); if (!g.ok) return fail(ctx, res, g.status, g.error); by = (g.actor && g.actor.by) || 'pm:page'; }
|
|
363
|
+
else by = /^(pm|agent):[\w.:-]{1,80}$/.test(String(got.body.by || '')) ? got.body.by : 'agent:cli';
|
|
364
|
+
return protoRules(ctx, res, got.body, by);
|
|
365
|
+
}
|
|
344
366
|
// delete and undo a prototype version: the trash in the Viewer (a page press), or `pmos lab delete|undo` from the chat's agent (D98,
|
|
345
367
|
// no Origin: the same door as the live round). A request from another site always carries its Origin, so it meets the page press.
|
|
346
368
|
if (p0 === '/api/lab/delete' || p0 === '/api/lab/restore') {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.608.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.608.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
.pc-prog small { color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
|
|
75
75
|
.pc-bar2 { display: block; height: 4px; border-radius: 2px; background: var(--cz-well); overflow: hidden; }
|
|
76
76
|
.pc-bar2 i { display: block; height: 100%; background: var(--cz-blue); transition: width .4s ease; }
|
|
77
|
+
.pc-fixed { margin: 0 0 8px; font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
77
78
|
.pc-lost { display: block; color: var(--cz-ink2); padding: 8px 10px; border-radius: 8px; background: var(--cz-well); margin-bottom: 8px; }
|
|
78
79
|
@keyframes pcPulse { 50% { opacity: 1; } }
|
|
79
80
|
@media (prefers-reduced-motion: reduce) { .pc-making i { animation: none; opacity: .7; } }
|
|
@@ -86,6 +87,21 @@
|
|
|
86
87
|
.pc-dev.desktop::before { content: ''; position: absolute; left: 12px; top: 10px; width: 36px; height: 8px; border-radius: 4px; background: radial-gradient(circle at 4px 4px, var(--cz-hair) 3.5px, transparent 4px) 0 0 / 14px 8px repeat-x; }
|
|
87
88
|
.pc-dev.desktop .pc-frame { height: 560px; border-radius: 0 0 12px 12px; }
|
|
88
89
|
.pc-frame { position: relative; overflow: hidden; background: var(--cz-c-ffffff); }
|
|
90
|
+
/* Design: only the design (Wawan 2026-11-18). No bar, no device, no card behind it: the frame is cut to the design's own box (cozy-proto.js
|
|
91
|
+
cropTo), and the notes sit beside it as annotations. */
|
|
92
|
+
.pc-proto:has(.pc-dev.design) { padding: 0; border: 0; background: transparent; }
|
|
93
|
+
.pc-drow { display: flex; align-items: flex-start; gap: 20px; }
|
|
94
|
+
.pc-dev.design { flex: none; }
|
|
95
|
+
.pc-dev.design .pc-frame { width: 900px; height: 560px; background: transparent; }
|
|
96
|
+
.pc-dev.design .pc-frame iframe { background: transparent; }
|
|
97
|
+
.pc-notes { width: 240px; flex: none; }
|
|
98
|
+
.pc-notes ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
99
|
+
.pc-note { box-sizing: border-box; display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-left: 3px solid var(--cz-risk); border-radius: 4px 12px 12px 4px; background: var(--cz-riskbg); color: var(--cz-ink2); font: inherit; font-size: var(--fs-meta); line-height: var(--lh-meta); text-align: left; }
|
|
100
|
+
button.pc-note { cursor: pointer; }
|
|
101
|
+
button.pc-note:hover, button.pc-note:focus-visible { color: var(--cz-ink); }
|
|
102
|
+
.pc-note .w { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
103
|
+
.pc-note small { color: var(--cz-ink3); }
|
|
104
|
+
.pc-nn { width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--cz-risk); color: var(--cz-onsolid); display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-badge); font-weight: var(--fw-strong); }
|
|
89
105
|
.pc-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--cz-c-ffffff); }
|
|
90
106
|
.pc-frame .pc-none { padding: 20px; }
|
|
91
107
|
.pc-ink { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; border-radius: inherit; }
|
|
@@ -204,5 +220,7 @@
|
|
|
204
220
|
.pc-pflow { width: 100%; }
|
|
205
221
|
.pc .pc-ib { width: 44px; height: 44px; }
|
|
206
222
|
.pc-dev.desktop { width: 100%; }
|
|
223
|
+
.pc-drow { flex-direction: column; }
|
|
224
|
+
.pc-notes { width: 100%; }
|
|
207
225
|
.pc-pframe.phone iframe { width: 100%; box-shadow: none; margin: 0; }
|
|
208
226
|
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* page is a data-page, its screens are its states, its layers are the data-el blocks of the screen shown); the inspector on the right
|
|
11
11
|
* (Exact values: text, font, size, weight, line height, spacing, colour, fill, corner, padding, align), saved with the version in
|
|
12
12
|
* edits.json (styles) and kept by the next version; a change says "You set … Kept as yours." once in the chat ('pmos:note').
|
|
13
|
-
* The cards, which update together: the prototype
|
|
13
|
+
* The cards, which update together: the prototype bare, cut to the design itself, with its notes beside it as annotations (notes.json;
|
|
14
|
+
* Wawan 2026-11-18: no frame, no instructions on a screen) (the comments,
|
|
14
15
|
* the ✦ test-link suggestion); the flow (screens as cards, decisions as diamonds, drawn as SVG from flow.json: a screen shows that moment
|
|
15
16
|
* on the prototype, a branch plays its scenario); the page copy, in its side panel (copy.json, edited in place: the prototype changes as the PM types and
|
|
16
17
|
* the edit is kept with the version, POST /api/lab/edit); who does what (lanes.json as a swimlane with arrows: a step shows its screen).
|
|
@@ -160,7 +161,7 @@ export function lanesLayout(lanes) {
|
|
|
160
161
|
/* Design mode is the default (design "Prototype like Figma", Wawan "build" 2026-11-18): Select is on, Pages > Screens > Layers on the left,
|
|
161
162
|
* the inspector (Exact values) on the right; both hide ([ and ]). Page copy, The flow and Who does what are side panels behind toolbar
|
|
162
163
|
* presses, closed by default; one shows at a time, in the inspector's place. The device switch is only for Play. */
|
|
163
|
-
const V = { body: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
164
|
+
const V = { body: null, box: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
164
165
|
sel: null, looks: null, screen: '', frameUrl: '', ready: null, edits: { copy: {}, vars: {}, styles: {} }, pend: null, saveT: null, draft: null, drawing: false, strokes: 0,
|
|
165
166
|
play: null, sig: '', side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
|
|
166
167
|
const ARROW = '<marker id="pcArr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker>';
|
|
@@ -220,6 +221,15 @@ function progressHtml(c) {
|
|
|
220
221
|
+ `${p && p.total ? `<span class="pc-bar2" aria-hidden="true"><i style="width:${pct}%"></i></span>` : ''}</div>`;
|
|
221
222
|
}
|
|
222
223
|
if (typeof document !== 'undefined' && typeof setInterval === 'function') setInterval(() => { for (const el of document.querySelectorAll('[data-pc-clock]')) el.textContent = clock(el.dataset.pcClock); }, 1000);
|
|
224
|
+
/** The PM's prototype rules (lib/prototype-rules.js): one quiet line, only when PMOS fixed something before the version opened, and the rule
|
|
225
|
+
* it still breaks when the one fix did not reach it (never hidden). Nothing at all when the first draft passed (zero is silence). */
|
|
226
|
+
export function checksHtml(c) {
|
|
227
|
+
const k = c && c.checks; if (!k) return '';
|
|
228
|
+
const n = k.fixed || 0, miss = (k.missed || []).filter(Boolean);
|
|
229
|
+
const fixed = n ? `PMOS fixed ${n === 1 ? '1 thing' : n + ' things'} before showing you this.` : '';
|
|
230
|
+
const left = miss.length ? ` It still breaks your ${miss.length === 1 ? 'rule' : 'rules'}: ${miss.map(esc).join('; ')}.` : '';
|
|
231
|
+
return `<p class="pc-fixed" role="status">${fixed}${left}</p>`;
|
|
232
|
+
}
|
|
223
233
|
function protoCard(c, v, making) {
|
|
224
234
|
const sel = V.sel && !(V.insp && !V.side) ? `<p class="pc-sel">${SVG(I.point, 14)}<b>${esc(V.sel.label || V.sel.el)}</b> is in the chat box: say the change.${ib('data-pc-unsel', 'Clear the element', I.x)}</p>` : '';
|
|
225
235
|
const cm = (c.comments || []).filter((x) => !x.send);
|
|
@@ -228,7 +238,20 @@ function protoCard(c, v, making) {
|
|
|
228
238
|
const sug = suggestion(c);
|
|
229
239
|
const draw = V.mode === 'draw' ? `<canvas class="pc-ink" aria-label="Sketch over the prototype"></canvas><span class="pc-inkacts">${ib('data-pc-ink="attach"', 'Attach the sketch to your next message', I.attach, 'blue')}${ib('data-pc-ink="clear"', 'Clear the sketch', I.x)}</span>` : '';
|
|
230
240
|
const lost = c.notMade ? `<p class="pc-making pc-lost">Version ${c.round} was not made: ${esc(c.notMade)}.${c.fallbackN ? ` This is version ${c.fallbackN}.` : ''} Ask in the chat for it in smaller steps, one screen or format at a time.</p>` : '';
|
|
231
|
-
return { pre: lost + (making ? progressHtml(c) :
|
|
241
|
+
return { pre: lost + (making ? progressHtml(c) : checksHtml(c)), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
|
|
242
|
+
}
|
|
243
|
+
/** The notes beside the design (notes.json): what the run wants the PM to know, kept off the screens (Wawan 2026-11-18). Only the notes for
|
|
244
|
+
* the screen shown and the ones for the whole prototype; none at all is silence. A note on a layer flashes it on the design. */
|
|
245
|
+
export function notesFor(notes, screen) { return ((notes && notes.notes) || []).filter((n) => !n.screen || !screen || n.screen === screen); }
|
|
246
|
+
function notesHtml(v) {
|
|
247
|
+
const L = layersOf(V.ready, V.screen), list = notesFor((v.data || {}).notes, L.screen);
|
|
248
|
+
if (!list.length) return '';
|
|
249
|
+
const lab = (el) => { const e = ((V.ready && V.ready.els) || []).find((x) => x.el === el); return e ? e.label || human(el) : ''; };
|
|
250
|
+
return `<aside class="pc-notes" aria-label="Notes on the design"><ol>${list.map((n, i) => {
|
|
251
|
+
const on = n.el ? lab(n.el) : '';
|
|
252
|
+
const inner = `<span class="pc-nn" aria-hidden="true">${i + 1}</span><span class="w">${esc(n.text)}${on ? `<small>on ${esc(on)}</small>` : ''}</span>`;
|
|
253
|
+
return `<li>${n.el ? `<button type="button" class="pc-note" data-pc-note="${esc(n.el)}" aria-label="${esc('Show ' + (on || n.el) + ' on the design: ' + n.text)}">${inner}</button>` : `<div class="pc-note">${inner}</div>`}</li>`;
|
|
254
|
+
}).join('')}</ol></aside>`;
|
|
232
255
|
}
|
|
233
256
|
function suggestion(c) {
|
|
234
257
|
// the design sprint runs silently: PMOS recommends good practice as ONE ✦ (canvas PbcChat), here: test it with people once it settles
|
|
@@ -369,24 +392,35 @@ export function draw(body, c, o = {}) {
|
|
|
369
392
|
// everything around the frame is drawn again; the frame stays where it is (moving an iframe reloads it)
|
|
370
393
|
const put = (sel, html) => { const n = root.querySelector(sel); if (n) n.innerHTML = html; };
|
|
371
394
|
put('.pc-barw', barHtml(c, v)); put('.pc-trayw', trayHtml(c)); put('.pc-leftw', leftHtml()); put('.pc-rightw', rightHtml(c, v));
|
|
372
|
-
put('.pc-pre', P.pre); put('.pc-post', P.post);
|
|
395
|
+
put('.pc-pre', P.pre); put('.pc-post', P.post); put('.pc-notesw', notesHtml(v));
|
|
373
396
|
root.querySelectorAll('.pc-dev > :not(.pc-frame)').forEach((n) => n.remove());
|
|
374
397
|
const dv = root.querySelector('.pc-dev'); if (dv) dv.insertAdjacentHTML('beforeend', P.dev.slice(P.dev.indexOf('</div>') + 6));
|
|
375
398
|
} else {
|
|
376
399
|
root.innerHTML = `<div class="pc-barw">${barHtml(c, v)}</div><div class="pc-trayw">${trayHtml(c)}</div><div class="pc-dbody"><div class="pc-leftw">${leftHtml()}</div>`
|
|
377
|
-
+ `<div class="pc-vp"><div class="pc-board"><section class="pc-card pc-proto" aria-label="The prototype"><div class="pc-pre">${P.pre}</div><div class="pc-dev
|
|
400
|
+
+ `<div class="pc-vp"><div class="pc-board"><section class="pc-card pc-proto" aria-label="The prototype"><div class="pc-pre">${P.pre}</div><div class="pc-drow"><div class="pc-dev design">${P.dev}</div><div class="pc-notesw">${notesHtml(v)}</div></div><div class="pc-post">${P.post}</div></section></div></div>`
|
|
378
401
|
+ `<div class="pc-rightw">${rightHtml(c, v)}</div></div>`;
|
|
379
402
|
const slot = root.querySelector('[data-pc-frame]');
|
|
380
|
-
if (slot && v.url) { V.frameUrl = frameUrl(v); V.ready = null; slot.innerHTML = `<iframe src="${esc(V.frameUrl)}" sandbox="allow-scripts" title="${esc('The prototype, version ' + (v.round || 1))}"></iframe>`; }
|
|
403
|
+
if (slot && v.url) { V.frameUrl = frameUrl(v); V.ready = null; V.box = null; slot.innerHTML = `<iframe src="${esc(V.frameUrl)}" sandbox="allow-scripts" title="${esc('The prototype, version ' + (v.round || 1))}"></iframe>`; }
|
|
381
404
|
}
|
|
382
405
|
if (!V.play) { const op = root.querySelector('.pc-play'); if (op) op.remove(); }
|
|
383
406
|
if (draftText && root.querySelector('#pcCm')) root.querySelector('#pcCm').value = draftText;
|
|
407
|
+
cropTo(root);
|
|
384
408
|
applyZoom(root);
|
|
385
409
|
if (V.mode === 'draw') ink(root);
|
|
386
410
|
if (keepFrame) { toFrame({ t: 'mode', mode: V.play ? 'view' : V.mode === 'draw' ? 'view' : V.mode }); pins(); }
|
|
387
411
|
if (V.play) startPlay(V.play.id, V.play.i);
|
|
388
412
|
if (V.draft && root.querySelector('#pcCm')) root.querySelector('#pcCm').focus();
|
|
389
413
|
}
|
|
414
|
+
/** Design shows only the design (Wawan 2026-11-18): no browser bar, no device, no page around it. The frame is cut to the design's own box
|
|
415
|
+
* on the screen shown (the runtime's 'box' message); the page stays full size inside, so a tap, a comment pin or a layer lands where it is. */
|
|
416
|
+
function cropTo(root) {
|
|
417
|
+
const f = root && root.querySelector('.pc-dev.design .pc-frame'), fr = f && f.querySelector('iframe'); if (!f || !fr) return;
|
|
418
|
+
const b = V.box;
|
|
419
|
+
if (!b || !(b.w > 0 && b.h > 0)) { f.style.width = ''; f.style.height = ''; fr.style.cssText = ''; return; }
|
|
420
|
+
f.style.width = b.w + 'px'; f.style.height = b.h + 'px';
|
|
421
|
+
fr.style.cssText = `position:absolute;left:${-b.x}px;top:${-b.y}px;width:${FRAME_W}px;height:${Math.max(b.docH || 0, b.y + b.h)}px`;
|
|
422
|
+
}
|
|
423
|
+
const FRAME_W = 900;
|
|
390
424
|
function applyZoom(root) {
|
|
391
425
|
const b = root.querySelector('.pc-board'), vp = root.querySelector('.pc-vp'); if (!b || !vp) return;
|
|
392
426
|
let z = V.zoom;
|
|
@@ -415,6 +449,10 @@ if (typeof window !== 'undefined') window.addEventListener('message', (e) => {
|
|
|
415
449
|
if (V.sel) toFrame({ t: 'sel', el: V.sel.el });
|
|
416
450
|
pins();
|
|
417
451
|
V.sig = ''; draw(V.body, V.c);
|
|
452
|
+
} else if (m.t === 'box') {
|
|
453
|
+
const n = (k) => Math.max(0, Math.round(Number(m[k]) || 0));
|
|
454
|
+
V.box = { x: n('x'), y: n('y'), w: n('w'), h: n('h'), docH: n('docH') };
|
|
455
|
+
cropTo(V.body.querySelector('.pc')); applyZoom(V.body.querySelector('.pc'));
|
|
418
456
|
} else if (m.t === 'screen') {
|
|
419
457
|
V.screen = String(m.id || '');
|
|
420
458
|
V.sig = ''; draw(V.body, V.c);
|
|
@@ -453,6 +491,7 @@ function wire(root) {
|
|
|
453
491
|
if (d.pcZoom != null) { const k = Number(d.pcZoom); V.zoom = k === 0 ? 0 : Math.max(0.4, Math.min(1.6, Math.round(((V.zoom || currentZoom()) + k * 0.1) * 10) / 10)); store.set('pmos.pc.zoom', V.zoom ? String(V.zoom) : null); applyZoom(root); return; }
|
|
454
492
|
if ('pcPlay' in d) { const sc = ((V.v.data || {}).flow || {}).scenarios || []; startPlay(sc.length ? sc[0].id : '', 0, true); return; }
|
|
455
493
|
if (d.pcFrom) { fire('pmos:from', { ini: V.c.ini, n: Number(d.pcFrom) }); say('The next change you send continues from version ' + d.pcFrom + '.'); return; }
|
|
494
|
+
if (d.pcNote) { toFrame({ t: 'hint', els: [d.pcNote] }); return; }
|
|
456
495
|
if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); V.sig = ''; draw(V.body, V.c); return; }
|
|
457
496
|
if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
|
|
458
497
|
if ('pcStop' in d) { pmPost('/api/lab/stop', { ws: (V.at || {}).ws, run: d.pcStop }).then((r) => { if (!r || !r.ok) say((r && r.error) || 'It did not stop.'); }).catch(() => say('It did not stop.')); return; }
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* (GET/POST /api/next-prompt/prefs; batch 26 item 2)
|
|
13
13
|
* › Checks (a heading inside Claude since U4; it was the section Claude’s checks) Grill by itself (Full, Only at stage exits, Off) and the monthly credit for checks with what this month used (grill.mode,
|
|
14
14
|
* grill.cap, POST /api/settings; GET /api/grill; canvas GrillEntry). At the cap Claude pauses and says so once here.
|
|
15
|
+
* › Prototype rules (after Checks; openSettings('rules')) the checks every prototype version meets before it opens, each from the PM's words,
|
|
16
|
+
* with Undo and Bring back (GET and POST /api/lab/rules, lib/prototype-rules.js)
|
|
15
17
|
* › Jev and Laya (a sub-panel of General › Extras since U4) the TypeSafe key, Laya on this computer and the per-repository switches (pm/cozy-jl.js; canvas JlA1Empty–JlA4Phone)
|
|
16
18
|
* › Adler (a sub-panel of General › Extras since U4) how much of Claude's face shows, Motion, Celebrations, Quiet after (adler.*, POST /api/settings; canvas AdM5, batch 16 item 2)
|
|
17
19
|
* › Dress for the day (adler.dress.*, canvas AsSet1, batch 18 item 8): the master switch, where you are, one switch per group,
|
|
@@ -425,7 +427,30 @@ function claudeSec() {
|
|
|
425
427
|
+ trow('API key', keySub, keyRight)
|
|
426
428
|
+ (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '')
|
|
427
429
|
+ sharpenRows()
|
|
428
|
-
+ '<h4 id="evChecks">Checks</h4>' + checksSec()
|
|
430
|
+
+ '<h4 id="evChecks">Checks</h4>' + checksSec() // U4: the section Claude’s checks folded in here
|
|
431
|
+
+ '<h4 id="evProtoRules">Prototype rules</h4>' + protoRulesSec();
|
|
432
|
+
}
|
|
433
|
+
/* Settings › PMOS › Prototype rules (initiative prototype-rules, design "Prototypes right on the first try", board FtB): each correction of
|
|
434
|
+
* the PM's that is true of every prototype, as a check PMOS runs on each version before it opens (lib/prototype-rules.js). Each row is the
|
|
435
|
+
* rule, the PM's own words and the date, and Undo. No run button and no picker: PMOS adds them from the chat. An undone rule waits below it
|
|
436
|
+
* with Bring back, and PMOS does not add it again unless the PM says it again. GET and POST /api/lab/rules. */
|
|
437
|
+
function protoRulesSec() {
|
|
438
|
+
const R = T.pru;
|
|
439
|
+
if (!R) return '<p class="ev-small ev-mut">Reading your prototype rules.</p>';
|
|
440
|
+
if (R.ok === false) return `<p class="ev-small ev-mut">Your prototype rules could not be read: ${esc(R.error || 'the server did not answer')}.</p>`;
|
|
441
|
+
const on = R.rules.filter((r) => r.on), off = R.rules.filter((r) => !r.on);
|
|
442
|
+
const sub = (r) => [r.words ? '“' + r.words + '”' : '', dayOf(r.at)].filter(Boolean).join(' · ');
|
|
443
|
+
return '<p class="ev-small ev-mut ev-lead">PMOS checks every prototype version against these before you see it, and fixes it once when one fails. Each comes from your own words in the chat.</p>'
|
|
444
|
+
+ (on.length ? on.map((r) => trow(r.title, sub(r), `<button type="button" class="ev-btn sm" data-ev-pru="undo" data-ev-pru-id="${esc(r.id)}" aria-label="${esc('Undo the rule ' + r.title)}">Undo</button>`)).join('')
|
|
445
|
+
: '<p class="ev-small ev-mut">No rules now. Each correction you make that is true of every prototype shows here.</p>')
|
|
446
|
+
+ off.map((r) => trow(r.title, 'You undid it' + (r.undoneAt ? ' on ' + dayOf(r.undoneAt) : '') + '. PMOS adds it again only when you say it again.', `<button type="button" class="ev-btn sm" data-ev-pru="restore" data-ev-pru-id="${esc(r.id)}" aria-label="${esc('Bring back the rule ' + r.title)}">Bring back</button>`)).join('');
|
|
447
|
+
}
|
|
448
|
+
async function saveProtoRule(op, id) {
|
|
449
|
+
const r = await pmPost('/api/lab/rules', { op, id });
|
|
450
|
+
if (r && r.ok && T.pru && T.pru.ok !== false) { const x = T.pru.rules.find((y) => y.id === id); if (x) { x.on = op === 'restore'; if (op === 'undo') x.undoneAt = new Date().toISOString(); else delete x.undoneAt; } }
|
|
451
|
+
const t = r && r.rule ? r.rule.title : 'the rule';
|
|
452
|
+
T.msg = r && r.ok ? (op === 'undo' ? 'Undone. PMOS no longer checks prototypes for: ' + t + '.' : 'Back. PMOS checks every prototype for: ' + t + ' again.') : (r && r.error) || 'Not saved.';
|
|
453
|
+
draw();
|
|
429
454
|
}
|
|
430
455
|
/* Settings › Claude › Sharpen prompts (batch 26 item 2; pm/next-prompt-ui.js, lib/routes-next-prompt.js): the suggestions after a reply, Sharpen as I
|
|
431
456
|
* type (on by default: both run as a background `claude -p` in the PM's own Claude session, Wawan 2026-11-04), the style, and Your own rules.
|
|
@@ -471,7 +496,7 @@ function checksSec() {
|
|
|
471
496
|
}
|
|
472
497
|
const BODY = { general, claude: claudeSec, connectors, workspaces, updates };
|
|
473
498
|
// the old section names (deep links, other pages' calls): where their controls are now (U4)
|
|
474
|
-
const MOVED = { scheduled: ['connectors', 'sw:list'], checks: ['claude', ''], adler: ['general', 'adler'], jl: ['general', 'jl'], dress: ['general', 'adler'], workflows: ['workspaces', 'workflows'] };
|
|
499
|
+
const MOVED = { scheduled: ['connectors', 'sw:list'], checks: ['claude', ''], rules: ['claude', ''], adler: ['general', 'adler'], jl: ['general', 'jl'], dress: ['general', 'adler'], workflows: ['workspaces', 'workflows'] };
|
|
475
500
|
let disposeClaudeSetup = null;
|
|
476
501
|
function draw() {
|
|
477
502
|
const el = T.el; if (!el || el.hidden) return;
|
|
@@ -553,6 +578,7 @@ function mount() {
|
|
|
553
578
|
async function press(e) {
|
|
554
579
|
const t = e.target.closest('a[data-ev-sec], a[data-ev-cadd], button'); if (!t) return;
|
|
555
580
|
if (t.dataset.evCadd) { startWait(t.dataset.evCadd); draw(); return; } // the link opens the Claude account's connector page; PMOS waits for it
|
|
581
|
+
if (t.dataset.evPru) { if (T.busy) return; T.busy = true; try { await saveProtoRule(t.dataset.evPru, t.dataset.evPruId); } finally { T.busy = false; } return; }
|
|
556
582
|
if (t.dataset.evCcat) { T.cat = t.dataset.evCcat; draw(); const f = T.el.querySelector(`[data-ev-ccat="${T.cat}"]`); if (f) f.focus(); return; }
|
|
557
583
|
if (t.dataset.evPok || t.dataset.evPno) { if (T.busy) return; T.busy = true; try { await decideProp(t.dataset.evPok || t.dataset.evPno, !!t.dataset.evPok); } finally { T.busy = false; } return; }
|
|
558
584
|
if (t.dataset.evSec) { e.preventDefault(); const m = MOVED[t.dataset.evSec]; T.sec = m ? m[0] : t.dataset.evSec; T.sub = m ? m[1] : ''; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); openCheck(); return; }
|
|
@@ -700,6 +726,7 @@ async function load() {
|
|
|
700
726
|
SW.swLoad(draw);
|
|
701
727
|
pmGet('/api/autonomy/kinds').then((k) => { T.ck = k && k.ok ? k : { ok: false, error: (k && k.error) || '' }; draw(); }).catch(() => { T.ck = { ok: false }; draw(); });
|
|
702
728
|
pmGet('/api/artefacts/lessons').then((l) => { T.ls = l && l.ok ? l : null; draw(); }).catch(() => { T.ls = null; });
|
|
729
|
+
pmGet('/api/lab/rules').then((r) => { T.pru = r && r.ok ? { ok: true, rules: Array.isArray(r.rules) ? r.rules : [] } : { ok: false, error: (r && r.error) || '' }; draw(); }).catch(() => { T.pru = { ok: false }; draw(); });
|
|
703
730
|
pmGet('/api/grill').then((g) => { T.gr = g && g.ok ? g : { ok: false, error: (g && g.error) || '' }; draw(); }).catch(() => { T.gr = { ok: false }; draw(); });
|
|
704
731
|
pmGet('/api/next-prompt/prefs').then((n) => { T.np = n && n.ok ? n : null; draw(); }).catch(() => { T.np = null; });
|
|
705
732
|
pmGet('/api/profiles').then(async (pr) => { const k = await pmGet('/api/anthropic'); T.cl = { profiles: pr && Array.isArray(pr.profiles) ? pr.profiles : [], prefs: (pr && pr.prefs) || {}, perr: pr && pr.ok === false ? (pr.error || 'the server did not answer') : '', key: k && k.ok ? k.key : { present: false, source: null }, off: !!(k && k.off) }; draw(); }).catch(() => { T.cl = { profiles: [], prefs: {}, perr: 'the server did not answer', key: { present: false, source: null } }; draw(); });
|
|
@@ -727,11 +754,11 @@ export function openSettings(section, o = {}) {
|
|
|
727
754
|
const m = MOVED[section];
|
|
728
755
|
if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
|
|
729
756
|
else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
|
|
730
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
|
|
757
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.pru = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
|
|
731
758
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
732
759
|
draw();
|
|
733
760
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
734
|
-
if (section === 'checks') { const h = el.querySelector('#evChecks'); if (h && h.scrollIntoView) h.scrollIntoView({ block: 'start' }); }
|
|
761
|
+
if (section === 'checks' || section === 'rules') { const h = el.querySelector(section === 'rules' ? '#evProtoRules' : '#evChecks'); if (h && h.scrollIntoView) h.scrollIntoView({ block: 'start' }); }
|
|
735
762
|
load();
|
|
736
763
|
return el;
|
|
737
764
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Prototype rules (initiative prototype-rules, step 2 of \"Prototypes right on the first try\"): the PM's corrections as checks run after renderCheck and before a version opens, one fix run on a failure, a rule added only when it fails its bad example and passes its good one, Undo in Settings › PMOS (lib/prototype-rules.js, lib/live-round.js, lib/routes-lab.js /api/lab/rules, lib/lab-cli.js). Backend and source reads only.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"prototype-rules.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": { "prototype-rules.test.js": 1 }
|
|
7
|
+
}
|