create-pmos 0.539.0 → 0.540.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 +26 -14
- 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 +25 -0
- package/workspace/guide/agent-capabilities.md +2 -0
- package/workspace/guide/settings.md +1 -1
- package/workspace/guide/today.md +8 -4
- package/workspace/guide/workflows.md +14 -12
- package/workspace/ini-workflow-test.js +1 -1
- package/workspace/lib/ai-cli.js +12 -1
- package/workspace/lib/headless.js +75 -1
- package/workspace/lib/job-graph.js +2 -0
- package/workspace/lib/run-tokens.js +70 -0
- package/workspace/lib/today-cli.js +57 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-news.js +1 -1
- package/workspace/public/pm/cozy-onboard.js +2 -2
- package/workspace/public/pm/cozy-settings.js +42 -11
- package/workspace/public/pm/home-app.js +10 -1
- package/workspace/public/pm/ini-wf.js +3 -3
- package/workspace/public/pm/wf-page.css +26 -15
- package/workspace/public/pm/wf-page.js +96 -72
- package/workspace/public/premium-workflows.html +8 -23
- package/workspace/server.js +7 -2
- package/workspace/workflows-setup-test.js +50 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.540.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,31 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.540.0",
|
|
37
|
+
"at": "2026-11-08T04:40:52.541Z",
|
|
38
|
+
"f": 4,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1266,
|
|
42
|
+
"t": "Workflows folds into Settings, New workflow starts the normal chat (UI grill U1)",
|
|
43
|
+
"s": "Workflows folds into Settings, New workflow starts the normal chat (UI grill U1)",
|
|
44
|
+
"k": "new"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"n": 1267,
|
|
48
|
+
"t": "Pmos today ranks with Your move's rankMove (UI grill item 9)",
|
|
49
|
+
"s": "Pmos today ranks with Your move's rankMove (UI grill item 9)",
|
|
50
|
+
"k": "new"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"n": 1268,
|
|
54
|
+
"t": "Lean start-up for background runs and a per-run token log",
|
|
55
|
+
"s": "Lean start-up for background runs and a per-run token log",
|
|
56
|
+
"k": "new"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
35
60
|
{
|
|
36
61
|
"v": "0.539.0",
|
|
37
62
|
"at": "2026-11-08T04:03:50.219Z",
|
|
@@ -434,19 +459,6 @@
|
|
|
434
459
|
"k": "fix"
|
|
435
460
|
}
|
|
436
461
|
]
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
"v": "0.520.0",
|
|
440
|
-
"at": "2026-11-04T01:52:53.932Z",
|
|
441
|
-
"f": 4,
|
|
442
|
-
"prs": [
|
|
443
|
-
{
|
|
444
|
-
"n": 1216,
|
|
445
|
-
"t": "Every initiative has its own description",
|
|
446
|
-
"s": "Every initiative has its own description",
|
|
447
|
-
"k": "new"
|
|
448
|
-
}
|
|
449
|
-
]
|
|
450
462
|
}
|
|
451
463
|
]
|
|
452
464
|
}
|
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-08T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-08T04:40: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-08T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-08T04:40: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-08T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-08T04:40:50Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.540.0",
|
|
4
|
+
"at": "2026-11-08T04:40:52.541Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1266,
|
|
9
|
+
"t": "Workflows folds into Settings, New workflow starts the normal chat (UI grill U1)",
|
|
10
|
+
"s": "Workflows folds into Settings, New workflow starts the normal chat (UI grill U1)",
|
|
11
|
+
"k": "new"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"n": 1267,
|
|
15
|
+
"t": "Pmos today ranks with Your move's rankMove (UI grill item 9)",
|
|
16
|
+
"s": "Pmos today ranks with Your move's rankMove (UI grill item 9)",
|
|
17
|
+
"k": "new"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"n": 1268,
|
|
21
|
+
"t": "Lean start-up for background runs and a per-run token log",
|
|
22
|
+
"s": "Lean start-up for background runs and a per-run token log",
|
|
23
|
+
"k": "new"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
2
27
|
{
|
|
3
28
|
"v": "0.539.0",
|
|
4
29
|
"at": "2026-11-08T04:03:50.219Z",
|
|
@@ -19,6 +19,7 @@ This page lists every job, so you know what runs and why. Each row links to the
|
|
|
19
19
|
- **Few at a time.** A run shows at most 3 proposals. In a quiet week it shows nothing.
|
|
20
20
|
- **Tested first.** A new version of a job shows nothing until its replay passes: its own known cases, and the guard's own cases (a made-up quote, a missing source, a path outside the repository, a write key). Each of those must be dropped.
|
|
21
21
|
- **Your login, your connections.** A job runs as a background Claude session with your own login, model, profile and connectors. The workspace holds no password or token. `PMOS_HEADLESS=off` sends every job back to a terminal pane.
|
|
22
|
+
- **Lean start.** A job that reads none of your connectors starts with only the tools it uses: no MCP servers, no skills, no settings files and no `CLAUDE.md`. It still runs with your login and your model. This cuts the tokens each run reads by about half or more. A job that reads your connectors starts as before. `PMOS_LEAN_JOBS=off` starts every job the old way.
|
|
22
23
|
- **One queue.** Every background job waits for its turn in one queue. Each minute the jobs go in this order: what is due at a set time (schedules, the morning brief and day check, the data refresh, report schedules), then the Initiative Driver, then the deep drafts (core documents, Your impact, metric drafts and reads, grill, proposals), then the idle work (the Horizon scan, then the idle lab). What you ask for, such as Scan now or Prepare my day, starts at once and never waits in the queue.
|
|
23
24
|
- **One run for each initiative.** A background run never starts on an initiative that another background run is working on. It tries again a minute later.
|
|
24
25
|
- **Idle work waits for you to step away.** The idle work starts only when you have not used PMOS for 30 minutes, or in the last hour of your working day if you never stepped away. It also waits when 3 background runs are live, inside quiet hours, and at the spending limit.
|
|
@@ -75,6 +76,7 @@ When you ask an agent session to do a piece of work, it can finish it, including
|
|
|
75
76
|
## See what ran, and turn it off
|
|
76
77
|
|
|
77
78
|
- `pmos ai status`: whether each AI job is on, whether its replay passed, and what its last run filed. It also shows the keep rate of each job that files under ✦ for the last 14 days: how many you kept of the ones you decided, and how many wait. It shows each product too. A job with 3 or more decided and none kept is listed to pause. You decide: `pmos ai off <job>`.
|
|
79
|
+
- `pmos ai status` also shows the background runs of the last 7 days: for each kind of run, how many ran, the tokens each run read, and the cost. Lean and full starts show side by side.
|
|
78
80
|
- `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
|
|
79
81
|
- `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
|
|
80
82
|
|
|
@@ -14,7 +14,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
14
14
|
| General | The theme (Light, Dark or Auto), whether the Viewer opens as a column or a popup, the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
|
|
15
15
|
| Claude | The Claude profile that new sessions start with, the Anthropic API key for Claude's own runs, Sharpen prompts, and **Checks**: when Claude grills an initiative by itself and the monthly credit for its checks. |
|
|
16
16
|
| Connectors | Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
|
|
17
|
-
| 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. See [Workflows](workflows.md). |
|
|
17
|
+
| 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](workflows.md). |
|
|
18
18
|
| Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
|
|
19
19
|
|
|
20
20
|
## Update PMOS and the kit
|
package/workspace/guide/today.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "What waits for you, and pmos today"
|
|
4
4
|
description: "Where the workspace shows what waits for you (Your day in Home) and how pmos today prints the same kind of list from a terminal."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-08
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# What waits for you, and pmos today
|
|
@@ -26,7 +26,7 @@ A session that waits on you has a blue dot in Home's list, under its initiative.
|
|
|
26
26
|
|
|
27
27
|
## From a terminal
|
|
28
28
|
|
|
29
|
-
`pmos today` prints
|
|
29
|
+
`pmos today` prints **Your move**: the same list as Home, in the same order. Home and the command use one ranking.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
32
|
pmos today # the repository you are in
|
|
@@ -35,6 +35,10 @@ pmos today --json # the list as JSON
|
|
|
35
35
|
pmos today --root <dir> # read a repository folder without a server
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
With the workspace server running, the command
|
|
38
|
+
With the workspace server running, the command prints the rows of Your move, then the sessions that wait for you. Rows older than two weeks are counted on one "Older" line. When the board is still being read, the command waits up to 8 seconds.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Without the server, or when the board cannot be read, the command prints the Today cards instead, with the kind first (1 a gate is owed, 2 a session is waiting, 3 a step was returned to you, 4 work to check, 5 a breakdown to keep, 6 a capture, 7 a cycle review, 8 needs repair). Without the server it also prints a line that says it did not read the sessions.
|
|
41
|
+
|
|
42
|
+
The command prints "Nothing needs you" when the list is empty. It exits with 0 when it read the list, 1 when it could not read it, and 2 when you gave it an option it does not have.
|
|
43
|
+
|
|
44
|
+
The command reads `GET /api/today`, `GET /api/board-premium`, `GET /api/programs` and `GET /api/your-move`. None of them changes anything.
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Workflows: the stages each kind of initiative goes through"
|
|
4
4
|
description: "Settings › Workspaces › Workflows: the workflow list, the default workflow (the star), one numbered list of stages across To do, In progress and Done, the stage panel, Only when conditions, removing a stage in use, New workflow in the chat, moving initiatives to a simpler workflow, and the pmos workflow commands."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-08
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Workflows
|
|
9
9
|
|
|
10
10
|
A **workflow** is the list of stages that one kind of initiative goes through ([D99](/DECISIONS.md)). PMOS ships one workflow, **Product feature**: Triage, Discover, Plan, Prioritize, Build, ◆ Deliver, Monitor and ◆ Evaluate. You make any other workflow, for example a tender or a vendor onboarding.
|
|
11
11
|
|
|
12
|
-
Open it from **Menu › Settings › Workspaces**, then the **Workflows ›** row. The address
|
|
12
|
+
Open it from **Menu › Settings › Workspaces**, then the **Workflows ›** row. It opens inside Settings, which then takes the whole window. **‹** goes back to Workspaces. The old address `/premium-workflows.html` still works: it opens Home with Settings on Workflows.
|
|
13
13
|
|
|
14
|
-
## The
|
|
14
|
+
## The panel
|
|
15
15
|
|
|
16
|
-
- **The list** on the left shows each workflow and how many initiatives use it. **+** starts a new workflow. An archived workflow shows last, under **Archived**.
|
|
16
|
+
- **The list** on the left shows each workflow and how many initiatives use it. **+** starts a new workflow in the chat. Under the list you can also start one **blank** (only Triage) or **from a copy** of a workflow. An archived workflow shows last, under **Archived**.
|
|
17
17
|
- **The star** on a row marks the **default workflow**: the workflow a new initiative starts on. Point at a row, or tab to it, to see its star, and press it to make that workflow the default. The toast has **Undo**. Product feature is the default until you pick another, and it can be the default again.
|
|
18
18
|
- **The workflow** is one numbered list of stages, in three columns: **To do**, **In progress** and **Done**. Drag a stage to change its place or its column. **Add a stage** adds one at the end of that column. The dashed **Won't do · Archived** column is in every workflow: any initiative can go there from any stage, and come back to Triage.
|
|
19
19
|
- **Triage** is always the first stage, in To do.
|
|
@@ -31,7 +31,7 @@ A new initiative starts in Triage on the default workflow. It does not matter ho
|
|
|
31
31
|
|
|
32
32
|
## A stage
|
|
33
33
|
|
|
34
|
-
Tap a stage to open it in the
|
|
34
|
+
Tap a stage to open it in the Viewer, beside the workflow. Escape closes the stage first, then Settings. Tap its name at the top to rename it. The panel has:
|
|
35
35
|
|
|
36
36
|
- **Category**: To do, In progress or Done.
|
|
37
37
|
- **Output**: what finishes the stage, and its kind. **Document** (PMOS drafts it from the template), **Jira tickets**, **Sign-off** or **Checklist only**. The kind sets how the Board counts progress.
|
|
@@ -51,20 +51,22 @@ If initiatives are in the stage, PMOS asks where they move. **Move and remove**
|
|
|
51
51
|
|
|
52
52
|
## New workflow
|
|
53
53
|
|
|
54
|
-
Press **+**.
|
|
54
|
+
Press **+**. Settings closes and Home's chat opens, scoped **In: New workflow**. It is the same chat as every other conversation, not a second one. Tell Claude how the work goes, in your own words, and add a policy or an old checklist if you have one. Claude drafts the stages and explains each choice in the chat. Answer its question or ask for a change, and it drafts again.
|
|
55
|
+
|
|
56
|
+
The draft waits in **Settings › Workspaces › Workflows**, as a row at the end of the list with the draft's name, marked **draft**, until you create it. Press that row to see the draft in the Viewer:
|
|
55
57
|
|
|
56
58
|
- **Create workflow** saves the draft.
|
|
57
|
-
- **Edit by hand** opens the draft
|
|
58
|
-
-
|
|
59
|
+
- **Edit by hand** opens the draft in the panel, so you can change it before you create it.
|
|
60
|
+
- **Continue in the chat** goes back to the same conversation.
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
New workflow… in an initiative's workflow picker starts the same conversation.
|
|
61
63
|
|
|
62
64
|
## Move initiatives to a simpler workflow
|
|
63
65
|
|
|
64
66
|
To use fewer stages, copy Product feature and make the copy simpler. For example, use Discovery, Implementation and Evaluation.
|
|
65
67
|
|
|
66
68
|
- **Claude's proposal.** Claude shows where each old stage goes, once, as a ✦ in **New for you**. For example: Triage, Discover, Plan and Prioritize go into Discovery. Each row shows how many initiatives and tasks go into that stage. Press ✓ to move all the initiatives. Press ✕ to leave them where they are.
|
|
67
|
-
- **The bridge.** The
|
|
69
|
+
- **The bridge.** The new workflow in Settings › Workflows shows **Replaces Product feature**: each old stage, with the stage it goes into. Change a stage there. The change is saved at once, and every later switch from the old workflow uses it.
|
|
68
70
|
- **One initiative.** On the initiative, open the workflow picker and pick the new workflow. The dialog shows the old stages in each new stage. **Change where a stage goes** shows one picker for each old stage. **This initiative** or **All N** sets which initiatives move.
|
|
69
71
|
- **What moves.** An initiative's stage and its tasks move together. Each task goes into the stage that its old stage goes into, on Home, on the Board and in `pmos task list`. A task goes under **Not in a stage** only when it had no stage before the move. Ticked items from the old stages count in the new stage. The new stage counts its days from the day its first old stage began. The stage card shows the days in each old stage.
|
|
70
72
|
- **Jira tickets.** The tickets go under the stage whose output is Jira tickets, whatever its name.
|
|
@@ -72,12 +74,12 @@ To use fewer stages, copy Product feature and make the copy simpler. For example
|
|
|
72
74
|
|
|
73
75
|
## The pmos workflow commands
|
|
74
76
|
|
|
75
|
-
An agent writes a draft or a reading with these commands, and moves an initiative along its workflow when you ask. It never saves, copies or archives a workflow: those are your presses
|
|
77
|
+
An agent writes a draft or a reading with these commands, and moves an initiative along its workflow when you ask. It never saves, copies or archives a workflow: those are your presses in Settings › Workflows.
|
|
76
78
|
|
|
77
79
|
- `pmos workflow list` names every workflow you can pick and marks the default one: the ones of this repository, then the ones you saved in Settings › Workspaces › Workflows (marked **saved in** and the workspace name) and in your other open workspaces.
|
|
78
80
|
- `pmos workflow show <id>` shows one workflow, its stages numbered. It finds a workflow in any of those libraries.
|
|
79
81
|
- An initiative chat reads workflows only through these commands. It does not search the repository's files for a workflow, and it does not use a lane, such as `feature`, in place of the initiative's workflow. When it cannot find a workflow, it says so and asks you.
|
|
80
|
-
- `pmos workflow draft --file <path>` writes the draft that the
|
|
82
|
+
- `pmos workflow draft --file <path>` writes the draft that waits as the draft row in Settings › Workflows. `--note` adds a line.
|
|
81
83
|
- `pmos workflow show-draft` shows the draft that is open.
|
|
82
84
|
- `pmos workflow judge --board <id> --id <initiative> --stage <key> --runs yes|no|unsure --why <reason> --cite <where>` records PMOS's reading of an Only when stage. **unsure** makes PMOS ask you. `--undo` takes a reading back.
|
|
83
85
|
- `pmos workflow of <initiative>` shows the workflow the initiative runs, its current stage, and each stage numbered as done, current or skipped. It reads the same row as the Board.
|
|
@@ -177,7 +177,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
177
177
|
await shot(D.page, 'picker-1440-dark');
|
|
178
178
|
ok('W8 dark: the picker draws, no page error', D.up && !D.errors.length, D.errors.join(' | '));
|
|
179
179
|
await D.page.click('.hi-pop [data-wf-new]');
|
|
180
|
-
ok('W3 New workflow… opens
|
|
180
|
+
ok('W3 New workflow… opens Home\'s chat scoped "New workflow", where the PM describes it and PMOS drafts it', await until(() => D.page.evaluate(() => /New workflow/.test((document.querySelector('.hm-chip') || {}).textContent || '') && /Tell me how this work goes/.test(document.body.innerText))), D.page.url());
|
|
181
181
|
await D.ctx.close();
|
|
182
182
|
finish();
|
|
183
183
|
})();
|
package/workspace/lib/ai-cli.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* pmos ai status [--json] the switch, each job's replay state and its last run, and the keep rate of every ✦ job (OS evaluation
|
|
5
5
|
* T1): the last 14 days, per job and per product, from each hosted product's proposals.jsonl. A job with
|
|
6
6
|
* 3 or more decided and none kept is listed to pause; the PM pauses it (`pmos ai off <job>`), never this.
|
|
7
|
+
* It also shows the token log of the background runs, last 7 days (lib/run-tokens.js): per kind and launch
|
|
8
|
+
* (lean or full), runs, tokens read per run, turns and cost.
|
|
7
9
|
* pmos ai off [<job>] turn every AI job off, or one job
|
|
8
10
|
* pmos ai on [<job>] turn every AI job on again, or one job
|
|
9
11
|
* pmos ai log [<job>] [--n N] the last audit lines: filed, dropped (with why), held, off, replay
|
|
@@ -55,7 +57,9 @@ function run(argv, { say = (s) => console.log(s), env = process.env, stateDir =
|
|
|
55
57
|
const s = AG.status({ stateDir: dir, settingsDir: dir, env });
|
|
56
58
|
let keep = null;
|
|
57
59
|
try { keep = keepOf(roots || rootsOf(dir, cwd), now); } catch { keep = null; }
|
|
58
|
-
|
|
60
|
+
let tokens = null;
|
|
61
|
+
try { tokens = require('./run-tokens.js').summary(dir, { now }); } catch { tokens = null; }
|
|
62
|
+
if (flag(args, 'json')) { say(JSON.stringify({ ...s, keep, tokens })); return 0; }
|
|
59
63
|
say(`AI jobs: ${s.on ? 'on' : 'off'}${s.settingsOff.length ? ' · off one by one: ' + s.settingsOff.join(', ') : ''}`);
|
|
60
64
|
if (!s.jobs.length) say(' no job has run yet');
|
|
61
65
|
for (const j of s.jobs) {
|
|
@@ -72,6 +76,13 @@ function run(argv, { say = (s) => console.log(s), env = process.env, stateDir =
|
|
|
72
76
|
if (keep.pause.length) say(` To pause (you decide): ${keep.pause.map((j) => '`pmos ai off ' + j + '`').join(', ')}`);
|
|
73
77
|
if (keep.unplaced) say(` ${keep.unplaced} older ✕ could not be placed on a job (a computed proposal that was never filed)`);
|
|
74
78
|
}
|
|
79
|
+
if (tokens && tokens.runs) {
|
|
80
|
+
const k = (n) => (n >= 1e6 ? (n / 1e6).toFixed(1) + 'M' : n >= 1000 ? Math.round(n / 1000) + 'k' : String(n));
|
|
81
|
+
const usd = (n) => '$' + n.toFixed(2);
|
|
82
|
+
const tot = tokens.rows.reduce((a, r) => ({ c: a.c + r.context, o: a.o + r.output, d: a.d + r.costUsd }), { c: 0, o: 0, d: 0 });
|
|
83
|
+
say(`Background runs, last ${tokens.days} days: ${tokens.runs} runs · ${k(tot.c)} tokens read · ${k(tot.o)} written · ${usd(tot.d)}`);
|
|
84
|
+
for (const r of tokens.rows) say(` ${r.kind} (${r.lean ? 'lean' : 'full'}): ${r.runs} runs · ${k(r.perRun)} read per run · ${r.turns} turns · ${usd(r.costUsd)}`);
|
|
85
|
+
}
|
|
75
86
|
return 0;
|
|
76
87
|
}
|
|
77
88
|
if (verb === 'log') {
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* for the skill kind, the folders the run may write in, from skillWriteDirs)
|
|
9
9
|
* skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
|
|
10
10
|
* parseResult(stdout) → { ok, text, isError, turns, durationMs, costUsd, denied[] }
|
|
11
|
+
* usageOf(stdout) → { tokens, model } | null the token counts of the same result line, for lib/run-tokens.js
|
|
12
|
+
* leanOf(kind, env) · builtinsOf(tools) · userModelOf(env) the lean launch (argsFor lean: true), see LEAN LAUNCH
|
|
11
13
|
* streamLines(line) → { log: [lines], result: object|null } one stream-json event, for the live log
|
|
12
14
|
* logLines(result, exitCode) → the lines the read-only log pane shows at the end
|
|
13
15
|
* outcomeOf(result, { code, signal, timedOut, stopped, timeoutMin }) → { ok, headline, why, turns, durationMs, denied } what the run card says
|
|
@@ -364,7 +366,47 @@ function kindFor({ agent, origin, skill, env } = {}) {
|
|
|
364
366
|
return null;
|
|
365
367
|
}
|
|
366
368
|
|
|
367
|
-
|
|
369
|
+
/* LEAN LAUNCH (token efficiency build, Wawan 2026-11-08). A plain `claude -p` loads about 63k tokens of fixed context on every turn: every
|
|
370
|
+
* built-in tool, every MCP server's tools, the skills and slash commands, the user and project settings and CLAUDE.md. A background run
|
|
371
|
+
* needs none of that beyond its own tools. Measured in the cloud: 63.0k → 15.7k tokens per turn, a 3-turn task 196k → 45k, same answer.
|
|
372
|
+
* The four flags only pay together: `--tools` alone, with the MCP servers still on, went UP to 66k.
|
|
373
|
+
* --tools <the kind's built-ins> only the built-in tools its --allowedTools names (Bash for `Bash(pmos *)`), never Task, Skill or TodoWrite
|
|
374
|
+
* --disable-slash-commands no skills or commands in the prompt
|
|
375
|
+
* --setting-sources= no user, project or local settings, and no CLAUDE.md (one argv token: an empty "" can be lost on Windows)
|
|
376
|
+
* --strict-mcp-config no MCP server, for every kind that reads no connector
|
|
377
|
+
* Because the PM's user settings no longer load, the server passes the model of those settings explicitly (userModelOf) when no tier chose one.
|
|
378
|
+
* A kind that reads the PM's connectors (CONNECTOR_READ_KINDS) stays on the full launch until a run on the PM's own computer shows its connector
|
|
379
|
+
* tools still load without the settings. PMOS_LEAN_JOBS: off = every kind on the full launch; all = connector kinds lean too, without
|
|
380
|
+
* --strict-mcp-config (for that check); anything else = the default. */
|
|
381
|
+
const LEAN_FLAGS = Object.freeze(['--disable-slash-commands', '--setting-sources=']);
|
|
382
|
+
/** Does this kind launch lean? (PMOS_LEAN_JOBS in env, see above) */
|
|
383
|
+
function leanOf(kind, env) {
|
|
384
|
+
const v = String(((env || {}).PMOS_LEAN_JOBS) || '').trim().toLowerCase();
|
|
385
|
+
if (/^(off|0|false|no)$/.test(v)) return false;
|
|
386
|
+
if (!TOOLS[kind]) return false;
|
|
387
|
+
return v === 'all' || !CONNECTOR_READ_KINDS.includes(kind);
|
|
388
|
+
}
|
|
389
|
+
/** The built-in tool names in an --allowedTools list: `Bash(pmos *)` → Bash, `Write(/x/**)` → Write; connector tools are not built-ins. */
|
|
390
|
+
function builtinsOf(tools) {
|
|
391
|
+
const out = [];
|
|
392
|
+
for (const t of tools || []) {
|
|
393
|
+
const m = /^([A-Z][A-Za-z]+)(?:\(|$)/.exec(String(t || ''));
|
|
394
|
+
if (m && !out.includes(m[1])) out.push(m[1]);
|
|
395
|
+
}
|
|
396
|
+
return out;
|
|
397
|
+
}
|
|
398
|
+
/** The model in the PM's Claude Code user settings (<CLAUDE_CONFIG_DIR or ~/.claude>/settings.json), or null. A lean run loads no settings, so
|
|
399
|
+
* the server passes this one explicitly and the run keeps the model it had. */
|
|
400
|
+
function userModelOf(env) {
|
|
401
|
+
const e = env || process.env;
|
|
402
|
+
const dir = e.CLAUDE_CONFIG_DIR ? String(e.CLAUDE_CONFIG_DIR) : path.join(e.HOME || require('os').homedir(), '.claude');
|
|
403
|
+
try {
|
|
404
|
+
const m = JSON.parse(fs.readFileSync(path.join(dir, 'settings.json'), 'utf8')).model;
|
|
405
|
+
return typeof m === 'string' && /^[\w.\[\]:-]{1,80}$/.test(m.trim()) ? m.trim() : null;
|
|
406
|
+
} catch { return null; }
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [], budgetUsd = null, connectorTools = [], team = null, lean = false } = {}) {
|
|
368
410
|
if (!TOOLS[kind]) throw new Error('unknown headless kind: ' + kind);
|
|
369
411
|
let tools = TOOLS[kind].slice();
|
|
370
412
|
// A role run: the role's own tools. Its writable paths (auto mode only) are each a folder ("/" at the end: it and what is under it) or one file.
|
|
@@ -405,6 +447,10 @@ function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [], budgetUs
|
|
|
405
447
|
// report draft stopped after reading ("Plan mode is on, and the draft step writes files") and wrote nothing. dontAsk runs the list above and denies
|
|
406
448
|
// the rest, which is what this file already promises; it is not a bypass.
|
|
407
449
|
const argv = ['-p', '--output-format', 'stream-json', '--verbose', '--no-session-persistence', '--permission-mode', 'dontAsk', '--append-system-prompt', DENIED_RULE, ...modelArgs, '--allowedTools', tools.join(',')];
|
|
450
|
+
if (lean) {
|
|
451
|
+
argv.push('--tools', builtinsOf(tools).join(','), ...LEAN_FLAGS);
|
|
452
|
+
if (!CONNECTOR_READ_KINDS.includes(kind)) argv.push('--strict-mcp-config');
|
|
453
|
+
}
|
|
408
454
|
// A run with a budget (a grill run, lib/grill.js budgetFor) stops at it, so the monthly credit cap holds
|
|
409
455
|
const b = Number(budgetUsd);
|
|
410
456
|
if (budgetUsd != null && Number.isFinite(b) && b > 0) argv.push('--max-budget-usd', String(b));
|
|
@@ -439,6 +485,32 @@ function jsonOf(line) {
|
|
|
439
485
|
try { const o = JSON.parse(t); return o && typeof o === 'object' ? o : null; } catch { return null; }
|
|
440
486
|
}
|
|
441
487
|
|
|
488
|
+
/** The token counts of a result's `usage`: { input, cacheCreate, cacheRead, output }, or null when it has none. Context read per run =
|
|
489
|
+
* input + cacheCreate + cacheRead (summed over every turn by Claude Code). */
|
|
490
|
+
function tokensOf(u) {
|
|
491
|
+
if (!u || typeof u !== 'object') return null;
|
|
492
|
+
const n = (v) => (Number.isFinite(v) && v >= 0 ? v : 0);
|
|
493
|
+
const t = { input: n(u.input_tokens), cacheCreate: n(u.cache_creation_input_tokens), cacheRead: n(u.cache_read_input_tokens), output: n(u.output_tokens) };
|
|
494
|
+
return t.input + t.cacheCreate + t.cacheRead + t.output > 0 ? t : null;
|
|
495
|
+
}
|
|
496
|
+
/** The model that did most of a run's work (`modelUsage`, by output tokens), or null. */
|
|
497
|
+
function modelOf(mu) {
|
|
498
|
+
if (!mu || typeof mu !== 'object') return null;
|
|
499
|
+
let best = null, top = -1;
|
|
500
|
+
for (const [k, v] of Object.entries(mu)) { const out = v && Number.isFinite(v.outputTokens) ? v.outputTokens : 0; if (out > top) { best = k; top = out; } }
|
|
501
|
+
return best;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/** The token counts and model of the result on stdout (the same line parseResult reads), or null. */
|
|
505
|
+
function usageOf(stdout) {
|
|
506
|
+
const lines = String(stdout || '').trim().split('\n');
|
|
507
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
508
|
+
const o = jsonOf(lines[i]);
|
|
509
|
+
if (o && (o.type === 'result' || (!o.type && o.usage))) { const tokens = tokensOf(o.usage); return tokens ? { tokens, model: modelOf(o.modelUsage) } : null; }
|
|
510
|
+
}
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
|
|
442
514
|
/** The result object on stdout: the whole of it (`--output-format json`), else the last line whose type is `result`
|
|
443
515
|
* (`stream-json`), else the last line that parses. Anything unreadable is not a result. */
|
|
444
516
|
function parseResult(stdout) {
|
|
@@ -560,3 +632,5 @@ function runEnvOf(extra) {
|
|
|
560
632
|
}
|
|
561
633
|
|
|
562
634
|
module.exports = { CONNECTOR_READ_KINDS, CONNECTOR_READ_SEED, DENIED_RULE, HEADLESS_ENV, headlessEnv, connectorReads, initTools, denialGuard, HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, METRIC_DRAFT_ORIGINS, IMPACT_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff, RUN_ENV, runEnvOf };
|
|
635
|
+
// the lean launch and the token counts (token efficiency build, 2026-11-08)
|
|
636
|
+
const LEAN_API = Object.assign(module.exports, { LEAN_FLAGS, leanOf, builtinsOf, userModelOf, tokensOf, modelOf, usageOf });
|
|
@@ -38,6 +38,8 @@ const LEDGERS = Object.freeze({
|
|
|
38
38
|
r('lib/proposal-runs.js', 'PR.lessonsOf', "the task checks' next run: dropped proposals and the PM's reasons")] },
|
|
39
39
|
[`<runtime>/${audit}`]: { concept: 'ai-audit', owner: 'lib/ai-guard.js', readers: [
|
|
40
40
|
r('lib/ai-cli.js', 'AG.readAudit', '`pmos ai log` and `pmos ai status`')] },
|
|
41
|
+
'<runtime>/run-tokens.jsonl': { concept: 'run-tokens', owner: 'lib/run-tokens.js', readers: [
|
|
42
|
+
r('lib/ai-cli.js', 'run-tokens.js', '`pmos ai status`: tokens read per background run, lean and full')] },
|
|
41
43
|
'<runtime>/bg-queue.jsonl': { concept: 'background-turns', owner: 'lib/bg-queue.js', readers: [
|
|
42
44
|
r('lib/routes-lab.js', 'bgQueue.record', 'Intelligence › Lab: what Claude did in the background')] },
|
|
43
45
|
'<runtime>/grill-runs.jsonl': { concept: 'grill-spend', owner: 'lib/grill.js', readers: [
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* run-tokens.js — the token log of background runs (token efficiency build, Wawan 2026-11-08).
|
|
3
|
+
*
|
|
4
|
+
* PMOS did not keep what a background run cost: lib/headless.js parseResult read the cost and dropped the token counts. Each finished
|
|
5
|
+
* headless run now writes one line to <state>/run-tokens.jsonl:
|
|
6
|
+
* { at, kind, origin, model, lean, turns, input, cacheCreate, cacheRead, output, costUsd, ok }
|
|
7
|
+
* origin is the part of the session origin before its first ':' (`propose`, `grill`, `schedule`), never an id or a prompt. No line holds
|
|
8
|
+
* a prompt, an answer or a key.
|
|
9
|
+
*
|
|
10
|
+
* record(stateDir, { kind, origin, lean, result, ok }) → the line written, or null (no tokens in the result: nothing is written)
|
|
11
|
+
* read(stateDir, { sinceMs?, limit? }) → [line]
|
|
12
|
+
* summary(stateDir, { now?, days? }) → { days, runs, rows: [{ kind, lean, runs, turns, context, output, costUsd, perRun }] }
|
|
13
|
+
* context = input + cacheCreate + cacheRead, the tokens the runs read; perRun = context / runs, rounded. One row per kind and launch
|
|
14
|
+
* (lean or full), so the before and after of the lean launch sit side by side. `pmos ai status` shows it.
|
|
15
|
+
*
|
|
16
|
+
* The log never stops a run: a failed append is lost, never thrown. */
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
|
|
20
|
+
const FILE = 'run-tokens.jsonl';
|
|
21
|
+
const DAY = 86400000;
|
|
22
|
+
const num = (v) => (Number.isFinite(v) && v >= 0 ? v : 0);
|
|
23
|
+
|
|
24
|
+
function record(stateDir, { kind, origin, lean = false, result, ok = null } = {}) {
|
|
25
|
+
const t = result && result.tokens;
|
|
26
|
+
if (!stateDir || !t) return null;
|
|
27
|
+
const line = {
|
|
28
|
+
at: new Date().toISOString(),
|
|
29
|
+
kind: String(kind || ''),
|
|
30
|
+
origin: String(origin || '').split(':')[0].slice(0, 40) || null,
|
|
31
|
+
model: result.model || null,
|
|
32
|
+
lean: !!lean,
|
|
33
|
+
turns: Number.isFinite(result.turns) ? result.turns : null,
|
|
34
|
+
input: num(t.input), cacheCreate: num(t.cacheCreate), cacheRead: num(t.cacheRead), output: num(t.output),
|
|
35
|
+
costUsd: Number.isFinite(result.costUsd) ? Math.round(result.costUsd * 10000) / 10000 : null,
|
|
36
|
+
ok: ok == null ? null : !!ok,
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
40
|
+
fs.appendFileSync(path.join(stateDir, FILE), JSON.stringify(line) + '\n', { mode: 0o600 });
|
|
41
|
+
} catch { return null; }
|
|
42
|
+
return line;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function read(stateDir, { sinceMs = 0, limit = 5000 } = {}) {
|
|
46
|
+
let text = '';
|
|
47
|
+
try { text = fs.readFileSync(path.join(stateDir, FILE), 'utf8'); } catch { return []; }
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const s of text.split('\n')) {
|
|
50
|
+
if (!s.trim()) continue;
|
|
51
|
+
try { const o = JSON.parse(s); if (o && (!sinceMs || Date.parse(o.at) >= sinceMs)) out.push(o); } catch { /* a torn line */ }
|
|
52
|
+
}
|
|
53
|
+
return out.slice(-limit);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function summary(stateDir, { now = Date.now(), days = 7 } = {}) {
|
|
57
|
+
const lines = read(stateDir, { sinceMs: now - days * DAY });
|
|
58
|
+
const by = new Map();
|
|
59
|
+
for (const l of lines) {
|
|
60
|
+
const k = `${l.kind}\u0000${l.lean ? 1 : 0}`;
|
|
61
|
+
const r = by.get(k) || { kind: l.kind, lean: !!l.lean, runs: 0, turns: 0, context: 0, output: 0, costUsd: 0 };
|
|
62
|
+
r.runs++; r.turns += num(l.turns); r.context += num(l.input) + num(l.cacheCreate) + num(l.cacheRead); r.output += num(l.output); r.costUsd += num(l.costUsd);
|
|
63
|
+
by.set(k, r);
|
|
64
|
+
}
|
|
65
|
+
const rows = [...by.values()].map((r) => ({ ...r, costUsd: Math.round(r.costUsd * 100) / 100, perRun: Math.round(r.context / r.runs) }))
|
|
66
|
+
.sort((a, b) => b.context - a.context || a.kind.localeCompare(b.kind) || Number(a.lean) - Number(b.lean));
|
|
67
|
+
return { days, runs: lines.length, rows };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = { FILE, record, read, summary };
|
|
@@ -19,9 +19,12 @@ const COMMANDS = { today: [] };
|
|
|
19
19
|
const USAGE = [
|
|
20
20
|
'usage: pmos today [--ws <id>] [--json]',
|
|
21
21
|
' pmos today --root <dir> [--json] [--wait]',
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
22
|
+
'With a workspace server running, prints Your move: the list Home shows, in the same order (public/pm/move-rank.js rankMove):',
|
|
23
|
+
'an overdue outcome verdict, a grill finding on shipped work, a meeting change, a finding on work ahead, a key result with no',
|
|
24
|
+
'reading, then the rest Claude proposes, one row per initiative. Rows older than 14 days fold under "Older".',
|
|
25
|
+
'Without a server it reads the repository and prints the Today cards, ranked by kind (1 a gate is owed, 2 a session is',
|
|
26
|
+
'waiting, 3 a step was returned to you, 4 work to check, 5 a breakdown to keep, 6 a capture, 7 a cycle review, 8 needs',
|
|
27
|
+
'repair). It does not read sessions then.',
|
|
25
28
|
'Without a server the Cycle review and missing-anchor cards need the initiative records read, which takes time: they show',
|
|
26
29
|
'as pending. Add --wait to read them now (about a quarter of a second per record).',
|
|
27
30
|
];
|
|
@@ -35,6 +38,46 @@ function repoRoot(cwd) {
|
|
|
35
38
|
catch { return cwd; }
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/* YOUR MOVE (UI grill item 9, "one truth for what needs me"): with a server, `pmos today` ranks with the function Home's Your move uses,
|
|
42
|
+
* on the answers Home reads: the board with its ✦ (GET /api/board-premium), the programs (GET /api/programs) and the product's GET
|
|
43
|
+
* /api/your-move. The board derives in the background (202 "reading"): it asks again for up to WAIT_MS, then falls back to the cards. */
|
|
44
|
+
const WAIT_MS = 8000;
|
|
45
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
46
|
+
async function moveOf(call, ws, { wait = WAIT_MS } = {}) {
|
|
47
|
+
const q = '?ws=' + encodeURIComponent(ws);
|
|
48
|
+
let b = null;
|
|
49
|
+
for (const t0 = Date.now(); ;) {
|
|
50
|
+
b = await call('GET', '/api/board-premium' + q);
|
|
51
|
+
if (!b || b.ok === false || b.state !== 'reading' || Date.now() - t0 >= wait) break;
|
|
52
|
+
await sleep(500);
|
|
53
|
+
}
|
|
54
|
+
if (!b || !b.ok || !b.model) return null;
|
|
55
|
+
const M = b.model, I = M.initiatives || {};
|
|
56
|
+
const rows = (I.list && I.list.rows) || M.rows || [];
|
|
57
|
+
const pg = await call('GET', '/api/programs');
|
|
58
|
+
const ym = await call('GET', '/api/your-move' + q);
|
|
59
|
+
const MR = await import(require('url').pathToFileURL(path.join(__dirname, '..', 'public', 'pm', 'move-rank.js')).href);
|
|
60
|
+
const r = MR.rankMove({
|
|
61
|
+
products: [{ ws, name: M.name || '', board: (M.board && M.board.id) || '', rows }],
|
|
62
|
+
programs: (pg && pg.ok && pg.programs) || [],
|
|
63
|
+
move: ym && ym.ok ? { [ws]: { verdicts: ym.verdicts || [], kr: ym.kr || null } } : {},
|
|
64
|
+
calls: [], now: Date.now(),
|
|
65
|
+
});
|
|
66
|
+
const slim = (x) => ({ key: x.key, rank: x.rank, kind: x.kind, title: x.title, sub: x.sub || '', tag: x.tag || '', age: x.age || '', ini: x.ini || null, yes: x.yes || '', alt: x.alt || '' });
|
|
67
|
+
return { ok: true, ws, source: 'your-move', count: r.rows.length, rows: r.rows.map(slim), older: r.older.map(slim) };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function printMove(say, mv, cards) {
|
|
71
|
+
const waiting = ((cards && cards.cards) || []).filter((c) => c.kind === 2);
|
|
72
|
+
const n = mv.count + waiting.length;
|
|
73
|
+
say(`${n} ${n === 1 ? 'needs' : 'need'} you`);
|
|
74
|
+
for (const r of mv.rows) say(`· ${r.title}${r.sub ? ' — ' + r.sub : ''}${r.age ? ' · ' + r.age : ''}${r.ini ? ' · ' + r.ini : ''}`);
|
|
75
|
+
for (const c of waiting) say(`· ${c.cause}${c.initiative_id ? ' · ' + c.initiative_id : ''}`);
|
|
76
|
+
if (mv.older.length) say(`Older: ${mv.older.length} more, filed more than 14 days ago.`);
|
|
77
|
+
for (const bn of (cards && cards.banner) || []) say(`! ${bn.source}: ${bn.error}`);
|
|
78
|
+
if (!n) say(mv.older.length ? 'Nothing new needs you.' : 'Nothing needs you.');
|
|
79
|
+
}
|
|
80
|
+
|
|
38
81
|
function print(say, out, { sessions }) {
|
|
39
82
|
say(`${out.count} ${out.count === 1 ? 'needs' : 'need'} you`);
|
|
40
83
|
for (const c of out.cards) {
|
|
@@ -91,9 +134,19 @@ async function run(argv, { say, call }) {
|
|
|
91
134
|
} finally { rowsLib.setBackground(was); }
|
|
92
135
|
}
|
|
93
136
|
if (!out.ok) { say('✗ ' + out.error); return 1; }
|
|
137
|
+
if (sessions) {
|
|
138
|
+
let mv = null;
|
|
139
|
+
try { mv = await moveOf(call, out.ws); } catch { mv = null; }
|
|
140
|
+
if (mv) {
|
|
141
|
+
const waiting = (out.cards || []).filter((c) => c.kind === 2);
|
|
142
|
+
if (f.json) say(JSON.stringify({ ...mv, sessions: waiting, banner: out.banner || [] }));
|
|
143
|
+
else printMove(say, mv, out);
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
94
147
|
if (f.json) say(JSON.stringify(out));
|
|
95
148
|
else print(say, out, { sessions });
|
|
96
149
|
return 0;
|
|
97
150
|
}
|
|
98
151
|
|
|
99
|
-
module.exports = { run, COMMANDS, USAGE };
|
|
152
|
+
module.exports = { run, COMMANDS, USAGE, moveOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.540.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.540.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED