create-pmos 0.803.0 → 0.804.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.803.0",
3
+ "version": "0.804.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": {
@@ -34,21 +34,30 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.803.0",
38
- "at": "2026-11-25T02:11:48.085Z",
37
+ "v": "0.804.0",
38
+ "at": "2026-11-25T02:16:07.854Z",
39
39
  "f": 4,
40
40
  "prs": [
41
- {
42
- "n": 1831,
43
- "t": "Chat input text spans the full width, controls row under it",
44
- "s": "Chat input text spans the full width, controls row under it",
45
- "k": "fix"
46
- },
47
41
  {
48
42
  "n": 1828,
49
43
  "t": "Every new task gets a stage; tasks with none are placed on the next read",
50
44
  "s": "Every new task gets a stage; tasks with none are placed on the next read",
51
45
  "k": "fix"
46
+ },
47
+ {
48
+ "n": 1830,
49
+ "t": "A grill the chat said started always lands or says why",
50
+ "s": "A grill the chat said started always lands or says why",
51
+ "k": "fix",
52
+ "try": {
53
+ "steps": [
54
+ "Open Work and open an initiative.",
55
+ "In its chat, write 'grill this'.",
56
+ "Look at Overview and the ✦."
57
+ ],
58
+ "see": "Overview and the ✦ say 'PMOS is grilling this now' while it runs; then the findings show under ✦ ('PMOS grilled it'), or one line says why it could not grill.",
59
+ "open": "/premium-board.html"
60
+ }
52
61
  }
53
62
  ]
54
63
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@97d8fb03f
1
+ kernel-source: pmos@fe5947380
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T02:11:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:16:04Z"}
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-25T02:11:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:16:04Z"}
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-25T02:11:44Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:16:04Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,20 +1,29 @@
1
1
  [
2
2
  {
3
- "v": "0.803.0",
4
- "at": "2026-11-25T02:11:48.085Z",
3
+ "v": "0.804.0",
4
+ "at": "2026-11-25T02:16:07.854Z",
5
5
  "f": 4,
6
6
  "prs": [
7
- {
8
- "n": 1831,
9
- "t": "Chat input text spans the full width, controls row under it",
10
- "s": "Chat input text spans the full width, controls row under it",
11
- "k": "fix"
12
- },
13
7
  {
14
8
  "n": 1828,
15
9
  "t": "Every new task gets a stage; tasks with none are placed on the next read",
16
10
  "s": "Every new task gets a stage; tasks with none are placed on the next read",
17
11
  "k": "fix"
12
+ },
13
+ {
14
+ "n": 1830,
15
+ "t": "A grill the chat said started always lands or says why",
16
+ "s": "A grill the chat said started always lands or says why",
17
+ "k": "fix",
18
+ "try": {
19
+ "steps": [
20
+ "Open Work and open an initiative.",
21
+ "In its chat, write 'grill this'.",
22
+ "Look at Overview and the ✦."
23
+ ],
24
+ "see": "Overview and the ✦ say 'PMOS is grilling this now' while it runs; then the findings show under ✦ ('PMOS grilled it'), or one line says why it could not grill.",
25
+ "open": "/premium-board.html"
26
+ }
18
27
  }
19
28
  ]
20
29
  },
@@ -63,6 +63,8 @@ PMOS also tests an initiative without being asked. There is no Grill button and
63
63
 
64
64
  You can also start one any time: in the initiative's chat, write "grill this" (or "grill it"). The run starts at once in the background, and the chat says so in one line. If it cannot start, for example because another grill is running or this month's credit is spent, the chat says why. The findings arrive under the ✦ as for the other runs.
65
65
 
66
+ While a grill runs, one line under the ✦ and in the initiative's Overview says "PMOS is grilling this now". When the run fails, that line gives the reason, for example "PMOS could not grill this today: the Claude API refused the run (…)". Write "grill this" again to retry. When the Claude API refuses a run at its first call (for example, an API key that is not in a workspace), PMOS runs the same grill in a background session instead, so the run still finishes.
67
+
66
68
  Each finding is a proposal in the group "PMOS grilled it", under the same ✦. Each row shows the mark and the name of the angle that found it: Premortem, Red team, Voices, Reframe, Scope, What-if or Earlier decision. Voices are simulated from your stored research and meeting notes, only with 3 sources or more, and carry the tag "Simulated, not evidence". A What-if carries "Simulated, not the plan". Each finding ends with one next step. ✓ adds that step as a task. ✎ lets you write the step in your own words first; ✓ then adds your words. ✕ drops the finding. A finding never rides on the header's ✓. Above the findings, one quiet line names the angles PMOS chose, when and why it ran, and what the run cost. Three findings show at a time; "+N smaller findings" and its ⋯ show the rest. On a phone the findings are cards side by side: swipe for the next. With no findings, nothing shows.
67
69
 
68
70
  The initiative's header shows its two strongest findings, each with its angle and day, and a ✦ with the count that opens all of them. Every finding, including the ones behind "+N smaller findings", is also ranked in Your move in [Your day](home.md).
@@ -10,7 +10,8 @@
10
10
  *
11
11
  * available(env, apiKey?) → bool a key is saved in Settings (lib/anthropic-key.js) or set in ANTHROPIC_API_KEY, and PMOS_GRILL_API is not off
12
12
  * costOf(model, usage) → US dollars null for a model with no known price
13
- * run({ prompt, root, env, budget, model?, client?, signal?, pmosBin?, apiKey? }) → Promise<{ ok, code, costUsd, note?, turns }>
13
+ * run({ prompt, root, env, budget, model?, client?, signal?, pmosBin?, apiKey? }) → Promise<{ ok, code, costUsd, note?, turns, refused? }>
14
+ * refused: true when the very first call failed and nothing was spent; the run then goes on in a background session
14
15
  * (the shape lib/grill-runs.js `ended` reads: { code, result: { ok, costUsd } })
15
16
  */
16
17
  const fs = require('fs');
@@ -110,7 +111,7 @@ async function run({ prompt, root, env: extra, budget, model, client, signal, pm
110
111
  const key = (apiKey && String(apiKey).trim()) || env.ANTHROPIC_API_KEY;
111
112
  delete env.ANTHROPIC_API_KEY; // the key is the loop's own: a pmos command it runs never sees it
112
113
  const useModel = model || modelOf(env), limit = Number(budget);
113
- if (!key && !client) return { ok: false, code: 1, costUsd: 0, turns: 0, note: 'no ANTHROPIC_API_KEY' };
114
+ if (!key && !client) return { ok: false, code: 1, costUsd: 0, turns: 0, note: 'no ANTHROPIC_API_KEY', refused: true };
114
115
  if (PRICE[useModel] == null) return { ok: false, code: 1, costUsd: 0, turns: 0, note: `no known price for ${useModel}: the budget cannot be held` };
115
116
  const api = client || new (require('@anthropic-ai/sdk'))({ apiKey: key });
116
117
  const ctx = { root: path.resolve(root || process.cwd()), env, pmosBin: pmosBin || path.join(__dirname, '..', 'bin', 'pmos.js') };
@@ -127,7 +128,10 @@ async function run({ prompt, root, env: extra, budget, model, client, signal, pm
127
128
  tools: TOOLS, messages }, signal ? { signal } : undefined);
128
129
  } catch (e) {
129
130
  if (signal && signal.aborted) return { ...done(false, 'stopped'), stopped: true };
130
- return done(false, 'the Claude API failed: ' + String((e && e.status ? e.status + ' ' : '') + ((e && e.message) || e)).slice(0, 200));
131
+ const r = done(false, 'the Claude API failed: ' + String((e && e.status ? e.status + ' ' : '') + ((e && e.message) || e)).slice(0, 200));
132
+ // refused: the first call failed and nothing was spent (a key the API does not take, a missing workspace header, no credit).
133
+ // lib/grill-runs.js then runs the same grill in a background session instead
134
+ return turns === 1 && !cost ? { ...r, refused: true } : r;
131
135
  }
132
136
  cost += costOf(useModel, res.usage) || 0;
133
137
  messages.push({ role: 'assistant', content: res.content });
@@ -82,7 +82,7 @@ function create(deps) {
82
82
  const res = (r && r.result) || {};
83
83
  const ok = !!(r && !r.timedOut && !r.stopped && r.code === 0 && res.ok !== false && !res.isError);
84
84
  const cost = Number.isFinite(res.costUsd) ? Math.round(res.costUsd * 10000) / 10000 : null;
85
- try { G.append(runtime(), { kind: 'end', run, ok, cost, ...(ok ? {} : { error: one((r && r.note) || res.text || 'the run failed', 200) }) }, now); } catch (e) { warn('grill run end', e); }
85
+ try { G.append(runtime(), { kind: 'end', run, ok, cost, ...(ok ? {} : { error: one((r && r.note) || res.text || 'the run failed', 200) }), ...(r && r.stopped ? { stopped: true } : {}) }, now); } catch (e) { warn('grill run end', e); }
86
86
  }
87
87
 
88
88
  /** Start one run now. → { ok, run, budget } | { ok: false, error, paused?, held? } */
@@ -116,30 +116,48 @@ function create(deps) {
116
116
  const prompt = promptOf(skill, { run, why, detail, ini, title: row.title || ini, intent: row.intent || '', stage: row.stage || '', stages: row.stages || [], today: localDay(now), open, dropped, lessons, budget: b.budget, decisions });
117
117
  active.set(run, { session: null });
118
118
  const env = { PMOS_GRILL_FILE: PR.ledgerFile(dir), PMOS_GRILL_LOG: G.logFile(rt), PMOS_GRILL_ROOT: w.root || '', PMOS_GRILL_WS: ws, PMOS_GRILL_BOARD: board || '', PMOS_GRILL_INI: ini, PMOS_GRILL_RUN: run, PMOS_GRILL_BUDGET: String(b.budget) };
119
- // With an API key the run goes to the Claude API (lib/grill-api.js); without one it stays a background agent session
119
+ let started = false;
120
+ const startLine = () => { if (!started) { started = true; G.append(rt, { kind: 'start', run, ws, ini, board: board || '', why, key, budget: b.budget }, now); } };
121
+ // The background agent session (`claude -p`): the default, and where an API run goes when the API refuses its first call
122
+ const viaSession = (note) => {
123
+ let session = null;
124
+ try {
125
+ session = deps.spawn({ name: 'Grilling · ' + one(row.title || ini, 60), ws, origin: `grill:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
126
+ env,
127
+ // a run that went on after the API refused it carries both reasons when it fails too
128
+ onDone: (r) => ended(run, note && r && !(r.code === 0 && !r.timedOut && !r.stopped) ? { ...r, note: note + '; ' + ((r.note || (r.result && r.result.text)) || 'the run failed') } : r) });
129
+ } catch (e) { warn('grill run', e); }
130
+ // held before it started: nothing is written, so the tick tries again in a minute
131
+ if (session && session.held && !started) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it grills in a minute' }; }
132
+ startLine();
133
+ const why0 = (session && session.held ? 'PMOS is busy with other runs; try again in a minute' : '') || (session && session.note) || 'the run could not start in the background';
134
+ if (!session || session.held || session.state === 'exited' || session.headless !== 'grill') {
135
+ if (session && !session.held && session.headless !== 'grill' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
136
+ ended(run, { code: 1, note: (note ? note + '; ' : '') + why0, result: { costUsd: 0 } });
137
+ return { ok: false, held: !!(session && session.held), error: why0 };
138
+ }
139
+ if (active.has(run)) active.get(run).session = session;
140
+ return { ok: true };
141
+ };
142
+ // With an API key the run goes to the Claude API (lib/grill-api.js). When the API refuses the first call (a key it does not take,
143
+ // a missing workspace header, no credit: nothing was spent), the same run goes on in a background session, so a key that stopped
144
+ // working never leaves the PM with a run that said it started and then showed nothing (Wawan, 2026-11-25).
120
145
  if (deps.api && deps.api.available(deps.env)) {
121
146
  const ctl = new AbortController();
122
- G.append(rt, { kind: 'start', run, ws, ini, board: board || '', why, key, budget: b.budget }, now);
147
+ startLine();
123
148
  active.get(run).session = { abort: () => ctl.abort() };
124
149
  Promise.resolve().then(() => deps.api.run({ prompt, root: w.root, env, budget: b.budget, signal: ctl.signal }))
125
- .then((r) => ended(run, { code: r.code, stopped: !!r.stopped, note: r.note, result: { ok: r.ok, costUsd: r.costUsd } }),
126
- (e) => ended(run, { code: 1, note: String((e && e.message) || e), result: { costUsd: 0 } }));
150
+ .then((r) => {
151
+ if (r && !r.ok && r.refused && !r.stopped && active.has(run)) {
152
+ try { G.append(rt, { kind: 'via', run, to: 'session', why: one(r.note, 200) }); } catch (e) { warn('grill via', e); }
153
+ return viaSession('the Claude API refused the run (' + one(r.note, 120) + ')');
154
+ }
155
+ return ended(run, { code: r.code, stopped: !!r.stopped, note: r.note, result: { ok: r.ok, costUsd: r.costUsd } });
156
+ }, (e) => ended(run, { code: 1, note: String((e && e.message) || e), result: { costUsd: 0 } }));
127
157
  return { ok: true, run, budget: b.budget, api: true };
128
158
  }
129
- let session = null;
130
- try {
131
- session = deps.spawn({ name: 'Grilling · ' + one(row.title || ini, 60), ws, origin: `grill:${ws}:${ini}:${run}`, initialInput: prompt + '\r', initiative: ini,
132
- env,
133
- onDone: (r) => ended(run, r) });
134
- } catch (e) { warn('grill run', e); }
135
- if (session && session.held) { active.delete(run); return { ok: false, held: true, error: 'PMOS is busy with other runs; it grills in a minute' }; }
136
- G.append(rt, { kind: 'start', run, ws, ini, board: board || '', why, key, budget: b.budget }, now);
137
- if (!session || session.state === 'exited' || session.headless !== 'grill') {
138
- if (session && session.headless !== 'grill' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
139
- ended(run, { code: 1, note: (session && session.note) || 'the run could not start in the background', result: { costUsd: 0 } }, now);
140
- return { ok: false, error: (session && session.note) || 'PMOS could not start grilling' };
141
- }
142
- active.get(run).session = session;
159
+ const s = viaSession('');
160
+ if (!s.ok) return { ok: false, ...(s.held ? { held: true } : {}), error: s.error || 'PMOS could not start grilling' };
143
161
  return { ok: true, run, budget: b.budget };
144
162
  }
145
163
 
@@ -24,7 +24,8 @@
24
24
  * says so once per month (a `paused` line).
25
25
  *
26
26
  * WHERE IT RUNS: with ANTHROPIC_API_KEY set, a run goes to the Claude API (lib/grill-api.js: a tool loop on the Messages API, model
27
- * PMOS_GRILL_MODEL or claude-opus-5-5, cost counted from usage and held to the budget); PMOS_GRILL_API=off or no key keeps the background agent session.
27
+ * PMOS_GRILL_MODEL or claude-opus-5-5, cost counted from usage and held to the budget); PMOS_GRILL_API=off or no key keeps the background agent session. When the API refuses
28
+ * the first call (nothing spent), the same run goes on in the background session; a run that still fails shows one line under the ✦ (runStateOf).
28
29
  *
29
30
  * THE LOG, <runtime>/grill-runs.jsonl (machine-wide, so the cap covers every product), one line per event { at, kind, ... }:
30
31
  * start { run, ws, ini, board, why, key, budget } key: what started it (the stage, the turn, the move), so it runs once per key
@@ -36,6 +37,9 @@
36
37
  *
37
38
  * logFile(dir) · readLines(file) · read(dir) → fold · append(dir, line)
38
39
  * fold(lines) PURE → { runs: Map run → r, keys: Set, lastAt: Map ws|ini → iso, snaps: Map, plans: Map, paused: Set month }
40
+ * runStateOf(F, ws, ini, now) PURE → what the initiative's ✦ says of its newest run: { state: 'running', at } while it runs,
41
+ * { state: 'failed', at, error } when the newest run failed (within 7 days), else null
42
+ * runStatesFor(dir, ws, now) reads the log once → (ini) → runStateOf | null (the Board rows and GET /api/proposals)
39
43
  * monthOf(ms) · spentIn(F, month) the month's spend (an open run counts its whole budget)
40
44
  * budgetFor(F, { cap, now }) PURE → { ok, budget, spent } | { ok: false, spent, why: 'cap' }
41
45
  * moved(prev, cur) PURE → '' | what moved, in words
@@ -104,7 +108,7 @@ function fold(lines) {
104
108
  if (str(l.key)) keys.add(l.key);
105
109
  lastAt.set(l.ws + '|' + l.ini, str(l.at));
106
110
  } else if (l.kind === 'voices') { const r = runs.get(l.run); if (r) r.voices = Number(l.n) || 0; }
107
- else if (l.kind === 'end') { const r = runs.get(l.run); if (r) { r.ended = true; r.ok = !!l.ok; r.cost = Number.isFinite(Number(l.cost)) && l.cost !== null ? Number(l.cost) : null; r.endAt = str(l.at); if (l.error) r.error = str(l.error); } }
111
+ else if (l.kind === 'end') { const r = runs.get(l.run); if (r) { r.ended = true; r.ok = !!l.ok; r.cost = Number.isFinite(Number(l.cost)) && l.cost !== null ? Number(l.cost) : null; r.endAt = str(l.at); if (l.error) r.error = str(l.error); if (l.stopped) r.stopped = true; } }
108
112
  else if (l.kind === 'snap') snaps.set(l.ws + '|' + l.ini, { n: Number(l.n) || 0, end: str(l.end), at: str(l.at) });
109
113
  else if (l.kind === 'plan') plans.set(l.ws + '|' + l.ini, str(l.sig));
110
114
  else if (l.kind === 'paused') paused.add(str(l.month));
@@ -112,6 +116,26 @@ function fold(lines) {
112
116
  return { runs, keys, lastAt, snaps, plans, paused };
113
117
  }
114
118
 
119
+ /** PURE. The newest grill run of one initiative, as its ✦ says it: running (started in the last RUNNING_MS and not ended), or failed (ended
120
+ * not ok in the last 7 days, and no run since). A run that ended ok, or one that is older, says nothing here (its findings are the ✦). */
121
+ const RUNNING_MS = 45 * 60e3;
122
+ function runStateOf(F, ws, ini, now = Date.now()) {
123
+ if (!F || !F.runs || !ini) return null;
124
+ let last = null;
125
+ for (const r of F.runs.values()) if (r.ini === ini && (!ws || r.ws === ws) && (!last || String(r.at) >= String(last.at))) last = r;
126
+ if (!last) return null;
127
+ const at = Date.parse(last.at) || 0;
128
+ if (!last.ended) return now - at <= RUNNING_MS ? { state: 'running', run: last.run, why: last.why, at: last.at } : null;
129
+ if (last.ok === false && !last.stopped && now - (Date.parse(last.endAt || last.at) || 0) <= 7 * 864e5) return { state: 'failed', run: last.run, why: last.why, at: last.endAt || last.at, error: last.error || 'the run failed' };
130
+ return null;
131
+ }
132
+
133
+ /** The ✦ line for every initiative of one workspace: reads the log once. → (ini) → runStateOf | null. A log that cannot be read says nothing. */
134
+ function runStatesFor(dir, ws, now = Date.now()) {
135
+ let F = null; try { F = dir ? read(dir) : null; } catch { F = null; }
136
+ return (ini) => (F ? runStateOf(F, ws, ini, now) : null);
137
+ }
138
+
115
139
  /* ── the credit cap ── */
116
140
  const monthOf = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0'); };
117
141
  /** What the month spent. An ended run counts its cost (its budget when the cost is unknown); an open run counts its whole budget. */
@@ -179,4 +203,4 @@ function finding(angle, input) {
179
203
  const idOf = (ini, angle, key) => 'pr-' + hash([ini, 'grill', angle, key || ''].join('|'));
180
204
 
181
205
  module.exports = { LOG, ANGLES, LABEL, SIMULATED, WHYS, MODES, VOICES_MIN, RUN_MAX_USD, RUN_MIN_USD, EST_USD, MONTHLY_DAYS, MOVE_DAYS,
182
- off, modeOf, logFile, readLines, read, append, fold, monthOf, spentIn, budgetFor, moved, ready, finding, idOf, dn };
206
+ off, modeOf, logFile, readLines, read, append, fold, runStateOf, runStatesFor, RUNNING_MS, monthOf, spentIn, budgetFor, moved, ready, finding, idOf, dn };
@@ -583,10 +583,12 @@ function viewOf(F, ini, o = {}) {
583
583
  sources: [...L.sources].filter(([, s]) => s.state === 'reading' || s.n > 0).map(([k, s]) => ({ source: k, name: SOURCE_NAMES[k] || k, state: s.state, n: s.n, what: s.what })) } : null;
584
584
  // the live look matters while it runs; once it ended it says nothing more (its finds are the proposals)
585
585
  const looking = look && !look.ended ? look : null;
586
- if (!props.length && !looking) return null;
586
+ // the grill run the PM was told about (lib/grill.js runStateOf): running, or failed with its reason; one line under the ✦, never silence
587
+ const grillRun = o.grillRun && (o.grillRun.state === 'running' || o.grillRun.state === 'failed') ? o.grillRun : null;
588
+ if (!props.length && !looking && !grillRun) return null;
587
589
  const groups = [];
588
590
  for (const p of props) { let g = groups.find((x) => x.group === p.group); if (!g) groups.push(g = { group: p.group, props: [], ...(p.group === 'grill' && grillMore ? { more: grillMore, hidden: grillHidden } : {}) }); g.props.push(p); }
589
- return { n: props.length, sure: props.filter((p) => p.section === 'sure').length, look: looking, groups, t: F.t };
591
+ return { n: props.length, sure: props.filter((p) => p.section === 'sure').length, look: looking, groups, t: F.t, ...(grillRun ? { grillRun } : {}) };
590
592
  }
591
593
 
592
594
  /** chief-of-staff C3: the filed proposals with no answer for EXPIRE_DAYS days, as the expire lines to append. PURE. now: ms. A proposal
@@ -615,7 +617,8 @@ function historyOf(F, uid) {
615
617
  return out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
616
618
  }
617
619
 
618
- /** Each Board row's r.props and r.found. items: the board's work items. o: { today, links(ini) → approved links, linkProps(r) → [proposal], settle, stages(r) } */
620
+ /** Each Board row's r.props and r.found. items: the board's work items. o: { today, links(ini) → approved links, linkProps(r) → [proposal], settle, stages(r),
621
+ * grillRun(ini) → lib/grill.js runStateOf | null } */
619
622
  function decorate(rows, F, items, o = {}) {
620
623
  if (!F) return rows;
621
624
  const T = new Map();
@@ -625,7 +628,7 @@ function decorate(rows, F, items, o = {}) {
625
628
  let v = null;
626
629
  try {
627
630
  v = viewOf(F, r.id, { T, today: o.today, stages: (r.wfStages || []).map((s) => ({ key: s.key, name: s.name })), links: o.links ? o.links(r.id) : [], settle: o.settle,
628
- linkProps: r.links && Array.isArray(r.links.proposals) ? r.links.proposals : [] });
631
+ linkProps: r.links && Array.isArray(r.links.proposals) ? r.links.proposals : [], grillRun: o.grillRun ? o.grillRun(r.id) : null });
629
632
  } catch { v = null; }
630
633
  if (v) r.props = v;
631
634
  const f = foundOf(F, r.id); if (f) r.found = f;
@@ -166,7 +166,7 @@ module.exports = {
166
166
  const items = its && its.body && Array.isArray(its.body.items) ? its.body.items : [], TL = require('./task-links.js'), PR = require('./proposals.js');
167
167
  const T = new Set(items.map((x) => x && x.uid).filter(Boolean)), approved = TL.linksOf(TL.read(dir)).filter((l) => T.has(l.from) && T.has(l.to));
168
168
  const F = PR.read(dir), today = model.today || new Date().toISOString().slice(0, 10);
169
- for (const L of [model.rows, ...(model.stages || []).map((x) => x.rows)]) PR.decorate(L, F, items.filter((x) => x && x.kind !== 'Epic'), { today, links: () => approved, settle: TL.settle });
169
+ for (const L of [model.rows, ...(model.stages || []).map((x) => x.rows)]) PR.decorate(L, F, items.filter((x) => x && x.kind !== 'Epic'), { today, links: () => approved, settle: TL.settle, grillRun: require('./grill.js').runStatesFor(ctx.runtimeDir, w && w.id) });
170
170
  }
171
171
  } catch { missing.push('PMOS\'s proposals'); }
172
172
  // Claude's suggestion to split an initiative or merge two (batch 11 item 14): made from the tasks and tickets on every read, never a timer;
@@ -66,7 +66,7 @@ function grillAsk(ctx, key, text, wsId) {
66
66
  if (!/^init:/.test(k) || !GRILL_RE.test(q) || typeof ctx.grillStart !== 'function') return null;
67
67
  const ini = k.replace(/^init:/, '').replace(/:\d+$/, '');
68
68
  let r; try { r = ctx.grillStart({ ws: wsId, ini, why: 'ask', key: 'ask:' + Date.now(), detail: q.slice(0, 200) }); } catch (e) { r = { ok: false, error: String((e && e.message) || e).slice(0, 160) }; }
69
- const note = r && r.ok ? '[PMOS] A grill run on this initiative started in the background just now. Its findings will wait under the initiative\'s ✦. Say so in one line. Do not grill it again here.'
69
+ const note = r && r.ok ? '[PMOS] A grill run on this initiative started in the background just now. Its findings will wait under the initiative\'s ✦; if it cannot finish, one line there says why. Say so in one line. Do not grill it again here.'
70
70
  : '[PMOS] The grill run did not start: ' + ((r && r.error) || 'no answer') + '. Say so in one line, and what would let it run.';
71
71
  return { text: note + '\n\nThe PM says: ' + q, started: !!(r && r.ok) };
72
72
  }
@@ -69,7 +69,8 @@ function view(ctx, p, ini, f, o = {}) {
69
69
  // the scope cuts (lib/scope-cuts.js): the committed end, and the PRD's words to say which cut costs more
70
70
  const prd = (() => { try { return TLR.prdText(p.w.root, ini) || ''; } catch { return ''; } })();
71
71
  const named = (title) => { const t = String(title || '').replace(/^\d+(\.\d+)*\s+/, '').trim(); return t.length >= 6 && prd.toLowerCase().includes(t.toLowerCase()); };
72
- return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named, me, pmName });
72
+ return PR.viewOf(F, ini, { T, today: todayIso(), stages: stagesOf(ctx, p, ini), links, settle: TL.settle, linkProps, grillAll: !!o.grillAll, limit: limitOf(f, T, ini), named, me, pmName,
73
+ grillRun: require('./grill.js').runStatesFor(ctx.runtimeDir, p.w && p.w.id)(ini) });
73
74
  }
74
75
  /** The date the scope cuts keep: the initiative's committed end (its plan items), else the plan end its tasks make, as the Board's row
75
76
  * shows it (routes-boards boardRow: the latest due date of its tasks). → day number | null */
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.803.0",
3
+ "version": "0.804.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.803.0",
9
+ "version": "0.804.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.803.0",
3
+ "version": "0.804.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -14,6 +14,8 @@
14
14
  * at: { ws, board, ini, title, props? } H: { pmGet, pmPost, toast, toastUndo, reload, full() }
15
15
  * On a phone the groups are folded, the counts first and the lines on a tap (CsF phone). Nothing is written before a press. */
16
16
 
17
+ import { runStateLine } from './grill-words.js'; // a grill run the PM was told about: running, or failed and why
18
+
17
19
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
18
20
  const SVG = (d, w = 16, sw = 2) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
19
21
  const I = { check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', more: 'M5 12h.01M12 12h.01M19 12h.01' };
@@ -90,12 +92,13 @@ function checkHtml(p) {
90
92
  }
91
93
  function bodyHtml() {
92
94
  const B = batchOf(S.props), VW = window.czViewer;
93
- if (!B.n) return '<p class="pp-none">Nothing waits here now.</p>';
95
+ const gr = S.props && S.props.grillRun, gl = gr ? `<p class="pp-grun${gr.state === 'failed' ? ' bad' : ''}" role="status">${esc(runStateLine(gr))}</p>` : '';
96
+ if (!B.n) return gl ? `<div class="pp bp">${gl}</div>` : '<p class="pp-none">Nothing waits here now.</p>';
94
97
  const lead = B.sure ? `<p class="bp-lead">${SVG(I.spark, 14, 2)} Here is everything I want to change on ${esc(S.at.title)}, on one screen. Keep all of it at once, or leave out one line.</p>` : '';
95
98
  const phone = isPhone();
96
99
  const secs = B.groups.map((g) => ({ id: g.group, title: g.title, count: g.lines.length, open: !phone, html: g.lines.map((l) => lineHtml(g.group, l)).join('') }));
97
100
  if (B.check.length) secs.push({ id: 'check', title: 'Check these', count: B.check.length, open: !phone || !B.sure, html: '<p class="bp-sub">Each one needs its own answer.</p>' + B.check.map(checkHtml).join('') });
98
- return `<div class="pp bp">${lead}${VW.czSections(secs, { key: 'batch' })}<button type="button" class="bp-full" data-bp-full>${SVG(I.more, 16, 2.4)} Open everything PMOS proposes on ${esc(S.at.title)}</button></div>`;
101
+ return `<div class="pp bp">${gl}${lead}${VW.czSections(secs, { key: 'batch' })}<button type="button" class="bp-full" data-bp-full>${SVG(I.more, 16, 2.4)} Open everything PMOS proposes on ${esc(S.at.title)}</button></div>`;
99
102
  }
100
103
  const presses = () => { const B = batchOf(S.props); return B.sure ? [{ act: 'all', label: 'Keep all ' + B.sure, icon: I.check, solid: true }] : []; };
101
104
  function draw() {
@@ -178,7 +181,7 @@ export function openBatch(at, H) {
178
181
  body.innerHTML = '<p class="pp-none">Reading what PMOS proposes…</p>'; body.onclick = onPress;
179
182
  body.onkeydown = (e) => { if (e.key === 'Enter' && e.target.matches('[data-bp-in]')) { e.preventDefault(); giveWhy(e.target.dataset.bpIn, e.target.value.trim()); } };
180
183
  if (S.props) draw();
181
- if (!S.props || S.props.look) fresh();
184
+ if (!S.props || S.props.look || S.props.grillRun) fresh();
182
185
  },
183
186
  onClose: () => { S.left.clear(); } });
184
187
  }
@@ -136,3 +136,6 @@ div.pwd-art { cursor: default; }
136
136
  .pwd-gh.drop-on { box-shadow: inset 0 0 0 2px var(--blue); background: var(--blue-tint); }
137
137
  .pwd-src { margin-left: auto; }
138
138
  .pwd-list.holding .pwd-li { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
139
+ /* the grill run the chat said started: running, or failed and why (pm/grill-words.js runStateLine) */
140
+ .pwd-grun { margin: var(--space-4) 0 0; color: var(--cz-blueink); }
141
+ .pwd-grun.bad { color: var(--cz-red); }
@@ -28,6 +28,7 @@ export const I = {
28
28
  };
29
29
  import * as WT from './work-tree.js'; // subtasks and the epic check (initiative work-subtasks)
30
30
  import { barHtml as selBar } from './work-select.js'; // the bulk bar (WorkBulkDS)
31
+ import { runStateLine } from './grill-words.js'; // a grill run the PM was told about: running, or failed and why (lib/grill.js runStateOf)
31
32
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
32
33
  const DAY = 864e5;
33
34
  const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
@@ -94,7 +95,10 @@ function standsParts(W, r, o = {}) {
94
95
  }).join('')}</p>` : '';
95
96
  const s = (W.suggests || [])[0], more = Math.max(0, (W.suggests || []).length - 1) + (W.more || 0);
96
97
  const sug = o.ro ? '' : sugHtml(s) + (more ? `<p class="pwd-moresug"><button type="button" class="pw-lk" data-pw-props>${esc(plural(more, 'more suggestion', 'more suggestions'))}</button></p>` : '');
97
- return { say, next, sug, n: o.ro ? 0 : (s && s.say ? 1 : 0) + more };
98
+ // the grill run the chat said started: one line while it runs, and one line with the reason when it failed (never silence)
99
+ const g = r && r.props && r.props.grillRun ? runStateLine(r.props.grillRun) : '';
100
+ const grill = g ? `<p class="pwd-grun pm-meta${r.props.grillRun.state === 'failed' ? ' bad' : ''}" role="status">${esc(g)}</p>` : '';
101
+ return { say, next, sug, grill, n: o.ro ? 0 : (s && s.say ? 1 : 0) + more };
98
102
  }
99
103
  export function standsHtml(W, r, o = {}) {
100
104
  const { say, next, sug } = standsParts(W, r, o);
@@ -292,16 +296,16 @@ export function caseHtml(W, o = {}) {
292
296
  * that opens it when PMOS has a suggestion waiting. The block's head is the fold press (data-pw-ov). Nothing to show: ''. */
293
297
  export function overviewHtml(W, r, o = {}) {
294
298
  const s = standsParts(W, r, o), c = caseParts(W, o), open = o.open !== false;
295
- if (!s.say && !s.next && !s.sug && !c.top && !c.lines && !c.status && !c.facts) return '';
299
+ if (!s.say && !s.next && !s.sug && !s.grill && !c.top && !c.lines && !c.status && !c.facts) return '';
296
300
  const head = `<h2 class="pm-h-sm"><button type="button" class="pwd-ovt" data-pw-ov aria-expanded="${open}">${SV(open ? I.down : I.right, 16)}${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}Overview</button></h2>`;
297
301
  if (!open) {
298
302
  const line = s.say || (W.overview && W.overview.status) || '';
299
303
  const one = line ? `<p class="pwd-say pwd-ov1">${esc(line)}</p>` : s.next;
300
304
  const sg = s.n ? `<button type="button" class="pw-lk" data-pw-ov>${esc(plural(s.n, 'suggestion', 'suggestions'))}</button>` : '';
301
- return `<section class="pm-block pwd-blk pwd-ov shut" aria-label="Overview">${head}${one || sg ? `<div class="pm-row pwd-ovs">${one}${sg}</div>` : ''}</section>`;
305
+ return `<section class="pm-block pwd-blk pwd-ov shut" aria-label="Overview">${head}${one || sg ? `<div class="pm-row pwd-ovs">${one}${sg}</div>` : ''}${s.grill}</section>`;
302
306
  }
303
307
  const part = (cls, lbl, h) => (h ? `<div class="pwd-ovp ${cls}"><h3 class="pm-meta">${lbl}</h3>${h}</div>` : '');
304
- const stands = part('pwd-ovw', 'Where it stands', (s.say ? `<p class="pwd-say">${esc(s.say)}</p>` : '') + s.next + s.sug);
308
+ const stands = part('pwd-ovw', 'Where it stands', (s.say ? `<p class="pwd-say">${esc(s.say)}</p>` : '') + s.grill + s.next + s.sug);
305
309
  const kase = part('pwd-ovc', 'The case', c.top + c.lines + c.status);
306
310
  const facts = part('pwd-ovf', 'Details', c.facts);
307
311
  return `<section class="pm-block pwd-blk pwd-ov" aria-label="Overview">${head}<div class="pwd-ovg">${stands}${kase}${facts}</div></section>`;
@@ -58,6 +58,15 @@ export function runLine(r, now = Date.now()) {
58
58
  if (!r) return '';
59
59
  return ['PMOS grilled it', whenWord(r.at, now)].filter(Boolean).join(' ') + (whyWord(r) ? ', ' + whyWord(r) : '');
60
60
  }
61
+ /** The one line the ✦ and the Overview say of a grill run the PM was told about (lib/grill.js runStateOf): running, or failed and why.
62
+ * Zero is silence: a run that ended well says nothing here (its findings are the ✦). → '' | text */
63
+ export function runStateLine(g, now = Date.now()) {
64
+ if (!g) return '';
65
+ if (g.state === 'running') return 'PMOS is grilling this now. Its findings show under ✦ when it ends.';
66
+ if (g.state !== 'failed') return '';
67
+ const why = String(g.error || 'the run failed').replace(/\s+/g, ' ').trim().replace(/[.;:,\s]+$/, '');
68
+ return 'PMOS could not grill this ' + (whenWord(g.at, now) || 'just now') + ': ' + (why.length > 160 ? why.slice(0, 159) + '…' : why) + '. Say "grill this" in the chat to try again.';
69
+ }
61
70
  export const turnWord = (to) => (to === 'will-miss' ? 'will miss' : to === 'at-risk' ? 'is at risk' : '');
62
71
 
63
72
  const MONS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -47,9 +47,11 @@ const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Chan
47
47
  /* ── the chip and the live look ── */
48
48
  export function chipOf(p) {
49
49
  if (!p) return null;
50
- const looking = !!(p.look && !p.look.ended);
51
- if (!p.n && !looking) return null;
52
- return { n: p.n || 0, looking, label: p.n ? 'PMOS proposes ' + p.n + (looking ? ', and is still looking' : '') + '. Open' : 'PMOS is looking for this initiative. Open' };
50
+ const gr = p.grillRun || null, grilling = !!(gr && gr.state === 'running');
51
+ const looking = !!(p.look && !p.look.ended) || grilling;
52
+ if (!p.n && !looking && !gr) return null;
53
+ return { n: p.n || 0, looking, label: p.n ? 'PMOS proposes ' + p.n + (looking ? ', and is still looking' : '') + '. Open'
54
+ : grilling ? 'PMOS is grilling this initiative. Open' : looking ? 'PMOS is looking for this initiative. Open' : 'PMOS could not grill this initiative. Open' };
53
55
  }
54
56
  const POLL = new Map(); // initiative id → timer, while Claude looks
55
57
  export function sync(v, H) {
@@ -186,9 +188,10 @@ function lookBlock(L) {
186
188
  }
187
189
  function bodyHtml(P) {
188
190
  const VW = window.czViewer;
189
- if (!P || (!P.n && !(P.look && !P.look.ended))) return '<p class="pp-none">Nothing waits here now.</p>';
191
+ const gl = P && P.grillRun ? `<p class="pp-grun${P.grillRun.state === 'failed' ? ' bad' : ''}" role="status">${esc(GW.runStateLine(P.grillRun))}</p>` : '';
192
+ if (!P || (!P.n && !(P.look && !P.look.ended))) return gl ? `<div class="pp">${gl}</div>` : '<p class="pp-none">Nothing waits here now.</p>';
190
193
  const secs = (P.groups || []).map((g) => ({ id: g.group, title: GROUP[g.group] || g.group, count: g.props.length + (g.more || 0), open: true, html: g.group === 'grill' ? grillSec(g) : g.props.map(propHtml).join('') }));
191
- return `<div class="pp">${lookBlock(P.look)}${VW.czSections(secs, { key: 'props' })}</div>`;
194
+ return `<div class="pp">${gl}${lookBlock(P.look)}${VW.czSections(secs, { key: 'props' })}</div>`;
192
195
  }
193
196
  function presses(P) { return P && P.sure ? [{ act: 'all', label: 'Keep all ' + P.sure + ' PMOS is sure of', icon: I.check, solid: true }] : []; }
194
197
  function draw() {
@@ -201,7 +204,7 @@ function draw() {
201
204
  const t = 'PMOS proposes' + (S.props && S.props.n ? ' ' + S.props.n : '');
202
205
  if (VW.retitle && cur.title !== t) VW.retitle(cur.id, t);
203
206
  clearTimeout(S.timer);
204
- if (S.props && S.props.look && !S.props.look.ended) S.timer = setTimeout(fresh, 4000);
207
+ if (S.props && ((S.props.look && !S.props.look.ended) || (S.props.grillRun && S.props.grillRun.state === 'running'))) S.timer = setTimeout(fresh, 4000);
205
208
  else if (LC.workingOf(S.props)) S.timer = setTimeout(fresh, 2000); // a live round's versions land one by one
206
209
  }
207
210
  async function fresh() {
@@ -223,7 +226,7 @@ async function keep(ids, all) {
223
226
  if (S.id === id) await fresh();
224
227
  if (H.reload) await H.reload();
225
228
  });
226
- if (!S.props || (!S.props.n && !(S.props.look && !S.props.look.ended))) window.czViewer.back();
229
+ if (!S.props || (!S.props.n && !(S.props.look && !S.props.look.ended) && !S.props.grillRun)) window.czViewer.back();
227
230
  }
228
231
  async function drop(sig, why) {
229
232
  const res = await write(S.H, '/api/proposals/drop', { initiative: S.id, sig, ...(why ? { why } : {}) });
@@ -1385,3 +1385,6 @@ button.ia-xr:hover { background: var(--cz-well); }
1385
1385
  .ik-tl .ab.done { fill: var(--cz-ink3); }
1386
1386
  /* round 3 item 11b: the task a Today row opened */
1387
1387
  .iv-tr.lit { background: var(--cz-bluebg); box-shadow: inset 3px 0 0 var(--cz-blue); }
1388
+ /* a grill run the PM was told about (lib/grill.js runStateOf): one line while it runs, the reason when it failed */
1389
+ .pp-grun { margin: 0 0 var(--space-8); font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-blueink); }
1390
+ .pp-grun.bad { color: var(--cz-red); }