create-pmos 0.316.0 → 0.318.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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-board-test.js +2 -2
  7. package/workspace/briefing-premium-initiative-test.js +5 -10
  8. package/workspace/briefing-premium-insights-test.js +1 -1
  9. package/workspace/briefing-premium-products-test.js +9 -4
  10. package/workspace/briefing-premium-test.js +12 -10
  11. package/workspace/briefing-premium-work-test.js +1 -1
  12. package/workspace/guide/briefing-premium.md +21 -16
  13. package/workspace/lib/briefing-premium-agent.js +5 -0
  14. package/workspace/lib/capacity-governor.js +5 -3
  15. package/workspace/lib/driver-run.js +46 -7
  16. package/workspace/lib/driver.js +5 -1
  17. package/workspace/lib/headless.js +40 -3
  18. package/workspace/lib/insights-premium.js +1 -1
  19. package/workspace/lib/orchestrator-gate.js +2 -1
  20. package/workspace/lib/orchestrator-health.js +7 -3
  21. package/workspace/lib/orchestrator-quota.js +84 -0
  22. package/workspace/lib/orchestrator-spawn.js +3 -2
  23. package/workspace/lib/routes-briefing-premium.js +1 -1
  24. package/workspace/lib/routes-report-design.js +6 -2
  25. package/workspace/lib/routes-report-structure.js +27 -6
  26. package/workspace/package-lock.json +2 -2
  27. package/workspace/package.json +1 -1
  28. package/workspace/premium-studio-test.js +4 -4
  29. package/workspace/public/pm/premium-board.js +3 -2
  30. package/workspace/public/pm/premium-initiative.js +2 -1
  31. package/workspace/public/pm/premium-insights.js +3 -2
  32. package/workspace/public/pm/premium-shell.js +147 -7
  33. package/workspace/public/pm/premium-work.js +3 -1
  34. package/workspace/public/pm/premium.css +47 -2
  35. package/workspace/public/pm/premium.js +16 -23
  36. package/workspace/public/premium-board.html +2 -6
  37. package/workspace/public/premium-initiative.html +1 -5
  38. package/workspace/public/premium-insights.html +1 -5
  39. package/workspace/public/premium-work.html +2 -6
  40. package/workspace/public/premium.html +3 -7
  41. package/workspace/server.js +27 -5
  42. package/workspace/test-lists/agent-orchestrator-c.json +5 -3
  43. package/workspace/test-lists/agent-orchestrator-e2e.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.316.0",
3
+ "version": "0.318.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@2924deb
1
+ kernel-source: pmos@c02ec11
2
2
  assembled: 2026-10-19
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-19T13:57:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T14:36:49Z"}
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-19T13:57:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T14:36:49Z"}
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-19T13:57:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T14:36:49Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -65,7 +65,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
65
65
  /* B1 */
66
66
  const rail = await p.evaluate(() => ({ names: [...document.querySelectorAll('.rail .pl')].map((b) => b.textContent.trim()), cur: document.querySelector('.rail [aria-current="page"]').textContent.trim(), pi: getComputedStyle(document.querySelector('.rail')).getPropertyValue('--pi').trim(), title: document.title, name: document.querySelector('#crBoard').textContent, sw: document.querySelector('#crSw').hidden }));
67
67
  ok('B1 the rail names four places, Board is current, the board is named and has no switcher for one board', rail.names.join() === 'Briefing,My work,Board,Insights' && rail.cur === 'Board' && rail.pi === '2' && rail.name === 'pmos' && rail.sw, JSON.stringify(rail));
68
- { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('B1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
68
+ { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('B1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
69
69
  ok('B1 the page is served at /premium-board and /premium-board.html', (await fetch(BASE + '/premium-board')).status === 200 && (await fetch(BASE + '/premium-board.html')).status === 200);
70
70
  for (const [go, re] of [['brief', /\/premium\.html$/], ['work', /\/premium-work\.html$/]]) {
71
71
  const r2 = await open(); await r2.page.locator(`.rail [data-go="${go}"]`).click();
@@ -159,7 +159,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
159
159
  const u = new URL(D.page.url());
160
160
  ok('B14 a click on an initiative opens its page with the initiative, the workspace and the board', u.pathname === '/premium-initiative.html' && u.searchParams.get('id') === 'self-serve-v2' && u.searchParams.get('ws') === 'w1' && u.searchParams.get('board') === 'w1', D.page.url());
161
161
  await D.page.goBack(); await until(() => D.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0));
162
- await D.page.click('#modeSeg [data-m="popup"]');
162
+ await D.page.click('#moreBtn'); await D.page.click('#modeSeg [data-m="popup"]'); await D.page.keyboard.press('Escape'); // premium-topbar: the switch is in the Board's ⋯ menu
163
163
  await D.page.locator('#ibBody .ini2').first().click();
164
164
  ok('B14 the Popup setting opens the dialog and stays on the Board', await until(() => D.page.evaluate(() => document.querySelector('#dlg').classList.contains('on'))) && new URL(D.page.url()).pathname === '/premium-board.html');
165
165
  await D.page.keyboard.press('Escape'); await D.page.reload(); await until(() => D.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0));
@@ -75,23 +75,18 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
75
75
  /* I1 place */
76
76
  const rail = await p.evaluate(() => ({ names: [...document.querySelectorAll('.rail .pl')].map((b) => b.textContent.trim()), cur: document.querySelector('.rail [aria-current="page"]').textContent.trim() }));
77
77
  ok('I1 the rail names the four places and marks Board', rail.names.join() === 'Briefing,My work,Board,Insights' && rail.cur === 'Board');
78
- { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('I1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
79
- ok('I1 the crumb names the board and the initiative, with a switcher for each and the sparkle', await p.evaluate(() => document.querySelector('#crBoard').textContent === 'Onboarding' && document.querySelector('#crIni').textContent === 'Self-serve onboarding v2' && !!document.querySelector('#crSw') && !!document.querySelector('#crSw2') && document.querySelector('#crAsk').getAttribute('aria-label') === 'Ask about this initiative'));
78
+ { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('I1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
79
+ ok('I1 the bar has a back button to the board, the initiative with its switcher, and Chat (premium-topbar)', await p.evaluate(() => document.querySelector('#crBoard').getAttribute('aria-label') === 'Back to Onboarding' && document.querySelector('#crIni').textContent === 'Self-serve onboarding v2' && !document.querySelector('#crSw') && !!document.querySelector('#crSw2') && document.querySelector('#crAsk').getAttribute('aria-label') === 'Ask about this initiative'));
80
80
  await p.route('**/premium-board.html*', (r) => r.fulfill({ contentType: 'text/html', body: '<title>b</title>' }));
81
81
  await p.route('**/premium-initiative.html?id=partner*', (r) => r.fulfill({ contentType: 'text/html', body: '<title>i</title>' }));
82
- await p.click('#crSw'); const bm = await p.evaluate(() => ({ open: !document.querySelector('#crMenu').hidden, items: [...document.querySelectorAll('#crMenu button')].map((b) => b.textContent + (b.hasAttribute('aria-current') ? '*' : '')).join('|'), exp: document.querySelector('#crSw').getAttribute('aria-expanded') }));
83
- ok('I1 the board switcher lists the boards and marks this one', bm.open && bm.items === 'Onboarding*|Payments' && bm.exp === 'true', JSON.stringify(bm));
84
- await p.keyboard.press('Escape'); ok('I1 Escape closes the menu and gives the focus back to its button', await p.evaluate(() => document.querySelector('#crMenu').hidden && document.activeElement.id === 'crSw'));
85
82
  await p.click('#crSw2'); const im = await p.evaluate(() => [...document.querySelectorAll('#crMenu button')].map((b) => b.textContent + (b.hasAttribute('aria-current') ? '*' : '')).join('|'));
86
83
  ok('I1 the initiative switcher lists the board\'s initiatives and marks this one', im === 'Self-serve onboarding v2*|Partner API rate limits|Usage-based billing', im);
87
84
  await p.click('#crMenu [data-swi="partner-rate-limits"]'); await sleep(500);
88
85
  { const u = new URL(p.url()); ok('I1 choosing an initiative opens its page on the same board', u.pathname === '/premium-initiative.html' && u.searchParams.get('id') === 'partner-rate-limits' && u.searchParams.get('board') === 'w1', p.url()); await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#cIniTk'))); }
89
- await p.click('#crSw'); await p.click('#crMenu [data-sw="w2|w2"]'); await sleep(500);
90
- { const u = new URL(p.url()); ok('I1 choosing a board opens that board\'s page', u.pathname === '/premium-board.html' && u.searchParams.get('ws') === 'w2' && u.searchParams.get('board') === 'w2', p.url()); await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#cIniTk'))); }
91
86
  await p.click('#crBoard'); await sleep(500);
92
- { const u = new URL(p.url()); ok('I1 the board\'s name leads back to the Board', u.pathname === '/premium-board.html' && u.searchParams.get('board') === 'w1', p.url()); await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#cIniTk'))); }
87
+ { const u = new URL(p.url()); ok('I1 the back button leads back to the Board', u.pathname === '/premium-board.html' && u.searchParams.get('board') === 'w1', p.url()); await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#cIniTk'))); }
93
88
  await p.click('#crAsk'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
94
- ok('I1 the sparkle opens the initiative in the dialog with the read-only agent beside it', await p.evaluate(() => document.querySelector('#dTitle').textContent === 'Self-serve onboarding v2' && /Lane\|feature/.test([...document.querySelectorAll('#oMain .kv2 span')].map((x) => x.textContent).join('|')) && !document.querySelector('#askF').hidden));
89
+ ok('I1 Chat opens the initiative in the dialog with the read-only agent beside it', await p.evaluate(() => document.querySelector('#dTitle').textContent === 'Self-serve onboarding v2' && /Lane\|feature/.test([...document.querySelectorAll('#oMain .kv2 span')].map((x) => x.textContent).join('|')) && !document.querySelector('#askF').hidden));
95
90
  await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
96
91
 
97
92
  /* I3 header */
@@ -323,7 +318,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
323
318
  /* I12 fidelity against the mockup */
324
319
  if (!fs.existsSync(MOCKUP)) ok('I12 the mockup is in the repository', false, MOCKUP);
325
320
  else {
326
- const PAIRS = [['rail', '.rail'], ['crumb', '.crumb'], ['crb', '#crBoard'], ['cri', '#crSw'], ['crask', '#crAsk'], ['lede', '#cIniOv .lede'], ['agr', '#cIniOv .agr2'], ['agc', '#cIniOv .agc'], ['tkadd', '.tkadd'], ['chip', '.ihead .chp'], ['meta', '.ihm'], ['strip', '.iws em'], ['segs', '.iws .sg2'], ['ov', '#cIniOv'], ['ovh', '#cIniOv h2'], ['todo', '#cIniOv .todo'], ['tdw', '#cIniOv .tdw'], ['tk', '#cIniTk'], ['tkq', '#cIniTk .tkq:last-child'], ['tki', '#cIniTk .tkq:last-child .tki'], ['tkn', '#cIniTk .tkq:last-child .tkn b'], ['tkp', '#cIniTk .tkq:last-child .tkp'], ['doc', '#cIniDoc'], ['dsum', '.dsum'], ['dprog', '.dprog'], ['dtool', '.dtool'], ['dmr', '#cIniDoc .dmr'], ['dmi', '#cIniDoc .dmi.c-Plan'], ['dock', '.dock']];
321
+ const PAIRS = [['rail', '.rail'], ['crumb', '.crumb'], ['lede', '#cIniOv .lede'], ['agr', '#cIniOv .agr2'], ['agc', '#cIniOv .agc'], ['tkadd', '.tkadd'], ['chip', '.ihead .chp'], ['meta', '.ihm'], ['strip', '.iws em'], ['segs', '.iws .sg2'], ['ov', '#cIniOv'], ['ovh', '#cIniOv h2'], ['todo', '#cIniOv .todo'], ['tdw', '#cIniOv .tdw'], ['tk', '#cIniTk'], ['tkq', '#cIniTk .tkq:last-child'], ['tki', '#cIniTk .tkq:last-child .tki'], ['tkn', '#cIniTk .tkq:last-child .tkn b'], ['tkp', '#cIniTk .tkq:last-child .tkp'], ['doc', '#cIniDoc'], ['dsum', '.dsum'], ['dprog', '.dprog'], ['dtool', '.dtool'], ['dmr', '#cIniDoc .dmr'], ['dmi', '#cIniDoc .dmi.c-Plan'], ['dock', '.dock']];
327
322
  const SKIP_W = ['crumb', 'crb', 'lede', 'agr', 'agc', 'tkadd', 'ckrs', 'chip', 'meta', 'strip', 'segs', 'ov', 'ovh', 'todo', 'tdw', 'chk', 'ckr', 'tk', 'tkq', 'tki', 'tkn', 'tkp', 'doc', 'dsum', 'dprog', 'dtool', 'dmr', 'dmi'];
328
323
  const SKIP_L = ['crumb', 'crb', 'cri', 'crask', 'lede', 'agr', 'agc', 'tkadd', 'ckrs', 'chip', 'meta', 'strip', 'segs', 'tdw', 'ovh', 'ckr', 'tkq', 'tki', 'tkn', 'tkp', 'dmr', 'dmi', 'dsum', 'dprog', 'dtool', 'todo'];
329
324
  const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'backdropFilter', 'borderTopColor'];
@@ -65,7 +65,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
65
65
  /* I1 */
66
66
  const rail = await p.evaluate(() => ({ names: [...document.querySelectorAll('.rail .pl')].map((b) => b.textContent.trim()), cur: document.querySelector('.rail [aria-current="page"]').textContent.trim(), pi: getComputedStyle(document.querySelector('.rail')).getPropertyValue('--pi').trim(), title: document.title, name: document.querySelector('#crBoard').textContent, sw: document.querySelector('#crSw').hidden }));
67
67
  ok('I1 the rail names four places, Insights is current, the board is named and has no switcher for one board', rail.names.join() === 'Briefing,My work,Board,Insights' && rail.cur === 'Insights' && rail.pi === '3' && rail.name === 'pmos' && rail.sw, JSON.stringify(rail));
68
- { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('I1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
68
+ { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('I1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
69
69
  ok('I1 the page is served at /premium-insights and /premium-insights.html', (await fetch(BASE + '/premium-insights')).status === 200 && (await fetch(BASE + '/premium-insights.html')).status === 200);
70
70
  for (const [go, re] of [['brief', /\/premium\.html$/], ['work', /\/premium-work\.html$/], ['init', /\/premium-board\.html$/]]) {
71
71
  const r2 = await open(); await r2.page.locator(`.rail [data-go="${go}"]`).click();
@@ -80,9 +80,14 @@ const product = (name, cond) => {
80
80
  const page = await ctx.newPage(); const errors = [];
81
81
  page.on('pageerror', (e) => errors.push(String(e.message || e)));
82
82
  await page.goto(BASE + '/premium.html' + q, { waitUntil: 'domcontentloaded' });
83
- await page.waitForSelector('#rank .rr, #calm:not([hidden]), #pkw:not([hidden])', { timeout: 30000 });
83
+ await page.waitForSelector('#rank .rr, #calm:not([hidden]), #pkw:not([hidden])', { state: 'attached', timeout: 30000 }); // the picker is parked for the Sources dialog (premium-topbar), so attached, not visible
84
84
  return { ctx, page, errors };
85
85
  };
86
+ // premium-topbar: the picker lives in the Sources dialog (the chip, or the ⋯ menu at phone width)
87
+ const pick = async (page) => {
88
+ if (!(await page.isVisible('#pick'))) { if (await page.isVisible('#srcChip')) await page.click('#srcChip'); else { await page.click('#moreBtn'); await page.click('#srcItem'); } await page.waitForSelector('#pick', { state: 'visible', timeout: 10000 }); }
89
+ await page.click('#pick');
90
+ };
86
91
  const rowsOf = (page) => page.$$eval('#rank .rr', (els) => els.map((e) => ({ key: e.dataset.key, tag: (e.querySelector('.pn') || {}).textContent || '', title: e.querySelector('.rt').textContent })));
87
92
 
88
93
  {
@@ -93,7 +98,7 @@ const product = (name, cond) => {
93
98
  const snap = await page.textContent('#snap');
94
99
  ok('P1 the header names what is read and what is not', /IDPF and microsites/.test(snap) && /not included/.test(snap) && /\b[Pp][Mm][Oo][Ss]\b|pmos/i.test(snap), snap);
95
100
  ok('P2 the picker says how many of the workspaces are on', (await page.textContent('#pick')).replace(/\s+/g, '') === 'Products2of3', await page.textContent('#pick'));
96
- await page.click('#pick');
101
+ await pick(page);
97
102
  const items = await page.$$eval('#pickMenu [role="menuitemcheckbox"]', (els) => els.map((e) => ({ name: e.textContent.trim(), on: e.getAttribute('aria-checked'), h: Math.round(e.getBoundingClientRect().height) })));
98
103
  ok('P2 the menu lists every workspace, the home one included, unticked', items.length === 3 && items.filter((i) => i.on === 'true').length === 2 && items.some((i) => i.on === 'false' && /home/.test(i.name)), JSON.stringify(items));
99
104
  const pickH = await page.$eval('#pick', (e) => Math.round(e.getBoundingClientRect().height));
@@ -107,7 +112,7 @@ const product = (name, cond) => {
107
112
  ok('P13 keyboard: the menu stays open on the ticked item and Escape closes it', await page.evaluate((id) => document.activeElement && document.activeElement.dataset.ws === id, wB.id) && (await page.keyboard.press('Escape'), await until(async () => await page.$eval('#pickMenu', (e) => e.hidden), 3000)));
108
113
  ok('P3 the choice survives a reload', await (async () => { await page.reload({ waitUntil: 'domcontentloaded' }); return until(async () => { const r = await rowsOf(page); return r.length === 1 && r[0].tag === 'IDPF' ? 1 : 0; }, 20000); })());
109
114
  // tick the home workspace
110
- await page.click('#pick'); await page.click(`#pickMenu [data-ws="${home.id}"]`);
115
+ await pick(page); await page.click(`#pickMenu [data-ws="${home.id}"]`);
111
116
  ok('P3 ticking the home workspace reads it', await until(async () => (await page.getAttribute(`#pickMenu [data-ws="${home.id}"]`, 'aria-checked')) === 'true' && new RegExp(home.name + ' and IDPF|IDPF and ' + home.name, 'i').test(await page.textContent('#snap')), 20000), await page.textContent('#snap'));
112
117
  // back to the default
113
118
  await page.click('#pickMenu [data-reset]');
@@ -152,7 +157,7 @@ const product = (name, cond) => {
152
157
  for (const [w, th] of [[390, 'light'], [390, 'dark'], [1280, 'dark']]) {
153
158
  const { ctx, page } = await open({ w, h: 800, theme: th });
154
159
  await until(async () => (await rowsOf(page)).length >= 1, 20000);
155
- await page.click('#pick');
160
+ await pick(page);
156
161
  const o = await page.evaluate(() => ({ sw: document.documentElement.scrollWidth, cw: document.documentElement.clientWidth, menu: (() => { const r = document.querySelector('#pickMenu').getBoundingClientRect(); return { l: Math.round(r.left), r: Math.round(r.right) }; })() }));
157
162
  ok(`P13 at ${w} px, ${th}: no sideways scroll with the menu open, and the menu stays on screen`, o.sw <= o.cw && o.menu.l >= 0 && o.menu.r <= o.cw, JSON.stringify(o));
158
163
  await ctx.close();
@@ -87,16 +87,18 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
87
87
  const def = await fetch(BASE + '/').then((r) => r.text());
88
88
  ok('R1 the premium Briefing is the default page', /class="rail/.test(def) && !/id="c3-root"/.test(def));
89
89
  { const con = await fetch(BASE + '/console.html').then((r) => r.text()); ok('R1 the console is served at /console.html', /id="c3-root"/.test(con)); const old = await fetch(BASE + '/c3.html', { redirect: 'manual' }); const oldQ = await fetch(BASE + '/c3.html?tab=rep', { redirect: 'manual' }); ok('R1 /c3.html goes to the premium Briefing, and with a query to the console with the same query', old.status === 302 && old.headers.get('location') === '/premium.html' && oldQ.status === 302 && oldQ.headers.get('location') === '/console.html?tab=rep', old.headers.get('location') + ' | ' + oldQ.headers.get('location')); }
90
- { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('R1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
90
+ { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('R1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
91
91
 
92
92
  /* premium-search-bell: the Search button, the bell and Ctrl K, from the shared shell */
93
93
  {
94
94
  await p.route('**/api/boards/backlog*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, ws: 'w1', board: 'b1', rows: [{ id: 'sb-alpha', title: 'Alpha launch plan', lane: 'feature', stage: 'Build' }] }) }));
95
95
  await p.route('**/api/core-docs*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, scope: { name: 'PMOS' }, docs: [{ key: 'roadmap', title: 'Roadmap' }] }) }));
96
96
  await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: [{ id: 's1', name: 'Fix the footer', state: 'idle', cwd: '.' }, { id: 's2', name: 'Nightly run', state: 'idle', automatic: true }] }) }));
97
+ await p.click('#moreBtn');
97
98
  const sb = await until(() => p.evaluate(() => { const s = document.querySelector('#pvSearch'), b = document.querySelector('#pvBell'), g = document.querySelector('#pvBdg'); if (!s || !b || !g || g.hidden) return null; const rs = s.getBoundingClientRect(), rb = b.getBoundingClientRect(); return { sw: Math.round(rs.width), sh: Math.round(rs.height), bw: Math.round(rb.width), bh: Math.round(rb.height), n: g.textContent, lab: b.getAttribute('aria-label') }; }), 8000);
98
99
  const want = MODEL.list.count;
99
- ok('SB1 the header has a Search button and a bell, 44 px, and the bell counts what the Briefing lists', sb && sb.sw >= 44 && sb.sh >= 44 && sb.bw >= 44 && sb.bh >= 44 && sb.n === String(want) && sb.lab === 'Needs you: ' + want, JSON.stringify(sb));
100
+ ok('SB1 the ⋯ menu has Search and the header has the bell, 44 px, and the bell counts what the Briefing lists', sb && sb.sw >= 44 && sb.sh >= 44 && sb.bw >= 44 && sb.bh >= 44 && sb.n === String(want) && sb.lab === 'Needs you: ' + want, JSON.stringify(sb));
101
+ await p.keyboard.press('Escape');
100
102
  await p.keyboard.press('Control+k');
101
103
  const pal = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return o && !o.hidden && document.activeElement && document.activeElement.id === 'pvQ' ? { rail: document.querySelector('.rail').inert, groups: [...document.querySelectorAll('#pvList .pv-grp')].map((x) => x.textContent) } : null; }), 6000);
102
104
  ok('SB2 Ctrl K opens the search with the box focused and the page behind it inert', pal && pal.rail === true, JSON.stringify(pal));
@@ -107,8 +109,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
107
109
  const ses = await until(() => p.evaluate(() => [...document.querySelectorAll('#pvList .pv-row b')].map((x) => x.textContent).join() === 'Fix the footer' ? 1 : 0), 6000);
108
110
  ok('SB4 sessions are listed and automatic ones are left out', !!ses);
109
111
  await p.keyboard.press('Escape');
110
- const closed = await until(() => p.evaluate(() => document.querySelector('#pvOv').hidden && !document.querySelector('.rail').inert && document.activeElement.id === 'pvSearch'), 4000);
111
- ok('SB5 Escape closes it and puts the focus back on the button', !!closed);
112
+ const closed = await until(() => p.evaluate(() => document.querySelector('#pvOv').hidden && !document.querySelector('.rail').inert && document.activeElement.id === 'moreBtn'), 4000);
113
+ ok('SB5 Escape closes it and puts the focus back on the ⋯ button', !!closed);
112
114
  await p.click('#pvBell');
113
115
  const rows = await until(() => p.evaluate(() => { const o = document.querySelector('#pvOv'); return !o.hidden ? document.querySelectorAll('#pvList .pv-row').length : 0; }), 6000);
114
116
  ok('SB6 the bell lists the Briefing rows and a row opens the Briefing', rows === MODEL.list.rows.length, String(rows));
@@ -116,8 +118,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
116
118
  ok('SB7 search and the bell only read: no POST left the page', !A.reqs.some((x) => x.startsWith('POST ')));
117
119
  }
118
120
  /* premium-settings: the dialog holds Workspaces and Connectors only; each press goes to its existing route */
119
- { const bt = await p.evaluate(() => { const b = document.querySelector('#settingsBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { label: b.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height) }; });
120
- ok('S1 the header has a Settings button of at least 44 px', bt && bt.label === 'Settings' && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
121
+ { await p.click('#moreBtn'); const bt = await p.evaluate(() => { const b = document.querySelector('#settingsBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { label: b.textContent.trim(), w: Math.round(r.width), h: Math.round(r.height) }; });
122
+ ok('S1 the ⋯ menu has a Settings item of at least 44 px', bt && bt.label === 'Settings' && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
121
123
  await p.click('#settingsBtn');
122
124
  const drawn = await until(() => p.evaluate(() => document.querySelectorAll('#oMain .sr').length > 0), 8000);
123
125
  const labs = await p.evaluate(() => [...document.querySelectorAll('#oMain .label')].map((x) => x.textContent));
@@ -140,8 +142,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
140
142
  let removes = 0, slowOnce = true;
141
143
  await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: fake }) }));
142
144
  await p.route('**/api/session/remove', (r) => { removes++; const id = JSON.parse(r.request().postData()).id; if (id === 'sess-2' && slowOnce) { slowOnce = false; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: false, note: 'asked it to end' }) }); } const i = fake.findIndex((x) => x.id === id); if (i >= 0) fake.splice(i, 1); return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: true }) }); });
143
- const bt = await p.evaluate(() => { const b = document.querySelector('#sessBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { w: Math.round(r.width), h: Math.round(r.height) }; });
144
- ok('X1 the header has an Agent sessions button of at least 44 px', bt && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
145
+ await p.click('#moreBtn'); const bt = await p.evaluate(() => { const b = document.querySelector('#sessBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { w: Math.round(r.width), h: Math.round(r.height) }; });
146
+ ok('X1 the ⋯ menu has an Agent sessions item of at least 44 px', bt && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
145
147
  await p.click('#sessBtn');
146
148
  const rows = await until(() => p.evaluate(() => document.querySelectorAll('#oMain .ssr').length), 8000);
147
149
  ok('X2 the list shows the sessions that have not exited, and the title counts them', rows === 2 && (await p.evaluate(() => document.querySelector('#dTitle').textContent)) === '2 running', String(rows));
@@ -164,7 +166,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
164
166
  let asking = true; const answers = [];
165
167
  await p.route('**/api/runs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, cards: asking ? { 'sess-1': { state: 'asking', asked: 'q-7', ask: { id: 'q-7', q: 'Which folder should the brief go in?', options: [{ label: 'planning/briefs', rec: true }, { label: 'planning/research' }] } } } : {} }) }));
166
168
  await p.route('**/api/runs/answer', (r) => { answers.push({ ...JSON.parse(r.request().postData()), hasNonce: !!r.request().headers()['x-pmos-nonce'] }); asking = false; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) }); });
167
- await p.keyboard.press('Escape'); await p.click('#sessBtn');
169
+ await p.keyboard.press('Escape'); await p.click('#moreBtn'); await p.click('#sessBtn');
168
170
  const q = await until(() => p.evaluate(() => { const b = document.querySelector('#oMain .ssq'); return b ? b.textContent : ''; }), 8000);
169
171
  ok('Q1 a session that is asking shows its question and the options it offered, in its own words', /Which folder should the brief go in\?/.test(q) && /planning\/briefs/.test(q) && /planning\/research/.test(q), q);
170
172
  ok('Q2 no question shows on a session that is not asking', (await p.evaluate(() => document.querySelectorAll('#oMain .ssq').length)) === 1);
@@ -527,7 +529,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
527
529
  {
528
530
  const t = await p.evaluate(() => {
529
531
  const small = [];
530
- for (const s of ['.rr .rhd', '.rr .rpin', '#tl .ev', '#srcChips .fchip', '.fbtn', '.rail .pl', '#theme', '#theme2']) document.querySelectorAll(s).forEach((e) => { const r = e.getBoundingClientRect(); if (r.width && (r.height < 44 || r.width < 44)) small.push(s + ' ' + Math.round(r.width) + 'x' + Math.round(r.height)); });
532
+ for (const s of ['.rr .rhd', '.rr .rpin', '#tl .ev', '#srcChips .fchip', '.fbtn', '.rail .pl', '#srcChip', '#moreBtn', '#pgChat', '#theme2']) document.querySelectorAll(s).forEach((e) => { const r = e.getBoundingClientRect(); if (r.width && (r.height < 44 || r.width < 44)) small.push(s + ' ' + Math.round(r.width) + 'x' + Math.round(r.height)); });
531
533
  return small;
532
534
  });
533
535
  ok('R11 every control is at least 44 px', t.length === 0, t.join(' | '));
@@ -70,7 +70,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
70
70
  /* M1 */
71
71
  const rail = await p.evaluate(() => ({ names: [...document.querySelectorAll('.rail .pl')].map((b) => b.textContent.trim()), cur: document.querySelector('.rail [aria-current="page"]').textContent.trim(), go: [...document.querySelectorAll('.rail [data-go]')].map((b) => b.dataset.go), pi: getComputedStyle(document.querySelector('.rail')).getPropertyValue('--pi').trim(), title: document.title }));
72
72
  ok('M1 the rail names four places, My work is current and the indicator sits on it', rail.names.join() === 'Briefing,My work,Board,Insights' && rail.cur === 'My work' && rail.go.join() === 'brief,work,init,rep' && rail.pi === '1', JSON.stringify(rail));
73
- { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('M1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
73
+ { await p.click('#moreBtn'); const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('M1 the ⋯ menu links to the console (premium-console-link, premium-topbar)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); await p.keyboard.press('Escape'); }
74
74
  const res = await fetch(BASE + '/premium-work').then((r) => r.status);
75
75
  { /* the Calendar card shared with the Briefing (initiative premium-calendar-card) */
76
76
  const cal = await until(() => p.evaluate(() => { const b = [...document.querySelectorAll('#weekBody [data-day]')]; return b.length === 5 && !/Reading/.test(document.querySelector('#wkList').textContent) ? { title: document.querySelector('#hWeek').textContent, pressed: b.filter((x) => x.getAttribute('aria-pressed') === 'true').length, list: !!document.querySelector('#wkList .wkd'), fold: document.querySelector('#weekCard .foldb').getAttribute('aria-expanded') } : null; }));
@@ -13,18 +13,26 @@ Every premium page uses the console's type: Space Grotesk for text, IBM Plex Mon
13
13
 
14
14
  A rail on the left names four places: Briefing, My work, Board and Insights. Each is a premium page.
15
15
 
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.
16
+ Every premium page has the same top bar. On the left is where you are, then a round **Chat** button. On the right are the **Sources** chip, the bell and one **⋯** menu.
17
17
 
18
- Every premium page also has a **Search** button and a bell. Ctrl K (or `/`) opens the search over places, initiatives, documents and your running sessions; Enter opens the result. The bell counts the same things the Briefing lists under what you need to do, and a press opens the Briefing. Both only read; neither changes a record. Every premium page has a **Settings** button beside it. It opens one dialog with two sections. **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.
18
+ - **Chat** opens the read-only agent about the page you are on: the Briefing, My work, the board, or the initiative. On Insights, Chat opens the Insight Studio, because the Studio is that page's chat.
19
+ - **Sources** has a green dot when every source was read recently, and an orange dot when a source is old, was never read, failed, or the page could not read it. Hover to see which. A press opens the Sources dialog (see "Sources" below).
20
+ - **The bell** counts the same things the Briefing lists under what you need to do, and a press opens the Briefing.
21
+ - **The ⋯ menu** holds **Search** (Ctrl K), **Agent sessions** with a count, **Console**, **Theme** (Light, Dark or Auto) and **Settings**. On the Board it also holds **Open initiatives** as Page or Popup. An orange dot on ⋯ means an agent session waits on you.
22
+ - **On a phone** the bar is one row: the page name, Chat, the bell and ⋯. Sources moves into the ⋯ menu.
19
23
 
20
- Every premium page has an **Agent sessions** button beside the console button, with a count of the sessions running. It opens a dialog that lists each running session and background run with its note, state and start time. **Stop** asks first and says what it ends, then ends the session and closes its terminal. If the session has not exited yet, the row says so and offers Stop again. When a session has asked a question, its row shows the question in the agent's own words with the options it offered; a press sends that option as your answer, and the question leaves the row. A permission request ("Wants to run"), terminals and new sessions stay in the console; the dialog links to it. Answering needs the page's launch nonce, so an agent session cannot call it.
24
+ **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 with two sections. **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
+
26
+ **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.
27
+
28
+ **Agent sessions** in the ⋯ menu shows a count of the sessions running. It opens a dialog that lists each running session and background run with its note, state and start time. **Stop** asks first and says what it ends, then ends the session and closes its terminal. If the session has not exited yet, the row says so and offers Stop again. When a session has asked a question, its row shows the question in the agent's own words with the options it offered; a press sends that option as your answer, and the question leaves the row. A permission request ("Wants to run"), terminals and new sessions stay in the console; the dialog links to it. Answering needs the page's launch nonce, so an agent session cannot call it.
21
29
 
22
30
  ## Products
23
31
 
24
32
  You work across products, and a conversation in email, the calendar or Confluence cannot be tied to one product. So the Briefing reads more than one workspace and merges what needs you into one list.
25
33
 
26
34
  - **By default** it reads every registered workspace except the home one (PMOS itself). PMOS is the tool, not a product you manage, so it is left out until you ask.
27
- - **The Products button** in the header lists every registered workspace, the home one included, each with a box. Tick a box to read that workspace, clear it to stop. The button says how many are on, for example "2 of 3". "Back to the default" returns to every workspace except the home one.
35
+ - **Products**, at the top of the **Sources** dialog, lists every registered workspace, the home one included, each with a box. Tick a box to read that workspace, clear it to stop. The button says how many are on, for example "2 of 3". "Back to the default" returns to every workspace except the home one.
28
36
  - **Your choice is saved** as the setting `ws.briefing.include` (a list of workspace ids) in this computer's state folder, so it stays when you reload or restart.
29
37
  - **A workspace that is not ticked is not read at all.** Its decisions, blocked work, merges and runs do not count in the hero, the list or the dock.
30
38
  - **Each row says which product it belongs to**, in a small tag before its line. Two products can hold an initiative or a kill condition of the same name. They stay separate rows, and a press is written into the journal of the product the row names.
@@ -68,12 +76,9 @@ Two reads feed the page. The quick read takes the kill conditions, the failed-re
68
76
 
69
77
  ## The header
70
78
 
71
- The pill at the top right says when the data was read and which source could not be read. A source that cannot be read adds nothing. The page does not guess.
72
-
73
- Two buttons sit beside the pill:
79
+ The Briefing's **Sources** dialog has two more parts under the tracked sources. **Products** is the product picker (see "Products"). **What the Briefing read** lists each source the page reads, with its state: **Read**, **Not read**, **Not included** or **Off**, and the reason. Examples: `planning/runs/agent-runs.jsonl` is missing in that repository; the product is not chosen under **Products**; the source is switched off under **Settings → Connectors**; the morning brief could not reach it. A source that cannot be read adds nothing. The page does not guess.
74
80
 
75
- - **Refresh** reads every included repository again now, without waiting for the 5-minute age. If a read is already running, Refresh does not start a second one. A read that failed is tried again at once. Mail, Jira and the calendar are read by skills, not by Refresh. To refresh them, use **Around you → Data freshness**.
76
- - **Sources** lists each source that the pill names, with its state: **Read**, **Not read**, **Not included** or **Off**. For each source, it also gives the reason. Examples: `planning/runs/agent-runs.jsonl` is missing in that repository; the product is not chosen under **Products**; the source is switched off under **Settings → Connectors**; the morning brief could not reach it.
81
+ On the Briefing, **Refresh all** also reads every included repository again now, without waiting for the 5-minute age. If a read is already running, it does not start a second one. A read that failed is tried again at once.
77
82
 
78
83
  ## The hero sentence
79
84
 
@@ -246,9 +251,9 @@ Board is the third place on the rail, at `/premium-board.html`. It reads what th
246
251
  - **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.
247
252
  - **Sprint** appears when an agent session has read Jira for the board. Otherwise it says there is none. **Coming up** shows the next release, from the releases ledger.
248
253
  - **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.
249
- - **The crumb** at the top names the board. With more than one board a menu switches between them, and the sparkle opens the board in the dialog with the read-only agent.
254
+ - **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.
250
255
  - **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. **Set it up** and **Open** go to the console. **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.
251
- - **Opening an initiative.** A click on an initiative opens its page (see "Initiative page"). The **Page / Popup** switch in the header changes that: Popup opens the initiative's dialog instead, which shows its record as a grid and the path of its file, with the read-only agent beside it. The choice is kept in this browser. The dialog holds no press.
256
+ - **Opening an initiative.** A click on an initiative opens its page (see "Initiative page"). **Open initiatives** (Page or Popup) in the ⋯ menu changes that: Popup opens the initiative's dialog instead, which shows its record as a grid and the path of its file, with the read-only agent beside it. The choice is kept in this browser. The dialog holds no press.
252
257
  - **New asks** sits at the top of the right column on a team board. Each ask shows where it came from and the drafted title, lane and anchor. **Accept** makes it an initiative in the first stage, through the console's accept route; **Decline** asks for a reason first. The card says when nothing is left to triage.
253
258
  - **New initiative** (beside the Initiatives heading, team boards only) asks for a title, a lane and an anchor (a KR or a health budget). It writes an ask and accepts it, as the console does. An unanchored initiative is refused on the page.
254
259
  - **⋯ on a row** (and the bar under an initiative page's heading) moves it to the next or another stage, puts it on hold with a reason and a check-back day, cancels it with a reason, or archives it. Each press writes one line through the console's route, says what it recorded, and offers Undo for a few seconds. An on-hold row offers Resume; a cancelled one offers Reopen; an archived one offers Restore. Cancelled and archived initiatives leave the list and sit under a fold below it. On the PMOS board the workflow engine places each initiative, so the moves are not offered and New asks and New initiative are hidden.
@@ -258,10 +263,10 @@ Not drawn, because PMOS holds no record for them: the mockup's demo measures (Ac
258
263
 
259
264
  ## Initiative page
260
265
 
261
- The initiative page is at `/premium-initiative.html?id=<initiative>`. A click on a Board initiative opens it. The crumb at the top leads back to the Board. Like the Board it reads the records of the production Initiatives sheet, and the first read takes a few seconds, because the routes derive every initiative. Until they have, the page says so and shows nothing.
266
+ The initiative page is at `/premium-initiative.html?id=<initiative>`. A click on a Board initiative opens it. The round back button at the top leads back to the Board. Like the Board it reads the records of the production Initiatives sheet, and the first read takes a few seconds, because the routes derive every initiative. Until they have, the page says so and shows nothing.
262
267
 
263
- - **The crumb** names the board and the initiative. Each has a menu: the boards, and the board's initiatives. The sparkle opens the initiative in the dialog with the read-only agent beside it.
264
- - **The data pill and the theme button** sit on a line under the crumb. Long file names in the evidence of a check wrap inside the card instead of running past its edge.
268
+ - **The top bar** has a back button to the board, then the initiative's name with a menu of the board's initiatives. **Chat** opens the initiative in the dialog with the read-only agent beside it.
269
+ - Long file names in the evidence of a check wrap inside the card instead of running past its edge.
265
270
  - **The header** shows a status chip, the owner and the planned finish. Each appears only when a record holds it. Under it, the stage strip shows how far through the board's workflow the initiative is.
266
271
  - **Overview** shows the description (the part of the record's title after " — "), then the next step with its reason, its action and what happens if you wait, as the workflow engine states them, and who it waits on. **PMOS can help** offers up to three presses that do something real: a draft of the first core document not started (the existing read-only run) and a question for the read-only agent. The health reasons and the board's warnings are shown as written.
267
272
  - **Overview** is one full-width card, as in the mockup; there is no separate Checks card. A blocked step shows as a note, and "All N workflow steps" lists every step of the engine with the evidence each states.
@@ -277,7 +282,7 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
277
282
 
278
283
  - **Charts.** One chart for each KR metric that holds at least two readings. The line runs through the readings at their dates, so a month with no reading is a gap and not a zero. The dashed line is the metric's target. The chip is the record's own line status: on its line, behind it, or well behind it. Pressing a chart, or its Details link, opens the metric's record in the dialog with the read-only agent beside it.
279
284
  - **Dashboards.** The switch lists All measures first, then your saved dashboards (the main one first, marked Main), then the pillars the metrics name. A saved dashboard draws its charts in the order you saved them. A chart whose record is gone, or that has fewer than two readings, is listed in its place with the reason and is not drawn.
280
- - **Open the Studio from the top.** The dark **Studio** pill beside the board name opens the Insight Studio: on the saved dashboard you are looking at, otherwise on a new dashboard, or in Report mode when no measure has a series yet.
285
+ - **Open the Studio from the top.** **Chat** beside the board name opens the Insight Studio: on the saved dashboard you are looking at, otherwise on a new dashboard, or in Report mode when no measure has a series yet.
281
286
  - **Make or edit a dashboard.** **New dashboard**, or **Edit** on a saved one, opens the **Insight Studio**, a wide dialog. On the right, the brief shows the Name, Purpose, Charts and Main dashboard; press a chip to change it. **Library** lists the board's measures and saved dashboards to add. The preview draws the dashboard as the page will, and lists a measure with no series as not drawn. The checks (a name, a purpose, a chart, six or fewer, no repeat, a main dashboard on the board) say what fails, with a one-press fix. On the left you can say it instead: "add Partner activation", "remove …", "move … first", "call it …", "it is for …", "make it the main dashboard", "undo" or "start a new one". A turn changes the draft only. **Undo** steps back one change. **Save the dashboard** records it; **Remove the dashboard** asks once more and then removes it. In a chart's dialog, **On your dashboards** has a switch for each saved dashboard, which adds the chart to it or takes it off.
282
287
  - **Make your own chart.** **New chart**, or **Edit** on one of your charts, opens the Insight Studio in **Chart** mode; the switch at the top moves between Chart and Dashboard, and each keeps its own draft. The brief shows the Question, Measure, Form (line, bars, number or meter), Range (all readings or the last few) and Target; **More** adds the Title, Better when, Note and Add to (a dashboard). The Studio suggests a form from the question and says why. The checks (a question, a target, enough readings, a form that fits the question, one scale) say what fails, with a one-press fix. You can say it instead: "show it as bars", "last 4 readings", "target 35", "lower is better", "call it …", "note: …", "add it to Weekly", or a question. A pie is declined, with the reason. **Save the chart** records it in the workspace's state folder, and adds it to the dashboard you named. Your charts are listed under **All measures**, and a dashboard can hold them beside the measures. **Remove the chart** asks once more; a dashboard that held it then says it was removed.
283
288
  - **Set up a report in the Studio.** **New report** on the Reports card opens the Insight Studio in **Report** mode. The brief shows the Title, What it answers, Audience, Format, Schedule, Draw from (your work, or the board's dashboard) and the Sections. A new report always has the same sections, in the same order, so they are listed, not edited. The checks (what it answers, an audience, a format that fits the audience, a new title, the answer first) say what fails, with a one-press fix. You can say it instead: "it answers: …", "for leadership", "slides", "monthly", "every two weeks on Thursday", "call it …". **Set it up** records the report and writes its first draft as a file.
@@ -308,7 +313,7 @@ Welcome is the premium first-run page, at `/premium-welcome.html`. It is a page
308
313
 
309
314
  ## The default page
310
315
 
311
- The premium Briefing is the default page: `/` and `/index.html` open it. The console is at `/console.html`, and the header button **Open the console** on each premium page goes there. The old address `/c3.html` goes to the premium Briefing; with a query (for example `/c3.html?tab=rep`) it goes to `/console.html` with the same query. `/classic.html` is unchanged. To go back, change the last page name in the page-route chain in `server.js` from `premium.html` to `c3.html` and delete the `/c3.html` redirect above it.
316
+ The premium Briefing is the default page: `/` and `/index.html` open it. The console is at `/console.html`, and **Console** in the ⋯ menu on each premium page goes there. The old address `/c3.html` goes to the premium Briefing; with a query (for example `/c3.html?tab=rep`) it goes to `/console.html` with the same query. `/classic.html` is unchanged. To go back, change the last page name in the page-route chain in `server.js` from `premium.html` to `c3.html` and delete the `/c3.html` redirect above it.
312
317
 
313
318
  ## The dialog on a phone and the document sheet's views
314
319
 
@@ -49,6 +49,11 @@ function threadOf(runtimeDir, key, now = Date.now()) {
49
49
  /** The row as the server's own model has it, plus the files an answer should start from. null when the key names no row on the page. */
50
50
  function rowFor(model, key) {
51
51
  if (!model || !KEY_RE.test(String(key || ''))) return null;
52
+ if (/^(src|work):this-page$/.test(key)) { // the top bar's Chat: the whole page is the context, its summary and its first rows
53
+ const rows = model.rows || (model.list && model.list.rows) || [];
54
+ const say = (model.hero || []).map((s) => (s.parts || []).map((p) => p.t).join('')).join(' ');
55
+ return { title: key === 'work:this-page' ? 'The My work page' : 'The Briefing page', subject: clip(model.header && model.header.text, 240), say: clip(say, 600), facts: rows.slice(0, 12).map((r) => clip(r.kind || r.list || 'item', 40) + ': ' + clip(r.title, 240)), files: [] };
56
+ }
52
57
  if (/^(work|board|init|doc|ins):/.test(key)) { // a My work item, a Board initiative, an Insights measure, an initiative page or one of its documents: the item's own record is the context
53
58
  const w = (model.rows || []).find((r) => r.key === key); if (!w) return null;
54
59
  const d = w.dialog || {};
@@ -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. When it is not known, the daily cap
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: 0..100 } | null. */
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
- D.append(file, { ev: 'run-end', run: runId, ok: false, reason: `the ${kind === 'work' ? 'work-unblock' : 'initiative-drive'} skill is not installed`, agent_run: agentRun(runId, group.target, false, now) }, { now });
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
- D.append(file, { ev: 'run-end', run: runId, ok: false, reason: (session && session.note) || 'the run could not start as a background run', agent_run: agentRun(runId, group.target, false, now) }, { now });
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
- function endRun(file, runId, target, r) {
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
- for (const r of state.runs.values()) {
158
- if (!r.end && !active.has(r.run)) D.append(file, { ev: 'run-end', run: r.run, ok: false, reason: 'interrupted: the workspace restarted', agent_run: agentRun(r.run, r.target, false, now) }, { now });
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 = [];
@@ -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 } agent_run is the run record the correction rate reads
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': {