create-pmos 0.579.0 → 0.581.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +27 -33
- 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/scripts/factory-guardrail.js +53 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +23 -3
- package/workspace/guide/cli.md +3 -2
- package/workspace/lib/bg-queue.js +5 -2
- package/workspace/lib/grill-runs.js +2 -0
- package/workspace/lib/grill.js +1 -1
- package/workspace/lib/headless.js +8 -2
- package/workspace/lib/idle-lab-engine.js +9 -2
- package/workspace/lib/idle-lab.js +15 -4
- package/workspace/lib/job-graph.js +1 -0
- package/workspace/lib/lab-cli.js +26 -2
- package/workspace/lib/live-round.js +407 -0
- package/workspace/lib/orchestrator-keeprate.js +3 -0
- package/workspace/lib/proposals.js +5 -2
- package/workspace/lib/routes-briefing-premium.js +27 -2
- package/workspace/lib/routes-lab.js +20 -3
- package/workspace/lib/routes-proposals.js +39 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-lab.css +12 -0
- package/workspace/public/pm/cozy-lab.js +42 -7
- package/workspace/public/pm/ini-props.js +7 -3
- package/workspace/run-tests.js +35 -0
- package/workspace/server.js +19 -0
- package/workspace/test-lists/live-round.json +9 -0
|
@@ -80,6 +80,7 @@ function keepCore(ctx, p, g, f, ini, want, choices = {}, extra = {}) {
|
|
|
80
80
|
}
|
|
81
81
|
const w = applyOne(ctx, p, g, f, ini, x, choices, outbox);
|
|
82
82
|
if (x.group === 'build' && !w.length) { failed.push({ id: x.id, why: x.failed || 'not opened' }); continue; } // stays open, says why
|
|
83
|
+
if (x.group === 'live' && !w.length) { failed.push({ id: x.id, why: x.failed || 'the round did not start' }); continue; } // stays open, says why
|
|
83
84
|
wrote.push(...w);
|
|
84
85
|
if (x.group === 'dates' && x.plan && w.some((y) => y.op === 'dates')) plans++;
|
|
85
86
|
keptIds.push(x.group === 'dates' ? x.id + ':' + x.sig : x.id);
|
|
@@ -118,6 +119,7 @@ function undoCore(ctx, p, g, id) {
|
|
|
118
119
|
else if (w.op === 'life') { const r2 = require('./outcomes.js').setLife(p.w.root, k.ini, w.from === 'cancelled' ? 'cancelled' : 'active', 'Undo: PMOS ✦ stopped it', g.actor); if (r2.ok) back++; else kept++; continue; }
|
|
119
120
|
// a new experiment the ✦ made goes from every list (the Board's own Delete: the record file stays, a restore brings it back)
|
|
120
121
|
else if (w.op === 'created') { r = RB.writeAs(ctx, '/api/boards/ini-delete', { ws: p.w.id, board: p.board.id, id: w.id }, g); }
|
|
122
|
+
else if (w.op === 'round') { const LR = require('./live-round.js'); LR.cancel(w.round); if (w.proposal) LR.dropCard(dir, w.proposal); back++; continue; } // a live round: its runs stop and its card goes
|
|
121
123
|
else if (w.op === 'pr') { const r2 = require('./build-engine.js').close(p.w.root, w.item, { url: w.url }); if (r2.ok) back++; else kept++; continue; } // D108: Undo closes the pull request (the branch stays)
|
|
122
124
|
else if (w.op === 'outcome') { const r2 = require('./initiative-writer.js').restoreOutcome(p.w.root, k.ini, w.from || {}, w.to || {}, { actor: g.actor }); if (r2.ok && !r2.kept) back++; else kept++; continue; } // a record edited since keeps its edit
|
|
123
125
|
if (r && r.body && r.body.ok) back++; else kept++;
|
|
@@ -169,6 +171,21 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/** The writes of one proposal. → [write] (each { op, ... } that landed). sk: the item ids the PM left out (✕ on one item). */
|
|
174
|
+
/** A live round's specimen kept (lib/live-round.js): it is the experiment's kept specimen and a lesson, and the grill runs once on it as
|
|
175
|
+
* the Review step (D60 as amended 2026-11-17: never during the round, once after ✓). A grill that cannot start now is said in the lesson. */
|
|
176
|
+
function liveKept(ctx, p, g, ini, x, ones) {
|
|
177
|
+
const AF = require('./artefacts.js'), LAB = require('./idle-lab.js'), dir = dirOf(ctx, p.w), d = x.data || {};
|
|
178
|
+
const actorOf = (by) => ({ by: /^(pm|agent):/.test(String(by || '')) ? by : 'agent:live-round' });
|
|
179
|
+
const what = ones.map((o) => o.key + (o.title ? ' (' + o.title + ')' : '')).join(', ');
|
|
180
|
+
try {
|
|
181
|
+
const f = AF.file(dir);
|
|
182
|
+
AF.set(f, { scope: 'experiment:' + ini, artefact: 'specimens', field: 'kept', text: `Kept ${what} of round ${d.round || 1}: ${LAB.specimenUrl(ones[0].file)}`, sources: [{ label: 'live round', ref: LAB.specimenUrl(ones[0].file) }] }, actorOf(g.actor && g.actor.by));
|
|
183
|
+
AF.set(f, { scope: 'experiment:' + ini, artefact: 'lessons', field: 'line', text: `✓ kept ${what} of round ${d.round || 1}${d.live && d.live.brief ? ' ("' + String(d.live.brief).slice(0, 200) + '")' : ''}`, sources: [{ label: 'live round' }] }, actorOf(g.actor && g.actor.by));
|
|
184
|
+
} catch { /* the keep line holds it */ }
|
|
185
|
+
if (typeof ctx.grillStart === 'function') {
|
|
186
|
+
try { ctx.grillStart({ ws: p.w.id, board: p.board.id, ini, why: 'kept', key: 'kept:' + x.id, detail: `the kept specimen ${what}: ${(ctx.runtimeDir && LAB.specimenPath(ctx.runtimeDir, ones[0].file)) || LAB.specimenUrl(ones[0].file)}` }); } catch { /* the grill runs by itself later */ }
|
|
187
|
+
}
|
|
188
|
+
}
|
|
172
189
|
function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
173
190
|
const wrote = [], why = x.why, source = srcText(x);
|
|
174
191
|
const items = x.items || [];
|
|
@@ -276,14 +293,26 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
276
293
|
// the record's own description (initiative-description-field): ✓ writes its description line, Undo puts back what was there
|
|
277
294
|
const r = require('./initiative-writer.js').setDescription(p.w.root, ini, (x.data || {}).text, { actor: g.actor });
|
|
278
295
|
if (r.ok && !r.same) add({ op: 'description', from: r.from, to: r.text });
|
|
296
|
+
} else if (x.group === 'live') {
|
|
297
|
+
// the live round's ask (lib/live-round.js): ✓ starts the round now (step 1: what the PM asked for); Undo stops it and takes its card away.
|
|
298
|
+
// A start that fails writes nothing, so the ask stays open and says why (keepCore).
|
|
299
|
+
const LR = require('./live-round.js'), d = x.data || {};
|
|
300
|
+
const r = LR.startNow({ ws: p.w.id, board: p.board.id, ini, brief: d.brief || x.title, base: x.type === 'feedback' ? d.base : '', directions: x.type === 'feedback' ? null : d.directions, from: 'chat', by: g.actor && g.actor.by });
|
|
301
|
+
if (r.ok) add({ op: 'round', round: r.round.id, proposal: r.round.proposal, keys: r.round.keys });
|
|
302
|
+
else x.failed = r.error;
|
|
279
303
|
} else if (x.group === 'prototyped' || x.group === 'improved' || x.group === 'scanned') {
|
|
280
304
|
// the idle lab (lib/idle-lab.js): ✓ keeps it as the initiative's own document. A prototype is each specimen of round 1, or the new
|
|
281
305
|
// round; a scan finding is evidence. The specimen stays in the runtime folder; the document links it (GET /api/lab/specimen)
|
|
306
|
+
// A live round (data.live, lib/live-round.js): ✓ in the compare view keeps the ONE specimen shown (choices[id] = its key) as the
|
|
307
|
+
// experiment's kept specimen; then the grill runs once on it, as the Review step (D60 as amended 2026-11-17: grill after the session).
|
|
282
308
|
const LAB = require('./idle-lab.js'), d = x.data || {}, name = (sp) => 'Prototype ' + sp.key + ' · ' + sp.title;
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
309
|
+
const live = !!d.live, pick = live && choices && typeof choices[x.id] === 'string' ? choices[x.id] : '';
|
|
310
|
+
const docOf = (title, ref, kind) => add({ op: 'doc', id: 'fd-' + PR.hash(ini + '|' + x.id + '|' + (ref || title)), title: String(title).slice(0, 140), source: live ? 'PMOS, live round' : 'PMOS, while you were away', at: x.at || '', ref, kind, claude: true });
|
|
311
|
+
const keptOnes = [];
|
|
312
|
+
if (x.group === 'prototyped') for (const sp of (d.specimens || []).filter((y) => !pick || y.key === pick)) { docOf(name(sp), LAB.specimenUrl(sp.file), 'prototype'); keptOnes.push({ key: sp.key, title: sp.title, file: sp.file }); }
|
|
313
|
+
else if (x.group === 'improved') { docOf('Prototype ' + (d.base || '') + ' · round ' + d.round + ': ' + (d.changed || ''), LAB.specimenUrl(d.file), 'prototype'); keptOnes.push({ key: d.base, title: 'round ' + d.round, file: d.file }); }
|
|
286
314
|
else docOf(x.why, ((x.sources || [])[0] || {}).ref || '', 'evidence');
|
|
315
|
+
if (live && keptOnes.length) liveKept(ctx, p, g, ini, x, keptOnes);
|
|
287
316
|
} else if (x.group === 'grill') {
|
|
288
317
|
// a grill finding (lib/grill.js): ✓ adds its next step as a task, with the finding and its sources in the notes
|
|
289
318
|
// ✎ on the finding: the PM's own words for the next step (choices[id]) replace Claude's
|
|
@@ -357,6 +386,9 @@ function saidOf(wrote, plans, left) {
|
|
|
357
386
|
if (n('created')) bits.push((bits.length ? 'started ' : 'Started ') + 'the next experiment');
|
|
358
387
|
if (wrote.some((w) => w.op === 'life' && w.to === 'cancelled')) bits.push((bits.length ? 'stopped ' : 'Stopped ') + 'this one');
|
|
359
388
|
if (n('outcome')) bits.push((bits.length ? 'set ' : 'Set ') + 'the outcome and its check date');
|
|
389
|
+
// a live round (lib/live-round.js): each version shows on its card as soon as it renders
|
|
390
|
+
const rd = wrote.find((w) => w.op === 'round');
|
|
391
|
+
if (rd) bits.push((bits.length ? 'started ' : 'Started ') + ((rd.keys || []).length > 1 ? (rd.keys || []).join(', ').replace(/, ([^,]*)$/, ' and $1') + ': each shows as soon as it renders' : 'the new round: it shows as soon as it renders'));
|
|
360
392
|
if (!bits.length) bits.push('Nothing changed');
|
|
361
393
|
return bits.join(', ') + '.' + (left ? ' ' + left + ' still ' + (left === 1 ? 'asks' : 'ask') + ' you.' : '');
|
|
362
394
|
}
|
|
@@ -420,6 +452,10 @@ const WRITES = {
|
|
|
420
452
|
// the PM's reason, when given (the idle lab's ✕ asks for one; Claude learns from it)
|
|
421
453
|
const why = typeof body.why === 'string' ? body.why.replace(/\s+/g, ' ').trim().slice(0, 300) : '';
|
|
422
454
|
PR.append(dirOf(ctx, p.w), g.actor, { kind: 'drop', ini, sig, ...which, ...(facts.length ? { facts } : {}), ...(why ? { why } : {}) });
|
|
455
|
+
// a live round or its ask (lib/live-round.js): the ✕ is a Lessons line of the experiment, with the reason when given
|
|
456
|
+
if (of && (of.group === 'live' || ((of.group === 'prototyped' || of.group === 'improved') && of.data && of.data.live))) {
|
|
457
|
+
try { const AF = require('./artefacts.js'); AF.set(AF.file(dirOf(ctx, p.w)), { scope: 'experiment:' + ini, artefact: 'lessons', field: 'line', text: `✕ dropped "${String(of.title || '').slice(0, 140)}"${why ? ': ' + why : ''}`, sources: [{ label: 'live round' }] }, { by: g.actor && /^(pm|agent):/.test(String(g.actor.by)) ? g.actor.by : 'agent:live-round' }); } catch { /* the drop line holds it */ }
|
|
458
|
+
}
|
|
423
459
|
// the reason becomes curated memory by itself, so every later run knows it (lib/corrections-memory.js)
|
|
424
460
|
if (why) require('./corrections-memory.js').remember(p.w.root, { what: `a ${(of && (of.group || of.type)) || ''} proposal on ${ini}`.replace(/ +/g, ' '), why, source: 'proposal:' + (which.id || sig) });
|
|
425
461
|
ctx.json(res, { ok: true });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.581.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.581.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
.lab-thf iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform: scale(.14); transform-origin: 0 0; background: var(--cz-card); }
|
|
15
15
|
.lab-cap { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
|
|
16
16
|
.lab-cap b { font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
17
|
+
/* the live round (lib/live-round.js): a version still being made, or not made, in its thumbnail's place (honest state) */
|
|
18
|
+
.lab-slot { cursor: default; }
|
|
19
|
+
.lab-slot:hover { border-color: var(--cz-hair); }
|
|
20
|
+
.lab-wait { display: flex; align-items: center; justify-content: center; gap: 6px; }
|
|
21
|
+
.lab-wait i { width: 7px; height: 7px; border-radius: 50%; background: var(--cz-ink2); opacity: .35; animation: labPulse 1.2s ease-in-out infinite; }
|
|
22
|
+
.lab-wait i:nth-child(2) { animation-delay: .2s; } .lab-wait i:nth-child(3) { animation-delay: .4s; }
|
|
23
|
+
.lab-slot.no .lab-wait { background: transparent; border-bottom: 1px dashed var(--cz-hair); }
|
|
24
|
+
@keyframes labPulse { 50% { opacity: 1; } }
|
|
25
|
+
@media (prefers-reduced-motion: reduce) { .lab-wait i { animation: none; opacity: .6; } }
|
|
26
|
+
.lab-dirs { margin: 4px 0 2px; padding: 0; list-style: none; display: grid; gap: 2px; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
|
|
27
|
+
.lab-dirs b { display: inline-block; min-width: 1.4em; color: var(--cz-ink); }
|
|
28
|
+
.lab-col[data-lab-col] { cursor: pointer; }
|
|
17
29
|
.lab-tx { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink2); }
|
|
18
30
|
.lab-tx b { font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
19
31
|
.lab-ok { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ok); }
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* Prototype), "Where they differ" and History. A column whose source is not proven is left out with one line
|
|
10
10
|
* why (lib/idle-lab.js PROVEN). A press on a round in History puts it in the Prototype column. ✓ and ✕ in the
|
|
11
11
|
* header keep or drop the round shown; ⤢ presents it on a clean screen in a new tab (GET /pm/present).
|
|
12
|
+
* A live round (lib/live-round.js, data.live): the card shows each version as it lands (working, made, not made); its ask (group live)
|
|
13
|
+
* says the directions, ✓ starts it. Its compare view puts A B C side by side; a press on a column picks it, ✓ keeps that one.
|
|
12
14
|
* Every specimen loads from GET /api/lab/specimen in a sandboxed frame: it cannot reach PMOS. Nothing is written before the PM's ✓. */
|
|
13
15
|
import { pmGet, pmPost } from './http.js';
|
|
14
16
|
|
|
@@ -18,7 +20,7 @@ export const I = {
|
|
|
18
20
|
proto: 'M3 4h18v14H3zM3 9h18', round: 'M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5', scan: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 3a15 15 0 0 1 0 18M3 12h18',
|
|
19
21
|
open: 'M7 17 17 7M8 7h9v9', check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', present: 'M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7',
|
|
20
22
|
};
|
|
21
|
-
const GROUPS = ['prototyped', 'improved', 'scanned'];
|
|
23
|
+
const GROUPS = ['prototyped', 'improved', 'scanned', 'live'];
|
|
22
24
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
25
|
const when = (iso) => { const d = new Date(iso); if (isNaN(d)) return ''; const t = new Date(); const same = d.toDateString() === t.toDateString(); return same ? 'today ' + String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON[d.getMonth()]; };
|
|
24
26
|
const specUrl = (file) => '/api/lab/specimen?file=' + encodeURIComponent(file);
|
|
@@ -30,6 +32,17 @@ if (typeof document !== 'undefined' && typeof document.createElement === 'functi
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export const isLab = (p) => !!p && GROUPS.includes(p.group);
|
|
35
|
+
/** True while a live round (lib/live-round.js) on these proposals still makes a version: the screens read again until each one lands. */
|
|
36
|
+
export function workingOf(props) {
|
|
37
|
+
const all = props && props.groups ? props.groups.flatMap((g) => g.props || []) : [];
|
|
38
|
+
return all.some((p) => p && p.data && p.data.live && (p.data.live.slots || []).some((x) => x.state === 'working' || x.state === 'proving'));
|
|
39
|
+
}
|
|
40
|
+
/** One version of a live round on its card: a thumbnail once it rendered, else what is happening (honest state). */
|
|
41
|
+
function slotHtml(id, x) {
|
|
42
|
+
if (x.state === 'ok' && x.file) return `<button type="button" class="lab-th" data-lab-open="${id}" data-lab-key="${esc(x.key)}" aria-label="${esc('Open ' + x.key + ', ' + x.title + ', in the compare view')}">${thumbHtml(x.file, x.key + ' · ' + x.title)}<span class="lab-cap"><b>${esc(x.key)} · ${esc(x.title)}</b></span></button>`;
|
|
43
|
+
const made = x.state === 'not made';
|
|
44
|
+
return `<span class="lab-th lab-slot${made ? ' no' : ' wk'}"><span class="lab-thf lab-wait" aria-hidden="true">${made ? '' : '<i></i><i></i><i></i>'}</span><span class="lab-cap"><b>${esc(x.key)} · ${esc(x.title)}</b>${esc(made ? 'Not made: ' + (x.why || 'it did not render') : 'PMOS is making it')}</span></span>`;
|
|
45
|
+
}
|
|
33
46
|
|
|
34
47
|
/** A specimen as a still thumbnail: the page drawn at desk size and scaled down, in a frame that cannot reach PMOS. */
|
|
35
48
|
export function thumbHtml(file, label) {
|
|
@@ -50,7 +63,24 @@ export function cardHtml(p, { why = false } = {}) {
|
|
|
50
63
|
const acts = (p.group !== 'scanned' ? ib(`data-lab-open="${id}"`, 'Compare it with production and the design', I.open) : '')
|
|
51
64
|
+ ib(`data-lab-why="${id}" aria-expanded="${why}"`, 'Drop it', I.x) + ib(`data-pp-keep="${id}"`, 'Keep it', I.check, 'ok');
|
|
52
65
|
let head = '', body = '';
|
|
53
|
-
if (p.group === '
|
|
66
|
+
if (p.group === 'live') {
|
|
67
|
+
// the live round's ask: ✓ starts it, ✕ asks why first. Nothing is made before ✓.
|
|
68
|
+
const dirs = (d.directions || []);
|
|
69
|
+
const acts2 = ib(`data-lab-why="${id}" aria-expanded="${why}"`, 'Not now', I.x) + ib(`data-pp-keep="${id}"`, p.type === 'feedback' ? 'Make this round' : 'Show it', I.check, 'ok');
|
|
70
|
+
const body2 = p.type === 'feedback' ? `<p class="lab-tx">${esc(p.why)}</p>` : `<ul class="lab-dirs">${dirs.map((x) => `<li><b>${esc(x.key)}</b> ${esc(x.title)}</li>`).join('')}</ul>`;
|
|
71
|
+
const ask2 = why ? `<div class="lab-why"><label class="vh" for="labWhy-${id}">Why not? PMOS learns from it</label><input id="labWhy-${id}" data-lab-reason="${id}" maxlength="200" placeholder="Why not? PMOS learns from it (you can leave it empty)">${ib(`data-lab-drop="${id}"`, 'Drop it now', I.x, 'solid')}</div>` : '';
|
|
72
|
+
return `<div class="pp-p lab" data-pp="${id}"><div class="pp-ph1"><span class="pp-ic gr">${SVG(I.proto, 16)}</span><span class="w"><b>${esc(p.title)}</b>${body2}<small class="lab-ok">About a minute. Each one shows as soon as it renders.</small>${ask2}</span><span class="pp-gacts">${acts2}</span></div></div>`;
|
|
73
|
+
}
|
|
74
|
+
if (p.group === 'prototyped' && d.live) {
|
|
75
|
+
const sl = d.live.slots || [], wk = sl.filter((x) => x.state === 'working' || x.state === 'proving').length;
|
|
76
|
+
head = p.title || `Round 1 · ${sl.length} ways`;
|
|
77
|
+
body = `<div class="lab-ths">${sl.map((x) => slotHtml(id, x)).join('')}</div>`
|
|
78
|
+
+ `<small class="lab-ok">${wk ? esc(wk === 1 ? 'One more is on its way.' : wk + ' are on their way.') + ' ' : ''}${d.checked ? 'Checked: ' + esc(d.checked) : ''}</small>`;
|
|
79
|
+
} else if (p.group === 'improved' && d.live && !d.file) {
|
|
80
|
+
const x = (d.live.slots || [])[0] || {};
|
|
81
|
+
head = p.title || `Round ${d.round} of ${d.base || ''}`;
|
|
82
|
+
body = `<div class="lab-ths">${slotHtml(id, x)}</div>`;
|
|
83
|
+
} else if (p.group === 'prototyped') {
|
|
54
84
|
const sp = d.specimens || [];
|
|
55
85
|
head = p.title || `Round 1 · ${sp.length} ways to do it, so you can look instead of read`;
|
|
56
86
|
body = `<div class="lab-ths">${sp.map((x) => `<button type="button" class="lab-th" data-lab-open="${id}" data-lab-key="${esc(x.key)}" aria-label="${esc('Open ' + x.key + ', ' + x.title + ', in the compare view')}">${thumbHtml(x.file, x.key + ' · ' + x.title)}<span class="lab-cap"><b>${esc(x.key)} · ${esc(x.title)}</b>${esc(x.caption)}</span></button>`).join('')}</div>`
|
|
@@ -68,13 +98,13 @@ export function cardHtml(p, { why = false } = {}) {
|
|
|
68
98
|
}
|
|
69
99
|
|
|
70
100
|
/* ── the compare view (I3) ── */
|
|
71
|
-
const C = { at: null, id: null, key: '', c: null, H: null };
|
|
101
|
+
const C = { at: null, id: null, key: '', c: null, H: null, timer: null };
|
|
72
102
|
async function read() {
|
|
73
103
|
const at = C.at || {};
|
|
74
104
|
return pmGet('/api/lab/compare?ws=' + encodeURIComponent(at.ws || '') + '&board=' + encodeURIComponent(at.board || '') + '&id=' + encodeURIComponent(C.id) + (C.key ? '&key=' + encodeURIComponent(C.key) : '')).catch(() => null);
|
|
75
105
|
}
|
|
76
106
|
function colHtml(col) {
|
|
77
|
-
return `<section class="lab-col${col.id === 'prototype' ? ' now' : ''}" aria-label="${esc(col.title)}"><div class="lab-ch"><b>${esc(col.title)}</b><span>${esc(col.meta || '')}</span></div>`
|
|
107
|
+
return `<section class="lab-col${col.id === 'prototype' || col.current ? ' now' : ''}"${/^[A-Z]$/.test(col.id) ? ` data-lab-col="${esc(col.id)}"` : ''} aria-label="${esc(col.title)}"><div class="lab-ch"><b>${esc(col.title)}</b><span>${esc(col.meta || '')}</span></div>`
|
|
78
108
|
+ `<span class="lab-frame"><iframe src="${esc(col.url || specUrl(col.file))}" sandbox="allow-scripts" title="${esc(col.title)}"></iframe></span>`
|
|
79
109
|
+ (col.read ? `<small class="lab-ok">${esc(col.read)}</small>` : '') + '</section>';
|
|
80
110
|
}
|
|
@@ -94,7 +124,7 @@ function presses(c) {
|
|
|
94
124
|
if (!c) return [];
|
|
95
125
|
// ⤢ present (live round W3): the round shown, on a clean screen in a new tab (GET /pm/present, pm/cozy-present.js)
|
|
96
126
|
const present = { act: 'present', label: 'Present this round', icon: I.present };
|
|
97
|
-
return c.state === 'open' ? [present, { act: 'drop', label: 'Drop this round', icon: I.x }, { act: 'keep', label: 'Keep this round', icon: I.check, blue: true }] : [present];
|
|
127
|
+
return c.state === 'open' ? [present, { act: 'drop', label: 'Drop this round', icon: I.x }, { act: 'keep', label: c.live && c.key ? 'Keep ' + c.key : 'Keep this round', icon: I.check, blue: true }] : [present];
|
|
98
128
|
}
|
|
99
129
|
/** The present page's address for the round shown. */
|
|
100
130
|
export const presentUrl = (at, c) => '/pm/present?ws=' + encodeURIComponent((at && at.ws) || '') + '&board=' + encodeURIComponent((at && at.board) || c.board || '') + '&id=' + encodeURIComponent(c.id);
|
|
@@ -112,13 +142,17 @@ async function load() {
|
|
|
112
142
|
// two or three columns side by side need the room: the Viewer opens wide (one column stays as it is)
|
|
113
143
|
if (C.c.columns.filter((x) => !x.left).length > 1 && window.czViewer.wide) window.czViewer.wide(true);
|
|
114
144
|
draw();
|
|
145
|
+
// a live round: its versions land one by one, so the view reads again while one is made
|
|
146
|
+
clearTimeout(C.timer);
|
|
147
|
+
if (C.c.working) { const id = C.id; C.timer = setTimeout(() => { const cur = window.czViewer && window.czViewer.current(); if (C.id === id && cur && cur.id === 'lab:cmp') load(); }, 2000); }
|
|
115
148
|
}
|
|
116
149
|
async function act(a) {
|
|
117
150
|
const c = C.c, at = C.at || {}; if (!c) return;
|
|
118
151
|
const say = (m, u) => { if (C.H && C.H.toast) C.H.toast(m, u); };
|
|
119
152
|
if (a === 'present') { window.open(presentUrl(at, c), '_blank', 'noopener'); return; }
|
|
120
153
|
if (a === 'keep') {
|
|
121
|
-
|
|
154
|
+
// a live round keeps the ONE version shown (its key) as the experiment's kept specimen
|
|
155
|
+
const r = await pmPost('/api/proposals/keep', { ws: at.ws, board: at.board || c.board, initiative: c.ini, ids: [c.id], ...(c.live && c.key ? { choices: { [c.id]: c.key } } : {}) }).catch(() => null);
|
|
122
156
|
if (!r || r.ok === false) { say((r && r.error) || 'Nothing was kept.'); return; }
|
|
123
157
|
say(r.said, async () => { await pmPost('/api/proposals/undo', { ws: at.ws, board: at.board || c.board, batch: r.batch }).catch(() => null); await load(); if (C.H && C.H.reload) C.H.reload(); });
|
|
124
158
|
} else if (a === 'drop') {
|
|
@@ -137,7 +171,8 @@ export function openCompare({ where, id, key = '', H = null } = {}) {
|
|
|
137
171
|
b.innerHTML = '<p class="pp-none">Reading the prototype.</p>';
|
|
138
172
|
b.onclick = (e) => {
|
|
139
173
|
const r = e.target.closest('[data-lab-round]'); if (r) { C.id = r.dataset.labRound; C.key = ''; load(); return; }
|
|
140
|
-
const k = e.target.closest('[data-lab-key]'); if (k) { C.key = k.dataset.labKey; load(); }
|
|
174
|
+
const k = e.target.closest('[data-lab-key]'); if (k) { C.key = k.dataset.labKey; load(); return; }
|
|
175
|
+
const col = e.target.closest('.lab-col[data-lab-col]'); if (col && C.c && C.c.live) { C.key = col.dataset.labCol; load(); }
|
|
141
176
|
};
|
|
142
177
|
load();
|
|
143
178
|
} });
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* On a phone the findings are cards side by side, one per screen.
|
|
15
15
|
* The idle lab (canvas I2 IlB): Claude prototyped it, Claude improved it, Claude scanned for it, drawn by
|
|
16
16
|
* pm/cozy-lab.js cardHtml; ⤢ opens the compare view (I3), ✕ asks why first, ✓ keeps it as a document.
|
|
17
|
+
* The live round (lib/live-round.js): its ✦ ask "PMOS will show 3 ways" (✓ starts it), and its card, whose
|
|
18
|
+
* versions land one by one (working, made, not made); the list reads again every 2 s while one is made.
|
|
17
19
|
* lookHtml(v) the Tasks' dashed placeholder while Claude looks and nothing is kept yet (PiA1)
|
|
18
20
|
* foundDocs(v) the documents a ✓ kept from elsewhere, for the Documents fold: [{ title, meta, ref }]
|
|
19
21
|
*
|
|
@@ -40,7 +42,7 @@ const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2
|
|
|
40
42
|
const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
|
|
41
43
|
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
42
44
|
const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
43
|
-
const GROUP = { build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
45
|
+
const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
44
46
|
|
|
45
47
|
/* ── the chip and the live look ── */
|
|
46
48
|
export function chipOf(p) {
|
|
@@ -62,13 +64,14 @@ export function sync(v, H) {
|
|
|
62
64
|
VW.setChip(cur.id, c ? { ...c, quiet: true, label: c.looking ? c.label : 'What PMOS proposes on ' + (v.title || 'this initiative') + '. Open', on: () => import('./batch-press.js').then((B) => B.openBatch({ ws: at.ws, board: at.board, ini: v.id, title: v.title || v.id, props: v.props },
|
|
63
65
|
{ pmGet, pmPost, toast: (m) => H.toast && H.toast(m), toastUndo: (m, u) => H.toast && H.toast(m, u), reload: H.reload, full: () => open(v, H) })) } : null);
|
|
64
66
|
// while Claude looks, a quiet read every few seconds; a change reads the Board again
|
|
65
|
-
|
|
67
|
+
// a live round (lib/live-round.js) puts each version on its card as soon as it renders: read again every few seconds while one is made
|
|
68
|
+
if (c && (c.looking || LC.workingOf(v.props)) && !POLL.has(v.id)) {
|
|
66
69
|
const t0 = v.props.t;
|
|
67
70
|
POLL.set(v.id, setTimeout(async () => {
|
|
68
71
|
POLL.delete(v.id);
|
|
69
72
|
const r = await read(H, v.id);
|
|
70
73
|
if (r && r.ok && (!r.props || r.props.t !== t0) && H.reload) await H.reload();
|
|
71
|
-
}, 5000));
|
|
74
|
+
}, LC.workingOf(v.props) ? 2500 : 5000));
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
async function read(H, id, all) {
|
|
@@ -197,6 +200,7 @@ function draw() {
|
|
|
197
200
|
if (VW.retitle && cur.title !== t) VW.retitle(cur.id, t);
|
|
198
201
|
clearTimeout(S.timer);
|
|
199
202
|
if (S.props && S.props.look && !S.props.look.ended) S.timer = setTimeout(fresh, 4000);
|
|
203
|
+
else if (LC.workingOf(S.props)) S.timer = setTimeout(fresh, 2000); // a live round's versions land one by one
|
|
200
204
|
}
|
|
201
205
|
async function fresh() {
|
|
202
206
|
const id = S.id, r = await read(S.H, id, S.all);
|
package/workspace/run-tests.js
CHANGED
|
@@ -674,6 +674,11 @@ function traceChanges(changes, ctx) {
|
|
|
674
674
|
for (const s of list) if (/\b(loadDir|readdirSync)\(path\.join\(__dirname, 'skills'\)/.test(get(s) || '')) picked.add(s);
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
|
+
const nk = f === 'lib/headless.js' ? newKindOnly(sget(f), lines) : null;
|
|
678
|
+
if (nk) { // a new headless kind: only a run whose origin starts with its prefix takes it, so the suites that name the prefix or the kind
|
|
679
|
+
for (const s of list) if (s === 'headless.test.js' || nk.some((x) => (get(s) || '').includes(x))) picked.add(s);
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
677
682
|
let why = null;
|
|
678
683
|
const before = picked.size;
|
|
679
684
|
if (get(f) == null) { // removed: only the names in the suites can say who used it
|
|
@@ -697,6 +702,36 @@ function traceChanges(changes, ctx) {
|
|
|
697
702
|
return { suites: list.filter((s) => picked.has(s)), why: `${changes.length} changed file(s) reach these suites` };
|
|
698
703
|
}
|
|
699
704
|
|
|
705
|
+
/* live-round (W1): lib/headless.js decides the kind of EVERY spawn through kindFor(), so a change there reaches every suite. A change that
|
|
706
|
+
* only ADDS a kind is narrower: a new `const X_ORIGINS = Object.freeze(['p:'])`, its `if (X_ORIGINS.some(...)) return 'k';` line in kindFor,
|
|
707
|
+
* its TOOLS entry and its name on WRITE_DIR_KINDS or WRITE_PATH_KINDS change only runs whose origin starts with 'p:'. Returns the new
|
|
708
|
+
* prefixes and kinds (quoted, as the suites name them), or null when any changed line is something else. `src` is without comments. */
|
|
709
|
+
function newKindOnly(src, lines) {
|
|
710
|
+
if (src == null || !Array.isArray(lines) || !lines.length) return null;
|
|
711
|
+
const C = src.split('\n');
|
|
712
|
+
const consts = new Map(); const kinds = new Set(); const later = [];
|
|
713
|
+
for (const n of lines) {
|
|
714
|
+
const l = (C[n - 1] || '').trim();
|
|
715
|
+
if (!l) continue;
|
|
716
|
+
let m = /^const ([A-Z_]+_ORIGINS) = Object\.freeze\(\[((?:\s*'[\w-]+:',?)+)\s*\]\);$/.exec(l);
|
|
717
|
+
if (m) { consts.set(m[1], [...m[2].matchAll(/'([\w-]+:)'/g)].map((x) => x[1])); continue; }
|
|
718
|
+
m = /^if \(([A-Z_]+_ORIGINS)\.some\(\(p\) => o\.startsWith\(p\)\)\) return '([\w-]+)';$/.exec(l);
|
|
719
|
+
if (m) { later.push(['if', m[1], m[2]]); continue; }
|
|
720
|
+
m = /^'([\w-]+)': Object\.freeze\(\[[^\]]*\]\),$/.exec(l);
|
|
721
|
+
if (m) { later.push(['kind', m[1]]); continue; }
|
|
722
|
+
m = /^const (WRITE_DIR_KINDS|WRITE_PATH_KINDS) = Object\.freeze\(\[([^\]]*)\]\);$/.exec(l);
|
|
723
|
+
if (m) { later.push(['list', [...m[2].matchAll(/'([\w-]+)'/g)].map((x) => x[1])]); continue; }
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
for (const x of later) if (x[0] === 'if') { if (!consts.has(x[1])) return null; kinds.add(x[2]); }
|
|
727
|
+
if (!kinds.size) return null;
|
|
728
|
+
for (const x of later) {
|
|
729
|
+
if (x[0] === 'kind' && !kinds.has(x[1])) return null;
|
|
730
|
+
if (x[0] === 'list' && ![...kinds].some((k) => x[1].includes(k))) return null;
|
|
731
|
+
}
|
|
732
|
+
return [...[...consts.values()].flat(), ...kinds].map((x) => `'${x}`);
|
|
733
|
+
}
|
|
734
|
+
|
|
700
735
|
/* The suites in `list` that the diff against `ref` can reach, by traceChanges() above. Returns { files, suites, why }. */
|
|
701
736
|
function changedSuites(list, ref, { exact = false } = {}) {
|
|
702
737
|
const git = (...a) => {
|
package/workspace/server.js
CHANGED
|
@@ -3405,6 +3405,25 @@ const idleLab = require('./lib/idle-lab-engine.js').create({
|
|
|
3405
3405
|
env: process.env,
|
|
3406
3406
|
warn: (what, e) => warnWriteFail(what, e),
|
|
3407
3407
|
});
|
|
3408
|
+
// the live round (lib/live-round.js, initiative live-round): the PM asks to see an idea, at any moment; ✓ on its ✦ ask (or `pmos lab round`)
|
|
3409
|
+
// starts three headless runs at once (step 1 of the queue: never held, never on the idle clock), and each version shows under the ✦ as soon
|
|
3410
|
+
// as it renders. A plain spawn: a run the PM asked for is not counted or held by the capacity governor. W2 (the meeting) calls round().
|
|
3411
|
+
const liveRound = require('./lib/live-round.js').install({
|
|
3412
|
+
runtimeDir: () => STATE,
|
|
3413
|
+
ownRoot: path.resolve(__dirname),
|
|
3414
|
+
product: (ws) => { const w = workspaces.get(ws) || null; if (!w) return null; const dir = stateDirFor(w); return dir ? { w, dir } : null; },
|
|
3415
|
+
info: (ws, ini) => {
|
|
3416
|
+
const w = workspaces.get(ws); if (!w) return null;
|
|
3417
|
+
let row = null; try { const b = require('./lib/routes-boards.js').baseRows(w); if (b && b.ok) row = (b.rows || []).find((r) => r && r.id === ini) || null; } catch { row = null; }
|
|
3418
|
+
let intent = ''; try { const AF = require('./lib/artefacts.js'), dir = stateDirFor(w); const st = AF.fold(AF.readLines(AF.file(dir))); const it = AF.intentOf(st, [row && row.board ? 'board:' + row.board : null, 'portfolio'].filter(Boolean)); intent = it && it.fields.want ? it.fields.want.text : ''; } catch { intent = ''; }
|
|
3419
|
+
return { title: (row && row.title) || ini, board: (row && row.board) || '', description: (row && row.description) || '', intent };
|
|
3420
|
+
},
|
|
3421
|
+
spawn: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, initiative: spec.initiative,
|
|
3422
|
+
writePaths: spec.writePaths, addDirs: spec.addDirs, autoDelete: undefined, onDone: spec.onDone }),
|
|
3423
|
+
stop: (s) => { if (s && s.child) stopHeadless(s); },
|
|
3424
|
+
artefact: (dir, line, by) => { const AF = require('./lib/artefacts.js'); return AF.set(AF.file(dir), line, { by }); },
|
|
3425
|
+
warn: (what, e) => warnWriteFail(what, e),
|
|
3426
|
+
});
|
|
3408
3427
|
try { const _tick = setInterval(() => { try { if (!scheduleOwner.mayRun()) return; } catch { /* no lock: run as before */ } try { refreshRun.settings(); } catch { /* the refresh tick tries again */ } try { healthTick(); } catch (e) { warnWriteFail('health tick', e); } orchTick(); bgQueue.tick(); }, TICK_MS); if (_tick.unref) _tick.unref(); } catch {}
|
|
3409
3428
|
|
|
3410
3429
|
// ── Sessions: real PTYs, owned by the server, with disk-backed scrollback + metadata. ──
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The live round (initiative live-round, 2026-11-17): a chat sentence files ONE ✦ ask, ✓ starts three runs at once, each file proven the moment it lands, a run past the 2 minute budget is not made with the reason, a feedback round is one run on the base version, the compare view puts A B C side by side, and `pmos lab round` reaches the server (lib/live-round.js, lib/lab-cli.js, lib/routes-briefing-premium.js liveAsk). A fake run: no server, model, browser or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"live-round.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"live-round.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|