create-pmos 0.396.0 → 0.397.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 (98) hide show
  1. package/package.json +13 -13
  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/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +12 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/guide/lifecycle.md +51 -0
  28. package/workspace/home-shot.js +38 -0
  29. package/workspace/lib/board-premium.js +92 -1
  30. package/workspace/lib/engine/boards.js +15 -14
  31. package/workspace/lib/engine/nine-stages.js +49 -20
  32. package/workspace/lib/engine/signals/detectors.js +13 -11
  33. package/workspace/lib/insights-premium.js +78 -1
  34. package/workspace/lib/routes-board-premium.js +3 -2
  35. package/workspace/lib/routes-initiatives.js +1 -1
  36. package/workspace/lib/routes-insights-premium.js +8 -1
  37. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/premium-agreed-viewer-shots.js +76 -0
  41. package/workspace/premium-board-actions-test.js +2 -0
  42. package/workspace/premium-chat-chart-tab-test.js +6 -5
  43. package/workspace/premium-chat-context-test.js +8 -6
  44. package/workspace/premium-chat-goal-view-test.js +9 -7
  45. package/workspace/premium-chat-notes-test.js +3 -2
  46. package/workspace/premium-chat-report-tab-test.js +8 -2
  47. package/workspace/premium-chat-term-test.js +3 -1
  48. package/workspace/premium-chat-viewer-test.js +23 -17
  49. package/workspace/premium-core-doc-issue-test.js +2 -0
  50. package/workspace/premium-html-viewer-test.js +4 -2
  51. package/workspace/premium-phone-card-test.js +1 -0
  52. package/workspace/premium-phone-room-test.js +16 -11
  53. package/workspace/premium-report-read-test.js +1 -1
  54. package/workspace/premium-vw-backlog-test.js +2 -0
  55. package/workspace/premium-vw-cal-test.js +9 -4
  56. package/workspace/premium-vw-doc-test.js +1 -1
  57. package/workspace/premium-vw-item-test.js +1 -0
  58. package/workspace/premium-vw-jira-test.js +4 -1
  59. package/workspace/premium-vw-notes-test.js +2 -1
  60. package/workspace/premium-vw-rec-test.js +3 -2
  61. package/workspace/premium-vw-slides-test.js +2 -2
  62. package/workspace/premium-work-depth-test.js +7 -3
  63. package/workspace/public/pm/bd-span.js +120 -0
  64. package/workspace/public/pm/bd-stages.js +33 -0
  65. package/workspace/public/pm/cozy-board.css +373 -0
  66. package/workspace/public/pm/cozy-home.css +152 -0
  67. package/workspace/public/pm/cozy-home.js +170 -0
  68. package/workspace/public/pm/cozy-initiative.css +138 -0
  69. package/workspace/public/pm/cozy-insights.css +292 -0
  70. package/workspace/public/pm/cozy-nav.js +54 -0
  71. package/workspace/public/pm/cozy-viewer.css +143 -0
  72. package/workspace/public/pm/cozy.css +172 -0
  73. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  74. package/workspace/public/pm/lifecycle-lens.js +22 -11
  75. package/workspace/public/pm/premium-board.js +329 -67
  76. package/workspace/public/pm/premium-brief.js +1 -1
  77. package/workspace/public/pm/premium-chat.js +17 -10
  78. package/workspace/public/pm/premium-initiative-head.js +138 -0
  79. package/workspace/public/pm/premium-initiative.js +28 -4
  80. package/workspace/public/pm/premium-insights.js +530 -244
  81. package/workspace/public/pm/premium-shell.js +40 -10
  82. package/workspace/public/pm/premium-viewer.js +5 -0
  83. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  84. package/workspace/public/pm/premium-vw-jira.css +11 -0
  85. package/workspace/public/pm/premium-vw-jira.js +11 -4
  86. package/workspace/public/pm/premium-vw-rec.js +5 -2
  87. package/workspace/public/pm/premium-work.js +18 -8
  88. package/workspace/public/pm/premium.js +19 -6
  89. package/workspace/public/premium-board.html +82 -47
  90. package/workspace/public/premium-chat.html +7 -33
  91. package/workspace/public/premium-initiative.html +15 -8
  92. package/workspace/public/premium-insights.html +82 -43
  93. package/workspace/public/premium-work.html +6 -72
  94. package/workspace/public/premium.html +61 -15
  95. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  96. package/workspace/server.js +7 -0
  97. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  98. package/workspace/third-party/README.md +1 -0
@@ -100,7 +100,8 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
100
100
  await strip(p);
101
101
  const sw = await p.evaluate(() => ({ title: document.querySelector('#hToday').textContent, days: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => b.dataset.day + ':' + b.getAttribute('aria-pressed')), box: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => { const r = b.getBoundingClientRect(); return Math.round(Math.min(r.width, r.height)); }), ahead: !!document.querySelector('#tl .grp'), sw: !!document.querySelector('#rng'), fold: document.querySelector('#todayCard .foldb').getAttribute('aria-expanded') }));
102
102
  const isWeekday = NOW.getDay() >= 1 && NOW.getDay() <= 5;
103
- ok('C1 the card is titled Calendar, has no Today / This week switch, and is open at 1280 px', sw.title === 'Calendar' && !sw.sw && sw.fold === 'true', JSON.stringify(sw));
103
+ // re-pointed for premium-agreed-design: on Home the calendar is the list's Today group (premium.html #hToday reads Today, not Calendar)
104
+ ok('C1 the card is titled Today, has no Today / This week switch, and is open at 1280 px', sw.title === 'Today' && !sw.sw && sw.fold === 'true', JSON.stringify(sw));
104
105
  ok('C1 the strip has Monday to Friday, today is pressed, and Today is unchanged', sw.days.length === 5 && sw.days.filter((x) => /:true$/.test(x)).length === (isWeekday ? 1 : 0) && (!isWeekday || sw.days.includes(dayKey(NOW) + ':true')) && sw.ahead, JSON.stringify(sw.days));
105
106
  ok('C1 each day button is at least 44 px', sw.box.every((n) => n >= 44), JSON.stringify(sw.box));
106
107
  ok('C1 the week is read once when the page opens, for today\'s date', A.weekGets.length === 1 && /view=week/.test(A.weekGets[0]) && A.weekGets[0].includes('date=' + dayKey(NOW)), JSON.stringify(A.weekGets));
@@ -146,8 +147,10 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
146
147
  ok('C4 a week row has its own conversation too (premium-popup-context P1)', dlg && dlg.ask === false);
147
148
  ok('C5 the dialog says what it is about, and that the calendar is never written', dlg && /It is about Board: IDPF/.test(dlg.text) && /calendar itself is never written/.test(dlg.text));
148
149
  await p.keyboard.press('Escape');
149
- const closed = await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
150
- ok('C4 Escape closes it and focus returns to the row', closed && await p.evaluate(() => document.activeElement && document.activeElement.id === 'rowSprint'));
150
+ // re-pointed for premium-agreed-design H2: on a desktop Home the chat is docked and stays open, so Escape takes the meeting's
151
+ // conversation back to the PM's own chat (title "Chat", the docked #dlg stays on) instead of closing the dialog; focus still returns to the row
152
+ const closed = await until(() => p.evaluate(() => { const g = document.querySelector('#dlg'); return !g.classList.contains('on') || (document.body.classList.contains('cz-dock') && document.querySelector('#dTitle').textContent === 'Chat'); }));
153
+ ok('C4 Escape closes the meeting\'s dialog and focus returns to the row', closed && await until(() => p.evaluate(() => document.activeElement && document.activeElement.id === 'rowSprint'), 3000));
151
154
 
152
155
  /* C5 link it */
153
156
  await p.click('#rowSprint');
@@ -215,8 +218,16 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
215
218
  const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
216
219
  await mp.setContent(MOCKUP); await CT.applyToPage(mp, CT_VENDOR); await mp.waitForTimeout(500);
217
220
  const F1 = await open();
218
- const pairs = [['#todayCard', '#todayCard'], ['#tl .ev b', '#tl .ev b'], ['#tl .nowl', '#tl .nowl']];
219
- for (const [a, b] of pairs) { const x = await css(mp, a), y = await css(F1.page, b); ok('C10 fidelity: ' + a + ' keeps the mockup\'s computed style at 1280 px', x === y || (x === null && true), x + ' vs ' + y); }
221
+ /* re-pointed for premium-agreed-design: the Agreed design replaces the old Briefing mockup's look (its 28 px card, its ink and amber now-line).
222
+ * On Home the Calendar is a group of the list: no card box (cozy-home.css .cz-home .card), the cozy ink for text and the cozy blue ink for
223
+ * the now line, read from cozy.css's tokens in the page. The type (size, weight, tracking, case) is still the mockup's. */
224
+ const tok = (page, v) => page.evaluate((v) => { const e = document.createElement('i'); e.style.color = 'var(' + v + ')'; document.body.appendChild(e); const c = getComputedStyle(e).color; e.remove(); return c; }, v);
225
+ const ink = await tok(F1.page, '--cz-ink'), blueink = await tok(F1.page, '--cz-blueink');
226
+ const agreed = { '#todayCard': { box: '0px|0px', color: ink }, '#tl .ev b': { box: '0px|0px', color: ink }, '#tl .nowl': { box: '0px|8px', color: blueink } };
227
+ for (const a of Object.keys(agreed)) {
228
+ const x = await css(mp, a), y = await css(F1.page, a), xs = (x || '').split('|'), ys = (y || '').split('|');
229
+ ok('C10 fidelity: ' + a + ' keeps the mockup\'s type and takes the Agreed design\'s box and colour at 1280 px', !!x && !!y && /^rgb/.test(ink) && xs.slice(0, 4).join('|') === ys.slice(0, 4).join('|') && ys.slice(4, 6).join('|') === agreed[a].box && ys[6] === agreed[a].color, x + ' vs ' + y + ' (agreed ' + JSON.stringify(agreed[a]) + ')');
230
+ }
220
231
  const grp = await css(mp, '#tl .grp');
221
232
  await week(F1.page);
222
233
  const wd = await css(F1.page, "#tl .wkd");
@@ -4,12 +4,9 @@
4
4
  * Serves the real page from the real server. Most checks answer GET /api/initiative-premium with the model lib/initiative-premium.js builds from a fixture
5
5
  * (fixtures/initiative-premium-facts.js); the last blocks read this repository's own initiative through the real routes and compare with the mockup.
6
6
  * I1 place · I2 reading · I3 header · I4 overview · I5 checks · I6 tasks · I7 documents · I8 document sheet · I9 opening · I10 presses · I11 one count · I12 floors and fidelity */
7
- const fs = require('fs');
8
7
  const path = require('path');
9
8
  const { spawn } = require('child_process');
10
9
  const { findBrowser } = require('./lib/find-browser');
11
- const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
12
- const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
13
10
  const T = require('./test-run').configure({ name: 'briefing-premium-initiative' });
14
11
  const IP = require('./lib/initiative-premium.js');
15
12
  const F = require('./fixtures/initiative-premium-facts.js');
@@ -31,7 +28,6 @@ const finish = async (code) => {
31
28
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
32
29
 
33
30
  const mk = (o) => IP.build(F.facts(o));
34
- const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
35
31
  const LOG = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', revisions: [{ rev: 1, why: '', by: 'baseline', at: '2026-10-16T08:00:00Z' }, { rev: 2, why: 'tightened the goal', by: 'pm', at: '2026-10-17T08:00:00Z' }], events: [{ kind: 'asked', at: '2026-10-17T08:30:00Z', prompt: 'What is missing?' }] };
36
32
  const TEXT = '---\ntype: PRD\ntitle: "Self-serve onboarding v2"\n---\n\n# PRD: Self-serve onboarding v2\n\n## Problem\n\nA partner waits for a person.\n\n## Goal\n\n- a first call without help\n- a key shown once\n\n## Requirements\n\n```\nR1 a first call\n```\n';
37
33
  const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: { passed: 1, total: 2, checks: [{ id: 'fresh', pass: true, reason: 'no cited source changed after it' }, { id: 'traced', pass: false, reason: 'a line with a figure has no source' }, { id: 'readers', pass: null, reason: 'no input' }] } };
@@ -73,8 +69,9 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
73
69
  const all = (s) => p.evaluate((q) => [...document.querySelectorAll(q)].map((e) => e.textContent.trim()), s);
74
70
 
75
71
  /* I1 place */
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
- ok('I1 the rail names the five places and marks Board', rail.names.join() === 'Briefing,My work,Chat,Board,Insights' && rail.cur === 'Board');
72
+ // the Agreed design (premium-agreed-design N1): the floating place menu replaces the rail on screen, and this page belongs to Home
73
+ const nav = await p.evaluate(() => ({ rail: getComputedStyle(document.querySelector('.rail')).display, fab: document.querySelector('#czFab').getAttribute('aria-label'), names: [...document.querySelectorAll('#czMenu a, #czMenu button')].map((b) => b.textContent.trim()), cur: document.querySelector('#czMenu [aria-current="page"]').textContent.trim() }));
74
+ ok('I1 the floating menu names Home, Board, Insights and Settings, marks Home, and the rail is off screen', nav.rail === 'none' && nav.names.join() === 'Home,Board,Insights,Settings' && nav.cur === 'Home' && nav.fab === 'Open the menu. You are in Home', JSON.stringify(nav));
78
75
  { 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
76
  ok('I1 the bar has a back button to the board, the initiative with its switcher, and no chat button (Chat is in the rail)', 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')));
80
77
  await p.route('**/premium-board.html*', (r) => r.fulfill({ contentType: 'text/html', body: '<title>b</title>' }));
@@ -85,14 +82,33 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
85
82
  { 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'))); }
86
83
  await p.click('#crBoard'); await sleep(500);
87
84
  { 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'))); }
88
- await p.click('.rail [data-go="chat"]'); await until(() => p.evaluate(() => /premium-chat\.html/.test(location.pathname) && document.querySelector('#dlg').classList.contains('on')), 10000); await sleep(500);
89
- { const u = new URL(p.url()); const t = await p.evaluate(() => document.querySelector('#dTitle').textContent);
90
- ok('I1 Chat opens the Chat page on the initiative\'s conversation (premium-chat-page)', /^init:/.test(u.searchParams.get('about') || '') && t === 'Ask about Self-serve onboarding v2', JSON.stringify({ url: p.url(), t })); }
91
- await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#cIniTk')), 20000);
85
+ // the Agreed design: the card's C button opens the initiative's own conversation with Claude (the thread key the Chat page used, init:<id>)
86
+ { const nT = A.posts.length; await p.click('#czBox [data-czov]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 10000); await sleep(300);
87
+ const t = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, label: document.querySelector('#czBox [data-czov]').getAttribute('aria-label') }));
88
+ ok('I1 the header card\'s C button opens the initiative\'s conversation with Claude, and sends nothing', t.title === 'Self-serve onboarding v2' && t.label === 'Overview of Self-serve onboarding v2 with Claude' && A.posts.length === nT, JSON.stringify(t));
89
+ await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); }
92
90
 
93
91
  /* I3 header */
94
- const head = await p.evaluate(() => ({ chip: document.querySelector('.ihead .chp').textContent.trim(), tone: document.querySelector('.ihead .chp').className, meta: document.querySelector('.ihm').textContent, segs: [...document.querySelectorAll('.iws .sg2 i')].map((i) => i.className).join('|'), cur: document.querySelector('.iws em b').textContent }));
95
- ok('I3 the chip, the meta and the stage strip are the record\'s', head.chip === 'At risk' && /warn/.test(head.tone) && head.meta === 'Onboarding · Dara · planned finish 30 Oct · stage derived by the workflow engine' && head.segs === 'p|p|p|p|p|n|||' && head.cur === 'Build', JSON.stringify(head));
92
+ const head = await p.evaluate(() => ({ chip: document.querySelector('.ihead .chp').textContent.trim(), tone: document.querySelector('.ihead .chp').className, meta: document.querySelector('.ihm').textContent, segs: [...document.querySelectorAll('#czBox .cz-ladder i')].map((i) => i.className).join('|'), cur: document.querySelector('#czBox .czi-lad b').textContent, lad: document.querySelector('#czBox .czi-lad').textContent, stage: document.querySelector('#czBox .czi-stage').textContent, turn: document.querySelector('#czBox .czi-turn').textContent }));
93
+ ok('I3 the chip and the meta are the record\'s', head.chip === 'At risk' && /warn/.test(head.tone) && head.meta === 'Onboarding · Dara · planned finish 30 Oct · stage derived by the workflow engine', JSON.stringify(head));
94
+ // premium-agreed-design I1: the header card's eight-step ladder, Deliver and Evaluate as milestones; Build is step 5
95
+ ok('I1 the header card shows the eight-step ladder with two milestones, the current step and the next', head.segs === 'done|done|done|done|now|ms||ms' && head.cur === 'Build' && /Prioritize/.test(head.lad) && /Deliver/.test(head.lad) && head.stage === '5 of 8 · Build' && head.turn === 'Your turn', JSON.stringify(head));
96
+ {
97
+ const card = await p.evaluate(() => ({ items: [...document.querySelectorAll('#czBox .czi-it')].map((e) => e.textContent.trim()), pay: (document.querySelector('#czBox .czi-pay') || {}).textContent, time: (document.querySelector('#czBox .czi-time') || {}).textContent, cta: document.querySelector('#czBox [data-czcta]').textContent, text: document.querySelector('#czHead').textContent }));
98
+ ok('I1 what finishes it: done, your steps and the Jira tickets, never a PMOS builder agent or a pull request', card.items.some((x) => /1 done: PRD and rubric written/.test(x)) && card.items.some((x) => /Your go on the done criteria\s*You/.test(x)) && card.items.some((x) => /1 of 2 tickets Done in Jira/.test(x)) && !/pull request|\bPR\b|builder/i.test(card.text), JSON.stringify(card));
99
+ ok('I1 the payoff line, the time in the stage and one primary CTA', /^Then: The features are delivered in Jira/.test(card.pay) && /Moves q3-2026:o1:kr1/.test(card.pay) && card.time === 'In Build · planned finish 30 Oct' && card.cta === 'Review the done criteria' && (await p.$$('#czBox .czi-cta')).length === 1, JSON.stringify(card));
100
+ await p.click('#czBox [data-czfold]');
101
+ const fold = await p.evaluate(() => ({ items: document.querySelectorAll('#czBox .czi-it').length, sum: (document.querySelector('#czBox .czi-fold') || {}).textContent, exp: document.querySelector('#czBox [data-czfold]').getAttribute('aria-expanded') }));
102
+ ok('I1 the card folds to one line and opens again', fold.items === 0 && /To reach Deliver/.test(fold.sum) && /1 of 4 done · 2 for you, in Jira/.test(fold.sum) && fold.exp === 'false', JSON.stringify(fold));
103
+ await p.click('#czBox [data-czfold]');
104
+ ok('I1 opened again it lists the items', await p.evaluate(() => document.querySelectorAll('#czBox .czi-it').length === 4));
105
+ await p.click('#czBox [data-czdone]');
106
+ ok('I1 the done items open from their summary row', await p.evaluate(() => document.querySelector('#czBox [data-czdone]').getAttribute('aria-expanded') === 'true' && [...document.querySelectorAll('#czBox .czi-it.done')].some((e) => e.textContent.replace('✓', '').trim() === 'PRD and rubric written')));
107
+ await p.click('#czBox [data-czdone]');
108
+ const nC = A.posts.length; await p.click('#czBox [data-czcta]');
109
+ ok('I1 the CTA asks the read-only agent about the step that waits on you', await until(() => A.posts.length > nC && A.posts[A.posts.length - 1].path === '/api/briefing-premium/ask' && A.posts[A.posts.length - 1].body.key === 'init:self-serve-v2'), JSON.stringify(A.posts.slice(-1)));
110
+ await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
111
+ }
96
112
 
97
113
  /* I4 overview and I5 checks */
98
114
  const ov = await p.evaluate(() => ({ who: document.querySelector('#cIniOv .tdw').textContent, h: document.querySelector('#cIniOv .todo b').textContent, p: document.querySelector('#cIniOv .todo p').textContent, more: document.querySelector('#cIniOv .todo small').textContent, skip: document.querySelector('#cIniOv .tdk').textContent, notes: [...document.querySelectorAll('#cIniOv .note')].map((n) => n.textContent) }));
@@ -329,35 +345,28 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
329
345
  const bad = await fetch(BASE + '/api/initiative-premium?id=../etc/passwd'); ok('I1 an id that is not an id is refused', bad.status === 400);
330
346
  const post = await fetch(BASE + '/api/initiative-premium?id=x', { method: 'POST' }); ok('I10 the route answers GET only', post.status === 405);
331
347
  }
332
- /* I12 fidelity against the mockup */
333
- if (!fs.existsSync(MOCKUP)) ok('I12 the mockup is in the repository', false, MOCKUP);
334
- else {
335
- 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']];
336
- 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'];
337
- 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'];
338
- const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'backdropFilter', 'borderTopColor'];
339
- const grab = (pg) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s0] of pairs) { const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS]);
340
- for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
341
- const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
342
- await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
343
- await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
344
- await m.evaluate((t) => { document.documentElement.dataset.theme = t; document.querySelector('.pl[data-p="init"]').click(); }, th);
345
- await until(() => m.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0)); await sleep(500);
346
- await m.evaluate(() => { showInit('initiative', 'pmos', 0); });
347
- await until(() => m.evaluate(() => !!document.querySelector('#cIniTk') && !!document.querySelector('#cIniDoc .dmr'))); await sleep(900);
348
- const R = await open({ w, h, theme: th, model: mk({ row: Object.assign({}, F.ROW, { title: 'Self-serve onboarding v2 — a partner reaches a first call without help' }) }) }); await sleep(500);
349
- const a = await grab(m), c = await grab(R.page), diffs = [];
350
- for (const [n] of PAIRS) {
351
- if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
352
- for (const k of Object.keys(a[n])) {
353
- const geom = k === 'left' || k === 'width';
354
- if (geom && ((k === 'width' && SKIP_W.includes(n)) || (k === 'left' && SKIP_L.includes(n)))) continue;
355
- if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
356
- }
357
- }
358
- ok(`I12 styles and geometry match the mockup at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
359
- await m.context().close(); await R.ctx.close();
360
- }
348
+ /* I12 fidelity: the Agreed design (premium-agreed-design, Inside one initiative frames) replaces the old mockup's look.
349
+ * The cozy panel, Nunito, the header card and its blue CTA, the floating menu where the frames put it, in light and dark. */
350
+ for (const [w, h] of [[1440, 900], [390, 844]]) for (const th of ['light', 'dark']) {
351
+ const R = await open({ w, h, theme: th }); await sleep(300);
352
+ const g = await R.page.evaluate(() => {
353
+ const cs = (s) => { const e = document.querySelector(s); return e ? getComputedStyle(e) : null; }, box = (s) => { const e = document.querySelector(s); if (!e) return null; const r = e.getBoundingClientRect(); return { l: Math.round(r.left), t: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height), r: Math.round(innerWidth - r.right), b: Math.round(innerHeight - r.bottom) }; };
354
+ return { font: cs('body').fontFamily, rail: cs('.rail').display, panel: { bg: cs('main.stage').backgroundColor, rad: cs('main.stage').borderTopLeftRadius, box: box('main.stage') }, card: cs('#czHead').borderTopLeftRadius,
355
+ well: cs('#czBox .czi-box').backgroundColor, cta: cs('#czBox .czi-cta').backgroundColor, ctaInk: cs('#czBox .czi-cta').color, fab: box('#czFab'), top: box('#czHead'), h1: cs('#iH1').position };
356
+ });
357
+ const desk = w > 720, dark = th === 'dark', d = [];
358
+ if (!/^Nunito/.test(g.font)) d.push('font ' + g.font);
359
+ if (g.rail !== 'none') d.push('rail ' + g.rail);
360
+ if (g.panel.bg !== (dark ? 'rgb(36, 38, 43)' : 'rgb(255, 255, 255)')) d.push('panel bg ' + g.panel.bg);
361
+ if (desk ? g.panel.rad !== '28px' || g.panel.box.l !== 16 || g.panel.box.t !== 16 : g.panel.rad !== '0px' || g.panel.box.l !== 0) d.push('panel ' + JSON.stringify(g.panel));
362
+ if (g.card !== '20px') d.push('card radius ' + g.card);
363
+ if (g.well !== (dark ? 'rgb(27, 29, 33)' : 'rgb(244, 243, 240)')) d.push('well ' + g.well);
364
+ if (g.cta !== (dark ? 'rgb(155, 199, 244)' : 'rgb(47, 95, 179)')) d.push('cta ' + g.cta);
365
+ if (!g.fab || g.fab.w !== 56 || g.fab.h !== 56 || (desk ? g.fab.l !== 36 || g.fab.b !== 36 : g.fab.r !== 18)) d.push('fab ' + JSON.stringify(g.fab));
366
+ if (g.top.t > (desk ? 40 : 16)) d.push('the header card does not start at the top ' + JSON.stringify(g.top));
367
+ if (g.h1 !== 'absolute') d.push('a visible page header ' + g.h1);
368
+ ok(`I12 the page follows the Agreed design at ${w} px, ${th}: Nunito, the cozy panel, the header card at the top, the blue CTA, the floating menu`, d.length === 0, d.join(' ; '));
369
+ await R.ctx.close();
361
370
  }
362
371
  return finish();
363
372
  })().catch((e) => { console.error(e); finish(1); });