create-pmos 0.396.0 → 0.398.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 (177) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  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/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
@@ -4,20 +4,30 @@
4
4
  * The real server with one product repository and a made-up morning brief written to <state>/briefs/<today>.json. Nothing here touches the PM's real briefs.
5
5
  * S1/S8 no brief for today: the header says so S2/S5 the rows, each tagged Across products (the brief names no included initiative)
6
6
  * S3 the dialog opens an https link and records nothing S7 the digests in Today S9 the writes refuse a source key; the agent answers
7
- * S11 the source row and the digest look like the mockup's own row and Today item at 1280 and 390 px, light and dark; no sideways scroll
7
+ * S11 the source row and the digest are drawn in the Agreed design's tokens at 1280 and 390 px, light and dark; no sideways scroll
8
+ * (re-pointed by premium-agreed-design: rows are Home's Needs-you rows, the digests and the read lines are in Home's minimal More cards)
8
9
  * Every wait polls the page; no fixed sleep stands in for a state. */
9
10
  const fs = require('fs');
10
11
  const os = require('os');
11
12
  const path = require('path');
12
13
  const { spawn, spawnSync } = require('child_process');
13
14
  const { findBrowser } = require('./lib/find-browser');
14
- const CT = require('./lib/premium-console-type'); // the mockup is read with the console's type (PM, 2026-10-19), as premium.css is
15
- const CT_VENDOR = 'file://' + path.join(__dirname, 'public', 'vendor') + '/';
16
15
  const T = require('./test-run').configure({ name: 'briefing-premium-sources' });
17
16
 
18
17
  const BASE = T.BASE;
19
- const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
20
18
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
19
+ /* premium-agreed-design: the Briefing's ranked list, its dialog, its Today timeline and its cards are gone. A source row is a Needs-you row on
20
+ * Home (its hint leads with the product, then the source and sender, then the prepared line) and opens in the Viewer. Today's digests are in
21
+ * Home's minimal Around you card, and the read lines and the background line are in its minimal Sources card; both open from the place
22
+ * menu's More and carry "Waiting for design". */
23
+ const moreItem = async (pg, label, sel) => {
24
+ if (await pg.isVisible('#czViewer')) { await pg.keyboard.press('Escape'); }
25
+ await pg.click('#czFab'); await pg.click('[data-cz-more]');
26
+ await pg.click(`#hmMenu [role="menuitem"]:has-text("${label}")`);
27
+ await pg.waitForSelector('#czViewer ' + sel, { timeout: 15000 });
28
+ };
29
+ const srcRowsOf = (pg) => pg.$$eval('#hmList .hm-r[data-id^="n:src:"]', (els) => els.map((e) => ({ key: e.dataset.id.slice(2), title: e.querySelector('.hm-rt b').textContent, line2: (e.querySelector('.hm-rt em') || {}).textContent || '' })));
30
+ const allNeeds = async (pg) => { for (let i = 0; i < 20; i++) { const t = await pg.textContent('#hmList [data-hm-allneeds]').catch(() => null); if (t === null || !/Show$/.test(t.trim())) return; await pg.click('#hmList [data-hm-allneeds]', { timeout: 2000 }).catch(() => {}); await sleep(150); } };
21
31
  const until = async (fn, ms = 15000, step = 150) => { const t0 = Date.now(); for (;;) { let v = null; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
22
32
  const results = [];
23
33
  const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
@@ -88,30 +98,30 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
88
98
  const page = await ctx.newPage(); const errors = [];
89
99
  page.on('pageerror', (e) => errors.push(String(e.message || e)));
90
100
  await page.goto(BASE + '/premium.html?theme=' + theme, { waitUntil: 'domcontentloaded' });
91
- await page.waitForSelector('#rank .rr', { timeout: 60000 });
101
+ await page.waitForSelector('#hmList .hm-r[data-id^="n:src:"]', { state: 'attached', timeout: 60000 });
92
102
  return { ctx, page, errors };
93
103
  };
94
104
 
95
105
  {
96
106
  const { ctx, page, errors } = await open();
97
- const rows = await page.$$eval('#rank .rr', (els) => els.map((e) => ({ key: e.dataset.key, title: e.querySelector('.rt').textContent.replace('Do this first', ''), line2: e.querySelector('.rs').textContent, old: e.querySelectorAll('.sug, .skip').length })));
98
- ok('S2 the first row is two lines: the title, then the source and sender · the verb and the prepared line', rows[0] && rows[0].line2 === 'Across productsMail · Anna Lee · Reply: Confirm Thursday' && rows[0].old === 0, JSON.stringify(rows[0]));
107
+ await allNeeds(page);
108
+ const rows = await srcRowsOf(page);
109
+ ok('S2 the first row is two lines: the title, then the product, the source and sender · the verb and the prepared line', rows[0] && rows[0].title === 'Confirm the Thursday review' && rows[0].line2 === 'Across products · Mail · Anna Lee · Reply: Confirm Thursday', JSON.stringify(rows[0]));
99
110
  ok('S2 a row with a verb and no prepared line shows the verb alone', rows[1] && /Confluence · Budi Santoso · Sign off$/.test(rows[1].line2), JSON.stringify(rows[1]));
100
- ok('S6 the dock counts the rows', (await page.textContent('#dN')) === '4', await page.textContent('#dN'));
101
- await page.click('#rank .rr:first-child .rhd');
102
- await page.waitForSelector('#srcLink');
103
- const link = await page.$eval('#srcLink', (a) => ({ href: a.href, target: a.target, rel: a.rel, h: Math.round(a.getBoundingClientRect().height) }));
104
- ok('S3 the dialog opens the item\'s https link in a new tab', link.href === 'https://mail.example/t/1' && link.target === '_blank' && /noopener/.test(link.rel), JSON.stringify(link));
105
- ok('S2 the row\'s why now is in its dialog', /Why now\s*Why aaaaaaaaaaa1/.test(await page.textContent('#card')), await page.textContent('#card'));
106
- ok('S3 the dialog offers nothing that records or sends', (await page.$('#recBtn')) === null && (await page.$('[data-until]')) === null && (await page.$('#dBody [data-op]')) === null);
111
+ const needN = await page.textContent('#hmNeedsN'), allRows = await page.$$eval('#hmList .hm-g[aria-label="Needs you"] .hm-r', (els) => els.length);
112
+ ok('S6 Home counts the rows: the four source rows are among the Needs-you rows, and the count names them all', rows.length === 4 && new RegExp('^' + allRows + ' needs? you$').test(needN.trim()), needN + ' / ' + allRows);
113
+ await page.click(`#hmList [data-hm-sel="n:${rows[0].key}"]`);
114
+ await page.waitForSelector('#czViewer #srcLink');
115
+ const link = await page.$eval('#czViewer #srcLink', (a) => ({ href: a.href, target: a.target, rel: a.rel, h: Math.round(a.getBoundingClientRect().height) }));
116
+ ok('S3 the Viewer opens the item\'s https link in a new tab', link.href === 'https://mail.example/t/1' && link.target === '_blank' && /noopener/.test(link.rel), JSON.stringify(link));
117
+ ok('S2 the row\'s why now is in its Viewer card', /Why now\s*Why aaaaaaaaaaa1/.test(await page.textContent('#czViewer')), await page.textContent('#czViewer'));
118
+ ok('S3 the card offers nothing that records or sends', (await page.$('#czViewer [data-hv-rec]')) === null && (await page.$('#czViewer [data-hv-later], #czViewer [data-hv-until]')) === null && (await page.$('#czViewer [data-hv-opt]')) === null);
107
119
  ok('S11 the link is at least 44 px high', link.h >= 44, String(link.h));
108
120
  await page.keyboard.press('Escape');
109
- const chip = await page.$eval('#srcChips', (e) => e.textContent);
110
- ok('S7 Today lists Digests with their count', /Digests1/.test(chip), chip);
111
- await page.click('#tl .ev.src-digest');
112
- await page.waitForSelector('#dBody');
113
- const dtxt = await page.textContent('#dlg');
114
- ok('S7 the digest dialog holds its lines and its link', /Decision: Ship on Friday/.test(dtxt) && /Open: Who owns QA/.test(dtxt) && (await page.getAttribute('#srcLink', 'href')) === 'https://slack.example/c/1', dtxt.slice(0, 200));
121
+ await moreItem(page, 'Around you', '#aroundDig');
122
+ const dig = await page.$eval('#czViewer #aroundDig', (e) => ({ h: e.querySelector('h4').textContent, t: e.textContent, href: (e.querySelector('a.srcLink') || {}).href || '' }));
123
+ ok('S7 Around you lists Digests with their count', dig.h === 'Digests 1', dig.h);
124
+ ok('S7 the digest holds its lines and its link', /Decision: Ship on Friday/.test(dig.t) && /Open: Who owns QA/.test(dig.t) && dig.href === 'https://slack.example/c/1', JSON.stringify(dig).slice(0, 300));
115
125
  ok('no page error', errors.length === 0, errors.join(' | '));
116
126
  await ctx.close();
117
127
  }
@@ -123,21 +133,19 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
123
133
  const shot = process.env.PMOS_SHOT_DIR || '';
124
134
  for (const theme of ['light', 'dark']) {
125
135
  const { ctx, page, errors } = await open({ theme, w: theme === 'dark' ? 390 : 1280, h: 844 });
126
- await page.waitForFunction(() => /sdot (ok|warn|bad)/.test((document.querySelector('#srcDot') || {}).className || ''), null, { timeout: 15000 }).catch(() => {});
127
- const dot = await page.$eval('#srcDot', (e) => e.className);
136
+ // premium-agreed-design (shared foundation): the design draws no Sources chip, so there is no dot on the page; the level is still read (GET /api/sources)
137
+ const dot = await page.evaluate(() => (document.querySelector('#srcDot, #srcChip') ? 'drawn' : 'none'));
138
+ await moreItem(page, 'Sources', '#srcHealth');
128
139
  if (theme === 'light') {
129
- // briefing-source-flow, slice 5: each card says which reads it shows and when, from the same Sources read
130
- await page.waitForSelector('#todayCard > .cread:not([hidden])', { timeout: 15000 }).catch(() => {});
131
- const rd = await page.evaluate(() => ({ cal: (document.querySelector('#todayCard > .cread') || {}).textContent || '', moves: (document.querySelector('#movesCard > .cread') || {}).textContent || '' }));
132
- ok('H5 the Calendar card names its read, and What you need to do names the initiatives, My work and the brief', /^Calendar (read|not read yet|failed)/.test(rd.cal) && /Initiatives/.test(rd.moves) && /My work/.test(rd.moves) && /Brief (built|not built yet|off)/.test(rd.moves), JSON.stringify(rd));
140
+ // briefing-source-flow, slice 5: Home names which reads each part shows and when, from the same Sources read (Home's Sources card)
141
+ const rd = await page.evaluate(() => ({ cal: ((document.querySelector('#czViewer [data-reads="Today"]') || {}).textContent || '').replace(/^Today:\s*/, ''), moves: ((document.querySelector('#czViewer [data-reads="Needs you"]') || {}).textContent || '').replace(/^Needs you:\s*/, '') }));
142
+ ok('H5 Sources names the read Today shows, and the initiatives, My work and the brief that Needs you shows', /^Calendar (read|not read yet|failed)/.test(rd.cal) && /Initiatives/.test(rd.moves) && /My work/.test(rd.moves) && /Brief (built|not built yet|off)/.test(rd.moves), JSON.stringify(rd));
133
143
  if (shot) await page.screenshot({ path: path.join(shot, 'cards-reads-light.png'), fullPage: true });
134
144
  }
135
- if (theme === 'light') await page.click('#srcChip'); else { await page.click('#moreBtn'); await page.click('#srcItem'); }
136
- await page.waitForSelector('#srcHealth .hline', { timeout: 15000 }).catch(() => {});
137
- const line = await page.$eval('#srcHealth', (e) => ({ text: e.textContent.trim(), dot: (e.querySelector('.sdot') || {}).className || '', w: Math.round(e.getBoundingClientRect().width), sw: document.documentElement.scrollWidth }));
145
+ const line = await page.$eval('#czViewer #srcHealth', (e) => ({ text: e.textContent.trim(), dot: (e.querySelector('.sdot') || {}).className || '', w: Math.round(e.getBoundingClientRect().width), sw: document.documentElement.scrollWidth }));
138
146
  if (theme === 'light') {
139
147
  ok('H2 Sources opens with the background line on top, in the level\'s colour', line.text.startsWith(h.line.slice(0, 20)) && line.dot === 'sdot ' + (h.level === 'ok' ? 'ok' : h.level), JSON.stringify(line));
140
- ok('H3 the chip\'s dot is red only when background work stopped', h.level === 'bad' ? dot === 'sdot bad' : dot !== 'sdot bad', dot);
148
+ ok('H3 no Sources chip and no dot are drawn on the page; the line above carries the level (premium-agreed-design)', dot === 'none', dot);
141
149
  } else ok('H4 on a phone the line fits: no sideways scroll', line.sw <= 390 && line.w > 0, JSON.stringify(line));
142
150
  if (shot) { await sleep(1200); await page.screenshot({ path: path.join(shot, 'sources-health-' + theme + '.png') }); }
143
151
  ok('H no page error (' + theme + ')', errors.length === 0, errors.join(' | '));
@@ -157,33 +165,64 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
157
165
  ok('S9 a message about a source row starts a Claude Code session', r3.status === 200 && r3.body.ok && r3.body.started === true, JSON.stringify(r3));
158
166
  }
159
167
 
160
- /* S11 fidelity: the source row against the mockup's second row, the digest against the mockup's Today item */
161
- if (!fs.existsSync(MOCKUP)) ok('S11 the mockup is in the repository', false, MOCKUP);
162
- else {
163
- const PAIRS = [['row', '#rank .rr:nth-child(2)'], ['number', '#rank .rr:nth-child(2) .rn'], ['title', '#rank .rr:nth-child(2) .rt'], ['subject', '#rank .rr:nth-child(2) .rs'], ['event', '#tl .ev:not(:first-of-type)'], ['eventTime', '#tl .ev:not(:first-of-type) time'], ['eventTitle', '#tl .ev:not(:first-of-type) b']];
164
- const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'borderTopColor'];
165
- const grab = (pg, sel) => pg.evaluate(([pairs, props]) => { const o = {}; for (const [n, s] of pairs) { const e = /^#tl/.test(s) && window.__ev ? window.__ev(s) : document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [sel, PROPS]);
168
+ /* S11 fidelity: the source row and the digest are drawn in the Agreed design's own type and colours.
169
+ * Re-pointed for premium-agreed-design: the reference was the old mockup (prototype/premium-ux-concept/briefing-artifact.html: Space Grotesk,
170
+ * ember, a numbered rank). The Agreed design replaced that look on purpose, so each property is now pinned to the cozy token the design names
171
+ * (cozy.css, cozy-home.css), resolved in the page itself for the theme under test; the row and the digest still fill their column, and still
172
+ * nothing scrolls sideways. A source row that drifted off the design's tokens fails here as it failed against the mockup. */
173
+ {
174
+ // re-pointed again for the Agreed design's Home: the source row is a Needs-you row of Home's list, and the digest is a line of Around you
175
+ const ROWS = [['row', '.hm-rm'], ['number', '.hm-dot'], ['title', '.hm-rt b'], ['subject', '.hm-rt em']];
176
+ const DIGS = [['event', ''], ['eventTime', '.bd-why'], ['eventTitle', '.bd-t']];
177
+ const SANS = 'var(--cz-sans)';
178
+ /* The design's values, as the tokens name them (a value that starts var( is resolved in the page; anything else is literal) */
179
+ const WANT = {
180
+ row: { fontFamily: SANS, color: 'var(--cz-ink)', backgroundColor: 'transparent' },
181
+ number: { backgroundColor: 'var(--cz-blue)', borderRadius: '50%', width: '7px', height: '7px' }, // the row's dot is blue: it waits on you
182
+ title: { fontFamily: SANS, fontSize: '14px', fontWeight: '700', color: 'var(--cz-ink)' },
183
+ subject: { fontFamily: SANS, fontSize: '12px', color: 'var(--cz-blueink)' },
184
+ event: { fontFamily: SANS, color: 'var(--cz-ink)', backgroundColor: 'var(--cz-card)', borderTopColor: 'var(--cz-hair)' },
185
+ eventTime: { fontSize: '12.5px', color: 'var(--cz-ink2)' },
186
+ eventTitle: { fontFamily: SANS, fontSize: '13.5px', fontWeight: '700', color: 'var(--cz-ink)' },
187
+ };
188
+ const grab = (pg, pairs, base, col) => pg.evaluate(([pairs, want, base, col]) => {
189
+ const o = {};
190
+ const probe = document.createElement('div'); document.body.appendChild(probe);
191
+ const resolve = (k, v) => { if (!/^var\(/.test(v) && v !== 'transparent') return v; probe.removeAttribute('style'); probe.style.position = 'absolute'; probe.style.visibility = 'hidden'; probe.style.setProperty(k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase()), v); return getComputedStyle(probe)[k]; };
192
+ const root = document.querySelectorAll(base)[base.includes('n:src:') ? 1 : 0];
193
+ for (const [n, s] of pairs) {
194
+ const e = !root ? null : s ? root.querySelector(s) : root;
195
+ if (!e) { o[n] = null; continue; }
196
+ const cs = getComputedStyle(e), v = {};
197
+ for (const [k, w] of Object.entries(want[n])) v[k] = [resolve(k, w), cs[k]];
198
+ o[n] = v;
199
+ }
200
+ probe.remove();
201
+ const c = root && root.closest(col);
202
+ o.fit = [c ? Math.round(c.getBoundingClientRect().width) : null, root ? Math.round(root.getBoundingClientRect().width) : null];
203
+ return o;
204
+ }, [pairs, WANT, base, col]);
205
+ const diff = (c, pairs, slack) => {
206
+ const d = [];
207
+ for (const [n] of pairs) { if (!c[n]) { d.push(n + ' missing'); continue; } for (const [k, [want, got]] of Object.entries(c[n])) if (want !== got) d.push(`${n}.${k} ${want} | ${got}`); }
208
+ const [col, got] = c.fit; if (col == null || got == null || got < col - slack || got > col + 2) d.push(`width fills ${col} | ${got}`);
209
+ return d;
210
+ };
166
211
  for (const [w, h] of [[1280, 900], [390, 844]]) for (const th of ['light', 'dark']) {
167
- const m = await (await browser.newContext({ viewport: { width: w, height: h } })).newPage();
168
- await m.goto('file://' + MOCKUP); await CT.applyToPage(m, CT_VENDOR);
169
- await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 1 && document.querySelectorAll('#tl .ev').length > 0));
170
- await m.evaluate((t) => { document.documentElement.dataset.theme = t; }, th);
171
212
  const R = await open({ w, h, theme: th });
172
- if (w === 390) { await R.page.click('#todayCard .folds').catch(() => {}); await R.page.evaluate(() => scrollTo(0, 0)); } // the Calendar card starts hidden on a phone (premium-calendar-card); measure it open
173
- await R.page.evaluate(() => { window.__ev = (s) => { const d = document.querySelector('#tl .ev.src-digest'); return !d ? null : / time$/.test(s) ? d.querySelector('time') : / b$/.test(s) ? d.querySelector('b') : d; }; });
213
+ if (w === 390) await R.page.click('#hmNeeds'); // on a phone the list is the "N need you" sheet
214
+ await allNeeds(R.page);
174
215
  await sleep(500);
175
- const a = await grab(m, PAIRS), c = await grab(R.page, PAIRS), diffs = [];
176
- for (const [n] of PAIRS) {
177
- if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
178
- for (const k of Object.keys(a[n])) {
179
- if (k === 'left' || k === 'width') { if (['row', 'number', 'title', 'subject', 'event', 'eventTime', 'eventTitle'].includes(n) && (k === 'left' || n !== 'row' && n !== 'event' && n !== 'eventTime')) continue; }
180
- if ((k === 'left' || k === 'width') ? 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]}`);
181
- }
182
- }
183
- ok(`S11 the source row and the digest look like the mockup's at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
216
+ const rowSel = '#hmList .hm-r[data-id^="n:src:"]';
217
+ const diffs = diff(await grab(R.page, ROWS, rowSel, '.hm-g'), ROWS, 4); // the row fills its group (the group's own inset aside)
218
+ if (w === 390) await R.page.keyboard.press('Escape');
219
+ await moreItem(R.page, 'Around you', '#aroundDig');
220
+ await sleep(300);
221
+ diffs.push(...diff(await grab(R.page, DIGS, '#czViewer .ar-dig', '#aroundDig'), DIGS, 2));
222
+ ok(`S11 the source row and the digest look like the Agreed design's at ${w} px, ${th}`, diffs.length === 0, diffs.join(' ; '));
184
223
  const ov = await R.page.evaluate(() => document.documentElement.scrollWidth - innerWidth);
185
224
  ok(`S11 no sideways scroll at ${w} px, ${th}`, ov <= 0, String(ov));
186
- await m.context().close(); await R.ctx.close();
225
+ await R.ctx.close();
187
226
  }
188
227
  }
189
228
  return finish();