create-pmos 0.397.0 → 0.399.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 (195) 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/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +105 -52
  8. package/workspace/briefing-premium-board-test.js +284 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +85 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +99 -83
  13. package/workspace/briefing-premium-initiative-test.js +175 -290
  14. package/workspace/briefing-premium-insights-test.js +414 -219
  15. package/workspace/briefing-premium-metrics-test.js +55 -97
  16. package/workspace/briefing-premium-products-test.js +44 -28
  17. package/workspace/briefing-premium-sources-test.js +70 -49
  18. package/workspace/briefing-premium-test.js +155 -648
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +24 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/board-premium-trail.js +32 -0
  23. package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
  24. package/workspace/guide/briefing-premium.md +3 -1
  25. package/workspace/guide/home.md +68 -0
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/lib/agent-roles.js +71 -0
  28. package/workspace/lib/board-grill.js +63 -0
  29. package/workspace/lib/board-premium.js +121 -24
  30. package/workspace/lib/board-trail.js +223 -0
  31. package/workspace/lib/home-work-item.js +58 -0
  32. package/workspace/lib/initiative-layout.js +77 -0
  33. package/workspace/lib/insights-goals.js +196 -0
  34. package/workspace/lib/insights-premium.js +64 -15
  35. package/workspace/lib/insights-records.js +115 -0
  36. package/workspace/lib/jira-tickets.js +1 -1
  37. package/workspace/lib/meeting-points.js +52 -0
  38. package/workspace/lib/news-for-you.js +88 -0
  39. package/workspace/lib/notes-series.js +29 -6
  40. package/workspace/lib/report-confirm.js +48 -0
  41. package/workspace/lib/route-modules.js +12 -0
  42. package/workspace/lib/routes-board-docs.js +46 -0
  43. package/workspace/lib/routes-board-grill.js +90 -0
  44. package/workspace/lib/routes-board-trail.js +33 -0
  45. package/workspace/lib/routes-home-desk.js +176 -0
  46. package/workspace/lib/routes-home-review.js +108 -0
  47. package/workspace/lib/routes-initiative-layout.js +57 -0
  48. package/workspace/lib/routes-insights-premium.js +16 -4
  49. package/workspace/lib/routes-insights-records.js +133 -0
  50. package/workspace/lib/routes-meeting-points.js +37 -0
  51. package/workspace/lib/routes-news.js +57 -0
  52. package/workspace/lib/routes-notes.js +3 -1
  53. package/workspace/lib/routes-report-confirm.js +31 -0
  54. package/workspace/lib/routes-search.js +38 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/search-index.js +176 -0
  57. package/workspace/lib/transcript-steps.js +123 -0
  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-board-actions-test.js +128 -82
  63. package/workspace/premium-briefing-depth-test.js +104 -90
  64. package/workspace/premium-chat-attach-test.js +54 -63
  65. package/workspace/premium-chat-chart-tab-test.js +37 -37
  66. package/workspace/premium-chat-context-test.js +19 -18
  67. package/workspace/premium-chat-goal-view-test.js +23 -23
  68. package/workspace/premium-chat-notes-test.js +26 -31
  69. package/workspace/premium-chat-report-tab-test.js +46 -28
  70. package/workspace/premium-chat-term-test.js +16 -16
  71. package/workspace/premium-chat-viewer-test.js +60 -59
  72. package/workspace/premium-core-doc-issue-test.js +52 -43
  73. package/workspace/premium-html-viewer-test.js +14 -17
  74. package/workspace/premium-phone-card-test.js +10 -3
  75. package/workspace/premium-phone-room-test.js +41 -35
  76. package/workspace/premium-report-read-test.js +152 -197
  77. package/workspace/premium-viewer-download-test.js +19 -22
  78. package/workspace/premium-viewer-flicker-test.js +11 -16
  79. package/workspace/premium-viewer-share-test.js +6 -9
  80. package/workspace/premium-viewer-test.js +41 -60
  81. package/workspace/premium-vw-backlog-test.js +53 -33
  82. package/workspace/premium-vw-cal-test.js +97 -128
  83. package/workspace/premium-vw-copy-test.js +17 -33
  84. package/workspace/premium-vw-doc-test.js +17 -10
  85. package/workspace/premium-vw-item-test.js +50 -49
  86. package/workspace/premium-vw-jira-test.js +53 -27
  87. package/workspace/premium-vw-meet-test.js +115 -187
  88. package/workspace/premium-vw-notes-test.js +88 -109
  89. package/workspace/premium-vw-rec-test.js +71 -194
  90. package/workspace/premium-vw-slides-test.js +46 -50
  91. package/workspace/premium-welcome-test.js +3 -2
  92. package/workspace/premium-work-depth-test.js +61 -53
  93. package/workspace/public/pm/bd-acts.js +383 -0
  94. package/workspace/public/pm/bd-asks.js +261 -0
  95. package/workspace/public/pm/bd-pop.js +59 -0
  96. package/workspace/public/pm/bd-span.js +222 -82
  97. package/workspace/public/pm/bd-stages.js +25 -11
  98. package/workspace/public/pm/bd-views.js +169 -0
  99. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  100. package/workspace/public/pm/c3-md.js +3 -395
  101. package/workspace/public/pm/c3-phone-detail.js +1 -1
  102. package/workspace/public/pm/c3-phone-model.js +3 -68
  103. package/workspace/public/pm/chat-term.js +3 -3
  104. package/workspace/public/pm/cozy-board.css +798 -230
  105. package/workspace/public/pm/cozy-ev.css +228 -0
  106. package/workspace/public/pm/cozy-evmodel.js +106 -0
  107. package/workspace/public/pm/cozy-evui.js +47 -0
  108. package/workspace/public/pm/cozy-home.css +570 -142
  109. package/workspace/public/pm/cozy-home.js +5 -3
  110. package/workspace/public/pm/cozy-insights.css +437 -170
  111. package/workspace/public/pm/cozy-md.js +396 -0
  112. package/workspace/public/pm/cozy-nav.js +104 -29
  113. package/workspace/public/pm/cozy-news.js +140 -0
  114. package/workspace/public/pm/cozy-placeholder.js +26 -0
  115. package/workspace/public/pm/cozy-search.js +203 -0
  116. package/workspace/public/pm/cozy-settings.js +198 -0
  117. package/workspace/public/pm/cozy-sources.js +89 -0
  118. package/workspace/public/pm/cozy-today.css +217 -0
  119. package/workspace/public/pm/cozy-viewer.css +3 -3
  120. package/workspace/public/pm/cozy-viewer.js +145 -0
  121. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  122. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  123. package/workspace/public/pm/cozy-vw.css +485 -0
  124. package/workspace/public/pm/cozy.css +83 -1
  125. package/workspace/public/pm/home-adddoc.js +48 -0
  126. package/workspace/public/pm/home-app.js +1179 -0
  127. package/workspace/public/pm/home-around.js +413 -0
  128. package/workspace/public/pm/home-chat.js +512 -0
  129. package/workspace/public/pm/home-data.js +312 -0
  130. package/workspace/public/pm/home-dictate.js +54 -0
  131. package/workspace/public/pm/home-draft.js +68 -0
  132. package/workspace/public/pm/home-ini-model.js +190 -0
  133. package/workspace/public/pm/home-ini.css +171 -0
  134. package/workspace/public/pm/home-ini.js +456 -0
  135. package/workspace/public/pm/home-list.js +276 -0
  136. package/workspace/public/pm/home-more.js +132 -0
  137. package/workspace/public/pm/home-phone-card.js +109 -0
  138. package/workspace/public/pm/home-review.js +104 -0
  139. package/workspace/public/pm/home-task.js +67 -0
  140. package/workspace/public/pm/home-today.js +144 -0
  141. package/workspace/public/pm/home-work.js +547 -0
  142. package/workspace/public/pm/phone-moment.js +69 -0
  143. package/workspace/public/pm/pm-work-view.js +1 -1
  144. package/workspace/public/pm/premium-attach.js +4 -0
  145. package/workspace/public/pm/premium-board.js +548 -395
  146. package/workspace/public/pm/premium-chart-tab.js +109 -62
  147. package/workspace/public/pm/premium-deck.js +3 -3
  148. package/workspace/public/pm/premium-first.js +23 -21
  149. package/workspace/public/pm/premium-insights.js +1102 -581
  150. package/workspace/public/pm/premium-meeting.js +61 -549
  151. package/workspace/public/pm/premium-mtg-present.js +138 -0
  152. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  153. package/workspace/public/pm/premium-notes.js +1 -1
  154. package/workspace/public/pm/premium-report-frame.css +20 -0
  155. package/workspace/public/pm/premium-report-read.js +669 -476
  156. package/workspace/public/pm/premium-report-tab.js +116 -67
  157. package/workspace/public/pm/premium-shell.js +76 -123
  158. package/workspace/public/pm/premium-viewer.js +22 -1
  159. package/workspace/public/pm/premium-vw-cal.js +277 -48
  160. package/workspace/public/pm/premium-vw-doc.css +6 -0
  161. package/workspace/public/pm/premium-vw-doc.js +40 -2
  162. package/workspace/public/pm/premium-vw-file.js +2 -2
  163. package/workspace/public/pm/premium-vw-meet.js +6 -83
  164. package/workspace/public/pm/premium-vw-mtg.js +958 -0
  165. package/workspace/public/pm/premium-vw-notes.js +116 -68
  166. package/workspace/public/pm/premium-vw-open.js +35 -0
  167. package/workspace/public/pm/premium-vw-page.js +16 -0
  168. package/workspace/public/pm/premium-vw-rec.js +11 -218
  169. package/workspace/public/pm/premium-vw-slides.css +5 -0
  170. package/workspace/public/pm/premium-vw-slides.js +44 -8
  171. package/workspace/public/pm/rp-parts.js +269 -0
  172. package/workspace/public/pm/term-view.js +22 -0
  173. package/workspace/public/premium-board.html +29 -70
  174. package/workspace/public/premium-initiative.html +8 -48
  175. package/workspace/public/premium-insights.html +26 -64
  176. package/workspace/public/premium-viewer.html +20 -0
  177. package/workspace/public/premium.html +18 -107
  178. package/workspace/r/m1.png +0 -0
  179. package/workspace/r/m2.png +0 -0
  180. package/workspace/r/m3.png +0 -0
  181. package/workspace/r/nl.png +0 -0
  182. package/workspace/server.js +18 -3
  183. package/workspace/test-files.json +1 -0
  184. package/workspace/test-lists/home-libs.json +9 -0
  185. package/workspace/test-lists/initiative-layout.json +9 -0
  186. package/workspace/test-lists/premium-report-read.json +1 -1
  187. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  188. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  189. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  190. package/workspace/test-lists/premium-vw-notes.json +1 -1
  191. package/workspace/test-lists/uf-everywhere.json +15 -0
  192. package/workspace/test-lists/uf-home.json +9 -0
  193. package/workspace/test-lists/uncovered-board.json +9 -0
  194. package/workspace/public/pm/premium-work.js +0 -729
  195. package/workspace/public/pm/premium.js +0 -1146
@@ -3,7 +3,8 @@
3
3
  /* premium-core-doc-issue-test.js — Issue it on a core document draft, on the premium Board and the premium initiative page (initiative premium-core-doc-issue;
4
4
  * planning/prd/premium-core-doc-issue-prd.md I1 to I7). A real server on a scratch `team` repository, never the PMOS checkout. The drafts are written by the
5
5
  * core-docs writer (lib/core-docs.js writeDraft), so the pages read what the agent's run would leave. The real pages press the real route:
6
- * R reading (slot and path) · B the Board reader and Issue it · I the initiative sheet, unsaved edits and a refusal · P the POST allow-list · F floors */
6
+ * R reading (slot and path) · B the Board reader and Issue it · I the initiative (a layout in Home since premium-agreed-design: its Overview, the draft
7
+ * reader in the Viewer), unsaved edits and a refusal · P the POST allow-list · F floors */
7
8
  const fs = require('fs');
8
9
  const path = require('path');
9
10
  const { spawn } = require('child_process');
@@ -34,7 +35,7 @@ const finish = async (code) => {
34
35
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
35
36
 
36
37
  const ledger = () => { const f = CD.ledgerFile(team); return fs.existsSync(f) ? fs.readFileSync(f, 'utf8').split('\n').filter(Boolean).map((x) => JSON.parse(x)) : []; };
37
- const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note|doc-health\/check)$/;
38
+ const ALLOWED = /^\/api\/(?:core-docs\/issue|briefing-premium\/note|briefing-premium\/seen|doc-health\/check)$/; // seen: Home records what it showed, not a press
38
39
  const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers.\n';
39
40
 
40
41
  (async () => {
@@ -81,66 +82,73 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
81
82
  if (theme === 'dark') await page.evaluate(() => { document.documentElement.dataset.theme = 'dark'; });
82
83
  return { ctx, page, errors, posts };
83
84
  };
84
- const dlgOn = async (p) => { const v = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800); return v; };
85
+ const dlgOn = async (p) => { const v = await until(() => p.evaluate(() => !!document.querySelector('#dlg.on'))); await sleep(800); return v; };
85
86
  const toastIs = (p, re) => until(() => p.evaluate((s) => { const t = document.querySelector('#toast'); return t.classList.contains('on') && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
86
87
  const H = await T.pressHeaders(BASE);
87
88
  const nonce = H['x-pmos-nonce'];
88
89
 
89
- /* B the Board reader */
90
+ /* B the Board reader (premium-uncovered-features, BdDocs: the Documents tab is a table; a row's title opens the document in the side panel,
91
+ with its health, edit log, the file's text and the Issue it bar) */
92
+ const bToast = (p, re) => until(() => p.evaluate((s) => { const t = document.querySelector('#bdToast'); return t && !t.hidden && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
90
93
  const P = await open('/premium-board.html'), p = P.page;
91
- ok('B1 a board document with a file is a button that opens the reader', await until(() => p.evaluate((k) => !!document.querySelector(`#docBody [data-doc="${k}"]`), bkey)));
92
- ok('B1 a document with no file is not', await p.evaluate((k) => !document.querySelector('#docBody .dmo:not(button)') || [...document.querySelectorAll('#docBody .dmo:not(button)')].every((x) => !x.closest('.dmr').querySelector(`[data-doc="${k}"]`)), bkey));
93
- await p.click('#tabDocs'); // the Agreed design shows the documents on the Documents tab (premium-agreed-design)
94
- await p.click(`#docBody [data-doc="${bkey}"]`); await dlgOn(p);
95
- ok('B2 the reader shows the file\'s text and path, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#oMain'); return /Why this board exists/.test(o.textContent) && !!o.querySelector('[data-ds="meta"]') && !!o.querySelector('[data-issue-bar="draft"]') && /Nothing is sent/.test(o.querySelector('[data-issue-bar]').textContent) && !!o.querySelector('[data-ds="issue"]'); }, d1.path)), await p.evaluate(() => document.querySelector('#oMain').textContent));
96
- ok('B2 the path is behind the file chip, not in the way', await p.evaluate((pt) => !document.querySelector('#oMain .dsmeta') && !!document.querySelector('#oMain [data-ds="meta"]'), d1.path) && (await p.click('#oMain [data-ds="meta"]'), await p.evaluate((pt) => document.querySelector('#oMain .dsmeta').textContent.includes(pt), d1.path)));
97
- ok('B2 the reader has the sheet\'s view menu, as the initiative page does', await p.evaluate(() => !!document.querySelector('#oMain #shV')));
94
+ await until(() => p.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 60000);
95
+ await p.click('#tabDocs');
96
+ ok('B1 a board document is a row whose title opens the reader', await until(() => p.evaluate((k) => !!document.querySelector(`#docBody [data-opendoc="core:${k}"]`), bkey), 60000));
97
+ ok('B1 every document row has a title that opens it', await p.evaluate(() => [...document.querySelectorAll('#docBody .bd-dt[data-docrow]')].every((r) => !!r.querySelector('[data-opendoc]'))));
98
+ await p.click(`#docBody [data-opendoc="core:${bkey}"]`);
99
+ ok('B2 the reader shows the file\'s text and path, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#peek'); return !o.hidden && /Why this board exists/.test(o.textContent) && o.textContent.includes(pt) && !!o.querySelector('[data-issue-bar="draft"]') && /Nothing is sent/.test(o.querySelector('[data-issue-bar]').textContent) && !!o.querySelector('[data-act="issue"]'); }, d1.path)), await p.evaluate(() => document.querySelector('#peek').textContent));
100
+ ok('B2 no old dialog opens', await p.evaluate(() => !!!document.querySelector('#dlg.on')));
98
101
  const n0 = ledger().filter((l) => l.ev === 'issue').length;
99
- await p.click('[data-ds="issue"]');
100
- ok('B3 Issue it says it sent nothing', !!(await toastIs(p, /Issued\. Nothing was sent to anyone/)));
102
+ await p.click('#peek [data-act="issue"]');
103
+ ok('B3 Issue it says it sent nothing', !!(await bToast(p, /Issued\. Nothing was sent to anyone/)));
101
104
  const sent = P.posts.filter((x) => x.path === '/api/core-docs/issue');
102
105
  ok('B4 it posted the workspace, the scope, the key and the slot, and nothing else, with the launch nonce', sent.length === 1 && Object.keys(sent[0].body).sort().join() === 'key,scope,slot,ws' && sent[0].body.scope === bscope && sent[0].body.key === bkey && sent[0].body.slot === d1.slot && sent[0].body.ws === B.ws && sent[0].headers['x-pmos-nonce'] === nonce && !!nonce, JSON.stringify(sent));
103
106
  const il = ledger().filter((l) => l.ev === 'issue');
104
107
  ok('B5 the ledger has one new issue line for that draft, written by the PM', il.length === n0 + 1 && il[il.length - 1].slot === d1.slot && il[il.length - 1].scope === bscope && /pm/.test(String(il[il.length - 1].by)), JSON.stringify(il));
105
108
  ok('B5 the file now says state: issued', /^state: issued$/m.test(fs.readFileSync(path.join(team, d1.path), 'utf8')));
106
- ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#oMain'); return !!o.querySelector('[data-issue-bar="done"]') && !o.querySelector('[data-ds="issue"]') && /state: issued|issued/.test(o.textContent); })) && await until(() => p.evaluate((k) => { const r = document.querySelector(`#docBody [data-doc="${k}"]`); return r && /Up to date/.test(r.textContent); }, bkey)));
109
+ ok('B6 the reader says it is issued, the Issue it press is gone, and the row reads Up to date', await until(() => p.evaluate(() => { const o = document.querySelector('#peek'); return !o.hidden && !!o.querySelector('[data-issue-bar="done"]') && !o.querySelector('[data-act="issue"]'); }), 30000) && await until(() => p.evaluate((k) => { const r = document.querySelector(`#docBody [data-docrow="core:${k}"]`); return r && /Up to date/.test(r.textContent); }, bkey), 30000), await p.evaluate(() => document.querySelector('#peek').textContent + ' // ' + document.querySelector('#docBody').textContent));
107
110
  await p.screenshot({ path: path.join(R.base, 'board-issued.png') });
108
111
  await P.ctx.close();
109
112
 
110
- /* I the initiative sheet */
113
+ /* I the initiative: a layout inside Home (premium-agreed-design). The Board's expand link lands there; the card's Overview lists the core documents (its Documents view),
114
+ and a draft opens a minimal reader in the Viewer (Waiting for design) with the Issue it bar, Read and Edit */
115
+ const ovOpen = async (p) => { await until(() => p.evaluate(() => !!document.querySelector('.hm-card [data-hm-ov]')), 60000); await p.click('.hm-card [data-hm-ov]');
116
+ // the Overview opens on Tasks; the core documents are its Documents view (premium-uncovered-features, canvas InDocs)
117
+ if (await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-hi-view="docs"]')), 30000)) await p.click('#czViewer [data-hi-view="docs"]'); };
111
118
  const I = await open('/premium-initiative.html' + iq), ip = I.page;
112
- await until(() => ip.evaluate((k) => !!document.querySelector(`#dmList [data-doc="${k}"]`), ikey), 60000);
113
- await ip.click(`#dmList [data-doc="${ikey}"]`); await dlgOn(ip);
114
- ok('I1 the Read tab of a draft has the Issue it bar above the text', await until(() => ip.evaluate(() => { const o = document.querySelector('#oMain'); const b = o.querySelector('[data-issue-bar="draft"]'); return !!b && /Nothing is sent/.test(b.textContent) && /Why this board exists/.test(o.textContent) && b.compareDocumentPosition(o.querySelector('.dsbody')) & Node.DOCUMENT_POSITION_FOLLOWING; })));
115
- await ip.click('#shV'); await ip.click('[data-sh="edit"]');
116
- await until(() => ip.evaluate(() => !!document.querySelector('#dsEd')));
117
- await ip.fill('#dsEd', BODY + '\n## Added\n\nUnsaved line.\n');
118
- await ip.click('#shV'); await ip.click('[data-sh="read"]');
119
- await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
120
- const nI = I.posts.length;
121
- await ip.click('[data-ds="issue"]');
122
- ok('I2 Issue it with unsaved edits posts nothing and says to save or cancel first', await until(() => ip.evaluate(() => /unsaved changes.*Save or cancel/.test((document.querySelector('#dsErr') || {}).textContent || ''))) && I.posts.length === nI);
119
+ await ovOpen(ip);
120
+ await until(() => ip.evaluate((k) => !!document.querySelector(`#czViewer [data-ov-dread="${k}"]`), ikey), 60000);
121
+ await ip.click(`#czViewer [data-ov-dread="${ikey}"]`);
122
+ ok('I1 the reader of a draft has the Issue it bar above the text', await until(() => ip.evaluate(() => { const o = document.querySelector('#czViewer:not([hidden])'); const b = o && o.querySelector('[data-issue-bar="draft"]'); const t = o && o.querySelector('.dsbody'); return !!b && !!t && /Nothing is sent/.test(b.textContent) && /Why this board exists/.test(t.textContent) && !!(b.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING); }), 30000));
123
+ ok('I1 no old dialog opens', await ip.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
124
+ await ip.click('#czViewer [data-ds="edit"]');
125
+ await until(() => ip.evaluate(() => !!document.querySelector('#czViewer [data-ds-host] .cfb[contenteditable="true"]')), 30000);
126
+ await ip.click('#czViewer [data-ds-host] .cfb'); await ip.keyboard.press('Control+End'); await ip.keyboard.type(' Unsaved line.');
127
+ const nI = I.posts.filter((x) => x.path === '/api/core-docs/issue').length;
128
+ await ip.click('#czViewer [data-ds="issue"]');
129
+ ok('I2 Issue it with unsaved edits posts nothing and says to save or cancel first', await until(() => ip.evaluate(() => /unsaved changes.*Save or cancel/.test((document.querySelector('#czViewer #dsErr') || {}).textContent || ''))) && I.posts.filter((x) => x.path === '/api/core-docs/issue').length === nI);
123
130
  ok('I2 the ledger has no issue line for that draft yet', !ledger().some((l) => l.ev === 'issue' && l.slot === d2.slot && l.scope === iscope));
124
- await ip.click('#shV'); await ip.click('[data-sh="edit"]'); await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="discard"]')));
125
- await ip.click('[data-ds="discard"]'); await ip.click('#shV'); await ip.click('[data-sh="read"]');
126
- await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
131
+ await ip.click('#czViewer [data-vd="cancel"]');
132
+ await until(() => ip.evaluate(() => !!document.querySelector('#czViewer [data-ds="issue"]') && !!document.querySelector('#czViewer .dsbody')));
127
133
  /* a refusal: someone else issues the same draft first (the console, a second tab) */
128
134
  const raced = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: H, body: JSON.stringify({ ws: B.ws, scope: iscope, key: ikey, slot: d2.slot }) });
129
135
  ok('I3 setup the draft is issued behind the page\'s back', raced.status === 200);
130
- await ip.click('[data-ds="issue"]');
131
- ok('I3 a refused press shows the server\'s words and the sheet changes nothing else', await until(() => ip.evaluate(() => /already/.test((document.querySelector('#dsErr') || {}).textContent || ''))));
136
+ await ip.click('#czViewer [data-ds="issue"]');
137
+ ok('I3 a refused press shows the server\'s words and the reader changes nothing else', await until(() => ip.evaluate(() => /already/.test((document.querySelector('#czViewer #dsErr') || {}).textContent || '') && !!document.querySelector('#czViewer [data-issue-bar="draft"]'))));
132
138
  ok('I3 the refusal wrote no second issue line', ledger().filter((l) => l.ev === 'issue' && l.slot === d2.slot && l.scope === iscope).length === 1);
133
- await ip.click('#dlg [data-act="close"], #dClose').catch(() => {});
134
139
  await I.ctx.close();
135
140
 
136
141
  /* I4 a fresh page: press Issue it on the third draft */
137
142
  const J = await open('/premium-initiative.html' + iq), jp = J.page;
138
143
  const k3 = d3.path.split('/').slice(-2)[0];
139
- await until(() => jp.evaluate((k) => !!document.querySelector(`#dmList [data-doc="${k}"]`), k3), 60000);
140
- await jp.click(`#dmList [data-doc="${k3}"]`); await dlgOn(jp);
141
- await until(() => jp.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
142
- await jp.click('[data-ds="issue"]');
143
- ok('I4 Issue it works from the sheet: the toast, the issued bar, and the row reads Up to date', !!(await toastIs(jp, /Issued\. Nothing was sent to anyone/)) && await until(() => jp.evaluate(() => !!document.querySelector('#oMain [data-issue-bar="done"]') && !document.querySelector('[data-ds="issue"]'))) && await until(() => jp.evaluate((k) => /Up to date/.test((document.querySelector(`#dmList [data-doc="${k}"]`) || {}).textContent || ''), k3)));
144
+ await ovOpen(jp);
145
+ await until(() => jp.evaluate((k) => !!document.querySelector(`#czViewer [data-ov-dread="${k}"]`), k3), 60000);
146
+ await jp.click(`#czViewer [data-ov-dread="${k3}"]`);
147
+ await until(() => jp.evaluate(() => !!document.querySelector('#czViewer [data-ds="issue"]')));
148
+ await jp.click('#czViewer [data-ds="issue"]');
149
+ const issued = !!(await toastIs(jp, /Issued\. Nothing was sent to anyone/)) && await until(() => jp.evaluate(() => !!document.querySelector('#czViewer [data-issue-bar="done"]') && !document.querySelector('#czViewer [data-ds="issue"]')));
150
+ await sleep(1500); await ovOpen(jp);
151
+ ok('I4 Issue it works from the reader: the toast, the issued bar, and the Overview row reads Up to date', issued && await until(() => jp.evaluate((k) => /Up to date/.test((document.querySelector(`#czViewer [data-ov-doc="${k}"]`) || {}).textContent || ''), k3), 30000));
144
152
  ok('I4 the file says state: issued and the ledger has its issue line', /^state: issued$/m.test(fs.readFileSync(path.join(team, d3.path), 'utf8')) && ledger().some((l) => l.ev === 'issue' && l.slot === d3.slot && l.scope === iscope));
145
153
  await jp.screenshot({ path: path.join(R.base, 'ini-issued.png') });
146
154
 
@@ -162,12 +170,13 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
162
170
  const k4 = d4.path.split('/').slice(-2)[0];
163
171
  for (const [w, h, theme] of [[390, 844, 'light'], [390, 844, 'dark'], [1280, 900, 'dark']]) {
164
172
  const S = await open('/premium-board.html', { w, h, theme });
165
- await until(() => S.page.evaluate((k) => !!document.querySelector(`#docBody [data-doc="${k}"]`), k4), 60000);
166
- await S.page.click('#tabDocs'); // the Agreed design shows the documents on the Documents tab (premium-agreed-design)
167
- await S.page.click(`#docBody [data-doc="${k4}"]`); await dlgOn(S.page);
168
- await until(() => S.page.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
169
- const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#oMain [data-ds="issue"], #oMain [data-ds="again"]')].filter((b) => b.getBoundingClientRect().height < 44 || b.getBoundingClientRect().width < 44).map((b) => b.dataset.ds), bg: getComputedStyle(document.querySelector('[data-issue-bar]')).backgroundColor }));
170
- ok(`F1 ${w} px ${theme}: no sideways scroll and the bar's buttons are at least 44 px`, !f.wide && !f.small.length, JSON.stringify(f));
173
+ await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0), 60000);
174
+ await S.page.click(w <= 720 ? '#chDocs' : '#tabDocs');
175
+ await until(() => S.page.evaluate((k) => !!document.querySelector(`#docBody [data-opendoc="core:${k}"]`), k4), 60000);
176
+ await S.page.click(`#docBody [data-opendoc="core:${k4}"]`);
177
+ await until(() => S.page.evaluate(() => !!document.querySelector('#peek [data-act="issue"]')));
178
+ const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#peek [data-act="issue"]')].filter((b) => b.getBoundingClientRect().height < (innerWidth <= 720 ? 44 : 34)).map((b) => b.textContent) }));
179
+ ok(`F1 ${w} px ${theme}: no sideways scroll and the bar's button is 44 px on a phone`, !f.wide && !f.small.length, JSON.stringify(f));
171
180
  await S.page.screenshot({ path: path.join(R.base, `bar-${w}-${theme}.png`) });
172
181
  await S.ctx.close();
173
182
  }
@@ -78,26 +78,23 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
78
78
  const f = FILES[new URL(r.request().url()).searchParams.get('path')];
79
79
  return r.fulfill({ status: 200, contentType: f.kind === 'markdown' ? 'text/markdown' : 'text/plain', headers: { 'X-Doc-Kind': f.kind }, body: f.text });
80
80
  });
81
- await page.goto(BASE + '/premium.html?theme=' + theme);
82
- await until(() => page.evaluate(() => !!document.querySelector('#dlg')), 15000);
83
- await page.evaluate(async () => {
84
- const S = await import('/pm/premium-shell.js');
85
- S.openDlg({ eye: 'Your item', title: 'Check GA Lightbox', say: 'The report is now an HTML file in the repo.', noteKey: null, pane: '<article class="paper doc"><p>Item record</p></article>', label: 'Item record' });
86
- });
81
+ // premium-agreed-design: a chat is Home's own (?about= names the conversation, as a list row does) and a file opens in the Viewer card
82
+ await page.goto(BASE + '/premium.html?about=work:html-test&theme=' + theme);
83
+ await until(() => page.evaluate(() => !!document.querySelector('#hmLog') && !!document.querySelector('#hmFoot textarea')), 15000);
87
84
  return { ctx, page, errors, out };
88
85
  };
89
86
  const press = (page, file) => page.evaluate((f) => {
90
87
  const b = document.createElement('button'); b.type = 'button'; b.className = 'fpath'; b.dataset.file = f; b.textContent = f;
91
- document.querySelector('#dBody .stream').append(b); b.click();
88
+ document.querySelector('#hmLog').append(b); b.click();
92
89
  }, file);
93
90
  const HTMLF = 'pmos/state/reports/lightbox-password-conversion/2026-10-19.html';
94
- const frameOf = async (page) => { const h = await until(() => page.$('#dOut .obody.vw iframe.vwframe'), 8000); return h ? h.contentFrame() : null; };
91
+ const frameOf = async (page) => { const h = await until(() => page.$('#czViewer .obody.vw iframe.vwframe'), 8000); return h ? h.contentFrame() : null; };
95
92
 
96
93
  if (TAG === 'after') {
97
94
  const { page, errors, out, ctx } = await open();
98
95
  await press(page, HTMLF);
99
96
  const fr = await frameOf(page);
100
- ok('H1 the .html file opens as a frame, not as code', !!fr && !(await page.$('#dOut .obody.vw .cb')));
97
+ ok('H1 the .html file opens as a frame, not as code', !!fr && !(await page.$('#czViewer .obody.vw .cb')));
101
98
  const st = fr && await until(() => fr.evaluate(() => (document.body && document.body.dataset.net ? { mode: document.compatMode, title: document.title, rows: document.querySelectorAll('.row').length, m: document.body.dataset.mode, parent: document.body.dataset.parent, store: document.body.dataset.store, net: document.body.dataset.net, h1: (document.querySelector('h1') || {}).textContent } : null)), 8000);
102
99
  ok('H1 the page renders in standards mode with its own title and bars', st && st.mode === 'CSS1Compat' && st.h1 === 'Password Conversion Funnel' && st.rows === 6 && st.m === 'events', JSON.stringify(st));
103
100
  // the press goes through the page's own handler; a click by coordinates can land on the viewer while it is still laying out
@@ -107,19 +104,19 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
107
104
  ok('H1 the page\'s own script runs: its toggle redraws the bars', after === '1,310 · 100%', after || why);
108
105
  ok('H2 the page cannot read the app, its storage or the network', st && st.parent === 'blocked' && st.store === 'blocked' && st.net === 'blocked', JSON.stringify(st));
109
106
  ok('H2 nothing leaves the machine: the CSP refuses the remote font', out.length === 0, out.join(' '));
110
- const bar = await page.evaluate(() => [...document.querySelectorAll('#dOut .obody.vw [data-fv]')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')).join());
107
+ const bar = await page.evaluate(() => [...document.querySelectorAll('#czViewer .obody.vw [data-fv]')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')).join());
111
108
  ok('H3 the bar offers Page and Source, Page pressed', bar === 'Page:true,Source:false', bar);
112
- await page.click('#dOut .obody.vw [data-fv="source"]');
113
- const src = await until(() => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw .cb pre'); return p ? { head: p.textContent.slice(0, 15), frame: !!document.querySelector('#dOut .obody.vw iframe') } : null; }), 4000);
109
+ await page.click('#czViewer .obody.vw [data-fv="source"]');
110
+ const src = await until(() => page.evaluate(() => { const p = document.querySelector('#czViewer .obody.vw .cb pre'); return p ? { head: p.textContent.slice(0, 15), frame: !!document.querySelector('#czViewer .obody.vw iframe') } : null; }), 4000);
114
111
  ok('H3 Source shows the file\'s text', src && src.head === '<!doctype html>' && !src.frame, JSON.stringify(src));
115
- await page.click('#dOut .obody.vw [data-fv="page"]');
112
+ await page.click('#czViewer .obody.vw [data-fv="page"]');
116
113
  ok('H3 Page brings the page back', !!(await frameOf(page)));
117
114
  await press(page, 'pmos/state/reports/lightbox-password-conversion/2026-10-19.md');
118
- const md = await until(() => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden]) .cfb'); return p && p.querySelector('strong') ? p.innerHTML : null; }), 6000);
115
+ const md = await until(() => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw .cfb'); return p && p.querySelector('strong') ? p.innerHTML : null; }), 6000);
119
116
  ok('H4 a markdown file still opens as a page', md && /<strong>sign-up<\/strong>/.test(md), md);
120
117
  await press(page, 'workspace/lib/a.js');
121
- const js = await until(() => page.evaluate(() => { const p = document.querySelector('#dOut .obody.vw:not([hidden]) .cb'); return p ? p.dataset.lang + ':' + p.querySelector('pre').textContent : null; }), 6000);
122
- ok('H4 a plain text file still opens as code, with no Page and Source bar', js === 'js:const a = 1;\n' && !(await page.$('#dOut .obody.vw:not([hidden]) [data-fv]')), js);
118
+ const js = await until(() => page.evaluate(() => { const p = document.querySelector('#czViewer:not([hidden]) .obody.vw .cb'); return p ? p.dataset.lang + ':' + p.querySelector('pre').textContent : null; }), 6000);
119
+ ok('H4 a plain text file still opens as code, with no Page and Source bar', js === 'js:const a = 1;\n' && !(await page.$('#czViewer:not([hidden]) .obody.vw [data-fv]')), js);
123
120
  ok('H4 no page errors', errors.length === 0, errors.join(' | '));
124
121
  await ctx.close();
125
122
  }
@@ -130,7 +127,7 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
130
127
  const fr = await frameOf(page);
131
128
  if (fr) await until(() => fr.evaluate(() => document.querySelectorAll('.row').length === 6), 6000);
132
129
  else await sleep(1500);
133
- const geo = await page.evaluate(() => { const f = document.querySelector('#dOut .obody.vw iframe'), r = f && f.getBoundingClientRect(); const pe = f && f.parentElement, ps = pe && getComputedStyle(pe), b = pe && { width: pe.clientWidth - parseFloat(ps.paddingLeft) - parseFloat(ps.paddingRight) }; return r ? { w: Math.round(r.width), h: Math.round(r.height), col: Math.round(b.width), sx: document.documentElement.scrollWidth - innerWidth } : null; });
130
+ const geo = await page.evaluate(() => { const f = document.querySelector('#czViewer .obody.vw iframe'), r = f && f.getBoundingClientRect(); const pe = f && f.parentElement, ps = pe && getComputedStyle(pe), b = pe && { width: pe.clientWidth - parseFloat(ps.paddingLeft) - parseFloat(ps.paddingRight) }; return r ? { w: Math.round(r.width), h: Math.round(r.height), col: Math.round(b.width), sx: document.documentElement.scrollWidth - innerWidth } : null; });
134
131
  // re-pointed for premium-agreed-design: on a desktop Home the Viewer sits in the docked chat's column (about 330 px at 1280), so the frame
135
132
  // must fill its file card's content box and keep a readable 300 px, rather than a fixed 500 px that only the old full-width dialog had
136
133
  ok(`H1 at ${w} ${theme} the frame fills the viewer's width and has room to read`, geo && geo.w >= 300 && geo.w >= geo.col - 2 && geo.h >= 400 && geo.sx <= 0, JSON.stringify(geo));
@@ -5,6 +5,10 @@
5
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
6
  * because they need a clock and a day of meetings. Done and Reopen press the real routes on real items.
7
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
+ * premium-agreed-design: the Agreed design has no place for the card, so Home keeps it usable at the top of the phone's "N need you" sheet
9
+ * (home-phone-card.js); premium-uncovered-features made it the Today card at the top of the phone's list (canvas HmPhone, HmPhone2), with
10
+ * no "Waiting for design" marker and no sheet to open. Open the meeting opens it in the cozy Viewer from the
11
+ * day's own record (Home's meeting line does the same), so O2 now checks that it never falls back to the old dialog.
8
12
  * Set PHONE_CARD_SHOTS=<dir> to save screenshots of each moment at 390 wide, light and dark. */
9
13
  const fs = require('fs');
10
14
  const path = require('path');
@@ -60,6 +64,7 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
60
64
  return json(r, { ok: true, view: u.searchParams.get('view') || 'quarter', cells: [], gantt: [], no_plan: 0, strategy: [], today: DATE });
61
65
  });
62
66
  await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
67
+ if (width < 641) await until(() => p.evaluate(() => !!document.querySelector('#hmList'))); // the card is the Today card at the top of the phone's list (canvas HmPhone)
63
68
  p.__posts = posts; p.__gets = gets; p.__errs = errs; p.__ctx = ctx;
64
69
  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
70
  return p;
@@ -116,12 +121,13 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
116
121
  p = await scene({ time: at(10, 20), today: [A], week: hit });
117
122
  await wait(p, /Under way/);
118
123
  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'))));
124
+ ok('O1 Open the meeting opens the meeting in the Viewer', await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && /Partner sync/.test(v.textContent); })));
120
125
  await p.__ctx.close();
121
126
  p = await scene({ time: at(10, 20), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
122
127
  await wait(p, /Under way/);
123
128
  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'))));
129
+ await sleep(800);
130
+ ok('O2 when the calendar does not list it, the meeting still opens from the day\'s record, never in the old dialog and never the console', await p.evaluate(() => !document.querySelector('#dlg.on') && !!document.querySelector('#czViewer:not([hidden])') && /\/premium\.html$/.test(location.pathname)));
125
131
  await p.__ctx.close();
126
132
 
127
133
  /* D: Done and Undo, on a real item */
@@ -156,7 +162,8 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
156
162
  p = await scene({ time: at(18, 0), today: [A], width: 1280 });
157
163
  await sleep(1500);
158
164
  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());
165
+ // premium-uncovered-features: Home reads /api/phone-day once at every width for the end-of-day Today card (canvas HmDay); the phone card never reads it at 1280
166
+ ok('W2 at 1280 wide only Home\'s own read asks for phone-day, once', p.__gets.filter((g) => g === '/api/phone-day').length <= 1, p.__gets.join());
160
167
  ok('W3 nothing is written on load', p.__posts.length === 0, JSON.stringify(p.__posts));
161
168
  await p.__ctx.close();
162
169
 
@@ -3,10 +3,12 @@
3
3
  /* premium-phone-room-test.js — Focus on a phone (Wawan, 2026-10-21: the scroll area is too small; then "UI broken. Better to have manual CTA to
4
4
  * Focus" after the automatic hiding misdrew the page with the keyboard up). A real server on a scratch repository (c3-scan-fixture.js); the
5
5
  * conversation is filled in the page.
6
- * P1 the PM's chat on a phone at rest: since premium-agreed-design (H2, H3) /premium-chat.html opens Home, and on a phone Home's list is the
7
- * page and the chat opens over it as a popup from the head's chat button · P2 scrolling and typing hide nothing · P3 Focus gives the dialog
8
- * the whole screen · P4 a second press brings it all back · P5 a chat dialog opened from script takes the screen, the rail class stays off ·
9
- * P6 a desktop shows no Focus button
6
+ * premium-agreed-design: /premium-chat.html opens Home, and on a phone the chat IS the page under a top bar (no popup, so no Focus button
7
+ * is needed: the conversation already has the screen). The suite keeps the complaint's measure: the conversation's room.
8
+ * P1 at rest the chat is the page: top bar, conversation, composer, and nothing modal over it · P2 scrolling and typing hide nothing
9
+ * P3 the conversation gets the screen below the top bar, more than the old Focus mode's 680 px floor allows for a page with a composer
10
+ * P4 no Focus button and no old dialog · P5 a chat dialog opened from script on another page (Insights still has one) still takes the
11
+ * screen with Focus · P6 a desktop shows no Focus button
10
12
  * Set PHONE_ROOM_SHOTS=<dir> to save the chat at 390 wide, light and dark, at rest and in focus. */
11
13
  const { findBrowser } = require('./lib/find-browser');
12
14
  require('./test-run').configure({ name: 'premium-phone-room' });
@@ -26,13 +28,20 @@ const finish = async (code) => {
26
28
  };
27
29
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
28
30
 
29
- /* the page's own state: the head, the rail and how much of the screen the conversation gets */
31
+ /* the page's own state on Home: the top bar, the conversation's visible room, the composer */
30
32
  const look = () => {
31
- const g = document.querySelector('#dlg'), rail = document.querySelector('.rail').getBoundingClientRect(), body = document.querySelector('#dBody').getBoundingClientRect(), ask = document.querySelector('#askF').getBoundingClientRect(), f = document.querySelector('#dFocus');
32
- return { on: g.classList.contains('on'), modal: g.getAttribute('aria-modal'), behind: ['.rail', 'main.stage'].every((s) => document.querySelector(s).inert), focus: g.classList.contains('focus'), dfocus: document.body.classList.contains('dfocus'), btn: !!f && getComputedStyle(f).display !== 'none', pressed: f && f.getAttribute('aria-pressed'), tabs: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', railTop: Math.round(rail.top), dlgTop: Math.round(g.getBoundingClientRect().top), dlgH: Math.round(g.getBoundingClientRect().height), room: Math.round(ask.top - body.top), vh: innerHeight };
33
+ const top = document.querySelector('#hmTop').getBoundingClientRect(), log = document.querySelector('#hmLog'), lr = log.getBoundingClientRect(), foot = document.querySelector('#hmFoot').getBoundingClientRect();
34
+ const vis = Math.max(0, Math.min(lr.bottom, foot.top, innerHeight) - Math.max(lr.top, top.bottom));
35
+ return { topShown: getComputedStyle(document.querySelector('#hmTop')).display !== 'none' && top.bottom > 0, topTop: Math.round(top.top), room: Math.round(vis), footIn: foot.bottom <= innerHeight + 1 && foot.top >= 0,
36
+ modal: !!document.querySelector('[aria-modal="true"]:not([hidden]):not([inert])'), dlg: !!document.querySelector('#dlg'), btn: !!document.querySelector('#dFocus'), vh: innerHeight, wide: document.documentElement.scrollWidth > innerWidth + 1 };
37
+ };
38
+ const MSGS = [{ role: 'user', text: 'Why did sign-ups drop?', at: '2026-10-21T08:00:00Z' }].concat(Array.from({ length: 14 }, (_, i) => ({ role: i % 2 ? 'user' : 'assistant', text: 'A line of the conversation about the sign-up drop reasons and the counts. '.repeat(3), at: '2026-10-21T08:0' + (i % 10) + ':10Z' })));
39
+ const hand = (dy) => { const b = document.querySelector('#hmLog'); b.dispatchEvent(new WheelEvent('wheel', { deltaY: dy })); b.scrollTop += dy; window.scrollBy(0, dy); };
40
+ const dlgLook = () => {
41
+ const g = document.querySelector('#dlg'), f = document.querySelector('#dFocus');
42
+ return { focus: g.classList.contains('focus'), dfocus: document.body.classList.contains('dfocus'), tabs: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', dlgTop: Math.round(g.getBoundingClientRect().top), dlgH: Math.round(g.getBoundingClientRect().height), vh: innerHeight, btn: !!f };
33
43
  };
34
44
  const fill = () => { const s = document.querySelector('#dBody .stream'); let h = ''; for (let i = 0; i < 14; i++) h += `<div class="turn"><p>${'A line of the conversation about the sign-up drop reasons and the counts. '.repeat(3)}</p></div>`; s.insertAdjacentHTML('beforeend', h); };
35
- const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEvent(new WheelEvent('wheel', { deltaY: dy })); b.scrollTop += dy; };
36
45
 
37
46
  (async () => {
38
47
  const exe = findBrowser();
@@ -46,44 +55,41 @@ const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEve
46
55
  const open = async (width, scheme = 'light', height = 844) => {
47
56
  const ctx = await browser.newContext({ viewport: { width, height }, colorScheme: scheme, hasTouch: true });
48
57
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
49
- await p.goto(chat); await until(() => p.evaluate(() => !!document.querySelector('#rank, #hChat') && /\/premium\.html$/.test(location.pathname)));
50
- if (width < 1000) { await p.click('#hChat'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dGrid').dataset.tab === 'chat')); }
51
- else await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream'))); // a desktop Home docks the chat open
52
- await p.evaluate(fill); await sleep(200);
58
+ await p.route('**/api/briefing-premium/thread**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-room' } }));
59
+ await p.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: MSGS } }));
60
+ await p.goto(chat + '&about=work:room-test');
61
+ await until(() => p.evaluate(() => /\/premium\.html$/.test(location.pathname) && document.querySelectorAll('#hmLog .hm-a, #hmLog .hm-u').length >= 10), 12000);
62
+ await sleep(300);
53
63
  return { p, ctx, errs };
54
64
  };
55
65
 
56
66
  { const { p, ctx, errs } = await open(390);
57
- await until(() => p.evaluate(() => { const g = document.querySelector('#dlg'); return g.getBoundingClientRect().top < innerHeight && !g.getAnimations().some((a) => a.playState === 'running'); })); // the popup's entrance has finished
58
- await sleep(300);
59
67
  const s0 = await p.evaluate(look);
60
- ok('P1 on a phone /premium-chat.html opens Home, and its chat button opens your chat over the list as a modal popup with a Focus button, out of focus', s0.on && s0.modal === 'true' && s0.behind && !s0.focus && !s0.dfocus && s0.btn && s0.pressed === 'false' && s0.dlgTop > 0 && s0.dlgH < s0.vh, JSON.stringify(s0));
61
- await p.evaluate(hand, 300); await sleep(400); await p.evaluate(hand, -100); await p.focus('#askIn'); await sleep(500);
68
+ ok('P1 on a phone /premium-chat.html opens Home with the chat as the page: the top bar, the conversation and the composer, nothing modal over it', s0.topShown && s0.footIn && !s0.modal && s0.room > 0, JSON.stringify(s0));
69
+ await p.evaluate(hand, 300); await sleep(400); await p.evaluate(hand, -100); await p.focus('#hmIn'); await sleep(500);
62
70
  const s1 = await p.evaluate(look);
63
- ok('P2 scrolling and typing hide nothing by themselves', !s1.focus && s1.railTop < s1.vh && s1.dlgH === s0.dlgH, JSON.stringify(s1));
64
- await p.evaluate(() => document.querySelector('#askIn').blur());
71
+ ok('P2 scrolling and typing hide nothing by themselves: the top bar and the composer stay', s1.topShown && s1.footIn && s1.topTop === s0.topTop, JSON.stringify(s1));
72
+ await p.evaluate(() => document.querySelector('#hmIn').blur());
73
+ ok('P3 the conversation gets the screen below the top bar: at least 560 px of the 844 px screen (516 px in the old popup at rest)', s0.room >= 560, JSON.stringify(s0));
65
74
  if (shots) await p.screenshot({ path: `${shots}/chat-rest-390-light.png` });
66
- await p.click('#dFocus');
67
- const s2 = await until(async () => { const v = await p.evaluate(look); return v.focus && v.dlgTop === 0 && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
68
- ok('P3 Focus hides the switch and gives the dialog the whole screen; a popup leaves the page\'s rail class alone', s2.focus && !s2.tabs && !s2.dfocus && s2.pressed === 'true' && s2.dlgTop === 0 && s2.dlgH >= s2.vh - 2, JSON.stringify(s2));
69
- ok('P3b in focus the conversation gets at least 680 px of the 844 px screen (516 px before)', s2.room >= 680, JSON.stringify(s2));
70
- if (shots) await p.screenshot({ path: `${shots}/chat-focus-390-light.png` });
71
- await p.click('#dFocus');
72
- const s3 = await until(async () => { const v = await p.evaluate(look); return !v.focus && v.dlgTop === s0.dlgTop && v.dlgH === s0.dlgH ? v : null; }) || await p.evaluate(look);
73
- ok('P4 a second press gives the screen back: the switch shows and the dialog has its popup size again', !s3.focus && !s3.dfocus && s3.tabs && s3.dlgH === s0.dlgH && s3.dlgTop === s0.dlgTop && s3.pressed === 'false', JSON.stringify(s3));
74
- ok('P4b no page error', errs.length === 0, errs.join(' | '));
75
+ ok('P4 no Focus button and no old dialog on Home', !s0.btn && !s0.dlg, JSON.stringify(s0));
76
+ ok('P4b no page error and no sideways scroll', errs.length === 0 && !s1.wide, errs.join(' | '));
75
77
  await ctx.close(); }
76
78
 
77
- if (shots) { const { p, ctx } = await open(390, 'dark'); await p.screenshot({ path: `${shots}/chat-rest-390-dark.png` }); await p.click('#dFocus'); await sleep(700); await p.screenshot({ path: `${shots}/chat-focus-390-dark.png` }); await ctx.close(); }
79
+ if (shots) { const { p, ctx } = await open(390, 'dark'); await p.screenshot({ path: `${shots}/chat-rest-390-dark.png` }); await ctx.close(); }
78
80
 
79
81
  { const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true }); const p = await ctx.newPage();
80
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!document.querySelector('.rail')));
81
- await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.openDlg({ eye: 'Goal', title: 'Check the sign-up funnel', sub: 'Working · round 1 of 12', html: '<p>detail</p>', say: 'Hello', noteKey: 'work:x' }); m.setTab('chat'); });
82
- await p.evaluate(fill); await sleep(700); await p.click('#dFocus');
83
- const d = await until(async () => { const v = await p.evaluate(look); return v.focus && v.dlgTop === 0 && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
84
- ok('P5 Focus in a chat dialog on another page gives it the whole screen and leaves the page\'s rail alone', d.focus && !d.tabs && !d.dfocus && d.dlgTop === 0 && d.dlgH >= d.vh - 2, JSON.stringify(d));
85
- await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.closeDlg(); m.openDlg({ eye: 'Goal', title: 'Another', html: '<p>x</p>', say: 'Hi', noteKey: 'work:y' }); });
86
- ok('P5b the next dialog opens out of focus', !(await p.evaluate(look)).focus);
82
+ // re-pointed (insights fix): Insights has no old dialog now (Agreed design); an item opened on another page goes to the Viewer card,
83
+ // which on a phone takes the whole screen by itself, so there is no Focus button to press
84
+ await p.goto(`${F.BASE}/premium-insights.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!window.czViewer));
85
+ const vwLook = () => { const v = document.querySelector('#czViewer'); const r = v && !v.hidden ? v.getBoundingClientRect() : null;
86
+ return { dlg: !!document.querySelector('#dlg'), dfocus: !!document.querySelector('#dFocus'), shown: !!r, top: r ? Math.round(r.top) : null, left: r ? Math.round(r.left) : null, w: r ? Math.round(r.width) : 0, h: r ? Math.round(r.height) : 0, vw: innerWidth, vh: innerHeight, title: v ? (v.querySelector('.cz-vw-title') || {}).textContent : '' }; };
87
+ await p.evaluate(() => window.czViewer.open({ kind: 'Goal', title: 'Check the sign-up funnel', html: '<p>detail</p>', id: 'work:x' }));
88
+ const d = await until(async () => { const v = await p.evaluate(vwLook); return v.shown && v.top === 0 && v.h >= v.vh - 2 ? v : null; }) || await p.evaluate(vwLook);
89
+ ok('P5 an item opened on another page gets the whole phone screen, with no old dialog and no Focus button', !d.dlg && !d.dfocus && d.shown && d.top === 0 && d.left === 0 && d.w >= d.vw - 2 && d.h >= d.vh - 2, JSON.stringify(d));
90
+ await p.evaluate(() => { window.czViewer.close(); window.czViewer.open({ kind: 'Goal', title: 'Another', html: '<p>x</p>', id: 'work:y' }); });
91
+ const d2 = await p.evaluate(vwLook);
92
+ ok('P5b the next item opens on its own, in place of the one before', d2.shown && d2.title === 'Another' && d2.h >= d2.vh - 2, JSON.stringify(d2));
87
93
  await ctx.close(); }
88
94
 
89
95
  { const { p, ctx } = await open(1280);