create-pmos 0.397.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 (145) hide show
  1. package/package.json +13 -13
  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 +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -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 +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -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,9 @@
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) with a "Waiting for design" marker; each scene opens the sheet. Open the meeting opens it in the cozy Viewer from the
10
+ * 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
11
  * Set PHONE_CARD_SHOTS=<dir> to save screenshots of each moment at 390 wide, light and dark. */
9
12
  const fs = require('fs');
10
13
  const path = require('path');
@@ -60,6 +63,7 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
60
63
  return json(r, { ok: true, view: u.searchParams.get('view') || 'quarter', cells: [], gantt: [], no_plan: 0, strategy: [], today: DATE });
61
64
  });
62
65
  await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(ws)}`);
66
+ if (width < 641) { await until(() => p.evaluate(() => { const b = document.querySelector('#hmNeeds'); return !!b && b.offsetParent !== null; })); await p.click('#hmNeeds'); } // the card sits at the top of the phone's sheet
63
67
  p.__posts = posts; p.__gets = gets; p.__errs = errs; p.__ctx = ctx;
64
68
  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
69
  return p;
@@ -116,12 +120,13 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
116
120
  p = await scene({ time: at(10, 20), today: [A], week: hit });
117
121
  await wait(p, /Under way/);
118
122
  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'))));
123
+ 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
124
  await p.__ctx.close();
121
125
  p = await scene({ time: at(10, 20), today: [A], week: { ok: true, range: { start: DATE, end: DATE }, cells: [], context: {} } });
122
126
  await wait(p, /Under way/);
123
127
  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'))));
128
+ await sleep(800);
129
+ 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
130
  await p.__ctx.close();
126
131
 
127
132
  /* D: Done and Undo, on a real item */
@@ -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);