create-pmos 0.315.0 → 0.317.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 +1 -1
- 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/briefing-premium-adddoc-test.js +3 -1
- package/workspace/briefing-premium-board-test.js +3 -1
- package/workspace/briefing-premium-calendar-2-test.js +3 -1
- package/workspace/briefing-premium-calendar-3-test.js +3 -1
- package/workspace/briefing-premium-calendar-test.js +3 -1
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +3 -1
- package/workspace/briefing-premium-insights-test.js +3 -1
- package/workspace/briefing-premium-metrics-test.js +3 -1
- package/workspace/briefing-premium-sources-test.js +3 -1
- package/workspace/briefing-premium-test.js +3 -1
- package/workspace/briefing-premium-work-test.js +3 -1
- package/workspace/guide/briefing-premium.md +2 -0
- package/workspace/lib/briefing-premium-drafts.js +21 -1
- package/workspace/lib/capacity-governor.js +5 -3
- package/workspace/lib/driver-run.js +46 -7
- package/workspace/lib/driver.js +5 -1
- package/workspace/lib/headless.js +43 -4
- package/workspace/lib/orchestrator-checker.js +116 -0
- package/workspace/lib/orchestrator-gate.js +2 -1
- package/workspace/lib/orchestrator-health.js +9 -3
- package/workspace/lib/orchestrator-keeprate.js +104 -0
- package/workspace/lib/orchestrator-quota.js +84 -0
- package/workspace/lib/orchestrator-spawn.js +3 -2
- package/workspace/lib/premium-console-type.js +71 -0
- package/workspace/lib/routes-orchestrator.js +7 -1
- package/workspace/lib/routes-report-design.js +6 -2
- package/workspace/lib/routes-report-structure.js +27 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-welcome-test.js +4 -2
- package/workspace/public/pm/premium-insights.css +32 -31
- package/workspace/public/pm/premium.css +397 -394
- package/workspace/server.js +70 -7
- package/workspace/skills/calendar-sync.skill +1 -0
- package/workspace/skills/jira-sync.skill +1 -0
- package/workspace/skills/morning-brief.skill +1 -0
- package/workspace/skills/my-work-read.skill +1 -0
- package/workspace/test-lists/agent-orchestrator-c.json +15 -0
- package/workspace/test-lists/agent-orchestrator-e2e.json +9 -0
- package/workspace/test-lists/premium-console-type.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.317.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": {
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T14:26:43Z"}
|
|
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-19T14:26:43Z"}
|
|
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-19T14:26:43Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -7,6 +7,8 @@ const fs = require('fs');
|
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const { spawn } = require('child_process');
|
|
9
9
|
const { findBrowser } = require('./lib/find-browser');
|
|
10
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
11
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
10
12
|
const T = require('./test-run').configure({ name: 'briefing-premium-adddoc' });
|
|
11
13
|
const BP = require('./lib/board-premium.js');
|
|
12
14
|
const IP = require('./lib/initiative-premium.js');
|
|
@@ -141,7 +143,7 @@ const PAGES = {
|
|
|
141
143
|
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { width: e.offsetWidth, height: e.offsetHeight, cw: e.clientWidth, sh: e.scrollHeight }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
|
|
142
144
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
143
145
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
144
|
-
await m.goto('file://' + MOCKUP);
|
|
146
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
145
147
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
146
148
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
|
|
147
149
|
await until(() => m.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0)); await sleep(500);
|
|
@@ -8,6 +8,8 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { spawn } = require('child_process');
|
|
10
10
|
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
12
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
11
13
|
const T = require('./test-run').configure({ name: 'briefing-premium-board' });
|
|
12
14
|
const BP = require('./lib/board-premium.js');
|
|
13
15
|
const F = require('./fixtures/board-premium-facts.js');
|
|
@@ -254,7 +256,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
254
256
|
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s0] of pairs) { const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
|
|
255
257
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
256
258
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
257
|
-
await m.goto('file://' + MOCKUP);
|
|
259
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
258
260
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
259
261
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
|
|
260
262
|
await until(() => m.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0)); await sleep(900);
|
|
@@ -9,6 +9,8 @@ const fs = require('fs');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { spawn } = require('child_process');
|
|
11
11
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
13
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
12
14
|
const T = require('./test-run').configure({ name: 'briefing-premium-calendar-2' });
|
|
13
15
|
const B = require('./lib/briefing-premium.js');
|
|
14
16
|
const F = require('./fixtures/briefing-premium-facts.js');
|
|
@@ -217,7 +219,7 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
|
|
|
217
219
|
}
|
|
218
220
|
const css = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); if (!e) return null; const c = getComputedStyle(e); return ['fontWeight', 'borderRadius'].map((k) => c[k]).join('|'); }, sel);
|
|
219
221
|
const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
|
|
220
|
-
await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
|
|
222
|
+
await mp.setContent(MOCKUP); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
|
|
221
223
|
const ctaM = await mp.evaluate(() => { const b = document.createElement('button'); b.className = 'cta'; document.body.appendChild(b); const c = getComputedStyle(b); return c.fontWeight + '|' + c.borderRadius; });
|
|
222
224
|
const addM = await mp.evaluate(() => { const b = document.createElement('button'); b.className = 'addb'; document.body.appendChild(b); const c = getComputedStyle(b); return c.fontWeight + '|' + c.borderRadius; }), F1 = await open(), addB = await css(F1.page, '#mmAdd');
|
|
223
225
|
await F1.page.click('#mmAdd'); await until(() => F1.page.evaluate(() => /Premium UX PRD/.test(document.querySelector('#mmSug').textContent))); await F1.page.click('#mmSug [data-pick]');
|
|
@@ -10,6 +10,8 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const { spawn } = require('child_process');
|
|
12
12
|
const { findBrowser } = require('./lib/find-browser');
|
|
13
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
14
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
13
15
|
const T = require('./test-run').configure({ name: 'briefing-premium-calendar-3' });
|
|
14
16
|
const B = require('./lib/briefing-premium.js');
|
|
15
17
|
const F = require('./fixtures/briefing-premium-facts.js');
|
|
@@ -354,7 +356,7 @@ const RECORDER = () => {
|
|
|
354
356
|
await P.ctx.close();
|
|
355
357
|
}
|
|
356
358
|
const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
|
|
357
|
-
await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
|
|
359
|
+
await mp.setContent(MOCKUP); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
|
|
358
360
|
const chipCss = (pg) => pg.evaluate(() => { const c = document.querySelector('.recchip, #recChip'); if (!c) return null; const k = getComputedStyle(c); const b = c.querySelector('button'); const bs = b ? getComputedStyle(b) : null; return [k.position, k.borderRadius, k.fontSize, k.fontWeight, k.display, bs && bs.borderRadius, bs && bs.fontWeight].join('|'); });
|
|
359
361
|
const chipM = await mp.evaluate(() => { const c = document.querySelector('#recChip'); c.hidden = false; c.innerHTML = '<i></i><span>Recording x</span><button>Open</button><button>Stop</button>'; const k = getComputedStyle(c), b = getComputedStyle(c.querySelector('button')); return [k.position, k.borderRadius, k.fontSize, k.fontWeight, k.display, b.borderRadius, b.fontWeight].join('|'); });
|
|
360
362
|
const Fx = await open({ notes: [live] }); await until(async () => /marked recording/.test((await chip(Fx.page)) || ''));
|
|
@@ -9,6 +9,8 @@ const fs = require('fs');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { spawn } = require('child_process');
|
|
11
11
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
13
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
12
14
|
const T = require('./test-run').configure({ name: 'briefing-premium-calendar' });
|
|
13
15
|
const B = require('./lib/briefing-premium.js');
|
|
14
16
|
const F = require('./fixtures/briefing-premium-facts.js');
|
|
@@ -207,7 +209,7 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
|
|
|
207
209
|
}
|
|
208
210
|
const css = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); if (!e) return null; const c = getComputedStyle(e); return ['fontSize', 'fontWeight', 'letterSpacing', 'textTransform', 'borderRadius', 'paddingTop', 'color'].map((k) => c[k]).join('|'); }, sel);
|
|
209
211
|
const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
|
|
210
|
-
await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
|
|
212
|
+
await mp.setContent(MOCKUP); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
|
|
211
213
|
const F1 = await open();
|
|
212
214
|
const pairs = [['#todayCard', '#todayCard'], ['#tl .ev b', '#tl .ev b'], ['#tl .nowl', '#tl .nowl']];
|
|
213
215
|
for (const [a, b] of pairs) { const x = await css(mp, a), y = await css(F1.page, b); ok('C10 fidelity: ' + a + ' keeps the mockup\'s computed style at 1280 px', x === y || (x === null && true), x + ' vs ' + y); }
|
|
@@ -28,7 +28,7 @@ const finish = async (code) => {
|
|
|
28
28
|
};
|
|
29
29
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
30
30
|
|
|
31
|
-
const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html'), 'utf8');
|
|
31
|
+
const MOCKUP = require('./lib/premium-console-type').transform(fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html'), 'utf8'), { faces: false }); // read with the console's type (PM, 2026-10-19), as premium.css is
|
|
32
32
|
const CSS = fs.readFileSync(path.join(__dirname, 'public', 'pm', 'premium.css'), 'utf8');
|
|
33
33
|
const PATH = 'planning/prd/self-serve-v2-prd.md';
|
|
34
34
|
const TEXT = '---\ntype: PRD\ntitle: "Self-serve onboarding v2"\n---\n\n# PRD: Self-serve onboarding v2\n\n## Problem\n\nA partner waits for a person.\n\n## Goal\n\n- a first call without help\n\n## Requirements\n\nR1 a first call\n';
|
|
@@ -169,7 +169,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
169
169
|
ok(`E8 ${t} tab at ${w} px ${theme}: no sideways scroll, no tiny target, nothing past the edge`, f.sx <= 0 && f.bad.length === 0 && f.out === 0, JSON.stringify(f));
|
|
170
170
|
}
|
|
171
171
|
const cs = await R.page.evaluate(() => { const e = document.querySelector('#dsAsk'); const c = getComputedStyle(e); return { r: c.borderRadius, fs: c.fontSize }; });
|
|
172
|
-
ok(`E8 the ask box is 14px rounded,
|
|
172
|
+
ok(`E8 the ask box is 14px rounded, 14px type (the console's body size) at ${w} px ${theme}`, cs.r === '14px' && cs.fs === '14px', JSON.stringify(cs));
|
|
173
173
|
await R.ctx.close();
|
|
174
174
|
}
|
|
175
175
|
finish();
|
|
@@ -8,6 +8,8 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { spawn } = require('child_process');
|
|
10
10
|
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
12
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
11
13
|
const T = require('./test-run').configure({ name: 'briefing-premium-initiative' });
|
|
12
14
|
const IP = require('./lib/initiative-premium.js');
|
|
13
15
|
const F = require('./fixtures/initiative-premium-facts.js');
|
|
@@ -328,7 +330,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
328
330
|
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s0] of pairs) { const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
|
|
329
331
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
330
332
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
331
|
-
await m.goto('file://' + MOCKUP);
|
|
333
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
332
334
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
333
335
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
|
|
334
336
|
await until(() => m.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0)); await sleep(500);
|
|
@@ -9,6 +9,8 @@ const os = require('os');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { spawn } = require('child_process');
|
|
11
11
|
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
13
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
12
14
|
const T = require('./test-run').configure({ name: 'briefing-premium-insights' });
|
|
13
15
|
const IP = require('./lib/insights-premium.js');
|
|
14
16
|
const F = require('./fixtures/insights-premium-facts.js');
|
|
@@ -282,7 +284,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
282
284
|
const grab = (pg, which) => pg.evaluate(([pairs, props, idx]) => { const o = {}; for (const pr of pairs) { const n = pr[0], s0 = pr[idx]; const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS, which]);
|
|
283
285
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
284
286
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
285
|
-
await m.goto('file://' + MOCKUP);
|
|
287
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
286
288
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
287
289
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="ins"]').click(); }, th);
|
|
288
290
|
await until(() => m.evaluate(() => document.querySelectorAll('#nMain .mt1').length > 0)); await sleep(900);
|
|
@@ -8,6 +8,8 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const { spawn } = require('child_process');
|
|
10
10
|
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
12
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
11
13
|
const T = require('./test-run').configure({ name: 'briefing-premium-metrics' });
|
|
12
14
|
const BP = require('./lib/board-premium.js');
|
|
13
15
|
const MP = require('./lib/board-metrics-premium.js');
|
|
@@ -196,7 +198,7 @@ const ready = (model) => ({ status: 200, body: { ok: true, state: 'ready', model
|
|
|
196
198
|
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector('main.stage:not([hidden]) ' + s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [SEL, PROPS]);
|
|
197
199
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
198
200
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
199
|
-
await m.goto('file://' + MOCKUP);
|
|
201
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
200
202
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
201
203
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
|
|
202
204
|
await until(() => m.evaluate(() => document.querySelectorAll('#cMet .mt1').length > 0));
|
|
@@ -11,6 +11,8 @@ const os = require('os');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
const { spawn, spawnSync } = require('child_process');
|
|
13
13
|
const { findBrowser } = require('./lib/find-browser');
|
|
14
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
15
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
14
16
|
const T = require('./test-run').configure({ name: 'briefing-premium-sources' });
|
|
15
17
|
|
|
16
18
|
const BASE = T.BASE;
|
|
@@ -133,7 +135,7 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
|
|
|
133
135
|
const grab = (pg, sel) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = /^#tl/.test(s) && window.__ev ? window.__ev(s) : document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [sel, PROPS]);
|
|
134
136
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
135
137
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
136
|
-
await m.goto('file://' + MOCKUP);
|
|
138
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
137
139
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 1 && document.querySelectorAll('#tl .ev').length > 0));
|
|
138
140
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; }, th);
|
|
139
141
|
const R = await open({ w, h, theme: th });
|
|
@@ -20,6 +20,8 @@ const fs = require('fs');
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
const { spawn } = require('child_process');
|
|
22
22
|
const { findBrowser } = require('./lib/find-browser');
|
|
23
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
24
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
23
25
|
const T = require('./test-run').configure({ name: 'briefing-premium' });
|
|
24
26
|
const B = require('./lib/briefing-premium.js');
|
|
25
27
|
const F = require('./fixtures/briefing-premium-facts.js');
|
|
@@ -560,7 +562,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
560
562
|
const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
|
|
561
563
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
562
564
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
563
|
-
await m.goto('file://' + MOCKUP);
|
|
565
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
564
566
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0));
|
|
565
567
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; }, th);
|
|
566
568
|
const R = await open({ w, h, theme: th });
|
|
@@ -10,6 +10,8 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const { spawn } = require('child_process');
|
|
12
12
|
const { findBrowser } = require('./lib/find-browser');
|
|
13
|
+
const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
|
|
14
|
+
const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
|
|
13
15
|
const T = require('./test-run').configure({ name: 'briefing-premium-work' });
|
|
14
16
|
const WP = require('./lib/my-work-premium.js');
|
|
15
17
|
const F = require('./fixtures/my-work-premium-facts.js');
|
|
@@ -288,7 +290,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
288
290
|
const grab = (pg, pairs) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s0] of pairs) { const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [pairs, PROPS]);
|
|
289
291
|
for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
|
|
290
292
|
const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
|
|
291
|
-
await m.goto('file://' + MOCKUP);
|
|
293
|
+
await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
|
|
292
294
|
await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
293
295
|
await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="work"]').click(); }, th);
|
|
294
296
|
await until(() => m.evaluate(() => document.querySelectorAll('#plateBody .wrow').length > 0)); await sleep(900);
|
|
@@ -9,6 +9,8 @@ timestamp: 2026-10-19
|
|
|
9
9
|
|
|
10
10
|
The premium Briefing is a page of its own at `/premium.html`. The console at `/` stays the default page. This page reads the repositories of the products you pick (see "Products"). It writes only when you press a button that says it records (see "What the buttons record"), plus one derived copy of its last answer, described below.
|
|
11
11
|
|
|
12
|
+
Every premium page uses the console's type: Space Grotesk for text, IBM Plex Mono for times and labels, and the same sizes and weights as the console. A premium page and the console at the same place read at the same size.
|
|
13
|
+
|
|
12
14
|
A rail on the left names four places: Briefing, My work, Board and Insights. Each is a premium page.
|
|
13
15
|
|
|
14
16
|
Every premium page has an **Open the console** button beside the theme button. It opens the console at `/c3.html`, for the places premium does not have yet (agent sessions, Calendar, Settings). In the console, the More menu has **Open premium**, which opens this page.
|
|
@@ -37,6 +37,7 @@ function rowOf(n, product) {
|
|
|
37
37
|
['Agent recommends', typeof f.recommended === 'string' ? clip(f.recommended, 120) : ''],
|
|
38
38
|
['Reversible', typeof f.reversible === 'boolean' ? (f.reversible ? 'Yes' : 'No') : ''],
|
|
39
39
|
['Effort', f.effort || ''],
|
|
40
|
+
['Checker', n.checker ? [n.checker.pass ? n.checker.pass + ' pass' : '', n.checker.flag ? n.checker.flag + ' flagged' : ''].filter(Boolean).join(', ') + ' · ' + n.checker.label : ''],
|
|
40
41
|
].filter((x) => x[1]);
|
|
41
42
|
const prepared = blocked ? 'The agent will not go on until you keep, send back or drop its drafts.' : 'Keep, send back or drop each draft.';
|
|
42
43
|
return {
|
|
@@ -73,6 +74,24 @@ function build({ parts } = {}) {
|
|
|
73
74
|
return { rows };
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
/** The Checker's advisory verdicts on each row's open drafts (initiative agent-orchestrator): { pass, flag, label } on the row, or nothing. */
|
|
78
|
+
function withChecks(root, needs) {
|
|
79
|
+
const D = require('./driver.js'), C = require('./orchestrator-checker.js');
|
|
80
|
+
const dir = D.stateDirOf(root);
|
|
81
|
+
if (!dir) return needs;
|
|
82
|
+
const checks = C.readChecks(dir);
|
|
83
|
+
if (!checks.size) return needs;
|
|
84
|
+
const state = D.fold(D.readLines(D.ledgerFile(dir)));
|
|
85
|
+
const cal = C.calibration(checks, state);
|
|
86
|
+
const open = [...state.proposals.values()].filter((p) => p.state === 'open');
|
|
87
|
+
return needs.map((n) => {
|
|
88
|
+
const m = /^driver-needs:(?:drafts|blocked):(.+)$/.exec(String(n && n.run_id || ''));
|
|
89
|
+
if (!m) return n;
|
|
90
|
+
const s = C.summary(open.filter((p) => D.targetKey(p.target) === m[1]), checks, cal);
|
|
91
|
+
return s ? Object.assign({}, n, { checker: s }) : n;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
76
95
|
/** One entry per included product: its driver rows. A product whose ledger cannot be read gives none, and no error. */
|
|
77
96
|
function readDrafts(available) {
|
|
78
97
|
const DN = require('./driver-needs.js');
|
|
@@ -81,9 +100,10 @@ function readDrafts(available) {
|
|
|
81
100
|
if (!a || !a.on || !a.root) continue;
|
|
82
101
|
let needs = [];
|
|
83
102
|
try { needs = DN.rowsFor({ root: a.root }, { lead: true }); } catch { needs = []; }
|
|
103
|
+
try { needs = withChecks(a.root, needs); } catch { /* the rows stand without the Checker */ }
|
|
84
104
|
out.push({ ws: a.ws, name: a.name, needs });
|
|
85
105
|
}
|
|
86
106
|
return out;
|
|
87
107
|
}
|
|
88
108
|
|
|
89
|
-
module.exports = { build, readDrafts, keyOf };
|
|
109
|
+
module.exports = { build, readDrafts, keyOf, withChecks };
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* It only decides whether a NEW run may start. It never ends a run: a run in progress drains by itself when the PM comes back.
|
|
16
16
|
* A run the PM starts by hand is not its business (see session-budget.js).
|
|
17
|
-
* Quota: when the CLI's remaining usage is known and below the reserve, nothing starts
|
|
18
|
-
* is the backstop, so an unreadable quota never means unlimited.
|
|
17
|
+
* Quota: when the CLI's remaining usage is known and below the reserve, nothing starts; nor before a usage-limit hold ends. When it is
|
|
18
|
+
* not known, the daily cap is the backstop, so an unreadable quota never means unlimited.
|
|
19
19
|
* Pure but for memFreeFrac and cpuPerCore, which take their readers as arguments. */
|
|
20
20
|
const fs = require('fs');
|
|
21
21
|
const os = require('os');
|
|
@@ -71,7 +71,8 @@ function modeOf({ now, lastActivityAt, settings } = {}) {
|
|
|
71
71
|
return inHours && active ? 'working' : 'away';
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/** load: { memFreeFrac: 0..1 | null, cpuPerCore: number | null }; quota: { remainingPct
|
|
74
|
+
/** load: { memFreeFrac: 0..1 | null, cpuPerCore: number | null }; quota: { remainingPct?: 0..100, heldUntil?: ms, reason? } | null.
|
|
75
|
+
* heldUntil is a hold set by a run that hit the usage limit (lib/orchestrator-quota.js): nothing starts before it. */
|
|
75
76
|
function decide({ now, lastActivityAt, settings, running = 0, startedToday = 0, load, quota, stopped = false } = {}) {
|
|
76
77
|
const s = settings || DEFAULTS;
|
|
77
78
|
const mode = modeOf({ now, lastActivityAt, settings: s });
|
|
@@ -80,6 +81,7 @@ function decide({ now, lastActivityAt, settings, running = 0, startedToday = 0,
|
|
|
80
81
|
if (stopped) return no('The orchestrator is stopped.');
|
|
81
82
|
if (running >= cap) return no(`${running} orchestrator runs are live (limit ${cap} while ${mode}).`);
|
|
82
83
|
if (startedToday >= s.dailyCap) return no(`${startedToday} runs started today (daily limit ${s.dailyCap}).`);
|
|
84
|
+
if (quota && Number.isFinite(quota.heldUntil) && quota.heldUntil > now) return no(quota.reason || 'Claude usage limit reached: no new run starts until it resets.');
|
|
83
85
|
if (quota && Number.isFinite(quota.remainingPct) && quota.remainingPct < s.quotaReservePct) {
|
|
84
86
|
return no(`Claude usage left is ${Math.round(quota.remainingPct)}%, below the ${s.quotaReservePct}% reserve.`);
|
|
85
87
|
}
|
|
@@ -23,6 +23,24 @@ const path = require('path');
|
|
|
23
23
|
const D = require('./driver.js');
|
|
24
24
|
const facts = require('./driver-facts.js');
|
|
25
25
|
const proactive = require('./proactive.js');
|
|
26
|
+
const crypto = require('crypto');
|
|
27
|
+
const tasks = require('./orchestrator-ledger.js');
|
|
28
|
+
|
|
29
|
+
/* agent-orchestrator (done-criterion 7): every wake a run answers is one task in the orchestrator's task ledger (tasks.jsonl, beside
|
|
30
|
+
* driver.jsonl). A run start starts its tasks; a run end finishes them. After a restart, lib/orchestrator-ledger.js recover() decides:
|
|
31
|
+
* a task on its first run is requeued, so the dead run's `run-end` hands its wake back to the queue and ONE more run answers it;
|
|
32
|
+
* a task on its second run fails with its reason and is not started again. The ledger is the orchestrator's, not a control-graph record. */
|
|
33
|
+
const taskIdOf = (wakeKey) => 'driver.' + crypto.createHash('sha1').update(String(wakeKey)).digest('hex').slice(0, 16);
|
|
34
|
+
function tasksStart(dir, wakeLines, runId, now) {
|
|
35
|
+
for (const w of wakeLines) {
|
|
36
|
+
const id = taskIdOf(w.key);
|
|
37
|
+
tasks.open(dir, { id, job: 'driver', trigger: w.reason, subject: w.key }, now);
|
|
38
|
+
tasks.started(dir, id, runId, now);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function tasksEnd(dir, wakeKeys, outcome, now) {
|
|
42
|
+
for (const k of wakeKeys || []) tasks.finished(dir, taskIdOf(k), outcome, now);
|
|
43
|
+
}
|
|
26
44
|
|
|
27
45
|
// A run that fails because the Claude login has expired fails again for every other target. Holding the next runs for this long (their
|
|
28
46
|
// wakes stay queued) stops one expired login from filing hundreds of failed runs; the first run after the wait is the probe.
|
|
@@ -98,7 +116,9 @@ function create(deps) {
|
|
|
98
116
|
const board = group.board || null;
|
|
99
117
|
if (!skill) {
|
|
100
118
|
D.append(file, { ev: 'run-start', run: runId, target: group.target, board, wakes: group.wakes, session: null }, { now });
|
|
101
|
-
|
|
119
|
+
const reason = `the ${kind === 'work' ? 'work-unblock' : 'initiative-drive'} skill is not installed`;
|
|
120
|
+
D.append(file, { ev: 'run-end', run: runId, ok: false, reason, agent_run: agentRun(runId, group.target, false, now) }, { now });
|
|
121
|
+
taskLedger(() => { tasksStart(path.dirname(file), wakeLines, runId, now); tasksEnd(path.dirname(file), group.wakes, { ok: false, reason }, now); });
|
|
102
122
|
return;
|
|
103
123
|
}
|
|
104
124
|
const prompt = `${skill}\n\nThis run:\n${describe(w, group.target, wakeLines, state, factsNow).map((l) => '- ' + l).join('\n')}\n\nFile every result with \`pmos driver propose\`. Send nothing, edit nothing.`;
|
|
@@ -107,7 +127,7 @@ function create(deps) {
|
|
|
107
127
|
session = deps.spawn({
|
|
108
128
|
name: `Driver · ${kind} ${group.target.id}`, ws: w.id, origin: `drive:${kind}:${group.target.id}`, initialInput: prompt + '\r',
|
|
109
129
|
initiative: kind === 'initiative' ? group.target.id : undefined,
|
|
110
|
-
onDone: (r) => endRun(file, runId, group.target, r),
|
|
130
|
+
onDone: (r) => endRun(file, runId, group.target, r, group.wakes),
|
|
111
131
|
});
|
|
112
132
|
} catch (e) { warn('driver run', e); }
|
|
113
133
|
D.append(file, { ev: 'run-start', run: runId, target: group.target, board, wakes: group.wakes, session: session ? session.id : null }, { now });
|
|
@@ -115,16 +135,22 @@ function create(deps) {
|
|
|
115
135
|
// A start that did not become a headless run (no `claude` on the PATH, a refused model choice, a pane because headless
|
|
116
136
|
// is off) is a failed run. It counts against the day, as every failed run does. Never leave a driver in a pane.
|
|
117
137
|
if (session && session.headless !== 'drive' && session.state !== 'exited' && deps.stop) { try { deps.stop(session); } catch { /* best effort */ } }
|
|
118
|
-
|
|
138
|
+
const reason = (session && session.note) || 'the run could not start as a background run';
|
|
139
|
+
D.append(file, { ev: 'run-end', run: runId, ok: false, reason, agent_run: agentRun(runId, group.target, false, now) }, { now });
|
|
140
|
+
taskLedger(() => { tasksStart(path.dirname(file), wakeLines, runId, now); tasksEnd(path.dirname(file), group.wakes, { ok: false, reason }, now); });
|
|
119
141
|
return;
|
|
120
142
|
}
|
|
121
143
|
active.set(runId, { target: group.target, ledger: file, session: session.id });
|
|
144
|
+
taskLedger(() => tasksStart(path.dirname(file), wakeLines, runId, now));
|
|
122
145
|
}
|
|
123
146
|
|
|
124
147
|
const agentRun = (runId, target, ok, now) => ({ run_id: runId, initiative_id: target.kind === 'initiative' ? target.id : null, kind: 'driver', target_kind: target.kind,
|
|
125
148
|
ok, human_corrections: 0, builder_model: 'not recorded in the repo', created_at: new Date(now == null ? Date.now() : now).toISOString() });
|
|
126
149
|
|
|
127
|
-
|
|
150
|
+
// The task ledger is bookkeeping for the restart: a failed write is reported and never stops or fails a run.
|
|
151
|
+
function taskLedger(fn) { try { fn(); } catch (e) { warn('orchestrator task ledger', e); } }
|
|
152
|
+
|
|
153
|
+
function endRun(file, runId, target, r, wakeKeys) {
|
|
128
154
|
active.delete(runId);
|
|
129
155
|
const res = (r && r.result) || {};
|
|
130
156
|
const ok = !!(r && !r.timedOut && !r.stopped && r.code === 0 && res.ok && !res.isError);
|
|
@@ -135,6 +161,7 @@ function create(deps) {
|
|
|
135
161
|
D.append(file, { ev: 'run-end', run: runId, ok, ...(reason ? { reason } : {}), ...(res.denied && res.denied.length ? { denied: res.denied } : {}),
|
|
136
162
|
agent_run: agentRun(runId, target, ok) });
|
|
137
163
|
} catch (e) { warn('driver run end', e); }
|
|
164
|
+
taskLedger(() => tasksEnd(path.dirname(file), wakeKeys, { ok, reason }));
|
|
138
165
|
}
|
|
139
166
|
|
|
140
167
|
/* `sweepNow` (Refresh now, data-refresh-settings R8) runs the unblock sweep at once, inside or outside the window. */
|
|
@@ -153,9 +180,21 @@ function create(deps) {
|
|
|
153
180
|
try {
|
|
154
181
|
let state = readState(file);
|
|
155
182
|
if (!state.epoch) { D.append(file, { ev: 'epoch' }, { now }); state = readState(file); summary.epoch++; }
|
|
156
|
-
// Runs that were alive when the server stopped are over; they keep their place in the day's count.
|
|
157
|
-
|
|
158
|
-
|
|
183
|
+
// Runs that were alive when the server stopped are over; they keep their place in the day's count. The task ledger decides
|
|
184
|
+
// what happens to their wakes (agent-orchestrator, criterion 7): a first interruption hands them back to the queue (`requeue`),
|
|
185
|
+
// so one more run answers them; a second fails them with the reason. A run from before the task ledger has no task: it only ends.
|
|
186
|
+
const dead = [...state.runs.values()].filter((r) => !r.end && !active.has(r.run));
|
|
187
|
+
if (dead.length) {
|
|
188
|
+
let rec = { requeued: [], failed: [] };
|
|
189
|
+
taskLedger(() => { rec = tasks.recover(dir, new Set(active.keys()), now); });
|
|
190
|
+
const requeued = new Set(rec.requeued); const failed = new Set(rec.failed);
|
|
191
|
+
for (const r of dead) {
|
|
192
|
+
const requeue = r.wakes.filter((k) => requeued.has(taskIdOf(k)));
|
|
193
|
+
const twice = r.wakes.some((k) => failed.has(taskIdOf(k)));
|
|
194
|
+
const reason = 'interrupted: the workspace restarted' + (requeue.length ? '; it runs once more' : twice ? '; interrupted twice, not started again' : '');
|
|
195
|
+
D.append(file, { ev: 'run-end', run: r.run, ok: false, reason, ...(requeue.length ? { requeue } : {}), agent_run: agentRun(r.run, r.target, false, now) }, { now });
|
|
196
|
+
}
|
|
197
|
+
state = readState(file);
|
|
159
198
|
}
|
|
160
199
|
const boardOf = (id) => { try { return deps.boardOf(w, id); } catch { return null; } };
|
|
161
200
|
let created = [];
|
package/workspace/lib/driver.js
CHANGED
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
* pause|resume { target, by } · mode { board, mode, by } PM only, as above. `board` '*' is every board.
|
|
31
31
|
* wake { key, target, board, reason: created|moved|answered|stuck, blocker? } queued: a run should start
|
|
32
32
|
* run-start { run, target, board, wakes: [key], session } one per run
|
|
33
|
-
* run-end { run, ok, reason?, agent_run }
|
|
33
|
+
* run-end { run, ok, reason?, agent_run, requeue? } agent_run is the run record the correction rate reads; requeue
|
|
34
|
+
* [key] (a run a restart interrupted, lib/driver-run.js): those wakes of the run go back to the queue for one more run
|
|
34
35
|
* refused { target, wakes: [key], reason } a wake the rules turned away, recorded
|
|
35
36
|
* blocker { key, day, target, board, code, owner: 'pm'|'agent', text } the sweep's finding, once per key per day
|
|
36
37
|
* epoch { } the first scan of this ledger: older events do not wake
|
|
@@ -249,6 +250,9 @@ function fold(lines) {
|
|
|
249
250
|
const r = s.runs.get(l.run);
|
|
250
251
|
if (!r || r.end) break;
|
|
251
252
|
r.end = l.at || null; r.ok = l.ok === true; r.reason = typeof l.reason === 'string' ? l.reason : null; r.agent_run = isObj(l.agent_run) ? l.agent_run : null;
|
|
253
|
+
// agent-orchestrator: a run a restart interrupted hands back the wakes the task ledger requeued (lib/orchestrator-ledger.js
|
|
254
|
+
// recover), so ONE more run answers them. Only a wake of this run that it started can go back to the queue.
|
|
255
|
+
if (Array.isArray(l.requeue)) for (const k of l.requeue) { const w = wakeBy.get(k); if (w && w.state === 'started' && r.wakes.includes(k)) w.state = 'queued'; }
|
|
252
256
|
break;
|
|
253
257
|
}
|
|
254
258
|
case 'refused': {
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* jobs that need no human run headless).
|
|
5
5
|
*
|
|
6
6
|
* kindFor({ agent, origin, skill, env }) → 'notes' | 'skill' | 'ask' | 'drive' | 'scan-web' | 'scan-repo' | 'scan-research-web' | 'scan-research-repo' | 'report-setup' | 'report-find' | 'core-doc' | 'report-design' | 'report-structure-pull' | 'report-sample-fetch' | 'report-structure' | 'report-structure-dry' | null (null: open a pane, as before)
|
|
7
|
-
* argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write
|
|
7
|
+
* argsFor(kind, { modelArgs, addDirs, writePaths }) → the argv after `claude` (writePaths: the one render file a report-design job may write;
|
|
8
|
+
* for the skill kind, the folders the run may write in, from skillWriteDirs)
|
|
9
|
+
* skillWriteDirs(skill, { root, scratch }) → the absolute folders a background skill run may write in: its scratch folder and the state folders its skill writes
|
|
8
10
|
* parseResult(stdout) → { ok, text, isError, turns, durationMs, costUsd, denied[] }
|
|
9
11
|
* streamLines(line) → { log: [lines], result: object|null } one stream-json event, for the live log
|
|
10
12
|
* logLines(result, exitCode) → the lines the read-only log pane shows at the end
|
|
@@ -55,6 +57,9 @@
|
|
|
55
57
|
* connector write tool, nothing that sends. The server validates the file before it lands. Neither kind ever runs in a pane.
|
|
56
58
|
*/
|
|
57
59
|
|
|
60
|
+
const fs = require('fs');
|
|
61
|
+
const path = require('path');
|
|
62
|
+
|
|
58
63
|
// The skills whose every start runs headless: they read, file a result for PMOS, and send nothing out.
|
|
59
64
|
const HEADLESS_SKILLS = Object.freeze([
|
|
60
65
|
'day-check', 'calendar-sync', 'jira-sync', 'my-work-read', 'report-biweekly', 'report-template',
|
|
@@ -63,7 +68,7 @@ const HEADLESS_SKILLS = Object.freeze([
|
|
|
63
68
|
// The note passes that run headless, by the origin prefix lib/routes-notes.js gives them.
|
|
64
69
|
const HEADLESS_ORIGINS = Object.freeze(['notes-bullets:', 'notes-summary:']);
|
|
65
70
|
// page-starts-agent: Ask the agent on a document. The run reads and answers with the revised text; it writes nothing.
|
|
66
|
-
const ASK_ORIGINS = Object.freeze(['doc-ask:', 'focus-companion:', 'briefing-ask:']); // focus-companion: the Meeting focus page's quiet companion and its private questions (read-only, nothing sent)
|
|
71
|
+
const ASK_ORIGINS = Object.freeze(['doc-ask:', 'focus-companion:', 'briefing-ask:', 'orch-check:']); // orch-check: the orchestrator's Checker grades the Driver's drafts (read-only, it writes nothing) // focus-companion: the Meeting focus page's quiet companion and its private questions (read-only, nothing sent)
|
|
67
72
|
// initiative-driver: one short run for one initiative or one Work task. Its origin is `drive:<kind>:<id>`.
|
|
68
73
|
const DRIVE_ORIGINS = Object.freeze(['drive:']);
|
|
69
74
|
// horizon-scan: a scan is two runs. The web run (origin `scan-web:<board>:<scan>`) reads the public web for the kept watch list and sees nothing of
|
|
@@ -93,6 +98,15 @@ const REPORT_STRUCTURE_DRY_ORIGINS = Object.freeze(['report-structure-dry:']);
|
|
|
93
98
|
// report-structure-gaps: Test pull reads ONE source for the last complete period (origin `report-structure-pull:<id>:<source>`).
|
|
94
99
|
const REPORT_STRUCTURE_PULL_ORIGINS = Object.freeze(['report-structure-pull:']);
|
|
95
100
|
const WRITE_PATH_KINDS = Object.freeze(['report-design', 'report-sample-fetch', 'report-structure', 'report-structure-dry', 'report-structure-pull']); // kinds whose one writable file the caller names (argsFor writePaths)
|
|
101
|
+
const WRITE_DIR_KINDS = Object.freeze(['skill']); // kinds whose writable folders the caller names (argsFor writePaths, each folder and what is under it)
|
|
102
|
+
// A background skill run reads untrusted text (Jira, mail, calendar), so it may write only in its own scratch folder and in the state folders its skill writes
|
|
103
|
+
// by hand. Every other write goes through a `pmos` verb, which checks what it writes. The folders are relative to <state>: `pmos/state/` if it exists, else
|
|
104
|
+
// `planning/` (the rule each skill states). A skill not named here writes only in its scratch folder.
|
|
105
|
+
const SKILL_WRITE_DIRS = Object.freeze({
|
|
106
|
+
'report-biweekly': Object.freeze(['reports/biweekly', 'reports/definitions']), // its notes in the draft, and a proposed definition when none exists
|
|
107
|
+
'report-template': Object.freeze(['reports']), // its notes and <slot>.data.json in <state>/reports/<template id>/; the id is the schedule's args
|
|
108
|
+
'memory-groom': Object.freeze(['memory/proposals']), // the one proposal file
|
|
109
|
+
});
|
|
96
110
|
|
|
97
111
|
// What each kind may use. Read-only search is always allowed. The notes passes write their JSON (and rename the .tmp
|
|
98
112
|
// file) in their notes folder, which --add-dir opens to them; the skills also run `pmos` verbs and repository scripts.
|
|
@@ -129,7 +143,10 @@ const TOOLS = Object.freeze({
|
|
|
129
143
|
'report-structure-dry': Object.freeze(['Read', 'Glob', 'Grep']),
|
|
130
144
|
// The pull run: the same read tools as the dry run. One source, one JSON file, no Bash, no web fetch, nothing that sends.
|
|
131
145
|
'report-structure-pull': Object.freeze(['Read', 'Glob', 'Grep']),
|
|
132
|
-
|
|
146
|
+
// `node` runs only the two repository scripts the skills name (report-biweekly, memory-groom): a bare `node *` could run anything, a send or a push included.
|
|
147
|
+
// The skill runs: no Write or Edit of their own. argsFor adds Write and Edit for the folders skillWriteDirs names (its scratch folder, and its skill's state folders).
|
|
148
|
+
skill: Object.freeze(['Read', 'Glob', 'Grep', 'Bash(pmos *)', 'Bash(node scripts/workflow-state.js)', 'Bash(node scripts/workflow-state.js *)',
|
|
149
|
+
'Bash(node scripts/pmos-memory.js *)', 'Bash(node pmos/scripts/pmos-memory.js *)',
|
|
133
150
|
'Bash(git log *)', 'Bash(git status *)', 'Bash(git diff *)', 'Bash(ls *)', 'Bash(date *)']),
|
|
134
151
|
});
|
|
135
152
|
|
|
@@ -173,6 +190,14 @@ function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [] } = {}) {
|
|
|
173
190
|
tools.push(`Write(/${s})`, `Edit(/${s})`);
|
|
174
191
|
}
|
|
175
192
|
}
|
|
193
|
+
// A background skill run may write in the folders the server names (its scratch folder, its skill's state folders) and nowhere else: absolute paths, no wildcard of their own.
|
|
194
|
+
if (WRITE_DIR_KINDS.includes(kind)) {
|
|
195
|
+
for (const p of Array.isArray(writePaths) ? writePaths : []) {
|
|
196
|
+
const s = String(p || '').replace(/\/+$/, '');
|
|
197
|
+
if (!s.startsWith('/') || /[\s,*?()\[\]{}]/.test(s) || s.includes('..')) continue;
|
|
198
|
+
tools.push(`Write(/${s}/**)`, `Edit(/${s}/**)`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
176
201
|
// stream-json needs --verbose in print mode; it adds the step events, and the last line is the same result object as `json`.
|
|
177
202
|
const argv = ['-p', '--output-format', 'stream-json', '--verbose', '--no-session-persistence', ...modelArgs, '--allowedTools', tools.join(',')];
|
|
178
203
|
// A web run gets no directory at all, whatever the caller passes: it must not be able to read the repository.
|
|
@@ -180,6 +205,20 @@ function argsFor(kind, { modelArgs = [], addDirs = [], writePaths = [] } = {}) {
|
|
|
180
205
|
return argv;
|
|
181
206
|
}
|
|
182
207
|
|
|
208
|
+
/** The absolute folders a background skill run may write in: its scratch folder, then the state folders SKILL_WRITE_DIRS names for its skill. */
|
|
209
|
+
function skillWriteDirs(skill, { root, scratch } = {}) {
|
|
210
|
+
const dirs = [];
|
|
211
|
+
if (scratch) dirs.push(path.resolve(String(scratch)));
|
|
212
|
+
const rel = SKILL_WRITE_DIRS[String(skill || '')];
|
|
213
|
+
if (rel && root) {
|
|
214
|
+
const r = path.resolve(String(root));
|
|
215
|
+
let state = path.join(r, 'planning');
|
|
216
|
+
try { if (fs.statSync(path.join(r, 'pmos', 'state')).isDirectory()) state = path.join(r, 'pmos', 'state'); } catch { /* no pmos/state: the state folder is planning/ */ }
|
|
217
|
+
for (const d of rel) dirs.push(path.join(state, d));
|
|
218
|
+
}
|
|
219
|
+
return dirs;
|
|
220
|
+
}
|
|
221
|
+
|
|
183
222
|
function timeoutMs(env) {
|
|
184
223
|
const n = Number((env || process.env).PMOS_HEADLESS_TIMEOUT_MS);
|
|
185
224
|
return Number.isFinite(n) && n > 0 ? n : DEFAULT_TIMEOUT_MS;
|
|
@@ -291,4 +330,4 @@ function logLines(r, exitCode) {
|
|
|
291
330
|
return out;
|
|
292
331
|
}
|
|
293
332
|
|
|
294
|
-
module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, TOOLS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff };
|
|
333
|
+
module.exports = { HEADLESS_SKILLS, HEADLESS_ORIGINS, ASK_ORIGINS, DRIVE_ORIGINS, SCAN_WEB_ORIGINS, SCAN_REPO_ORIGINS, SCAN_RESEARCH_WEB_ORIGINS, SCAN_RESEARCH_REPO_ORIGINS, WEB_KINDS, REPORT_SETUP_ORIGINS, REPORT_FIND_ORIGINS, CORE_DOC_ORIGINS, REPORT_DESIGN_ORIGINS, REPORT_SAMPLE_FETCH_ORIGINS, REPORT_STRUCTURE_ORIGINS, REPORT_STRUCTURE_DRY_ORIGINS, TOOLS, SKILL_WRITE_DIRS, DEFAULT_TIMEOUT_MS, kindFor, argsFor, skillWriteDirs, timeoutMs, parseResult, streamLines, outcomeOf, signedOut, SIGNED_OUT_WHY, logLines, switchedOff };
|