create-pmos 0.751.0 → 0.752.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 +32 -33
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/changelog.json +31 -0
- package/workspace/guide/cli.md +11 -0
- package/workspace/guide/home.md +3 -1
- package/workspace/guide/settings-and-switches.md +2 -2
- package/workspace/lib/autonomy.js +2 -1
- package/workspace/lib/driver-decide.js +8 -0
- package/workspace/lib/driver-needs.js +3 -20
- package/workspace/lib/driver-run.js +16 -1
- package/workspace/lib/driver.js +23 -11
- package/workspace/lib/line-cli.js +99 -0
- package/workspace/lib/line.js +231 -0
- package/workspace/lib/never-wait.js +144 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/routes-today-log.js +6 -3
- package/workspace/lib/today-log.js +21 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today-app.js +17 -2
- package/workspace/public/pm/cozy-today-model.js +21 -3
- package/workspace/public/pm/cozy-today-view.js +4 -2
- package/workspace/public/pm/quiet-batch.js +111 -0
- package/workspace/public/pm/quiet-rows.js +130 -0
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +38 -8
- package/workspace/test-lists/line.json +9 -0
- package/workspace/test-lists/never-wait-on-drafts.json +9 -0
- package/workspace/test-lists/quiet-rows.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.752.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,37 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.752.0",
|
|
38
|
+
"at": "2026-11-24T00:12:53.761Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1694,
|
|
43
|
+
"t": "Settings › Workflows names the workspace it shows, with a picker",
|
|
44
|
+
"s": "Settings › Workflows names the workspace it shows, with a picker",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"n": 1700,
|
|
49
|
+
"t": "Quiet rows, at most 3 line rows a day per product and one batch (quiet-rows, slice A)",
|
|
50
|
+
"s": "Quiet rows, at most 3 line rows a day per product and one batch (quiet-rows, slice A)",
|
|
51
|
+
"k": "new"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"n": 1698,
|
|
55
|
+
"t": "Pmos line, where each initiative stands on its own workflow",
|
|
56
|
+
"s": "Pmos line, where each initiative stands on its own workflow",
|
|
57
|
+
"k": "new"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"n": 1701,
|
|
61
|
+
"t": "PMOS never waits on its own drafts",
|
|
62
|
+
"s": "PMOS never waits on its own drafts",
|
|
63
|
+
"k": "new"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
36
67
|
{
|
|
37
68
|
"v": "0.751.0",
|
|
38
69
|
"at": "2026-11-23T23:33:04.160Z",
|
|
@@ -597,38 +628,6 @@
|
|
|
597
628
|
}
|
|
598
629
|
}
|
|
599
630
|
]
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
"v": "0.728.0",
|
|
603
|
-
"at": "2026-11-23T05:05:21.945Z",
|
|
604
|
-
"f": 4,
|
|
605
|
-
"prs": [
|
|
606
|
-
{
|
|
607
|
-
"n": 1620,
|
|
608
|
-
"t": "Pmos questions, every open question in one list with owner, age and default (A420)",
|
|
609
|
-
"s": "Pmos questions, every open question in one list with owner, age and default (A420)",
|
|
610
|
-
"k": "new",
|
|
611
|
-
"try": {
|
|
612
|
-
"steps": [
|
|
613
|
-
"In a chat, ask: what questions are open?"
|
|
614
|
-
],
|
|
615
|
-
"see": "One list with who can answer, how long it waited, and the default."
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
"n": 1603,
|
|
620
|
-
"t": "Refresh Jira by tier, reading only what changed",
|
|
621
|
-
"s": "Refresh Jira by tier, reading only what changed",
|
|
622
|
-
"k": "new",
|
|
623
|
-
"try": {
|
|
624
|
-
"steps": [
|
|
625
|
-
"Refresh Work."
|
|
626
|
-
],
|
|
627
|
-
"see": "It finishes sooner and nothing is missing from the sprint.",
|
|
628
|
-
"open": "/premium-board.html"
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
]
|
|
632
631
|
}
|
|
633
632
|
]
|
|
634
633
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-11-
|
|
1
|
+
kernel-source: pmos@9d5ad11f
|
|
2
|
+
assembled: 2026-11-24
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T00:12:50Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T00:12:50Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T00:12:50Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.752.0",
|
|
4
|
+
"at": "2026-11-24T00:12:53.761Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1694,
|
|
9
|
+
"t": "Settings › Workflows names the workspace it shows, with a picker",
|
|
10
|
+
"s": "Settings › Workflows names the workspace it shows, with a picker",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1700,
|
|
15
|
+
"t": "Quiet rows, at most 3 line rows a day per product and one batch (quiet-rows, slice A)",
|
|
16
|
+
"s": "Quiet rows, at most 3 line rows a day per product and one batch (quiet-rows, slice A)",
|
|
17
|
+
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1698,
|
|
21
|
+
"t": "Pmos line, where each initiative stands on its own workflow",
|
|
22
|
+
"s": "Pmos line, where each initiative stands on its own workflow",
|
|
23
|
+
"k": "new"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"n": 1701,
|
|
27
|
+
"t": "PMOS never waits on its own drafts",
|
|
28
|
+
"s": "PMOS never waits on its own drafts",
|
|
29
|
+
"k": "new"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
2
33
|
{
|
|
3
34
|
"v": "0.751.0",
|
|
4
35
|
"at": "2026-11-23T23:33:04.160Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -333,6 +333,17 @@ Anyone can run it, not only the PM: an engineer or a stakeholder who wants to kn
|
|
|
333
333
|
- Each line comes from the initiative's own record or its PRD: the goal from Goal, the problem from Intent or the PRD's Problem, the evidence from an Evidence section or the first problem sentence that names a number or a link. A line the records do not hold says "not written". PMOS does not guess it.
|
|
334
334
|
- `pmos why coverage` says how many active initiatives have all three lines and which lines the others miss. Its last line is the percent, so a script can read it.
|
|
335
335
|
|
|
336
|
+
### pmos line: where each initiative stands, and what moves it next
|
|
337
|
+
|
|
338
|
+
Run it in the product's repository, or pass `--root <dir>`. It reads the records on disk, needs no running workspace and changes nothing: it writes no file, moves nothing and sends nothing.
|
|
339
|
+
|
|
340
|
+
- `pmos line` lists every live initiative by station. The station is the current stage of the initiative's own workflow, the one `pmos workflow of` shows. Each line gives the days on that station, the exit items still missing, the next move, and a flag: stuck, moving, waiting or can't tell. Ended initiatives (Won't do, archived, cancelled, shipped, or in a Closed stage) are counted at the top and are not on the line.
|
|
341
|
+
- The exit items are the stage's To finish lines. A line is missing until its task is Done or Won't do. A stage with no To finish list has one exit item, its output (for example the PRD); a stage whose output is Jira work lists the open tickets.
|
|
342
|
+
- Days there count from the Board move, the workflow change or your word that put it on the station. With no such record, the clock is the days since the last dated activity, shown as "quiet".
|
|
343
|
+
- Stuck means past the station's limit with no activity inside it. The default limits are Triage 3 days, Discovery 15, Plan 5, Implementation 3 working days with no ticket change (or the planned end passed), Deliver 3, Evaluation 7; Closed is never stuck. Waiting for capacity is never stuck. A Jira read older than 7 days, or no dated record at all, is can't tell.
|
|
344
|
+
- `pmos line <initiative>` shows one initiative and why it has its flag. Add `--json` for the whole answer, and `--as-of <YYYY-MM-DD>` to read a backup as it stood on that day.
|
|
345
|
+
- `pmos line count` prints the percent of live initiatives placed with a next move on its last line, so a script can read it.
|
|
346
|
+
|
|
336
347
|
### pmos outcomes: expected outcomes
|
|
337
348
|
|
|
338
349
|
Run them in the product's repository, or pass `--root <dir>`.
|
package/workspace/guide/home.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Home: your list, the chat, the Viewer, My work, documents and people"
|
|
4
4
|
description: "Home's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-24
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Home
|
|
@@ -47,6 +47,8 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
|
|
|
47
47
|
## Your move
|
|
48
48
|
|
|
49
49
|
- **At most 5 show.** The rest are under **Can wait**, in the same order. Nothing is dropped.
|
|
50
|
+
- **At most 3 rows a day for each product.** A row from a product's own records counts toward the 3: an open question, a check, a grill finding, a date change from a meeting, a key result, or a change PMOS proposes on an initiative. A reply someone waits for, your own task and a draft never count. The rows are fixed the first time Today shows them that day. When you finish a row, nothing takes its place until tomorrow. A new row that holds up a ship date takes the place of that product's lowest row and never makes a fourth. Rows over the 3 wait under **Later** with "Waits for tomorrow". A product with nothing for you has no row.
|
|
51
|
+
- **Today's batch.** Everything other people will see (a review request, Jira tickets, a follow-up, a closed ask) is one row: "Today's batch: 5 to send". Press it to open the batch full size. **Back** returns to Today. The drafts are in groups by kind, and each one says who will see it. ✎ **Change it first** opens the draft, ✕ **Skip** drops it (with Undo), and ✓ **Approve** sends it. When more than one draft waits, PMOS suggests **Approve and send all**. Nothing is sent until you press. If no channel is connected yet, the draft stays in the batch and says so. A draft you leave for 7 days lapses and is not sent. On a phone the batch shows one draft at a time, full text first: swipe right to approve, left to skip.
|
|
50
52
|
- **One press per initiative.** An initiative's proposals are one row, for example "Checkout: 6 changes to keep" with "3 dates, 2 names, 1 link" under it. Press it to see them grouped as Dates, Names, Done and Links. ✓ keeps all of them, with one Undo for the batch. ✕ drops them, then offers three reasons and **Say why**. A proposal that needs your own check keeps its own ✓ and ✕. **See every change** opens the full list on the initiative.
|
|
51
53
|
- **An ask expires after 14 days with no answer.** PMOS leaves it as it was and writes why in the initiative's History. Your move says it once: "2 asks expired after 14 days with no answer." Dates computed from your tasks never expire: PMOS reads them again each time.
|
|
52
54
|
- **Done** lists what PMOS finished by itself in the last 14 days, one line each with Undo.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Settings, switches and data freshness"
|
|
4
4
|
description: "What each section of Settings holds, every PMOS_ environment variable, and how the workspace keeps each source up to date."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-24
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Settings, switches and data freshness
|
|
@@ -17,7 +17,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
17
17
|
| Prototype rules | What every prototype version is checked for before you see it. |
|
|
18
18
|
| Connectors | Every connector your Claude session has, and a directory of services you can connect. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
19
19
|
| Your account | The Claude login and profile that new sessions start with, the Anthropic API key for PMOS's own runs, and Sharpen prompts. |
|
|
20
|
-
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. See [Workflows](statuses.md). |
|
|
20
|
+
| Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. Each workspace keeps its own workflows: when PMOS works in more than one, the **Workspace** picker over the list says whose workflows show, and PMOS remembers your pick. See [Workflows](statuses.md). |
|
|
21
21
|
| Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
|
|
22
22
|
|
|
23
23
|
## Update PMOS and the kit
|
|
@@ -105,7 +105,8 @@ const KIND_LIST = Object.freeze([
|
|
|
105
105
|
k('found', 'What PMOS found elsewhere', ['propose:found', 'propose:scanned', 'propose:improved', 'propose:prototyped']),
|
|
106
106
|
k('grill', 'Fixes from a check', ['propose:grill']),
|
|
107
107
|
// default-decisions-with-a-deadline: the day's questions nobody answered by their deadline (lib/default-decisions.js)
|
|
108
|
-
|
|
108
|
+
// never-wait-on-drafts: a Driver draft nobody answered in 2 days, and a message or stage move that lapsed unsent after 7 (lib/never-wait.js)
|
|
109
|
+
k('defaults', 'Defaults when nobody answers', ['propose:default', 'driver:default', 'driver:lapse']),
|
|
109
110
|
]);
|
|
110
111
|
const KIND_OF_JOB = new Map(KIND_LIST.flatMap((x) => x.jobs.map((j) => [j, x.key])));
|
|
111
112
|
const kindOf = (job) => KIND_OF_JOB.get(String(job || '')) || null;
|
|
@@ -186,6 +186,14 @@ async function undo({ file, proposal, actor, ctx = {}, now, stateDir, product =
|
|
|
186
186
|
const t = now == null ? Date.now() : now;
|
|
187
187
|
const p = D.fold(D.readLines(file)).proposals.get(proposal);
|
|
188
188
|
if (!p) return refuse(404, `no driver proposal ${String(proposal).slice(0, 40)}`);
|
|
189
|
+
// never-wait-on-drafts: Undo of a default PMOS took, or of a lapse, opens the draft again (lib/never-wait.js); nothing was written
|
|
190
|
+
if (p.state === 'defaulted' || p.state === 'lapsed') {
|
|
191
|
+
if (p.decided_at && t - Date.parse(p.decided_at) > require('./autonomy.js').UNDO_DAYS * D.DAY) return refuse(409, 'Undo is open for 14 days after a change; this one is older');
|
|
192
|
+
D.append(file, { ev: 'undo', proposal: p.id, back: true, by: actor.by }, { now: t });
|
|
193
|
+
const NW = require('./never-wait.js');
|
|
194
|
+
const s = p.state === 'defaulted' && stateDir ? require('./autonomy.js').recordSetback(stateDir, { job: NW.DEFAULT_JOB, product, ref: p.id, kind: 'undo' }, { now: t }) : { demoted: null };
|
|
195
|
+
return { ok: true, back: true, reopened: true, demoted: s.demoted || null };
|
|
196
|
+
}
|
|
189
197
|
if (p.state !== 'kept') return refuse(409, `the proposal is ${p.state}, so there is nothing to undo`);
|
|
190
198
|
if (p.decided_at && t - Date.parse(p.decided_at) > require('./autonomy.js').UNDO_DAYS * D.DAY) return refuse(409, 'Undo is open for 14 days after a change; this one is older');
|
|
191
199
|
if (!UNDOABLE.has(p.what)) return refuse(409, `a kept ${p.what} has no Undo`);
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* rowsFor(w, { lead }) → rows · sig(w) → string · titlesOf(w) · rowsOf(state, { titleOf, now, ledgerRel })
|
|
7
7
|
*
|
|
8
8
|
* driver-drafts one row per initiative or Work task with open proposals: "Agent has 3 drafts on <title>".
|
|
9
|
-
* driver-blocked
|
|
10
|
-
*
|
|
9
|
+
* driver-blocked no longer raised (never-wait-on-drafts): an open draft holds no run, so nothing waits on the PM. The kind stays
|
|
10
|
+
* listed so readers of older rows still know it.
|
|
11
11
|
*
|
|
12
12
|
* SHADOW MODE raises no row (PRD section 5): the board mode, taken from the board of the target's latest run, decides. The
|
|
13
13
|
* rows are repository-wide, so a tree that is not the lead returns []. A row never carries a session token.
|
|
@@ -83,24 +83,7 @@ function rowsOf(state, { titleOf = () => null, now = Date.now(), ledgerRel = 'pm
|
|
|
83
83
|
today: { kind: 7, source: NAME, cause: `The agent filed ${plural(g.list.length, 'draft', 'drafts')} for ${KIND_WORD[g.target.kind]}: ${whats}`, evidence: ledgerRel, act: { label: 'Review', cli: null } },
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
const seen = new Set();
|
|
88
|
-
for (const b of state.blockers) {
|
|
89
|
-
if (b.owner !== 'pm' || b.day !== today || !b.target) continue;
|
|
90
|
-
const k = D.targetKey(b.target);
|
|
91
|
-
if (seen.has(k) || !open.has(k) || shadow(b.target)) continue;
|
|
92
|
-
const g = open.get(k);
|
|
93
|
-
const oldest = g.list.map((p) => Date.parse(p.at)).filter(Number.isFinite).sort((a, c) => a - c)[0];
|
|
94
|
-
if (!(now - oldest >= D.PM_WAIT_MS)) continue;
|
|
95
|
-
seen.add(k);
|
|
96
|
-
const days = Math.max(1, Math.floor((now - oldest) / D.DAY));
|
|
97
|
-
const title = titleOf(g.target) || g.target.id;
|
|
98
|
-
rows.push({
|
|
99
|
-
run_id: `${NAME}:blocked:${k}`, kind: 'driver-blocked', initiative_id: g.target.kind === 'initiative' ? g.target.id : null, rank: rankFacts(state, g, now),
|
|
100
|
-
question: `${title} is waiting on you: the drafts are ${plural(days, 'day', 'days')} old`, doc: null,
|
|
101
|
-
today: { kind: 7, source: NAME, cause: 'The agent starts no new run on this until you keep, send back or drop its drafts', evidence: ledgerRel, act: { label: 'Review', cli: null } },
|
|
102
|
-
});
|
|
103
|
-
}
|
|
86
|
+
// never-wait-on-drafts: an open draft no longer holds its target, so there is no "waiting on you, the agent starts no new run" row
|
|
104
87
|
return rows;
|
|
105
88
|
}
|
|
106
89
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* 2. closes runs that were alive when the server stopped (`run-end`, reason "interrupted"): they still count against the day;
|
|
9
9
|
* 3. finds the wakes: a `created` placement line (the page, Triage accept and `pmos initiative new` all write one), a board
|
|
10
10
|
* `move` line (one the PM pressed on the page, `pressed: true`, wakes none: bet 1f), a proposal the PM sent back with a note. Each key wakes once (the ledger's `wake` line makes it idempotent);
|
|
11
|
-
* 4. every 30 minutes inside the day-check window, and outside quiet hours, runs the unblock sweep (no model, lib/driver.js)
|
|
11
|
+
* 4. every 30 minutes inside the day-check window, and outside quiet hours, runs the unblock sweep (no model, lib/driver.js), then
|
|
12
|
+
* lib/never-wait.js on the open drafts: apply, default after 2 days or lapse after 7 (never-wait-on-drafts);
|
|
12
13
|
* 5. starts the queued runs the rules allow (mode, pause, 3 at once) through spawnSession with origin `drive:<kind>:<id>`
|
|
13
14
|
* and the skill prompt, which lib/headless.js turns into a `claude -p` run with a fixed tool list.
|
|
14
15
|
* `PMOS_DRIVER=off` does none of it. A run ends in a `run-end` line with its reason when it fails or times out.
|
|
@@ -180,6 +181,19 @@ function create(deps) {
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
/* `sweepNow` (Refresh now, data-refresh-settings R8) runs the unblock sweep at once, inside or outside the window. */
|
|
184
|
+
/* never-wait-on-drafts: once per sweep, open drafts are applied, defaulted or lapsed by themselves (lib/never-wait.js). It runs in the
|
|
185
|
+
* background, one at a time per ledger; a failure is warned and the next sweep tries again. */
|
|
186
|
+
const waitSteps = new Map();
|
|
187
|
+
function neverWait(w, file, dir, now, env) {
|
|
188
|
+
if (waitSteps.has(file)) return;
|
|
189
|
+
const rt = deps.runtimeDir || null;
|
|
190
|
+
const ctx = { stageFile: path.join(dir, require('./stage-tools.js').LEDGER), itemsDir: rt ? path.join(rt, 'pm-items') : null, root: w.root,
|
|
191
|
+
correctionsFile: rt ? path.join(rt, 'corrections.jsonl') : null };
|
|
192
|
+
const job = require('./never-wait.js').step({ file, stateDir: dir, product: w.id, ctx, now, env: env || process.env, settingsDir: rt })
|
|
193
|
+
.catch((e) => warn('driver never-wait', e)).finally(() => waitSteps.delete(file));
|
|
194
|
+
waitSteps.set(file, job);
|
|
195
|
+
}
|
|
196
|
+
|
|
183
197
|
function tick({ now = Date.now(), env, sweepNow = false } = {}) {
|
|
184
198
|
if (off(env || deps.env)) return { off: true };
|
|
185
199
|
const summary = { epoch: 0, woke: 0, swept: 0, started: 0, refused: 0 };
|
|
@@ -229,6 +243,7 @@ function create(deps) {
|
|
|
229
243
|
const sw = D.sweepLines(g.facts, state, { now, stalledDays: settings.stalledDays });
|
|
230
244
|
for (const l of sw.lines) { D.append(file, l, { now }); if (l.ev === 'wake') summary.swept++; }
|
|
231
245
|
state = readState(file);
|
|
246
|
+
neverWait(w, file, dir, now, env);
|
|
232
247
|
} else if (!g.pending) warn('driver sweep', new Error(g.error));
|
|
233
248
|
}
|
|
234
249
|
// Start what the rules allow.
|
package/workspace/lib/driver.js
CHANGED
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
* what `doc` (core-documents): data { key, slot } names a core document draft the run wrote; Keep issues it
|
|
28
28
|
* keep|return|drop { proposal, note?, by, auto?, undo? } PM or agent (D98): the fold ignores one whose `by` is neither. A keep with
|
|
29
29
|
* auto: true is one an agent applied by itself (D106); `undo` holds what its record write needs to go back
|
|
30
|
-
* undo { proposal, by, back } D106: a kept proposal is undone; `back` says whether its record write went back
|
|
30
|
+
* undo { proposal, by, back } D106: a kept proposal is undone; `back` says whether its record write went back.
|
|
31
|
+
* Of a defaulted or lapsed proposal (never-wait-on-drafts): it is open again (`reopened_at`); a defaulted one never defaults again
|
|
32
|
+
* default { proposal, why, by: 'pmos:default' } never-wait-on-drafts (lib/never-wait.js): nobody answered in 2 days, so PMOS left the
|
|
33
|
+
* record as it is. Nothing is written; the proposal is `defaulted`
|
|
34
|
+
* lapse { proposal, why, by: 'pmos:lapse' } never-wait-on-drafts: a class C proposal waited 7 days, so it is `lapsed`: not sent
|
|
31
35
|
* correction { proposal, run, kind: 'return'|'drop', by } one per return or drop; the north star counts it
|
|
32
36
|
* pause|resume { target, by } · mode { board, mode, by } PM only, as above. `board` '*' is every board.
|
|
33
37
|
* wake { key, target, board, reason: created|moved|answered|stuck, blocker? } queued: a run should start
|
|
@@ -62,7 +66,7 @@ const NEEDS_SOURCE = Object.freeze(['evidence', 'sizing', 'assumption', 'stakeho
|
|
|
62
66
|
const MODES = Object.freeze(['off', 'shadow', 'approve', 'auto']);
|
|
63
67
|
const DEFAULT_MODE = 'auto';
|
|
64
68
|
const WAKES = Object.freeze(['created', 'moved', 'answered', 'stuck']);
|
|
65
|
-
const EVENTS = Object.freeze(['proposal', 'keep', 'return', 'drop', 'correction', 'pause', 'resume', 'mode', 'wake', 'run-start', 'run-end', 'refused', 'blocker', 'epoch', 'undo']);
|
|
69
|
+
const EVENTS = Object.freeze(['proposal', 'keep', 'return', 'drop', 'correction', 'pause', 'resume', 'mode', 'wake', 'run-start', 'run-end', 'refused', 'blocker', 'epoch', 'undo', 'default', 'lapse']);
|
|
66
70
|
const BUDGET = Object.freeze({ concurrent: 3 });
|
|
67
71
|
const EFFORTS = Object.freeze(['S', 'M', 'L']);
|
|
68
72
|
const DAY = 86400000;
|
|
@@ -284,8 +288,19 @@ function fold(lines) {
|
|
|
284
288
|
}
|
|
285
289
|
case 'undo': {
|
|
286
290
|
const p = s.proposals.get(l.proposal);
|
|
287
|
-
if (!p ||
|
|
288
|
-
p.state = 'undone'; p.undone_at = l.at || null; p.undone_by = l.by;
|
|
291
|
+
if (!p || !pm(l.by)) break;
|
|
292
|
+
if (p.state === 'kept') { p.state = 'undone'; p.undone_at = l.at || null; p.undone_by = l.by; break; }
|
|
293
|
+
// never-wait-on-drafts: Undo of a default or a lapse opens the proposal again; a defaulted one never defaults again
|
|
294
|
+
if (p.state !== 'defaulted' && p.state !== 'lapsed') break;
|
|
295
|
+
if (p.state === 'defaulted') p.no_default = true;
|
|
296
|
+
p.state = 'open'; p.reopened_at = l.at || null; p.note = null; p.decided_at = null; p.decided_by = null;
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
case 'default': case 'lapse': {
|
|
300
|
+
const p = s.proposals.get(l.proposal);
|
|
301
|
+
if (!p || p.state !== 'open' || l.by !== (l.ev === 'default' ? 'pmos:default' : 'pmos:lapse')) break;
|
|
302
|
+
p.state = l.ev === 'default' ? 'defaulted' : 'lapsed';
|
|
303
|
+
p.note = typeof l.why === 'string' && l.why ? l.why : null; p.decided_at = l.at || null; p.decided_by = l.by;
|
|
289
304
|
break;
|
|
290
305
|
}
|
|
291
306
|
case 'correction': s.corrections.push({ proposal: l.proposal || null, run: l.run || null, kind: l.kind, at: l.at || null }); break;
|
|
@@ -432,21 +447,18 @@ function detect(facts, state, { now, stalledDays } = {}) {
|
|
|
432
447
|
return out;
|
|
433
448
|
}
|
|
434
449
|
|
|
435
|
-
/** The lines the sweep appends now: one `blocker` per blocker per day, and for an agent blocker one `wake`.
|
|
436
|
-
*
|
|
437
|
-
* the
|
|
438
|
-
* what raises its Needs you row again. */
|
|
450
|
+
/** The lines the sweep appends now: one `blocker` per blocker per day, and for an agent blocker one `wake`. An open proposal never
|
|
451
|
+
* holds its target (never-wait-on-drafts, rule 3 of the product line plan): its agent blockers still wake a run, and lib/never-wait.js
|
|
452
|
+
* applies, defaults or lapses the proposal by itself. A proposal older than a day still raises the PM blocker (pm-open) once a day. */
|
|
439
453
|
function sweepLines(facts, state, { now, stalledDays } = {}) {
|
|
440
454
|
const t = now == null ? facts.now : now;
|
|
441
455
|
const day = facts.day || localDay(t);
|
|
442
456
|
const blockers = detect(facts, state, { now: t, stalledDays });
|
|
443
|
-
const pmBlocked = new Set(blockers.filter((b) => b.owner === 'pm').map((b) => targetKey(b.target)));
|
|
444
|
-
for (const b of blockers) if (openProposals(state, b.target).length) pmBlocked.add(targetKey(b.target));
|
|
445
457
|
const lines = [];
|
|
446
458
|
for (const b of blockers) {
|
|
447
459
|
if (state.blockerDays.has(`${b.key}|${day}`)) continue;
|
|
448
460
|
lines.push({ ev: 'blocker', key: b.key, day, target: b.target, board: b.board, code: b.code, owner: b.owner, text: b.text, ...(b.docs ? { docs: b.docs } : {}) });
|
|
449
|
-
if (b.owner === 'agent'
|
|
461
|
+
if (b.owner === 'agent') {
|
|
450
462
|
const key = `stuck:${b.key}:${day}`;
|
|
451
463
|
if (!state.wakeKeys.has(key)) lines.push({ ev: 'wake', key, target: b.target, board: b.board, reason: 'stuck', blocker: b.code });
|
|
452
464
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* line-cli.js — `pmos line`: where each initiative of this product stands on its own workflow, and what moves it next
|
|
3
|
+
* (product line plan, slice 2; initiative pmos-line). Read-only: it writes no file, moves nothing and sends nothing.
|
|
4
|
+
*
|
|
5
|
+
* pmos line [<initiative>] [--json] [--root <dir>] [--as-of <YYYY-MM-DD>]
|
|
6
|
+
* every live initiative by station: days there (or quiet days), the exit items still missing, the next move, and
|
|
7
|
+
* stuck, moving, waiting or can't tell. Ended initiatives are counted at the end.
|
|
8
|
+
* pmos line count [--root <dir>] [--as-of <YYYY-MM-DD>]
|
|
9
|
+
* the percent of live initiatives placed on a station with a next move, on the last line (the health number).
|
|
10
|
+
*
|
|
11
|
+
* --as-of reads the records as they stood on a day (a backup), so "days there" counts to that day.
|
|
12
|
+
* The reading is lib/line.js. Exit codes: 0 done, 1 refused, 2 usage. */
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execFileSync } = require('child_process');
|
|
15
|
+
const L = require('./line.js');
|
|
16
|
+
|
|
17
|
+
const COMMANDS = { line: ['count'] };
|
|
18
|
+
const USAGE = [
|
|
19
|
+
'usage: pmos line [<initiative>|count] [--json] [--root <dir>] [--as-of <YYYY-MM-DD>] — where each initiative stands on its own workflow',
|
|
20
|
+
' pmos line every live initiative by station: days there, exit items missing, next move, and stuck, moving, waiting or can\'t tell',
|
|
21
|
+
' pmos line <initiative> one initiative, with why it has that flag',
|
|
22
|
+
' pmos line count the percent of live initiatives placed with a next move, on the last line',
|
|
23
|
+
' The station is the current stage of the initiative\'s own workflow (pmos workflow of). Its exit items are the stage\'s To finish',
|
|
24
|
+
' lines, else its output. Waiting for capacity is never stuck; a stale or missing record is can\'t tell. Nothing is written or sent.',
|
|
25
|
+
];
|
|
26
|
+
const FLAG = { stuck: 'stuck', moving: 'moving', waiting: 'waiting', 'cant-tell': "can't tell" };
|
|
27
|
+
|
|
28
|
+
function parse(argv) {
|
|
29
|
+
const pos = [], flags = {};
|
|
30
|
+
for (let i = 0; i < argv.length; i++) {
|
|
31
|
+
const a = argv[i];
|
|
32
|
+
if (a === '-h' || a === '--help') { flags.help = true; continue; }
|
|
33
|
+
if (a === '--json') { flags.json = true; continue; }
|
|
34
|
+
if (a === '--root' || a === '--as-of') { flags[a.slice(2)] = argv[++i]; continue; }
|
|
35
|
+
if (a.startsWith('--root=') || a.startsWith('--as-of=')) { const k = a.slice(2, a.indexOf('=')); flags[k] = a.slice(a.indexOf('=') + 1); continue; }
|
|
36
|
+
if (a.startsWith('--')) { flags.bad = a; continue; }
|
|
37
|
+
pos.push(a);
|
|
38
|
+
}
|
|
39
|
+
return { pos, flags };
|
|
40
|
+
}
|
|
41
|
+
function repoRoot(cwd) {
|
|
42
|
+
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; }
|
|
43
|
+
catch { return cwd; }
|
|
44
|
+
}
|
|
45
|
+
const daysText = (x) => (x.daysThere != null ? `${x.daysThere}d here` : x.quietDays != null ? `quiet ${x.quietDays}d` : "days can't tell");
|
|
46
|
+
|
|
47
|
+
function run(argv, { say = console.log, cwd = process.cwd() } = {}) {
|
|
48
|
+
const { pos, flags } = parse(argv.slice(1));
|
|
49
|
+
if (flags.help) { for (const l of USAGE) say(l); return 0; }
|
|
50
|
+
if (flags.bad) { say(`${flags.bad} is not an option of pmos line`); for (const l of USAGE) say(l); return 2; }
|
|
51
|
+
let now = Date.now();
|
|
52
|
+
if (flags['as-of'] !== undefined) {
|
|
53
|
+
const t = Date.parse(String(flags['as-of']) + 'T23:59:59Z');
|
|
54
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(String(flags['as-of'])) || !Number.isFinite(t)) { say('--as-of is a day: YYYY-MM-DD'); return 2; }
|
|
55
|
+
now = t;
|
|
56
|
+
}
|
|
57
|
+
const root = flags.root ? path.resolve(flags.root) : repoRoot(cwd);
|
|
58
|
+
const count = pos[0] === 'count';
|
|
59
|
+
const only = count ? null : pos[0] || null;
|
|
60
|
+
const r = L.lineOf(root, { only, now });
|
|
61
|
+
if (!r.ok) { say('✗ ' + r.error); return 1; }
|
|
62
|
+
const s = L.summary(r);
|
|
63
|
+
if (count) {
|
|
64
|
+
say(`[line] ${r.product}: ${s.placed} of ${s.live} live initiatives placed with a next move; ${r.ended} ended`);
|
|
65
|
+
const by = {}; for (const x of r.rows) if (x.live) by[x.flag] = (by[x.flag] || 0) + 1;
|
|
66
|
+
say('[line] ' + Object.entries(by).map(([k, v]) => `${FLAG[k] || k} ${v}`).join(' · '));
|
|
67
|
+
say(String(s.percent));
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
if (flags.json) { say(JSON.stringify({ ok: true, product: r.product, asOf: new Date(now).toISOString().slice(0, 10), ...s, ended: r.ended, rows: r.rows })); return 0; }
|
|
71
|
+
if (only) {
|
|
72
|
+
const x = r.rows[0];
|
|
73
|
+
if (!x) { say(`✗ no initiative ${only}`); return 1; }
|
|
74
|
+
say(`${x.title} (${x.id}) · ${x.workflow || 'no workflow'}`);
|
|
75
|
+
if (!x.live) { say(`Ended: ${x.ended}. It is off the line.`); return 0; }
|
|
76
|
+
say(x.station ? `Station ${x.station.n} of ${x.station.of}: ${x.station.name} · ${daysText(x)}${x.setBy ? ' (set by ' + x.setBy + ')' : ''}` : 'No station: it has no workflow stage.');
|
|
77
|
+
say(`Flag: ${FLAG[x.flag]} — ${x.why}`);
|
|
78
|
+
say(x.missing.length ? 'Missing to finish this station:' : 'Nothing missing on this station.');
|
|
79
|
+
for (const m of x.missing) say(` · ${m}`);
|
|
80
|
+
if (x.next) say(`Next move: ${x.next}`);
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
say(`${r.product} · ${s.live} live initiatives on the line · ${s.placed} placed with a next move (${s.percent}%)${r.ended ? ' · ' + r.ended + ' ended' : ''}`);
|
|
84
|
+
const live = r.rows.filter((x) => x.live);
|
|
85
|
+
const groups = new Map();
|
|
86
|
+
for (const x of live) { const k = x.station ? `${x.workflow} · ${x.station.n}. ${x.station.name}` : 'No station'; if (!groups.has(k)) groups.set(k, []); groups.get(k).push(x); }
|
|
87
|
+
for (const [k, list] of [...groups].sort((a, b) => a[0].localeCompare(b[0], undefined, { numeric: true }))) {
|
|
88
|
+
say('');
|
|
89
|
+
say(`${k} (${list.length})`);
|
|
90
|
+
for (const x of list) {
|
|
91
|
+
say(` ${x.id} · ${daysText(x)} · ${FLAG[x.flag]}`);
|
|
92
|
+
if (x.missing.length > 1) say(` missing: ${x.missing.join(' · ')}`);
|
|
93
|
+
say(` next: ${x.next || '—'}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
module.exports = { run, COMMANDS, USAGE };
|