create-pmos 0.596.0 → 0.597.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 +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 +13 -0
- package/workspace/guide/agent-capabilities.md +2 -2
- package/workspace/lib/idle-lab.js +9 -3
- package/workspace/lib/lab-cli.js +2 -2
- package/workspace/lib/live-round.js +38 -19
- package/workspace/lib/routes-lab.js +10 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-proto.css +7 -0
- package/workspace/public/pm/cozy-proto.js +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.597.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.597.0",
|
|
38
|
+
"at": "2026-11-18T03:47:49.565Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1339,
|
|
43
|
+
"t": "No time limit, progress with Stop, and a version that was not made still opens",
|
|
44
|
+
"s": "No time limit, progress with Stop, and a version that was not made still opens",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.596.0",
|
|
38
51
|
"at": "2026-11-18T03:21:21.557Z",
|
|
@@ -297,19 +310,6 @@
|
|
|
297
310
|
"k": "new"
|
|
298
311
|
}
|
|
299
312
|
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"v": "0.577.0",
|
|
303
|
-
"at": "2026-11-17T01:37:16.629Z",
|
|
304
|
-
"f": 4,
|
|
305
|
-
"prs": [
|
|
306
|
-
{
|
|
307
|
-
"n": 1310,
|
|
308
|
-
"t": "Improvement signals ledger, 183 feedback items, honest shallow clone, verifier that runs anywhere",
|
|
309
|
-
"s": "Improvement signals ledger, 183 feedback items, honest shallow clone, verifier that runs anywhere",
|
|
310
|
-
"k": "new"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
313
|
}
|
|
314
314
|
]
|
|
315
315
|
}
|
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-18T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
|
|
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-18T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
|
|
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-18T03:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.597.0",
|
|
4
|
+
"at": "2026-11-18T03:47:49.565Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1339,
|
|
9
|
+
"t": "No time limit, progress with Stop, and a version that was not made still opens",
|
|
10
|
+
"s": "No time limit, progress with Stop, and a version that was not made still opens",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.596.0",
|
|
4
17
|
"at": "2026-11-18T03:21:21.557Z",
|
|
@@ -100,7 +100,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
|
|
|
100
100
|
| [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's success criteria, or the anchored key result | "Expected outcome" under the initiative's ✦. Today when a check is due. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
|
|
101
101
|
| [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
|
|
102
102
|
| [Horizon scan](intelligence-okr-goals.md) | Daily by default, at most once a day, the first time you step away after 09:00. Scan now: at most 3 a day. | The public web for your kept watch list, and your repository | Report documents and proposals you approve | Cadence: Off. `PMOS_SCAN=off` |
|
|
103
|
-
| Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once
|
|
103
|
+
| Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once. No time limit: you see its progress and can stop it. | The initiative's name, the product's Intent and its token sheet; a feedback round also reads the last version. | "PMOS prototyped it" or "PMOS improved it" under the initiative's ✦, each version as soon as it renders. | ✕ on its ✦ ask; Undo after ✓ |
|
|
104
104
|
| Idle lab | When you have not used PMOS for 30 minutes. One run at a time, at most 3 results each time you step away. | Prototypes: the initiative's record, PRD and earlier specimens. Scans: public pages only, read through `pmos lab page`, and no repository. | "PMOS prototyped it", "PMOS improved it" and "PMOS scanned for it" under the initiative's ✦. A finding that fits no initiative: Intelligence › Lab. | `pmos ai off idle-lab` |
|
|
105
105
|
| [Prototypes before a meeting](notes.md) | A meeting starts in the next 60 minutes, and its title, agenda or material names an initiative in Triage or Discover with no prototype. One round at a time. An initiative is tried once a week at most, and never while a round waits for you. | The initiative, as a live round reads it | Round 1 under the initiative's ✦ at minute 0. In the meeting, ✓ on **✦ Show it?** starts the next round. | `pmos ai off meeting-prewarm` |
|
|
106
106
|
| [What you might have missed](claude-proposes.md) | Each Monday, for the week before. It uses no model. | Records only: tasks, dates, initiatives and Jira status | One ✦ in Home's chat, at most 3 items | `pmos ai off drift`. `PMOS_DRIFT=off` |
|
|
@@ -216,7 +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
|
-
- **A version that does not render
|
|
219
|
+
- **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
220
|
- **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
221
|
- **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).
|
|
222
222
|
- **Order.** A live round is step 1 of the queue: what you asked for starts at once. While it runs, the idle lab does not start on that initiative. The idle lab treats a live round as one more round, so the rounds stay in one history.
|
|
@@ -256,7 +256,11 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
|
|
|
256
256
|
const file = p.group === 'improved' ? p.data.file : spec && spec.file;
|
|
257
257
|
const making = !!(p.data && p.data.live && (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving'));
|
|
258
258
|
// a live round still being made is readable before its file lands (the Viewer opens on it and reads again until it renders)
|
|
259
|
-
|
|
259
|
+
// a live version that was not made (its run failed or stopped) still opens: it says why and shows the version it was made from
|
|
260
|
+
// (Wawan 2026-11-18: "I click version 2, but got error page")
|
|
261
|
+
const lost = !file && !making && p.group === 'improved' && p.data && p.data.live ? ((p.data.live.slots || [])[0] || {}) : null;
|
|
262
|
+
if (!file && !lost && !(p.data && p.data.live && (p.group === 'prototyped' || making))) return null;
|
|
263
|
+
const fromFile = lost ? (() => { const f = rounds.find((r) => r.data.round === p.data.from && r.data.file); return f ? f.data.file : ((specs.find((s) => s.key === p.data.base) || {}).file || ''); })() : '';
|
|
260
264
|
const round = p.group === 'improved' ? p.data.round : 1;
|
|
261
265
|
const c = (p.data && p.data.compare) || {};
|
|
262
266
|
const cols = [];
|
|
@@ -291,8 +295,10 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
|
|
|
291
295
|
// the version's companions as data, read by the route next to its file (lib/routes-lab.js), and their state while it is being made
|
|
292
296
|
const slotNow = live ? (p.data.live.slots || []).find((s) => s.key === k) || (p.data.live.slots || [])[0] : null;
|
|
293
297
|
return { ini: p.ini, board: p.board || '', id: p.id, sig: PRsig(p), state: stateOf(p), title: name, round, key: k, say, columns: cols, pins, history,
|
|
294
|
-
...(file ? { file } : {}), ...(upd ? { updated: upd, also: p.data.also || '' } : {}), ...(slotNow && slotNow.parts ? { parts: slotNow.parts } : {}),
|
|
295
|
-
...(live ? { live: true, working: (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving' || Object.values(s.parts || {}).includes('working')) } : {})
|
|
298
|
+
...(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 } : {}),
|
|
299
|
+
...(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')) } : {}),
|
|
300
|
+
// what the run is doing now (its progress.json, lib/live-round.js progressOf): the Viewer's progress line while it is made
|
|
301
|
+
...(slotNow && slotNow.progress && making ? { progress: slotNow.progress } : {}) };
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
/** 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
|
@@ -144,8 +144,8 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
|
|
|
144
144
|
if (!r) { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
|
|
145
145
|
if (!r.ok) { say('✗ ' + (r.error || 'the round did not start')); return 1; }
|
|
146
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
|
|
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
|
|
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, or that it was not made. The Viewer shows its progress. Do not build it yourself.`); return 0; }
|
|
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; the Viewer shows its progress.`);
|
|
149
149
|
return 0;
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
* feedback ONE run on the base specimen (it reads the earlier file). Files group `improved`, `changed` = the PM's sentence.
|
|
25
25
|
* Each run gets a per-product scaffold (scaffoldOf: the product's tokens.css and the head of its components.css, else PMOS's own), the
|
|
26
26
|
* initiative's name, description and Intent, and the viewport pin (dry run finding a: 2 of 9 ran wider than the phone and were cut off).
|
|
27
|
-
*
|
|
27
|
+
* NO TIME LIMIT (Wawan 2026-11-18: "No need limit, but need a visual guidance of the progression"). The run writes progress.json
|
|
28
|
+
* ({ now, done, total }) at each step; the Viewer shows it with the time so far and a Stop press (stop()). Only a run that writes
|
|
29
|
+
* nothing for STALL_MS (no progress, no file) is stopped, and its slot says "not made" with the reason.
|
|
28
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
|
|
29
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
|
|
30
32
|
* slot is working, made (a thumbnail) or not made (why). Nothing is written to a product repository before ✓ (D60, D65).
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
* THE LEDGERS. The proposal lines are lib/proposals.js's (one id per round; the newest line for an id wins, so each proven file rewrites it).
|
|
35
37
|
* Each run's start and end are lines of <runtime>/idle-lab/runs.jsonl (job `live-round`), so its cost counts with the idle lab's.
|
|
36
38
|
*
|
|
37
|
-
* JOB ·
|
|
39
|
+
* JOB · STALL_MS · progressOf · KEYS · DEFAULT_DIRECTIONS · ORIGIN
|
|
38
40
|
* intentOf(text, { waiting }) PURE → { kind: 'new' | 'feedback', brief, base? } | null what a chat sentence asks for
|
|
39
41
|
* parseDirs(text) PURE → [{ key, title }] | null "A: …|B: …|C: …"
|
|
40
42
|
* askOf({ ini, board, brief, directions, base?, round?, from? }) PURE → the ✦ ask's proposal line (without at/by)
|
|
@@ -57,7 +59,14 @@ const E = require('./idle-lab-engine.js');
|
|
|
57
59
|
|
|
58
60
|
const JOB = 'live-round';
|
|
59
61
|
const ORIGIN = 'live-round';
|
|
60
|
-
const
|
|
62
|
+
const STALL_MS = 10 * 60 * 1000; // a run that writes nothing (no progress line, no file) this long is stuck
|
|
63
|
+
/** PURE. The run's progress.json, read loosely: { now, done, total } or null. */
|
|
64
|
+
function progressOf(j) {
|
|
65
|
+
if (!isObj(j)) return null;
|
|
66
|
+
const now = one(j.now, 140), total = Math.max(0, Math.min(99, Math.floor(Number(j.total) || 0))), done = Math.max(0, Math.min(total || 99, Math.floor(Number(j.done) || 0)));
|
|
67
|
+
return now || total ? { now, done, total } : null;
|
|
68
|
+
}
|
|
69
|
+
const minsOf = (ms) => { const m = Math.max(1, Math.round(ms / 60000)); return m + ' minute' + (m === 1 ? '' : 's'); };
|
|
61
70
|
const KEYS = Object.freeze(['A', 'B', 'C']);
|
|
62
71
|
const DEFAULT_DIRECTIONS = Object.freeze([
|
|
63
72
|
Object.freeze({ key: 'A', title: 'Summary first: the plainest layout, a few rows and a quiet meta line' }),
|
|
@@ -242,6 +251,7 @@ function promptOf(o) {
|
|
|
242
251
|
// the design sprint's good practice, silent (Wawan 2026-11-17: "the design sprint runs in silent"): a target user, one question, real
|
|
243
252
|
// content, Goldilocks fidelity. Never a step the PM has to fill in.
|
|
244
253
|
L.push('', 'Good practice, in the background: work out from the initiative who this is for and the one question the prototype must answer, and build for that. Real content from the initiative, never placeholders. Just real enough to react to, not polished. 2 to 6 screens.');
|
|
254
|
+
L.push('', `Progress: the PM watches it. Before you start and after each step, overwrite ${path.join(dir, 'progress.json')} with { "now": "<what you are doing, e.g. Reading the design brief, Building screen 3 of 7: AST1 7680×1550, Writing the flow>", "done": <steps done>, "total": <steps in all> }. Take as long as the idea needs.`);
|
|
245
255
|
L.push('', `Write these files with the Write tool, in this order, in ${dir}:`,
|
|
246
256
|
`1. ${o.file}: the prototype. Write it FIRST: the PM sees it as soon as it lands.`,
|
|
247
257
|
' - One self-contained HTML page: inline CSS only, no script, no network, no image files. Real draft copy, never lorem ipsum or a placeholder.',
|
|
@@ -404,7 +414,7 @@ function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
|
|
|
404
414
|
const fin = (x) => x.state === 'ok' || x.state === 'not made' || x.state === 'none';
|
|
405
415
|
const partsLine = (s) => Object.fromEntries((s.parts || []).map((x) => [x.kind, x.state === 'not made' ? 'not made: ' + one(x.why, 120) : x.state]));
|
|
406
416
|
function roundLine(R, now) {
|
|
407
|
-
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.parts || []).length ? { parts: partsLine(s) } : {}) }));
|
|
417
|
+
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) } : {}) }));
|
|
408
418
|
const ok = R.slots.filter((s) => s.state === 'ok');
|
|
409
419
|
const done = R.slots.every((s) => fin(s) && (s.parts || []).every(fin));
|
|
410
420
|
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(', ') + ')' : '';
|
|
@@ -426,14 +436,13 @@ function roundLine(R, now) {
|
|
|
426
436
|
* deps: { runtimeDir() → folder, product(ws) → { w: { id, root }, dir } | null, info(ws, ini) → { title, board, description?, intent? } | null,
|
|
427
437
|
* spawn(spec) → session (server spawnSession: { name, agent, ws, origin, initialInput, initiative, writePaths, addDirs, onDone }),
|
|
428
438
|
* stop(session), render?(abs) → Promise<{ ok, w, h, why? }>, artefact?(dir, line) (lib/artefacts.js set, as agent:live-round),
|
|
429
|
-
* ownRoot? (PMOS's own folder, for the scaffold), pollMs?,
|
|
439
|
+
* ownRoot? (PMOS's own folder, for the scaffold), pollMs?, stallMs?, now?() , warn(what, e) }
|
|
430
440
|
*/
|
|
431
441
|
function create(deps) {
|
|
432
442
|
const warn = deps.warn || (() => {});
|
|
433
443
|
const now = () => (deps.now ? deps.now() : Date.now());
|
|
434
444
|
const render = deps.render || ((abs) => E.renderCheck(abs, { phone: true })); // proven at 390 px too: the viewport pin
|
|
435
445
|
const pollMs = deps.pollMs || 1000;
|
|
436
|
-
const budgetMs = deps.budgetMs || BUDGET_MS;
|
|
437
446
|
const rounds = new Map(); // id → round
|
|
438
447
|
|
|
439
448
|
function lesson(dir, ini, text, by = 'agent:live-round') {
|
|
@@ -481,7 +490,8 @@ function create(deps) {
|
|
|
481
490
|
// the off switch (`pmos ai off live-round`, or every AI job off) holds it, as it holds every other job
|
|
482
491
|
let off = null; try { off = require('./ai-guard.js').off(JOB, { env: deps.env || process.env, settingsDir: rt }); } catch { off = null; }
|
|
483
492
|
if (off) return { ok: false, error: 'live rounds are off: ' + off };
|
|
484
|
-
|
|
493
|
+
const busy = runningOf(c.ini);
|
|
494
|
+
if (busy) return { ok: false, error: `Version ${busy.n} is still being made on this initiative${busy.progress && busy.progress.now ? ' (' + busy.progress.now + (busy.progress.total ? ', ' + busy.progress.done + ' of ' + busy.progress.total + ' done' : '') + ')' : ''}, ${minsOf(now() - busy.start)} so far. Wait for it, or stop it in the Viewer.` };
|
|
485
495
|
const t = now(), id = 'lr' + t.toString(36) + crypto.randomBytes(3).toString('hex');
|
|
486
496
|
const from = FROM[input.from] ? input.from : 'chat', step = Number(input.step) === 2 ? 2 : 1;
|
|
487
497
|
const P = PR.read(c.dir);
|
|
@@ -514,8 +524,7 @@ function create(deps) {
|
|
|
514
524
|
for (const s of R.slots) launch(R, s, { info: c.info, scaffold, b });
|
|
515
525
|
R.timer = setInterval(() => { poll(R).catch((e) => warn('live round poll', e)); }, pollMs);
|
|
516
526
|
if (R.timer.unref) R.timer.unref();
|
|
517
|
-
R.
|
|
518
|
-
if (R.budget.unref) R.budget.unref();
|
|
527
|
+
R.stallMs = deps.stallMs || STALL_MS; R.seen = t;
|
|
519
528
|
settle(R);
|
|
520
529
|
return { ok: true, round: { id, n: R.n, keys: R.slots.map((s) => s.key), directions: R.slots.map((s) => ({ key: s.key, title: s.title })), proposal: R.propId, parts: PARTS.map((x) => x.kind) }, runs: R.slots.map((s) => s.run) };
|
|
521
530
|
}
|
|
@@ -599,14 +608,20 @@ function create(deps) {
|
|
|
599
608
|
}
|
|
600
609
|
async function poll(R) {
|
|
601
610
|
for (const s of R.slots) {
|
|
611
|
+
// the run's own progress line: what it is doing now, steps done and left (the Viewer's progress line)
|
|
612
|
+
if (s.state === 'working' && s.abs) {
|
|
613
|
+
let pj = null; try { pj = progressOf(JSON.parse(fs.readFileSync(path.join(path.dirname(s.abs), 'progress.json'), 'utf8'))); } catch { pj = null; }
|
|
614
|
+
if (pj && JSON.stringify(pj) !== JSON.stringify(s.progress || null)) { s.progress = pj; R.seen = now(); write(R); }
|
|
615
|
+
}
|
|
602
616
|
for (const x of s.state === 'not made' ? [] : [s, ...(s.parts || [])]) {
|
|
603
617
|
if (x.state !== 'working') continue;
|
|
604
618
|
let size = -1; try { size = fs.statSync(x.abs).size; } catch { size = -1; }
|
|
605
619
|
// a file that stopped growing for one poll has landed: prove it now, before the run ends
|
|
606
620
|
if (size > 0 && size === x.size) { if (x === s) await prove(R, s); else provePart(R, s, x); }
|
|
607
|
-
else x.size = size;
|
|
621
|
+
else { if (size !== x.size) R.seen = now(); x.size = size; }
|
|
608
622
|
}
|
|
609
623
|
}
|
|
624
|
+
if (!R.ended && now() - R.seen > R.stallMs) over(R, 'it stopped making progress: nothing new for ' + minsOf(R.stallMs));
|
|
610
625
|
}
|
|
611
626
|
async function ended(R, s, res = {}) {
|
|
612
627
|
const out = (res && res.result) || {};
|
|
@@ -623,12 +638,12 @@ function create(deps) {
|
|
|
623
638
|
if (have) provePart(R, s, x); else partNotMade(R, s, x, 'the run ended without writing ' + x.name);
|
|
624
639
|
}
|
|
625
640
|
}
|
|
626
|
-
function over(R) {
|
|
641
|
+
function over(R, why) {
|
|
627
642
|
for (const s of R.slots) {
|
|
628
643
|
const busy = [s, ...(s.parts || [])].some((x) => x.state === 'working');
|
|
629
644
|
if (busy && s.session && s.session.state !== 'exited' && deps.stop) try { deps.stop(s.session); } catch { /* best effort */ }
|
|
630
|
-
if (s.state === 'working') notMade(R, s,
|
|
631
|
-
for (const x of s.parts || []) partNotMade(R, s, x,
|
|
645
|
+
if (s.state === 'working') notMade(R, s, why); // a file being proven finishes its proof
|
|
646
|
+
for (const x of s.parts || []) partNotMade(R, s, x, why);
|
|
632
647
|
}
|
|
633
648
|
}
|
|
634
649
|
function settle(R) {
|
|
@@ -636,7 +651,7 @@ function create(deps) {
|
|
|
636
651
|
for (const s of R.slots) if (fin(s) && (s.parts || []).every(fin) && s.session && s.session.state !== 'exited' && deps.stop && !s.stopped) { s.stopped = true; try { deps.stop(s.session); } catch { /* it ends by itself */ } }
|
|
637
652
|
if (R.ended || !R.slots.every((s) => fin(s) && (s.parts || []).every(fin))) return;
|
|
638
653
|
R.ended = true;
|
|
639
|
-
clearInterval(R.timer);
|
|
654
|
+
clearInterval(R.timer);
|
|
640
655
|
// what each version changed against the one it was made from: the chat's "Also updated" and the cards' Updated
|
|
641
656
|
if (R.base) {
|
|
642
657
|
const s = R.slots[0], prev = R.baseFile ? LAB.specimenPath(R.rt, R.baseFile) : null;
|
|
@@ -647,7 +662,7 @@ function create(deps) {
|
|
|
647
662
|
const lost = (s) => [...(s.parts || [])].filter((x) => x.state === 'not made').map((x) => (PARTS.find((p) => p.kind === x.kind) || {}).title || x.kind);
|
|
648
663
|
if (R.slots.length === 1) {
|
|
649
664
|
const s = R.slots[0], v = 'Version ' + R.n;
|
|
650
|
-
if (s.state !== 'ok') tell(R, `[PMOS] ${v} was not made: ${s.why}.
|
|
665
|
+
if (s.state !== 'ok') tell(R, `[PMOS] ${v} was not made: ${s.why}. Tell the PM in one line that it was not made and why, and offer to try again. Nothing else.`);
|
|
651
666
|
else {
|
|
652
667
|
const also = s.changes && s.changes.line, miss = lost(s);
|
|
653
668
|
tell(R, `[PMOS] ${v} is in the Viewer${s.said ? ': "' + s.said + '"' : ''}.${also ? ' Also updated: ' + also + '.' : ''}${miss.length ? ' Not made this time: ' + andOf(miss) + '.' : ''} Reply to the PM starting with "${v}: ", then one or two sentences on what ${R.base ? 'changed' : 'it shows and for whom'}${also ? ', then "Also updated: ' + also + '."' : ''}. Nothing else. Do not build anything here.`);
|
|
@@ -678,10 +693,13 @@ function create(deps) {
|
|
|
678
693
|
return true;
|
|
679
694
|
} catch (e) { warn('live round undo', e); return false; }
|
|
680
695
|
}
|
|
681
|
-
function
|
|
696
|
+
function runningOf(ini) { for (const R of rounds.values()) if (R.ini === ini && !R.ended) return { id: R.id, n: R.n, start: R.start, progress: (R.slots.find((s) => s.progress) || {}).progress || null }; return null; }
|
|
697
|
+
function running(ini) { return !!runningOf(ini); }
|
|
698
|
+
/** The PM's Stop in the Viewer: the round's runs end now, and each unfinished version is "not made: you stopped it". */
|
|
699
|
+
function stop(id) { const R = rounds.get(id); if (!R || R.ended) return { ok: false, error: 'that version is not being made now' }; cancel(id, 'you stopped it'); return { ok: true }; }
|
|
682
700
|
function status() { return [...rounds.values()].map((R) => ({ id: R.id, ws: R.ws, ini: R.ini, ended: R.ended, slots: R.slots.map((s) => ({ key: s.key, state: s.state, why: s.why })) })); }
|
|
683
701
|
|
|
684
|
-
return { start, propose, cancel, dropCard, running, status, _rounds: rounds, _poll: poll };
|
|
702
|
+
return { start, propose, cancel, stop, dropCard, running, status, _rounds: rounds, _poll: poll };
|
|
685
703
|
}
|
|
686
704
|
|
|
687
705
|
/* ── the module-level shortcuts (server.js calls create once; W2, the routes and the CLI route call these) ── */
|
|
@@ -694,8 +712,9 @@ function proposeNow(input) { return inst ? inst.propose(input) : { ok: false, er
|
|
|
694
712
|
function cancel(id, why) { return inst ? inst.cancel(id, why) : { ok: false }; }
|
|
695
713
|
function dropCard(dir, propId) { return inst ? inst.dropCard(dir, propId) : false; }
|
|
696
714
|
function running(ini) { return inst ? inst.running(ini) : false; }
|
|
715
|
+
function stopRound(id) { return inst ? inst.stop(id) : { ok: false, error: NOT_READY }; }
|
|
697
716
|
function status() { return inst ? inst.status() : []; }
|
|
698
717
|
|
|
699
|
-
module.exports = { JOB, ORIGIN,
|
|
718
|
+
module.exports = { 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,
|
|
700
719
|
flowOf, lanesOf, tweaksOf, copyOf, changesOf, partsAt, editsOf,
|
|
701
|
-
create, install, round, startNow, proposeNow, cancel, dropCard, running, status };
|
|
720
|
+
create, install, round, startNow, proposeNow, cancel, stopRound, dropCard, running, status };
|
|
@@ -124,8 +124,8 @@ const READS = {
|
|
|
124
124
|
for (const col of c.columns) if (col.file) col.url = LAB.specimenUrl(col.file);
|
|
125
125
|
if (c.live) {
|
|
126
126
|
// the version's companions as data, and the comments on the initiative (Prototype by chatting)
|
|
127
|
-
const
|
|
128
|
-
if (abs) { c.url = LAB.specimenUrl(
|
|
127
|
+
const f = c.file || c.fallback || '', abs = f ? LAB.specimenPath(ctx.runtimeDir, f) : null;
|
|
128
|
+
if (abs) { c.url = LAB.specimenUrl(f); c.data = require('./live-round.js').partsAt(abs); }
|
|
129
129
|
c.comments = commentsOf(dir, c.ini);
|
|
130
130
|
}
|
|
131
131
|
ctx.json(res, { ok: true, compare: c });
|
|
@@ -214,6 +214,14 @@ const WRITES = {
|
|
|
214
214
|
ctx.json(res, { ok: true, edits: next });
|
|
215
215
|
return true;
|
|
216
216
|
},
|
|
217
|
+
// the PM's Stop on a version being made (no time limit since 2026-11-18): its run ends and the version is "not made: you stopped it"
|
|
218
|
+
'/api/lab/stop': (ctx, res, body) => {
|
|
219
|
+
const run = String(body.run || ''); if (!/^lr[0-9a-z]{4,40}$/.test(run)) return fail(ctx, res, 400, 'run names the version being made');
|
|
220
|
+
const r = require('./live-round.js').stopRound(run);
|
|
221
|
+
if (!r.ok) return fail(ctx, res, 409, r.error || 'that version is not being made now');
|
|
222
|
+
ctx.json(res, { ok: true });
|
|
223
|
+
return true;
|
|
224
|
+
},
|
|
217
225
|
'/api/lab/comment': (ctx, res, body, g, w, dir) => {
|
|
218
226
|
const ini = String(body.ini || ''), text = typeof body.text === 'string' ? body.text.replace(/\s+/g, ' ').trim().slice(0, 500) : '';
|
|
219
227
|
if (!ID_RE.test(ini) || !text) return fail(ctx, res, 400, 'ini and text name the initiative and the comment');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.597.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.597.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -46,6 +46,13 @@
|
|
|
46
46
|
.pc-making { margin: 0; display: flex; align-items: center; gap: 5px; font-size: var(--fs-meta); color: var(--cz-blueink); }
|
|
47
47
|
.pc-making i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: pcPulse 1.2s ease-in-out infinite; }
|
|
48
48
|
.pc-making i:nth-child(2) { animation-delay: .2s; } .pc-making i:nth-child(3) { animation-delay: .4s; }
|
|
49
|
+
.pc-prog { display: grid; gap: 6px; margin-bottom: 8px; }
|
|
50
|
+
.pc-prog .pc-making { flex-wrap: wrap; }
|
|
51
|
+
.pc-prog .pc-making .w { flex: 1 1 auto; min-width: 0; }
|
|
52
|
+
.pc-prog small { color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
|
|
53
|
+
.pc-bar2 { display: block; height: 4px; border-radius: 2px; background: var(--cz-well); overflow: hidden; }
|
|
54
|
+
.pc-bar2 i { display: block; height: 100%; background: var(--cz-blue); transition: width .4s ease; }
|
|
55
|
+
.pc-lost { display: block; color: var(--cz-ink2); padding: 8px 10px; border-radius: 8px; background: var(--cz-well); margin-bottom: 8px; }
|
|
49
56
|
@keyframes pcPulse { 50% { opacity: 1; } }
|
|
50
57
|
@media (prefers-reduced-motion: reduce) { .pc-making i { animation: none; opacity: .7; } }
|
|
51
58
|
|
|
@@ -154,6 +154,8 @@ const say = (m, u) => { if (V.H && V.H.toast) V.H.toast(m, u); };
|
|
|
154
154
|
/** The version shown: the compare itself, or (while the next version is being made) the last one that rendered, with a note. */
|
|
155
155
|
function shown(c) {
|
|
156
156
|
if (c && c.file) return { v: c, making: c.working && !c.file };
|
|
157
|
+
// a version that was not made shows the one it was made from, with why (lib/idle-lab.js compareOf notMade)
|
|
158
|
+
if (c && c.notMade) return { v: c, making: false };
|
|
157
159
|
if (V.last && c && V.last.ini === c.ini) return { v: V.last, making: true };
|
|
158
160
|
return { v: c, making: true };
|
|
159
161
|
}
|
|
@@ -186,6 +188,16 @@ function trayHtml(c) {
|
|
|
186
188
|
+ `<span class="pc-tacts">${c.state === 'open' && !c.working ? ib('data-pc-tray="keep"', 'Keep ' + c.key, I.check, 'blue') : ''}${ib('data-pc-tray="close"', 'Close these ways', I.x)}</span></div>`;
|
|
187
189
|
}
|
|
188
190
|
const upd = (c, k) => (c.updated && c.updated[k] ? '<span class="pc-upd">Updated</span>' : '');
|
|
191
|
+
/** While a version is made (no time limit): what the run is doing now, steps done of all, the time so far, and Stop. */
|
|
192
|
+
const clock = (iso) => { const s = Math.max(0, Math.round((Date.now() - Date.parse(iso || '')) / 1000)); return Number.isFinite(s) ? Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0') : ''; };
|
|
193
|
+
function progressHtml(c) {
|
|
194
|
+
const p = c.progress || null, pct = p && p.total ? Math.round((p.done / p.total) * 100) : 0;
|
|
195
|
+
return `<div class="pc-prog" role="status"><p class="pc-making"><i></i><i></i><i></i> <span class="w">PMOS is making version ${c.round}${p && p.now ? ': ' + esc(p.now) : ''}</span>`
|
|
196
|
+
+ `${p && p.total ? `<small>${p.done} of ${p.total} done</small>` : ''}<small data-pc-clock="${esc(c.startedAt || '')}">${clock(c.startedAt)}</small>`
|
|
197
|
+
+ `${c.run ? ib(`data-pc-stop="${esc(c.run)}"`, 'Stop making this version', I.x) : ''}</p>`
|
|
198
|
+
+ `${p && p.total ? `<span class="pc-bar2" aria-hidden="true"><i style="width:${pct}%"></i></span>` : ''}</div>`;
|
|
199
|
+
}
|
|
200
|
+
if (typeof document !== 'undefined' && typeof setInterval === 'function') setInterval(() => { for (const el of document.querySelectorAll('[data-pc-clock]')) el.textContent = clock(el.dataset.pcClock); }, 1000);
|
|
189
201
|
function protoCard(c, v, making) {
|
|
190
202
|
const data = v.data || {}, tw = ((data.tweaks && data.tweaks.tweaks) || []).filter((t) => !t.el || (V.sel && t.el === V.sel.el));
|
|
191
203
|
const tweaks = tw.length ? `<div class="pc-tw" aria-label="Tweaks">${tw.map((t) => { const val = parseFloat(V.edits.vars[t.var]) || t.value; return `<label><span>${esc(t.label)}</span><input type="range" min="${t.min}" max="${t.max}" step="${t.step}" value="${val}" data-pc-var="${esc(t.var)}" data-pc-unit="${esc(t.unit)}"><em>${esc(val + t.unit)}</em></label>`; }).join('')}</div>` : '';
|
|
@@ -195,7 +207,8 @@ function protoCard(c, v, making) {
|
|
|
195
207
|
const list = cm.length ? `<ol class="pc-cms">${cm.map((x, i) => `<li><span class="pc-pin">${i + 1}</span><span class="w">${x.label ? `<small>on ${esc(x.label)}</small>` : ''}${esc(x.text)}</span>${ib(`data-pc-make="${esc(x.id)}"`, 'Make this change', I.star)}</li>`).join('')}</ol>` : '';
|
|
196
208
|
const sug = suggestion(c);
|
|
197
209
|
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>` : '';
|
|
198
|
-
|
|
210
|
+
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>` : '';
|
|
211
|
+
return `<section class="pc-card pc-proto" aria-label="The prototype">${lost}${making ? progressHtml(c) : ''}`
|
|
199
212
|
+ `<div class="pc-dev ${V.device}"><div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}</div>${sel}${tweaks}${draft}${list}${sug}</section>`;
|
|
200
213
|
}
|
|
201
214
|
function suggestion(c) {
|
|
@@ -251,7 +264,7 @@ export function draw(body, c, o = {}) {
|
|
|
251
264
|
if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
|
|
252
265
|
V.body = body;
|
|
253
266
|
// keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
|
|
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]);
|
|
267
|
+
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, 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]);
|
|
255
268
|
const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input');
|
|
256
269
|
if (sig === V.sig && root.firstChild) return;
|
|
257
270
|
if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
|
|
@@ -325,6 +338,7 @@ function wire(root) {
|
|
|
325
338
|
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; }
|
|
326
339
|
if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); return; }
|
|
327
340
|
if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
|
|
341
|
+
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; }
|
|
328
342
|
if ('pcUnsel' in d) { V.sel = null; toFrame({ t: 'sel', el: '' }); fire('pmos:point', { ini: V.c.ini, el: '', label: '' }); V.sig = ''; draw(V.body, V.c); return; }
|
|
329
343
|
if (d.pcCm) { comment(d.pcCm); return; }
|
|
330
344
|
if (d.pcMake) { const x = (V.c.comments || []).find((y) => y.id === d.pcMake); if (x) fire('pmos:say', { ini: V.c.ini, text: (x.label || x.el ? `[On: ${x.label || x.el}${x.el ? ' · ' + x.el : ''}] ` : '') + x.text }); return; }
|