create-pmos 0.556.0 → 0.557.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 -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 +13 -0
- package/workspace/guide/home.md +7 -2
- package/workspace/lib/coming-up.js +51 -0
- package/workspace/lib/routes-autonomy.js +12 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ini-agent.js +84 -24
- package/workspace/public/pm/ini-view-model.js +2 -1
- package/workspace/public/pm/ini-view.css +5 -2
- package/workspace/public/pm/ini-view.js +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.557.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.557.0",
|
|
38
|
+
"at": "2026-11-11T01:38:47.040Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1286,
|
|
43
|
+
"t": "Coming up is a short dated list of five kinds, each with its source",
|
|
44
|
+
"s": "Coming up is a short dated list of five kinds, each with its source",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.556.0",
|
|
38
51
|
"at": "2026-11-11T01:22:29.972Z",
|
|
@@ -357,19 +370,6 @@
|
|
|
357
370
|
"k": "new"
|
|
358
371
|
}
|
|
359
372
|
]
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"v": "0.537.0",
|
|
363
|
-
"at": "2026-11-05T23:09:31.438Z",
|
|
364
|
-
"f": 4,
|
|
365
|
-
"prs": [
|
|
366
|
-
{
|
|
367
|
-
"n": 1253,
|
|
368
|
-
"t": "One-row Board header, no workflow chips",
|
|
369
|
-
"s": "One-row Board header, no workflow chips",
|
|
370
|
-
"k": "new"
|
|
371
|
-
}
|
|
372
|
-
]
|
|
373
373
|
}
|
|
374
374
|
]
|
|
375
375
|
}
|
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-11T01:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T01:38:44Z"}
|
|
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-11T01:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T01:38:44Z"}
|
|
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-11T01:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T01:38:44Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.557.0",
|
|
4
|
+
"at": "2026-11-11T01:38:47.040Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1286,
|
|
9
|
+
"t": "Coming up is a short dated list of five kinds, each with its source",
|
|
10
|
+
"s": "Coming up is a short dated list of five kinds, each with its source",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.556.0",
|
|
4
17
|
"at": "2026-11-11T01:22:29.972Z",
|
package/workspace/guide/home.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Home: your list, the chat, the Viewer, My work, documents and people"
|
|
4
4
|
description: "Home's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-11
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Home
|
|
@@ -78,7 +78,12 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
|
|
|
78
78
|
|
|
79
79
|
- The page's header shows the lane and the anchor, the name, **New session** (+), ⋯, Open wide and Close.
|
|
80
80
|
- **Experiment** shows what PMOS keeps for the initiative: **We bet**, **Stop if**, **Budget**, **Who builds**, **Specimens** and **Done when**. A line that nobody wrote does not show. Press a line to change it. After you change a line, PMOS asks before it changes that line again. When an experiment is on record, **Gate to Build** shows the done test and the kill condition (D107) instead of the PRD and the rubric.
|
|
81
|
-
- **PMOS's work** lists what PMOS changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. **Coming up**
|
|
81
|
+
- **PMOS's work** lists what PMOS changed on this initiative by itself, each with its reason, its day and Undo. A run that stopped is one amber line. Under it, **Coming up** lists what is ahead, by date. Three rows show, and **N more** opens the rest. A kind with nothing ahead is not shown. Each row says where it comes from:
|
|
82
|
+
- a milestone that is due, or the end of the plan
|
|
83
|
+
- the outcome check date (a check that is already due shows in Your move instead)
|
|
84
|
+
- the kill check: the date in the experiment's stop line, or the end of its budget (amber)
|
|
85
|
+
- a PMOS job on a schedule that names this initiative
|
|
86
|
+
- something that waits on someone else: a blocked Jira ticket or an open dependency
|
|
82
87
|
- The stage card shows the stage, **N of M done** for its tasks, the days in the stage (for example "9 of ~7 days", amber when over the usual time) and → for the next stage. → turns blue when every task of the stage is done.
|
|
83
88
|
- Under the header is one line for the whole initiative. Each stage is a part of the line, on its own dates. Done stages are grey, the current stage is blue, later stages are light, and a stage with no dated task is dashed. The ◇ marks are the milestone tasks, with the name above and the date below. The end ◇ is the end date. When the initiative has milestone tasks, the end ◇ stands for one of them (one on the end date, else the latest in the last milestone stage, else the latest of all), sits on that task's own date and shows it. A thin tick is Today.
|
|
84
89
|
- Press a part to show that stage in **Tasks**. Press **N of M done** to do the same. Press a ◇ to open the milestone task in **Tasks**. Milestones a few days apart merge into one ◇ with a count. Press it to list them.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* coming-up.js — the dated things of one initiative that only the server can read (batch 29 item 7, Exploring 2 board CuA, picked by
|
|
3
|
+
* Wawan 2026-11-11). The initiative Viewer's Coming up list (pm/ini-agent.js comingUp) joins them with what the page already holds: the
|
|
4
|
+
* milestones and the plan's end, the experiment's kill condition, and what waits on someone else.
|
|
5
|
+
*
|
|
6
|
+
* aheadOf(root, ini, { today, schedules, now }) → { outcome: { date, metric, src } | null, jobs: [{ date, name, src }] }
|
|
7
|
+
* outcome the record's outcome check (outcome_metric + outcome_horizon, lib/outcomes.js), only while it is still ahead and nobody
|
|
8
|
+
* recorded a verdict. A check that is due is Your move on Home, so it is not repeated here.
|
|
9
|
+
* jobs PMOS's scheduled jobs that name this initiative (its id or its title, in the schedule's name or its request), enabled,
|
|
10
|
+
* each with its next run in the next 30 days (lib/schedule-logic.js nextRun: what is shown is what fires).
|
|
11
|
+
* Nothing here writes.
|
|
12
|
+
*/
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const DAY = 86400000;
|
|
16
|
+
const WINDOW_DAYS = 30;
|
|
17
|
+
|
|
18
|
+
function outcomeOf(root, ini, today) {
|
|
19
|
+
try {
|
|
20
|
+
const O = require('./outcomes.js');
|
|
21
|
+
const S = O.scan(root, { today });
|
|
22
|
+
const it = (S.pending || []).find((x) => x.id === ini);
|
|
23
|
+
if (!it || !it.horizon || !it.metric) return null;
|
|
24
|
+
return { date: it.horizon, metric: it.metric, src: it.record + ' · outcome_horizon' };
|
|
25
|
+
} catch { return null; }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const names = (s, words) => { const t = String(s || '').toLowerCase(); return words.some((w) => w && t.includes(w)); };
|
|
29
|
+
|
|
30
|
+
function jobsOf(ini, title, schedules, now) {
|
|
31
|
+
const L = require('./schedule-logic.js');
|
|
32
|
+
const words = [String(ini || '').toLowerCase(), String(title || '').trim().length >= 6 ? String(title).trim().toLowerCase() : ''].filter(Boolean);
|
|
33
|
+
const until = now.getTime() + WINDOW_DAYS * DAY, out = [];
|
|
34
|
+
for (const s of Array.isArray(schedules) ? schedules : []) {
|
|
35
|
+
if (!s || s.enabled === false || !(names(s.name, words) || names(s.args, words))) continue;
|
|
36
|
+
let at = null; try { at = L.nextRun(s, now); } catch { at = null; }
|
|
37
|
+
if (!at || Date.parse(at) > until) continue;
|
|
38
|
+
if (s.until && String(at).slice(0, 10) > String(s.until)) continue;
|
|
39
|
+
out.push({ date: at, name: String(s.name || s.skill || 'A scheduled job'), src: 'Scheduled ' + L.humanCadence(s) });
|
|
40
|
+
}
|
|
41
|
+
return out.sort((a, b) => a.date.localeCompare(b.date));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function aheadOf(root, ini, o = {}) {
|
|
45
|
+
const now = o.now ? new Date(o.now) : new Date();
|
|
46
|
+
const today = o.today || now.toISOString().slice(0, 10);
|
|
47
|
+
const outcome = root && ini ? outcomeOf(path.resolve(root), ini, today) : null;
|
|
48
|
+
return { outcome, jobs: jobsOf(ini, o.title || '', o.schedules || [], now) };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = { aheadOf, WINDOW_DAYS };
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* failed: the agent runs of the last 7 days that ended with an error and that no later run of the same target answered:
|
|
10
10
|
* { run, ini, at, why, source: 'driver' | 'team' }, newest first. Requirement R4: a failure is never the PM's work; it is one amber
|
|
11
11
|
* line where the work is.
|
|
12
|
+
* GET /api/autonomy/ahead?ws&ini&title → { ok, ws, ini, outcome: { date, metric, src } | null, jobs: [{ date, name, src }] }
|
|
13
|
+
* the initiative's dated things only the server reads, for the Viewer's Coming up list (lib/coming-up.js; batch 29 item 7)
|
|
12
14
|
* POST /api/autonomy/undo { ws, ref } → { ok, back, demoted? } Undo of one change: a Driver proposal (p-…) or a ✦ batch (pk-…)
|
|
13
15
|
* POST /api/autonomy/seen { ws, job, product, until } → { ok } Home said the demotion once
|
|
14
16
|
* GET /api/autonomy/kinds → { ok, kinds: [{ kind, label, made, kept, undone, auto, set, way, until }], showUntil }
|
|
@@ -124,6 +126,16 @@ async function handle(req, res, url, ctx) {
|
|
|
124
126
|
done.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
125
127
|
return send({ status: 200, body: { ok: true, ws: w.id, done, notices, failed: failedOf(w, dirs) } });
|
|
126
128
|
}
|
|
129
|
+
if (sub === 'ahead' && req.method === 'GET') {
|
|
130
|
+
const w = wsOf(ctx, url.searchParams.get('ws'));
|
|
131
|
+
if (!w) return send(bad(404, 'no such workspace'));
|
|
132
|
+
const ini = text(url.searchParams.get('ini'));
|
|
133
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(ini)) return send(bad(400, 'ini is required'));
|
|
134
|
+
let schedules = [];
|
|
135
|
+
try { schedules = require('./report-needs.js').readSchedules(); } catch { /* none */ }
|
|
136
|
+
const r = require('./coming-up.js').aheadOf(w.root, ini, { title: text(url.searchParams.get('title')), schedules });
|
|
137
|
+
return send({ status: 200, body: { ok: true, ws: w.id, ini, ...r } });
|
|
138
|
+
}
|
|
127
139
|
if (sub === 'kinds' && req.method === 'GET') {
|
|
128
140
|
const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
|
|
129
141
|
const dirs = [];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.557.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.557.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Wawan 2026-11-10; requirements R4, R5, R7, R12, R17, R18 and decision D107). Pure parts first: Node imports them (ini-agent.test.js).
|
|
3
3
|
*
|
|
4
4
|
* agentModel(art, auto, id, o) → M | null what the Viewer shows, from GET /api/artefacts?scope=experiment:<id> and GET /api/autonomy
|
|
5
|
-
* expHtml(M) · workHtml(M) · sectionsHtml(M) the Experiment section
|
|
6
|
-
*
|
|
5
|
+
* expHtml(M) · workHtml(M) · comingHtml(rows) · sectionsHtml(M, v) the Experiment section, PMOS's work (with its amber line) and
|
|
6
|
+
* Coming up, each '' when it has nothing to say
|
|
7
|
+
* comingUp(v, M) → [row] what is ahead for the initiative, dated, oldest first (batch 29 item 7, board CuA)
|
|
7
8
|
* gateOf(M) → { label, parts } | null D107: the gate to Build reads the done test and the kill condition, not PRD and rubric
|
|
8
9
|
* want(ws, id, done) · cached(id) · edit(body, btn) · save(body, form) · undo(btn) the reads and presses (the page only)
|
|
9
10
|
*
|
|
@@ -12,14 +13,24 @@
|
|
|
12
13
|
* written there is no section (zero is silence). The PM edits a one-line field in place (POST /api/artefacts/set); Claude then asks before
|
|
13
14
|
* it changes that line again (lib/artefacts.js pmEdited).
|
|
14
15
|
* CLAUDE'S WORK (R7): the changes Claude made here by itself in the last 14 days (GET /api/autonomy done, by initiative), each with its
|
|
15
|
-
* one-line reason, its day and Undo; a run that stopped is one amber line (R4)
|
|
16
|
+
* one-line reason, its day and Undo; a run that stopped is one amber line (R4).
|
|
17
|
+
* COMING UP (R5; batch 29 item 7, Exploring 2 board CuA, picked by Wawan 2026-11-11): a short dated list under its own head, three rows and
|
|
18
|
+
* "N more", in the same row shape as PMOS's work. Five kinds, each row naming its source; a kind with nothing ahead is not drawn:
|
|
19
|
+
* due the open milestones ahead and the plan's end (the Viewer's stage model) ◇
|
|
20
|
+
* outcome the record's outcome check date, while it is still ahead (GET /api/autonomy/ahead) target
|
|
21
|
+
* kill the date in the experiment's stop line, else its budget's end flag (amber)
|
|
22
|
+
* job PMOS's scheduled jobs that name this initiative, next 30 days (…/ahead) clock: PMOS does it
|
|
23
|
+
* wait what waits on someone else: a blocked Jira ticket, an open dependency person
|
|
24
|
+
* A check that is already due is Your move on Home, so nothing here repeats it.
|
|
16
25
|
* Icon-only presses carry their words in aria-label and title. */
|
|
17
26
|
import { pmGet, pmPost } from './http.js';
|
|
18
27
|
|
|
19
28
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
29
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
21
30
|
const P = { undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', check: 'M5 12l5 5 9-10', warn: 'M12 8v5M12 16.5v.01M10.3 3.9L2.6 17.5A2 2 0 0 0 4.3 20.5h15.4a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z',
|
|
22
|
-
clock: 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17', x: 'M6 6l12 12M18 6L6 18', right: 'M10 7l5 5-5 5'
|
|
31
|
+
clock: 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17', x: 'M6 6l12 12M18 6L6 18', right: 'M10 7l5 5-5 5',
|
|
32
|
+
flag: 'M5 21V4M5 4h11l-2 4 2 4H5', target: 'M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 11.5v1',
|
|
33
|
+
person: 'M12 4a3.5 3.5 0 1 0 0 7a3.5 3.5 0 1 0 0-7M5 20a7 7 0 0 1 14 0', ms: 'M12 3.5l8.5 8.5-8.5 8.5-8.5-8.5z' };
|
|
23
34
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
24
35
|
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
25
36
|
const DAY = 864e5, SHOW = 3;
|
|
@@ -57,7 +68,9 @@ export function agentModel(A, U, id, o = {}) {
|
|
|
57
68
|
const fl = ((U && U.failed) || []).filter((f) => f && f.ini === id && now - Date.parse(f.at || '') <= 7 * DAY);
|
|
58
69
|
const failed = fl.length ? { n: fl.length, at: fl[0].at, why: fl[0].why || '' } : null;
|
|
59
70
|
const week = work.filter((w) => now - Date.parse(w.at) <= 7 * DAY).length;
|
|
60
|
-
|
|
71
|
+
const AH = o.ahead && o.ahead.ok !== false ? o.ahead : null;
|
|
72
|
+
const ahead = AH ? { outcome: AH.outcome || null, jobs: Array.isArray(AH.jobs) ? AH.jobs : [] } : null;
|
|
73
|
+
return { id, ws: (U && U.ws) || (A && A.ws) || '', exp, gate, work, week, failed, ahead, kill: kill ? kill.text : '', budget: budget ? budget.text : '' };
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
/** D107: with an experiment on record, the gate to Build is its done test and its kill condition (not the PRD and the rubric). */
|
|
@@ -66,15 +79,47 @@ export function gateOf(M) {
|
|
|
66
79
|
return { label: 'Gate to Build', parts: [{ text: 'done test', ok: M.gate.done, ...(M.gate.done ? {} : { note: 'No done test is written yet' }) }, { text: 'kill condition', ok: M.gate.kill, ...(M.gate.kill ? {} : { note: 'No kill condition is written yet' }) }] };
|
|
67
80
|
}
|
|
68
81
|
|
|
69
|
-
/**
|
|
70
|
-
export function
|
|
82
|
+
/** A date written in a line ("by 30 Nov", "Nov 30", "2026-11-30") as YYYY-MM-DD, on or after today; '' when it names none. */
|
|
83
|
+
export function dateIn(text, today) {
|
|
84
|
+
const t = String(text || ''), y0 = +String(today || '').slice(0, 4) || new Date().getFullYear();
|
|
85
|
+
let m = /\b(\d{4})-(\d{2})-(\d{2})\b/.exec(t);
|
|
86
|
+
if (m) return m[0];
|
|
87
|
+
const mon = (w) => MON.findIndex((x) => x.toLowerCase() === String(w).slice(0, 3).toLowerCase());
|
|
88
|
+
m = /\b(\d{1,2})\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?(?:,?\s+(\d{4}))?/i.exec(t);
|
|
89
|
+
let d = m ? +m[1] : 0, k = m ? mon(m[2]) : -1, y = m && m[3] ? +m[3] : 0;
|
|
90
|
+
if (!m) { m = /\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\.?\s+(\d{1,2})\b(?:,?\s+(\d{4}))?/i.exec(t); if (m) { d = +m[2]; k = mon(m[1]); y = m[3] ? +m[3] : 0; } }
|
|
91
|
+
if (!m || k < 0 || d < 1 || d > 31) return '';
|
|
92
|
+
const iso = (yy) => yy + '-' + String(k + 1).padStart(2, '0') + '-' + String(d).padStart(2, '0');
|
|
93
|
+
// no year written: this year's date, else next year's when this year's has passed
|
|
94
|
+
return y ? iso(y) : iso(y0) >= String(today || '') ? iso(y0) : iso(y0 + 1);
|
|
95
|
+
}
|
|
96
|
+
const stop = (s) => String(s || '').trim().replace(/[.!?]?$/, '.');
|
|
97
|
+
|
|
98
|
+
/** What is ahead for the initiative: v is the Viewer's model (ini-view-model.js iniView), M this file's agentModel. Dated rows oldest
|
|
99
|
+
* first, then the undated waits; each { kind, iso, text, src }. Nothing ahead: []. */
|
|
100
|
+
export function comingUp(v, M) {
|
|
101
|
+
const today = (v && v.today) || new Date().toISOString().slice(0, 10), out = [];
|
|
102
|
+
const add = (kind, iso, text, src) => { const d = String(iso || '').slice(0, 10); if (d && d < today) return; out.push({ kind, iso: d, text, src }); };
|
|
71
103
|
const st = v && v.stage;
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
|
|
104
|
+
for (const g of (st && st.gates && st.gates.open) || []) if (!g.late && g.iso) add('due', g.iso, stop(g.name + ' is due'), 'From the milestone task' + (g.owner ? ', owner ' + g.owner : ''));
|
|
105
|
+
if (st && st.endIso && st.dates && !st.dates.over) add('due', st.endIso, 'The plan ends.', 'From the initiative’s end date');
|
|
106
|
+
const A = M && M.ahead;
|
|
107
|
+
if (A && A.outcome && A.outcome.date) add('outcome', A.outcome.date, stop('Outcome check: ' + (A.outcome.metric || 'the outcome')), 'From the outcome check date on the record');
|
|
108
|
+
if (M && M.kill) {
|
|
109
|
+
const k = dateIn(M.kill, today), b = k ? '' : dateIn(M.budget, today);
|
|
110
|
+
if (k || b) add('kill', k || b, stop('Kill check: ' + M.kill), k ? 'From the experiment’s stop line' : 'From the end of the experiment’s budget');
|
|
111
|
+
}
|
|
112
|
+
for (const j of (A && A.jobs) || []) add('job', j.date, stop('PMOS runs “' + j.name + '”'), 'From the schedule, ' + j.src.replace(/^Scheduled /, ''));
|
|
113
|
+
for (const sec of (v && v.tasks && v.tasks.sections) || []) {
|
|
114
|
+
for (const k of (sec.jira && sec.jira.open) || []) if (k.warn) add('wait', /^\d{4}-\d{2}-\d{2}/.test(k.due || '') ? k.due : '', stop(k.title + ' waits'), 'From Jira ' + k.key + (k.sub ? ': ' + k.sub : ''));
|
|
115
|
+
}
|
|
116
|
+
for (const l of (v && v.linked) || []) {
|
|
117
|
+
if (l.kind !== 'dep' || /: done$/.test(l.title || '')) continue;
|
|
118
|
+
add('wait', '', stop(l.label), 'From a dependency on the record');
|
|
119
|
+
}
|
|
120
|
+
const seen = new Set();
|
|
121
|
+
return out.filter((r) => { const k = r.kind + '|' + r.iso + '|' + r.text; if (seen.has(k)) return false; seen.add(k); return true; })
|
|
122
|
+
.sort((a, b) => (a.iso ? 0 : 1) - (b.iso ? 0 : 1) || a.iso.localeCompare(b.iso));
|
|
78
123
|
}
|
|
79
124
|
|
|
80
125
|
const failLine = (F) => `<div class="ia-fl" role="status">${SVG(P.warn, 14, 2)}<span>${esc((F.n === 1 ? 'The ' + dm(F.at) + ' run' : F.n + ' runs') + ' ended with an error.' + (F.why ? ' ' + String(F.why).replace(/\.?$/, '.') : '') + ' PMOS runs ' + (F.n === 1 ? 'it' : 'them') + ' again on the next wake. Nothing ' + (F.n === 1 ? 'it' : 'they') + ' made was kept.')}</span></div>`;
|
|
@@ -90,21 +135,32 @@ export function expHtml(M) {
|
|
|
90
135
|
+ `<div class="iv-folds">${M.exp.rows.map(rowHtml).join('')}<p class="ia-note">Press a line to edit it. PMOS asks before it changes one you edited.</p></div></section>`;
|
|
91
136
|
}
|
|
92
137
|
|
|
93
|
-
export function workHtml(M,
|
|
94
|
-
if (!M || (!M.work.length && !M.failed
|
|
138
|
+
export function workHtml(M, o = {}) {
|
|
139
|
+
if (!M || (!M.work.length && !M.failed)) return '';
|
|
95
140
|
const all = !!o.all, shown = all ? M.work : M.work.slice(0, SHOW), more = M.work.length - shown.length;
|
|
96
141
|
const row = (w) => `<div class="ia-dr" data-ref="${esc(w.ref)}"><span class="ck" aria-hidden="true">${SVG(P.check, 12, 2.6)}</span><span><b>${esc(w.title)}</b><em>${esc([w.reason, dm(w.at)].filter(Boolean).join(' · '))}</em></span>`
|
|
97
142
|
+ `<button type="button" class="yd-alt sm" data-ia-undo="${esc(w.ref)}" data-ws="${esc(w.ws)}" aria-label="${esc('Undo: ' + w.title)}" title="Undo">${SVG(P.undo, 16, 2)}</button></div>`;
|
|
98
|
-
const list =
|
|
99
|
-
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-more aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div>'
|
|
100
|
-
const cu = up ? `<p class="ia-cu">${SVG(P.clock, 14, 2)}<span><b>${esc('Coming up · ' + up.date + '.')}</b> ${esc(up.text)}</span></p>` : '';
|
|
143
|
+
const list = `<div class="iv-folds">${M.failed ? failLine(M.failed) : ''}${shown.map(row).join('')}`
|
|
144
|
+
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-more aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div>';
|
|
101
145
|
const n = M.week ? M.week + ' this week' : M.work.length ? M.work.length + ' in 14 days' : '';
|
|
102
|
-
return `<section class="ia-sec" aria-label="PMOS’s work" data-ia-work><div class="ia-th"><b>PMOS’s work</b>${n ? `<span class="n">${esc(n)}</span>` : ''}</div>${list}
|
|
146
|
+
return `<section class="ia-sec" aria-label="PMOS’s work" data-ia-work><div class="ia-th"><b>PMOS’s work</b>${n ? `<span class="n">${esc(n)}</span>` : ''}</div>${list}</section>`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const SIGN = { due: ['ms', ''], outcome: ['target', ''], kill: ['flag', ' k'], job: ['clock', ''], wait: ['person', ''] };
|
|
150
|
+
/** Coming up (board CuA): three rows and "N more", the PMOS's work row shape; the sign says who acts. Nothing ahead: ''. */
|
|
151
|
+
export function comingHtml(rows, o = {}) {
|
|
152
|
+
if (!rows || !rows.length) return '';
|
|
153
|
+
const all = !!o.all, shown = all ? rows : rows.slice(0, SHOW), more = rows.length - shown.length;
|
|
154
|
+
const row = (r) => { const [ic, cls] = SIGN[r.kind] || SIGN.due;
|
|
155
|
+
return `<div class="ia-dr ia-up" data-kind="${esc(r.kind)}"><span class="ck up${cls}" aria-hidden="true">${SVG(P[ic], 12, 2.2)}</span><span><b>${esc((r.iso ? dm(r.iso) + ' · ' : '') + r.text)}</b><em>${esc(stop(r.src))}</em></span></div>`; };
|
|
156
|
+
return `<section class="ia-sec" aria-label="Coming up" data-ia-cu><div class="ia-th"><b>Coming up</b><span class="n">${esc(rows.length + ' ahead')}</span></div><div class="iv-folds">${shown.map(row).join('')}`
|
|
157
|
+
+ (more > 0 ? `<button type="button" class="iv-fr" data-ia-cumore aria-expanded="false"><b>${more} more</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '')
|
|
158
|
+
+ (all && rows.length > SHOW ? `<button type="button" class="iv-fr" data-ia-cumore aria-expanded="true"><b>Fewer</b><span class="iv-cv" aria-hidden="true">${SVG(P.right, 14, 2)}</span></button>` : '') + '</div></section>';
|
|
103
159
|
}
|
|
104
160
|
|
|
105
161
|
/** Both sections in one holder the page can swap when the reads arrive. */
|
|
106
162
|
export function sectionsHtml(M, v, id, o = {}) {
|
|
107
|
-
return `<div class="ia" data-ia="${esc(id)}">${expHtml(M)}${workHtml(M, comingUp(v), o)}</div>`;
|
|
163
|
+
return `<div class="ia" data-ia="${esc(id)}">${expHtml(M)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
|
|
108
164
|
}
|
|
109
165
|
|
|
110
166
|
/* ── the reads and the presses (the page only) ── */
|
|
@@ -113,15 +169,16 @@ const FRESH_MS = 30e3;
|
|
|
113
169
|
export const cached = (id) => (CACHE.get(id) || {}).M || null;
|
|
114
170
|
export const allOpen = (id) => OPEN.has(id);
|
|
115
171
|
/** Read the experiment and Claude's work for one initiative, at most every 30 s; done() runs when the answer changed what shows. */
|
|
116
|
-
export function want(ws, id, done) {
|
|
172
|
+
export function want(ws, id, done, title) {
|
|
117
173
|
if (!id) return;
|
|
118
174
|
const c = CACHE.get(id), k = ws + '|' + id;
|
|
119
175
|
if (c && Date.now() - c.at < FRESH_MS) return;
|
|
120
176
|
if (WANT.has(k)) return;
|
|
121
177
|
const q = ws ? 'ws=' + encodeURIComponent(ws) + '&' : '';
|
|
122
|
-
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)
|
|
123
|
-
|
|
124
|
-
|
|
178
|
+
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null),
|
|
179
|
+
pmGet('/api/autonomy/ahead?' + q + 'ini=' + encodeURIComponent(id) + (title ? '&title=' + encodeURIComponent(title) : '')).catch(() => null)])
|
|
180
|
+
.then(([a, u, h]) => {
|
|
181
|
+
const M = agentModel(a && a.ok ? a : null, u && u.ok ? u : null, id, { ahead: h && h.ok ? h : null });
|
|
125
182
|
const was = JSON.stringify(cached(id));
|
|
126
183
|
CACHE.set(id, { M, at: Date.now() });
|
|
127
184
|
if (JSON.stringify(M) !== was && done) done();
|
|
@@ -130,6 +187,9 @@ export function want(ws, id, done) {
|
|
|
130
187
|
}
|
|
131
188
|
const forget = (id) => { const c = CACHE.get(id); if (c) c.at = 0; };
|
|
132
189
|
export function toggleMore(id) { if (OPEN.has(id)) OPEN.delete(id); else OPEN.add(id); }
|
|
190
|
+
/** Coming up's own "N more" and "Fewer", kept apart from PMOS's work. */
|
|
191
|
+
export const cuOpen = (id) => OPEN.has('cu|' + id);
|
|
192
|
+
export function toggleCu(id) { toggleMore('cu|' + id); }
|
|
133
193
|
|
|
134
194
|
/** A press on a field: the line turns into its editor (a text field, or the three builders for Who builds). */
|
|
135
195
|
export function edit(btn) {
|
|
@@ -243,7 +243,7 @@ export function iniView(r, ctx = {}) {
|
|
|
243
243
|
// the way to finish the stage (R5): the stage's count, and its milestone tasks, the open ones by date, the done ones counted
|
|
244
244
|
const msRows = curRows.filter((x) => x.ms && !x.wont);
|
|
245
245
|
const gates = {
|
|
246
|
-
open: msRows.filter((x) => !x.closed).sort((a, b2) => (a.end || '9999').localeCompare(b2.end || '9999')).map((x) => ({ id: x.uid, name: x.title, date: x.end ? dateY(x.end, today) : '', late: x.late,
|
|
246
|
+
open: msRows.filter((x) => !x.closed).sort((a, b2) => (a.end || '9999').localeCompare(b2.end || '9999')).map((x) => ({ id: x.uid, name: x.title, date: x.end ? dateY(x.end, today) : '', iso: x.end || '', late: x.late,
|
|
247
247
|
ago: x.late ? between(dayOf(x.end), today) : 0, left: !x.late && x.end && dayOf(x.end) >= today ? between(today, dayOf(x.end)) : null, owner: x.owner, av: x.av })),
|
|
248
248
|
done: msRows.filter((x) => x.closed).length,
|
|
249
249
|
};
|
|
@@ -255,6 +255,7 @@ export function iniView(r, ctx = {}) {
|
|
|
255
255
|
doneOf, nDone: sDone, nTotal: sTotal, nLate: curRows.filter((x) => !x.closed && x.late).length, gates, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
256
256
|
clock: days != null && !line.chip ? (usual != null ? days + ' of ~' + usual + ' days' : plural(days, 'day', 'days')) : '', line, ready,
|
|
257
257
|
ladder: list.map((s) => ({ name: s.name, ms: s.ms, cls: s.status })), dates, next: nx,
|
|
258
|
+
endIso: r.end && !finished ? String(r.end).slice(0, 10) : '', // the plan's end as a date: Coming up sorts by it (pm/ini-agent.js comingUp)
|
|
258
259
|
// the old stages' own days, kept after a switch merged them (batch 20 item 3, canvas WmD): "Before the switch: Triage 4 days · Discover 12 days"
|
|
259
260
|
before: Array.isArray(tr.before) && tr.before.length ? 'Before the switch: ' + tr.before.map((b) => b.name + ' ' + plural(b.days, 'day', 'days')).join(' · ') : '',
|
|
260
261
|
aria: cur >= 0 ? 'Stage ' + (cur + 1) + ' of ' + list.length + ' of ' + ((r.wf && r.wf.name) || 'Product feature') + ': ' + st.name + '.' + (nx ? ' Next stage: ' + nx.name + '.' : '') : 'No stage on record.',
|
|
@@ -1346,8 +1346,11 @@ button.ia-xr:hover { background: var(--cz-well); }
|
|
|
1346
1346
|
.ia-dr em { display: block; font-style: normal; font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
1347
1347
|
.ia-dr .yd-alt.sm { flex: none; width: 36px; height: 36px; }
|
|
1348
1348
|
.ia-fl { display: flex; gap: 8px; align-items: flex-start; margin: 8px 8px 4px; padding: 9px 12px; border-radius: 12px; background: var(--cz-latebg); color: var(--cz-late); font-size: var(--fs-label); line-height: 1.45; }
|
|
1349
|
-
.ia-fl svg
|
|
1350
|
-
|
|
1349
|
+
.ia-fl svg { flex: none; margin-top: 2px; }
|
|
1350
|
+
/* Coming up (batch 29 item 7, board CuA): the PMOS's work row with a quiet sign; the kill check is amber */
|
|
1351
|
+
.ia-dr .ck.up { background: var(--cz-well); color: var(--cz-blueink); }
|
|
1352
|
+
.ia-dr .ck.up.k { background: var(--cz-latebg); color: var(--cz-late); }
|
|
1353
|
+
.ia-up { padding-right: 12px; }
|
|
1351
1354
|
@media (max-width: 760px) { .ia-xr { flex-direction: column; gap: 2px; } .ia-xr > b { width: auto; } }
|
|
1352
1355
|
.ia .yd-ok, .ia .yd-alt { flex: none; border: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font: inherit; width: 36px; height: 36px; border-radius: 18px; }
|
|
1353
1356
|
.ia .yd-ok { background: var(--cz-blue); color: var(--cz-onsolid); }
|
|
@@ -418,7 +418,7 @@ export function viewHtml(v, o = {}) {
|
|
|
418
418
|
if (v.merged) return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${smMerged(v.merged)}</div><div class="iv-cr">${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
419
419
|
// One reading column: summary, milestones and proposals, then content-sized Tasks and document folds.
|
|
420
420
|
return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${ctrlHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}</div>`
|
|
421
|
-
+ `<div class="iv-cr">${v.id ? IA.sectionsHtml(AM, v, v.id, { all: IA.allOpen(v.id) }) : ''}<section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
421
|
+
+ `<div class="iv-cr">${v.id ? IA.sectionsHtml(AM, v, v.id, { all: IA.allOpen(v.id), cuAll: IA.cuOpen(v.id) }) : ''}<section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
/* ── the presses ── */
|
|
@@ -430,14 +430,14 @@ export function wireView(body, h) {
|
|
|
430
430
|
const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); about(id); agent(id); fitMission(body); };
|
|
431
431
|
// agent-run (AwB): the experiment and Claude's work, read every 30 s at most; they draw alone (and the gate with them) when they change
|
|
432
432
|
const wsOf = () => { const H = body.__iv || {}; return ((H.where && H.where()) || {}).ws || ''; };
|
|
433
|
-
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id)); };
|
|
433
|
+
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id), (VIEWED.get(id) || {}).title); };
|
|
434
434
|
const paintAgent = (id) => {
|
|
435
435
|
if (idOf() !== id || !VIEWED.has(id)) return;
|
|
436
436
|
const v0 = VIEWED.get(id), M = IA.cached(id), g = IA.gateOf(M), v = g ? { ...v0, stage: { ...v0.stage, gate: g } } : v0;
|
|
437
437
|
VIEWED.set(id, v);
|
|
438
438
|
// replace only what changed: a node another press holds (a task card's day picker) is never swapped for an identical copy
|
|
439
439
|
const swap = (n, html) => { const t = document.createElement('template'); t.innerHTML = html; const x = t.content.firstElementChild; if (!x || !x.isEqualNode(n)) n.outerHTML = html; };
|
|
440
|
-
const at = body.querySelector('[data-ia]'); if (at) swap(at, IA.sectionsHtml(M, v, id, { all: IA.allOpen(id) }));
|
|
440
|
+
const at = body.querySelector('[data-ia]'); if (at) swap(at, IA.sectionsHtml(M, v, id, { all: IA.allOpen(id), cuAll: IA.cuOpen(id) }));
|
|
441
441
|
if (g) for (const n of body.querySelectorAll('.iv-gate')) swap(n, srcGateHtml({ gate: g }));
|
|
442
442
|
};
|
|
443
443
|
// the success measure Claude drafted: read once per page load, the view draws again when it arrives
|
|
@@ -486,6 +486,7 @@ export function wireView(body, h) {
|
|
|
486
486
|
if ('iaCancel' in d) { e.preventDefault(); paintAgent(id); return; }
|
|
487
487
|
if (d.iaUndo) { e.preventDefault(); IA.undo(b, wsOf(), () => paintAgent(id), H.toast); return; }
|
|
488
488
|
if ('iaMore' in d) { e.preventDefault(); IA.toggleMore(id); paintAgent(id); return; }
|
|
489
|
+
if ('iaCumore' in d) { e.preventDefault(); IA.toggleCu(id); paintAgent(id); return; }
|
|
489
490
|
if (d.ivMc) { e.preventDefault(); const M = MD.measuresOf(id); mcToggle(id, d.ivMc, { proposal: !!(M && M.mode === 'open') }); if (H.redraw) H.redraw(); later(b, (r) => r.querySelector(`[data-iv-mc="${d.ivMc}"]`), true); return; }
|
|
490
491
|
if (d.abMore && AB.pressMore(b, H.redraw)) { e.preventDefault(); return; }
|
|
491
492
|
if (d.md && MD.press(b, { redraw: H.redraw, toast: H.toast })) { e.preventDefault(); return; }
|