create-pmos 0.580.0 → 0.582.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/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +24 -3
- package/workspace/guide/cli.md +3 -2
- package/workspace/guide/notes.md +4 -3
- package/workspace/lib/bg-queue.js +7 -3
- 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 +11 -3
- package/workspace/lib/idle-lab.js +15 -4
- package/workspace/lib/job-graph.js +4 -0
- package/workspace/lib/lab-cli.js +26 -2
- package/workspace/lib/live-round-meeting.js +167 -0
- package/workspace/lib/live-round.js +407 -0
- package/workspace/lib/meeting-focus.js +42 -10
- 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-meeting-focus.js +57 -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/cozy-rec-now.css +2 -0
- package/workspace/public/pm/cozy-rec-now.js +27 -8
- package/workspace/public/pm/ini-props.js +7 -3
- package/workspace/run-tests.js +35 -0
- package/workspace/server.js +28 -0
- package/workspace/test-lists/live-round.json +9 -0
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* companionPrompt(input) → string what the read-only agent is asked; its answer is ONE JSON object
|
|
8
8
|
* screenOf(frames, { minutes?, now_t? }) → [{ t, text }] the latest shots of the shared screen that have text (recording tab, batch 12 item 1)
|
|
9
9
|
* parseCompanion(text) → { gist, chips, topic, notes, raise } | null a malformed answer is null, a malformed part is dropped
|
|
10
|
+
* showIntent(question) → { title, brief } | null a sentence the PM typed that asks PMOS to show an idea ("show 3 ways to …")
|
|
11
|
+
* showLine(item, at) → the raise line of a Show it? offer the PM asked for themselves (no companion run)
|
|
10
12
|
* foldState(lines, { topics, startMs, nowMs }) → the page's state the append-only focus/<id>.jsonl folded
|
|
11
13
|
* outLine(parsed, at) · moveLine(...) → the lines the state file takes
|
|
12
14
|
* shouldRun(now, state, note, opts) → { run, reason } the rules of when the companion may run
|
|
@@ -17,7 +19,9 @@
|
|
|
17
19
|
* The state file holds lines of these kinds (every `at` is epoch ms):
|
|
18
20
|
* { k: 'run', at, lines } a companion run started; `lines` is how many transcript lines it could see
|
|
19
21
|
* { k: 'out', at, gist, chips, topic, notes, raise } its parsed answer
|
|
20
|
-
* { k: 'raise', at, id, action: 'raised'|'skip' }
|
|
22
|
+
* { k: 'raise', at, id, action: 'raised'|'skip'|'undo', round? } the PM's answer to a Raise now item (✓ raised it, ✗ not now, Undo:
|
|
23
|
+
* open again). For a "show" item ✓ starts a live round (lib/live-round.js); round = its id
|
|
24
|
+
* { k: 'offer', at, raise: [item] } a Show it? offer filed without a companion run (the PM typed "show 3 ways to …")
|
|
21
25
|
* { k: 'fail', at, error } the run ended without a usable answer
|
|
22
26
|
* { k: 'move', at, action: 'set'|'add'|'park'|'back', topic } the PM's correction; back = "Not this one": the line before it is on again
|
|
23
27
|
* { k: 'ask', id, at, question } a private question
|
|
@@ -32,8 +36,9 @@ const TAIL_MAX = 40; // and at most this many lines
|
|
|
32
36
|
const TOPICS_MAX = 30; // every invite line is kept; lib/agenda-topics.js shows them under 3 to 5 topics
|
|
33
37
|
const NOTES_MAX = 5;
|
|
34
38
|
const CHIPS_MAX = 4;
|
|
35
|
-
const RAISE_KINDS = Object.freeze(['check', 'follow-up', 'no-owner']);
|
|
36
|
-
const RAISE_MAX = 2; // the Now panel shows at most this many prompts
|
|
39
|
+
const RAISE_KINDS = Object.freeze(['check', 'follow-up', 'no-owner', 'show']);
|
|
40
|
+
const RAISE_MAX = 2; // the Now panel shows at most this many prompts; a Show it? offer counts as one
|
|
41
|
+
const INI_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/;
|
|
37
42
|
const FROM = Object.freeze(['talk', 'screen', 'prep', 'last']); // where an answer came from: the talk, the shared screen, the prep, last time
|
|
38
43
|
const SCREEN_MAX = 3; // how many recent shots of the shared screen the companion reads
|
|
39
44
|
const SCREEN_CHARS = 700;
|
|
@@ -185,6 +190,7 @@ function companionPrompt(input) {
|
|
|
185
190
|
} else {
|
|
186
191
|
L.push('Say what is being discussed, which topic the room is on, and add a note only when it helps the PM right now: an answer to a question the room asked, a fact to check, a decision forming, a time warning, a topic that came up, context behind a name that was said, or a follow-up. Stay quiet when nothing helps: an empty "notes" list is a good answer.');
|
|
187
192
|
L.push('In "raise", give at most ' + RAISE_MAX + ' things the PM should raise in the room now, each one short line: "check" when the screen and the talk differ (a date, a number, a name), "follow-up" when an action from last time is still open and nobody raised it, "no-owner" when the room agreed something and nobody owns it. An empty "raise" list is a good answer.');
|
|
193
|
+
L.push('Also in "raise", at most one "show": when the room names an idea that nobody can judge from words alone (a screen, a flow, a layout, a page, how something looks or moves), PMOS can make 3 quick specimens of it while the meeting goes on. Then "text" is one sentence of what to show, "title" names the idea in a few words, and "initiative" is the id of the initiative it belongs to when the brief or a reference above names it. Only offer it for an idea that is new in the talk and not offered before. Never for a decision, a number or a date.');
|
|
188
194
|
}
|
|
189
195
|
L.push('');
|
|
190
196
|
L.push('## Your answer');
|
|
@@ -193,7 +199,7 @@ function companionPrompt(input) {
|
|
|
193
199
|
L.push(' "chips":[{"label":"a name or thing said","sub":"what PMOS holds on it","ref":{"type":"initiative|plan-item|release|item|jira|ask|report|note|decision","id":"..."}} or {"label":"...","sub":"...","url":"https://..."}],');
|
|
194
200
|
L.push(' "topic":{"current":"the exact text of a line above, or a new line","add":["new lines that came up"],"under":"the name of the topic (### above) a new line belongs to"},');
|
|
195
201
|
L.push(' "notes":[{"cat":"' + CATS.join('|') + '","heard":"the line it answers","body":"the answer","why":"why now","src":"where it came from","from":["' + FROM.join('","') + '"],"acts":[{"label":"Open the record","ref":{"type":"...","id":"..."}}],"show":"now|hold","when":"when to show a held note"}],');
|
|
196
|
-
L.push(' "raise":[{"kind":"' + RAISE_KINDS.join('|') + '","text":"one short line to raise","from":"the screen, or the date of the last meeting"}]}');
|
|
202
|
+
L.push(' "raise":[{"kind":"' + RAISE_KINDS.join('|') + '","text":"one short line to raise","from":"the screen, or the date of the last meeting","title":"show only: the idea in a few words","initiative":"show only: an initiative id, or leave it out"}]}');
|
|
197
203
|
L.push('Prefer a line that is already above. Add a line only for a subject no line covers, and never one that says the same as a line above. A new line always goes under one of the topics: name it in "under".');
|
|
198
204
|
L.push('At most ' + CHIPS_MAX + ' chips and ' + NOTES_MAX + ' notes. Keep each body to two sentences. Name your source in "src". Use only references and links that you read in this repository or in the brief above; never invent one.');
|
|
199
205
|
return L.join('\n');
|
|
@@ -245,9 +251,27 @@ function raiseOf(r) {
|
|
|
245
251
|
if (!r || typeof r !== 'object' || Array.isArray(r)) return null;
|
|
246
252
|
const kind = str(r.kind, 12).toLowerCase(); const text = str(r.text, 200);
|
|
247
253
|
if (!RAISE_KINDS.includes(kind) || !text) return null;
|
|
248
|
-
|
|
254
|
+
const out = { id: raiseKey(kind, text), kind, text, from: str(r.from, 60) };
|
|
255
|
+
if (kind === 'show') {
|
|
256
|
+
out.title = str(r.title, 80) || str(text, 60);
|
|
257
|
+
const ini = str(r.initiative, 80);
|
|
258
|
+
if (ini && INI_ID.test(ini)) out.initiative = ini;
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
249
261
|
}
|
|
250
262
|
|
|
263
|
+
/* A sentence the PM typed in the meeting that asks PMOS to show an idea: "show 3 ways to …", "show it", "prototype the …",
|
|
264
|
+
* "mock up …", "can PMOS sketch …". → { title, brief } (brief = the sentence) or null. A plain question is null. */
|
|
265
|
+
const SHOW_ASK = /^(?:(?:can|could|would)\s+(?:you|pmos)\s+|please\s+|pmos[,:]?\s+)?(show(?:\s+(?:me|us))?|prototype|mock(?:\s*-?\s*up)?|sketch|draw)\b\s*(.*)$/i;
|
|
266
|
+
function showIntent(question) {
|
|
267
|
+
const q = str(question, 400).replace(/[?.!]+$/, '');
|
|
268
|
+
const m = SHOW_ASK.exec(q);
|
|
269
|
+
if (!m) return null;
|
|
270
|
+
const rest = m[2].replace(/^(?:\d+|two|three|a few)\s+(?:ways|options|versions|takes)\s+(?:of|to|for)?\s*/i, '').replace(/^(?:it|this|that)\s*$/i, '').trim();
|
|
271
|
+
return { title: str(rest || 'what the room is talking about', 80), brief: q };
|
|
272
|
+
}
|
|
273
|
+
const showLine = (item, at) => ({ k: 'offer', at, raise: [raiseOf({ kind: 'show', text: item.brief, title: item.title, initiative: item.initiative })].filter(Boolean) });
|
|
274
|
+
|
|
251
275
|
/** The companion's answer as { gist, chips, topic: { current, add }, notes, raise }. null when the text holds no JSON object or nothing
|
|
252
276
|
* in it can be shown; a part that is malformed (an unknown category, an empty body, a link that is not http) is dropped alone. */
|
|
253
277
|
function parseCompanion(text) {
|
|
@@ -259,7 +283,8 @@ function parseCompanion(text) {
|
|
|
259
283
|
const topic = { current: str(t.current, 120) || null, add: (Array.isArray(t.add) ? t.add : []).map((x) => str(x, 120)).filter(Boolean).slice(0, 3) };
|
|
260
284
|
if (str(t.under, 80)) topic.under = str(t.under, 80);
|
|
261
285
|
const notes = (Array.isArray(o.notes) ? o.notes : []).map(noteOf).filter(Boolean).slice(0, NOTES_MAX);
|
|
262
|
-
|
|
286
|
+
let shows = 0; // one Show it? offer an answer, at most
|
|
287
|
+
const raise = (Array.isArray(o.raise) ? o.raise : []).map(raiseOf).filter(Boolean).filter((r) => r.kind !== 'show' || shows++ === 0).slice(0, RAISE_MAX);
|
|
263
288
|
if (!gist && !chips.length && !topic.current && !topic.add.length && !notes.length && !raise.length) return null;
|
|
264
289
|
return { gist, chips, topic, notes, raise };
|
|
265
290
|
}
|
|
@@ -268,7 +293,7 @@ function parseCompanion(text) {
|
|
|
268
293
|
|
|
269
294
|
const outLine = (parsed, at) => ({ k: 'out', at, gist: parsed.gist, chips: parsed.chips, topic: parsed.topic, notes: parsed.notes, raise: parsed.raise || [] });
|
|
270
295
|
const moveLine = (action, topic, at) => ({ k: 'move', at, action, topic: str(topic, 120) });
|
|
271
|
-
const raiseLine = (id, action, at) => ({ k: 'raise', at, id: str(id, 80), action: action === 'raised'
|
|
296
|
+
const raiseLine = (id, action, at, round) => ({ k: 'raise', at, id: str(id, 80), action: action === 'raised' || action === 'undo' ? action : 'skip', ...(round ? { round: str(round, 120) } : {}) });
|
|
272
297
|
|
|
273
298
|
/** The page's state from the state file's lines. topics = topicsFrom(...) (the starting topics); startMs = the meeting's start; nowMs = now.
|
|
274
299
|
* → { gist, chips, current, topics: [{ id, text, src, state: now|discussed|notyet|parked, minutes, at?, by? }], runs: [{ topic, from_min, to_min }],
|
|
@@ -284,6 +309,10 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
284
309
|
for (const t of topics) addTopic(t.text || t, t.src || 'steps');
|
|
285
310
|
let current = null; const runs = []; let veto = null; let gist = ''; let chips = []; const notes = []; let seen = 0; let lastRunAt = 0; let pending = false; let error = null; let authAt = 0;
|
|
286
311
|
const asks = new Map(); const raises = new Map(); // veto: the line the PM said "Not this one" to, kept off for 5 min
|
|
312
|
+
const addRaise = (r, at) => {
|
|
313
|
+
if (!r || !r.id || raises.has(r.id)) return;
|
|
314
|
+
raises.set(r.id, { id: r.id, kind: r.kind, text: r.text, from: r.from || '', ...(r.kind === 'show' ? { title: r.title || '', ...(r.initiative ? { initiative: r.initiative } : {}) } : {}), at, state: 'open' });
|
|
315
|
+
};
|
|
287
316
|
const close = (at) => { const r = runs[runs.length - 1]; if (r && r.to == null) r.to = at; };
|
|
288
317
|
const switchTo = (row, at, by) => { if (!row || (current && current.id === row.id && runs.length && runs[runs.length - 1].to == null)) return; close(at); row.parked = false; current = row; runs.push({ topic: row.id, from: at, to: null, by: by || 'PMOS' }); };
|
|
289
318
|
const nextOpen = () => order.find((r) => r !== current && !r.parked && !runs.some((x) => x.topic === r.id));
|
|
@@ -301,9 +330,12 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
301
330
|
for (const a of tp.add || []) addTopic(a, 'added', { at, by: 'PMOS', ...under });
|
|
302
331
|
if (tp.current) { const row = addTopic(tp.current, 'added', { at, by: 'PMOS', ...under }); if (!(veto && row && row.id === veto.id && at < veto.until)) switchTo(row, at, 'PMOS'); }
|
|
303
332
|
for (const n of l.notes || []) notes.push({ ...n, id: 'n' + notes.length, at });
|
|
304
|
-
for (const r of Array.isArray(l.raise) ? l.raise : [])
|
|
333
|
+
for (const r of Array.isArray(l.raise) ? l.raise : []) addRaise(r, at);
|
|
334
|
+
} else if (l.k === 'offer') {
|
|
335
|
+
for (const r of Array.isArray(l.raise) ? l.raise : []) addRaise(r, at);
|
|
305
336
|
} else if (l.k === 'raise') {
|
|
306
|
-
const r = raises.get(l.id);
|
|
337
|
+
const r = raises.get(l.id);
|
|
338
|
+
if (r) { r.state = l.action === 'undo' ? 'open' : l.action === 'raised' ? 'raised' : 'skipped'; if (l.round) r.round = l.round; else if (l.action === 'undo') delete r.round; }
|
|
307
339
|
} else if (l.k === 'move' && l.action === 'back') {
|
|
308
340
|
// "Not this one": the line before the one PMOS moved to is on again; PMOS does not move back to it for 5 minutes
|
|
309
341
|
if (!current) continue;
|
|
@@ -401,4 +433,4 @@ function pickNow(events, { now = Date.now(), meet = '', title = '' } = {}) {
|
|
|
401
433
|
return { ok: false, status: 404, error: 'No meeting on the calendar fits this call.', choices };
|
|
402
434
|
}
|
|
403
435
|
|
|
404
|
-
module.exports = { CATS, REF_TYPES, RAISE_KINDS, RAISE_MAX, FROM, MIN_GAP_MS, TAIL_MINUTES, TAIL_MAX, topicsFrom, tailOf, capturedFrom, screenOf, companionPrompt, parseCompanion, foldState, outLine, moveLine, raiseLine, shouldRun, pickNow, meetTitle, norm, str, off };
|
|
436
|
+
module.exports = { CATS, REF_TYPES, RAISE_KINDS, RAISE_MAX, FROM, MIN_GAP_MS, TAIL_MINUTES, TAIL_MAX, topicsFrom, tailOf, capturedFrom, screenOf, companionPrompt, parseCompanion, showIntent, showLine, foldState, outLine, moveLine, raiseLine, shouldRun, pickNow, meetTitle, norm, str, off };
|
|
@@ -78,6 +78,7 @@ const JOBS = Object.freeze([
|
|
|
78
78
|
{ job: 'descriptions', label: 'Descriptions' },
|
|
79
79
|
{ job: 'outcomes', label: 'Expected outcomes' },
|
|
80
80
|
{ job: 'idle-lab', label: 'Idle lab' },
|
|
81
|
+
{ job: 'live-round', label: 'Live rounds' },
|
|
81
82
|
]);
|
|
82
83
|
const GROUP_JOB = { found: 'found-elsewhere', dates: 'dates', status: 'looks-done', names: 'names', description: 'descriptions', outcome: 'outcomes',
|
|
83
84
|
prototyped: 'idle-lab', improved: 'idle-lab', scanned: 'idle-lab' };
|
|
@@ -85,6 +86,8 @@ const GROUP_JOB = { found: 'found-elsewhere', dates: 'dates', status: 'looks-don
|
|
|
85
86
|
function jobOf(p) {
|
|
86
87
|
if (!p) return null;
|
|
87
88
|
if (p.group === 'grill') return p.type === 'past' ? 'past-repeat' : p.type === 'decision' ? 'decision-memory' : 'grill';
|
|
89
|
+
// the live round (lib/live-round.js): its ✦ ask, and a round it made (data.live), are its own job, apart from the idle lab
|
|
90
|
+
if (p.group === 'live' || ((p.group === 'prototyped' || p.group === 'improved') && p.data && p.data.live)) return 'live-round';
|
|
88
91
|
return GROUP_JOB[p.group] || null;
|
|
89
92
|
}
|
|
90
93
|
const DATE_KEPT = /:s:[0-9a-f]{10}$/;
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
* data { failure, count, items, next }; one item { id: the failure kind }. Class C, section 'check': ✓ adds a task for the PM
|
|
30
30
|
* prototyped · improved · scanned what the idle lab made while the PM was away (lib/idle-lab.js result): a first round of 2–3 specimens,
|
|
31
31
|
* a new round of one, a scan finding to attach as evidence. No items; always section 'check'. ✓ keeps it as a document
|
|
32
|
+
* live the live round's ask (lib/live-round.js askOf): type new "PMOS will show 3 ways: A …, B …, C …" (data { brief, directions }) or type
|
|
33
|
+
* feedback "Round n of B: …" (data { brief, base, round }). No items; section 'check'. ✓ starts the round (lib/live-round.js),
|
|
34
|
+
* whose result is a prototyped or improved proposal with data.live (its slots: working, made, not made). Undo stops it
|
|
32
35
|
* grill what Claude found when it grilled the initiative by itself (lib/grill.js): type = the angle, no items, a next step in data.next;
|
|
33
36
|
* always section 'check' (its own ✓, never Keep all). 3 show, best rank first; the group's `more` counts the rest and
|
|
34
37
|
* `hidden` carries them short (id, type, title, why, at, sig), for Your move's ranked list (pm/move-rank.js)
|
|
@@ -408,7 +411,7 @@ function datesOf(ini, T, o = {}) {
|
|
|
408
411
|
}
|
|
409
412
|
|
|
410
413
|
/* ── what r.props carries ── */
|
|
411
|
-
const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, status: 2, names: 3, links: 4, grill: 5 };
|
|
414
|
+
const ORDER = { build: -3, harness: -2.5, description: -2, outcome: -1, live: -0.7, prototyped: -0.6, improved: -0.5, scanned: -0.4, found: 0, dates: 1, status: 2, names: 3, links: 4, grill: 5 };
|
|
412
415
|
const GRILL_SHOWN = 3;
|
|
413
416
|
/**
|
|
414
417
|
* One initiative's proposals, as the ✦ and the Viewer draw them, or null when there is nothing to show.
|
|
@@ -427,7 +430,7 @@ function viewOf(F, ini, o = {}) {
|
|
|
427
430
|
p.items = p.items.filter((x) => !F.drops.has(itemSig(p, x)) && (!x.task || (T.has(x.task) && !(p.group !== 'found' && T.get(x.task).closed && p.group !== 'status'))));
|
|
428
431
|
if (p.group === 'status') p.items = p.items.filter((x) => T.has(x.task) && !T.get(x.task).closed);
|
|
429
432
|
if (p.group === 'names') p.items = p.items.filter((x) => T.has(x.task) && T.get(x.task).title !== x.to).map((x) => ({ ...x, from: T.get(x.task).title, ...(T.get(x.task).jira ? { jira: true } : {}) }));
|
|
430
|
-
if (!p.items.length && p.type !== 'stage' && p.group !== 'grill' && !LAB.includes(p.group)) continue;
|
|
433
|
+
if (!p.items.length && p.type !== 'stage' && p.group !== 'grill' && p.group !== 'live' && !LAB.includes(p.group)) continue;
|
|
431
434
|
if (p.group === 'grill' && factsOf(p).some((f) => F.drops.has(f))) continue;
|
|
432
435
|
props.push(p);
|
|
433
436
|
}
|
|
@@ -69,6 +69,30 @@ function grillAsk(ctx, key, text, wsId) {
|
|
|
69
69
|
: '[PMOS] The grill run did not start: ' + ((r && r.error) || 'no answer') + '. Say so in one line, and what would let it run.';
|
|
70
70
|
return { text: note + '\n\nThe PM says: ' + q, started: !!(r && r.ok) };
|
|
71
71
|
}
|
|
72
|
+
/** The live round (lib/live-round.js, initiative live-round): "show 3 ways", "prototype this", or a feedback sentence on a round that waits
|
|
73
|
+
* ("B, but lead with the risk") in an initiative's chat. The agent proposes, the PM approves: a feedback sentence files its ✦ ask here and now
|
|
74
|
+
* ("Round n of B: …"); a new ask goes to the chat's Claude with one rule: choose three directions and file them as the ✦ ask with
|
|
75
|
+
* `pmos lab round --propose`, and build nothing in the chat. The PM's ✓ under the ✦ starts the round. → { text, filed } | null */
|
|
76
|
+
function liveAsk(ctx, key, text, wsId) {
|
|
77
|
+
const k = String(key || ''), q = String(text == null ? '' : text);
|
|
78
|
+
if (!/^init:/.test(k)) return null;
|
|
79
|
+
const ini = k.replace(/^init:/, '').replace(/:\d+$/, '');
|
|
80
|
+
const LR = require('./live-round.js'), PR = require('./proposals.js');
|
|
81
|
+
let w = null; try { w = ctx.getWs ? ctx.getWs(wsId || null) : null; } catch { w = null; }
|
|
82
|
+
const dir = w && ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
83
|
+
const it = LR.intentOf(q, { waiting: dir ? LR.waiting(PR.read(dir), ini) : null });
|
|
84
|
+
if (!it || !w) return null;
|
|
85
|
+
if (it.kind === 'feedback') {
|
|
86
|
+
const r = LR.proposeNow({ ws: w.id, ini, brief: q, base: it.base, from: 'chat' });
|
|
87
|
+
const note = r.ok ? `[PMOS] The PM gave feedback on version ${it.base} of the live round. PMOS filed it under the initiative's ✦ as "${r.said}"; the PM's ✓ there makes the new round. Say so in one line. Do not build it here.`
|
|
88
|
+
: '[PMOS] The feedback round was not filed: ' + r.error + '. Say so in one line.';
|
|
89
|
+
return { text: note + '\n\nThe PM says: ' + q, filed: !!r.ok };
|
|
90
|
+
}
|
|
91
|
+
const note = '[PMOS] The PM asked to see this as a live round. Do not write HTML or build anything in this chat. Choose three clearly different directions for it, one short line each, then file them with exactly this one command: '
|
|
92
|
+
+ `\`pmos lab round ${ini} --ws ${w.id} --propose --brief "<the PM's sentence>" --dirs "A: <direction>|B: <direction>|C: <direction>"\`. `
|
|
93
|
+
+ 'Then say in one line that the three ways wait under the initiative\'s ✦, where ✓ starts them and each one shows as soon as it renders.';
|
|
94
|
+
return { text: note + '\n\nThe PM says: ' + q, filed: false };
|
|
95
|
+
}
|
|
72
96
|
function iniInfoOf(ctx, key, wsId) {
|
|
73
97
|
const id = String(key || '').replace(/^init:/, '').replace(/:\d+$/, '');
|
|
74
98
|
if (!/^init:/.test(String(key || '')) || !id) return null;
|
|
@@ -141,7 +165,8 @@ async function post(req, res, url, ctx) {
|
|
|
141
165
|
const att = Files.pathsOf({ runtimeDir, key: b.key, names: b.files });
|
|
142
166
|
if (!att.ok) { ctx.json(res, { ok: false, error: att.error }, att.status); return true; }
|
|
143
167
|
// batch 20 item 13: the PM can start a grill any time by asking for it in an initiative's chat; it also runs by itself
|
|
144
|
-
|
|
168
|
+
// the live round: "show 3 ways" or feedback on a round that waits (lib/live-round.js); a grill ask comes first
|
|
169
|
+
const g2 = grillAsk(ctx, b.key, b.text, wsId) || liveAsk(ctx, b.key, b.text, wsId);
|
|
145
170
|
const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(g2 ? g2.text : b.text, att.paths), context: b.context, sessions: ctx.chatSessions, reportInfo: () => reportInfoOf(ctx, wsId, b.report), model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId, iniInfo: () => iniInfoOf(ctx, b.key, wsId) });
|
|
146
171
|
ctx.json(res, a.body, a.status);
|
|
147
172
|
return true;
|
|
@@ -221,7 +246,7 @@ async function chatFile(req, res, url, ctx) {
|
|
|
221
246
|
return true;
|
|
222
247
|
}
|
|
223
248
|
|
|
224
|
-
module.exports = { grillAsk,
|
|
249
|
+
module.exports = { grillAsk, liveAsk,
|
|
225
250
|
products,
|
|
226
251
|
prefixes: ['/api/briefing-premium', '/api/chat-file'],
|
|
227
252
|
handle: async (req, res, url, ctx) => {
|
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
* POST /api/lab/keep { ws, id } → { ok, batch, said } ✓ on a Lab ✦: start keeps it and starts the initiative on its board
|
|
12
12
|
* POST /api/lab/drop { ws, id, why? } → { ok, batch } ✕, with the PM's reason when given
|
|
13
13
|
* POST /api/lab/undo { ws, batch } → { ok } Undo of a keep or a drop (a started initiative stays: close it on the Board)
|
|
14
|
+
* POST /api/lab/round { ws?, board?, ini, brief, base?, dirs?, propose? } → the live round (lib/live-round.js): `pmos lab round` starts one,
|
|
15
|
+
* or with propose: true files its ✦ ask. No page press needed (D98); it writes no record.
|
|
14
16
|
*
|
|
15
17
|
* The week's record lists every background job: the idle lab, the grill runs (lib/grill.js), the AI jobs through lib/ai-guard.js, and
|
|
16
18
|
* whatever the shared queue reports (ctx.bgQueue.record({ ws, since }) → [{ job, title, meta?, at, ini?, board? }], when it is there).
|
|
17
|
-
* Every POST passes pm-guard requirePagePress. */
|
|
19
|
+
* Every other POST passes pm-guard requirePagePress. */
|
|
18
20
|
const fs = require('fs');
|
|
19
21
|
const guard = require('./pm-guard.js');
|
|
20
22
|
const LAB = require('./idle-lab.js');
|
|
@@ -38,7 +40,7 @@ function titles(w) {
|
|
|
38
40
|
}
|
|
39
41
|
// Why a grill run started, in plain words (lib/grill-runs.js why), for "Checked <initiative> for risks · <why> · <what it found>"
|
|
40
42
|
// (Wawan, 2026-11-04: "I don't understand" "Grill · … why: monthly").
|
|
41
|
-
const GRILL_WHY = { monthly: 'monthly check', ask: 'you asked', exit: 'it passed a stage', forecast: 'its forecast moved', move: 'its tasks or end date moved', plan: 'its PRD changed' };
|
|
43
|
+
const GRILL_WHY = { monthly: 'monthly check', ask: 'you asked', exit: 'it passed a stage', forecast: 'its forecast moved', move: 'its tasks or end date moved', plan: 'its PRD changed', kept: 'you kept a live prototype' };
|
|
42
44
|
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
43
45
|
/** A grill run's findings: filed by the run (proposals.js propose lines carry the run), and the ones still waiting for the PM. */
|
|
44
46
|
function grillFound(P, run) {
|
|
@@ -171,6 +173,18 @@ const WRITES = {
|
|
|
171
173
|
return true;
|
|
172
174
|
},
|
|
173
175
|
};
|
|
176
|
+
/** POST /api/lab/round { ws?, board?, ini, brief, base?, dirs?, propose?, from?, by? } → { ok, round, runs } | { ok, id, said } (propose) */
|
|
177
|
+
function liveRound(ctx, res, b) {
|
|
178
|
+
const LR = require('./live-round.js');
|
|
179
|
+
const w = wsOf(ctx, typeof b.ws === 'string' && b.ws ? b.ws : null); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
180
|
+
const by = /^(pm|agent):[\w.:-]{1,80}$/.test(String(b.by || '')) ? b.by : 'agent:cli';
|
|
181
|
+
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() : '',
|
|
182
|
+
dirs: typeof b.dirs === 'string' ? b.dirs : '', from: b.from === 'meeting' ? 'meeting' : b.propose ? 'chat' : 'cli', by };
|
|
183
|
+
const r = b.propose === true ? LR.proposeNow(input) : LR.startNow(input);
|
|
184
|
+
if (!r.ok) return fail(ctx, res, 409, r.error);
|
|
185
|
+
ctx.json(res, r);
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
174
188
|
const readsDrop = (dir, b) => LAB.readLines(LAB.ledgerFile(dir)).some((l) => l.kind === 'drop' && l.batch === b);
|
|
175
189
|
|
|
176
190
|
module.exports = {
|
|
@@ -180,9 +194,12 @@ module.exports = {
|
|
|
180
194
|
if (req.method === 'GET') { const fn = READS[p0]; if (!fn) return fail(ctx, res, 404, 'not found'); return fn(ctx, res, url); }
|
|
181
195
|
if (req.method !== 'POST') return fail(ctx, res, 405, 'GET or POST only');
|
|
182
196
|
const fn = WRITES[p0];
|
|
183
|
-
if (!fn) return fail(ctx, res, 404, 'not found');
|
|
197
|
+
if (!fn && p0 !== '/api/lab/round') return fail(ctx, res, 404, 'not found');
|
|
184
198
|
const got = await ctx.readJson(req);
|
|
185
199
|
if (!got.ok || !isObj(got.body)) return fail(ctx, res, 400, 'the body must be a JSON object');
|
|
200
|
+
// the live round (lib/live-round.js): `pmos lab round` reaches it with no Origin (D98: an agent does what it was asked; the PM's own
|
|
201
|
+
// terminal too). It starts a round, or with propose: true only files the ✦ ask the PM's ✓ starts. Never a write of a record.
|
|
202
|
+
if (p0 === '/api/lab/round') return liveRound(ctx, res, got.body);
|
|
186
203
|
const g = guard.requirePagePress(req, got.body);
|
|
187
204
|
if (!g.ok) return fail(ctx, res, g.status, g.error);
|
|
188
205
|
const w = wsOf(ctx, typeof got.body.ws === 'string' ? got.body.ws : null); if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
@@ -18,8 +18,13 @@
|
|
|
18
18
|
* POST /api/meeting-focus/topic { event | note, date?, action: 'set'|'add'|'park'|'back', topic } page press; the PM's correction, appended to the state
|
|
19
19
|
* back = "Not this one": the line before is on again
|
|
20
20
|
* POST /api/meeting-focus/agenda { sig, action: 'undo' } page press; Undo the merge for that invite (every line is its topic again)
|
|
21
|
-
* POST /api/meeting-focus/ask { event, note?, date?, question } page press; one headless read-only run with the PM's question
|
|
22
|
-
*
|
|
21
|
+
* POST /api/meeting-focus/ask { event, note?, date?, question } page press; one headless read-only run with the PM's question.
|
|
22
|
+
* A sentence that asks PMOS to show an idea ("show 3 ways to …", lib/meeting-focus.js showIntent) files a ✦ Show it? offer at once
|
|
23
|
+
* instead, with no run → { ok, offer: id, state: 'offered' }
|
|
24
|
+
* POST /api/meeting-focus/raise { event | note, date?, id, action: 'raised'|'skip'|'undo' } page press; the PM's ✓ or ✗ on a Raise now item (the recording tab's Now panel),
|
|
25
|
+
* or Undo (the item is open again). ✓ on a ✦ Show it? offer (kind "show") starts a live round (lib/live-round.js round(), from 'meeting',
|
|
26
|
+
* queue step 1) on the offer's initiative, else the meeting's initiative (with neither, a 409 that says so); → { ok, round }. The companion
|
|
27
|
+
* only OFFERS: nothing starts a round but this press. A started round has no Undo here: it is dropped with ✕ in the compare view.
|
|
23
28
|
* GET /api/meeting-focus/ask?id= → { ok, id, state: working | answered | failed, error? } the answer itself comes back as a note in GET /api/meeting-focus
|
|
24
29
|
*
|
|
25
30
|
* The companion runs as origin `focus-companion:<key>` (lib/headless.js 'ask': Read, Glob and Grep only). It sends nothing to anyone and
|
|
@@ -314,14 +319,54 @@ async function agendaPress(req, body, ctx) {
|
|
|
314
319
|
}
|
|
315
320
|
/* ── POST /api/meeting-focus/raise ────────────────────────────────────────────────────────────────────────────────── */
|
|
316
321
|
|
|
322
|
+
/** lib/live-round.js round() (W1). A test hands its own in ctx.round. */
|
|
323
|
+
function roundFn(ctx) {
|
|
324
|
+
if (typeof ctx.round === 'function') return ctx.round;
|
|
325
|
+
try { const LR = require('./live-round.js'); return typeof LR.round === 'function' ? LR.round : null; } catch { return null; }
|
|
326
|
+
}
|
|
327
|
+
/** The initiative a Show it? offer belongs to: the one the companion named, else the meeting's (its event, else its brief). */
|
|
328
|
+
async function showIni(ctx, item, k) {
|
|
329
|
+
if (item.initiative) return item.initiative;
|
|
330
|
+
const ev = k.ev || (k.note && k.note.meeting && k.note.meeting.kind === 'event' ? { id: k.note.meeting.event_id, title: k.note.meeting.title || k.note.title, at: k.note.meeting.start } : null);
|
|
331
|
+
if (!ev) return null;
|
|
332
|
+
if (ev.initiative) return F.str(typeof ev.initiative === 'object' ? ev.initiative.id : ev.initiative, 80) || null;
|
|
333
|
+
try {
|
|
334
|
+
const day = String(ev.at || '').slice(0, 10);
|
|
335
|
+
const b = typeof ctx.briefFor === 'function' ? await ctx.briefFor(ev, day) : await realBrief(ctx, ev, day);
|
|
336
|
+
return b && b.initiative && b.initiative.id ? F.str(b.initiative.id, 80) : null;
|
|
337
|
+
} catch { return null; }
|
|
338
|
+
}
|
|
339
|
+
/** The brief a round takes: the offer's sentence, and what the room is on when the sentence alone says little ("show it"). */
|
|
340
|
+
function showBrief(item, gist) {
|
|
341
|
+
const s = F.str(item.text, 200);
|
|
342
|
+
return s.split(' ').length < 4 && gist ? s + ': ' + F.str(gist, 300) : s;
|
|
343
|
+
}
|
|
344
|
+
|
|
317
345
|
async function raise(req, body, ctx) {
|
|
318
346
|
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
319
347
|
const action = String(body.action || '');
|
|
320
|
-
if (!['raised', 'skip'].includes(action)) return fail(400, 'action must be raised or
|
|
348
|
+
if (!['raised', 'skip', 'undo'].includes(action)) return fail(400, 'action must be raised, skip or undo');
|
|
321
349
|
const id = F.str(body.id, 80);
|
|
322
350
|
if (!id) return fail(400, 'id is required');
|
|
323
351
|
const key = await keyFromBody(body, ctx); if (key.error) return key.error;
|
|
324
352
|
const now = typeof ctx.now === 'function' ? ctx.now() : Date.now();
|
|
353
|
+
const keys = [key.key, key.ev ? keyOf(key.ev.id) : null, key.note && key.note.meeting && key.note.meeting.event_id ? keyOf(key.note.meeting.event_id) : null];
|
|
354
|
+
const state = F.foldState(linesOf(ctx.runtimeDir, keys), { nowMs: now });
|
|
355
|
+
const item = (state.raised || []).find((r) => r.id === id) || null;
|
|
356
|
+
if (action === 'undo' && item && item.round) return fail(409, 'The round has started. Drop it with ✕ where its specimens show.');
|
|
357
|
+
if (action === 'raised' && item && item.kind === 'show') {
|
|
358
|
+
if (item.state !== 'open') return fail(409, 'This offer was answered already.');
|
|
359
|
+
const round = roundFn(ctx);
|
|
360
|
+
if (!round) return fail(409, 'Live rounds are not ready in this version of PMOS.');
|
|
361
|
+
const ini = await showIni(ctx, item, key);
|
|
362
|
+
if (!ini) return fail(409, 'This meeting names no initiative, so PMOS cannot tell where the round goes. Link the meeting to an initiative, or ask in the initiative chat.');
|
|
363
|
+
let r;
|
|
364
|
+
try { r = await round({ ws: ctx.w ? ctx.w.id : undefined, board: F.str(body.board, 80) || undefined, ini, brief: showBrief(item, state.gist), from: 'meeting', step: 1, by: 'you' }); } catch (e) { r = { ok: false, error: (e && e.message) || 'the round did not start' }; }
|
|
365
|
+
if (!r || !r.ok) return fail(409, 'PMOS could not start the round: ' + ((r && r.error) || 'no answer') + '.');
|
|
366
|
+
const roundId = r.round && r.round.id ? String(r.round.id) : '';
|
|
367
|
+
append(ctx.runtimeDir, key.key + '.jsonl', F.raiseLine(id, action, now, roundId || 'started'));
|
|
368
|
+
return { status: 200, body: { ok: true, key: key.key, ini: ini || null, round: r.round || null } };
|
|
369
|
+
}
|
|
325
370
|
append(ctx.runtimeDir, key.key + '.jsonl', F.raiseLine(id, action, now));
|
|
326
371
|
return { status: 200, body: { ok: true, key: key.key } };
|
|
327
372
|
}
|
|
@@ -369,6 +414,15 @@ async function ask(req, body, ctx) {
|
|
|
369
414
|
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
370
415
|
const question = F.str(body.question, 1000);
|
|
371
416
|
if (!question) return fail(400, 'Type your question.');
|
|
417
|
+
const show = F.showIntent(question);
|
|
418
|
+
if (show) {
|
|
419
|
+
// "show 3 ways to …": a ✦ Show it? offer, with no run; ✓ on it starts the round (POST /raise)
|
|
420
|
+
const k = await keyFromBody(body, ctx); if (k.error) return k.error;
|
|
421
|
+
const line = F.showLine(show, typeof ctx.now === 'function' ? ctx.now() : Date.now());
|
|
422
|
+
if (!line.raise.length) return fail(400, 'Say what to show.');
|
|
423
|
+
append(ctx.runtimeDir, k.key + '.jsonl', line);
|
|
424
|
+
return { status: 200, body: { ok: true, offer: line.raise[0].id, state: 'offered' } };
|
|
425
|
+
}
|
|
372
426
|
if (typeof ctx.spawnSession !== 'function') return fail(409, 'this workspace cannot start sessions');
|
|
373
427
|
if (!kindOk()) return fail(409, 'Background runs are switched off here (PMOS_HEADLESS=off), so PMOS cannot answer from this page.');
|
|
374
428
|
const k = await keyFromBody({ ...body, note: body.note }, ctx); if (k.error) return k.error;
|
|
@@ -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.582.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.582.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); }
|