create-pmos 0.275.0 → 0.277.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 (56) 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 +1 -1
  7. package/workspace/briefing-premium-calendar-3-test.js +18 -6
  8. package/workspace/briefing-premium-initiative-test.js +1 -1
  9. package/workspace/briefing-premium-insights-test.js +2 -2
  10. package/workspace/briefing-premium-test.js +3 -2
  11. package/workspace/briefing-premium-work-test.js +1 -1
  12. package/workspace/c3-briefing-test.js +2 -2
  13. package/workspace/c3-capture-test.js +3 -3
  14. package/workspace/c3-core-docs-test.js +1 -1
  15. package/workspace/c3-driver-test.js +6 -6
  16. package/workspace/c3-foundation-test.js +4 -4
  17. package/workspace/c3-ini-harness.js +2 -2
  18. package/workspace/c3-initiatives-test.js +1 -1
  19. package/workspace/c3-light-load-test.js +2 -2
  20. package/workspace/c3-one-home-test.js +2 -2
  21. package/workspace/c3-phone-test.js +12 -12
  22. package/workspace/c3-quiet-test.js +5 -5
  23. package/workspace/c3-report-design-real-test.js +2 -2
  24. package/workspace/c3-report-design-test.js +4 -4
  25. package/workspace/c3-report-setup-test.js +7 -7
  26. package/workspace/c3-report-structure-real-test.js +2 -2
  27. package/workspace/c3-report-structure-test.js +2 -2
  28. package/workspace/c3-reports-test.js +2 -2
  29. package/workspace/c3-scan-test.js +7 -7
  30. package/workspace/c3-sessions-panel-test.js +2 -2
  31. package/workspace/c3-settings-test.js +7 -7
  32. package/workspace/c3-updates-test.js +1 -1
  33. package/workspace/c3-work-test.js +2 -2
  34. package/workspace/extension/README.md +1 -1
  35. package/workspace/extension/panel.js +3 -3
  36. package/workspace/extension/popup.js +4 -4
  37. package/workspace/guide/briefing-premium.md +13 -0
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/premium-phone-card-test.js +178 -0
  41. package/workspace/public/pm/c3-audience-link.js +2 -2
  42. package/workspace/public/pm/c3-capture.js +2 -2
  43. package/workspace/public/pm/c3-focus.js +1 -1
  44. package/workspace/public/pm/premium-board.js +2 -2
  45. package/workspace/public/pm/premium-insights.js +1 -1
  46. package/workspace/public/pm/premium-report-read.js +1 -1
  47. package/workspace/public/pm/premium-shell.js +3 -3
  48. package/workspace/public/pm/premium.css +18 -0
  49. package/workspace/public/pm/premium.js +95 -1
  50. package/workspace/public/premium-board.html +1 -1
  51. package/workspace/public/premium-initiative.html +1 -1
  52. package/workspace/public/premium-insights.html +1 -1
  53. package/workspace/public/premium-work.html +1 -1
  54. package/workspace/public/premium.html +11 -2
  55. package/workspace/server.js +12 -4
  56. package/workspace/test-lists/premium-phone-card.json +9 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* c3-report-setup-test.js — the report workspace on console3, UI slice (initiative report-workspace; mockup 41-reportsetup).
4
- * DEMO mode: a real server and a real Chromium drive /c3.html?demo=1&tab=rep; c3-demo-rs.js answers the contract routes.
4
+ * DEMO mode: a real server and a real Chromium drive /console.html?demo=1&tab=rep; c3-demo-rs.js answers the contract routes.
5
5
  *
6
6
  * tab Ask PMOS, Found in your work (3), Set up (3), Documents (6); the Reports tab badge counts the drafts waiting
7
7
  * ask an ask runs, then answers from its own words (not a fixed report); Change revises it; Set up posts ONE setup with the ask and proposal
@@ -63,7 +63,7 @@ const TAB = '[data-rs-tab]';
63
63
  const sent = (p) => posts.filter((x) => x.path === p);
64
64
  const shot = async (pg, n) => { if (shots) await pg.screenshot({ path: path.join(shots, n + '.png'), fullPage: true }); };
65
65
  const text = (sel) => page.textContent(sel).catch(() => '');
66
- const goReports = async () => { await page.goto(BASE + '/c3.html?demo=1&tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-row]'); await spy(page); };
66
+ const goReports = async () => { await page.goto(BASE + '/console.html?demo=1&tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-row]'); await spy(page); };
67
67
 
68
68
  /* ── tab ── */
69
69
  await goReports();
@@ -153,18 +153,18 @@ const TAB = '[data-rs-tab]';
153
153
 
154
154
 
155
155
  /* ── briefing and settings ── */
156
- await page.goto(BASE + '/c3.html?demo=1');
156
+ await page.goto(BASE + '/console.html?demo=1');
157
157
  ok('the Briefing has a Report found card with Set up, See what PMOS found and Not a report', !!(await until(() => page.$('[data-rs-card] [data-rs-act="b-setup"]'), 12000)) && !!(await page.$('[data-rs-act="b-see"]')) && !!(await page.$('[data-rs-act="b-no"]')) && /Nothing is sent/.test(await text('[data-rs-card]')));
158
- await page.goto(BASE + '/c3.html?demo=1&tab=settings&section=connectors');
158
+ await page.goto(BASE + '/console.html?demo=1&tab=settings&section=connectors');
159
159
  ok('Settings, Connectors has the Report finder: Weekly or Off, and the sources', !!(await until(() => page.$('[data-rs-finder]'), 12000)) && !!(await spy(page).then(() => 1)) && /Weekly/.test(await text('[data-rs-finder]')) && /Calendar/.test(await text('[data-rs-finder]')));
160
160
  await page.click('[data-rs-finder] button:has-text("Off") >> nth=0');
161
161
  ok('Off posts the finder cadence', !!(await until(() => sent('/api/report-setups/finder').length >= 1)) && sent('/api/report-setups/finder')[0].body.cadence === 'off');
162
- await page.goto(BASE + '/c3.html?demo=1&tab=settings&section=sharing');
162
+ await page.goto(BASE + '/console.html?demo=1&tab=settings&section=sharing');
163
163
  await page.waitForSelector('[data-c3set-sched-link]');
164
164
  ok('Sharing links to Reports, Set up and no longer lists schedules', /Set up/.test(await text('[data-c3set-sched-link]')) && !/Scheduled shares/.test(await text('body')));
165
165
 
166
166
  /* ── old tab names ── */
167
- await page.goto(BASE + '/c3.html?demo=1&tab=rep'); await page.waitForSelector('[data-rp3]');
167
+ await page.goto(BASE + '/console.html?demo=1&tab=rep'); await page.waitForSelector('[data-rp3]');
168
168
  await page.evaluate(() => window.dispatchEvent(new CustomEvent('pmos:go-tab', { detail: { tab: 'rep', view: 'lib' } })));
169
169
  ok('view=lib lands on Charts', !!(await until(async () => await page.getAttribute('[data-rp3-tab="charts"]', 'aria-selected') === 'true')));
170
170
  await page.evaluate(() => window.dispatchEvent(new CustomEvent('pmos:go-tab', { detail: { tab: 'rep', view: 'drafts' } })));
@@ -174,7 +174,7 @@ const TAB = '[data-rs-tab]';
174
174
  const ph = await browser.newContext({ viewport: { width: 400, height: 860 }, hasTouch: true, isMobile: true });
175
175
  const pp = await ph.newPage(); watch(pp);
176
176
  const noScroll = () => pp.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1);
177
- await pp.goto(BASE + '/c3.html?demo=1&tab=rep'); await pp.waitForSelector('[data-rp3]'); await pp.click('[data-rp3-tab="reports"]'); await pp.waitForSelector('[data-rs-row]');
177
+ await pp.goto(BASE + '/console.html?demo=1&tab=rep'); await pp.waitForSelector('[data-rp3]'); await pp.click('[data-rp3-tab="reports"]'); await pp.waitForSelector('[data-rs-row]');
178
178
  ok('400px: the Reports tab has no horizontal scroll', await noScroll());
179
179
  await shot(pp, 'reports-400');
180
180
  await pp.click('[data-rs-row="rs1"] [data-rs-act="open"], [data-rs-row="rs1"] .tt');
@@ -3,7 +3,7 @@
3
3
  /* c3-report-structure-real-test.js — the Structure step of the report studio against the REAL backend (initiative report-structure, PRD done-criterion 10).
4
4
  * Not demo mode and no route interception: a real server on a scratch repository, with a stub `claude` that plays the report-structure and
5
5
  * report-structure-dry jobs (as report-structure-server.test.js does) and a stub for the source check (PMOS_REPORT_CHECK_STUB), and a real
6
- * Chromium on /c3.html. It proves the page and the server agree on the API contract end to end.
6
+ * Chromium on /console.html. It proves the page and the server agree on the API contract end to end.
7
7
  *
8
8
  * setup a work-sourced report set up through the API
9
9
  * turn the Structure step opens from the set-up row (Shape the report); a purpose and one turn land S1 with sources, charts and outline;
@@ -133,7 +133,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
133
133
  const text = (sel) => page.textContent(sel).catch(() => '');
134
134
  const idle = () => page.waitForFunction(() => { const b = document.querySelector('[data-st-act="send"]'); return b && !b.disabled && !document.querySelector('[data-st-running]'); }, null, { timeout: 20000 });
135
135
  const verOn = async (n) => await page.getAttribute('[data-st-v="' + n + '"]', 'aria-pressed') === 'true';
136
- const goReports = async () => { await page.goto(BASE + '/c3.html?tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-reg="' + id + '"]', { timeout: 15000 }); };
136
+ const goReports = async () => { await page.goto(BASE + '/console.html?tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-reg="' + id + '"]', { timeout: 15000 }); };
137
137
 
138
138
  /* ── the Structure step from the set-up row ── */
139
139
  await goReports();
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* c3-report-structure-test.js — the Structure step of the report studio, UI slice (initiative report-structure; mockup 43-reportstructure;
4
- * API contract planning/prd/report-structure-contract.md). A real server and a real Chromium drive /c3.html?tab=rep; the routes of the
4
+ * API contract planning/prd/report-structure-contract.md). A real server and a real Chromium drive /console.html?tab=rep; the routes of the
5
5
  * contract (/api/report-structure*, /api/charts) and the report reads are answered by Playwright route interception, so the page is
6
6
  * tested against the contract alone, not against the backend (c3-report-structure-real-test.js does that).
7
7
  *
@@ -152,7 +152,7 @@ function makeStub() {
152
152
  const text = (sel) => page.textContent(sel).catch(() => '');
153
153
  const sent = (p) => S.posts.filter((x) => x.path === p);
154
154
  const closeAll = async () => { for (let i = 0; i < 3 && await page.$('.sheet'); i++) { await page.keyboard.press('Escape'); await sleep(250); } };
155
- const goReports = async () => { await page.goto(BASE + '/c3.html?tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-reg="' + SETUP.id + '"]', { timeout: 15000 }); };
155
+ const goReports = async () => { await page.goto(BASE + '/console.html?tab=rep'); await page.waitForSelector('[data-rp3]'); await page.click('[data-rp3-tab="reports"]'); await page.waitForSelector('[data-rs-reg="' + SETUP.id + '"]', { timeout: 15000 }); };
156
156
  const idle = () => page.waitForFunction(() => { const b = document.querySelector('[data-st-act="send"]'); return b && !b.disabled && !document.querySelector('[data-st-running]'); }, null, { timeout: 15000 });
157
157
  const noOverflow = () => page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1);
158
158
 
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  /* c3-reports-test.js — the console3 Reports dashboards in a browser, demo mode (initiative console3-reports, PRD R1 to R7).
4
4
  *
5
- * WHERE. The suite first loads /c3.html?demo=1&tab=rep. When the shell mounts the dashboards there ([data-rp3] in the Reports pane),
5
+ * WHERE. The suite first loads /console.html?demo=1&tab=rep. When the shell mounts the dashboards there ([data-rp3] in the Reports pane),
6
6
  * it runs against the shell. Until c3-shell.js has the mount line, it serves a small harness page from this process (page.route, no
7
7
  * file in public/) that installs demo mode and mounts mountReports with the same ctx the shell passes ({ ws, pmGet, drafts }, drafts
8
8
  * doing what repTab does). The suite prints which one it used.
@@ -83,7 +83,7 @@ const DEF_P = ['north', 'outcomes', 'signals', 'delivery', 'bets', 'synergy', 'm
83
83
  const open = async (page) => {
84
84
  await page.route(BASE + HARNESS, (r) => r.fulfill({ status: 200, contentType: 'text/html', body: HARNESS_HTML }));
85
85
  if (mode !== 'harness') {
86
- await page.goto(BASE + '/c3.html?demo=1&tab=rep');
86
+ await page.goto(BASE + '/console.html?demo=1&tab=rep');
87
87
  const inShell = await until(() => page.$('[data-c3-pane="rep"] [data-rp3]'), mode === 'shell' ? 15000 : 4000);
88
88
  if (inShell) { mode = 'shell'; return true; }
89
89
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* c3-scan-test.js — the portfolio Horizon scan on console3 (initiative horizon-scan-portfolio; PRD sections 1 to 4 and 7; the approved mockup 42-hscan).
4
- * LIVE mode: a real server and a scratch repository (c3-scan-fixture.js) and a real Chromium driving /c3.html. The first part routes the page's
4
+ * LIVE mode: a real server and a scratch repository (c3-scan-fixture.js) and a real Chromium driving /console.html. The first part routes the page's
5
5
  * /api/scan/* calls to a model that answers with the REAL view functions and presses of lib/scan.js and lib/routes-scan.js over a ledger of its own
6
6
  * (portfolioStub), so a test can move a scan one step at a time. The last part (E) is end to end: no routing at all, the server's own scan routes over a
7
7
  * seeded state folder, the runner stubbed, a real initiative created. The report documents are real markdown files read through GET /api/doc.
@@ -66,7 +66,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
66
66
  const noScroll = () => st(() => document.documentElement.scrollWidth <= window.innerWidth + 1 && [...document.querySelectorAll('.sheet .sb')].every((n) => n.scrollWidth <= n.clientWidth + 1));
67
67
  const text = (s) => st((q) => { const n = document.querySelector(q); return n ? n.textContent : ''; }, s);
68
68
  const toastText = () => st(() => (document.querySelector('[data-c3-toast]') || {}).textContent || '');
69
- const portfolio = async () => { await page.goto(BASE + '/c3.html?tab=init', { waitUntil: 'load' }); await sel('[data-scan-section="portfolio"] [data-scan-act=scan]'); };
69
+ const portfolio = async () => { await page.goto(BASE + '/console.html?tab=init', { waitUntil: 'load' }); await sel('[data-scan-section="portfolio"] [data-scan-act=scan]'); };
70
70
 
71
71
  /* ── pure parts, read in the page ── */
72
72
  await portfolio();
@@ -347,7 +347,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
347
347
  await page.keyboard.press('Escape');
348
348
 
349
349
  /* ── Briefing ── */
350
- await page.goto(BASE + '/c3.html?tab=brief', { waitUntil: 'load' });
350
+ await page.goto(BASE + '/console.html?tab=brief', { waitUntil: 'load' });
351
351
  await sel('[data-c3pg="scan"] [data-scan-report]');
352
352
  const card = await text('[data-c3pg="scan"]');
353
353
  ok('B1 the Briefing has a Horizon scan card: when it ran, the boards scanned, the reports of the day', /Horizon scan/.test(card) && /today, \d\d:\d\d/.test(card) && /1 board scanned/.test(card) && /4 reports today/.test(card), card);
@@ -363,7 +363,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
363
363
  await page.keyboard.press('Escape');
364
364
 
365
365
  /* ── Board settings ── */
366
- await page.goto(BASE + `/c3.html?tab=init&init=board:${ws}:summary`, { waitUntil: 'load' });
366
+ await page.goto(BASE + `/console.html?tab=init&init=board:${ws}:summary`, { waitUntil: 'load' });
367
367
  await (await sel('[data-ini=board-settings]')).click();
368
368
  await sel('[data-scan-ptr]');
369
369
  const ptr = await text('[data-scan-ptr]');
@@ -380,7 +380,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
380
380
 
381
381
  /* ── triage: an ask an earlier per-board scan found ── */
382
382
  const seed = fx.seedScan();
383
- await page.goto(BASE + `/c3.html?tab=init&init=board:${ws}:triage`, { waitUntil: 'load' });
383
+ await page.goto(BASE + `/console.html?tab=init&init=board:${ws}:triage`, { waitUntil: 'load' });
384
384
  await sel(`[data-ibt-ask="${seed.asks[0]}"]`);
385
385
  const row = (i) => st((id) => { const r = document.querySelector(`[data-ibt-ask="${id}"]`); return { text: r.textContent, agent: !!r.querySelector('[data-scan="found-by-agent"]'), links: [...r.querySelectorAll('a[data-scan-src=web]')].map((a) => ({ target: a.target, rel: a.rel })), accept: !!r.querySelector('[data-ibt-accept]'), more: !!r.querySelector('[data-ibt-more]'), decline: !!r.querySelector('[data-ibt-decline]') }; }, seed.asks[i]);
386
386
  const r0 = await row(0); const r2 = await row(2);
@@ -406,7 +406,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
406
406
  await page.click(`[data-scan-act=change][data-id=${CP1}]`); await sleep(300);
407
407
  ok('M5 at 400 wide the Change first form has no horizontal scroll', await noScroll());
408
408
  await page.keyboard.press('Escape');
409
- await page.goto(BASE + '/c3.html?tab=brief', { waitUntil: 'load' });
409
+ await page.goto(BASE + '/console.html?tab=brief', { waitUntil: 'load' });
410
410
  await sel('[data-c3pg="scan"] [data-scan-report]'); await sleep(300);
411
411
  await shot('briefing-400');
412
412
  ok('M6 at 400 wide the Briefing has no horizontal scroll', await noScroll());
@@ -443,7 +443,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
443
443
  const eToast = () => page2.evaluate(() => (document.querySelector('[data-c3-toast]') || {}).textContent || '');
444
444
  const eRb = E.reports.find((r) => r.type === 'benchmark'); const eRc = E.reports.find((r) => r.type === 'competitive');
445
445
  const eProp = (rep, kind) => [...eState().proposals.values()].find((p) => p.report === rep.id && p.kind === kind);
446
- await page2.goto(eBase + '/c3.html?tab=init', { waitUntil: 'load' });
446
+ await page2.goto(eBase + '/console.html?tab=init', { waitUntil: 'load' });
447
447
  await eSel('[data-scan-section="portfolio"] [data-scan-act=scan]');
448
448
  await eSel('[data-scan-section] [data-scan-report]');
449
449
  const eSec = await eText('[data-scan-section="portfolio"]');
@@ -5,7 +5,7 @@
5
5
  * Starts a real server with its own state directory. Before it starts, a session record is written whose process does not exist and
6
6
  * whose file still says it runs: the server restores it as exited, and GET /api/runs must say it ended (it read "starting · 4 d" before).
7
7
  * Then one live shell is started, and the page checks: the live row reads the server's state, not "starting"; Open the session draws the
8
- * session's real terminal in a sheet on /c3.html and the address does not change; the message box types into the session and presses Enter;
8
+ * session's real terminal in a sheet on /console.html and the address does not change; the message box types into the session and presses Enter;
9
9
  * End asks first, Keep it keeps it, End ends it.
10
10
  */
11
11
  const fs = require('fs');
@@ -101,7 +101,7 @@ function startShell(name) {
101
101
  page.on('pageerror', (e) => errors.push(String(e && e.message || e)));
102
102
 
103
103
  /* ── B: the panel ── */
104
- await page.goto(BASE + '/c3.html');
104
+ await page.goto(BASE + '/console.html');
105
105
  ok('B1 the header has the Sessions button', await waitFor(page, () => !!document.querySelector('[data-c3pg="agent-button"]'), null, 45000));
106
106
  await page.click('[data-c3pg="agent-button"]');
107
107
  const sel = `[data-c3t="mine"] [data-run="${id}"]`;
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
  /* c3-settings-test.js — the console3 Settings page (initiative console3-settings).
4
4
  *
5
- * Loads /c3.html against a real server with its own state directory and checks: the gear, the More menu item and
5
+ * Loads /console.html against a real server with its own state directory and checks: the gear, the More menu item and
6
6
  * ?tab=settings open Settings; every section draws; search finds a setting across sections; a change to a store setting
7
7
  * is saved through POST /api/settings and read back; the theme switch sets the page theme; the start page and the
8
8
  * time-of-day switches take effect on the next load; Set up Laya opens its terminal; and the page throws no error.
@@ -49,7 +49,7 @@ async function waitFor(page, fn, arg, ms = 8000) {
49
49
  page.on('dialog', (d) => d.dismiss().catch(() => {}));
50
50
 
51
51
  /* ── A: the ways in ── */
52
- await page.goto(BASE + '/c3.html');
52
+ await page.goto(BASE + '/console.html');
53
53
  ok('A1 the header has a Settings gear', await waitFor(page, () => !!document.querySelector('[data-c3pg="settings"]')));
54
54
  await page.click('[data-c3pg="settings"]');
55
55
  ok('A2 the gear opens Settings', await waitFor(page, () => { const p = document.querySelector('[data-c3-pane="settings"]'); return p && !p.hidden && !!p.querySelector('[data-c3set]'); }));
@@ -113,7 +113,7 @@ async function waitFor(page, fn, arg, ms = 8000) {
113
113
 
114
114
 
115
115
  /* ── R: Data refresh (data-refresh-settings R9) ── */
116
- await page.goto(BASE + '/c3.html?tab=settings');
116
+ await page.goto(BASE + '/console.html?tab=settings');
117
117
  await waitFor(page, () => !!document.querySelector('[data-c3set-nav] [data-c3set-sec="connectors"]'));
118
118
  await page.click('[data-c3set-nav] [data-c3set-sec="connectors"]');
119
119
  ok('R1 Connectors links to Data refresh instead of holding its schedule', await waitFor(page, () => { const a = document.querySelector('[data-c3set-row="conn.cal.refresh"]'); const b = document.querySelector('[data-c3set-row="conn.jira.refresh"]'); return !!a && !!b && !!a.querySelector('button.lk') && /Data refresh/.test(a.textContent) && !a.querySelector('select') && !b.querySelector('select'); }));
@@ -173,16 +173,16 @@ async function waitFor(page, fn, arg, ms = 8000) {
173
173
  const post = (key, value) => page.evaluate(async ([k, v]) => { const { pmPost } = await import('/pm/http.js'); return pmPost('/api/settings', { key: k, value: v }); }, [key, value]);
174
174
  const f0 = [await post('look.start', 'cal'), await post('time.tint', false), await post('time.strip', false)];
175
175
  ok('F0 the start page and switches save', f0.every((r) => r && r.ok), JSON.stringify(f0));
176
- await page.goto(BASE + '/c3.html');
176
+ await page.goto(BASE + '/console.html');
177
177
  ok('F1 the saved start page opens', await waitFor(page, () => { const p = document.querySelector('[data-c3-pane="cal"]'); return p && !p.hidden; }));
178
178
  ok('F2 the tint switch reaches the page', await waitFor(page, () => document.getElementById('c3-root').getAttribute('data-c3-tint') === 'off'));
179
179
  ok('F3 the daylight strip is hidden', await waitFor(page, () => { const s = document.querySelector('.c3pg-daylight'); return !s || getComputedStyle(s).display === 'none'; })); // the stylesheet loads after the attribute is set
180
- await page.goto(BASE + '/c3.html?tab=settings');
180
+ await page.goto(BASE + '/console.html?tab=settings');
181
181
  ok('F4 ?tab=settings opens Settings directly', await waitFor(page, () => { const p = document.querySelector('[data-c3-pane="settings"]'); return p && !p.hidden && !!p.querySelector('[data-c3set]'); }));
182
182
  await post('look.start', 'brief'); await post('time.tint', true); await post('time.strip', true);
183
183
 
184
184
  /* ── G: the palette ── */
185
- await page.goto(BASE + '/c3.html');
185
+ await page.goto(BASE + '/console.html');
186
186
  await waitFor(page, () => !!document.querySelector('[data-c3pg="search"]'));
187
187
  await page.click('[data-c3pg="search"]');
188
188
  await sleep(200);
@@ -190,7 +190,7 @@ async function waitFor(page, fn, arg, ms = 8000) {
190
190
  ok('G1 the palette lists Settings', await waitFor(page, () => [...document.querySelectorAll('[role="option"], .pal li, .pal button, [data-pal-item]')].some((x) => /Settings/.test(x.textContent)), null, 3000));
191
191
 
192
192
  /* ── I: Set up Laya opens its terminal on the page, not only on the server (jev-local-fallback R9) ── */
193
- await page.goto(BASE + '/c3.html?tab=settings');
193
+ await page.goto(BASE + '/console.html?tab=settings');
194
194
  await waitFor(page, () => !!document.querySelector('[data-c3set-nav] [data-c3set-sec="privacy"]'));
195
195
  await page.click('[data-c3set-nav] [data-c3set-sec="privacy"]');
196
196
  ok('I1 Privacy shows the Set up Laya button', await waitFor(page, () => !!document.querySelector('[data-c3set-laya-setup]')));
@@ -74,7 +74,7 @@ async function waitFor(page, fn, arg, ms = 8000) {
74
74
  const named = (kind) => calls.filter((c) => c[0] === kind);
75
75
 
76
76
  const open = async () => {
77
- await page.goto(BASE + '/c3.html?tab=settings');
77
+ await page.goto(BASE + '/console.html?tab=settings');
78
78
  await waitFor(page, () => !!document.querySelector('[data-c3set-nav] [data-c3set-sec="updates"]'));
79
79
  await page.click('[data-c3set-nav] [data-c3set-sec="updates"]');
80
80
  return waitFor(page, () => !!document.querySelector('[data-c3set-section="updates"] [data-c3set-check]:not([disabled])'));
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
  /* c3-work-test.js — the console3 Work page (initiative console3-work-page; planning/prd/console3-work-page-prd.md R1 to R10, rubric
4
- * dimensions 1 to 5 and 7). Loads /c3.html?demo=1 at 1440 wide and then at 390 wide. Demo mode answers every /api call in the page,
4
+ * dimensions 1 to 5 and 7). Loads /console.html?demo=1 at 1440 wide and then at 390 wide. Demo mode answers every /api call in the page,
5
5
  * so nothing reaches the server and the fixture (public/pm/c3-demo-data.js pmItems) is placed by the same rule the server uses.
6
6
  *
7
7
  * views seven views in order (Inbox, Today, Upcoming, Waiting, Someday, Review, Done), each with its count; no Triage, Week, Later
@@ -81,7 +81,7 @@ const W = '[data-pm-work]';
81
81
  };
82
82
  const toastUndo = () => until(() => click('[data-c3-toast-action]'), 4000);
83
83
 
84
- await page.goto(BASE + '/c3.html?demo=1&tab=work');
84
+ await page.goto(BASE + '/console.html?demo=1&tab=work');
85
85
  const up = await until(() => st((w) => !!document.querySelector('[data-c3-demo="1"]') && !!document.querySelector(w + ' [data-pm-lenses]') && !!document.querySelector(w + ' [data-pm-lens-head]'), W), 45000, 250);
86
86
  if (!up) { await click('[data-c3-tab="work"]'); }
87
87
  const ready = up || await until(() => st((w) => !!document.querySelector(w + ' [data-pm-lens-head]'), W), 20000, 250);
@@ -31,7 +31,7 @@ Open any page in Chrome and press the PMOS button in the toolbar. The popup is "
31
31
  - A sample is at most 20 MB. When it is over, the popup says so. Open a shorter page, or add a smaller copy.
32
32
  - When PMOS does not answer, the popup says "PMOS is not answering at <address>. Start PMOS, then try again." and has **Try again**.
33
33
 
34
- How the data reaches PMOS: the extension never writes to PMOS itself. The popup shows a page from your PMOS (`/c3.html?capture=1&pop=1`) in a frame. That page has the report list and the Add button. When you press Add, it asks the popup to take the page. The popup sends the PDF or the pictures back to that page, and that page saves them with its own press, as every other change in PMOS is saved. Each message is checked for its sender and its origin on both sides.
34
+ How the data reaches PMOS: the extension never writes to PMOS itself. The popup shows a page from your PMOS (`/console.html?capture=1&pop=1`) in a frame. That page has the report list and the Add button. When you press Add, it asks the popup to take the page. The popup sends the PDF or the pictures back to that page, and that page saves them with its own press, as every other change in PMOS is saved. Each message is checked for its sender and its origin on both sides.
35
35
 
36
36
  ## Files
37
37
 
@@ -1,6 +1,6 @@
1
1
  /* panel.js — the page the content script frames over a Meet call (panel.html).
2
2
  * It reads the PMOS address from chrome.storage.sync (pmosAddress, default http://localhost:7433) and asks whether anything answers there.
3
- * When PMOS answers, the page becomes one frame: ${address}/c3.html?focus=now&pop=1&meet=…&mtitle=… (PMOS's compact meeting focus). When it does not,
3
+ * When PMOS answers, the page becomes one frame: ${address}/console.html?focus=now&pop=1&meet=…&mtitle=… (PMOS's compact meeting focus). When it does not,
4
4
  * the page says where it looked and links to the options. Nothing else is fetched. The frame's { pmosFocus } message (fold or open, no data) is passed
5
5
  * up to the content script. */
6
6
  (function () {
@@ -28,7 +28,7 @@
28
28
  function answers(addr) {
29
29
  var ctl = typeof AbortController === 'function' ? new AbortController() : null;
30
30
  var t = ctl ? setTimeout(function () { ctl.abort(); }, CHECK_MS) : null;
31
- return fetch(addr + '/c3.html', { mode: 'no-cors', cache: 'no-store', signal: ctl ? ctl.signal : undefined })
31
+ return fetch(addr + '/console.html', { mode: 'no-cors', cache: 'no-store', signal: ctl ? ctl.signal : undefined })
32
32
  .then(function (r) { if (t) clearTimeout(t); return r; }, function (e) { if (t) clearTimeout(t); throw e; });
33
33
  }
34
34
  function showMissing(addr) {
@@ -46,7 +46,7 @@
46
46
  var q = new URLSearchParams({ focus: 'now', pop: '1', meet: meet, mtitle: title });
47
47
  frame = document.createElement('iframe');
48
48
  frame.title = 'PMOS meeting helper';
49
- frame.src = addr + '/c3.html?' + q.toString();
49
+ frame.src = addr + '/console.html?' + q.toString();
50
50
  frameOrigin = new URL(addr).origin;
51
51
  msg.remove();
52
52
  document.body.appendChild(frame);
@@ -1,5 +1,5 @@
1
1
  /* popup.js — the PMOS button's popup (popup.html): "Add this page to a report design".
2
- * PMOS draws the popup: the page is one frame, ${address}/c3.html?capture=1&pop=1&…, which lists the reports and has the Add button. The extension never posts to PMOS
2
+ * PMOS draws the popup: the page is one frame, ${address}/console.html?capture=1&pop=1&…, which lists the reports and has the Add button. The extension never posts to PMOS
3
3
  * itself, because every PMOS write needs a press on a PMOS page (a nonce and an Origin check). So when the frame asks (postMessage { pmosCapture: 'request' }), this
4
4
  * page takes the open tab and posts it back to the frame ({ pmosCapture: 'data', … }), and the frame uploads it with its own press. Both ways, the message must
5
5
  * come from the other window and from the PMOS origin; the extension posts to the PMOS origin only.
@@ -34,7 +34,7 @@
34
34
  function answers(addr) {
35
35
  var ctl = typeof AbortController === 'function' ? new AbortController() : null;
36
36
  var t = ctl ? setTimeout(function () { ctl.abort(); }, CHECK_MS) : null;
37
- return fetch(addr + '/c3.html', { mode: 'no-cors', cache: 'no-store', signal: ctl ? ctl.signal : undefined })
37
+ return fetch(addr + '/console.html', { mode: 'no-cors', cache: 'no-store', signal: ctl ? ctl.signal : undefined })
38
38
  .then(function (r) { if (t) clearTimeout(t); return r; }, function (e) { if (t) clearTimeout(t); throw e; });
39
39
  }
40
40
  var sleep = function (ms) { return new Promise(function (r) { setTimeout(r, ms); }); };
@@ -78,7 +78,7 @@
78
78
  if (screens) q.set('pscreens', String(screens));
79
79
  frame = document.createElement('iframe');
80
80
  frame.title = 'PMOS: add this page to a report design';
81
- frame.src = addr + '/c3.html?' + q.toString();
81
+ frame.src = addr + '/console.html?' + q.toString();
82
82
  frameOrigin = new URL(addr).origin;
83
83
  if (msg.parentNode) msg.remove();
84
84
  document.body.appendChild(frame);
@@ -169,7 +169,7 @@
169
169
  if (m.pmosCapture === 'resize') { if (frame) frame.style.height = m.height + 'px'; return; }
170
170
  if (m.pmosCapture === 'close') { window.close(); return; }
171
171
  if (m.pmosCapture === 'open') {
172
- try { chrome.tabs.create({ url: frameOrigin + '/c3.html?studio=' + encodeURIComponent(m.report) }); } catch (x) { /* no tabs */ }
172
+ try { chrome.tabs.create({ url: frameOrigin + '/console.html?studio=' + encodeURIComponent(m.report) }); } catch (x) { /* no tabs */ }
173
173
  window.close();
174
174
  return;
175
175
  }
@@ -118,6 +118,14 @@ Under Today, the **Around you** card holds what the agents and the outside world
118
118
 
119
119
  With one product picked, the dialogs show its data. With several, each product's part has its own heading, and the counts are not added across products. The agent mode, the scan's watch list and setting and the report documents stay in the console.
120
120
 
121
+ ## The phone card
122
+
123
+ On a phone (640 pixels wide or narrower) the Briefing opens with one card above "What you need to do". It says what the day is doing now, and it changes with the clock. It has eight moments: a meeting under way, a meeting about to start, a meeting that just ended, a free stretch, the morning, working hours, the evening recap and the night. The card is chosen again every minute and when you return to the page. On a wider screen the card does not show, and the page does not read the day for it.
124
+
125
+ - **Open the meeting** opens the same dialog as a row in Today. If the calendar PMOS holds does not list the meeting, the card says so and opens nothing.
126
+ - **Done** marks one of your own items as done, and shows **Undo** on the same line. A refused press shows the reason. The card never says "Done" when the record was not written.
127
+ - The card does not ask to record a meeting, and it does not say that notes exist unless the meeting holds them. If a read fails, the card names it.
128
+
121
129
  ## The dock
122
130
 
123
131
  When you scroll past the hero, the hero folds into a bar at the top. The bar shows how many rows need you and the next item in Today.
@@ -145,6 +153,7 @@ Each button writes one record, through a check that only a real press from this
145
153
  | Make it a task, Mark read, Mark unread (a mention) | One Work item, or a read mark | the Work list, `mentions/read.jsonl` |
146
154
  | Approve, Dismiss, Undo, Scan now, Stop (the horizon scan) | The scan's own records | `scan.jsonl` in the state folder |
147
155
  | Refresh, Refresh all (data freshness) | A new read of the source | the source's own store |
156
+ | Done, Undo (the phone card) | The item is marked done, or reopened | the Work list |
148
157
  | Not yet: Later today, Tomorrow, Next week | A put-off record. The row leaves the list until then and the page names it. It does not count as done. | `briefing-premium-deferred.jsonl` in the state folder |
149
158
 
150
159
  Later today means three hours from now. Tomorrow and Next week mean 09:00, tomorrow and next Monday.
@@ -231,3 +240,7 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
231
240
  - **Shape a report's look.** On a draft, **Add a sample** takes a PDF, PowerPoint, Word, PNG or JPG file to follow. Say how it should look in the conversation; PMOS draws the next design version (D1, D2, …) and says what it changed. Press a version to go back to it. **This is it** saves the version shown as the report's design, and PMOS draws the cycle to match. An issued cycle is frozen with its look.
232
241
 
233
242
  Not built: a second measure next to a chart, bar highlights, speaker notes and notes on a slide, changing a set-up report's audience, format or schedule, tile sizes and free layout, the finder's settings, run-based charts such as corrections per 100 runs (they belong to the Board's Metrics card), and any measure no record holds. The console's own dashboards are separate and unchanged. KR metric records belong to a workspace, so every board of a workspace shows the same charts.
243
+
244
+ ## The default page
245
+
246
+ 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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.275.0",
3
+ "version": "0.277.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.275.0",
9
+ "version": "0.277.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.275.0",
3
+ "version": "0.277.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-phone-card-test.js — the phone moment card on the premium Briefing (initiative premium-phone-card;
4
+ * planning/prd/premium-phone-card-prd.md R1 to R5). A real server on a scratch repository (c3-scan-fixture.js). The real page runs at 390 wide
5
+ * with the clock set to each moment of the day; /api/brief-page, /api/phone-day and the week of the calendar are answered in the browser,
6
+ * because they need a clock and a day of meetings. Done and Reopen press the real routes on real items.
7
+ * M the eight moments · O Open the meeting · D Done and Undo · X a refused press · E a read that fails · W desktop width and the POST allow-list · L floors
8
+ * Set PHONE_CARD_SHOTS=<dir> to save screenshots of each moment at 390 wide, light and dark. */
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const { findBrowser } = require('./lib/find-browser');
12
+ require('./test-run').configure({ name: 'premium-phone-card' });
13
+ const Fx = require('./c3-scan-fixture.js');
14
+
15
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
+ const until = async (fn, ms = 15000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
17
+ const results = [];
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
19
+ let F = null, browser = null;
20
+ const finish = async (code) => {
21
+ if (browser) await browser.close().catch(() => {});
22
+ if (F) F.stop();
23
+ const bad = results.filter((x) => !x.cond).length;
24
+ console.log(`\n${results.length - bad}/${results.length} premium-phone-card assertions passed`);
25
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
26
+ };
27
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
28
+
29
+ const pad = (n) => String(n).padStart(2, '0');
30
+ const base = new Date(); base.setHours(0, 0, 0, 0);
31
+ const DATE = `${base.getFullYear()}-${pad(base.getMonth() + 1)}-${pad(base.getDate())}`;
32
+ const at = (h, m = 0, d = 0) => new Date(base.getFullYear(), base.getMonth(), base.getDate() + d, h, m, 0, 0);
33
+ const MT = (id, title, h1, m1, h2, m2, people = ['Dana Hartono', 'Priya Sen']) => ({ id, title, start: at(h1, m1).toISOString(), end: at(h2, m2).toISOString(), minutes: (h2 * 60 + m2) - (h1 * 60 + m1), people, initiative: 'Partner API onboarding', prepared: [{ kind: 'note', text: 'Last time you agreed to share the sandbox dates.' }], before: [], state: 'upcoming' });
34
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
35
+
36
+ (async () => {
37
+ const exe = findBrowser();
38
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
39
+ let chromium;
40
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
41
+ F = await Fx.start({ name: 'premium-phone-card' });
42
+ const ws = F.ws;
43
+ const i1 = (await F.post('/api/pm-items/add', { line: 'Send the partner onboarding list to Lina' })).body.item;
44
+ const i2 = (await F.post('/api/pm-items/add', { line: 'Confirm the rate-limit quota' })).body.item;
45
+ browser = await chromium.launch({ executablePath: exe, headless: true, args: ['--no-sandbox'] });
46
+
47
+ const shotDir = process.env.PHONE_CARD_SHOTS;
48
+ /* one page per scene: a clock, a day of meetings and a list of the PM's own items */
49
+ async function scene({ time, today = [], needs = [], width = 390, scheme = 'light', pageFail = false, dayFail = false, week = null, name }) {
50
+ const ctx = await browser.newContext({ viewport: { width, height: 844 }, colorScheme: scheme });
51
+ const p = await ctx.newPage(), posts = [], gets = [], errs = [];
52
+ p.on('pageerror', (e) => errs.push(String(e)));
53
+ p.on('request', (r) => { const u = new URL(r.url()); if (r.method() === 'POST') posts.push({ path: u.pathname, body: (() => { try { return JSON.parse(r.postData() || 'null'); } catch { return null; } })() }); else if (u.pathname.startsWith('/api/')) gets.push(u.pathname); });
54
+ await p.clock.install({ time });
55
+ await p.route('**/api/brief-page*', (r) => (pageFail ? json(r, { ok: false, error: 'the brief could not be read' }, 500) : json(r, { ok: true, date: DATE, today, needs, mentions: [] })));
56
+ await p.route('**/api/phone-day*', (r) => (dayFail ? json(r, { ok: false, error: 'the day could not be read' }, 500) : json(r, { ok: true, finished: [{ id: 'f1', title: 'Draft of the sandbox note', summary: 'Two paragraphs, ready for you to read.', status: 'review' }], recap: { meetings: 2, decided: 1, done: 3, finished: 1, moved: [{ kind: 'done', text: 'Sandbox dates agreed', sub: 'Partner API onboarding' }] }, tomorrow: { label: 'Tuesday', meetings: [{ id: 'm9', title: 'Quota review', start: at(10, 0, 1).toISOString(), people: ['Priya Sen'] }] } })));
57
+ await p.route('**/api/calendar-views*', (r) => {
58
+ const u = new URL(r.request().url());
59
+ if (u.searchParams.get('view') === 'week' && week) return json(r, week);
60
+ return json(r, { ok: true, view: u.searchParams.get('view') || 'quarter', cells: [], gantt: [], no_plan: 0, strategy: [], today: DATE });
61
+ });
62
+ await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
63
+ p.__posts = posts; p.__gets = gets; p.__errs = errs; p.__ctx = ctx;
64
+ if (shotDir && name) p.__shot = async (suffix) => { await sleep(700); fs.mkdirSync(shotDir, { recursive: true }); await p.screenshot({ path: path.join(shotDir, `${name}-${suffix}.png`) }); };
65
+ return p;
66
+ }
67
+ const card = (p) => p.evaluate(() => { const c = document.querySelector('#phoneCard'); return c && !c.hidden && getComputedStyle(c).display !== 'none' ? { kind: c.dataset.moment || '', text: c.textContent.replace(/\s+/g, ' ').trim() } : null; });
68
+ const wait = async (p, re) => until(async () => { const c = await card(p); return c && re.test(c.text) ? c : null; });
69
+ const A = MT('mA', 'Partner sync', 10, 0, 11, 0);
70
+
71
+ /* M: the eight moments */
72
+ let p = await scene({ time: at(10, 20), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], name: 'meeting' });
73
+ let c = await wait(p, /Under way/);
74
+ ok('M1 a meeting under way: says when it ends and names it', c && c.kind === 'meeting' && /Under way · ends in 40 min/.test(c.text) && /Partner sync/.test(c.text) && /Dana, Priya/.test(c.text), c && c.text);
75
+ if (p.__shot) await p.__shot('light');
76
+ await p.__ctx.close();
77
+
78
+ p = await scene({ time: at(9, 45), today: [A], name: 'before' });
79
+ c = await wait(p, /Starts/);
80
+ ok('M2 a meeting near: says when it starts and what is prepared', c && c.kind === 'before' && /Starts in 15 min · 10:00/.test(c.text) && /sandbox dates/.test(c.text), c && c.text);
81
+ if (p.__shot) await p.__shot('light');
82
+ await p.__ctx.close();
83
+
84
+ p = await scene({ time: at(11, 10), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], name: 'after' });
85
+ c = await wait(p, /Just ended/);
86
+ ok('M3 a meeting just ended: names it and does not claim notes exist', c && c.kind === 'after' && /Partner sync/.test(c.text) && /if there are any/.test(c.text) && !/record/i.test(c.text), c && c.text);
87
+ await p.__ctx.close();
88
+
89
+ p = await scene({ time: at(11, 40), today: [A, MT('mB', 'Quota review', 14, 0, 15, 0)], needs: [{ key: 'k1', kind: 'overdue', id: i1.id, headline: i1.text || 'Send the partner onboarding list to Lina', days_late: 2 }], name: 'gap' });
90
+ c = await wait(p, /free|Free|until/);
91
+ ok('M4 a free stretch: names the next meeting and the item that fits', c && c.kind === 'gap' && /Quota review/.test(c.text) && /Lina/.test(c.text), c && c.text);
92
+ await p.__ctx.close();
93
+
94
+ p = await scene({ time: at(8, 0), today: [MT('mB', 'Quota review', 13, 0, 14, 0)], needs: [{ key: 'k1', kind: 'due-today', id: i1.id, headline: 'Send the partner onboarding list to Lina' }], name: 'morning' });
95
+ c = await wait(p, /this morning/);
96
+ ok('M5 the morning: counts what waits and names the first meeting', c && c.kind === 'morning' && /One thing this morning/.test(c.text) && /First up: Quota review at 13:00/.test(c.text), c && c.text);
97
+ await p.__ctx.close();
98
+
99
+ p = await scene({ time: at(14, 30), today: [MT('mB', 'Quota review', 16, 0, 17, 0)], name: 'work' });
100
+ c = await wait(p, /Finished for you/);
101
+ ok('M6 working hours: says what the agent finished, from phone-day, and that approving waits for the computer', c && c.kind === 'work' && /Draft of the sandbox note/.test(c.text) && /Waits for you/.test(c.text) && /waits for your computer/.test(c.text), c && c.text);
102
+ await p.__ctx.close();
103
+
104
+ p = await scene({ time: at(18, 0), today: [A], needs: [{ key: 'k1', kind: 'overdue', id: i1.id, headline: 'Send the partner onboarding list to Lina', days_late: 1 }], name: 'recap' });
105
+ c = await wait(p, /How today went/);
106
+ ok('M7 the evening: the recap counts come from phone-day', c && c.kind === 'recap' && /2\s*meetings/.test(c.text) && /3\s*done by you/.test(c.text) && /Sandbox dates agreed/.test(c.text) && /Still open · 1/.test(c.text), c && c.text);
107
+ await p.__ctx.close();
108
+
109
+ p = await scene({ time: at(21, 0), today: [A], name: 'night' });
110
+ c = await wait(p, /Tomorrow, Tuesday/);
111
+ ok('M8 the night: tomorrow at a glance, with its meetings', c && c.kind === 'night' && /Quota review/.test(c.text) && /10:00/.test(c.text), c && c.text);
112
+ await p.__ctx.close();
113
+
114
+ /* O: Open the meeting */
115
+ const hit = { ok: true, range: { start: DATE, end: DATE }, cells: [{ key: DATE, end: DATE, events: [{ id: 'ev1', title: A.title, at: A.start, end: A.end, attendees: A.people }] }], context: {} };
116
+ p = await scene({ time: at(10, 20), today: [A], week: hit });
117
+ await wait(p, /Under way/);
118
+ await p.click('#phoneCard [data-pha="phopen"]');
119
+ ok('O1 Open the meeting opens the meeting dialog when the calendar lists it', await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))));
120
+ await p.__ctx.close();
121
+ p = await scene({ time: at(10, 20), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
122
+ await wait(p, /Under way/);
123
+ await p.click('#phoneCard [data-pha="phopen"]');
124
+ ok('O2 when the calendar does not list it, the page says so and opens nothing', await until(() => p.evaluate(() => /could not be opened/.test(document.body.innerText))) && !(await p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))));
125
+ await p.__ctx.close();
126
+
127
+ /* D: Done and Undo, on a real item */
128
+ const own = (it, k = 'k1') => ({ key: k, kind: 'overdue', id: it.id, headline: 'Confirm the rate-limit quota', days_late: 3 });
129
+ p = await scene({ time: at(8, 0), today: [], needs: [own(i2)] });
130
+ await wait(p, /Confirm the rate-limit quota/);
131
+ await p.click(`#phoneCard .phfit[data-id="${i2.id}"] [data-pha="phdone"]`);
132
+ ok('D1 Done posts one done for that item and the card says Done.', await until(() => p.evaluate(() => /Done\./.test(document.querySelector('#phoneCard').textContent))) && p.__posts.filter((x) => x.path === '/api/pm-items/done').length === 1 && p.__posts.find((x) => x.path === '/api/pm-items/done').body.id === i2.id, JSON.stringify(p.__posts));
133
+ const st1 = await F.get('/api/pm-items'); const row1 = JSON.stringify(st1.body).includes(i2.id);
134
+ ok('D2 the item is recorded as done by the real route', row1 && /done/i.test(JSON.stringify((st1.body.items || []).find((x) => x.id === i2.id) || {})), JSON.stringify(st1.body).slice(0, 300));
135
+ await p.click(`#phoneCard .phfit[data-id="${i2.id}"] [data-pha="phundo"]`);
136
+ ok('D3 Undo posts a reopen and the Done button is back', await until(() => p.evaluate((id) => !!document.querySelector(`#phoneCard .phfit[data-id="${id}"] [data-pha="phdone"]`), i2.id)) && p.__posts.some((x) => x.path === '/api/pm-items/reopen' && x.body.id === i2.id), JSON.stringify(p.__posts));
137
+ await p.__ctx.close();
138
+
139
+ /* X: a refused press */
140
+ p = await scene({ time: at(8, 0), today: [], needs: [{ key: 'kx', kind: 'overdue', id: 'zz-no-such-item', headline: 'An item the file does not hold', days_late: 1 }] });
141
+ await wait(p, /An item the file does not hold/);
142
+ await p.click('#phoneCard [data-pha="phdone"]');
143
+ ok('X1 a refused Done shows the reason and does not say Done', await until(() => p.evaluate(() => /That did not go through/.test(document.querySelector('#phoneCard').textContent))) && !/Done\./.test(await p.evaluate(() => document.querySelector('#phoneCard').textContent)));
144
+ await p.__ctx.close();
145
+
146
+ /* E: a read that fails is named in the card */
147
+ p = await scene({ time: at(10, 20), pageFail: true });
148
+ ok('E1 a failed brief read is named in the card', !!(await wait(p, /could not be read/)));
149
+ await p.__ctx.close();
150
+ p = await scene({ time: at(18, 0), today: [A], dayFail: true });
151
+ c = await wait(p, /Today could not be read/);
152
+ ok('E2 a failed phone-day read is named in the recap, and the open items still show', c && /Still open/.test(c.text), c && c.text);
153
+ await p.__ctx.close();
154
+
155
+ /* W: desktop width and the POST allow-list */
156
+ p = await scene({ time: at(18, 0), today: [A], width: 1280 });
157
+ await sleep(1500);
158
+ ok('W1 at 1280 wide the card is not shown', (await card(p)) === null);
159
+ ok('W2 at 1280 wide nothing asks for phone-day', !p.__gets.includes('/api/phone-day'), p.__gets.join());
160
+ ok('W3 nothing is written on load', p.__posts.length === 0, JSON.stringify(p.__posts));
161
+ await p.__ctx.close();
162
+
163
+ /* L: floors at 390, light and dark */
164
+ for (const scheme of ['light', 'dark']) {
165
+ p = await scene({ time: at(9, 45), today: [A], needs: [own(i2)], scheme, name: 'floors' });
166
+ await wait(p, /Starts/);
167
+ const f = await p.evaluate(() => {
168
+ const c = document.querySelector('#phoneCard'), bs = [...c.querySelectorAll('button')];
169
+ return { over: document.documentElement.scrollWidth > innerWidth + 1, small: bs.filter((b) => b.getBoundingClientRect().height < 43.5).length, buttons: bs.length, colour: getComputedStyle(c.querySelector('.phbig')).color, bg: getComputedStyle(c).backgroundColor, edge: getComputedStyle(c).boxShadow };
170
+ });
171
+ ok(`L1 ${scheme}: no sideways scroll at 390 and every button is 44 px tall`, !f.over && f.small === 0 && f.buttons >= 1, JSON.stringify(f));
172
+ ok(`L2 ${scheme}: the card has the ember edge and readable text`, /inset/.test(f.edge) && f.colour !== f.bg, JSON.stringify(f));
173
+ ok(`L3 ${scheme}: the page raised no error`, p.__errs.length === 0, p.__errs.join());
174
+ if (p.__shot) await p.__shot(scheme);
175
+ await p.__ctx.close();
176
+ }
177
+ return finish();
178
+ })().catch((e) => { console.error(e); finish(1); });