create-pmos 0.592.0 → 0.593.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 +14 -14
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/changelog.json +13 -0
- package/workspace/guide/agent-capabilities.md +5 -4
- package/workspace/guide/cli.md +1 -1
- package/workspace/lib/autonomy.js +3 -0
- package/workspace/lib/lab-cli.js +5 -3
- package/workspace/lib/live-round.js +35 -6
- package/workspace/lib/proposals.js +46 -2
- package/workspace/lib/routes-briefing-premium.js +9 -4
- package/workspace/lib/routes-lab.js +21 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-proto.css +7 -2
- package/workspace/public/pm/cozy-proto.js +72 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.593.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,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.593.0",
|
|
38
|
+
"at": "2026-11-18T01:08:15.346Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1331,
|
|
43
|
+
"t": "The newest prototype version is the initiative's prototype, and the chat knows it",
|
|
44
|
+
"s": "The newest prototype version is the initiative's prototype, and the chat knows it",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.592.0",
|
|
38
51
|
"at": "2026-11-17T16:29:19.409Z",
|
|
@@ -285,19 +298,6 @@
|
|
|
285
298
|
"k": "fix"
|
|
286
299
|
}
|
|
287
300
|
]
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
"v": "0.573.0",
|
|
291
|
-
"at": "2026-11-16T04:53:10.251Z",
|
|
292
|
-
"f": 4,
|
|
293
|
-
"prs": [
|
|
294
|
-
{
|
|
295
|
-
"n": 1304,
|
|
296
|
-
"t": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
297
|
-
"s": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
298
|
-
"k": "fix"
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
301
|
}
|
|
302
302
|
]
|
|
303
303
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-11-
|
|
1
|
+
kernel-source: pmos@a59cfcc4
|
|
2
|
+
assembled: 2026-11-18
|
|
3
3
|
mode: vendor
|
|
@@ -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-18T01:08:11Z"}
|
|
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-18T01:08:11Z"}
|
|
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-18T01:08:11Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.593.0",
|
|
4
|
+
"at": "2026-11-18T01:08:15.346Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1331,
|
|
9
|
+
"t": "The newest prototype version is the initiative's prototype, and the chat knows it",
|
|
10
|
+
"s": "The newest prototype version is the initiative's prototype, and the chat knows it",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.592.0",
|
|
4
17
|
"at": "2026-11-17T16:29:19.409Z",
|
|
@@ -195,10 +195,10 @@ 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.**
|
|
198
|
+
2. **The Viewer is one canvas.** Three cards update together, and the page copy opens beside them:
|
|
199
199
|
- **The prototype**, in a phone frame or a desktop browser frame (the Phone and Desktop presses in the toolbar).
|
|
200
|
-
- **The flow**: screens as cards, decisions as diamonds, and branches to the other scenarios. Tap a screen to see that moment on the prototype. Tap a side branch to play that scenario.
|
|
201
|
-
- **Page copy
|
|
200
|
+
- **The flow**: screens as cards, decisions as diamonds, and branches to the other scenarios. The main scenario is one row, side branches sit in rows under it, and lines going back run above or under the boxes, so no line crosses a box or a label. Tap a screen to see that moment on the prototype. Tap a side branch to play that scenario.
|
|
201
|
+
- **Page copy** (the Page copy press in the toolbar, closed by default): every word on the screen, in a side panel. Edit a line in place, and the prototype changes as you type. PMOS keeps the edit with the version, and the next version keeps it.
|
|
202
202
|
- **Who does what**: a swimlane with arrows between the steps. Tap a step to see it on the prototype. A card that the last version changed says **Updated**. Zoom out, zoom in and fit are in the toolbar.
|
|
203
203
|
3. **Change it in one sentence.** For example, "make the alert orange". PMOS makes the next version of the prototype and its flow, swimlane and copy, and the chat says what changed, then "Also updated: step 3, the swimlane and the copy". ‹ › in the toolbar walks the versions. On an older version, **Back to latest** returns, and **Continue from version n** makes your next change start from that version.
|
|
204
204
|
4. **Point, then say.** Press Point (S) and tap an element in the prototype. It goes into the chat box as a chip, for example "Screen list". Your next sentence changes that element. Sliders for that element (spacing, corner radius, colour) show under the prototype: they change it at once, with no chat round, and PMOS keeps them with the version.
|
|
@@ -206,7 +206,8 @@ You can ask to see an idea at any moment: alone while you work on an initiative,
|
|
|
206
206
|
6. **Draw or attach an image.** Press Draw (D), sketch over the prototype, then attach the sketch. It goes with your next message. An image you attach does the same. PMOS builds from it (its layout, hierarchy and colours) unless your words say otherwise, for example "only the colours".
|
|
207
207
|
7. **Play.** Press Play to run the prototype full size through a scenario of the flow. Tap where the user would tap. A tap that misses shows where to tap. Restart and Close are above it. Ask in the chat for another scenario.
|
|
208
208
|
8. **Several versions only when you ask.** Say "show me 3 ways" (or "two options"). PMOS picks that many directions and shows them in a tray. Tap one to preview it, then keep it (✓) or close the tray (✕).
|
|
209
|
-
9. **
|
|
209
|
+
9. **The initiative's prototype.** The newest version made from the chat is the initiative's prototype: the **Prototype** document of the initiative and the kept specimen on its Experiment card. Your edits in the Viewer are part of that version. Earlier versions stay in ‹ ›. PMOS never keeps a round by itself. A round of several ways, or one started from a terminal (a test), becomes the prototype only when you keep it with ✓ in the Viewer; the grill then runs once on it. ✕ drops a round, and you can say why.
|
|
210
|
+
10. **The chat knows the prototype.** Every message in the initiative's chat tells PMOS which version is current, where its files are, and the one command that makes the next version. So "Improve the prototype based on the PRD" or "Rebuild A from this list" makes the next version in the Viewer. The chat never writes a loose HTML file.
|
|
210
211
|
|
|
211
212
|
What each part does:
|
|
212
213
|
|
package/workspace/guide/cli.md
CHANGED
|
@@ -231,7 +231,7 @@ The idle lab run uses only the first three commands:
|
|
|
231
231
|
- `pmos lab page <url>`: a scan run reads one public page. PMOS refuses a private or local address and keeps the page text, so a quote can be checked.
|
|
232
232
|
- `pmos lab file <group> --json -`: a run files one result. It waits until the run ends and the proof passes.
|
|
233
233
|
- `pmos lab status`: in a run, what it filed. Outside a run, this month's idle lab runs and spend.
|
|
234
|
-
- `pmos lab round <initiative> --brief "<what to show>" [--one] [--base B] [--dirs "A: …|B: …|C: …"] [--propose] [--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. With `--propose`, PMOS files the ✦ ask instead, and your ✓ starts it. A background lab run cannot use this command. See [The live round](agent-capabilities.md).
|
|
234
|
+
- `pmos lab round <initiative> --brief "<what to show>" [--one] [--base B] [--dirs "A: …|B: …|C: …"] [--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. 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).
|
|
235
235
|
|
|
236
236
|
### pmos outcomes: expected outcomes
|
|
237
237
|
|
|
@@ -122,6 +122,9 @@ function classOfProposal(p) {
|
|
|
122
122
|
if (p.group === 'outcome' && p.type === 'refuted') return 'C';
|
|
123
123
|
// D108 as amended 2026-11-16 (Wawan: "Open them automatically"): the factory's pull request opens by itself, from the server (never the
|
|
124
124
|
// Builder's run), and Undo closes it. The guardrail and CI decide merge or review. `pmos ai off` or a demotion returns it to the ✓.
|
|
125
|
+
// a live round's prototype (lib/live-round.js, data.live) is the PM's to keep: PMOS never keeps one by itself (2026-11-18: a test round it
|
|
126
|
+
// kept became the initiative's design). The newest version is the prototype anyway (lib/proposals.js currentOf).
|
|
127
|
+
if ((p.group === 'prototyped' || p.group === 'improved') && isObj(p.data) && isObj(p.data.live)) return 'C';
|
|
125
128
|
if (p.group === 'build') return 'B'; // stopping or replacing an experiment is the PM's call (launch simulation W2)
|
|
126
129
|
// a maybe, or a duplicate already in another initiative (type link, or an item with `other`), is a question for the PM, not a change
|
|
127
130
|
// found type stage moves the initiative's stage: a stage move is C (as the Driver's `move`)
|
package/workspace/lib/lab-cli.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* pmos lab page <n> [--from <line>] print a page this run already read, from a line
|
|
7
7
|
* pmos lab file <group> --json <file|-> one result of this run. It waits until the run ends; then PMOS proves it and files it under ✦
|
|
8
8
|
* pmos lab status in a run: what this run filed. Outside a run: this month's idle lab runs and spend
|
|
9
|
-
* pmos lab round <ini> --brief "…" [--base B] [--dirs "A: …|B: …|C: …"] [--propose] [--ws <id>]
|
|
9
|
+
* pmos lab round <ini> --brief "…" [--base B] [--dirs "A: …|B: …|C: …"] [--propose] [--chat] [--ws <id>]
|
|
10
|
+
* --chat: the initiative chat's own agent started it, so the chat is told when the version renders
|
|
10
11
|
* the live round (lib/live-round.js): the running server starts three runs now, or one on B; --propose
|
|
11
12
|
* files its ✦ ask for the PM's ✓ instead (the initiative chat's way)
|
|
12
13
|
*
|
|
@@ -29,7 +30,7 @@ const USAGE = [
|
|
|
29
30
|
' pmos lab file scanned --json - { "title", "why", "claims": [{ "text", "sources": [{ "page": 1, "line": 12, "quote": "<words on that line>" }] }], "refreshed"? }',
|
|
30
31
|
' pmos lab file scan --json - the same, for a finding that fits no initiative',
|
|
31
32
|
' pmos lab status',
|
|
32
|
-
' pmos lab round <initiative> --brief "<what to show>" [--one] [--base B] [--dirs "A: …|B: …|C: …"] [--propose] [--ws <id>]',
|
|
33
|
+
' pmos lab round <initiative> --brief "<what to show>" [--one] [--base B] [--dirs "A: …|B: …|C: …"] [--propose] [--chat] [--ws <id>]',
|
|
33
34
|
' the live round: three versions now (--one: one, with its flow, swimlane and copy; --base B: the next',
|
|
34
35
|
' version of B from the brief), each shown as soon as it renders. --propose files the ✦ ask instead',
|
|
35
36
|
'A specimen must open and render; every claim must quote what was read. What is not proven is dropped. Nothing is sent.',
|
|
@@ -138,11 +139,12 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
138
139
|
if (base !== undefined && !/^[A-C]$/i.test(String(base))) { say('✗ --base is the key of the version to improve: A, B or C'); return 2; }
|
|
139
140
|
if (typeof call !== 'function') { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
|
|
140
141
|
let by = ''; try { by = require('./actor.js').fromCli({ env }).by || ''; } catch { by = ''; }
|
|
141
|
-
const body = { ini, brief: brief.trim(), ...(base ? { base: String(base).toUpperCase() } : {}), ...(typeof dirs === 'string' ? { dirs } : {}), ...(typeof ws === 'string' ? { ws } : {}), ...(typeof board === 'string' ? { board } : {}), ...(flag(args, 'propose') ? { propose: true } : {}), ...(flag(args, 'one') ? { one: true } : {}), ...(by ? { by } : {}) };
|
|
142
|
+
const body = { ini, brief: brief.trim(), ...(base ? { base: String(base).toUpperCase() } : {}), ...(typeof dirs === 'string' ? { dirs } : {}), ...(typeof ws === 'string' ? { ws } : {}), ...(typeof board === 'string' ? { board } : {}), ...(flag(args, 'propose') ? { propose: true } : {}), ...(flag(args, 'one') ? { one: true } : {}), ...(flag(args, 'chat') ? { from: 'chat' } : {}), ...(by ? { by } : {}) };
|
|
142
143
|
let r = null; try { r = await call('POST', '/api/lab/round', body); } catch { r = null; }
|
|
143
144
|
if (!r) { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
|
|
144
145
|
if (!r.ok) { say('✗ ' + (r.error || 'the round did not start')); return 1; }
|
|
145
146
|
if (body.propose) { say(`✓ filed under the initiative's ✦: ${r.said}. The PM's ✓ starts it.`); return 0; }
|
|
147
|
+
if (body.from === 'chat') { say(`✓ version ${r.round.n} started from ${r.round.directions.map((d) => d.key).join(', ')}. PMOS tells this chat when it is in the Viewer (2 minutes at most). Do not build it yourself.`); return 0; }
|
|
146
148
|
say(`✓ round ${r.round.n} started: ${r.round.directions.map((d) => d.key + ' · ' + d.title).join('; ')}. Each version shows under the initiative's ✦ as soon as it renders (2 minutes at most).`);
|
|
147
149
|
return 0;
|
|
148
150
|
}
|
|
@@ -40,7 +40,10 @@
|
|
|
40
40
|
* askOf({ ini, board, brief, directions, base?, round?, from? }) PURE → the ✦ ask's proposal line (without at/by)
|
|
41
41
|
* waiting(P, ini) PURE → the open round on the initiative { id, group, round, keys } | null (P: lib/proposals.js fold; keys: the
|
|
42
42
|
* first round's versions that rendered, the ones a feedback sentence may name)
|
|
43
|
-
* baseOf(P, ini, key) PURE → { of, round, file, title } | null
|
|
43
|
+
* baseOf(P, ini, key, { from?, of? }) PURE → { of, round, file, title } | null what a feedback round on `key` builds on (start: the
|
|
44
|
+
* current version, lib/proposals.js currentOf, unless the PM said Continue from version n)
|
|
45
|
+
* contextOf(cur, { ini, ws, rt }) PURE → the line the initiative chat's agent reads before every message while a prototype exists: the
|
|
46
|
+
* version, its folder and files, and the one command that makes the next version (never a loose HTML file)
|
|
44
47
|
* promptOf(o) PURE · scaffoldOf(roots) → { css, from }
|
|
45
48
|
* create(deps) → { start(input), propose(input), cancel(id, why), running(ini), status() } and the module-level shortcuts below,
|
|
46
49
|
* round(input) → Promise<{ ok, round: { id, n, keys, directions }, runs } | { ok: false, error }> once create() ran (W2 builds on it)
|
|
@@ -87,6 +90,10 @@ const FEEDBACK_RE = /^\s*(?:(?:take|keep|go with|try|use|make)\s+)?([A-C])(?:\s*
|
|
|
87
90
|
// Wawan 2026-11-17 20:25: "iterative, like Claude Code design work": one prototype unless the PM asks for several, and any change sentence
|
|
88
91
|
// while one is open changes it. A change sentence starts with a change word; a question or a plain remark does not.
|
|
89
92
|
const CHANGE_RE = /^\s*(?:please\s+|can you\s+|could you\s+|now\s+)?(change|make|add|drop|remove|move|put|use|try|lead|swap|replace|turn|show|hide|fewer|more|less|bigger|smaller|larger|instead|but|also|without|with|give|start|end|rename|call|colou?r|shorten|simplify|keep|take out|bring|flip|split|merge|stack|sort|group|open|close|round|tighten|loosen|lighten|darken|center|centre|align)\b/i;
|
|
93
|
+
// 2026-11-18 ("Improve the prototype based on the PRD" got "I can't find the rendered files"): a word that asks for work on what is there counts
|
|
94
|
+
// as a change of the prototype when the sentence names it (the prototype, a version, a screen, the layout, the design, or its letter)
|
|
95
|
+
const WORK_RE = /^\s*(?:please\s+|can you\s+|could you\s+|now\s+|ok(?:ay)?,?\s+|yes,?\s+)?(improve|update|refine|rework|redo|rebuild|redesign|restyle|polish|fix|adjust|tweak|iterate( on)?|apply|continue|cover|base|follow|align|write)\b/i;
|
|
96
|
+
const PROTO_NOUN_RE = /\b(prototype|version|screens?|page|layout|design|mock ?up|ui|viewer|canvas|flow|swimlane|copy)\b/i;
|
|
90
97
|
const COUNT_RE = /\b(\d|two|three|a few|some|(?:a )?couple of)\s+(ways|options|versions|takes|directions|variants)\b/i;
|
|
91
98
|
const WORDS = { two: 2, three: 3, 'a few': 3, some: 3, 'couple of': 2, 'a couple of': 2 };
|
|
92
99
|
/** PURE. The marks the canvas puts before the PM's words (pm/cozy-proto.js through pm/home-chat.js): "[On: Screen list · screen-list]" for
|
|
@@ -119,7 +126,7 @@ function intentOf(text, { waiting = null } = {}) {
|
|
|
119
126
|
if (m) { const w = m[1].toLowerCase(); count = /^\d$/.test(w) ? Number(w) : WORDS[w] || 3; }
|
|
120
127
|
return { kind: 'new', brief: t, count: Math.min(3, Math.max(1, count)) };
|
|
121
128
|
}
|
|
122
|
-
if (keys.length === 1 && (CHANGE_RE.test(t) || ((mk.point || mk.from) && !/\?\s*$/.test(t)))) return { kind: 'feedback', base: keys[0], brief: t, ...extra };
|
|
129
|
+
if (keys.length === 1 && (CHANGE_RE.test(t) || (WORK_RE.test(t) && (PROTO_NOUN_RE.test(t) || /\b[A-C]\b/.test(t))) || ((mk.point || mk.from) && !/\?\s*$/.test(t)))) return { kind: 'feedback', base: keys[0], brief: t, ...extra };
|
|
123
130
|
return null;
|
|
124
131
|
}
|
|
125
132
|
/** PURE. "A: plain list|B: risk first|C: timeline" (or one per line) → [{ key, title }] with 2 or 3 different keys A–C, else null. */
|
|
@@ -169,11 +176,12 @@ function waiting(P, ini) {
|
|
|
169
176
|
}
|
|
170
177
|
/** PURE. A feedback round on `key`: the newest first round on the initiative, the newest proven file of that key (or of version `from`,
|
|
171
178
|
* after Continue from version n), and the next round's number. The version's companions live next to its file (PARTS). */
|
|
172
|
-
function baseOf(P, ini, key, { from = null } = {}) {
|
|
179
|
+
function baseOf(P, ini, key, { from = null, of = '' } = {}) {
|
|
173
180
|
if (!P || !KEYS.includes(key)) return null;
|
|
174
181
|
const all = [...P.props.values()].filter((p) => p.ini === ini);
|
|
175
182
|
const roots = all.filter((p) => p.group === 'prototyped').sort((a, b) => ms(b.at) - ms(a.at));
|
|
176
|
-
const
|
|
183
|
+
const has = (r) => ((r.data || {}).specimens || []).some((s) => s.key === key);
|
|
184
|
+
const root = (of && roots.find((r) => r.id === of && has(r))) || roots.find(has);
|
|
177
185
|
if (!root) return null;
|
|
178
186
|
const rounds = all.filter((p) => p.group === 'improved' && p.data && p.data.of === root.id).sort((a, b) => (a.data.round || 0) - (b.data.round || 0));
|
|
179
187
|
const spec = root.data.specimens.find((s) => s.key === key);
|
|
@@ -215,6 +223,7 @@ function promptOf(o) {
|
|
|
215
223
|
L.push('', `The idea: ${one(o.brief, 600)}`);
|
|
216
224
|
if (info.title) L.push(`The initiative: ${one(info.title, 160)}${info.description ? ' · ' + one(info.description, 400) : ''}`);
|
|
217
225
|
if (info.intent) L.push(`What the product wants (its Intent): ${one(info.intent, 400)}`);
|
|
226
|
+
if (/\b(prd|brief|spec|brd|requirements?|document|doc)\b/i.test(String(o.brief || ''))) L.push('The idea names a document of the initiative: find it in this repository with Glob (planning/, docs/) and read it first. Build from what it says.');
|
|
218
227
|
// an image, a sketch or a file the PM attached (Wawan 2026-11-17: "when user upload the image, it takes it as reference and builds
|
|
219
228
|
// according to it, or as user prompted")
|
|
220
229
|
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.`);
|
|
@@ -366,6 +375,21 @@ function saidOf(abs) {
|
|
|
366
375
|
return m ? one(m[1].replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'), 160) : '';
|
|
367
376
|
}
|
|
368
377
|
|
|
378
|
+
/** PURE. What the initiative chat's agent is told before the PM's words while the initiative has a prototype (cur: lib/proposals.js
|
|
379
|
+
* currentOf; rt: the runtime folder). 2026-11-18: asked to "Improve the prototype based on the PRD", the chat found no files and asked the
|
|
380
|
+
* PM for a path; asked to "Rebuild A", it tried the idle lab's `pmos lab file` and wrote a loose a2.html in its scratchpad instead of a
|
|
381
|
+
* version in the Viewer. → '' when there is no prototype. */
|
|
382
|
+
function contextOf(cur, { ini, ws = '', rt = null } = {}) {
|
|
383
|
+
if (!cur || !cur.file || !ini) return '';
|
|
384
|
+
const abs = (rt && LAB.specimenPath(rt, cur.file)) || cur.file, dir = path.dirname(abs);
|
|
385
|
+
const wsf = ws ? ` --ws ${ws}` : '';
|
|
386
|
+
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. `
|
|
387
|
+
+ `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. `
|
|
388
|
+
+ `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>"\` `
|
|
389
|
+
+ `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. `
|
|
390
|
+
+ 'Never write the prototype yourself, never write an HTML file in a scratchpad or elsewhere, and never use `pmos lab file`: that is for the background lab only.';
|
|
391
|
+
}
|
|
392
|
+
|
|
369
393
|
/* ── the proposal line of a round ── */
|
|
370
394
|
const fin = (x) => x.state === 'ok' || x.state === 'not made' || x.state === 'none';
|
|
371
395
|
const partsLine = (s) => Object.fromEntries((s.parts || []).map((x) => [x.kind, x.state === 'not made' ? 'not made: ' + one(x.why, 120) : x.state]));
|
|
@@ -456,7 +480,9 @@ function create(deps) {
|
|
|
456
480
|
let base = '', b = null, dirs;
|
|
457
481
|
if (input.base) {
|
|
458
482
|
base = String(input.base).toUpperCase();
|
|
459
|
-
|
|
483
|
+
// the version the initiative is at now (lib/proposals.js currentOf), unless the PM said Continue from version n
|
|
484
|
+
const cur = fromV ? null : PR.currentOf(P, c.ini);
|
|
485
|
+
b = cur && cur.key === base ? baseOf(P, c.ini, base, { from: cur.n, of: cur.of }) : baseOf(P, c.ini, base, { from: fromV });
|
|
460
486
|
if (!b) return { ok: false, error: `there is no proven version ${base} on this initiative yet: ask for a first one` };
|
|
461
487
|
dirs = [{ key: base, title: b.title }];
|
|
462
488
|
} else {
|
|
@@ -545,6 +571,9 @@ function create(deps) {
|
|
|
545
571
|
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); }
|
|
546
572
|
try { E.appendRun(R.rt, { kind: 'end', run: s.run, ok: true, cost, ms: Math.max(0, now() - R.start), filed: 1, dropped: [] }, now()); } catch { /* the card says it */ }
|
|
547
573
|
if (deps.artefact) try { deps.artefact(R.dir, { scope: 'experiment:' + R.ini, artefact: 'specimens', field: 'specimen', text: one(`${R.base ? 'Version ' + R.n + ' of ' + s.key : 'Round 1 · ' + s.key}: ${s.title} (${LAB.specimenUrl(s.file)})`, 600), sources: [{ label: 'live round', ref: LAB.specimenUrl(s.file) }] }, 'agent:live-round'); } catch (e) { warn('live round specimen', e); }
|
|
574
|
+
// one version at a time: the newest proven version IS the initiative's prototype (2026-11-18: the Experiment card still showed an old
|
|
575
|
+
// round). A round of several ways, or one started in a terminal (a test), waits for the PM's keep (lib/routes-proposals.js liveKept).
|
|
576
|
+
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); }
|
|
548
577
|
write(R); settle(R);
|
|
549
578
|
}
|
|
550
579
|
/** A companion lands: it must parse and be well formed (flowOf, lanesOf, tweaksOf), else it is "not made" with the reason. */
|
|
@@ -656,6 +685,6 @@ function dropCard(dir, propId) { return inst ? inst.dropCard(dir, propId) : fals
|
|
|
656
685
|
function running(ini) { return inst ? inst.running(ini) : false; }
|
|
657
686
|
function status() { return inst ? inst.status() : []; }
|
|
658
687
|
|
|
659
|
-
module.exports = { JOB, ORIGIN, BUDGET_MS, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, scaffoldOf, promptOf, saidOf, roundLine,
|
|
688
|
+
module.exports = { JOB, ORIGIN, BUDGET_MS, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, saidOf, roundLine,
|
|
660
689
|
flowOf, lanesOf, tweaksOf, copyOf, changesOf, partsAt, editsOf,
|
|
661
690
|
create, install, round, startNow, proposeNow, cancel, dropCard, running, status };
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
* tidyName(from, to) → '' when `to` keeps the standard (rule 5), else the reason it does not
|
|
68
68
|
* datesOf(ini, T, o) PURE → the date proposals for one initiative (rule 1: late, or due within 3 days and not started)
|
|
69
69
|
* viewOf(F, ini, o) → what r.props carries (null: nothing to show)
|
|
70
|
-
* foundOf(F, ini) → { docs, linked, ran } the kept found items, as the initiative's own
|
|
70
|
+
* foundOf(F, ini) → { docs, linked, ran } the kept found items, as the initiative's own (a live round's prototype: only the current one)
|
|
71
|
+
* currentOf(F, ini) PURE → the initiative's prototype now: the newest proven version, or the one the PM kept since | null
|
|
71
72
|
* historyOf(F, uid) → [entry] Claude's approved changes to one task, newest first, each with its reason and source
|
|
72
73
|
* decorate(rows, F, items, o) puts r.props and r.found on each Board row that has something
|
|
73
74
|
*/
|
|
@@ -301,17 +302,60 @@ function lessonsOn(lines, { match, on }) {
|
|
|
301
302
|
}
|
|
302
303
|
/** The kept proposal ids (a batch undone gives its proposals back). */
|
|
303
304
|
const keptIds = (F) => { const s = new Set(); for (const k of F.kept) if (!F.undone.has(k.batch)) for (const id of k.ids) s.add(id); return s; };
|
|
305
|
+
/** PURE. The initiative's prototype now (prototype by chatting, fix 2026-11-18): the newest proven one-version live round or version of it,
|
|
306
|
+
* or the version the PM kept from the tray since. A keep PMOS made by itself (agent:auto) never counts: a test round it kept became the
|
|
307
|
+
* initiative's design. A round started in a terminal (from cli, a test) counts only once the PM keeps it. A version the PM closed (✕) is
|
|
308
|
+
* not current; one that only expired still is.
|
|
309
|
+
* → { id, of, key, n, file, title, said, brief, at } | null (file: <round>/<key>/<key>.html under the specimens folder) */
|
|
310
|
+
function currentOf(F, ini) {
|
|
311
|
+
if (!F || !F.props) return null;
|
|
312
|
+
const exp = new Set((F.expired || []).map((x) => x.sig));
|
|
313
|
+
const closed = (p) => { const g = sigOf(p); return F.drops.has(g) && !exp.has(g); };
|
|
314
|
+
const live = (p) => !!p && p.ini === ini && isObj(p.data) && isObj(p.data.live);
|
|
315
|
+
const of = (p, file, at) => {
|
|
316
|
+
const d = p.data;
|
|
317
|
+
if (p.group === 'prototyped') {
|
|
318
|
+
const s = (Array.isArray(d.specimens) ? d.specimens : []).find((x) => isObj(x) && str(x.file) && (!file || x.file === file));
|
|
319
|
+
return s ? { id: p.id, of: p.id, key: str(s.key), n: 1, file: s.file, title: str(s.title), said: str(s.caption), brief: str(d.live.brief), at } : null;
|
|
320
|
+
}
|
|
321
|
+
if (p.group === 'improved' && str(d.file) && (!file || d.file === file)) return { id: p.id, of: str(d.of), key: str(d.base), n: Number(d.round) || 2, file: d.file, title: '', said: str(d.said), brief: str(d.changed), at };
|
|
322
|
+
return null;
|
|
323
|
+
};
|
|
324
|
+
const out = [];
|
|
325
|
+
for (const p of F.props.values()) {
|
|
326
|
+
if (!live(p) || closed(p)) continue;
|
|
327
|
+
// a round of several ways waits in the tray: only the PM's keep makes one of them the prototype
|
|
328
|
+
if (p.group === 'prototyped' && !((p.data.live.slots || []).length === 1)) continue;
|
|
329
|
+
// a round started in a terminal (`pmos lab round` without --chat: a test, a check) waits for the PM's keep too
|
|
330
|
+
if (p.data.live.from === 'cli') continue;
|
|
331
|
+
const c = of(p, '', p.at); if (c) out.push(c);
|
|
332
|
+
}
|
|
333
|
+
for (const k of F.kept || []) {
|
|
334
|
+
if (k.ini !== ini || (F.undone && F.undone.has(k.batch)) || k.by === 'agent:auto') continue;
|
|
335
|
+
for (const w of k.wrote) {
|
|
336
|
+
if (w.op !== 'doc' || w.kind !== 'prototype' || !/[?&]file=/.test(str(w.ref))) continue;
|
|
337
|
+
let file = ''; try { file = decodeURIComponent(str(w.ref).split(/[?&]file=/)[1].split('&')[0]); } catch { file = ''; }
|
|
338
|
+
for (const id of k.ids) { const p = F.props.get(String(id)); const c = live(p) ? of(p, file, k.at) : null; if (c) out.push(c); }
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
342
|
+
return out[0] || null;
|
|
343
|
+
}
|
|
304
344
|
/** What was kept that has no other store: the found documents, the Linked entries and the dates past stages ran. */
|
|
305
345
|
function foundOf(F, ini) {
|
|
306
346
|
const docs = [], linked = [], ran = {};
|
|
307
347
|
for (const k of F.kept) {
|
|
308
348
|
if (k.ini !== ini || F.undone.has(k.batch)) continue;
|
|
309
349
|
for (const w of k.wrote) {
|
|
350
|
+
if (w.op === 'doc' && w.source === 'PMOS, live round') continue; // a live round's prototype: only the current one, below
|
|
310
351
|
if (w.op === 'doc') docs.push({ id: w.id, title: w.title, source: w.source || '', at: w.at || '', ref: w.ref || '', kind: w.kind || 'doc', ...(w.claude ? { claude: true } : {}) });
|
|
311
352
|
else if (w.op === 'linked') linked.push({ id: w.id, label: w.title, ref: w.ref || '', title: w.why || '' });
|
|
312
353
|
else if (w.op === 'ran' && str(w.stage)) ran[w.stage] = { from: w.from || null, to: w.to || null, source: w.source || '' };
|
|
313
354
|
}
|
|
314
355
|
}
|
|
356
|
+
// the initiative's prototype is the version it is at now, never an older round someone kept (2026-11-18)
|
|
357
|
+
const cur = currentOf(F, ini);
|
|
358
|
+
if (cur) docs.push({ id: 'fd-proto-' + hash(ini), title: one(`Prototype · Version ${cur.n}${cur.said || cur.title ? ': ' + (cur.said || cur.title) : ''}`, 140), source: 'PMOS, live round', at: cur.at, ref: '/api/lab/specimen?file=' + encodeURIComponent(cur.file), kind: 'prototype', claude: true, version: cur.n });
|
|
315
359
|
docs.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
316
360
|
return docs.length || linked.length || Object.keys(ran).length ? { docs, linked, ran } : null;
|
|
317
361
|
}
|
|
@@ -504,5 +548,5 @@ function decorate(rows, F, items, o = {}) {
|
|
|
504
548
|
|
|
505
549
|
module.exports = {
|
|
506
550
|
LEDGER, GROUPS, TYPES, SOURCES, SOURCE_NAMES, RISK_DAYS, ledgerFile, read, readLines, append, fold, lessonsOf, clean, idOf, sigOf, itemSig, factsOf, tidyName, taskOf, lateOf,
|
|
507
|
-
datesOf, viewOf, foundOf, historyOf, decorate, keptIds, newBatch, dn, isoN, md, hash, workday, staleOf, expiredSince, EXPIRE_DAYS, EXPIRE_WHY,
|
|
551
|
+
datesOf, viewOf, foundOf, currentOf, historyOf, decorate, keptIds, newBatch, dn, isoN, md, hash, workday, staleOf, expiredSince, EXPIRE_DAYS, EXPIRE_WHY,
|
|
508
552
|
};
|
|
@@ -80,12 +80,17 @@ function liveAsk(ctx, key, text, wsId, refs = []) {
|
|
|
80
80
|
const LR = require('./live-round.js'), PR = require('./proposals.js');
|
|
81
81
|
let w = null; try { w = ctx.getWs ? ctx.getWs(wsId || null) : null; } catch { w = null; }
|
|
82
82
|
const dir = w && ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
83
|
-
const
|
|
84
|
-
|
|
83
|
+
const P = dir ? PR.read(dir) : null;
|
|
84
|
+
// the version the initiative is at now (lib/proposals.js currentOf): a change sentence means it even when no round waits (2026-11-18)
|
|
85
|
+
const cur = P ? PR.currentOf(P, ini) : null, open = P ? LR.waiting(P, ini) : null;
|
|
86
|
+
const it = LR.intentOf(q, { waiting: open || (cur ? { keys: [cur.key] } : null) });
|
|
87
|
+
// every other message on an initiative with a prototype carries where it is and how to change it, so the chat never hunts for files
|
|
88
|
+
const ctxLine = cur && w ? LR.contextOf(cur, { ini, ws: w.id, rt: ctx.runtimeDir || null }) : '';
|
|
89
|
+
if (!it || !w) return ctxLine ? { text: ctxLine + '\n\nThe PM says: ' + q, filed: false } : null;
|
|
85
90
|
// Wawan 2026-11-17 20:25, "iterative, like Claude Code design work": the round starts at once, no ✦ ask and no ✓. One version unless the
|
|
86
91
|
// PM asked for several; a change sentence while one is open is its next round. The Viewer shows it; the chat says what changed.
|
|
87
92
|
const live = (r) => (r && r.ok && r.round ? { id: r.round.proposal, ws: w.id, board: '' } : null);
|
|
88
|
-
const next = `From now on, when the PM asks to change the prototype, run \`pmos lab round ${ini} --ws ${w.id} --base <its letter> --brief "<the PM's words>"\` and say in one line what will change; a question about it you answer yourself.`;
|
|
93
|
+
const next = `From now on, when the PM asks to change the prototype, run \`pmos lab round ${ini} --ws ${w.id} --base <its letter> --chat --brief "<the PM's words>"\` and say in one line what will change; a question about it you answer yourself. Never write the prototype or an HTML file yourself.`;
|
|
89
94
|
if (it.kind === 'feedback') {
|
|
90
95
|
const r = LR.startNow({ ws: w.id, ini, brief: q, base: it.base, from: 'chat', refs });
|
|
91
96
|
const note = r.ok ? `[PMOS] PMOS is making the next version of ${it.base} (version ${r.round.n}) now, about a minute${it.point ? ', about the element the PM pointed at (' + (it.point.label || it.point.el) + ')' : ''}; it replaces the one in the Viewer when it renders, and you will be told what changed. Say in one line what will change. Do not build it here.`
|
|
@@ -100,7 +105,7 @@ function liveAsk(ctx, key, text, wsId, refs = []) {
|
|
|
100
105
|
}
|
|
101
106
|
const n = it.count === 2 ? 'two' : 'three', dirs = it.count === 2 ? 'A: <direction>|B: <direction>' : 'A: <direction>|B: <direction>|C: <direction>';
|
|
102
107
|
const note = `[PMOS] The PM asked to see ${n} ways. Do not write HTML or build anything in this chat. Choose ${n} clearly different directions, one short line each, then start them with exactly this one command: `
|
|
103
|
-
+ `\`pmos lab round ${ini} --ws ${w.id} --brief "<the PM's sentence>" --dirs "${dirs}"\`. `
|
|
108
|
+
+ `\`pmos lab round ${ini} --ws ${w.id} --chat --brief "<the PM's sentence>" --dirs "${dirs}"\`. `
|
|
104
109
|
+ `Then say in one line that the ${n} ways show side by side in the Viewer as each one renders, and that the PM picks one by naming it or pressing it. ` + next;
|
|
105
110
|
return { text: note + '\n\nThe PM says: ' + q, filed: false };
|
|
106
111
|
}
|
|
@@ -203,6 +203,10 @@ const WRITES = {
|
|
|
203
203
|
const add = LR.editsOf({ copy: body.copy, vars: body.vars }), old = LR.editsOf(was);
|
|
204
204
|
const next = { copy: { ...old.copy, ...add.copy }, vars: { ...old.vars, ...add.vars } };
|
|
205
205
|
try { fs.writeFileSync(f, JSON.stringify(next, null, 1)); } catch { return fail(ctx, res, 500, 'The edit was not saved'); }
|
|
206
|
+
// the edits are part of the version the initiative is at (2026-11-18: they lived only in edits.json): its kept line says so, once per
|
|
207
|
+
// new line edited (not on every key press)
|
|
208
|
+
const n0 = Object.keys(old.copy).length + Object.keys(old.vars).length, n1 = Object.keys(next.copy).length + Object.keys(next.vars).length;
|
|
209
|
+
if (n1 > n0) try { keptEdited(dir, String(body.file), next, g); } catch { /* edits.json holds them */ }
|
|
206
210
|
ctx.json(res, { ok: true, edits: next });
|
|
207
211
|
return true;
|
|
208
212
|
},
|
|
@@ -220,6 +224,22 @@ const WRITES = {
|
|
|
220
224
|
},
|
|
221
225
|
};
|
|
222
226
|
const COMMENTS = 'lab-comments.jsonl';
|
|
227
|
+
/** The experiment's kept specimen, when `file` is the initiative's current version: "Version n, with your edits in the Viewer (…)". */
|
|
228
|
+
function keptEdited(dir, file, ed, g) {
|
|
229
|
+
const F = PR.read(dir);
|
|
230
|
+
let ini = '';
|
|
231
|
+
for (const p of F.props.values()) {
|
|
232
|
+
const d = p.data || {};
|
|
233
|
+
if (!isObj(d.live)) continue;
|
|
234
|
+
if ((p.group === 'improved' && d.file === file) || (p.group === 'prototyped' && (d.specimens || []).some((x) => x && x.file === file))) { ini = p.ini; break; }
|
|
235
|
+
}
|
|
236
|
+
const cur = ini ? PR.currentOf(F, ini) : null;
|
|
237
|
+
if (!cur || cur.file !== file) return;
|
|
238
|
+
const nc = Object.keys(ed.copy).length, nv = Object.keys(ed.vars).length;
|
|
239
|
+
const what = [nc ? nc + (nc === 1 ? ' line of copy' : ' lines of copy') : '', nv ? nv + (nv === 1 ? ' tweak' : ' tweaks') : ''].filter(Boolean).join(' and ');
|
|
240
|
+
const AF = require('./artefacts.js'), by = (g.actor && /^(pm|agent):/.test(String(g.actor.by || ''))) ? g.actor : { by: 'agent:live-round' };
|
|
241
|
+
AF.set(AF.file(dir), { scope: 'experiment:' + ini, artefact: 'specimens', field: 'kept', text: `Version ${cur.n}, with your edits in the Viewer (${what}): ${cur.said || cur.title || ''} (${LAB.specimenUrl(file)})`.slice(0, 600), sources: [{ label: 'live round', ref: LAB.specimenUrl(file) }] }, by);
|
|
242
|
+
}
|
|
223
243
|
/** A live round's version file, by its specimen path (<round>/<key>/<key>.html): the absolute path, or null. */
|
|
224
244
|
function liveFile(ctx, file) {
|
|
225
245
|
const f = String(file || '');
|
|
@@ -240,7 +260,7 @@ function liveRound(ctx, res, b) {
|
|
|
240
260
|
const w = wsOf(ctx, typeof b.ws === 'string' && b.ws ? b.ws : null); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
241
261
|
const by = /^(pm|agent):[\w.:-]{1,80}$/.test(String(b.by || '')) ? b.by : 'agent:cli';
|
|
242
262
|
const input = { ws: w.id, board: typeof b.board === 'string' ? b.board : '', ini: String(b.ini || ''), brief: String(b.brief || ''), base: /^[A-C]$/i.test(String(b.base || '')) ? String(b.base).toUpperCase() : '',
|
|
243
|
-
dirs: typeof b.dirs === 'string' ? b.dirs : '', from: b.from === 'meeting' ? 'meeting' : b.propose ? 'chat' : 'cli', by, ...(b.one === true ? { count: 1 } : {}) };
|
|
263
|
+
dirs: typeof b.dirs === 'string' ? b.dirs : '', from: b.from === 'meeting' ? 'meeting' : b.from === 'chat' || b.propose ? 'chat' : 'cli', by, ...(b.one === true ? { count: 1 } : {}) };
|
|
244
264
|
const r = b.propose === true ? LR.proposeNow(input) : LR.startNow(input);
|
|
245
265
|
if (!r.ok) return fail(ctx, res, 409, r.error);
|
|
246
266
|
ctx.json(res, r);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.593.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.593.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
.pc-e.br path { stroke-dasharray: 4 3; }
|
|
97
97
|
.pc-e .hit { stroke: transparent; stroke-width: 12; stroke-dasharray: none; cursor: pointer; }
|
|
98
98
|
.pc-e[data-pc-scen]:hover path:not(.hit), .pc-e[data-pc-scen]:focus-visible path:not(.hit) { stroke: var(--cz-blue); }
|
|
99
|
-
.pc-e text { font-size: 9px; fill: var(--cz-ink3); }
|
|
99
|
+
.pc-e text { font-size: 9px; fill: var(--cz-ink3); paint-order: stroke; stroke: var(--cz-card); stroke-width: 4px; stroke-linejoin: round; } /* a label is never drawn over a line */
|
|
100
100
|
.pc-ln rect { fill: var(--cz-card); }
|
|
101
101
|
.pc-ln.alt rect { fill: var(--cz-well); }
|
|
102
102
|
.pc-ln text { font-weight: var(--fw-strong); }
|
|
@@ -111,7 +111,12 @@
|
|
|
111
111
|
.pc-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink2); font: inherit; font-size: var(--fs-meta); cursor: pointer; }
|
|
112
112
|
.pc-chip[aria-pressed="true"] { background: var(--cz-bluebg); color: var(--cz-blueink); border-color: transparent; }
|
|
113
113
|
|
|
114
|
-
/* the page copy */
|
|
114
|
+
/* the page copy: a side panel over the canvas, behind the toolbar's Page copy press (closed by default) */
|
|
115
|
+
.pc-side { position: absolute; top: 44px; right: 0; bottom: 0; z-index: 4; width: min(380px, 100%); overflow: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
|
|
116
|
+
.pc-side h3 { display: flex; align-items: center; gap: 8px; }
|
|
117
|
+
.pc-side h3 .pc-ib { margin-left: auto; width: 28px; height: 28px; }
|
|
118
|
+
.pc .pc-ib.upd { position: relative; }
|
|
119
|
+
.pc .pc-ib.upd::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--cz-ok); }
|
|
115
120
|
.pc-copy { display: flex; flex-direction: column; border: 1px solid var(--cz-hair); border-radius: 12px; overflow: hidden; }
|
|
116
121
|
.pc-cr { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--cz-hair); font-size: var(--fs-body); line-height: var(--lh-body); }
|
|
117
122
|
.pc-cr:first-child { border-top: 0; }
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* 2026-11-17). The initiative chat sits on the left; this draws the right side for a live round (lib/live-round.js), from the compare view
|
|
4
4
|
* pm/cozy-lab.js reads (GET /api/lab/compare: the version's file and its companions as data, lib/live-round.js partsAt).
|
|
5
5
|
*
|
|
6
|
-
* The toolbar: Point (S), Comment (C), Draw (D) · Phone, Desktop · Version n of N (‹ ›, Back to latest, Continue from version n) · zoom
|
|
6
|
+
* The toolbar: Point (S), Comment (C), Draw (D) · Page copy (a side panel, closed by default: Wawan 2026-11-18) · Phone, Desktop · Version n of N (‹ ›, Back to latest, Continue from version n) · zoom
|
|
7
7
|
* −, +, fit · Play. Icon-only presses with aria-labels.
|
|
8
8
|
* The cards, which update together: the prototype in a phone or desktop frame (Tweaks under it for the element pointed at, the comments,
|
|
9
9
|
* the ✦ test-link suggestion); the flow (screens as cards, decisions as diamonds, drawn as SVG from flow.json: a screen shows that moment
|
|
10
|
-
* on the prototype, a branch plays its scenario); the page copy (copy.json, edited in place: the prototype changes as the PM types and
|
|
10
|
+
* 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
|
|
11
11
|
* 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).
|
|
12
12
|
* A card the version changed says Updated (compare.updated).
|
|
13
13
|
* Three ways (a round with several versions): a tray; a press previews one; ✓ keeps it, ✕ closes the round.
|
|
@@ -31,6 +31,7 @@ const I = {
|
|
|
31
31
|
prev: 'M15 6l-6 6 6 6', next: 'M9 6l6 6-6 6', latest: 'M5 12h14M13 6l6 6-6 6', cont: 'M4 12a8 8 0 1 0 2.3-5.6L4 9M4 4v5h5',
|
|
32
32
|
restart: 'M4 12a8 8 0 1 0 2.3-5.6L4 9M4 4v5h5', x: 'M6 6l12 12M18 6L6 18', check: 'M5 12l5 5 9-10', send: 'M12 19V5M6 11l6-6 6 6',
|
|
33
33
|
keep: 'M6 4h12v16l-6-4-6 4z', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
|
|
34
|
+
text: 'M4 7V5h16v2M12 5v14M9 19h6',
|
|
34
35
|
attach: 'M20 11l-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7', star: 'M12 3l2.2 6.3H21l-5.4 4 2 6.4L12 15.8 6.4 19.7l2-6.4L3 9.3h6.8z',
|
|
35
36
|
};
|
|
36
37
|
const ib = (attr, label, icon, cls = '') => `<button type="button" class="pc-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16)}</button>`;
|
|
@@ -53,9 +54,13 @@ if (typeof document !== 'undefined' && typeof document.createElement === 'functi
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/* ── layout (PURE) ── */
|
|
56
|
-
const SW = 132, SH = 58,
|
|
57
|
-
/**
|
|
58
|
-
|
|
57
|
+
const SW = 132, SH = 58, DH = 70, GX = 76, GY = 34, PAD = 16, CH = 18;
|
|
58
|
+
/** The width of a decision diamond: wide enough for its words in two lines inside the shape (2026-11-18: "What does th" was cut). */
|
|
59
|
+
const diaW = (t) => Math.max(120, Math.min(200, Math.ceil(String(t || '').length / 2) * 6.4 / 0.55 + 16));
|
|
60
|
+
/** PURE. flow → { w, h, nodes: [{ id, kind, title, x, y, w, h, main, chars }], edges: [{ from, to, label, d, lx, ly, main, anchor }] }.
|
|
61
|
+
* Columns by the shortest path from the first screen. The main scenario is ONE row; side branches sit in rows below their column. A line
|
|
62
|
+
* going back runs in its own channel: above the main row when it leaves the main row, under everything when it leaves a branch, so lines
|
|
63
|
+
* never run through a box or cross a label (Wawan 2026-11-18: "too many overlapping components and lines"). */
|
|
59
64
|
export function flowLayout(flow) {
|
|
60
65
|
const f = flow || {}, nodes = [...(f.screens || []).map((s) => ({ ...s, kind: 'screen' })), ...(f.decisions || []).map((d) => ({ ...d, kind: 'decision' }))];
|
|
61
66
|
if (!nodes.length) return { w: 0, h: 0, nodes: [], edges: [] };
|
|
@@ -65,32 +70,60 @@ export function flowLayout(flow) {
|
|
|
65
70
|
while (q.length) { const u = q.shift(); for (const e of out.get(u)) if (!col.has(e.to)) { col.set(e.to, col.get(u) + 1); q.push(e.to); } }
|
|
66
71
|
let extra = Math.max(0, ...col.values()) + 1;
|
|
67
72
|
for (const n of nodes) if (!col.has(n.id)) col.set(n.id, extra++);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
n
|
|
74
|
-
n.x = PAD + n.c * cw + (SW - n.w) / 2; n.y = PAD + n.r * rh + (SH + 10 - n.h) / 2;
|
|
75
|
-
n.main = n.kind === 'decision' || main.size === 0 || main.has(n.id);
|
|
73
|
+
const steps = new Set(((f.scenarios || [])[0] || { steps: [] }).steps.map((s) => s.screen));
|
|
74
|
+
// the main row: the first scenario's screens and the decisions between them (no scenario: the first node of each column)
|
|
75
|
+
const onMain = new Set();
|
|
76
|
+
if (steps.size) {
|
|
77
|
+
for (const n of nodes) if (steps.has(n.id)) onMain.add(n.id);
|
|
78
|
+
for (const n of nodes) if (n.kind === 'decision' && [...out.get(n.id)].some((e) => steps.has(e.to)) && (f.edges || []).some((e) => e.to === n.id && steps.has(e.from))) onMain.add(n.id);
|
|
76
79
|
}
|
|
80
|
+
const rowsUsed = new Map(); // column → next free row
|
|
81
|
+
const taken = new Set();
|
|
82
|
+
for (const n of [...nodes].sort((x, y) => (onMain.has(y.id) ? 1 : 0) - (onMain.has(x.id) ? 1 : 0))) {
|
|
83
|
+
const c = col.get(n.id);
|
|
84
|
+
let r = onMain.has(n.id) || (!steps.size && !taken.has(c + ':0')) ? 0 : Math.max(1, rowsUsed.get(c) || 1);
|
|
85
|
+
while (taken.has(c + ':' + r)) r += 1;
|
|
86
|
+
taken.add(c + ':' + r); rowsUsed.set(c, Math.max(rowsUsed.get(c) || 1, r + 1));
|
|
87
|
+
n.c = c; n.r = r;
|
|
88
|
+
}
|
|
89
|
+
for (const n of nodes) { n.w = n.kind === 'decision' ? diaW(n.title) : SW; n.h = n.kind === 'decision' ? DH : SH; }
|
|
90
|
+
const nc = Math.max(...nodes.map((n) => n.c)) + 1, cw = [];
|
|
91
|
+
for (let c = 0; c < nc; c += 1) cw[c] = Math.max(SW, ...nodes.filter((n) => n.c === c).map((n) => n.w));
|
|
92
|
+
const cx = []; let acc = PAD; for (let c = 0; c < nc; c += 1) { cx[c] = acc; acc += cw[c] + GX; }
|
|
93
|
+
// the back lines that leave the main row run in channels above it; the others under everything
|
|
94
|
+
const raw = (f.edges || []).map((e) => ({ e, a: by.get(e.from), b: by.get(e.to) })).filter((x) => x.a && x.b);
|
|
95
|
+
const back = (x) => x.b.c <= x.a.c && x.a !== x.b;
|
|
96
|
+
const up = raw.filter((x) => back(x) && x.a.r === 0), down = raw.filter((x) => back(x) && x.a.r > 0);
|
|
97
|
+
const top = PAD + up.length * CH + (up.length ? 6 : 0), rh = Math.max(SH, DH) + GY;
|
|
98
|
+
for (const n of nodes) { n.x = cx[n.c] + (cw[n.c] - n.w) / 2; n.y = top + n.r * rh + (Math.max(SH, DH) - n.h) / 2; n.main = n.kind === 'decision' ? onMain.has(n.id) || !steps.size : !steps.size || steps.has(n.id); }
|
|
99
|
+
const bottom = Math.max(...nodes.map((n) => n.y + n.h));
|
|
77
100
|
const edges = [];
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
let d, lx, ly;
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
raw.forEach((x) => {
|
|
102
|
+
const { e, a, b } = x;
|
|
103
|
+
let d, lx, ly, anchor = 'middle';
|
|
104
|
+
if (back(x)) {
|
|
105
|
+
// its own channel: k-th line above or under, entering and leaving at a quarter of the box so two lines do not share a segment
|
|
106
|
+
const i = up.includes(x) ? up.indexOf(x) : down.indexOf(x), isUp = up.includes(x);
|
|
107
|
+
const x1 = a.x + a.w * (isUp ? 0.7 : 0.5), x2 = b.x + b.w * 0.3;
|
|
108
|
+
if (isUp) { const yc = PAD + i * CH + 4; d = `M${x1} ${a.y}V${yc}H${x2}V${b.y - 2}`; ly = yc - 4; }
|
|
109
|
+
else { const yc = bottom + 16 + i * CH, y2 = b.y + b.h; d = `M${x1} ${a.y + a.h}V${yc}H${x2}V${y2 + 2}`; ly = yc - 4; }
|
|
110
|
+
lx = (x1 + x2) / 2;
|
|
111
|
+
} else if (a.r === b.r) {
|
|
112
|
+
const x1 = a.x + a.w, y1 = a.y + a.h / 2, x2 = b.x, y2 = b.y + b.h / 2;
|
|
113
|
+
d = `M${x1} ${y1}H${(x1 + x2) / 2}V${y2}H${x2 - 2}`; lx = (x1 + x2) / 2; ly = Math.min(y1, y2) - 7;
|
|
114
|
+
} else if (b.r > a.r) {
|
|
115
|
+
// down to a side branch: out of the bottom of the box, then across, the label beside the drop
|
|
116
|
+
const x1 = a.x + a.w / 2, y1 = a.y + a.h, y2 = b.y + b.h / 2;
|
|
117
|
+
d = `M${x1} ${y1}V${y2}H${b.x - 2}`; lx = x1 + 6; ly = y1 + (y2 - y1) / 2 + 3; anchor = 'start';
|
|
85
118
|
} else {
|
|
86
|
-
//
|
|
87
|
-
const x1 = a.x + a.w
|
|
88
|
-
d = `M${x1} ${y1}
|
|
119
|
+
// up from a branch to a later main box: across the gap, then up into its bottom
|
|
120
|
+
const x1 = a.x + a.w, y1 = a.y + a.h / 2, x2 = b.x + b.w / 2;
|
|
121
|
+
d = `M${x1} ${y1}H${x2}V${b.y + b.h + 2}`; lx = x1 + (x2 - x1) / 2; ly = y1 - 7;
|
|
89
122
|
}
|
|
90
|
-
edges.push({ from: e.from, to: e.to, label: e.label || '', d, lx, ly, main: a.main && b.main });
|
|
91
|
-
}
|
|
92
|
-
const w = Math.max(...nodes.map((n) => n.x + n.w)) + PAD, h =
|
|
93
|
-
return { w, h, nodes: nodes.map(({ id, kind, title, x, y, w: nw, h: nh, main: m }) => ({ id, kind, title, x, y, w: nw, h: nh, main: m })), edges };
|
|
123
|
+
edges.push({ from: e.from, to: e.to, label: e.label || '', d, lx, ly, anchor, main: a.main && b.main });
|
|
124
|
+
});
|
|
125
|
+
const w = Math.max(...nodes.map((n) => n.x + n.w)) + PAD, h = bottom + (down.length ? 16 + down.length * CH : 0) + PAD;
|
|
126
|
+
return { w, h, nodes: nodes.map(({ id, kind, title, x, y, w: nw, h: nh, main: m }) => ({ id, kind, title, x, y, w: nw, h: nh, main: m, chars: kind === 'decision' ? Math.floor((nw * 0.55) / 6.4) : 21 })), edges };
|
|
94
127
|
}
|
|
95
128
|
const LW = 110, LH = 68, BW = 136, BH = 44, BG = 26;
|
|
96
129
|
/** PURE. lanes → { w, h, lanes: [{ id, name, y }], boxes: [{ n, title, screen, x, y, lane }], arrows: [{ d }] }: one column per step, in
|
|
@@ -112,7 +145,7 @@ export function lanesLayout(lanes) {
|
|
|
112
145
|
/* ── state ── */
|
|
113
146
|
const V = { body: null, c: null, at: null, H: null, last: null, mode: 'view', device: store.get('pmos.pc.device') || 'phone', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
114
147
|
sel: null, screen: '', frameUrl: '', ready: null, edits: { copy: {}, vars: {} }, pend: null, saveT: null, draft: null, drawing: false, strokes: 0,
|
|
115
|
-
play: null, sig: '' };
|
|
148
|
+
play: null, sig: '', copy: false };
|
|
116
149
|
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>';
|
|
117
150
|
const frameUrl = (c) => (c && c.url ? c.url + '&rt=1' : '');
|
|
118
151
|
const toFrame = (m, f) => { const fr = f || (V.body && V.body.querySelector('.pc-frame iframe')); if (fr && fr.contentWindow) fr.contentWindow.postMessage({ pmos: 1, ...m }, '*'); };
|
|
@@ -138,6 +171,8 @@ function barHtml(c, v) {
|
|
|
138
171
|
: `<span class="pc-ver"><b>Version ${c.round || 1}</b></span>`;
|
|
139
172
|
const z = Math.round((V.zoom || 1) * 100);
|
|
140
173
|
return `<div class="pc-bar" role="toolbar" aria-label="Prototype tools"><span class="pc-grp">${tool('point', 'Point at an element', I.point, 'S')}${tool('comment', 'Comment', I.comment, 'C')}${tool('draw', 'Draw a sketch', I.draw, 'D')}</span>`
|
|
174
|
+
// the page copy sits behind its own press (Wawan 2026-11-18: a 40-row table pushed the canvas down), closed by default
|
|
175
|
+
+ `<span class="pc-grp">${ib(`data-pc-copyp aria-pressed="${V.copy}"`, 'Page copy', I.text, (c.updated || {}).copy ? 'upd' : '')}</span>`
|
|
141
176
|
+ `<span class="pc-grp">${dev('phone', 'Phone', I.phone)}${dev('desktop', 'Desktop', I.desk)}</span>${ver}<span class="pc-sp"></span>`
|
|
142
177
|
+ `<span class="pc-grp">${ib('data-pc-zoom="-1"', 'Zoom out', I.minus)}<span class="pc-z" aria-live="polite">${z}%</span>${ib('data-pc-zoom="1"', 'Zoom in', I.plus)}${ib('data-pc-zoom="0"', 'Fit to the Viewer', I.fit)}</span>`
|
|
143
178
|
+ `${ib('data-pc-play', 'Play the prototype', I.play, 'blue')}</div>`;
|
|
@@ -176,18 +211,20 @@ function flowCard(c, v) {
|
|
|
176
211
|
const L = flowLayout(f), scen = f.scenarios || [];
|
|
177
212
|
const branchOf = (to) => { for (let i = 1; i < scen.length; i += 1) if (scen[i].steps.some((s) => s.screen === to)) return scen[i].id; return ''; };
|
|
178
213
|
const nodes = L.nodes.map((n) => n.kind === 'decision'
|
|
179
|
-
? `<g class="pc-dn"><path d="M${n.x + n.w / 2} ${n.y}L${n.x + n.w} ${n.y + n.h / 2}L${n.x + n.w / 2} ${n.y + n.h}L${n.x} ${n.y + n.h / 2}Z"/><text
|
|
214
|
+
? `<g class="pc-dn"><path d="M${n.x + n.w / 2} ${n.y}L${n.x + n.w} ${n.y + n.h / 2}L${n.x + n.w / 2} ${n.y + n.h}L${n.x} ${n.y + n.h / 2}Z"/><text text-anchor="middle">${lines(n.title, n.x + n.w / 2, n.y + n.h / 2 + (String(n.title).length > n.chars ? -2 : 4), n.chars, 12)}</text></g>`
|
|
180
215
|
: `<g class="pc-sn${n.main ? '' : ' br'}${V.screen === n.id ? ' on' : ''}" data-pc-screen="${esc(n.id)}" role="button" tabindex="0" aria-label="${esc('Show ' + n.title + ' on the prototype')}"><rect x="${n.x}" y="${n.y}" width="${n.w}" height="${n.h}" rx="8"/><text x="${n.x + 10}" y="${n.y + 15}" class="k">SCREEN</text><text>${lines(n.title, n.x + 10, n.y + 31, 21)}</text></g>`).join('');
|
|
181
|
-
const edges = L.edges.map((e) => { const sc = e.main ? '' : branchOf(e.to); return `<g class="pc-e${e.main ? '' : ' br'}"${sc ? ` data-pc-scen="${esc(sc)}" role="button" tabindex="0" aria-label="${esc('Play ' + (scen.find((x) => x.id === sc) || {}).name)}"` : ''}><path d="${e.d}" marker-end="url(#pcArr)"/>${sc ? `<path class="hit" d="${e.d}"/>` : ''}${e.label ? `<text x="${e.lx}" y="${e.ly}">${esc(e.label)}</text>` : ''}</g>`; }).join('');
|
|
216
|
+
const edges = L.edges.map((e) => { const sc = e.main ? '' : branchOf(e.to); return `<g class="pc-e${e.main ? '' : ' br'}"${sc ? ` data-pc-scen="${esc(sc)}" role="button" tabindex="0" aria-label="${esc('Play ' + (scen.find((x) => x.id === sc) || {}).name)}"` : ''}><path d="${e.d}" marker-end="url(#pcArr)"/>${sc ? `<path class="hit" d="${e.d}"/>` : ''}${e.label ? `<text x="${e.lx}" y="${e.ly}" text-anchor="${e.anchor || 'middle'}">${esc(e.label)}</text>` : ''}</g>`; }).join('');
|
|
182
217
|
const chips = scen.length ? `<div class="pc-scens">${scen.map((s, i) => `<button type="button" class="pc-chip" data-pc-scen="${esc(s.id)}" title="${esc(s.description || '')}">${SVG(I.play, 12)}${esc(i === 0 ? s.name : s.name)}</button>`).join('')}</div>` : '';
|
|
183
218
|
return `<section class="pc-card pc-flowc" aria-label="The flow"><h3>The flow ${upd(c, 'flow')}</h3><div class="pc-svgw"><svg class="pc-flow" width="100%" style="max-width:${L.w}px" viewBox="0 0 ${L.w} ${L.h}" preserveAspectRatio="xMinYMin meet"><defs>${ARROW}</defs>${edges}${nodes}</svg></div>`
|
|
184
219
|
+ `<p class="pc-hint">Tap a screen to see it on the prototype. Tap a side branch to play that scenario.</p>${chips}</section>`;
|
|
185
220
|
}
|
|
186
221
|
function copyCard(c, v) {
|
|
222
|
+
if (!V.copy) return '';
|
|
223
|
+
const close = ib('data-pc-copyp', 'Close the page copy', I.x);
|
|
187
224
|
const copy = (v.data || {}).copy || {}, keys = Object.keys(copy);
|
|
188
|
-
if (!keys.length) return `<section class="pc-card pc-copyc" aria-label="Page copy"><h3>Page copy</h3><p class="pc-none">${esc(v.url ? 'This version has no editable copy.' : 'PMOS is writing it.')}</p></section>`;
|
|
225
|
+
if (!keys.length) return `<section class="pc-card pc-copyc pc-side" aria-label="Page copy"><h3>Page copy ${close}</h3><p class="pc-none">${esc(v.url ? 'This version has no editable copy.' : 'PMOS is writing it.')}</p></section>`;
|
|
189
226
|
const changed = new Set((c.updated && c.updated.keys) || []);
|
|
190
|
-
return `<section class="pc-card pc-copyc" aria-label="Page copy"><h3>Page copy ${upd(c, 'copy')}</h3><div class="pc-copy" role="table">${keys.map((k) => `<div class="pc-cr${changed.has(k) ? ' ch' : ''}" role="row"><span role="rowheader">${esc(human(k))}</span><span role="cell" contenteditable="plaintext-only" spellcheck="true" data-pc-copy="${esc(k)}" aria-label="${esc(human(k))}">${esc(k in V.edits.copy ? V.edits.copy[k] : copy[k])}</span></div>`).join('')}</div>`
|
|
227
|
+
return `<section class="pc-card pc-copyc pc-side" aria-label="Page copy"><h3>Page copy ${upd(c, 'copy')}${close}</h3><div class="pc-copy" role="table">${keys.map((k) => `<div class="pc-cr${changed.has(k) ? ' ch' : ''}" role="row"><span role="rowheader">${esc(human(k))}</span><span role="cell" contenteditable="plaintext-only" spellcheck="true" data-pc-copy="${esc(k)}" aria-label="${esc(human(k))}">${esc(k in V.edits.copy ? V.edits.copy[k] : copy[k])}</span></div>`).join('')}</div>`
|
|
191
228
|
+ '<p class="pc-hint">Edit any line: the prototype changes as you type, and the next version keeps it.</p></section>';
|
|
192
229
|
}
|
|
193
230
|
function lanesCard(c, v) {
|
|
@@ -214,7 +251,7 @@ export function draw(body, c, o = {}) {
|
|
|
214
251
|
if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
|
|
215
252
|
V.body = body;
|
|
216
253
|
// keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
|
|
217
|
-
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.updated, c.parts, (c.comments || []).length, V.mode, V.device, V.sel && V.sel.el, !!V.draft, (c.history || []).length, c.state]);
|
|
254
|
+
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.updated, c.parts, (c.comments || []).length, V.mode, V.device, V.sel && V.sel.el, !!V.draft, (c.history || []).length, c.state, V.copy]);
|
|
218
255
|
const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input');
|
|
219
256
|
if (sig === V.sig && root.firstChild) return;
|
|
220
257
|
if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
|
|
@@ -222,7 +259,7 @@ export function draw(body, c, o = {}) {
|
|
|
222
259
|
const frame = root.querySelector('.pc-frame iframe'), keepFrame = frame && V.frameUrl === frameUrl(v);
|
|
223
260
|
const draftText = root.querySelector('#pcCm') ? root.querySelector('#pcCm').value : '';
|
|
224
261
|
if (keepFrame) frame.remove();
|
|
225
|
-
root.innerHTML = barHtml(c, v) + trayHtml(c) + `<div class="pc-vp"><div class="pc-board">${protoCard(c, v, making)}<div class="pc-col">${flowCard(c, v)}
|
|
262
|
+
root.innerHTML = barHtml(c, v) + trayHtml(c) + `<div class="pc-vp"><div class="pc-board">${protoCard(c, v, making)}<div class="pc-col">${flowCard(c, v)}</div>${lanesCard(c, v)}</div></div>` + copyCard(c, v) + (V.play ? playHtml(v) : '');
|
|
226
263
|
const slot = root.querySelector('[data-pc-frame]');
|
|
227
264
|
if (slot && v.url) {
|
|
228
265
|
if (keepFrame) slot.appendChild(frame);
|
|
@@ -281,6 +318,7 @@ function wire(root) {
|
|
|
281
318
|
const b = e.target.closest('button, [data-pc-screen], [data-pc-scen]'); if (!b || !root.contains(b)) return;
|
|
282
319
|
const d = b.dataset;
|
|
283
320
|
if (d.pcMode) { setMode(V.mode === d.pcMode ? 'view' : d.pcMode); return; }
|
|
321
|
+
if ('pcCopyp' in d) { V.copy = !V.copy; V.sig = ''; draw(V.body, V.c); return; }
|
|
284
322
|
if (d.pcDev) { V.device = d.pcDev; store.set('pmos.pc.device', V.device); V.sig = ''; draw(V.body, V.c); return; }
|
|
285
323
|
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; }
|
|
286
324
|
if ('pcPlay' in d) { const sc = ((V.v.data || {}).flow || {}).scenarios || []; startPlay(sc.length ? sc[0].id : '', 0, true); return; }
|