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
@@ -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,8 +127,10 @@ 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(); return r ? { w: Math.round(r.width), h: Math.round(r.height), sx: document.documentElement.scrollWidth - innerWidth } : null; });
134
- ok(`H1 at ${w} ${theme} the frame fills the viewer's width and has room to read`, geo && geo.w >= (w < 1000 ? 300 : 500) && geo.h >= 400 && geo.sx <= 0, JSON.stringify(geo));
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; });
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
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
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));
135
134
  if (SHOTS) { fs.mkdirSync(SHOTS, { recursive: true }); await sleep(300); await page.screenshot({ path: path.join(SHOTS, `${TAG}-${w}-${theme}.png`) }); }
136
135
  await ctx.close();
137
136
  }
@@ -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 */
@@ -169,6 +174,7 @@ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'applicati
169
174
  return { over: document.documentElement.scrollWidth > innerWidth + 1, small: bs.filter((b) => b.getBoundingClientRect().height < 43.5).length, buttons: bs.length, colour: getComputedStyle(c.querySelector('.phbig')).color, bg: getComputedStyle(c).backgroundColor, edge: getComputedStyle(c).boxShadow };
170
175
  });
171
176
  ok(`L1 ${scheme}: no sideways scroll at 390 and every button is 44 px tall`, !f.over && f.small === 0 && f.buttons >= 1, JSON.stringify(f));
177
+ // premium-agreed-design: the accent edge is the cozy blue (--cz-blue, cozy-home.css) where the old design drew ember; the check reads the inset edge alone
172
178
  ok(`L2 ${scheme}: the card has the ember edge and readable text`, /inset/.test(f.edge) && f.colour !== f.bg, JSON.stringify(f));
173
179
  ok(`L3 ${scheme}: the page raised no error`, p.__errs.length === 0, p.__errs.join());
174
180
  if (p.__shot) await p.__shot(scheme);
@@ -3,9 +3,13 @@
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 Chat page at rest (no Detail switch since premium-chat-viewer) · P2 scrolling and typing hide nothing · P3 Focus gives the dialog the screen and moves the rail away · P4 a second
7
- * press brings it all back · P5 a chat dialog on another page takes the screen, the rail class stays off · P6 a desktop has no Focus button
8
- * Set PHONE_ROOM_SHOTS=<dir> to save the Chat page at 390 wide, light and dark, at rest and in focus. */
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
12
+ * Set PHONE_ROOM_SHOTS=<dir> to save the chat at 390 wide, light and dark, at rest and in focus. */
9
13
  const { findBrowser } = require('./lib/find-browser');
10
14
  require('./test-run').configure({ name: 'premium-phone-room' });
11
15
  const Fx = require('./c3-scan-fixture.js');
@@ -24,13 +28,20 @@ const finish = async (code) => {
24
28
  };
25
29
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
26
30
 
27
- /* 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 */
28
32
  const look = () => {
29
- const g = document.querySelector('#dlg'), rail = document.querySelector('.rail').getBoundingClientRect(), body = document.querySelector('#dBody').getBoundingClientRect(), ask = document.querySelector('#askF').getBoundingClientRect(), f = document.querySelector('#dFocus');
30
- return { 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 };
31
43
  };
32
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); };
33
- const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEvent(new WheelEvent('wheel', { deltaY: dy })); b.scrollTop += dy; };
34
45
 
35
46
  (async () => {
36
47
  const exe = findBrowser();
@@ -44,41 +55,41 @@ const hand = (dy) => { const b = document.querySelector('#dBody'); b.dispatchEve
44
55
  const open = async (width, scheme = 'light', height = 844) => {
45
56
  const ctx = await browser.newContext({ viewport: { width, height }, colorScheme: scheme, hasTouch: true });
46
57
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
47
- await p.goto(chat); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dGrid').dataset.tab === 'chat'));
48
- 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);
49
63
  return { p, ctx, errs };
50
64
  };
51
65
 
52
66
  { const { p, ctx, errs } = await open(390);
53
- await until(() => p.evaluate(() => document.querySelector('#dlg').getBoundingClientRect().top === 0)); // the dialog's entrance has finished
54
67
  const s0 = await p.evaluate(look);
55
- ok('P1 the Chat page at rest shows the rail and a Focus button, and no Detail switch (premium-chat-viewer V5: the viewer is a layer)', !s0.tabs && !s0.focus && s0.btn && s0.pressed === 'false' && s0.railTop < s0.vh, JSON.stringify(s0));
56
- 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);
57
70
  const s1 = await p.evaluate(look);
58
- ok('P2 scrolling and typing hide nothing by themselves', !s1.focus && s1.railTop < s1.vh && s1.dlgH === s0.dlgH, JSON.stringify(s1));
59
- 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));
60
74
  if (shots) await p.screenshot({ path: `${shots}/chat-rest-390-light.png` });
61
- await p.click('#dFocus');
62
- const s2 = await until(async () => { const v = await p.evaluate(look); return v.focus && v.dfocus && v.railTop >= v.vh && v.dlgH >= v.vh - 2 ? v : null; }) || await p.evaluate(look);
63
- ok('P3 Focus hides the switch, moves the rail off the screen and gives the dialog the whole screen', s2.focus && !s2.tabs && s2.dfocus && s2.pressed === 'true' && s2.railTop >= s2.vh && s2.dlgTop === 0 && s2.dlgH >= s2.vh - 2, JSON.stringify(s2));
64
- 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));
65
- if (shots) await p.screenshot({ path: `${shots}/chat-focus-390-light.png` });
66
- await p.click('#dFocus');
67
- const s3 = await until(async () => { const v = await p.evaluate(look); return !v.focus && !v.dfocus && v.railTop < v.vh ? v : null; }) || await p.evaluate(look);
68
- ok('P4 a second press brings the rail back', !s3.focus && !s3.dfocus && s3.railTop < s3.vh && s3.pressed === 'false', JSON.stringify(s3));
69
- 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(' | '));
70
77
  await ctx.close(); }
71
78
 
72
- 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(); }
73
80
 
74
81
  { const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true }); const p = await ctx.newPage();
75
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!document.querySelector('.rail')));
76
- 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'); });
77
- await p.evaluate(fill); await sleep(700); await p.click('#dFocus');
78
- 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);
79
- 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));
80
- 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' }); });
81
- 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));
82
93
  await ctx.close(); }
83
94
 
84
95
  { const { p, ctx } = await open(1280);