create-pmos 0.548.0 → 0.549.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 +14 -26
- 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 +13 -0
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/programs.md +2 -0
- package/workspace/guide/settings-and-switches.md +15 -1
- package/workspace/lib/artefacts.js +38 -1
- package/workspace/lib/autonomy.js +84 -6
- package/workspace/lib/board-pack-route.js +5 -0
- package/workspace/lib/board-pack.js +7 -1
- package/workspace/lib/routes-artefacts.js +22 -0
- package/workspace/lib/routes-autonomy.js +11 -2
- package/workspace/lib/settings-store.js +5 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-board.css +6 -0
- package/workspace/public/pm/cozy-ev.css +5 -0
- package/workspace/public/pm/cozy-settings.js +47 -4
- package/workspace/public/pm/good-morning.js +3 -2
- package/workspace/public/pm/home-app.js +21 -8
- package/workspace/public/pm/readonly.js +18 -0
- package/workspace/public/pm/story.css +8 -0
- package/workspace/public/pm/story.js +39 -0
- package/workspace/skills/report-weekly.skill +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.549.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,19 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.549.0",
|
|
37
|
+
"at": "2026-11-10T07:06:56.286Z",
|
|
38
|
+
"f": 4,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1277,
|
|
42
|
+
"t": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
|
|
43
|
+
"s": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
|
|
44
|
+
"k": "new"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
35
48
|
{
|
|
36
49
|
"v": "0.548.0",
|
|
37
50
|
"at": "2026-11-10T02:35:02.323Z",
|
|
@@ -350,31 +363,6 @@
|
|
|
350
363
|
"k": "new"
|
|
351
364
|
}
|
|
352
365
|
]
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"v": "0.529.0",
|
|
356
|
-
"at": "2026-11-04T13:14:44.790Z",
|
|
357
|
-
"f": 4,
|
|
358
|
-
"prs": [
|
|
359
|
-
{
|
|
360
|
-
"n": 1243,
|
|
361
|
-
"t": "A look change from a report's chat becomes its next look, kept with ✓ and redrawn into the open draft; the drafting session's answer shows",
|
|
362
|
-
"s": "A look change from a report's chat becomes its next look, kept with ✓ and redrawn into the open draft; the drafting session's answer shows",
|
|
363
|
-
"k": "fix"
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
"n": 1245,
|
|
367
|
-
"t": "The Lab's background record says in plain words what Claude did, what came out and when",
|
|
368
|
-
"s": "The Lab's background record says in plain words what Claude did, what came out and when",
|
|
369
|
-
"k": "fix"
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
"n": 1244,
|
|
373
|
-
"t": "Meeting player, Jev crop display and word fix A",
|
|
374
|
-
"s": "Meeting player, Jev crop display and word fix A",
|
|
375
|
-
"k": "new"
|
|
376
|
-
}
|
|
377
|
-
]
|
|
378
366
|
}
|
|
379
367
|
]
|
|
380
368
|
}
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-10T07:06:52Z"}
|
|
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-10T07:06:52Z"}
|
|
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-10T07:06:52Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.549.0",
|
|
4
|
+
"at": "2026-11-10T07:06:56.286Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1277,
|
|
9
|
+
"t": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
|
|
10
|
+
"s": "The story so far on the product page and shared Board; Settings › Claude says how Claude decides",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.548.0",
|
|
4
17
|
"at": "2026-11-10T02:35:02.323Z",
|
package/workspace/guide/home.md
CHANGED
|
@@ -19,7 +19,7 @@ Home, the Board, Insights and the Viewer use one typeface, Plus Jakarta Sans, wi
|
|
|
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
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
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.
|
|
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. A kind Claude shows you comes first. **By product** opens Settings › Claude, where you set how Claude decides for each kind.
|
|
23
23
|
- **Since yesterday**: up to 3 new items, then **New for you · N** to see all of them. ✓✓ marks all of them seen.
|
|
24
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.
|
|
25
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.
|
|
@@ -82,12 +82,14 @@ Press a program's name on the Board to open its panel. Home links to it with `?p
|
|
|
82
82
|
The Viewer of a program, and the product page, are one page. There is no Work and Dashboard switch.
|
|
83
83
|
|
|
84
84
|
- The top shows Claude's ✦ line, then the goal card with its milestones and the forecast bar. Goals show a short title, not the KR's full text.
|
|
85
|
+
- On the product page, **The story so far** comes under the ✦ line. Claude writes it from the records, and every line shows its source as a chip. This story is your weekly update: the update leads with it, without the sources. The ✦ line then says "Your weekly update is this story." Claude keeps it current when it prepares the weekly report. With no story, there is no card.
|
|
85
86
|
- Each goal row shows the KR as a chip, then a short title, then one grey line on how it reads. The KR id alone is never the title.
|
|
86
87
|
- When Claude proposes changes, a folded row under the goal card counts them. Only the owner sees this row. Press it to open every proposal, each with Claude's pick: ✕ drops it, ✎ opens it to change, ✓ keeps the pick.
|
|
87
88
|
- On the product page, the same row also holds **Goals I would change**: a KR whose wording reads badly, with the old words struck through, the new words, one reason and a test read (its source and number). Claude lists a goal only when its test read returned a number.
|
|
88
89
|
- The tabs are **Tasks**, **Initiatives** (the default), **Reports** and **Documents**.
|
|
89
90
|
- The product page also shows a **Programs** card and a **Health budgets** card. Its **Initiatives** tab lists the product's own initiatives, then one card for each program that holds some of them.
|
|
90
91
|
- A teammate on a shared board sees the same page, with no proposals.
|
|
92
|
+
- A shared Board link of a product shows the same story above the timeline, without the sources and without what Claude did.
|
|
91
93
|
|
|
92
94
|
## Claude suggests milestones
|
|
93
95
|
|
|
@@ -12,7 +12,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
|
|
|
12
12
|
| Section | What it holds |
|
|
13
13
|
|---|---|
|
|
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
|
-
| Claude |
|
|
15
|
+
| Claude | **How Claude decides** for each kind of change, the calls that are **Always yours**, and Claude's **Lessons**. Then 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
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](statuses.md). |
|
|
18
18
|
| Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
|
|
@@ -39,6 +39,20 @@ Under the update card, **Updates** shows what changed in the published kits. **T
|
|
|
39
39
|
- A change published before Claude wrote stories shows the pull request's title and its sentence instead.
|
|
40
40
|
- The card in **General** that says a new PMOS is ready opens **Updates**.
|
|
41
41
|
|
|
42
|
+
## Claude: how Claude decides, and its Lessons
|
|
43
|
+
|
|
44
|
+
**How Claude decides** lists each kind of change that Claude made by itself, for example "Notes on where work stands" or "Task names". Each row says how many Claude made and how many you kept. Each kind has three ways:
|
|
45
|
+
|
|
46
|
+
- **Quietly**: Claude does it and lists it in Claude did.
|
|
47
|
+
- **Show me**: Claude does it and shows it first in Claude did.
|
|
48
|
+
- **Ask first**: Claude does not do it. It waits for your ✓ as a proposal.
|
|
49
|
+
|
|
50
|
+
Claude picks the way by itself. A new kind is **Show me** until you keep 3 of its changes; then it is **Quietly**. Two Undos on a kind and Claude asks first for 7 days. Press a way to set a kind yourself. Your way wins over Claude's, the 7 days included. Press the way Claude would pick to give the choice back to Claude. **By product** under Claude did on Your day opens this section.
|
|
51
|
+
|
|
52
|
+
**Always yours** lists the calls Claude never makes by itself, whatever it has learned: a new request, a verdict on an outcome, a message to people, a move the team reads in Jira or on the Board, and a merge, a delete or spend.
|
|
53
|
+
|
|
54
|
+
**Lessons** lists what Claude got wrong and what it changed, newest first, from the Lessons of every product. The first line says what went wrong; the next says what changed.
|
|
55
|
+
|
|
42
56
|
## Claude: the profile and the API key
|
|
43
57
|
|
|
44
58
|
**Claude login and profile.** Choose a separate PMOS login or an existing Claude setup. Complete sign-in in that profile’s terminal. **Check and use this profile** verifies access and saves the choice for new sessions. The check can consume a small amount of Claude usage. A discovered profile is not a verified login. The same login test appears in [first-run setup](layout.md).
|
|
@@ -15,6 +15,9 @@
|
|
|
15
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)
|
|
16
16
|
* viewOf(state, scope) → { scope, artefacts: [{ key, title, owner, for, fields, carried, empty }] } always all seven that fit the scope
|
|
17
17
|
* migrate({ dir, coreDocs, driverLines, reports }, { now }) → { ok, carried, already, lines } idempotent; deletes nothing
|
|
18
|
+
* storyOf(state, scopes, { now, days }) → { at, lines: [{ text, sources }] } | null "The story so far" (board AwE): the Narrative's
|
|
19
|
+
* `now` (one paragraph per line) and its `week` lines of the last `days` days; every line carries the sources of its set
|
|
20
|
+
* lessonsOf(state) → [{ scope, text, sources, at }] every Lessons line of every scope, newest first (Settings › Claude, AwG2)
|
|
18
21
|
*
|
|
19
22
|
* THE LINES. Every line is { v: 1, ev, id, scope, at, by }.
|
|
20
23
|
* set { artefact, field, text, sources: [{ label, ref }] } a value. A `one` field: the newest set wins. A `list` field: every set is a line.
|
|
@@ -237,6 +240,40 @@ function pmEdited(state, { scope, artefact, field } = {}) {
|
|
|
237
240
|
return !!sets.length && /^pm:/.test(String(sets[sets.length - 1].by || ''));
|
|
238
241
|
}
|
|
239
242
|
|
|
243
|
+
/** "The story so far" of a product (board AwE, the weekly update): the Narrative of the first scope that has one, else nothing.
|
|
244
|
+
* `now` gives one paragraph per line of its text; the `week` lines of the last `days` days follow, oldest first. With as many sources as
|
|
245
|
+
* lines, line N shows source N; otherwise the sources of a set ride on its last line. Pure. */
|
|
246
|
+
function storyOf(state, scopes, { now, days = 7 } = {}) {
|
|
247
|
+
const t = now == null ? Date.now() : now;
|
|
248
|
+
for (const sc of scopes || []) {
|
|
249
|
+
const v = viewOf(state, sc);
|
|
250
|
+
const n = v && v.artefacts.find((a) => a.key === 'narrative');
|
|
251
|
+
if (!n || n.empty) continue;
|
|
252
|
+
const lines = [];
|
|
253
|
+
const add = (set) => {
|
|
254
|
+
const ps = String(set.text || '').split(/\n+/).map((x) => x.trim()).filter(Boolean);
|
|
255
|
+
const src = set.sources || [];
|
|
256
|
+
// one source per line, in order, when the agent gave as many as it wrote lines; else every source rides on the last line
|
|
257
|
+
ps.forEach((x, i) => lines.push({ text: x, sources: src.length === ps.length && ps.length > 1 ? [src[i]] : i === ps.length - 1 ? src : [] }));
|
|
258
|
+
};
|
|
259
|
+
if (n.fields.now) add(n.fields.now);
|
|
260
|
+
for (const w of n.fields.week || []) if (Date.parse(w.at || '') >= t - days * 86400000) add(w);
|
|
261
|
+
if (!lines.length) continue;
|
|
262
|
+
const ats = [n.fields.now, ...(n.fields.week || [])].filter(Boolean).map((x) => x.at).filter(Boolean).sort();
|
|
263
|
+
return { scope: v.scope, at: ats[ats.length - 1] || null, lines };
|
|
264
|
+
}
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
/** Every Lessons line, newest first. Pure. */
|
|
268
|
+
function lessonsOf(state) {
|
|
269
|
+
const out = [];
|
|
270
|
+
for (const [scope, m] of state || new Map()) {
|
|
271
|
+
const x = m.get('lessons');
|
|
272
|
+
if (x) for (const l of x.sets) if (l.field === 'line') out.push({ scope, text: l.text, sources: l.sources || [], at: l.at || null });
|
|
273
|
+
}
|
|
274
|
+
return out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
275
|
+
}
|
|
276
|
+
|
|
240
277
|
// ── writes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
241
278
|
const refuse = (status, error) => ({ ok: false, status, error });
|
|
242
279
|
const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
|
|
@@ -374,7 +411,7 @@ function migrateRepo(root, { now } = {}) {
|
|
|
374
411
|
}
|
|
375
412
|
|
|
376
413
|
module.exports = {
|
|
377
|
-
pmEdited,
|
|
414
|
+
pmEdited, storyOf, lessonsOf,
|
|
378
415
|
LEDGER, EVENTS, ARTEFACTS, KEYS, EXECUTORS, FROM_DOCS, FROM_WHATS, FROM_CADENCES, FROM_LANES,
|
|
379
416
|
parseScope, targetOfDoc, targetOfWhat, fieldOf, file, readLines, append, fold, viewOf, checkSet, set, undo,
|
|
380
417
|
planMigration, migrate, migrateRepo, reportDrafts, dirOf, proposalText,
|
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
* `kept` (earlier changes of its job and product nobody undid) and `reason` (reasonOf)
|
|
39
39
|
* reasonOf({ cls, why, kept }) → one line: how Claude did it and why ("Did it quietly. You kept this kind 4 times before.")
|
|
40
40
|
* restore(stateDir, { job, product }, actor, { now })
|
|
41
|
+
*
|
|
42
|
+
* HOW CLAUDE DECIDES (Settings › Claude, agent-run workspace boards AwG and AwG2, agreed by the PM 2026-11-10). The jobs are grouped into
|
|
43
|
+
* KINDS of change the PM can name ("Notes on where work stands"). Each kind has a WAY:
|
|
44
|
+
* quiet Claude does it and lists it in Claude did (the kind is kept: SHOW_UNTIL or more of its changes nobody undid)
|
|
45
|
+
* show Claude does it and shows it first in Claude did (a new kind, until the PM keeps SHOW_UNTIL)
|
|
46
|
+
* ask Claude asks first: the change waits as a proposal (two Undos on a kind: the demotion above, for 7 days)
|
|
47
|
+
* The PM may set any kind (setting claude.ways, { kind: way }); the PM's way wins over the automatic one, a demotion included.
|
|
48
|
+
* WAYS · SHOW_UNTIL · KIND_LIST · kindOf(job) · waysSet(settingsDir) · autoWay({ kept, demoted }) · kindsOf(dirs, { now, settingsDir })
|
|
41
49
|
*/
|
|
42
50
|
const fs = require('fs');
|
|
43
51
|
const path = require('path');
|
|
@@ -54,6 +62,8 @@ const KINDS = Object.freeze(['undo', 'revert', 'verifier-fail']);
|
|
|
54
62
|
const EVENTS = Object.freeze(['applied', 'setback', 'demote', 'seen', 'restore']);
|
|
55
63
|
const JOB_RE = /^(driver|propose|ai|goal):[a-z0-9][a-z0-9-]{0,40}$/;
|
|
56
64
|
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
65
|
+
const WAYS = Object.freeze(['quiet', 'show', 'ask']);
|
|
66
|
+
const SHOW_UNTIL = 3;
|
|
57
67
|
const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
58
68
|
|
|
59
69
|
/* The Initiative Driver's kinds (lib/driver.js WHATS). */
|
|
@@ -70,6 +80,36 @@ const PROPOSAL_CLASS = Object.freeze({
|
|
|
70
80
|
description: 'B', outcome: 'B', found: 'B', status: 'B', grill: 'B', links: 'B', prototyped: 'B', improved: 'B', scanned: 'B',
|
|
71
81
|
});
|
|
72
82
|
|
|
83
|
+
/* The kinds of change the PM can name, each with the jobs it holds (Settings › Claude, How Claude decides). A job in no kind (a role
|
|
84
|
+
* agent's ai:<role>, a goal loop) keeps the automatic rules only. */
|
|
85
|
+
const k = (key, label, jobs) => Object.freeze({ key, label, jobs: Object.freeze(jobs) });
|
|
86
|
+
const KIND_LIST = Object.freeze([
|
|
87
|
+
k('notes', 'Notes on where work stands', ['driver:note']),
|
|
88
|
+
k('problem', 'Problem statements and evidence', ['driver:problem', 'driver:evidence', 'driver:sizing', 'driver:assumption', 'driver:stakeholders', 'driver:overlap']),
|
|
89
|
+
k('experiment', 'The experiment and its next step', ['driver:artefact', 'driver:doc', 'driver:next-step']),
|
|
90
|
+
k('outcome', 'Expected outcomes and check dates', ['propose:outcome']),
|
|
91
|
+
k('names', 'Task names', ['propose:names']),
|
|
92
|
+
k('dates', 'Dates moved by evidence', ['propose:dates']),
|
|
93
|
+
k('status', 'Closing tasks Jira marked Done', ['propose:status']),
|
|
94
|
+
k('description', 'Descriptions and links', ['propose:description', 'propose:links']),
|
|
95
|
+
k('found', 'What Claude found elsewhere', ['propose:found', 'propose:scanned', 'propose:improved', 'propose:prototyped']),
|
|
96
|
+
k('grill', 'Fixes from a check', ['propose:grill']),
|
|
97
|
+
]);
|
|
98
|
+
const KIND_OF_JOB = new Map(KIND_LIST.flatMap((x) => x.jobs.map((j) => [j, x.key])));
|
|
99
|
+
const kindOf = (job) => KIND_OF_JOB.get(String(job || '')) || null;
|
|
100
|
+
/** The ways the PM set, { kind: way }, from the settings (claude.ways). {} when none or unreadable. */
|
|
101
|
+
function waysSet(settingsDir) {
|
|
102
|
+
if (!settingsDir) return {};
|
|
103
|
+
try {
|
|
104
|
+
const v = require('./settings-store.js').get(settingsDir, 'claude.ways');
|
|
105
|
+
const out = {};
|
|
106
|
+
if (isObj(v)) for (const [kk, w] of Object.entries(v)) if (KIND_LIST.some((x) => x.key === kk) && WAYS.includes(w)) out[kk] = w;
|
|
107
|
+
return out;
|
|
108
|
+
} catch { return {}; }
|
|
109
|
+
}
|
|
110
|
+
/** The automatic way of a kind: ask while demoted, quiet once kept SHOW_UNTIL times, else show. Pure. */
|
|
111
|
+
const autoWay = ({ kept = 0, demoted = false } = {}) => (demoted ? 'ask' : kept >= SHOW_UNTIL ? 'quiet' : 'show');
|
|
112
|
+
|
|
73
113
|
const classOfDriver = (what) => DRIVER_CLASS[what] || 'C';
|
|
74
114
|
function classOfProposal(p) {
|
|
75
115
|
if (!isObj(p)) return 'C';
|
|
@@ -186,7 +226,12 @@ function decide({ stateDir, job, product, cls, mode = 'auto', undoable = true, n
|
|
|
186
226
|
if (mode !== 'auto') return { apply: false, why: `the mode is ${mode}` };
|
|
187
227
|
if (cls === 'C' || !CLASSES.includes(cls)) return { apply: false, why: 'class C: seen by others or not reversible, so it waits for the daily press' };
|
|
188
228
|
if (!undoable) return { apply: false, why: 'no Undo for this change, so it waits' };
|
|
189
|
-
const
|
|
229
|
+
const set = waysSet(settingsDir)[kindOf(job)];
|
|
230
|
+
if (set === 'ask') return { apply: false, why: 'you set this kind to Ask first' };
|
|
231
|
+
if (set) return { apply: true, why: `class ${cls}: applied with Undo, as you set this kind` };
|
|
232
|
+
// a demotion holds for its whole kind (How Claude decides: "two Undos on a kind and it asks first"), so evidence waits when problems were undone
|
|
233
|
+
const st = fold(read(stateDir)), kind = KIND_LIST.find((x) => x.key === kindOf(job));
|
|
234
|
+
const d = (kind ? kind.jobs : [job]).map((j) => demotedNow(st, j, product, now)).find(Boolean) || null;
|
|
190
235
|
if (d) return { apply: false, why: `back to propose until ${d.until.slice(0, 10)}: ${d.why}` };
|
|
191
236
|
return { apply: true, why: `class ${cls}: applied with Undo` };
|
|
192
237
|
}
|
|
@@ -212,28 +257,60 @@ const markSeen = (stateDir, n, { now } = {}) => append(stateDir, { ev: 'seen', j
|
|
|
212
257
|
/** The one-line reason a change shows beside its Undo (agent-run workspace, board AwA: "each change says why"). Honest from the ledger:
|
|
213
258
|
* 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
259
|
* change carries one. Pure. */
|
|
215
|
-
function reasonOf({ cls = null, why = '', kept = 0 } = {}) {
|
|
216
|
-
const
|
|
217
|
-
|
|
260
|
+
function reasonOf({ cls = null, why = '', kept = 0, way = null } = {}) {
|
|
261
|
+
const w0 = WAYS.includes(way) && way !== 'ask' ? way : autoWay({ kept });
|
|
262
|
+
const times = kept === 1 ? 'once' : kept + ' times';
|
|
263
|
+
const how = w0 === 'quiet' ? (kept > 0 ? 'Did it quietly. You kept this kind ' + times + ' before.' : 'Did it quietly, as you set this kind.')
|
|
264
|
+
: kept > 0 ? 'Did it and showed you. You kept this kind ' + times + (way === 'show' ? ' before; you asked to see it.' : '; it shows until you keep ' + SHOW_UNTIL + '.')
|
|
265
|
+
: 'Did it and showed you. It is the first of its kind' + (cls === 'A' ? ', and it is upkeep with one right answer.' : '.');
|
|
218
266
|
const w = one(why, 200);
|
|
219
267
|
return w ? how + ' ' + w.replace(/\.?$/, '.') : how;
|
|
220
268
|
}
|
|
221
269
|
|
|
222
270
|
/** The Done group: what agents applied by themselves in the last `days` days and nobody undid, newest first. */
|
|
223
|
-
function done(stateDir, { now, days = UNDO_DAYS } = {}) {
|
|
271
|
+
function done(stateDir, { now, days = UNDO_DAYS, settingsDir = null } = {}) {
|
|
224
272
|
const t = now == null ? Date.now() : now;
|
|
225
273
|
const since = t - days * DAY;
|
|
274
|
+
const set = waysSet(settingsDir);
|
|
226
275
|
const out = [];
|
|
227
276
|
for (const j of fold(read(stateDir)).jobs.values()) {
|
|
228
277
|
let kept = 0;
|
|
278
|
+
const own = set[kindOf(j.job)] || null;
|
|
229
279
|
for (const a of j.applied) {
|
|
230
|
-
if (!a.undone && Date.parse(a.at) >= since)
|
|
280
|
+
if (!a.undone && Date.parse(a.at) >= since) {
|
|
281
|
+
const way = own && own !== 'ask' ? own : autoWay({ kept });
|
|
282
|
+
out.push({ ...a, kept, way, reason: reasonOf({ cls: a.cls, why: a.why, kept, way: own }) });
|
|
283
|
+
}
|
|
231
284
|
if (!a.undone) kept++;
|
|
232
285
|
}
|
|
233
286
|
}
|
|
234
287
|
return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
235
288
|
}
|
|
236
289
|
|
|
290
|
+
/** How Claude decides, per kind, over the state folders of every product (Settings › Claude). made: changes applied by itself; kept: the
|
|
291
|
+
* ones nobody undid; undone; way: what Claude does now; set: the PM's way or null; auto: the automatic way; until: the end of a demotion.
|
|
292
|
+
* Only the kinds with a change or a way the PM set are listed (zero is silence), most made first. */
|
|
293
|
+
function kindsOf(dirs, { now, settingsDir = null } = {}) {
|
|
294
|
+
const t = now == null ? Date.now() : now;
|
|
295
|
+
const set = waysSet(settingsDir);
|
|
296
|
+
const acc = new Map(KIND_LIST.map((x) => [x.key, { made: 0, kept: 0, undone: 0, until: null }]));
|
|
297
|
+
for (const d of dirs || []) {
|
|
298
|
+
const st = fold(read(d));
|
|
299
|
+
for (const j of st.jobs.values()) {
|
|
300
|
+
const kk = kindOf(j.job); if (!kk) continue;
|
|
301
|
+
const a = acc.get(kk);
|
|
302
|
+
a.made += j.applied.length;
|
|
303
|
+
a.undone += j.applied.filter((x) => x.undone).length;
|
|
304
|
+
a.kept += j.applied.filter((x) => !x.undone).length;
|
|
305
|
+
if (j.demote && Date.parse(j.demote.until) > t && (!a.until || j.demote.until > a.until)) a.until = j.demote.until;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return KIND_LIST.map((x) => {
|
|
309
|
+
const a = acc.get(x.key), auto = autoWay({ kept: a.kept, demoted: !!a.until });
|
|
310
|
+
return { kind: x.key, label: x.label, made: a.made, kept: a.kept, undone: a.undone, auto, set: set[x.key] || null, way: set[x.key] || auto, until: a.until };
|
|
311
|
+
}).filter((x) => x.made || x.set).sort((p, q) => q.made - p.made);
|
|
312
|
+
}
|
|
313
|
+
|
|
237
314
|
/** May this applied change still be undone (within 14 days, not undone yet)? */
|
|
238
315
|
function undoOpen(stateDir, ref, { now } = {}) {
|
|
239
316
|
const a = fold(read(stateDir)).applied.get(ref);
|
|
@@ -250,6 +327,7 @@ function restore(stateDir, { job, product }, actor, { now } = {}) {
|
|
|
250
327
|
}
|
|
251
328
|
|
|
252
329
|
module.exports = {
|
|
330
|
+
WAYS, SHOW_UNTIL, KIND_LIST, kindOf, waysSet, autoWay, kindsOf,
|
|
253
331
|
LEDGER, CLASSES, DRIVER_CLASS, PROPOSAL_CLASS, DEMOTE_DAYS, UNDO_DAYS, RATE_LIMIT, RATE_MIN, KINDS,
|
|
254
332
|
classOfDriver, classOfProposal, killed, autoFor, file, read, fold, recordApplied, reasonOf, recordSetback, decide, demotedNow, notices, markSeen, done, undoOpen, restore,
|
|
255
333
|
};
|
|
@@ -60,6 +60,11 @@ module.exports = {
|
|
|
60
60
|
for (const sc of scopes) { const dk = '/api/ready-reports/dashboard?' + new URLSearchParams({ ws, scope: sc }).toString(); const d = await via(RRoutes, dk, req, ctx); if (d.body && d.body.ok) answers[dk] = d.body; }
|
|
61
61
|
const ik = '/api/boards/items?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board); const it = await via(Boards, ik, req, ctx); if (it.body && it.body.ok) answers[ik] = it.body;
|
|
62
62
|
}
|
|
63
|
+
// the product's story (board AwF): the same Narrative as its page, above the timeline; the pack drops the sources
|
|
64
|
+
if (selection.some((s) => s.kind === 'product')) {
|
|
65
|
+
const sk = '/api/artefacts/story?ws=' + encodeURIComponent(ws); const st = await via(require('./routes-artefacts.js'), sk, req, ctx);
|
|
66
|
+
if (st.body && st.body.ok && st.body.story) answers[sk] = st.body;
|
|
67
|
+
}
|
|
63
68
|
const meta = { by: q.get('by') || '', at: q.get('at') || '', ends: q.get('ends') || '', viewer: q.get('viewer') || '', hub: q.get('hub') || '', view: q.get('view') || '' };
|
|
64
69
|
ctx.json(res, { ok: true, pack: Pack.buildPack({ ws, board, selection, answers, meta }) });
|
|
65
70
|
} catch (e) { return bad(String((e && e.message) || e).slice(0, 240), /not on this board|Pick at least|at most 2 MB|product, a program/.test(String(e && e.message)) ? 400 : 500); }
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* ws, board the board the answers are from (a product is a board)
|
|
9
9
|
* selection [{ kind: 'product' | 'program' | 'initiative', id }], one or more; the pack holds the union
|
|
10
10
|
* answers { '/api/…?query': body } — the Board's GET answers, as the workspace's own routes gave them. Pure: nothing is read here.
|
|
11
|
-
* The one program and product page (batch 21 item 2) reads two more: /api/ready-reports/dashboard (teammateDash) and /api/boards/items
|
|
11
|
+
* The one program and product page (batch 21 item 2) reads two more: /api/ready-reports/dashboard (teammateDash) and /api/boards/items;
|
|
12
|
+
* a product carries its story, /api/artefacts/story, as text lines only (board AwF: no sources, no Claude's activity)
|
|
12
13
|
* meta { by, at, ends, viewer, hub? } — shown on the one line above the Board, and the version of the Board's code that reads the pack
|
|
13
14
|
* assertSize(pack) throws the host's limit (2 MB, H5)
|
|
14
15
|
*
|
|
@@ -173,6 +174,11 @@ function buildPack({ ws, board, selection, answers, meta }) {
|
|
|
173
174
|
if (Array.isArray(body.items)) body.items = body.items.filter((t) => t && R.keep.has(t.ini));
|
|
174
175
|
if (Array.isArray(body.initiatives)) body.initiatives = body.initiatives.filter((x) => x && R.keep.has(x.id || x));
|
|
175
176
|
responses[k] = sweep(settled(body), needles) || {};
|
|
177
|
+
} else if (p === '/api/artefacts/story') {
|
|
178
|
+
// "The story so far" (board AwF): a stakeholder reads the same story as the product page, without its sources or Claude's activity
|
|
179
|
+
const st = R.wholeBoard && answers[k] && answers[k].story;
|
|
180
|
+
const lines = st && Array.isArray(st.lines) ? st.lines.map((l) => sweep(String((l && l.text) || ''), needles)).filter((x) => x) : [];
|
|
181
|
+
if (lines.length) responses[p + '?' + new URLSearchParams({ ws: q.get('ws') || ws }).toString()] = { ok: true, ws: q.get('ws') || ws, story: { at: st.at || null, lines: lines.map((text) => ({ text })) } };
|
|
176
182
|
} else if (p === '/api/initiative-layout') {
|
|
177
183
|
if (R.keep.has(q.get('initiative'))) responses[k] = sweep(clone(answers[k]), needles) || {};
|
|
178
184
|
}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* GET /api/artefacts?ws&scope → { ok, ws, scope, kind, artefacts: [{ key, title, owner, for, labels, fields, carried, empty }] }
|
|
5
5
|
* scope: portfolio (default), board:<id>, goal:<id>, experiment:<id> (initiative:<id> is an alias)
|
|
6
|
+
* GET /api/artefacts/story?ws → { ok, ws, story: { scope, at, lines: [{ text, sources }] } | null } "The story so far" on the product
|
|
7
|
+
* page (board AwE): the Narrative of board:<ws>, else of the portfolio (lib/artefacts.js storyOf). A shared
|
|
8
|
+
* Board carries it without the sources (lib/board-pack.js).
|
|
9
|
+
* GET /api/artefacts/lessons → { ok, lessons: [{ ws, product, scope, text, at }] } every product's Lessons, newest first, at most 20
|
|
10
|
+
* (Settings › Claude, board AwG2)
|
|
6
11
|
* GET /api/artefacts/map → { ok, artefacts, rows: [{ from, name, artefact, field, note }] } what every older shape became
|
|
7
12
|
* POST /api/artefacts/set { ws, scope, artefact, field, text } → { ok, line } the PM edits one line from the Viewer (board AwB: "You edit
|
|
8
13
|
* any line"). A page press (pm-guard requirePagePress); the actor is the PM, so Claude asks before it
|
|
@@ -44,6 +49,23 @@ async function handle(req, res, url, ctx) {
|
|
|
44
49
|
}
|
|
45
50
|
if (req.method !== 'GET') return send(405, { ok: false, error: 'the artefacts are read here; the PM edits a line with POST /api/artefacts/set' });
|
|
46
51
|
if (sub === 'map') return send(200, { ok: true, artefacts: A.KEYS, rows: require('./artefacts-cli.js').mapRows() });
|
|
52
|
+
if (sub === 'lessons') {
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const w of (ctx.workspaceList ? ctx.workspaceList() : []).filter((x) => x && x.root && !x.linked)) {
|
|
55
|
+
let dir; try { dir = A.dirOf(w.root); } catch { continue; }
|
|
56
|
+
for (const l of A.lessonsOf(A.fold(A.readLines(A.file(dir))))) out.push({ ws: w.id, product: w.label || w.name || w.id, scope: l.scope, text: l.text, at: l.at });
|
|
57
|
+
}
|
|
58
|
+
out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
59
|
+
return send(200, { ok: true, lessons: out.slice(0, 20) });
|
|
60
|
+
}
|
|
61
|
+
if (sub === 'story') {
|
|
62
|
+
const w = wsOf(ctx, url.searchParams.get('ws'));
|
|
63
|
+
if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
|
|
64
|
+
let dir;
|
|
65
|
+
try { dir = A.dirOf(w.root); } catch (e) { return send(409, { ok: false, error: String((e && e.message) || e) }); }
|
|
66
|
+
const scopes = (A.parseScope('board:' + w.id) ? ['board:' + w.id] : []).concat('portfolio');
|
|
67
|
+
return send(200, { ok: true, ws: w.id, story: A.storyOf(A.fold(A.readLines(A.file(dir))), scopes) });
|
|
68
|
+
}
|
|
47
69
|
if (sub) return send(404, { ok: false, error: 'no such artefacts route' });
|
|
48
70
|
const q = url.searchParams;
|
|
49
71
|
const w = wsOf(ctx, q.get('ws'));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* routes-autonomy.js — what agents did by themselves, and its Undo (D106, "Full autonomy now").
|
|
3
3
|
*
|
|
4
4
|
* GET /api/autonomy?ws → { ok, ws, done: [change], notices: [demotion], failed: [run] }
|
|
5
|
-
* change: { ref, job, title, cls, at, undo_until, ini, reason } the changes agents applied by themselves in the last 14 days that
|
|
5
|
+
* change: { ref, job, title, cls, way, at, undo_until, ini, reason } way: quiet | show (lib/autonomy.js: show draws first) the changes agents applied by themselves in the last 14 days that
|
|
6
6
|
* nobody undid, newest first: the Done group ("Claude did" on Your day, "Claude's work" in the Viewer; agent-run workspace, boards
|
|
7
7
|
* AwA and AwB). title is said as an act ("Wrote the problem: …"); reason is lib/autonomy.js reasonOf, one line.
|
|
8
8
|
* notices: the jobs that fell back to propose and Home has not said so yet (say it once).
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* line where the work is.
|
|
12
12
|
* POST /api/autonomy/undo { ws, ref } → { ok, back, demoted? } Undo of one change: a Driver proposal (p-…) or a ✦ batch (pk-…)
|
|
13
13
|
* POST /api/autonomy/seen { ws, job, product, until } → { ok } Home said the demotion once
|
|
14
|
+
* GET /api/autonomy/kinds → { ok, kinds: [{ kind, label, made, kept, undone, auto, set, way, until }], showUntil }
|
|
15
|
+
* How Claude decides (Settings › Claude, boards AwG and AwG2), over every product's state folders: lib/autonomy.js kindsOf. The PM
|
|
16
|
+
* sets a kind's way with POST /api/settings { key: 'claude.ways', value: { kind: quiet | show | ask } }.
|
|
14
17
|
*
|
|
15
18
|
* Every POST passes pm-guard requirePagePress. An Undo is a correction (the north star) and a setback of its job (lib/autonomy.js).
|
|
16
19
|
*/
|
|
@@ -115,12 +118,18 @@ async function handle(req, res, url, ctx) {
|
|
|
115
118
|
if (!w) return send(bad(404, 'no such workspace'));
|
|
116
119
|
const done = [], notices = [], dirs = dirsOf(ctx, w);
|
|
117
120
|
for (const d of dirs) {
|
|
118
|
-
for (const a of A.done(d)) done.push({ ref: a.ref, job: a.job, title: sayOf(a), cls: a.cls, at: a.at, undo_until: new Date(Date.parse(a.at) + A.UNDO_DAYS * DAY).toISOString(), ini: a.ini || null, reason: a.reason });
|
|
121
|
+
for (const a of A.done(d, { settingsDir: ctx.runtimeDir || null })) done.push({ ref: a.ref, job: a.job, title: sayOf(a), cls: a.cls, way: a.way, at: a.at, undo_until: new Date(Date.parse(a.at) + A.UNDO_DAYS * DAY).toISOString(), ini: a.ini || null, reason: a.reason });
|
|
119
122
|
for (const n of A.notices(d)) notices.push(n);
|
|
120
123
|
}
|
|
121
124
|
done.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
122
125
|
return send({ status: 200, body: { ok: true, ws: w.id, done, notices, failed: failedOf(w, dirs) } });
|
|
123
126
|
}
|
|
127
|
+
if (sub === 'kinds' && req.method === 'GET') {
|
|
128
|
+
const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
|
|
129
|
+
const dirs = [];
|
|
130
|
+
for (const w of list) for (const d of dirsOf(ctx, w)) if (!dirs.includes(d)) dirs.push(d);
|
|
131
|
+
return send({ status: 200, body: { ok: true, kinds: A.kindsOf(dirs, { settingsDir: ctx.runtimeDir || null }), showUntil: A.SHOW_UNTIL } });
|
|
132
|
+
}
|
|
124
133
|
if (sub !== 'undo' && sub !== 'seen') return send(bad(404, 'no such autonomy route'));
|
|
125
134
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
126
135
|
const read = await ctx.readJson(req);
|
|
@@ -105,6 +105,9 @@ const DEFS = Object.freeze({
|
|
|
105
105
|
// `pmos ai off [job]` and `pmos ai on [job]` set them; PMOS_AI=off wins over both.
|
|
106
106
|
'ai.on': bool('checks', 'computer', true),
|
|
107
107
|
'ai.off': { section: 'checks', scope: 'computer', type: 'jobs', max: 40, def: [] },
|
|
108
|
+
// Settings › Claude › How Claude decides (lib/autonomy.js KIND_LIST): the way the PM set for a kind of change, { kind: quiet | show | ask }.
|
|
109
|
+
// A kind left out follows the automatic way. The PM's way wins over it, a demotion included.
|
|
110
|
+
'claude.ways': { section: 'claude', scope: 'computer', type: 'ways', max: 30, def: {} },
|
|
108
111
|
});
|
|
109
112
|
|
|
110
113
|
/* The environment variables that win over a setting, here or in a setting's own store. `key` names the setting the page
|
|
@@ -168,6 +171,8 @@ function validate(key, value) {
|
|
|
168
171
|
}
|
|
169
172
|
// ['*'] alone is every workspace (the product picker's All, lib/briefing-premium-products.js)
|
|
170
173
|
case 'ids': return value === null || Array.isArray(value) && (value.length === 1 && value[0] === '*' || value.length <= d.max && value.every((x) => typeof x === 'string' && WS_ID.test(x)) && new Set(value).size === value.length) ? null : `${key} must list at most ${d.max} workspace ids, each once, or ['*'] for every one`;
|
|
174
|
+
case 'ways': return value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length <= d.max
|
|
175
|
+
&& Object.entries(value).every(([k, v]) => /^[a-z][a-z-]{1,30}$/.test(k) && ['quiet', 'show', 'ask'].includes(v)) ? null : `${key} must map at most ${d.max} kinds of change to quiet, show or ask`;
|
|
171
176
|
case 'jobs': return Array.isArray(value) && value.length <= d.max && value.every((x) => typeof x === 'string' && /^[a-z][a-z0-9-]{1,40}$/.test(x)) && new Set(value).size === value.length ? null : `${key} must list at most ${d.max} job ids, each once`;
|
|
172
177
|
// Dress for the day (pm/cozy-seasons.js): a day's key is its charm key, as in DAYS there
|
|
173
178
|
case 'country': return value === '' || typeof value === 'string' && /^[A-Z]{2}$/.test(value) ? null : `${key} must be a two-letter country code, or empty for this computer's`;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.549.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.549.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -1517,6 +1517,12 @@ span.tg-ng { cursor: default; }
|
|
|
1517
1517
|
/* the shared-by line ends with two quiet icons, Open in my PMOS and Get PMOS; the tabs of a link of several picks sit under it (batch 27 items 1 to 3) */
|
|
1518
1518
|
.ro-by { display: flex; align-items: center; gap: 8px; }
|
|
1519
1519
|
.ro-by .ro-txt { flex: 1; min-width: 0; }
|
|
1520
|
+
/* "The story so far" above the timeline (board AwF, pm/readonly.js storyOf): the product page's story, no sources */
|
|
1521
|
+
.ro-story { margin: 12px 18px 16px; padding: 16px 20px 18px; border-radius: 18px; background: var(--cz-card); border: 1px solid var(--cz-hair); display: flex; flex-direction: column; gap: 8px; }
|
|
1522
|
+
.ro-story p { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
1523
|
+
.ro-story p b, .ro-sth b { font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
1524
|
+
.ro-sth { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-row); }
|
|
1525
|
+
.ro-sth small { font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
1520
1526
|
.ro-ways { display: inline-flex; gap: 4px; flex: none; }
|
|
1521
1527
|
.ro-way { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); background: var(--cz-well); }
|
|
1522
1528
|
.ro-way:hover { color: var(--cz-ink); }
|
|
@@ -393,3 +393,8 @@
|
|
|
393
393
|
/* a quiet place (pm/quiet-place.js, onboarding B3 ObA4Gradual): one honest line instead of empty tables, until its moment comes */
|
|
394
394
|
.qp-on > :not(.qp-line) { display: none !important; }
|
|
395
395
|
.qp-line { margin: 18vh auto 0; max-width: 520px; padding: 0 16px; text-align: center; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink2); line-height: 1.5; }
|
|
396
|
+
/* Settings › Claude › How Claude decides and Lessons (boards AwG, AwG2): a lesson says what went wrong in amber, what changed in blue */
|
|
397
|
+
.cz .ev-lead { margin: 0 0 4px; }
|
|
398
|
+
.cz .ev-ls { display: flex; flex-direction: column; gap: 2px; }
|
|
399
|
+
.cz .ev-ls .ev-ms { color: var(--cz-late); }
|
|
400
|
+
.cz .ev-ls .ev-nx { color: var(--cz-blueink); }
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* for Adler's leaf, the impact log and the weekly check; the page hears `pmos:impact`), Agents write to Jira (fixed: only after Commit).
|
|
6
6
|
* Extras at the bottom (UI grill U4, 2026-11-08: nine sections became five): "Adler ›" and "Jev and Laya ›" open each as a
|
|
7
7
|
* sub-panel inside General with the controls they had as sections, nothing removed (T.sub; ‹ goes back to General).
|
|
8
|
-
* Claude
|
|
8
|
+
* Claude How Claude decides (boards AwG, AwG2, agreed 2026-11-10): each kind of change Claude makes by itself, how many it made and you
|
|
9
|
+
* kept, and Quietly, Show me or Ask first (GET /api/autonomy/kinds; the PM's way is claude.ways, POST /api/settings). Then the
|
|
10
|
+
* five Always yours rows (the six calls that always wait) and Lessons (GET /api/artefacts/lessons, the D107 artefact). Then
|
|
11
|
+
* the Claude profile, the API key, and Sharpen prompts: suggestions after a reply, Sharpen as I type, the style and Your own rules
|
|
9
12
|
* (GET/POST /api/next-prompt/prefs; batch 26 item 2)
|
|
10
13
|
* › Checks (a heading inside Claude since U4; it was the section Claude’s checks) Grill by itself (Full, Only at stage exits, Off) and the monthly credit for checks with what this month used (grill.mode,
|
|
11
14
|
* grill.cap, POST /api/settings; GET /api/grill; canvas GrillEntry). At the cap Claude pauses and says so once here.
|
|
@@ -286,6 +289,43 @@ function weeks() {
|
|
|
286
289
|
const arc = old.length ? `<div class="ev-arc"><button type="button" class="ev-arcb" data-ev-arc aria-expanded="${T.arc}"><b>Archive</b><span class="ev-small ev-mut">${old.length} earlier ${old.length === 1 ? 'week' : 'weeks'}</span>${svg(ICON.down, 14)}</button>${T.arc ? rows : ''}</div>` : '';
|
|
287
290
|
return `<div class="ev-wk">${head}${weekTop(w)}${arc}</div>`;
|
|
288
291
|
}
|
|
292
|
+
/* Settings › Claude › How Claude decides (AwG): one row per kind of change Claude made by itself, with what it made and you kept and the way
|
|
293
|
+
* it acts now. Pressing the automatic way clears yours. Then Always yours (AwG2): the calls that never move without you. Then Lessons. */
|
|
294
|
+
const WAY = [['quiet', 'Quietly'], ['show', 'Show me'], ['ask', 'Ask first']];
|
|
295
|
+
const dayOf = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }) : ''; };
|
|
296
|
+
function kindSub(k, until) {
|
|
297
|
+
const made = k.made === 1 ? '1 made' : k.made + ' made', kept = k.kept === k.made ? (k.made === 1 ? 'you kept it' : 'you kept all') : k.kept ? 'you kept ' + k.kept : 'none kept yet';
|
|
298
|
+
const how = k.set ? 'You set this.' : k.auto === 'ask' ? 'Two Undos, so Claude asks first' + (k.until ? ' until ' + dayOf(k.until) : '') + '.'
|
|
299
|
+
: k.auto === 'quiet' ? 'Claude does these quietly.' : 'A new kind shows until you keep ' + until + '.';
|
|
300
|
+
return (k.made ? made + ', ' + kept + '. ' : '') + how;
|
|
301
|
+
}
|
|
302
|
+
const ALWAYS = [['Start a new request', 'Claude recommends. You decide.'], ['Say if it worked', 'The verdict on an outcome is yours.'], ['Send a message to people', 'Claude drafts. Only you send.'],
|
|
303
|
+
['Move what the team reads', 'Stages and dates in Jira or on the Board.'], ['Merge, delete or spend', '']];
|
|
304
|
+
function lessonRow(l) {
|
|
305
|
+
const [wrong, ...rest] = String(l.text || '').split(/\n+/); // a lesson's first line says what went wrong, the rest what changed
|
|
306
|
+
return `<div class="ev-trow"><div class="ev-tx ev-ls"><b>${esc([dayOf(l.at), l.product].filter(Boolean).join(' · '))}</b><p class="ev-small${rest.length ? ' ev-ms' : ''}">${esc(wrong)}</p>${rest.length ? `<p class="ev-small ev-nx">${esc(rest.join(' '))}</p>` : ''}</div></div>`;
|
|
307
|
+
}
|
|
308
|
+
function decidesSec() {
|
|
309
|
+
const K = T.ck;
|
|
310
|
+
const kinds = !K ? '<p class="ev-small ev-mut">Reading what Claude did by itself.</p>' : K.ok === false ? `<p class="ev-small ev-mut">What Claude did could not be read: ${esc(K.error || 'the server did not answer')}.</p>`
|
|
311
|
+
: !K.kinds.length ? '<p class="ev-small ev-mut">Claude has not changed anything by itself yet. Each kind of change shows here once it has.</p>'
|
|
312
|
+
: K.kinds.map((k) => trow(k.label, kindSub(k, K.showUntil || 3), seg(k.label, 'claude.way:' + k.kind, k.way, WAY))).join('');
|
|
313
|
+
const L = T.ls && T.ls.ok ? T.ls.lessons || [] : [];
|
|
314
|
+
return '<h4>How Claude decides</h4><p class="ev-small ev-mut ev-lead">Claude picks for each kind of change from what you kept and undid. Two Undos on a kind and it asks first for 7 days. You can set any kind yourself.</p>'
|
|
315
|
+
+ kinds + '<h4>Always yours</h4>' + ALWAYS.map(([b, p]) => trow(b, p, '<span class="ev-pill">Always asks</span>')).join('')
|
|
316
|
+
+ (L.length ? '<h4>Lessons</h4>' + L.slice(0, 8).map(lessonRow).join('') : '');
|
|
317
|
+
}
|
|
318
|
+
/** A press on a kind's way: the PM's way is kept, unless it is the automatic one (then the kind follows the automatic way again). */
|
|
319
|
+
async function saveWay(kind, v) {
|
|
320
|
+
const K = T.ck; if (!K || !K.ok) return;
|
|
321
|
+
const ways = {}; for (const k of K.kinds) if (k.set) ways[k.kind] = k.set;
|
|
322
|
+
const k = K.kinds.find((x) => x.kind === kind); if (!k) return;
|
|
323
|
+
if (v === k.auto) delete ways[kind]; else ways[kind] = v;
|
|
324
|
+
const r = await pmPost('/api/settings', { key: 'claude.ways', value: ways });
|
|
325
|
+
if (r && r.ok) { k.set = ways[kind] || null; k.way = v; }
|
|
326
|
+
T.msg = r && r.ok ? 'Saved. ' + k.label + ': ' + (v === 'ask' ? 'Claude asks you first.' : v === 'show' ? 'Claude does them and shows them first in Claude did.' : 'Claude does them quietly.') : (r && r.error) || 'Not saved.';
|
|
327
|
+
draw();
|
|
328
|
+
}
|
|
289
329
|
/* Settings > Claude: which Claude profile PMOS starts Claude sessions with, and the API key for Claude's own runs (D101).
|
|
290
330
|
* The key is typed here and goes to this computer only; the page never gets it back, only whether one is set and where from. */
|
|
291
331
|
function claudeSec() {
|
|
@@ -298,7 +338,7 @@ function claudeSec() {
|
|
|
298
338
|
const k = C.key || {};
|
|
299
339
|
const keySub = k.present ? (k.source === 'environment' ? 'Set in ANTHROPIC_API_KEY. A key saved here is used first.' : 'Saved on this computer only. PMOS never shows it again.') : 'Not set. Claude\u2019s own runs, such as Grill, use a Claude session instead.';
|
|
300
340
|
const keyRight = `<span class="ev-dr-pl"><label class="ev-vh" for="evKey">Anthropic API key</label><input id="evKey" class="ev-inp" type="password" autocomplete="off" spellcheck="false" placeholder="${k.present ? 'Replace the key' : 'sk-ant-\u2026'}" data-ev-key><button type="button" class="ev-btn sm pri" data-ev-keysave>Save</button>${k.source === 'settings' ? '<button type="button" class="ev-btn sm" data-ev-keyclear>Remove</button>' : ''}</span>`;
|
|
301
|
-
return '<h4>Claude login and profile</h4><div data-claude-setup></div>'
|
|
341
|
+
return decidesSec() + '<h4>Claude login and profile</h4><div data-claude-setup></div>'
|
|
302
342
|
+ trow('API key', keySub, keyRight)
|
|
303
343
|
+ (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '')
|
|
304
344
|
+ sharpenRows()
|
|
@@ -436,6 +476,7 @@ async function press(e) {
|
|
|
436
476
|
if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
|
|
437
477
|
if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
|
|
438
478
|
if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
|
|
479
|
+
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
|
|
439
480
|
if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
|
|
440
481
|
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('grill.')) {
|
|
441
482
|
const key = t.dataset.evSeg, value = key === 'grill.cap' ? Number(t.dataset.v) : t.dataset.v;
|
|
@@ -562,7 +603,9 @@ async function readAgain(id) {
|
|
|
562
603
|
}
|
|
563
604
|
async function load() {
|
|
564
605
|
readFresh();
|
|
565
|
-
pmGet('/api/
|
|
606
|
+
pmGet('/api/autonomy/kinds').then((k) => { T.ck = k && k.ok ? k : { ok: false, error: (k && k.error) || '' }; draw(); }).catch(() => { T.ck = { ok: false }; draw(); });
|
|
607
|
+
pmGet('/api/artefacts/lessons').then((l) => { T.ls = l && l.ok ? l : null; draw(); }).catch(() => { T.ls = null; });
|
|
608
|
+
pmGet('/api/grill').then((g) => { T.gr = g && g.ok ? g : { ok: false, error: (g && g.error) || '' }; draw(); }).catch(() => { T.gr = { ok: false }; draw(); });
|
|
566
609
|
pmGet('/api/next-prompt/prefs').then((n) => { T.np = n && n.ok ? n : null; draw(); }).catch(() => { T.np = null; });
|
|
567
610
|
pmGet('/api/profiles').then(async (pr) => { const k = await pmGet('/api/anthropic'); T.cl = { profiles: pr && Array.isArray(pr.profiles) ? pr.profiles : [], prefs: (pr && pr.prefs) || {}, perr: pr && pr.ok === false ? (pr.error || 'the server did not answer') : '', key: k && k.ok ? k.key : { present: false, source: null }, off: !!(k && k.off) }; draw(); }).catch(() => { T.cl = { profiles: [], prefs: {}, perr: 'the server did not answer', key: { present: false, source: null } }; draw(); });
|
|
568
611
|
const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
|
|
@@ -588,7 +631,7 @@ export function openSettings(section, o = {}) {
|
|
|
588
631
|
const m = MOVED[section];
|
|
589
632
|
if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
|
|
590
633
|
else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
|
|
591
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; JL.reset(); }
|
|
634
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); }
|
|
592
635
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
593
636
|
draw();
|
|
594
637
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -250,7 +250,8 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
|
|
|
250
250
|
const move = mine.slice(0, MOVE_CAP), more = mine.length - move.length;
|
|
251
251
|
// Claude did (AwA): what Claude finished by itself, newest first, each with its reason and Undo; a run that stopped is one amber line
|
|
252
252
|
const R = Y.rank || {}, recent = (x) => { const t = Date.parse(x.at || ''); return Number.isFinite(t) && now - t <= SINCE_MS; };
|
|
253
|
-
|
|
253
|
+
// a kind Claude shows you (Settings › Claude: a new kind, or one you set to Show me) comes first; the quiet ones follow, newest first
|
|
254
|
+
const did = (R.done || []).map((d, i) => ({ d, i })).sort((a, b) => (a.d.way === 'show' ? 0 : 1) - (b.d.way === 'show' ? 0 : 1) || a.i - b.i).map(({ d }) => d).map((d) => ({ ...d, title: d.via === 'proposals' && d.name ? d.name + ': ' + (d.said || 'done') : d.said || 'done',
|
|
254
255
|
why: d.reason || 'Done by itself. You can undo it for 14 days.' }));
|
|
255
256
|
const didN = did.filter(recent).length;
|
|
256
257
|
const fl = (R.failed || []).filter(recent);
|
|
@@ -386,7 +387,7 @@ export function gmHtml(G, openHtml, o = {}) {
|
|
|
386
387
|
else if (quiet) a += `<div class="gm-more">${quiet}</div>`;
|
|
387
388
|
// Claude did (AwA): the amber line of a run that stopped, then the newest changes with their reasons and Undo; the rest fold
|
|
388
389
|
const dl = (G.did || []).slice(0, MOVE_CAP), dmore = (G.did || []).length - dl.length;
|
|
389
|
-
if (dl.length || G.failed) a += `<section class="gm-sec gm-didl"><h3 class="gm-sh">Claude did${G.didN ? ` <span class="gm-n">${G.didN} since yesterday</span>` : ''}</h3>${failHtml(G.failed)}${dl.map(didRowHtml).join('')}`
|
|
390
|
+
if (dl.length || G.failed) a += `<section class="gm-sec gm-didl"><h3 class="gm-sh">Claude did${G.didN ? ` <span class="gm-n">${G.didN} since yesterday</span>` : ''}<button type="button" class="gm-lnk" data-yd="gm-claude">By product</button></h3>${failHtml(G.failed)}${dl.map(didRowHtml).join('')}`
|
|
390
391
|
+ (dmore > 0 ? `<div class="gm-more"><button type="button" data-yd="gm-fold" data-fold="done"><b>${dmore}</b> more Claude did${svg(CHEV, 14, 2)}</button></div>` : '') + '</section>';
|
|
391
392
|
const b = G.since.length || G.newsN ? `<section class="gm-sec gm-since"><h3 class="gm-sh">Since yesterday${G.since.length ? `<button type="button" class="yd-all" data-yd="seen" aria-label="Mark all ${G.newsN} seen" title="Mark all seen">${svg(MARK2, 18, 1.9)}</button>` : ''}</h3>`
|
|
392
393
|
+ `<div class="gm-sl">${G.since.map((it) => `<button type="button" class="gm-si${it.rise ? ' hot' : ''}" data-yd="news" data-id="${esc(it.id)}"><i aria-hidden="true"></i><span>${esc(it.kind === 'task' ? String(it.title || '').replace(/^New task: /, '') : it.title)}</span>${it.at ? `<em>${esc(at(it.at))}</em>` : ''}</button>`).join('')}</div>`
|
|
@@ -25,6 +25,7 @@ import { ownTab, bring, tabUrl } from './rec-tab-core.js';
|
|
|
25
25
|
import * as VW from './cozy-viewer.js';
|
|
26
26
|
import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
|
|
27
27
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
28
|
+
import * as ST from './story.js';
|
|
28
29
|
import * as H from './home-data.js';
|
|
29
30
|
import { mountChat, avHtml } from './home-chat.js';
|
|
30
31
|
import * as MORE from './home-more.js';
|
|
@@ -398,7 +399,7 @@ async function readMove() {
|
|
|
398
399
|
return pmGet('/api/lab' + (q ? '?' + q : '')).then((r) => (r && r.ok && r.lab && (r.lab.loose || []).length ? { ws: L[i], board: b, n: r.lab.loose.length, say: r.lab.say || '' } : null)).catch(() => null); }));
|
|
399
400
|
L.forEach((ws, i) => {
|
|
400
401
|
const r = got[i], A = auto[i] && auto[i].ok ? auto[i] : null; if (!r || !r.ok) return;
|
|
401
|
-
const done = A ? (A.done || []).map((d) => ({ ref: d.ref, ini: d.ini || '', said: d.title || 'done', at: d.at, via: 'autonomy', reason: d.reason || '' }))
|
|
402
|
+
const done = A ? (A.done || []).map((d) => ({ ref: d.ref, ini: d.ini || '', said: d.title || 'done', at: d.at, via: 'autonomy', reason: d.reason || '', way: d.way || '' }))
|
|
402
403
|
: (r.done || []).map((d) => ({ ref: d.batch, ini: d.ini, board: d.board, said: d.said, at: d.at, via: 'proposals' }));
|
|
403
404
|
// agent-run (AwA, R4): the runs that stopped, one amber line in Claude did
|
|
404
405
|
next[ws] = { verdicts: r.verdicts || [], kr: r.kr || null, expired: r.expired || [], done, notices: A ? A.notices || [] : [], failed: A ? A.failed || [] : [] };
|
|
@@ -526,6 +527,7 @@ async function readNotePicks() {
|
|
|
526
527
|
async function gmPress(b) {
|
|
527
528
|
const act = b.dataset.yd, body = b.closest('.yd');
|
|
528
529
|
if (act === 'gm-intel') { location.href = insightsHref(deskWs()); return; }
|
|
530
|
+
if (act === 'gm-claude') { import('./cozy-settings.js').then((M) => M.openSettings('claude')); return; } // AwG: how Claude decides, per kind
|
|
529
531
|
if (act === 'gm-cal') { openCalendar(); return; }
|
|
530
532
|
if (act === 'gm-fold') {
|
|
531
533
|
const sec = body && body.querySelector('.czs-sec[data-czs-id="' + b.dataset.fold + '"]'); if (!sec) return;
|
|
@@ -1236,8 +1238,11 @@ function productPageHtml(x, ws, vid, name, g) {
|
|
|
1236
1238
|
{ id: 'reports', label: 'Reports', n: reps.length, sig: reps.some((r) => r.state === 'drafted') ? 'ready' : '', html: () => `<div class="db" data-level="product">${d ? DB.trustHtml(d) : ''}${R}</div><section class="pv-card" aria-label="More reports">${extra}</section>` },
|
|
1237
1239
|
{ id: 'documents', label: 'Documents', html: () => '<p class="pv-none">Each initiative keeps its PRD, rubric and release notes on its own page. Open one from Initiatives.</p>' },
|
|
1238
1240
|
];
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
+
// "The story so far" (board AwE): the product's Narrative under the top line, a source on every line; the top line says it is the weekly update
|
|
1242
|
+
const story = x.story ? ST.storyHtml(x.story, { sources: true }) : '';
|
|
1243
|
+
const lead = story ? 'Your weekly update is this story.' : d && d.handled ? d.handled.lead : '';
|
|
1244
|
+
const rest = story ? 'I keep it current from the records, and every line says where it came from.' : d && d.handled ? d.handled.rest : '';
|
|
1245
|
+
return PV.pageHtml({ page: 'product:' + (ws || 'own'), line: { lead, rest, warn: !story && !!(d && d.handled && d.handled.tone === 'warn') }, goal: story + goal, cards: progs + budgets, props, tabs,
|
|
1241
1246
|
tail: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
|
|
1242
1247
|
}
|
|
1243
1248
|
function productDash(b, ws, vid, name, g) {
|
|
@@ -1260,7 +1265,11 @@ function productDash(b, ws, vid, name, g) {
|
|
|
1260
1265
|
paint();
|
|
1261
1266
|
DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
|
|
1262
1267
|
DB.readKr(ws).then((k) => { x.kr = k; if (DB.krOf(k).length) paint(); });
|
|
1268
|
+
ST.readStory(ws).then((st) => { STORY.set(ws || '', st); if (JSON.stringify(st) !== JSON.stringify(x.story || null)) { x.story = st; paint(); } });
|
|
1263
1269
|
}
|
|
1270
|
+
/** The product's story (pm/story.js) by workspace, as last read: the weekly update Claude drafts leads with it. */
|
|
1271
|
+
const STORY = new Map();
|
|
1272
|
+
const deskStory = () => STORY.get(deskWs() || '') || STORY.get('') || null;
|
|
1264
1273
|
/** A phone: the page's "Message Claude about …" closes the sheet and opens the chat full screen; its ← goes back to the list (HbCPhone). */
|
|
1265
1274
|
function talk() { S.phoneChat = true; VW.close(); drawList(); chat.focus(); }
|
|
1266
1275
|
/** "Overview with Claude" on the initiative's card: the ask is typed into the chat box, for the PM to send or change. */
|
|
@@ -1711,9 +1720,10 @@ function openUpdateViewer(o = {}) {
|
|
|
1711
1720
|
const sent = (U.sent || []).find((x) => x.week === U.week.iso);
|
|
1712
1721
|
// workspace grill W2: the words come from the sections (H.updateWords); a week with nothing moved and no open risk has no update to send
|
|
1713
1722
|
const flag = U.sections.flatMap((x) => x[2]).find((x) => x.flag);
|
|
1714
|
-
const
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1723
|
+
const story = deskStory(); // board AwE: the weekly update is the story; the sections below stay what PMOS read
|
|
1724
|
+
const text = story ? ST.storyText(story) : (U.draft || sent ? H.updateWords(U) : 'Nothing moved and no risk is open this week, so there is no update to send.') + (flag ? ' ' + flag.title + ': ' + flag.flag.toLowerCase() + '.' : '');
|
|
1725
|
+
const sum = VW.czSummary({ line: sent ? 'Sent ' + new Date(sent.at).toDateString().slice(0, 10) : U.draft || story ? 'Ready to send' : 'Nothing new this week', tone: sent || !(U.draft || story) ? '' : 'you', text,
|
|
1726
|
+
meta: 'Communicator · ' + (U.to.length ? 'to ' + U.to.join(', ') : 'say who gets it under More'), primary: U.draft || sent || story ? { label: sent ? 'Send again' : 'Send now', act: 'send' } : null });
|
|
1717
1727
|
const it = (x) => x.key ? `<div class="czs-it"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span></span></div>` : `<button type="button" class="czs-it" data-hv-ini="${esc(x.id)}"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span>${x.flag ? `<span class="flag">${esc(x.flag)}</span>` : ''}</span></button>`;
|
|
1718
1728
|
// "Before you send": Claude's risks the PM has not confirmed, with one press that confirms them all (each a ✓ Keep on its program's charter)
|
|
1719
1729
|
const confirmAll = (L) => { const say = L.length === 1 ? 'Confirm this risk' : 'Confirm all ' + L.length + ' risks'; return `<p><button type="button" class="hv-chip" data-hv-confirm aria-label="${say}" title="${say}">${SVG(I.check, 15, 2.4)}</button></p>`; };
|
|
@@ -1725,13 +1735,14 @@ function openUpdateViewer(o = {}) {
|
|
|
1725
1735
|
if (edit) { const i = b.querySelector('#hvTo'); if (i) i.focus(); }
|
|
1726
1736
|
};
|
|
1727
1737
|
const U0 = H.weeklyUpdate(S.D, S.D.now);
|
|
1728
|
-
const copy = async () => { try { await navigator.clipboard.writeText(
|
|
1738
|
+
const copy = async () => { try { await navigator.clipboard.writeText(updateBody(H.weeklyUpdate(S.D, S.D.now), H.productName(S.D))); toast('The update is copied as text.'); } catch { toast('The text could not be copied.'); } };
|
|
1729
1739
|
const more = () => [
|
|
1730
1740
|
{ label: 'Change who gets it', note: U0.to.length ? U0.to.length + (U0.to.length === 1 ? ' person' : ' people') : '', on: () => { edit = !edit; draw(body); } },
|
|
1731
1741
|
{ label: 'Copy as text', on: copy },
|
|
1732
1742
|
{ label: 'Past updates', note: (U0.sent || []).length ? U0.sent.length + ((U0.sent.length === 1) ? ' week' : ' weeks') : '', on: () => { past = !past; draw(body); } },
|
|
1733
1743
|
];
|
|
1734
1744
|
const body = VW.open({ id: 'update', kind: 'Weekly update', title: H.productName(S.D) + ' · week of ' + U0.week.label, icon: 'doc', url: selfUrl({ ini: 'product' }), more: more(), render: draw });
|
|
1745
|
+
if (!STORY.has(deskWs() || '')) ST.readStory(deskWs()).then((st) => { STORY.set(deskWs() || '', st); if (st && body && body.isConnected) draw(body); });
|
|
1735
1746
|
const saveTo = async (to) => { const r = await pmPost('/api/home-desk/recipients', { ws: deskWs(), to }); if (r && r.ok) { S.D.desk.product = { ...(S.D.desk.product || {}), recipients: r.recipients }; draw(body); drawList(); } else toast((r && r.error) || 'The recipients were not saved.'); };
|
|
1736
1747
|
body.onkeydown = (e) => { if (e.target.id === 'hvTo' && (e.key === 'Enter' || e.key === ',')) { e.preventDefault(); const v = e.target.value.trim(); if (v) saveTo(H.weeklyUpdate(S.D).to.concat(v)); } };
|
|
1737
1748
|
body.onclick = async (e) => {
|
|
@@ -1753,12 +1764,14 @@ async function confirmRisks(L, after) {
|
|
|
1753
1764
|
/** This page's address for one view (the Viewer's Open in a new tab): the workspace and board of this page, and the view's own keys. */
|
|
1754
1765
|
const selfUrl = (o) => { const q = new URLSearchParams(); if (WS) q.set('ws', WS); if (BOARD) q.set('board', BOARD); for (const [k, v] of Object.entries(o)) q.set(k, v); return location.pathname + '?' + q.toString(); };
|
|
1755
1766
|
const deskWs = () => (S.D.desk && S.D.desk.ws) || ((S.D.board && S.D.board.board) || {}).ws || WS || undefined;
|
|
1767
|
+
/** The words of the weekly update: the story first when Claude keeps one (board AwE; no sources, it goes to people), then what PMOS read. */
|
|
1768
|
+
const updateBody = (U, name) => { const st = deskStory(); const t = H.updateText(U, name); if (!st) return t; const L = t.split('\n'); return [L[0], '', ST.storyText(st), '', ...L.slice(2)].join('\n'); };
|
|
1756
1769
|
async function sendUpdate() {
|
|
1757
1770
|
const U = H.weeklyUpdate(S.D, S.D.now);
|
|
1758
1771
|
if (!U.to.length) { openUpdateViewer({ edit: true }); toast('Say who the update goes to first.'); setTimeout(() => { const i = $('#hvTo'); if (i) i.focus(); }, 0); return; }
|
|
1759
1772
|
const name = H.productName(S.D), subject = name + ' · week of ' + U.week.label;
|
|
1760
1773
|
const mails = U.to.filter((x) => /@/.test(x));
|
|
1761
|
-
location.href = 'mailto:' + mails.map(encodeURIComponent).join(',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(
|
|
1774
|
+
location.href = 'mailto:' + mails.map(encodeURIComponent).join(',') + '?subject=' + encodeURIComponent(subject) + '&body=' + encodeURIComponent(updateBody(U, name) + (U.to.length > mails.length ? '\n\nAlso for: ' + U.to.filter((x) => !/@/.test(x)).join(', ') : ''));
|
|
1762
1775
|
const r = await pmPost('/api/home-desk/update-sent', { ws: deskWs(), week: U.week.iso, to: U.to, subject });
|
|
1763
1776
|
if (r && r.ok) { toast('The draft is open in your mail. Recorded as sent this week.'); await load(); if (S.ini === 'product') openTarget(updateTarget()); }
|
|
1764
1777
|
else toast((r && r.error) || 'The send was not recorded.');
|
|
@@ -128,6 +128,24 @@ function banner() {
|
|
|
128
128
|
main.insertBefore(d, main.firstChild);
|
|
129
129
|
const tabs = tabsHtml(PACK, location);
|
|
130
130
|
if (tabs) d.insertAdjacentHTML('afterend', tabs);
|
|
131
|
+
// "The story so far" (board AwF): the product's story above the timeline, as its page has it, without sources or Claude's activity
|
|
132
|
+
const st = storyOf(PACK, location);
|
|
133
|
+
if (st) (main.querySelector('.ro-tabs') || d).insertAdjacentHTML('afterend', st);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** The story of the board on screen, from the pack (lib/board-pack.js carries it as text lines). '' when the pack holds none. A program's tab
|
|
137
|
+
* (?program=) has no product story. */
|
|
138
|
+
export function storyOf(pack, loc) {
|
|
139
|
+
const q = new URLSearchParams(loc.search); if (q.get('program')) return '';
|
|
140
|
+
const R = (pack && pack.responses) || {};
|
|
141
|
+
const ws = q.get('ws') || (pack && pack.scope && pack.scope.kind === 'product' ? pack.scope.id : '');
|
|
142
|
+
const a = R['/api/artefacts/story?' + new URLSearchParams({ ws }).toString()];
|
|
143
|
+
const S = a && a.ok && a.story; const L = S && Array.isArray(S.lines) ? S.lines.filter((l) => l && l.text) : [];
|
|
144
|
+
if (!L.length) return '';
|
|
145
|
+
const day = (() => { const t = Date.parse(S.at || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }) : ''; })();
|
|
146
|
+
const sub = [pack.scope && pack.scope.kind === 'product' ? pack.scope.label : '', day ? 'as of ' + day : ''].filter(Boolean).join(' · ');
|
|
147
|
+
return '<section class="ro-story" aria-label="The story so far"><div class="ro-sth"><b>The story so far</b>' + (sub ? '<small>' + esc(sub) + '</small>' : '') + '</div>'
|
|
148
|
+
+ L.map((l) => '<p>' + esc(l.text).replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>') + '</p>').join('') + '</section>';
|
|
131
149
|
}
|
|
132
150
|
|
|
133
151
|
function start() {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* pm/story.css — "The story so far" (pm/story.js; boards AwE and AwF). Tokens only. */
|
|
2
|
+
.st-story { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
|
|
3
|
+
.st-story p { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
4
|
+
.st-story p b { font-weight: var(--fw-strong); }
|
|
5
|
+
.st-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0 0 2px; }
|
|
6
|
+
.st-h h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
|
|
7
|
+
.st-h small { font-size: var(--fs-label); color: var(--cz-ink3); line-height: var(--lh-label); }
|
|
8
|
+
.st-src { display: inline-flex; align-items: center; height: 22px; margin-left: 6px; padding: 0 8px; border-radius: 6px; background: var(--cz-well); color: var(--cz-ink3); font-size: var(--fs-label); font-weight: var(--fw-strong); vertical-align: 1px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* pm/story.js — "The story so far" (agent-run workspace boards AwE and AwF, agreed by the PM 2026-11-10).
|
|
2
|
+
* The standing Narrative of a product (D107), written by Claude from the records, read with GET /api/artefacts/story?ws.
|
|
3
|
+
*
|
|
4
|
+
* storyHtml(story, { sources, label, sub }) the card. story: { at, lines: [{ text, sources? }] }; sources true draws each line's source
|
|
5
|
+
* chips (the product page); a shared Board draws none (its pack holds none). '' when empty.
|
|
6
|
+
* storyText(story) the story as plain text: the body of the weekly update Claude drafts
|
|
7
|
+
* readStory(ws) the GET; null when there is no story or the server does not answer
|
|
8
|
+
*
|
|
9
|
+
* A line's **words** are bold. Zero is silence: no story, no card. */
|
|
10
|
+
import { pmGet } from './http.js';
|
|
11
|
+
|
|
12
|
+
const CSS = new URL('./story.css', import.meta.url).href;
|
|
13
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
14
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
15
|
+
}
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
|
+
const bold = (t) => esc(t).replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>');
|
|
18
|
+
const plain = (t) => String(t || '').replace(/\*\*([^*]+)\*\*/g, '$1');
|
|
19
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
20
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
21
|
+
/** "3 Nov 16:05" in this browser's time. */
|
|
22
|
+
export function when(iso) {
|
|
23
|
+
const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return '';
|
|
24
|
+
const d = new Date(t); return `${d.getDate()} ${MON[d.getMonth()]} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
25
|
+
}
|
|
26
|
+
const lines = (s) => (s && Array.isArray(s.lines) ? s.lines.filter((l) => l && String(l.text || '').trim()) : []);
|
|
27
|
+
|
|
28
|
+
export function storyHtml(story, o = {}) {
|
|
29
|
+
const L = lines(story); if (!L.length) return '';
|
|
30
|
+
const chip = (x) => `<span class="st-src" title="${esc(x.ref || x.label)}">${esc(x.label)}</span>`;
|
|
31
|
+
const p = L.map((l) => `<p>${bold(l.text)}${o.sources && Array.isArray(l.sources) ? l.sources.filter((x) => x && x.label).map(chip).join('') : ''}</p>`).join('');
|
|
32
|
+
const sub = o.sub != null ? o.sub : ['Claude keeps it current', when(story.at)].filter(Boolean).join(' · ');
|
|
33
|
+
return `<section class="${o.cls || 'pv-card'} st-story" aria-label="The story so far"><div class="st-h"><h4>${esc(o.label || 'The story so far')}</h4>${sub ? `<small>${esc(sub)}</small>` : ''}</div>${p}</section>`;
|
|
34
|
+
}
|
|
35
|
+
export function storyText(story) { return lines(story).map((l) => plain(l.text)).join('\n\n'); }
|
|
36
|
+
export async function readStory(ws) {
|
|
37
|
+
const r = await pmGet('/api/artefacts/story' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
38
|
+
return r && r.ok && r.story && lines(r.story).length ? r.story : null;
|
|
39
|
+
}
|
|
@@ -50,7 +50,8 @@ Procedure:
|
|
|
50
50
|
`definition` says whether the definition used is confirmed (`stable`) or only proposed (`draft`). Do not add a `timestamp` or `verified`.
|
|
51
51
|
5. Under the frontmatter: a Headline (one or two sentences: what the reader most needs to know), then the sections the definition names in its order, then "Needs your call" (decisions or answers only the PM can give), then "Sources reached and not reached" (each source kind: reached or not reached and why; private items skipped).
|
|
52
52
|
6. If the definition was a draft, say so in the first line of the Headline so the PM sees it.
|
|
53
|
-
7.
|
|
53
|
+
7. Keep the product's story current (D107 Narrative; the product page shows it as "The story so far", and the weekly update leads with it). Write 3 to 6 short sentences, one per line, on where the product stands now: what was settled, what waits, what is late, what has no verdict yet. Give one `--source` per line, in the same order, each pointing at the record that holds that sentence: `pmos artefacts set portfolio narrative now --text "<line 1>"$'\n'"<line 2>"… --source "<label>=<ref>" --source …`. A label is short ("Jira IDPF-3326 · 30 Oct"). Bold a few words with **two stars** when they are the point. A sentence with no record is left out. The story goes to people only when the PM sends it.
|
|
54
|
+
8. Finish by saying in one line where the draft is. Do not commit; the PM's Sync carries the file.
|
|
54
55
|
|
|
55
56
|
Default shape, used ONLY when proposing a definition: a weekly report: progress against initiatives, decisions made, risks, what is next. Use the report frame of D78: a Headline, then What moved, Risks and Metrics, then Needs your call and Sources reached and not reached.
|
|
56
57
|
|