create-pmos 0.546.0 → 0.548.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +27 -45
- 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/README.md +1 -1
- package/workspace/bin/pmos.js +22 -0
- package/workspace/changelog.json +26 -0
- package/workspace/guide/cli.md +10 -0
- package/workspace/guide/home.md +9 -4
- package/workspace/guide/layout.md +1 -1
- package/workspace/lib/artefacts.js +12 -0
- package/workspace/lib/autonomy.js +27 -7
- package/workspace/lib/driver-decide.js +6 -1
- package/workspace/lib/launcher-cli.js +147 -13
- package/workspace/lib/routes-artefacts.js +18 -1
- package/workspace/lib/routes-autonomy.js +56 -8
- package/workspace/lib/routes-proposals.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today.css +7 -0
- package/workspace/public/pm/good-morning.js +72 -14
- package/workspace/public/pm/home-app.js +4 -3
- package/workspace/public/pm/home-day.js +11 -6
- package/workspace/public/pm/ini-agent.js +164 -0
- package/workspace/public/pm/ini-view.css +32 -3
- package/workspace/public/pm/ini-view.js +25 -2
- package/workspace/public/pm/move-rank.js +6 -3
- package/workspace/stage-card-tasks-test.js +3 -0
- package/workspace/test-lists/agent-run-workspace.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.548.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": {
|
|
@@ -32,6 +32,32 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.548.0",
|
|
37
|
+
"at": "2026-11-10T02:35:02.323Z",
|
|
38
|
+
"f": 4,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1276,
|
|
42
|
+
"t": "Agent-run Your day and initiative Viewer",
|
|
43
|
+
"s": "Agent-run Your day and initiative Viewer",
|
|
44
|
+
"k": "new"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"v": "0.547.0",
|
|
50
|
+
"at": "2026-11-09T23:58:24.564Z",
|
|
51
|
+
"f": 4,
|
|
52
|
+
"prs": [
|
|
53
|
+
{
|
|
54
|
+
"n": 1275,
|
|
55
|
+
"t": "A Mac running PMOS keeps working unattended — minute check + Remote Control keeper",
|
|
56
|
+
"s": "A Mac running PMOS keeps working unattended — minute check + Remote Control keeper",
|
|
57
|
+
"k": "new"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
35
61
|
{
|
|
36
62
|
"v": "0.546.0",
|
|
37
63
|
"at": "2026-11-09T15:25:03.150Z",
|
|
@@ -349,50 +375,6 @@
|
|
|
349
375
|
"k": "new"
|
|
350
376
|
}
|
|
351
377
|
]
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
"v": "0.528.0",
|
|
355
|
-
"at": "2026-11-04T12:00:44.809Z",
|
|
356
|
-
"f": 4,
|
|
357
|
-
"prs": [
|
|
358
|
-
{
|
|
359
|
-
"n": 1229,
|
|
360
|
-
"t": "Dates carry their year, and plain words across the workspace (workspace grill W4)",
|
|
361
|
-
"s": "Dates carry their year, and plain words across the workspace (workspace grill W4)",
|
|
362
|
-
"k": "fix"
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
"n": 1241,
|
|
366
|
-
"t": "Good morning on live data — a stale source said once, a quiet quarter, goal tags, say-it-once folds",
|
|
367
|
-
"s": "Good morning on live data — a stale source said once, a quiet quarter, goal tags, say-it-once folds",
|
|
368
|
-
"k": "fix"
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
"n": 1239,
|
|
372
|
-
"t": "The Lab's background record leaves out a chat's own runs",
|
|
373
|
-
"s": "The Lab's background record leaves out a chat's own runs",
|
|
374
|
-
"k": "fix"
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
"n": 1242,
|
|
378
|
-
"t": "Report reader no longer flickers while a draft is written",
|
|
379
|
-
"s": "Report reader no longer flickers while a draft is written",
|
|
380
|
-
"k": "fix"
|
|
381
|
-
}
|
|
382
|
-
]
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
"v": "0.527.0",
|
|
386
|
-
"at": "2026-11-04T11:15:45.443Z",
|
|
387
|
-
"f": 4,
|
|
388
|
-
"prs": [
|
|
389
|
-
{
|
|
390
|
-
"n": 1237,
|
|
391
|
-
"t": "Chat refinements keep drafting the open report",
|
|
392
|
-
"s": "Chat refinements keep drafting the open report",
|
|
393
|
-
"k": "fix"
|
|
394
|
-
}
|
|
395
|
-
]
|
|
396
378
|
}
|
|
397
379
|
]
|
|
398
380
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-11-
|
|
1
|
+
kernel-source: pmos@fabcb8e9
|
|
2
|
+
assembled: 2026-11-10
|
|
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-10T02:34:59Z"}
|
|
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-10T02:34:59Z"}
|
|
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-10T02:34:59Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
package/workspace/README.md
CHANGED
|
@@ -33,7 +33,7 @@ pmos status # is it running? which sessions?
|
|
|
33
33
|
pmos stop # shut it down (scrollback is preserved; sessions respawn next time)
|
|
34
34
|
pmos doctor # diagnose the environment (node-pty arch, PTY spawn test, ports)
|
|
35
35
|
```
|
|
36
|
-
**Without a terminal.** Mac and Windows setup creates a launcher and login item automatically. Windows gets a Start menu shortcut. To repair or change a launcher, `pmos launcher on` writes a PMOS app — `~/Applications/PMOS.app` on macOS, an app-menu entry on Linux — and a login item that starts the server at login without opening a browser. Both run `pmos up <repo>` with the PATH your terminal had at setup. `pmos launcher status` checks it, `pmos launcher off` removes it. Guide: [`guide/layout.md`](guide/layout.md).
|
|
36
|
+
**Without a terminal.** Mac and Windows setup creates a launcher and login item automatically. Windows gets a Start menu shortcut. To repair or change a launcher, `pmos launcher on` writes a PMOS app — `~/Applications/PMOS.app` on macOS, an app-menu entry on Linux — and a login item that starts the server at login without opening a browser (on macOS it checks every minute and restarts a stopped server; `--remote-control` also keeps `claude remote-control` running). Both run `pmos up <repo>` with the PATH your terminal had at setup. `pmos launcher status` checks it, `pmos launcher off` removes it. Guide: [`guide/layout.md`](guide/layout.md).
|
|
37
37
|
|
|
38
38
|
**The port is found, not assumed.** A running server records the port it serves, so `pmos` in a second repo joins the workspace you already have open — whatever port it ended up on, and however it was started. If another program holds the default port (7433), `pmos` starts on the next free one and says so; `PMOS_WS_PORT=7500 pmos` pins it by hand. `pmos stop` shuts down every workspace server it finds, which is how you collapse two back into one.
|
|
39
39
|
|
package/workspace/bin/pmos.js
CHANGED
|
@@ -50,6 +50,17 @@ const urlOf = (port) => `http://127.0.0.1:${port}`;
|
|
|
50
50
|
// Tests set PMOS_NO_OPEN. `--no-open` is the login item's (`pmos launcher on`): a flag, not the env var, so the
|
|
51
51
|
// server it starts does not hand PMOS_NO_OPEN to every session, where a `pmos` typed later would open nothing.
|
|
52
52
|
const NO_OPEN = process.env.PMOS_NO_OPEN === '1' || process.argv.includes('--no-open');
|
|
53
|
+
// `--keep` is the login item's check, run by launchd every minute (`pmos launcher on`). It answers "is the workspace
|
|
54
|
+
// up, on this install's version?" and does nothing more when it is: it registers no repository, opens nothing and
|
|
55
|
+
// prints nothing. When no server answers (it crashed, or an update stopped it and did not bring it back) it starts
|
|
56
|
+
// one; when a server is stuck for a minute it stops that server and starts a new one. While an in-page update is
|
|
57
|
+
// running (its log was written in the last few minutes) it waits, because that update stops the server and starts
|
|
58
|
+
// the new one itself.
|
|
59
|
+
const KEEP = process.argv.includes('--keep');
|
|
60
|
+
const UPDATE_GRACE_MS = 5 * 60000;
|
|
61
|
+
function updateRunning(now = Date.now()) {
|
|
62
|
+
try { return now - fs.statSync(path.join(STATE, 'app-update.log')).mtimeMs < UPDATE_GRACE_MS; } catch { return false; }
|
|
63
|
+
}
|
|
53
64
|
|
|
54
65
|
const say = (s) => console.log(s);
|
|
55
66
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
@@ -323,6 +334,11 @@ async function up(dir, { remote = false, open = true, waited = false } = {}) {
|
|
|
323
334
|
}
|
|
324
335
|
// 1. Is a workspace already running — on ANY port it recorded, not just the one this shell guesses?
|
|
325
336
|
let live = await discover();
|
|
337
|
+
if (KEEP) {
|
|
338
|
+
if (live.some((l) => l.version === APP_VERSION)) return 0;
|
|
339
|
+
if (updateRunning()) return 0;
|
|
340
|
+
say(`${new Date().toISOString()} keep: ${live.length ? `the workspace runs ${live[0].version || 'an older version'}, this install is ${APP_VERSION}` : 'no workspace server answered'} — starting it`);
|
|
341
|
+
}
|
|
326
342
|
// A server that predates this install is running OLD code under NEW files (or the reverse). Reusing
|
|
327
343
|
// it is the failure behind "not found is not valid JSON": the page asks for routes that process
|
|
328
344
|
// never learned. Sessions are tmux-backed, so replacing the server does not end them.
|
|
@@ -357,6 +373,12 @@ async function up(dir, { remote = false, open = true, waited = false } = {}) {
|
|
|
357
373
|
const slow = waited ? [] : await busy();
|
|
358
374
|
if (slow.length) {
|
|
359
375
|
if (await waitForBusy(slow)) return up(dir, { remote, open, waited: true }); // re-run: it may be an older version
|
|
376
|
+
if (KEEP) {
|
|
377
|
+
// Unattended, nobody will read the advice below. A server that has not answered for a minute is stuck: replace it.
|
|
378
|
+
say(`${new Date().toISOString()} keep: the server on port ${slow[0].port} has not answered for a minute — restarting it`);
|
|
379
|
+
for (const b of slow) if (await stopOne(b.port)) return 1;
|
|
380
|
+
return up(dir, { remote, open, waited: true });
|
|
381
|
+
}
|
|
360
382
|
say(`✗ the workspace server on port ${slow[0].port} (pid ${slow[0].pid}) is running but has not answered for a minute.`);
|
|
361
383
|
say(' Run `pmos stop`, then `pmos` to restart it. If it happens again, run `pmos doctor` and send its output.');
|
|
362
384
|
return 1;
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.548.0",
|
|
4
|
+
"at": "2026-11-10T02:35:02.323Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1276,
|
|
9
|
+
"t": "Agent-run Your day and initiative Viewer",
|
|
10
|
+
"s": "Agent-run Your day and initiative Viewer",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.547.0",
|
|
17
|
+
"at": "2026-11-09T23:58:24.564Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1275,
|
|
22
|
+
"t": "A Mac running PMOS keeps working unattended — minute check + Remote Control keeper",
|
|
23
|
+
"s": "A Mac running PMOS keeps working unattended — minute check + Remote Control keeper",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.546.0",
|
|
4
30
|
"at": "2026-11-09T15:25:03.150Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -27,6 +27,16 @@ Mac and Windows setup creates the PMOS app and a login item automatically. [Layo
|
|
|
27
27
|
|
|
28
28
|
Open a terminal in the repository you want. Type `pmos launcher on`. To choose another repository, add its path. Repeat this command after moving Node or the installed PMOS app.
|
|
29
29
|
|
|
30
|
+
#### Keep a Mac working when you are away
|
|
31
|
+
|
|
32
|
+
Type `pmos launcher on --profile=claude-personal --remote-control`. Use the name of your own Claude profile.
|
|
33
|
+
|
|
34
|
+
- The login item checks the server every minute. It starts the server again after a crash or an update that did not finish.
|
|
35
|
+
- `--profile=<id>` sets the Claude profile for unattended Claude work, the same as Settings → Claude.
|
|
36
|
+
- `--remote-control` keeps `claude remote-control` running under that profile in the tmux session `pmos-remote-control`. Claude can then reach this Mac when the Claude desktop app is closed. Type `tmux attach -t pmos-remote-control` to see it, and Ctrl-b d to leave it.
|
|
37
|
+
|
|
38
|
+
The Mac must stay awake and signed in. A later `pmos launcher on` without `--remote-control` keeps the Remote Control item. `pmos launcher off` removes it.
|
|
39
|
+
|
|
30
40
|
To create only the app, use `pmos launcher on --no-login` on a fresh installation. To skip launcher creation during app activation, use `npx create-pmos@latest workspace --no-launcher`.
|
|
31
41
|
|
|
32
42
|
Type `pmos launcher status` to check the launcher. The result names the repository, Node, PMOS and login item. A missing target means the launcher needs repair.
|
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-10
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Home
|
|
@@ -17,11 +17,14 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
|
|
|
17
17
|
- Press **Good morning** to open **Your day** in the Viewer. This is the same on a computer and on a phone. To open the calendar, press the calendar icon in Your day's header. A program's milestone changes that wait on you are the first line of the program's card.
|
|
18
18
|
- Your day is the **Good morning** page. It shows the date and greeting, then the quarter, then two columns. On a computer it opens wide.
|
|
19
19
|
- **The quarter.** One bar with all goals of the products Home reads: reached, on track, still reading, at risk and will miss, each with its count. A black tick marks your line, for example "line 18". One sentence says how many goals are on track or better, and one line says why. When no goal has a reading yet, the sentence says that instead, for example "3 goals, none read yet." **By product** opens Intelligence. With no goals, there is no bar. With no line, there is no tick, and Claude can propose a line with ✦: press ✓ to keep it, or ✕ to not set one this quarter. A product that could not be read is named and is not counted.
|
|
20
|
-
- **The left column.** Claude's lead,
|
|
20
|
+
- **The left column.** Claude's lead says it straight, for example "Straight answer: 5 calls are yours. I did the other 54." When a source such as Jira cannot be read, one quiet line under the lead says so and what it shows instead, with an icon to read it again. The source never takes the lead's place.
|
|
21
|
+
- **Your move** shows only the calls that always wait for you: a verdict, a new request or a decision, a message to people, a move the team reads, a merge, and a delete or spend. Each row starts with its kind and says why, for example "Message · I drafted it. It goes to people and cannot be unsent." It also shows its due day (orange when late) and the goal it moves when a goal reads it. At most 5 show. **N more calls of yours** opens the rest. Claude acts on everything else by itself, so there is no Can wait.
|
|
22
|
+
- **Claude did** lists what Claude finished by itself, newest first. Each row has a one-line reason, for example "Did it quietly. You kept this kind 4 times before.", and Undo. Undo works for 14 days. After two Undos in a row on one kind, Claude asks first for that kind for 7 days. A run that stopped is one amber line at the top, never a row in Your move. **N more Claude did** opens the rest.
|
|
23
|
+
- **Since yesterday**: up to 3 new items, then **New for you · N** to see all of them. ✓✓ marks all of them seen.
|
|
21
24
|
- **The right column.** Today's agenda, not to scale: a line at the time now, each meeting with its prep note, ✦ picks in free time, and "3 h free" for a long free stretch. The meeting where your call is decided has an orange edge. Under it, **Notes since yesterday**: meeting notes with their main lines, and recordings with no initiative. When Claude finds the initiative a recording belongs to, press the link icon to link it.
|
|
22
25
|
- **In the hour before a meeting**, the meeting's prep leads: what to agree, the points, and the record icon. The quarter shows only when it moved since the morning. Past meetings fade, with their notes under them.
|
|
23
|
-
- **On a phone or in a narrow Viewer**, the page is one column: the quarter, the lead,
|
|
24
|
-
- Under the page are **Now** (on a phone)
|
|
26
|
+
- **On a phone or in a narrow Viewer**, the page is one column: the quarter, the lead, Your move, Claude did, the agenda, then Since yesterday.
|
|
27
|
+
- Under the page are **Now** (on a phone) and **This week** (the Weekly review and **Mentions**). The rest of your calls, the rest of Claude did and **Drafted for you** open there from their line.
|
|
25
28
|
- **Drafted for you** lists what Claude drafted today and the weekly update. Press a row to open it: a finished draft opens what Claude wrote, and the weekly update opens the update.
|
|
26
29
|
- Your day does not show the meeting on now or the next meeting. Home's meeting line shows them. On a phone, the **Now** card does not show while a meeting is in progress.
|
|
27
30
|
- When a conversation in Mentions waits on your answer, Your day names the oldest one under its first line: who asked, where, how many more wait, and what they asked. Press its icon to open that conversation in Mentions.
|
|
@@ -74,6 +77,8 @@ A reply PMOS sees in the thread clears the ask on the next read. A new ask after
|
|
|
74
77
|
Press an initiative's name in the list, or open `?ini=<id>`. The list stays as it is and the initiative's row is selected. The chat talks about the initiative, and its page opens in the Viewer.
|
|
75
78
|
|
|
76
79
|
- The page's header shows the lane and the anchor, the name, **New session** (+), ⋯, Open wide and Close.
|
|
80
|
+
- **Experiment** shows what Claude keeps for the initiative: **We bet**, **Stop if**, **Budget**, **Who builds**, **Specimens** and **Done when**. A line that nobody wrote does not show. Press a line to change it. After you change a line, Claude asks before it changes that line again. When an experiment is on record, **Gate to Build** shows the done test and the kill condition (D107) instead of the PRD and the rubric.
|
|
81
|
+
- **Claude's work** lists what Claude changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. **Coming up** names the next dated thing, for example a milestone that is due.
|
|
77
82
|
- The stage card shows the stage, **N of M done** for its tasks, the days in the stage (for example "9 of ~7 days", amber when over the usual time) and → for the next stage. → turns blue when every task of the stage is done.
|
|
78
83
|
- Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. When the initiative has milestone tasks, the end ◇ stands for one of them (one on the end date, else the latest in the last milestone stage, else the latest of all), sits on that task's own date and shows it. A thin tick is Today.
|
|
79
84
|
- Press a part to show that stage in **Tasks**. Press **N of M done** to do the same. Press a ◇ to open the milestone task in **Tasks**. Milestones a few days apart merge into one ◇ with a count. Press it to list them.
|
|
@@ -185,7 +185,7 @@ To change, repair or remove the launcher, use `pmos launcher on`, `pmos launcher
|
|
|
185
185
|
|
|
186
186
|
### Limits
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
On macOS the login item checks the server every minute. It starts the server when the server stops, and replaces a server that does not answer for a minute. It waits while an in-app update runs. On Linux the login item starts the server once at login. Open the app if the server stops. Login does not enable remote access. Mac and Linux launcher output goes to `launcher.log` in the runtime state folder. Windows launchers run without a command window and use the server's normal logs.
|
|
189
189
|
|
|
190
190
|
## Adler, Claude's face
|
|
191
191
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* file(dir) · readLines(file) · fold(lines) → Map scope → Map artefact → { fields: { name: value|[values] }, carried: [line] }
|
|
13
13
|
* set(file, { scope, artefact, field, text, sources }, actor, { now }) → { ok, line } | { ok: false, status, error }
|
|
14
14
|
* undo(file, { ref }, actor, { now }) → { ok, line } | refusal a set goes back; carry lines cannot be undone (they point at records)
|
|
15
|
+
* pmEdited(state, { scope, artefact, field }) → bool the newest set of that field is the PM's: Claude asks before it changes it (board AwB)
|
|
15
16
|
* viewOf(state, scope) → { scope, artefacts: [{ key, title, owner, for, fields, carried, empty }] } always all seven that fit the scope
|
|
16
17
|
* migrate({ dir, coreDocs, driverLines, reports }, { now }) → { ok, carried, already, lines } idempotent; deletes nothing
|
|
17
18
|
*
|
|
@@ -226,6 +227,16 @@ function viewOf(state, scope) {
|
|
|
226
227
|
return { scope: p.scope, kind: p.kind, artefacts };
|
|
227
228
|
}
|
|
228
229
|
|
|
230
|
+
/** True when the newest set of this field is the PM's own (the Viewer's "You edit any line. Claude asks before it changes one you edited",
|
|
231
|
+
* agent-run workspace board AwB). The Driver then files Claude's change as a proposal instead of applying it. Pure. */
|
|
232
|
+
function pmEdited(state, { scope, artefact, field } = {}) {
|
|
233
|
+
const p = parseScope(scope);
|
|
234
|
+
const x = p && state && state.get(p.scope) && state.get(p.scope).get(artefact);
|
|
235
|
+
if (!x) return false;
|
|
236
|
+
const sets = x.sets.filter((l) => l.field === field);
|
|
237
|
+
return !!sets.length && /^pm:/.test(String(sets[sets.length - 1].by || ''));
|
|
238
|
+
}
|
|
239
|
+
|
|
229
240
|
// ── writes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
230
241
|
const refuse = (status, error) => ({ ok: false, status, error });
|
|
231
242
|
const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
|
|
@@ -363,6 +374,7 @@ function migrateRepo(root, { now } = {}) {
|
|
|
363
374
|
}
|
|
364
375
|
|
|
365
376
|
module.exports = {
|
|
377
|
+
pmEdited,
|
|
366
378
|
LEDGER, EVENTS, ARTEFACTS, KEYS, EXECUTORS, FROM_DOCS, FROM_WHATS, FROM_CADENCES, FROM_LANES,
|
|
367
379
|
parseScope, targetOfDoc, targetOfWhat, fieldOf, file, readLines, append, fold, viewOf, checkSet, set, undo,
|
|
368
380
|
planMigration, migrate, migrateRepo, reportDrafts, dirOf, proposalText,
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* A change with no Undo writer is never applied by itself, whatever its class ("no Undo, no auto"): it waits like C.
|
|
11
11
|
*
|
|
12
12
|
* THE LEDGER: <state folder>/autonomy.jsonl, append-only, THIS FILE IS ITS ONE WRITER. One line per event { v: 1, at, ev, ... }:
|
|
13
|
-
* applied { job, product, ref, title, cls }
|
|
13
|
+
* applied { job, product, ref, title, cls, ini?, why? } an agent applied a change by itself (ref: the proposal id or the ✦ batch;
|
|
14
|
+
* ini: the initiative it changed; why: the evidence it acted on, one line)
|
|
14
15
|
* setback { job, product, ref?, kind } kind: undo (the PM pressed Undo) · revert (a revert of the change) ·
|
|
15
16
|
* verifier-fail (the T4 verifier failed it; counts like an Undo)
|
|
16
17
|
* demote { job, product, until, why } the job falls back to propose for this product until `until`
|
|
@@ -33,7 +34,9 @@
|
|
|
33
34
|
* killed({ env, settingsDir }) → null | reason PMOS_AUTONOMY=off or `pmos ai off` stops every auto apply
|
|
34
35
|
* demotedNow(state, job, product, now) → null | { until, why }
|
|
35
36
|
* notices(stateDir, { now }) → [{ job, product, until, why }] demotions Home has not said yet; markSeen(stateDir, n, { now })
|
|
36
|
-
* done(stateDir, { now, days }) → [applied line, newest first] the applied changes of the last 14 days that are not undone
|
|
37
|
+
* done(stateDir, { now, days }) → [applied line, newest first] the applied changes of the last 14 days that are not undone, each with
|
|
38
|
+
* `kept` (earlier changes of its job and product nobody undid) and `reason` (reasonOf)
|
|
39
|
+
* reasonOf({ cls, why, kept }) → one line: how Claude did it and why ("Did it quietly. You kept this kind 4 times before.")
|
|
37
40
|
* restore(stateDir, { job, product }, actor, { now })
|
|
38
41
|
*/
|
|
39
42
|
const fs = require('fs');
|
|
@@ -112,7 +115,7 @@ function fold(lines) {
|
|
|
112
115
|
if (!isObj(l) || typeof l.job !== 'string') continue;
|
|
113
116
|
const j = get(l.job, l.product);
|
|
114
117
|
if (l.ev === 'applied') {
|
|
115
|
-
const a = { ref: l.ref || null, title: l.title || '', cls: l.cls || null, job: l.job, product: l.product || null, at: l.at, undone: false, undoneAt: null };
|
|
118
|
+
const a = { ref: l.ref || null, title: l.title || '', cls: l.cls || null, job: l.job, product: l.product || null, ini: l.ini || null, why: l.why || '', at: l.at, undone: false, undoneAt: null };
|
|
116
119
|
j.applied.push(a);
|
|
117
120
|
if (a.ref) applied.set(a.ref, a);
|
|
118
121
|
} else if (l.ev === 'setback') {
|
|
@@ -148,9 +151,10 @@ function trip(j, now) {
|
|
|
148
151
|
return null;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
function recordApplied(stateDir, { job, product, ref, title, cls }, { now } = {}) {
|
|
154
|
+
function recordApplied(stateDir, { job, product, ref, title, cls, ini, why }, { now } = {}) {
|
|
152
155
|
if (!JOB_RE.test(String(job || ''))) return null;
|
|
153
|
-
return append(stateDir, { ev: 'applied', job, product: product || null, ref: ref ? one(ref, 120) : null, title: one(title, 200), cls: CLASSES.includes(cls) ? cls : null
|
|
156
|
+
return append(stateDir, { ev: 'applied', job, product: product || null, ref: ref ? one(ref, 120) : null, title: one(title, 200), cls: CLASSES.includes(cls) ? cls : null,
|
|
157
|
+
...(ini ? { ini: one(ini, 80) } : {}), ...(why ? { why: one(why, 200) } : {}) }, { now });
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
/** THE HOOK for an Undo, a revert or a verifier FAIL. Writes the setback and, when it trips, the demotion. */
|
|
@@ -205,12 +209,28 @@ function notices(stateDir, { now } = {}) {
|
|
|
205
209
|
}
|
|
206
210
|
const markSeen = (stateDir, n, { now } = {}) => append(stateDir, { ev: 'seen', job: n.job, product: n.product || null, until: n.until }, { now });
|
|
207
211
|
|
|
212
|
+
/** The one-line reason a change shows beside its Undo (agent-run workspace, board AwA: "each change says why"). Honest from the ledger:
|
|
213
|
+
* a kind the PM kept before is done quietly and says how often; the first of its kind is done and shown; the evidence follows when the
|
|
214
|
+
* change carries one. Pure. */
|
|
215
|
+
function reasonOf({ cls = null, why = '', kept = 0 } = {}) {
|
|
216
|
+
const how = kept > 0 ? 'Did it quietly. You kept this kind ' + (kept === 1 ? 'once' : kept + ' times') + ' before.'
|
|
217
|
+
: 'Did it and showed you. It is the first of its kind' + (cls === 'A' ? ', and it is upkeep with one right answer.' : '.');
|
|
218
|
+
const w = one(why, 200);
|
|
219
|
+
return w ? how + ' ' + w.replace(/\.?$/, '.') : how;
|
|
220
|
+
}
|
|
221
|
+
|
|
208
222
|
/** The Done group: what agents applied by themselves in the last `days` days and nobody undid, newest first. */
|
|
209
223
|
function done(stateDir, { now, days = UNDO_DAYS } = {}) {
|
|
210
224
|
const t = now == null ? Date.now() : now;
|
|
211
225
|
const since = t - days * DAY;
|
|
212
226
|
const out = [];
|
|
213
|
-
for (const j of fold(read(stateDir)).jobs.values())
|
|
227
|
+
for (const j of fold(read(stateDir)).jobs.values()) {
|
|
228
|
+
let kept = 0;
|
|
229
|
+
for (const a of j.applied) {
|
|
230
|
+
if (!a.undone && Date.parse(a.at) >= since) out.push({ ...a, kept, reason: reasonOf({ cls: a.cls, why: a.why, kept }) });
|
|
231
|
+
if (!a.undone) kept++;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
214
234
|
return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
215
235
|
}
|
|
216
236
|
|
|
@@ -231,5 +251,5 @@ function restore(stateDir, { job, product }, actor, { now } = {}) {
|
|
|
231
251
|
|
|
232
252
|
module.exports = {
|
|
233
253
|
LEDGER, CLASSES, DRIVER_CLASS, PROPOSAL_CLASS, DEMOTE_DAYS, UNDO_DAYS, RATE_LIMIT, RATE_MIN, KINDS,
|
|
234
|
-
classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
|
|
254
|
+
classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, reasonOf, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
|
|
235
255
|
};
|
|
@@ -137,9 +137,14 @@ async function autoApply({ file, proposal, actor, ctx = {}, now, stateDir, produ
|
|
|
137
137
|
const cls = A.classOfDriver(p.what);
|
|
138
138
|
const d = A.decide({ stateDir, job: jobOf(p), product, cls, mode: m, undoable: UNDOABLE.has(p.what), now, settingsDir: ctx.settingsDir || null });
|
|
139
139
|
if (!d.apply) return { applied: false, why: d.why, cls };
|
|
140
|
+
// board AwB: a line of an artefact the PM edited is the PM's now; Claude's change to it waits as a proposal
|
|
141
|
+
if (p.what === 'artefact' && ctx.root) {
|
|
142
|
+
const AR = require('./artefacts.js');
|
|
143
|
+
try { if (AR.pmEdited(AR.fold(AR.readLines(AR.file(AR.dirOf(ctx.root)))), p.data || {})) return { applied: false, why: 'the PM edited this line, so Claude asks first', cls }; } catch { /* no artefacts yet: nothing edited */ }
|
|
144
|
+
}
|
|
140
145
|
const r = await decide('keep', { file, proposal, actor, ctx, now, auto: true });
|
|
141
146
|
if (!r.ok) return { applied: false, why: r.error, cls };
|
|
142
|
-
A.recordApplied(stateDir, { job: jobOf(p), product, ref: p.id, title: `${p.what}: ${p.why}`, cls }, { now });
|
|
147
|
+
A.recordApplied(stateDir, { job: jobOf(p), product, ref: p.id, title: `${p.what}: ${p.why}`, cls, ini: p.target && p.target.kind === 'initiative' ? p.target.id : null }, { now });
|
|
143
148
|
return { applied: true, why: d.why, cls, wrote: r.wrote };
|
|
144
149
|
} catch (e) { return { applied: false, why: 'the apply failed: ' + String((e && e.message) || e).slice(0, 160) }; }
|
|
145
150
|
}
|