create-pmos 0.360.0 → 0.362.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 +35 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-sources-test.js +22 -0
- package/workspace/briefing-premium-test.js +12 -1
- package/workspace/changelog.json +34 -0
- package/workspace/guide/briefing-premium.md +6 -3
- package/workspace/lib/board-premium.js +8 -3
- package/workspace/lib/engine/boards.js +5 -3
- package/workspace/lib/first-input.js +44 -5
- package/workspace/lib/harness-health.js +95 -0
- package/workspace/lib/proactive.js +21 -3
- package/workspace/lib/refresh-run.js +20 -0
- package/workspace/lib/refresh.js +38 -4
- package/workspace/lib/routes-board-premium.js +1 -1
- package/workspace/lib/routes-boards.js +15 -1
- package/workspace/lib/routes-sources.js +4 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-jira-test.js +22 -6
- package/workspace/public/pm/premium-board.js +3 -3
- package/workspace/public/pm/premium-shell.js +24 -6
- package/workspace/public/pm/premium-vw-jira-model.js +8 -5
- package/workspace/public/pm/premium-vw-jira.css +9 -0
- package/workspace/public/pm/premium-vw-jira.js +21 -9
- package/workspace/public/pm/premium.css +6 -0
- package/workspace/server.js +69 -16
- package/workspace/test-lists/harness-health.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.362.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,40 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.362.0",
|
|
37
|
+
"at": "2026-10-21T00:23:03.151Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 961,
|
|
42
|
+
"t": "Settings lists every connector of your Claude session",
|
|
43
|
+
"s": "Settings › Connectors lists every connector your Claude session has, and says that your sessions can use all of them while a switch only chooses what PMOS reads on its own."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"n": 963,
|
|
47
|
+
"t": "The premium Board release card lists the board's past releases",
|
|
48
|
+
"s": "The premium Board release card lists the board's past releases"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"n": 964,
|
|
52
|
+
"t": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket",
|
|
53
|
+
"s": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"v": "0.361.0",
|
|
59
|
+
"at": "2026-10-21T00:14:19.012Z",
|
|
60
|
+
"f": 2,
|
|
61
|
+
"prs": [
|
|
62
|
+
{
|
|
63
|
+
"n": 960,
|
|
64
|
+
"t": "The morning brief runs on fresh sources; Sources says whether background work runs",
|
|
65
|
+
"s": "PMOS reads the pane after it presses Enter."
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
35
69
|
{
|
|
36
70
|
"v": "0.360.0",
|
|
37
71
|
"at": "2026-10-20T13:51:06.028Z",
|
|
@@ -267,30 +301,6 @@
|
|
|
267
301
|
"s": "A file path in Claude's words is underlined, and pressing it opens the file read-only as a viewer tab beside the conversation."
|
|
268
302
|
}
|
|
269
303
|
]
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"v": "0.342.0",
|
|
273
|
-
"at": "2026-10-20T04:02:58.586Z",
|
|
274
|
-
"f": 2,
|
|
275
|
-
"prs": [
|
|
276
|
-
{
|
|
277
|
-
"n": 937,
|
|
278
|
-
"t": "Label rows in premium cards no longer overlap at phone width",
|
|
279
|
-
"s": "The rows stay as two columns, one row per label, at every width."
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"v": "0.341.0",
|
|
285
|
-
"at": "2026-10-20T03:46:04.473Z",
|
|
286
|
-
"f": 2,
|
|
287
|
-
"prs": [
|
|
288
|
-
{
|
|
289
|
-
"n": 936,
|
|
290
|
-
"t": "The premium chat panel draws Claude's markdown, hides paste tags and quiets tool lines",
|
|
291
|
-
"s": "Claude's turns render as markdown, the way Claude Code shows them."
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
304
|
}
|
|
295
305
|
]
|
|
296
306
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-10-
|
|
1
|
+
kernel-source: pmos@245c2ee7
|
|
2
|
+
assembled: 2026-10-21
|
|
3
3
|
mode: vendor
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T00:22:59Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T00:22:59Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T00:22:59Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
|
@@ -115,7 +115,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
115
115
|
|
|
116
116
|
/* B9 B8 */
|
|
117
117
|
ok('B9 with no Jira read the sprint card says so and draws nothing', await p.evaluate(() => /No sprint is on record/.test(document.querySelector('#sprBody').textContent) && document.querySelector('#sprCap').textContent === 'none' && !document.querySelector('#sprBody .spr')));
|
|
118
|
-
ok('B8 with no release the card says none is
|
|
118
|
+
ok('B8 with no release the card says none is on record', await p.evaluate(() => /No release is on record/.test(document.querySelector('#relBody').textContent)));
|
|
119
119
|
{
|
|
120
120
|
const R = await open({ model: mk({ sprints: { source: 'jira', readAt: '2026-10-16', sprints: [{ name: 'Sprint 42', state: 'active', start: '2026-10-12', end: '2026-10-23', counts: { todo: 11, doing: 9, done: 14 }, goal: 'Self-serve onboarding reaches beta' }] }, nextRelease: { id: 'r1', type: 'minor', at: '2026-10-23T00:00:00Z' } }) });
|
|
121
121
|
const d = await R.page.evaluate(() => ({ sp: document.querySelector('#sprBody').textContent.replace(/\s+/g, ' '), cnt: [...document.querySelectorAll('#sprBody .cnt b')].map((b) => b.textContent).join(), rel: document.querySelector('#relBody').textContent.replace(/\s+/g, ' '), cap: document.querySelector('#relCap').textContent }));
|
|
@@ -116,6 +116,28 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
|
|
|
116
116
|
await ctx.close();
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
{ /* harness-health: the background line at the top of Sources, and the chip's dot takes its level */
|
|
120
|
+
const api = (await json('GET', '/api/sources')).body;
|
|
121
|
+
const h = api && api.health;
|
|
122
|
+
ok('H1 GET /api/sources carries the background health: a level, a line and the issues', h && ['ok', 'warn', 'bad'].includes(h.level) && typeof h.line === 'string' && h.line.length > 10 && Array.isArray(h.issues), JSON.stringify(h));
|
|
123
|
+
const shot = process.env.PMOS_SHOT_DIR || '';
|
|
124
|
+
for (const theme of ['light', 'dark']) {
|
|
125
|
+
const { ctx, page, errors } = await open({ theme, w: theme === 'dark' ? 390 : 1280, h: 844 });
|
|
126
|
+
await page.waitForFunction(() => /sdot (ok|warn|bad)/.test((document.querySelector('#srcDot') || {}).className || ''), null, { timeout: 15000 }).catch(() => {});
|
|
127
|
+
const dot = await page.$eval('#srcDot', (e) => e.className);
|
|
128
|
+
if (theme === 'light') await page.click('#srcChip'); else { await page.click('#moreBtn'); await page.click('#srcItem'); }
|
|
129
|
+
await page.waitForSelector('#srcHealth .hline', { timeout: 15000 }).catch(() => {});
|
|
130
|
+
const line = await page.$eval('#srcHealth', (e) => ({ text: e.textContent.trim(), dot: (e.querySelector('.sdot') || {}).className || '', w: Math.round(e.getBoundingClientRect().width), sw: document.documentElement.scrollWidth }));
|
|
131
|
+
if (theme === 'light') {
|
|
132
|
+
ok('H2 Sources opens with the background line on top, in the level\'s colour', line.text.startsWith(h.line.slice(0, 20)) && line.dot === 'sdot ' + (h.level === 'ok' ? 'ok' : h.level), JSON.stringify(line));
|
|
133
|
+
ok('H3 the chip\'s dot is red only when background work stopped', h.level === 'bad' ? dot === 'sdot bad' : dot !== 'sdot bad', dot);
|
|
134
|
+
} else ok('H4 on a phone the line fits: no sideways scroll', line.sw <= 390 && line.w > 0, JSON.stringify(line));
|
|
135
|
+
if (shot) { await sleep(1200); await page.screenshot({ path: path.join(shot, 'sources-health-' + theme + '.png') }); }
|
|
136
|
+
ok('H no page error (' + theme + ')', errors.length === 0, errors.join(' | '));
|
|
137
|
+
await ctx.close();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
119
141
|
{
|
|
120
142
|
const html = await (await fetch(BASE + '/')).text();
|
|
121
143
|
const nonce = (/<meta name="pmos-nonce" content="([^"]*)"/.exec(html) || [])[1] || '';
|
|
@@ -50,7 +50,10 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
50
50
|
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the briefing-premium suite cannot run'); return finish(1); }
|
|
51
51
|
let chromium;
|
|
52
52
|
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed — the briefing-premium suite cannot run'); return finish(1); }
|
|
53
|
-
|
|
53
|
+
// the Claude config the server reads the session's connectors from (premium-settings S5): two that back a source, BigQuery that backs none
|
|
54
|
+
const CFG = path.join(T.STATE_DIR, 'claude-config'); fs.mkdirSync(CFG, { recursive: true });
|
|
55
|
+
fs.writeFileSync(path.join(CFG, '.claude.json'), JSON.stringify({ claudeAiMcpEverConnected: ['claude.ai Google Calendar', 'claude.ai Slack', 'claude.ai Google Cloud BigQuery'] }));
|
|
56
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), CLAUDE_CONFIG_DIR: CFG }) });
|
|
54
57
|
await T.waitForServer(BASE);
|
|
55
58
|
browser = await chromium.launch({ executablePath: exe });
|
|
56
59
|
{ /* every context starts with the console's Needs you read off (see open below); a page route set by `console` wins over it */
|
|
@@ -137,6 +140,14 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
137
140
|
const flipped = await until(() => p.evaluate((v) => document.querySelector('#oMain [data-src="mail"]').getAttribute('aria-checked') !== v, sw), 6000);
|
|
138
141
|
ok('S3 a source switch saves through /api/proactive/settings and flips', flipped && A.reqs.includes('POST /api/proactive/settings'));
|
|
139
142
|
await p.click('#oMain [data-src="mail"]'); await until(() => p.evaluate((v) => document.querySelector('#oMain [data-src="mail"]').getAttribute('aria-checked') === v, sw), 6000);
|
|
143
|
+
const bq = await p.evaluate(() => { const b = document.querySelector('#oMain [data-conn="claude.ai Google Cloud BigQuery"]'); const r = b && b.closest('.sr');
|
|
144
|
+
return { row: r ? r.textContent : null, on: b ? b.getAttribute('aria-checked') : null, dup: document.querySelectorAll('#oMain [data-conn]').length }; });
|
|
145
|
+
ok('S5 every connector of the session is listed: BigQuery has its own row, Off, and says nothing in PMOS reads it on its own yet; Calendar and Slack stay under their source', bq.on === 'false' && /Google Cloud BigQuery/.test(bq.row) && !/claude\.ai/.test(bq.row) && /Nothing in PMOS reads it on its own yet/.test(bq.row) && bq.dup === 1, JSON.stringify(bq));
|
|
146
|
+
await p.click('#oMain [data-conn="claude.ai Google Cloud BigQuery"]');
|
|
147
|
+
const bqOn = await until(() => p.evaluate(() => document.querySelector('#oMain [data-conn="claude.ai Google Cloud BigQuery"]').getAttribute('aria-checked') === 'true'), 6000);
|
|
148
|
+
const saved = await (await fetch(BASE + '/api/proactive/settings')).json();
|
|
149
|
+
ok('S6 its switch saves the choice through /api/proactive/settings', bqOn && saved.settings.connectors['claude.ai Google Cloud BigQuery'] === true, JSON.stringify(saved.settings.connectors));
|
|
150
|
+
await p.click('#oMain [data-conn="claude.ai Google Cloud BigQuery"]'); await until(() => p.evaluate(() => document.querySelector('#oMain [data-conn="claude.ai Google Cloud BigQuery"]').getAttribute('aria-checked') === 'false'), 6000);
|
|
140
151
|
const bare = await fetch(BASE + '/api/workspaces/forget', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: 'no-such' }) });
|
|
141
152
|
ok('S4 Remove is a page press: no nonce, no removal (403)', bare.status === 403, String(bare.status));
|
|
142
153
|
for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/proactive\/settings$/.test(A.reqs[i])) A.reqs.splice(i, 1); // R10 below counts presses on a page where nothing was pressed
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.362.0",
|
|
4
|
+
"at": "2026-10-21T00:23:03.151Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 961,
|
|
9
|
+
"t": "Settings lists every connector of your Claude session",
|
|
10
|
+
"s": "Settings › Connectors lists every connector your Claude session has, and says that your sessions can use all of them while a switch only chooses what PMOS reads on its own."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"n": 963,
|
|
14
|
+
"t": "The premium Board release card lists the board's past releases",
|
|
15
|
+
"s": "The premium Board release card lists the board's past releases"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"n": 964,
|
|
19
|
+
"t": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket",
|
|
20
|
+
"s": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"v": "0.361.0",
|
|
26
|
+
"at": "2026-10-21T00:14:19.012Z",
|
|
27
|
+
"f": 2,
|
|
28
|
+
"prs": [
|
|
29
|
+
{
|
|
30
|
+
"n": 960,
|
|
31
|
+
"t": "The morning brief runs on fresh sources; Sources says whether background work runs",
|
|
32
|
+
"s": "PMOS reads the pane after it presses Enter."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
2
36
|
{
|
|
3
37
|
"v": "0.360.0",
|
|
4
38
|
"at": "2026-10-20T13:51:06.028Z",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "The premium Briefing (/premium.html)"
|
|
4
4
|
description: "The Briefing page at /premium.html: the hero sentence, What you need to do, Today, the dock, and what each one reads from the repository."
|
|
5
|
-
timestamp: 2026-10-
|
|
5
|
+
timestamp: 2026-10-21
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# The premium Briefing
|
|
@@ -22,10 +22,12 @@ Every premium page has the same top bar. On the left is where you are, then a ro
|
|
|
22
22
|
- **On a phone** the bar is one row: the page name, Chat, the bell and ⋯. Sources moves into the ⋯ menu.
|
|
23
23
|
- **Menus.** An option that is too long for one line wraps onto the next line, and its row grows to hold it.
|
|
24
24
|
|
|
25
|
-
**Search** (Ctrl K, or `/`) opens the search over places, initiatives, documents and your running sessions; Enter opens the result. Search and the bell only read; neither changes a record. **Console** opens the console at `/console.html`, for the places premium does not have yet. In the console, the More menu has **Open premium**, which opens this page. **Settings** opens one dialog. **Updates** comes first: the PMOS version you have, the newest published version, **Check now** and, when a newer one is ready, **Update**. Update does what the console's Settings › Updates does: it updates the kit in each workspace that is behind, then PMOS itself, which stops for about a minute and reloads the page. PMOS that runs from a checkout says to use `git pull` instead. Each workspace is a row with its kit version. PMOS checks once a day while a page is open (the console's **Check for updates** setting turns this off). **What's new** lists each published kit, newest first and grouped by day: its version, when it published, and one entry per pull request it carries: the pull request's title in bold, with its number, and under it the first sentence of its "After:" paragraph. Both are copied from the pull request when the kit is published; a parenthesis that holds code or a decision number is left out, and a pull request with no "After:" paragraph shows its title only. Kits newer than yours are tinted, and yours is marked. Five show per day; **Show more** opens the rest. Then come two choices. **Workspaces** lists the repositories PMOS works in, with Add (a folder path) and Remove; Remove forgets the address and never deletes the folder, and a refusal shows the server's reason. **Connectors** has an On/Off switch for each source the Briefing reads. Each press saves that one record. Every other setting runs on a default and stays in the console; the dialog links to it. Remove needs the page's launch nonce, so an agent session cannot call it.
|
|
25
|
+
**Search** (Ctrl K, or `/`) opens the search over places, initiatives, documents and your running sessions; Enter opens the result. Search and the bell only read; neither changes a record. **Console** opens the console at `/console.html`, for the places premium does not have yet. In the console, the More menu has **Open premium**, which opens this page. **Settings** opens one dialog. **Updates** comes first: the PMOS version you have, the newest published version, **Check now** and, when a newer one is ready, **Update**. Update does what the console's Settings › Updates does: it updates the kit in each workspace that is behind, then PMOS itself, which stops for about a minute and reloads the page. PMOS that runs from a checkout says to use `git pull` instead. Each workspace is a row with its kit version. PMOS checks once a day while a page is open (the console's **Check for updates** setting turns this off). **What's new** lists each published kit, newest first and grouped by day: its version, when it published, and one entry per pull request it carries: the pull request's title in bold, with its number, and under it the first sentence of its "After:" paragraph. Both are copied from the pull request when the kit is published; a parenthesis that holds code or a decision number is left out, and a pull request with no "After:" paragraph shows its title only. Kits newer than yours are tinted, and yours is marked. Five show per day; **Show more** opens the rest. Then come two choices. **Workspaces** lists the repositories PMOS works in, with Add (a folder path) and Remove; Remove forgets the address and never deletes the folder, and a refusal shows the server's reason. **Connectors** has an On/Off switch for each source the Briefing reads, then a row for every other connector your Claude session has (for example BigQuery). PMOS reads the connector names from the default profile, or from Claude Code's own settings when no profile is set. Your Claude sessions can use every connector whatever its switch says; a switch chooses only what PMOS reads on its own. Such a row is Off until you switch it on, and it says that nothing in PMOS reads it on its own yet: the switch saves your choice for a reader to come. Each press saves that one record. Every other setting runs on a default and stays in the console; the dialog links to it. Remove needs the page's launch nonce, so an agent session cannot call it.
|
|
26
26
|
|
|
27
27
|
**Sources** is a dialog that lists each tracked source (Repository, Initiatives, Calendar, Jira status, My work and Tracker items) with its own state and the time it was last read. Each source except the repository has **Refresh**, and **Refresh all** reads them all again. Slack and email are read as part of My work, so they have no row of their own. A source PMOS does not track has no row: the dialog shows only what PMOS can say it read.
|
|
28
28
|
|
|
29
|
+
The first line of **Sources** says whether PMOS's background work is running. When everything is on time it reads like "Background on · brief 06:52 · sources 06:49": the time today's morning brief was saved and the time of the last source read. It turns orange when something is late, such as a source that missed its scheduled read by more than an hour, or Git sync that keeps failing. It turns red when something stopped: no morning brief 45 minutes after its time, a source whose last run failed, a session whose prompt was typed but not sent, or background checks that stopped. The line gives the reason in plain words, and other problems are listed under it. The Sources dot takes the same colour, and a stop is also added to the bell, once a day. When the morning brief is due, it first refreshes Calendar, Jira and My work if they are more than 2 hours old, then builds from them. It waits for them for at most 30 minutes.
|
|
30
|
+
|
|
29
31
|
**Sessions** lists every running session beside the chat. When a chat dialog is full screen on a desktop, it has three panels: the session list, the conversation and the viewer.
|
|
30
32
|
|
|
31
33
|
- **Groups.** **Goals** holds a chat whose goal is started or waiting on you. **Yours** holds the other sessions you started. **Started by PMOS** holds schedules, the day run, the Driver, the Checker, notes, document syncs and other background runs. A PMOS session shows only when it needs you. The rest fold into one line, "N more working on their own · Show".
|
|
@@ -303,8 +305,9 @@ Board is the third place on the rail, at `/premium-board.html`. It reads what th
|
|
|
303
305
|
- **List** shows the late and at-risk initiatives first, then the board's now view, up to 100 loaded and 25 on screen at a time. A row shows the owner and lane, a status chip when it is not on track, how far through the workflow it is (and "derived" when the workflow engine placed it), a progress bar only when a record holds progress, and the planned finish only when an end date was set ("Not planned" otherwise). "Do this first" appears only when the first row is late.
|
|
304
306
|
- **By stage** has one column for each stage of the board's workflow with the board's own count and its first five initiatives.
|
|
305
307
|
- **List** and **Timeline** show ten tasks a page with Previous and Next; **By stage** shows six cards a column with Show more. **Timeline** draws a bar for each initiative that has both a start and an end date, with the days left or over, and counts the rest. With no dates on record it says so and draws nothing.
|
|
306
|
-
- **Sprint** appears when an agent session has read Jira for the board. Otherwise it says there is none. Press it to open the sprint's facts, with the sprint as a board in a second tab: **To do**, **In progress** and **Done** columns from the last Jira read, with the
|
|
308
|
+
- **Sprint** appears when an agent session has read Jira for the board. Otherwise it says there is none. Press it to open the sprint's facts, with the sprint as a board in a second tab: **To do**, **In progress** and **Done** columns from the last Jira read, with the dates, the days left and the points. The sprint goal is the one the Jira status check writes from the sprint's tickets, as on the console's Sprints tab, with its summary; Jira's own goal shows under it only as a reference (**In Jira: "…"**). Until the check has written one, the tab says **No goal yet**. The active and next sprints are buttons at the top. The closed sprints are behind **Past sprints**, which is shut until you press it. Press any card to open its ticket in another tab. A ticket that is on no initiative of this board shows what the sprint read holds (title, status, points and its Jira link). The board is read only: Jira owns each ticket's status and sprint, so you move tickets in Jira. Tickets with no sprint are not in this read. **Coming up** shows the next release, from the releases ledger.
|
|
307
309
|
- **Open the backlog** is in the Sprint dialog and on its sprint tab. It opens the board's Jira backlog in a tab beside the dialog: the open sprints (active, then next) and then **Backlog**, the tickets in no sprint and not done. A row shows the key, title, status, points and initiative, and why a blocked ticket is blocked. **All**, **Blocked** and **Bugs** filter it (Bugs appears only when the Jira read holds the issue type). A row opens its ticket. The list holds only the tickets the board's initiatives pushed to Jira or hold under their epics, in key order: the Jira read has no rank, assignee or capacity. You move and rank tickets in Jira. With no Jira read, the tab says so.
|
|
310
|
+
- **Next release** shows the next release that carries an initiative of this board, the one planned after it, and the three latest past releases (**Released** when accepted, else **Past**). It reads the release records (`releases/releases.jsonl`, written from the console's Releases view); Jira fix versions alone do not make a release. With no release planned it says so and still lists the past ones. With none at all it says "No release is on record for this board, past or planned."
|
|
308
311
|
- **Metrics** appears above the Initiatives card on the board of any workspace except the home one (PMOS itself), and counts from that workspace's own repository. It has four tiles. **Corrections per 100 runs** is the corrections logged on the week's runs in `planning/runs/agent-runs.jsonl`; a week with fewer than 10 runs is left blank. **Merged a week** counts the commits on the first-parent line of the trunk. **Blocked** and **Idle for a month** come from the workflow engine, which keeps no history. From the first day the card is read, PMOS keeps their counts once a day in the workspace's state folder (`board-metric-history.jsonl`), so their charts start on that day and their caption says **history starts today** (later, the date). Earlier weeks read **Not kept yet**. Move over a chart, or use the arrow keys, to read a week. A tile that cannot be counted says **Not read** and why; a repository with no run log says **No runs yet**. The line above the tiles starts with how many tiles need a look, and those tiles have a **Needs a look** chip and an orange outline. The line ends with **open Insights**, which opens the same board's Insights page. Press a tile for its definition and values, with the read-only agent beside it. A target is set on Insights, not here. A measure with a target shows it under the value, draws it as a dashed line, and carries **On target** or its gap (for example **2 short**); off target, it also has the orange outline. A measure without a target draws no line. Day and Month are off. It was tested only on made-up repositories, not on a real IDPF or microsite repository.
|
|
309
312
|
- **The top bar** names the page and the board. With more than one board a menu switches between them, and **Chat** opens the board in the dialog with the read-only agent.
|
|
310
313
|
- **Core documents** lists the board's documents with their state, cadence and writer, a summary (drafts to review, not started, up to date), a progress bar, a filter and a search. A document with a file opens in the dialog, read only, with its path and state; a draft there has **Issue it**, which marks it issued through the console's own route and sends nothing, and **Draft it again**, which starts a new draft that replaces this one (a board draft has no Edit tab). **Draft it** starts the existing read-only run that writes a draft and sends nothing; **Draft the N not started** does that for each document that can be drafted. **Open** stays on premium pages: the backlog goes to this page's initiatives, new asks to its New asks card, releases to the release dialog, a Horizon scan to the Briefing's Horizon scan, and **Set it up** for a report to Insights. **Add a document** opens a form (title, who writes it, where it lives) and saves a document the core set does not cover on the board's record, in `custom-docs.jsonl`. A document with no link reads "Not started". A document with a link to Confluence or Google Docs reads "Linked" and shows its address. PMOS does not read or sync the linked page, so a linked document is never counted as up to date. Issue and Drop are not on this page.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* sprints GET /api/boards/sprints → { source: 'jira'|'none', readAt, sprints: [{ name, state, start, end, counts: { todo, doing, done } }] }
|
|
13
13
|
* docs GET /api/core-docs?level=board → { scope, summary, docs: [{ key, title, for, cadence, by, kind, st, act, running }] }
|
|
14
14
|
* nextRelease { id, type, at } | null
|
|
15
|
+
* pastReleases [{ id, type, at, name, ini, accepted }] the board's release history, the latest first (at most 3)
|
|
15
16
|
* held, cancelled, archived GET /api/boards/backlog?view=all&status=on hold | status=cancelled | archived=1 → rows (initiative premium-board-actions)
|
|
16
17
|
* asks GET /api/boards/asks → asks [{ id, line, source, by, at, draft: { title, lane, anchor_suggestion } }]; null when it was not read
|
|
17
18
|
*
|
|
@@ -146,12 +147,16 @@ function build(f) {
|
|
|
146
147
|
return { name: r.name || r.id, tag, at: shortDate(String(r.at).slice(0, 10)), days: rd, away: rd != null ? (rd === 0 ? 'today' : rd + ' ' + plural(rd, 'day', 'days') + ' away') : '', type: r.type || '',
|
|
147
148
|
ini: (r.ini || []).map((id) => rows.find((x) => x.id === id)).filter(Boolean).map((x) => ({ id: x.id, key: x.key, title: x.title, status: x.statusLabel || '', tone: x.late ? 'bad' : x.bad ? 'warn' : '' })) };
|
|
148
149
|
};
|
|
150
|
+
// the board's release history, as the console's Released list shows it: accepted ones say Released, the others Past
|
|
151
|
+
const past = (f.pastReleases || []).filter((r) => r && r.at).map((r) => Object.assign(relOf(r, r.accepted ? 'Released' : 'Past'), { away: '' }));
|
|
149
152
|
const release = nr && nr.at
|
|
150
|
-
? { ...relOf(nr, 'Next'), cap: relOf(nr, 'Next').away, rel: [relOf(nr, 'Next')].concat(nr.later && nr.later.at ? [relOf(nr.later, 'Planned')] : []) }
|
|
151
|
-
:
|
|
153
|
+
? { ...relOf(nr, 'Next'), cap: relOf(nr, 'Next').away, rel: [relOf(nr, 'Next')].concat(nr.later && nr.later.at ? [relOf(nr.later, 'Planned')] : [], past) }
|
|
154
|
+
: past.length
|
|
155
|
+
? { cap: 'none planned', rel: past, why: 'No release is planned for this board. The latest releases are listed below.' }
|
|
156
|
+
: { cap: 'none', why: 'No release is on record for this board, past or planned. A release appears here when a release record carries one of this board\'s initiatives.', rel: [] };
|
|
152
157
|
const relRow = release.rel.length ? (() => {
|
|
153
158
|
const rs = release.rel.flatMap((r) => [[r.name + ' · ' + r.tag, [r.at, r.away].filter(Boolean).join(' · ') + (r.type ? ' · ' + r.type : '')]].concat(r.ini.map((i) => ['Rides on it', i.title + (i.status ? ' · ' + i.status : '')])));
|
|
154
|
-
return { key: 'board:release', id: null, title: release.name, sub: 'Release', dialog: { eye: 'Release', logTitle: 'Read from the releases', log: ['Read the releases that carry an initiative of this board', 'Took the earliest date from today on', 'Changed nothing'], say: release.name + ' is next: ' + release.at + ', ' + release.away + '.', head: 'Where it stands', facts: rs, hold: 'This dialog changes nothing.', pane: { label: 'Release', file: '', note: 'The releases as the release records hold them.', rows: rs } } };
|
|
159
|
+
return { key: 'board:release', id: null, title: release.name || past[0].name, sub: 'Release', dialog: { eye: 'Release', logTitle: 'Read from the releases', log: ['Read the releases that carry an initiative of this board', 'Took the earliest date from today on, and the latest before today', 'Changed nothing'], say: release.name ? release.name + ' is next: ' + release.at + ', ' + release.away + '.' : 'No release is planned. The latest was ' + past[0].name + ', ' + past[0].at + '.', head: 'Where it stands', facts: rs, hold: 'This dialog changes nothing.', pane: { label: 'Release', file: '', note: 'The releases as the release records hold them.', rows: rs } } };
|
|
155
160
|
})() : null;
|
|
156
161
|
|
|
157
162
|
const dd = f.docs || null;
|
|
@@ -627,6 +627,8 @@ function flowOf(issues) {
|
|
|
627
627
|
const rank = { todo: 0, doing: 1, done: 2 };
|
|
628
628
|
return [...by.values()].sort((a, b) => (rank[a.category] - rank[b.category]) || (b.n - a.n));
|
|
629
629
|
}
|
|
630
|
+
// a sprint ticket carries its Jira page where the reading holds one, so a premium ticket tab can link to it
|
|
631
|
+
const urlOf = (t) => (typeof t.url === 'string' && /^https:\/\//.test(t.url) ? { url: t.url } : {});
|
|
630
632
|
function sprintsOf(snapshots, onBoard = () => true, whole = null, notes = null, opts = {}) {
|
|
631
633
|
const byName = new Map();
|
|
632
634
|
let readAt = null;
|
|
@@ -644,7 +646,7 @@ function sprintsOf(snapshots, onBoard = () => true, whole = null, notes = null,
|
|
|
644
646
|
if (!sp.start && typeof t.sprint.start === 'string' && t.sprint.start) sp.start = t.sprint.start; // the sprint's dates, as Jira holds them
|
|
645
647
|
if (!sp.end && typeof t.sprint.end === 'string' && t.sprint.end) sp.end = t.sprint.end;
|
|
646
648
|
const category = ['todo', 'doing', 'done'].includes(t.category) ? t.category : 'todo';
|
|
647
|
-
sp.issues.push({ key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: s.initiative, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t) });
|
|
649
|
+
sp.issues.push({ key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: s.initiative, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t), ...urlOf(t) });
|
|
648
650
|
sp.counts[category]++;
|
|
649
651
|
}
|
|
650
652
|
}
|
|
@@ -662,7 +664,7 @@ function sprintsOf(snapshots, onBoard = () => true, whole = null, notes = null,
|
|
|
662
664
|
...all.map((t) => {
|
|
663
665
|
const category = ['todo', 'doing', 'done'].includes(t.category) ? t.category : 'todo';
|
|
664
666
|
const o = own.get(t.key);
|
|
665
|
-
return { key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: o ? o.initiative : null, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t) };
|
|
667
|
+
return { key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: o ? o.initiative : null, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t), ...urlOf(t.url ? t : o || {}) };
|
|
666
668
|
}),
|
|
667
669
|
...sp.issues.filter((i) => !keys.has(i.key)), // a board ticket the sprint read has not seen yet keeps its own reading
|
|
668
670
|
];
|
|
@@ -685,7 +687,7 @@ function sprintsOf(snapshots, onBoard = () => true, whole = null, notes = null,
|
|
|
685
687
|
if (!(n.themes || []).some((t) => t && t.initiative && onBoard(t.initiative))) continue;
|
|
686
688
|
const issues = wt.filter((t) => t && t.key && t.sprint && same(t.sprint, n)).map((t) => {
|
|
687
689
|
const category = ['todo', 'doing', 'done'].includes(t.category) ? t.category : 'todo';
|
|
688
|
-
return { key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: iniOf.get(t.key) || null, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t) };
|
|
690
|
+
return { key: t.key, summary: t.summary || '', status: t.status || '', category, initiative: iniOf.get(t.key) || null, flagged: !!t.flagged, reason: t.flagged && t.reason ? String(t.reason) : null, points: ptsOf(t), ...urlOf(t) };
|
|
689
691
|
});
|
|
690
692
|
const counts = { todo: 0, doing: 0, done: 0 };
|
|
691
693
|
for (const i of issues) counts[i.category]++;
|
|
@@ -12,8 +12,17 @@
|
|
|
12
12
|
* lines stay one prompt. Otherwise it is sent as typed text.
|
|
13
13
|
* 3. ENTER: SUBMIT_MS later, Enter alone. A bracketed-paste program that printed nothing after that Enter gets Enter once
|
|
14
14
|
* more after RETRY_MS, because the first one can land while the paste is still being read.
|
|
15
|
+
*
|
|
16
|
+
* THE SCREEN (harness-health, 2026-10-21). "Printed nothing" is not enough: on 2026-10-21 both 06:45 morning briefs sat with
|
|
17
|
+
* their whole prompt in Claude Code's input box, because an Enter that is swallowed still redraws the box. The ready test was
|
|
18
|
+
* also fooled: the shell that starts the agent turns bracketed paste on and goes quiet before Claude Code has drawn its box.
|
|
19
|
+
* Claude Code keeps what was typed while it started and shows it in its box, so a prompt typed early is not lost; only its Enter
|
|
20
|
+
* is. So when the caller passes `screen` (the pane's visible text, from tmux capture-pane), the box is read after the Enter, at
|
|
21
|
+
* each of CHECK_MS. When it still holds the prompt, Enter is pressed again. When it still does after the last check, the
|
|
22
|
+
* delivery ends as 'unsent' so the caller can say so instead of leaving the session idle. Without `screen` (a plain shell, a
|
|
23
|
+
* test) the plan is as before.
|
|
15
24
|
* The clock and the timers are injected, so the plan is tested without waiting. No I/O of its own: it writes only through
|
|
16
|
-
* `write`.
|
|
25
|
+
* `write` and reads only through `screen`.
|
|
17
26
|
*/
|
|
18
27
|
|
|
19
28
|
const MIN_MS = 1200;
|
|
@@ -23,6 +32,7 @@ const MAX_MS = 20000;
|
|
|
23
32
|
const POLL_MS = 200;
|
|
24
33
|
const SUBMIT_MS = 500;
|
|
25
34
|
const RETRY_MS = 1500;
|
|
35
|
+
const CHECK_MS = Object.freeze([4000, 12000]); // after the Enter: read the input box at these delays, Enter again if it still holds the prompt
|
|
26
36
|
const PASTE_ON = '\x1b[?2004h';
|
|
27
37
|
const PASTE_OFF = '\x1b[?2004l';
|
|
28
38
|
|
|
@@ -41,6 +51,22 @@ function ready({ now, t0, lastOutputAt, firstOut }) {
|
|
|
41
51
|
return now - lastOutputAt >= QUIET_MS;
|
|
42
52
|
}
|
|
43
53
|
|
|
54
|
+
const BOX = /^\s*❯(?:\s|$)/;
|
|
55
|
+
const squash = (t) => String(t || '').replace(/\s+/g, '');
|
|
56
|
+
/** The text in the agent's input box: what follows ❯ on the LAST such line of the visible screen, or null when there is no box. */
|
|
57
|
+
function boxText(screen) {
|
|
58
|
+
const lines = String(screen || '').split('\n');
|
|
59
|
+
for (let i = lines.length - 1; i >= 0; i--) if (BOX.test(lines[i])) return lines[i].replace(BOX, '').trim();
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
/** Does the input box still hold (part of) `text`? The box may show the start or, for a long prompt, a later part. Spaces are
|
|
63
|
+
* ignored because the box wraps the prompt at its own width. */
|
|
64
|
+
function stillInBox(screen, text) {
|
|
65
|
+
const b = squash(boxText(screen));
|
|
66
|
+
if (b.length < 8) return false;
|
|
67
|
+
return squash(text).includes(b.slice(0, 40));
|
|
68
|
+
}
|
|
69
|
+
|
|
44
70
|
/** Split a first input into the text and whether it ended with Enter. */
|
|
45
71
|
function splitInput(input) {
|
|
46
72
|
const s = String(input == null ? '' : input);
|
|
@@ -58,6 +84,8 @@ function deliver(s, input, o = {}) {
|
|
|
58
84
|
const now = o.now || (() => Date.now());
|
|
59
85
|
const later = o.setTimeout || setTimeout;
|
|
60
86
|
const done = typeof o.onDone === 'function' ? o.onDone : () => {};
|
|
87
|
+
const screenFn = typeof o.screen === 'function' ? o.screen : null;
|
|
88
|
+
const screen = () => { try { return String(screenFn() || ''); } catch { return ''; } };
|
|
61
89
|
const { text, enter } = splitInput(input);
|
|
62
90
|
if (!s || (!text && !enter)) { done('nothing'); return; }
|
|
63
91
|
const t0 = now();
|
|
@@ -65,6 +93,17 @@ function deliver(s, input, o = {}) {
|
|
|
65
93
|
let firstOut = 0;
|
|
66
94
|
const alive = () => s.pty && s.state !== 'exited';
|
|
67
95
|
const write = (d) => { try { s.pty.write(d); return true; } catch { return false; } };
|
|
96
|
+
// after the Enter: read the box at each CHECK_MS; Enter again while it still holds the prompt
|
|
97
|
+
const check = (i, outcome) => {
|
|
98
|
+
if (!screenFn || !text || i >= CHECK_MS.length) { done(outcome); return; }
|
|
99
|
+
later(() => {
|
|
100
|
+
if (!alive()) { done('gone'); return; }
|
|
101
|
+
if (!stillInBox(screen(), text)) { done(outcome); return; }
|
|
102
|
+
write('\r');
|
|
103
|
+
if (i + 1 < CHECK_MS.length) { check(i + 1, 'resubmitted'); return; }
|
|
104
|
+
later(() => { done(alive() && stillInBox(screen(), text) ? 'unsent' : 'resubmitted'); }, CHECK_MS[0]);
|
|
105
|
+
}, CHECK_MS[i] - (i ? CHECK_MS[i - 1] : 0));
|
|
106
|
+
};
|
|
68
107
|
const tick = () => {
|
|
69
108
|
if (!alive()) { done('gone'); return; }
|
|
70
109
|
if (!firstOut && (s.lastOutputAt || 0) > base) firstOut = s.lastOutputAt;
|
|
@@ -76,14 +115,14 @@ function deliver(s, input, o = {}) {
|
|
|
76
115
|
if (!alive()) { done('gone'); return; }
|
|
77
116
|
const before = s.lastOutputAt || 0;
|
|
78
117
|
write('\r');
|
|
79
|
-
if (!paste) {
|
|
118
|
+
if (!paste) { check(0, 'submitted'); return; }
|
|
80
119
|
later(() => {
|
|
81
|
-
if (alive() && (s.lastOutputAt || 0) <= before) { write('\r');
|
|
82
|
-
|
|
120
|
+
if (alive() && (s.lastOutputAt || 0) <= before) { write('\r'); check(0, 'resubmitted'); return; }
|
|
121
|
+
check(0, 'submitted');
|
|
83
122
|
}, RETRY_MS);
|
|
84
123
|
}, text ? SUBMIT_MS : 0);
|
|
85
124
|
};
|
|
86
125
|
later(tick, POLL_MS);
|
|
87
126
|
}
|
|
88
127
|
|
|
89
|
-
module.exports = { deliver, ready, pasteOn, splitInput, MIN_MS, QUIET_MS, SILENT_MS, MAX_MS, SUBMIT_MS, RETRY_MS };
|
|
128
|
+
module.exports = { deliver, ready, pasteOn, splitInput, boxText, stillInBox, MIN_MS, QUIET_MS, SILENT_MS, MAX_MS, SUBMIT_MS, RETRY_MS, CHECK_MS };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* harness-health.js — one line that says whether PMOS's background work is running (initiative harness-health).
|
|
3
|
+
*
|
|
4
|
+
* of({ now, settings, state, log, briefAt, sessions, lastTick, win }) → { level, line, issues: [{ level, key, text }] } PURE.
|
|
5
|
+
*
|
|
6
|
+
* The PM asked on 2026-10-21 "how do I know the agent harness is working": the morning brief had sat unsent since 06:45 and
|
|
7
|
+
* nothing on any page said so. This reads what the refresh engine already keeps (lib/refresh.js settings, state and log), the
|
|
8
|
+
* day's brief file and the live sessions, and answers with one level:
|
|
9
|
+
* ok every background run is on time. The line names the last brief and the last source read: "Background on · brief 06:52 · sources 06:49".
|
|
10
|
+
* warn something is late: a source missed its slot by more than an hour, or Git sync keeps failing.
|
|
11
|
+
* bad something stopped: the background tick is not running, today's brief is missing 45 minutes after its time, a source's
|
|
12
|
+
* last run failed, or a session's prompt was typed but never sent.
|
|
13
|
+
* Every issue is a plain sentence with a time; `line` is the worst one. Nothing here reads a file or the clock.
|
|
14
|
+
*
|
|
15
|
+
* now ms
|
|
16
|
+
* settings refresh.json, with defaults (lib/refresh.js withDefaults)
|
|
17
|
+
* state refresh-state.json
|
|
18
|
+
* log the folded log (lib/refresh.js foldLog)
|
|
19
|
+
* briefAt ms the brief for today was saved, or 0
|
|
20
|
+
* sessions [{ id, name, origin, state, firstInput: { result } }]: the live sessions
|
|
21
|
+
* lastTick ms of the last background tick, or 0 before the first
|
|
22
|
+
* win the working hours { start, end }
|
|
23
|
+
*/
|
|
24
|
+
const R = require('./refresh.js');
|
|
25
|
+
|
|
26
|
+
const MIN = 60000;
|
|
27
|
+
const TICK_LATE_MS = 5 * MIN; // the background tick runs every minute
|
|
28
|
+
const BRIEF_LATE_MS = 45 * MIN; // a brief takes a few minutes; 45 leaves room for the sources it refreshes first (at most 30)
|
|
29
|
+
const MISSED_MS = 60 * MIN; // a source slot with no run an hour on was missed
|
|
30
|
+
const RANK = { ok: 0, warn: 1, bad: 2 };
|
|
31
|
+
|
|
32
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
33
|
+
const hm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
|
|
34
|
+
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
35
|
+
const ms = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? t : 0; };
|
|
36
|
+
const sameDay = (a, b) => new Date(a).toDateString() === new Date(b).toDateString();
|
|
37
|
+
|
|
38
|
+
function of({ now, settings, state = {}, log, briefAt = 0, sessions = [], lastTick = 0, win } = {}) {
|
|
39
|
+
const issues = [];
|
|
40
|
+
const add = (level, key, text) => issues.push({ level, key, text });
|
|
41
|
+
const set = settings || R.withDefaults({});
|
|
42
|
+
const runs = (id) => (log ? log.runs(id, 10) : []).filter((r) => r.result !== 'skipped');
|
|
43
|
+
|
|
44
|
+
if (lastTick && now - lastTick > TICK_LATE_MS) add('bad', 'tick', `Background checks stopped at ${hm(lastTick)}. Restart PMOS to start them again.`);
|
|
45
|
+
|
|
46
|
+
for (const s of sessions) {
|
|
47
|
+
if (s.state !== 'exited' && s.firstInput && s.firstInput.result === 'unsent') add('bad', 'unsent:' + s.id, `${clip(s.name, 40)} is idle: its prompt was typed but not sent. Open it and press Enter.`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// today's morning brief
|
|
51
|
+
const bset = set.sources.brief;
|
|
52
|
+
const bslot = bset && bset.on ? R.lastSlot(bset.s, now, win) : null;
|
|
53
|
+
if (bslot != null && sameDay(bslot, now) && !(briefAt && sameDay(briefAt, now)) && now - bslot > BRIEF_LATE_MS) {
|
|
54
|
+
const bst = state.brief || {};
|
|
55
|
+
const open = Object.values(bst.open || {})[0];
|
|
56
|
+
const last = runs('brief').find((r) => ms(r.start_at) >= bslot - MIN);
|
|
57
|
+
let why;
|
|
58
|
+
if (open) why = `Morning brief started at ${hm(open.at)} and has not finished.`;
|
|
59
|
+
else if (bst.waiting_since) why = `Morning brief has waited for its sources since ${hm(bst.waiting_since)}.`;
|
|
60
|
+
else if (last && last.result && last.result !== 'done') why = `Morning brief ${last.result === 'interrupted' ? 'was stopped' : 'failed'} at ${hm(ms(last.end_at))}${last.error ? ': ' + clip(last.error, 90) : '.'}`;
|
|
61
|
+
else why = `Morning brief did not start at ${hm(bslot)}.`;
|
|
62
|
+
add('bad', 'brief', why);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// each skill source: a failed last run, or a slot that passed with no run
|
|
66
|
+
for (const src of R.SOURCES.filter((x) => x.run === 'skill' && x.id !== 'brief')) {
|
|
67
|
+
const x = set.sources[src.id]; if (!x || !x.on) continue;
|
|
68
|
+
const last = runs(src.id)[0];
|
|
69
|
+
if (last && last.end_at && ['failed', 'interrupted'].includes(last.result) && !(state[src.id] || {}).retry_at) {
|
|
70
|
+
add('bad', 'failed:' + src.id, `${src.label} ${last.result === 'interrupted' ? 'was stopped' : 'failed'} at ${hm(ms(last.end_at))}${last.error ? ': ' + clip(last.error, 90) : '.'}`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const slot = R.lastSlot(x.s, now, win);
|
|
74
|
+
if (slot == null || now - slot < MISSED_MS) continue;
|
|
75
|
+
const st = state[src.id] || {};
|
|
76
|
+
const ran = Math.max(st.started_at || 0, ...runs(src.id).map((r) => ms(r.start_at)));
|
|
77
|
+
if (ran < slot && !Object.keys(st.open || {}).length) add('warn', 'missed:' + src.id, `${src.label} missed its ${hm(slot)} read.`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const sync = runs('sync')[0];
|
|
81
|
+
if (set.sources.sync && set.sources.sync.on && sync && sync.result === 'failed') {
|
|
82
|
+
const gone = /repository '(?:https?:\/\/[^/]+\/)?([^']+?)(?:\.git)?\/?' not found/.exec(sync.error || '');
|
|
83
|
+
add('warn', 'sync', gone ? `Git sync is failing: ${gone[1]} was not found. Check that remote's address or your access.` : `Git sync is failing: ${clip(sync.error || 'see Settings, Data refresh', 90)}`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
issues.sort((a, b) => RANK[b.level] - RANK[a.level]);
|
|
87
|
+
const level = issues.length ? issues[0].level : 'ok';
|
|
88
|
+
if (issues.length) return { level, line: issues[0].text, issues };
|
|
89
|
+
const lastBrief = briefAt && sameDay(briefAt, now) ? 'brief ' + hm(briefAt) : 'no brief yet today';
|
|
90
|
+
const reads = R.SOURCES.filter((x) => x.run === 'skill' && x.id !== 'brief').map((x) => runs(x.id).find((r) => r.result === 'done')).filter(Boolean).map((r) => ms(r.end_at));
|
|
91
|
+
const src = reads.length ? 'sources ' + (sameDay(Math.max(...reads), now) ? hm(Math.max(...reads)) : 'read ' + new Date(Math.max(...reads)).toDateString().slice(4, 10)) : 'sources not read yet';
|
|
92
|
+
return { level, line: `Background on · ${lastBrief} · ${src}`, issues };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = { of, TICK_LATE_MS, BRIEF_LATE_MS, MISSED_MS };
|
|
@@ -40,6 +40,15 @@ const SCOPE_SERVICES = ['slack', 'jira', 'confluence'];
|
|
|
40
40
|
const SCOPE_LEVELS = ['watch', 'search', 'ignore'];
|
|
41
41
|
const MAX_SCOPE_NAMES = 50;
|
|
42
42
|
const MAX_WEBSITES = 10;
|
|
43
|
+
// The other connectors of the PM's Claude session (BigQuery, Sheets, ...): name → on. Nothing reads one yet, so a connector
|
|
44
|
+
// with no entry is off, and the switch only records the PM's choice for a reader to come (premium Settings › Connectors).
|
|
45
|
+
const MAX_CONNECTORS = 100;
|
|
46
|
+
// A connector name → the brief source it already backs, or null. Atlassian backs both Jira and Confluence.
|
|
47
|
+
const CONNECTOR_SOURCE = [[/calendar/i, 'calendar'], [/wispr/i, 'wispr'], [/gmail|outlook|\bmail\b/i, 'mail'], [/slack/i, 'slack'], [/atlassian|jira/i, 'jira'],
|
|
48
|
+
[/confluence/i, 'confluence'], [/github/i, 'github'], [/drive/i, 'drive'], [/figma/i, 'figma']];
|
|
49
|
+
const connectorSource = (name) => { const hit = CONNECTOR_SOURCE.find(([re]) => re.test(String(name || ''))); return hit ? hit[1] : null; };
|
|
50
|
+
/** The name a person knows a connector by: Claude Code keeps a claude.ai connector as "claude.ai <Name>". */
|
|
51
|
+
const connectorLabel = (name) => String(name || '').replace(/^claude\.ai\s+/i, '').trim();
|
|
43
52
|
// G22: the daytime check — every 30 or 60 minutes, or off (0), between start and end of the working day.
|
|
44
53
|
const DAY_CHECK_EVERY = [0, 30, 60];
|
|
45
54
|
const DAY_CHECK_DEFAULT = Object.freeze({ every: 60, start: '09:00', end: '18:00' });
|
|
@@ -49,7 +58,7 @@ const DAY_CHECK_DEFAULT = Object.freeze({ every: 60, start: '09:00', end: '18:00
|
|
|
49
58
|
const ABOUT_MAX = Object.freeze({ role: 80, work: 200, duties: 1000 });
|
|
50
59
|
const ABOUT_DEFAULT = Object.freeze({ role: '', work: '', duties: '' });
|
|
51
60
|
const DEFAULTS = Object.freeze({ name: '', about: ABOUT_DEFAULT, briefSources: BRIEF_DEFAULT, briefScoring: false, backgroundPrepare: false, enabled: true, triggers: Object.freeze(Object.fromEntries(TRIGGERS.map((t) => [t, true]))), stalledDays: 5, quiet: null, pauseLearning: false,
|
|
52
|
-
scopes: Object.freeze({ slack: Object.freeze({}), jira: Object.freeze({}), confluence: Object.freeze({}) }), placeRepos: Object.freeze({ slack: Object.freeze({}), jira: Object.freeze({}), confluence: Object.freeze({}) }), dayCheck: DAY_CHECK_DEFAULT, websites: Object.freeze([]) });
|
|
61
|
+
scopes: Object.freeze({ slack: Object.freeze({}), jira: Object.freeze({}), confluence: Object.freeze({}) }), placeRepos: Object.freeze({ slack: Object.freeze({}), jira: Object.freeze({}), confluence: Object.freeze({}) }), dayCheck: DAY_CHECK_DEFAULT, websites: Object.freeze([]), connectors: Object.freeze({}) });
|
|
53
62
|
|
|
54
63
|
const idOf = (key) => crypto.createHash('sha1').update(String(key)).digest('hex').slice(0, 12);
|
|
55
64
|
const clip = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
@@ -183,7 +192,7 @@ const HHMM = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
|
183
192
|
function normalizeSettings(raw) {
|
|
184
193
|
const r = raw && typeof raw === 'object' ? raw : {};
|
|
185
194
|
const s = { name: DEFAULTS.name, about: { ...ABOUT_DEFAULT }, briefSources: { ...BRIEF_DEFAULT }, briefScoring: DEFAULTS.briefScoring, backgroundPrepare: DEFAULTS.backgroundPrepare, enabled: DEFAULTS.enabled, triggers: { ...DEFAULTS.triggers }, stalledDays: DEFAULTS.stalledDays, quiet: DEFAULTS.quiet, pauseLearning: DEFAULTS.pauseLearning,
|
|
186
|
-
scopes: { slack: {}, jira: {}, confluence: {} }, placeRepos: { slack: {}, jira: {}, confluence: {} }, dayCheck: { ...DAY_CHECK_DEFAULT }, websites: [] };
|
|
195
|
+
scopes: { slack: {}, jira: {}, confluence: {} }, placeRepos: { slack: {}, jira: {}, confluence: {} }, dayCheck: { ...DAY_CHECK_DEFAULT }, websites: [], connectors: {} };
|
|
187
196
|
if (r.enabled !== undefined) { if (typeof r.enabled !== 'boolean') return { ok: false, error: 'enabled must be true or false' }; s.enabled = r.enabled; }
|
|
188
197
|
if (r.name !== undefined) { if (typeof r.name !== 'string' || r.name.length > 40) return { ok: false, error: 'name must be text of at most 40 characters' }; s.name = r.name.replace(/\s+/g, ' ').trim(); }
|
|
189
198
|
if (r.about !== undefined) {
|
|
@@ -204,6 +213,15 @@ function normalizeSettings(raw) {
|
|
|
204
213
|
s.briefSources[k] = v;
|
|
205
214
|
}
|
|
206
215
|
}
|
|
216
|
+
if (r.connectors !== undefined) {
|
|
217
|
+
if (!r.connectors || typeof r.connectors !== 'object' || Array.isArray(r.connectors)) return { ok: false, error: 'connectors must be an object of connector name → true or false' };
|
|
218
|
+
for (const [k, v] of Object.entries(r.connectors)) {
|
|
219
|
+
if (!k.trim() || k.length > 120) return { ok: false, error: 'a connector name is 1 to 120 characters' };
|
|
220
|
+
if (typeof v !== 'boolean') return { ok: false, error: `connector "${k}" must be true or false` };
|
|
221
|
+
s.connectors[k] = v;
|
|
222
|
+
}
|
|
223
|
+
if (Object.keys(s.connectors).length > MAX_CONNECTORS) return { ok: false, error: `connectors has ${Object.keys(s.connectors).length} names — at most ${MAX_CONNECTORS}` };
|
|
224
|
+
}
|
|
207
225
|
if (r.pauseLearning !== undefined) { if (typeof r.pauseLearning !== 'boolean') return { ok: false, error: 'pauseLearning must be true or false' }; s.pauseLearning = r.pauseLearning; }
|
|
208
226
|
if (r.triggers !== undefined) {
|
|
209
227
|
if (!r.triggers || typeof r.triggers !== 'object' || Array.isArray(r.triggers)) return { ok: false, error: `triggers must be an object of ${TRIGGERS.join(', ')} → true or false` };
|
|
@@ -287,4 +305,4 @@ function inQuietHours(nowMs, quiet) {
|
|
|
287
305
|
return a < b ? m >= a && m < b : m >= a || m < b;
|
|
288
306
|
}
|
|
289
307
|
|
|
290
|
-
module.exports = { BRIEF_SOURCES, SCOPE_SERVICES, SCOPE_LEVELS, MAX_SCOPE_NAMES, MAX_WEBSITES, DAY_CHECK_EVERY, TRIGGERS, VERDICTS, EVENTS, DEFAULTS, DEDUPE_MS, DISMISS_MS, BASE, detect, rank, newSignals, dismissedIds, validateFeedback, normalizeSettings, inQuietHours };
|
|
308
|
+
module.exports = { BRIEF_SOURCES, MAX_CONNECTORS, connectorSource, connectorLabel, SCOPE_SERVICES, SCOPE_LEVELS, MAX_SCOPE_NAMES, MAX_WEBSITES, DAY_CHECK_EVERY, TRIGGERS, VERDICTS, EVENTS, DEFAULTS, DEDUPE_MS, DISMISS_MS, BASE, detect, rank, newSignals, dismissedIds, validateFeedback, normalizeSettings, inQuietHours };
|