create-pmos 0.802.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 +21 -6
- 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 +20 -5
- package/workspace/guide/claude-proposes.md +2 -0
- package/workspace/lib/grill-api.js +7 -3
- package/workspace/lib/grill-runs.js +37 -19
- package/workspace/lib/grill.js +27 -3
- package/workspace/lib/proposals.js +7 -4
- package/workspace/lib/routes-board-premium.js +1 -1
- package/workspace/lib/routes-boards.js +54 -6
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/routes-proposals.js +5 -6
- package/workspace/lib/routes-task-plans.js +4 -1
- package/workspace/lib/task-cli.js +9 -7
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/batch-press.js +6 -3
- package/workspace/public/pm/bd-pop-ds.css +3 -0
- package/workspace/public/pm/bd-pop-ds.js +8 -4
- package/workspace/public/pm/grill-words.js +9 -0
- package/workspace/public/pm/ini-props.js +10 -7
- package/workspace/public/pm/ini-view.css +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "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,15 +34,30 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T02:
|
|
37
|
+
"v": "0.804.0",
|
|
38
|
+
"at": "2026-11-25T02:16:07.854Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
42
|
-
"n":
|
|
43
|
-
"t": "
|
|
44
|
-
"s": "
|
|
42
|
+
"n": 1828,
|
|
43
|
+
"t": "Every new task gets a stage; tasks with none are placed on the next read",
|
|
44
|
+
"s": "Every new task gets a stage; tasks with none are placed on the next read",
|
|
45
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
|
+
}
|
|
46
61
|
}
|
|
47
62
|
]
|
|
48
63
|
},
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-25T02:
|
|
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:
|
|
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:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T02:16:04Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T02:
|
|
3
|
+
"v": "0.804.0",
|
|
4
|
+
"at": "2026-11-25T02:16:07.854Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
8
|
-
"n":
|
|
9
|
-
"t": "
|
|
10
|
-
"s": "
|
|
8
|
+
"n": 1828,
|
|
9
|
+
"t": "Every new task gets a stage; tasks with none are placed on the next read",
|
|
10
|
+
"s": "Every new task gets a stage; tasks with none are placed on the next read",
|
|
11
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
|
+
}
|
|
12
27
|
}
|
|
13
28
|
]
|
|
14
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) =>
|
|
126
|
-
|
|
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
|
-
|
|
130
|
-
|
|
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
|
|
package/workspace/lib/grill.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -744,6 +744,42 @@ function rowsOfBoard(fr, board, base) {
|
|
|
744
744
|
}
|
|
745
745
|
return rows;
|
|
746
746
|
}
|
|
747
|
+
/** The stage a task sits in, as the breakdown reads it: its last task-section line, else the stage whose To finish entry made it. '' or null = none. */
|
|
748
|
+
function sectionOf(folded, t) {
|
|
749
|
+
if (!t) return null;
|
|
750
|
+
const S = folded.sections || new Map();
|
|
751
|
+
return S.has(t.id) ? S.get(t.id) : (t.from && t.from.stage) || null;
|
|
752
|
+
}
|
|
753
|
+
/** The stage a new task with no section named goes under: its parent's stage, else the initiative's stage in progress; null when the
|
|
754
|
+
* initiative has no workflow stage to name (the task then has no place, as before). */
|
|
755
|
+
function defaultSection(folded, row, parent) {
|
|
756
|
+
const st = (row && row.wfStages) || [];
|
|
757
|
+
const ok = (k) => typeof k === 'string' && k && st.some((x) => x.key === k);
|
|
758
|
+
if (parent) { const ps = sectionOf(folded, folded.tasks && folded.tasks.get(parent)); if (ok(ps)) return ps; }
|
|
759
|
+
const cur = row && row.wfStage && row.wfStage.key;
|
|
760
|
+
return ok(cur) ? cur : null;
|
|
761
|
+
}
|
|
762
|
+
const CLOSED_TASK = new Set(['Done', "Won't do", 'Archived']);
|
|
763
|
+
/** The repair of tasks with no place (data reliability, 2026-11-25): an open task of a live initiative that has NO task-section line and no
|
|
764
|
+
* To finish stage was hidden by the Work breakdown (it draws tasks by stage; the ones in no stage only count in a footer). Each such task
|
|
765
|
+
* is placed under its parent's stage, else the stage in progress, once: the line it writes makes it placed, so the next read finds nothing.
|
|
766
|
+
* A task the PM put in "Not in a stage" has a line ('') and is never touched. `pmos task set <task> --stage none` takes one back out.
|
|
767
|
+
* → the number placed. */
|
|
768
|
+
function placeLoose(file, folded, board, row) {
|
|
769
|
+
if (!file || !row || board.self || row.ended || row.archived || !row.wfStage) return 0;
|
|
770
|
+
const S = folded.sections || new Map();
|
|
771
|
+
let n = 0;
|
|
772
|
+
for (const t of tasksOfIni(folded, row.id)) {
|
|
773
|
+
if (!t || t.kind === 'Epic' || CLOSED_TASK.has(t.state) || S.has(t.id) || (t.from && t.from.stage)) continue;
|
|
774
|
+
const parent = folded.parents ? folded.parents.get(t.id) : null;
|
|
775
|
+
const sec = defaultSection(folded, row, parent || null);
|
|
776
|
+
if (!sec) continue;
|
|
777
|
+
append(file, { by: 'agent:repair' }, { kind: 'task-section', board: board.id, task: t.id, section: sec, repair: true,
|
|
778
|
+
why: 'placed under ' + sec + ': it had no stage, so Work did not show it' });
|
|
779
|
+
n++;
|
|
780
|
+
}
|
|
781
|
+
return n;
|
|
782
|
+
}
|
|
747
783
|
/** A stage's To finish entries are tasks of the initiative (feedback batch 5: "Also there is workflow tasks, confusing"). Each entry of the
|
|
748
784
|
* current stage becomes one Board task, once: its `from` marker names the stage and the entry, so a move back and forth makes no second
|
|
749
785
|
* one. It runs on a move, a switch and the first read that finds none, so closing one (on the stage card, in the Tasks section or with
|
|
@@ -780,6 +816,9 @@ function seedRows(ctx, w, fr, board, rows) {
|
|
|
780
816
|
let n = 0;
|
|
781
817
|
for (const r of rows) if (r.wf && r.wf.id !== 'product-feature') n += stageTasks(file, fr.folded, board, r, stagedBy(fr.folded, board.id, r.id));
|
|
782
818
|
if (n) fr.folded = foldOf(ctx, w);
|
|
819
|
+
let m = 0;
|
|
820
|
+
for (const r of rows) m += placeLoose(file, fr.folded, board, r);
|
|
821
|
+
if (m) fr.folded = foldOf(ctx, w);
|
|
783
822
|
return n;
|
|
784
823
|
}
|
|
785
824
|
|
|
@@ -1580,21 +1619,26 @@ const WRITES = {
|
|
|
1580
1619
|
const b0 = base.find((r) => r.id === body.initiative);
|
|
1581
1620
|
if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.initiative} on this board`);
|
|
1582
1621
|
// the + on a stage of the Tasks list (batch 18 item 16): the task goes under that stage
|
|
1622
|
+
const row0 = boardRow(p.board, b0, p.fr.folded);
|
|
1583
1623
|
if (body.section != null) {
|
|
1584
1624
|
if (typeof body.section !== 'string' || body.section.length > 80) return fail(ctx, res, 400, "section is a stage key of the initiative's workflow, or '' for Not in a stage");
|
|
1585
|
-
const st =
|
|
1625
|
+
const st = row0.wfStages || [];
|
|
1586
1626
|
if (body.section && !st.some((x) => x.key === body.section)) return fail(ctx, res, 400, `"${body.section}" is not a stage of this initiative's workflow: one of ${st.map((x) => x.key).join(', ')}, or ''`);
|
|
1587
1627
|
}
|
|
1588
1628
|
const id = `task-${crypto.randomBytes(5).toString('hex')}`;
|
|
1589
1629
|
// "under Batch 2: …" in the add box (initiative work-subtasks): the new task is a subtask from its first line
|
|
1590
1630
|
if (body.parent != null && body.parent !== '') { const pe = parentError(p, id, body.parent, body.initiative); if (pe) return fail(ctx, res, 400, pe); }
|
|
1631
|
+
// every new task gets a place (data reliability, 2026-11-25): a caller that names no section (the chat, \`pmos task add\`, a kept ✦,
|
|
1632
|
+
// an outcome's next step) used to write no task-section line, so the Work breakdown had no stage to draw the task under and hid it.
|
|
1633
|
+
// No section named: the parent's stage for a subtask, else the stage in progress. '' stays the PM's own "Not in a stage".
|
|
1634
|
+
const sec = typeof body.section === 'string' ? body.section : defaultSection(p.fr.folded, row0, body.parent || null);
|
|
1591
1635
|
// a milestone has one date, the due day, and no start (the ◇ of the Viewer's add field, batch 25 item 5)
|
|
1592
1636
|
const ms = body.milestone === true;
|
|
1593
1637
|
const start = ms ? '' : body.start || (body.due && body.due < B.shiftDay(today(), 1) ? body.due : B.shiftDay(today(), 1));
|
|
1594
1638
|
const due = body.due || (ms ? body.start || B.shiftDay(today(), 8) : B.shiftDay(start, 7));
|
|
1595
1639
|
append(p.file, g.actor, { kind: 'task', board: p.board.id, task: id, type: body.type || 'Task', initiative: body.initiative, title: body.title.trim(), epic: body.epic ? String(body.epic).trim() : null,
|
|
1596
1640
|
owner: body.owner ? String(body.owner).trim() : actorLib.pageName(g.actor.by), state: 'To do', start, due, ...(body.notes && body.notes.trim() ? { notes: body.notes.replace(/\s+$/, '') } : {}), ...(body.parent ? { parent: body.parent } : {}) });
|
|
1597
|
-
if (typeof
|
|
1641
|
+
if (typeof sec === 'string') append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: id, section: sec, why: sec ? 'placed under ' + sec + (typeof body.section === 'string' ? '' : ', the ' + (body.parent ? "parent's stage" : 'stage in progress')) : 'placed under no stage' });
|
|
1598
1642
|
if (ms) append(p.file, g.actor, { kind: 'task-milestone', board: p.board.id, task: id, milestone: true, why: 'added as a milestone' });
|
|
1599
1643
|
const t = B.taskOf(B.fold(readLedger(ctx, p.w)), id);
|
|
1600
1644
|
ctx.json(res, { ok: true, item: B.rollupItems([B.taskItem(t)])[0] });
|
|
@@ -2313,9 +2357,13 @@ function initiativeWorkflow(ctx, w, id) {
|
|
|
2313
2357
|
/** stageTasks for one initiative outside HTTP (`pmos task list|state`): its current stage's To finish entries made tasks once. → the number made, or 0. */
|
|
2314
2358
|
function seedInitiative(ctx, w, id) {
|
|
2315
2359
|
const r = initiativeWorkflow(ctx, w, id);
|
|
2316
|
-
if (!r.ok || !r.row.wf
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2360
|
+
if (!r.ok || !r.row.wf) return 0;
|
|
2361
|
+
const file = ledgerFile(ctx, w);
|
|
2362
|
+
let folded = foldOf(ctx, w);
|
|
2363
|
+
const n = r.row.wf.id === 'product-feature' ? 0 : stageTasks(file, folded, r.board, r.row, stagedBy(folded, r.board.id, id));
|
|
2364
|
+
if (n) folded = foldOf(ctx, w);
|
|
2365
|
+
placeLoose(file, folded, r.board, r.row); // a task with no place is placed before it is listed (data reliability, 2026-11-25)
|
|
2366
|
+
return n;
|
|
2319
2367
|
}
|
|
2320
2368
|
|
|
2321
2369
|
/** The board of each initiative of a workspace, for other routes (Reports): { boards: [{ id, title }], of(id) → board id }.
|
|
@@ -2382,4 +2430,4 @@ function meetingBoards(ctx) {
|
|
|
2382
2430
|
return { list, detail };
|
|
2383
2431
|
}
|
|
2384
2432
|
|
|
2385
|
-
module.exports = { prefixes: ['/api/boards'], handle, jiraFacts, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, taskComment, describeDraft, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, kindSwitch, kindFollowsWorkflow, recordKind, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
2433
|
+
module.exports = { prefixes: ['/api/boards'], handle, jiraFacts, tasksOfIni, defaultSection, placeLoose, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, taskComment, describeDraft, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, kindSwitch, kindFollowsWorkflow, recordKind, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
@@ -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
|
|
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 */
|
|
@@ -331,14 +332,12 @@ function applyOne(ctx, p, g, f, ini, x, choices, outbox) {
|
|
|
331
332
|
for (const it of items) {
|
|
332
333
|
if (it.jira) { epics.push(it.jira.toUpperCase()); continue; }
|
|
333
334
|
const title = (it.wbs && !String(it.title).startsWith(it.wbs) ? it.wbs + ' ' : '') + it.title;
|
|
335
|
+
// the stage the source names goes with the add; none named: the add places it under the stage in progress (routes-boards defaultSection)
|
|
336
|
+
const st = it.stage ? stagesOf(ctx, p, ini).find((s) => s.key === it.stage || s.name.toLowerCase() === String(it.stage).toLowerCase()) : null;
|
|
334
337
|
const r = RB.taskAdd(ctx, { ws: p.w.id, board: p.board.id, initiative: ini, title: title.slice(0, 200), ...(it.start ? { start: it.start } : {}), ...(it.due ? { due: it.due } : {}), ...(it.owner ? { owner: it.owner } : {}),
|
|
335
|
-
notes: ['From ' + (it.source || source || 'your sources') + (it.ref ? ': ' + it.ref : ''), it.notes || ''].filter(Boolean).join('\n').slice(0, 1900) }, g);
|
|
338
|
+
...(st ? { section: st.key } : {}), notes: ['From ' + (it.source || source || 'your sources') + (it.ref ? ': ' + it.ref : ''), it.notes || ''].filter(Boolean).join('\n').slice(0, 1900) }, g);
|
|
336
339
|
if (!W.ok(r)) continue;
|
|
337
340
|
const uid = r.body.item && (r.body.item.uid || r.body.item.id);
|
|
338
|
-
if (uid && it.stage) {
|
|
339
|
-
const st = stagesOf(ctx, p, ini).find((s) => s.key === it.stage || s.name.toLowerCase() === String(it.stage).toLowerCase());
|
|
340
|
-
if (st) RB.taskEdit(ctx, { ws: p.w.id, board: p.board.id, task: uid, section: st.key }, g);
|
|
341
|
-
}
|
|
342
341
|
add({ op: 'add', task: uid, title, to: { start: it.start || '', due: it.due || '' } });
|
|
343
342
|
}
|
|
344
343
|
if (epics.length) {
|
|
@@ -89,11 +89,14 @@ function nameFor(F, ini, fromLive) {
|
|
|
89
89
|
function applyLive(ctx, p, row, d, g) {
|
|
90
90
|
const live = liveOf(p, row), S = TP.stepsOf(d, live), undo = { added: [], changed: [], dropped: [], unchosen: [] };
|
|
91
91
|
const file = p.file, by = g.actor;
|
|
92
|
+
let dk; // the stage in progress, read once: where a new task with no stage named goes
|
|
93
|
+
const dflt = () => { if (dk === undefined) { try { dk = RB.defaultSection(p.fr.folded, RB.boardRow(p.board, row, p.fr.folded), null); } catch { dk = null; } } return dk; };
|
|
92
94
|
for (const x of S.add) {
|
|
93
95
|
const id = `task-${require('crypto').randomBytes(5).toString('hex')}`;
|
|
94
96
|
RB.append(file, by, { kind: 'task', board: p.board.id, task: id, type: 'Task', initiative: row.id, title: x.title || 'Task', epic: null, owner: x.owner || actorLib.pageName(by.by),
|
|
95
97
|
state: 'To do', start: x.start || null, due: x.due || null, ...(x.milestone ? { milestone: true } : {}), why: 'made live from ' + d.name });
|
|
96
|
-
|
|
98
|
+
// no stage named: the stage in progress, so the task shows in the Work breakdown (data reliability, 2026-11-25)
|
|
99
|
+
const sec = x.section || (x.from && x.from.stage) || dflt() || '';
|
|
97
100
|
if (sec) RB.append(file, by, { kind: 'task-section', board: p.board.id, task: id, section: sec, why: 'placed under ' + sec });
|
|
98
101
|
undo.added.push(id);
|
|
99
102
|
}
|
|
@@ -39,6 +39,7 @@ const USAGE = [
|
|
|
39
39
|
'usage: pmos task add|list|state|set|remove — an initiative\'s tasks, the ones the PM sees in its Tasks section',
|
|
40
40
|
' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>] [--parent <task>]',
|
|
41
41
|
' Add a task. Every new task goes here; pmos item add is the older breakdown record. --parent adds it as a subtask of that task.',
|
|
42
|
+
' With no --stage it goes under the parent\'s stage, else the stage in progress, so Work shows it. --stage none keeps it in no stage.',
|
|
42
43
|
' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
|
|
43
44
|
' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]',
|
|
44
45
|
' --parent puts the task under another task of the same initiative as a subtask; none takes it back to the top level. Set it only when the PM asks.',
|
|
@@ -180,17 +181,18 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
180
181
|
const body = { ws: w.id, board: r.board.id, initiative: id, title };
|
|
181
182
|
for (const k of ['due', 'start', 'owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
|
|
182
183
|
if (flags.parent !== undefined && String(flags.parent).toLowerCase() !== 'none') body.parent = String(flags.parent); // a subtask (initiative chat-subtasks)
|
|
184
|
+
// the place goes with the add, in one write: no --stage places it under the parent's stage or the stage in progress (routes-boards
|
|
185
|
+
// defaultSection), so a task the chat adds always shows in the Work breakdown; --stage none keeps it in no stage
|
|
186
|
+
if (sec != null) body.section = sec;
|
|
183
187
|
const a = boards.taskAdd(ctx, body, g);
|
|
184
188
|
if (!a.body || a.body.ok !== true) return fail((a.body && a.body.error) || 'the write was refused');
|
|
185
189
|
const t = a.body.item;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (!e.body || e.body.ok !== true) return fail(`added ${t.uid}, but it was not placed under ${sec}: ${(e.body && e.body.error) || 'the write was refused'}`);
|
|
189
|
-
}
|
|
190
|
+
let placedAt = sec;
|
|
191
|
+
if (placedAt == null) { try { placedAt = (boards.foldOf(ctx, w).sections || new Map()).get(t.uid) || null; } catch { placedAt = null; } }
|
|
190
192
|
if (body.parent) console.error('[task-parent]', 'add', 1);
|
|
191
|
-
LIVE.emit(stateDir, { id: t.uid, field: 'added', value: { initiative: id, title: t.title, status: t.status, owner: t.owner || '', start: t.start || '', end: t.end || '', ...(
|
|
192
|
-
if (json) say(JSON.stringify({ ok: true, task: { id: t.uid, board: t.board, title: t.title, state: t.status, owner: t.owner, start: t.start, due: t.end, ...(
|
|
193
|
-
else say(`✓ added ${t.uid} · ${t.status} · ${t.title}${body.parent ? ' · a subtask of ' + body.parent : ''}${
|
|
193
|
+
LIVE.emit(stateDir, { id: t.uid, field: 'added', value: { initiative: id, title: t.title, status: t.status, owner: t.owner || '', start: t.start || '', end: t.end || '', ...(placedAt ? { section: placedAt } : {}), ...(body.parent ? { parent: body.parent } : {}) } });
|
|
194
|
+
if (json) say(JSON.stringify({ ok: true, task: { id: t.uid, board: t.board, title: t.title, state: t.status, owner: t.owner, start: t.start, due: t.end, ...(placedAt ? { stage: placedAt } : {}), ...(body.parent ? { parent: body.parent } : {}) } }));
|
|
195
|
+
else say(`✓ added ${t.uid} · ${t.status} · ${t.title}${body.parent ? ' · a subtask of ' + body.parent : ''}${placedAt ? ' · under ' + placedAt : ''}${t.end ? ' · due ' + t.end : ''}. The initiative's Tasks section shows it. Nothing was sent.`);
|
|
194
196
|
return 0;
|
|
195
197
|
}
|
|
196
198
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "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.
|
|
9
|
+
"version": "0.804.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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
|
-
|
|
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
|
-
|
|
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
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
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); }
|