create-pmos 0.395.0 → 0.397.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/package.json +25 -30
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +24 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/briefing-premium.md +3 -1
  27. package/workspace/guide/index.md +1 -0
  28. package/workspace/guide/lifecycle.md +51 -0
  29. package/workspace/home-shot.js +38 -0
  30. package/workspace/lib/board-premium.js +92 -1
  31. package/workspace/lib/engine/boards.js +15 -14
  32. package/workspace/lib/engine/nine-stages.js +49 -20
  33. package/workspace/lib/engine/signals/detectors.js +13 -11
  34. package/workspace/lib/insights-premium.js +78 -1
  35. package/workspace/lib/routes-board-premium.js +3 -2
  36. package/workspace/lib/routes-initiatives.js +1 -1
  37. package/workspace/lib/routes-insights-premium.js +8 -1
  38. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  39. package/workspace/package-lock.json +2 -2
  40. package/workspace/package.json +1 -1
  41. package/workspace/premium-agreed-viewer-shots.js +76 -0
  42. package/workspace/premium-board-actions-test.js +2 -0
  43. package/workspace/premium-chat-chart-tab-test.js +6 -5
  44. package/workspace/premium-chat-context-test.js +8 -6
  45. package/workspace/premium-chat-goal-view-test.js +9 -7
  46. package/workspace/premium-chat-notes-test.js +3 -2
  47. package/workspace/premium-chat-report-tab-test.js +8 -2
  48. package/workspace/premium-chat-term-test.js +3 -1
  49. package/workspace/premium-chat-viewer-test.js +23 -17
  50. package/workspace/premium-core-doc-issue-test.js +2 -0
  51. package/workspace/premium-html-viewer-test.js +4 -2
  52. package/workspace/premium-phone-card-test.js +1 -0
  53. package/workspace/premium-phone-room-test.js +16 -11
  54. package/workspace/premium-report-read-test.js +1 -1
  55. package/workspace/premium-vw-backlog-test.js +2 -0
  56. package/workspace/premium-vw-cal-test.js +9 -4
  57. package/workspace/premium-vw-doc-test.js +1 -1
  58. package/workspace/premium-vw-item-test.js +1 -0
  59. package/workspace/premium-vw-jira-test.js +4 -1
  60. package/workspace/premium-vw-notes-test.js +2 -1
  61. package/workspace/premium-vw-rec-test.js +3 -2
  62. package/workspace/premium-vw-slides-test.js +2 -2
  63. package/workspace/premium-work-depth-test.js +7 -3
  64. package/workspace/public/pm/bd-span.js +120 -0
  65. package/workspace/public/pm/bd-stages.js +33 -0
  66. package/workspace/public/pm/cozy-board.css +373 -0
  67. package/workspace/public/pm/cozy-home.css +152 -0
  68. package/workspace/public/pm/cozy-home.js +170 -0
  69. package/workspace/public/pm/cozy-initiative.css +138 -0
  70. package/workspace/public/pm/cozy-insights.css +292 -0
  71. package/workspace/public/pm/cozy-nav.js +54 -0
  72. package/workspace/public/pm/cozy-viewer.css +143 -0
  73. package/workspace/public/pm/cozy.css +172 -0
  74. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  75. package/workspace/public/pm/lifecycle-lens.js +22 -11
  76. package/workspace/public/pm/premium-board.js +329 -67
  77. package/workspace/public/pm/premium-brief.js +1 -1
  78. package/workspace/public/pm/premium-chat.js +17 -10
  79. package/workspace/public/pm/premium-initiative-head.js +138 -0
  80. package/workspace/public/pm/premium-initiative.js +28 -4
  81. package/workspace/public/pm/premium-insights.js +530 -244
  82. package/workspace/public/pm/premium-shell.js +40 -10
  83. package/workspace/public/pm/premium-viewer.js +5 -0
  84. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  85. package/workspace/public/pm/premium-vw-jira.css +11 -0
  86. package/workspace/public/pm/premium-vw-jira.js +11 -4
  87. package/workspace/public/pm/premium-vw-rec.js +5 -2
  88. package/workspace/public/pm/premium-wide.css +30 -0
  89. package/workspace/public/pm/premium-work.js +18 -8
  90. package/workspace/public/pm/premium.js +19 -6
  91. package/workspace/public/premium-board.html +83 -47
  92. package/workspace/public/premium-chat.html +7 -32
  93. package/workspace/public/premium-initiative.html +16 -8
  94. package/workspace/public/premium-insights.html +83 -43
  95. package/workspace/public/premium-work.html +6 -71
  96. package/workspace/public/premium.html +62 -15
  97. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  98. package/workspace/server.js +7 -0
  99. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  100. package/workspace/third-party/README.md +1 -0
@@ -1,40 +1,63 @@
1
1
  'use strict';
2
2
  /*
3
- * The nine stage names as a label layer over the workflow engine's derived stage (run 3).
3
+ * The lifecycle label layer over the workflow engine's derived stage: six stages and two milestones
4
+ * (premium-agreed-design L1, PM decision 2026-10-22). The file keeps its old name and export names
5
+ * (`nineStages`, `STAGES`, `LABELS`, `LANE_STAGES`) so that every caller keeps working; the
6
+ * `nine_stages` field on a row keeps its name for the same reason. It now carries eight entries.
7
+ *
8
+ * Triage (BRD) → Discover (PRD) → Plan (scope, timeline, WBS; the PM's Commit pushes tickets to Jira)
9
+ * → Prioritize (ranked on the roadmap) → Build (features delivered, Jira) → ◆ Deliver (milestone:
10
+ * release shipped, PM sign-off) → Monitor (outcome report) → ◆ Evaluate (milestone: keep, iterate or stop)
4
11
  *
5
12
  * The engine derives one of six rungs (intake, spec, contract, build, eval, accepted) from the steps
6
- * it found. This file names the nine stages the PM sees and says which of them each lane uses. It
7
- * never decides a stage itself: a stage is `done` only when a derived signal shows it, and a stage
8
- * no record can yet show is `no-signal`, not guessed.
13
+ * it found. This file names the stages the PM sees and says which of them each lane uses. It never
14
+ * decides a stage itself: a stage is `done` only when a derived signal shows it, and a stage no record
15
+ * can yet show is `no-signal`, not guessed.
9
16
  *
10
- * The lane sets below are a proposal for the PM to correct (see the run 3 contract in the PRD).
17
+ * Migration: the old nine had Ideate and Strategize. Stage is derived, never stored, so there is no
18
+ * stored stage to rewrite. Records that signalled Ideate (ideas, hypotheses) now count for Discover;
19
+ * records that signalled Strategize (decisions, bets) now count for Prioritize. `stageKey` maps an
20
+ * old key read from anywhere (a stored payload, a URL, a fixture) to its new key at read time.
11
21
  */
12
22
 
13
- const STAGES = ['discover', 'ideate', 'strategize', 'prioritize', 'plan', 'build', 'deliver', 'monitor', 'evaluate'];
23
+ const STAGES = ['triage', 'discover', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate'];
14
24
 
15
25
  const LABELS = {
16
- discover: 'Discover', ideate: 'Ideate', strategize: 'Strategize', prioritize: 'Prioritize', plan: 'Plan',
26
+ triage: 'Triage', discover: 'Discover', plan: 'Plan', prioritize: 'Prioritize',
17
27
  build: 'Build', deliver: 'Deliver', monitor: 'Monitor', evaluate: 'Evaluate',
18
28
  };
19
29
 
30
+ // What each stage produces (the PM's words on the Agreed design).
31
+ const OUTPUTS = {
32
+ triage: 'BRD', discover: 'PRD', plan: 'Scope, timeline and work breakdown', prioritize: 'Ranked on the roadmap',
33
+ build: 'Features delivered (Jira)', deliver: 'Release shipped, PM sign-off', monitor: 'Outcome report', evaluate: 'Keep, iterate or stop',
34
+ };
35
+
36
+ // Deliver and Evaluate are milestones (drawn as a diamond), not stages with duration.
37
+ const MILESTONES = new Set(['deliver', 'evaluate']);
38
+
39
+ // The removed keys and where they went. Read-time only: nothing stored is rewritten.
40
+ const LEGACY = { ideate: 'discover', strategize: 'prioritize' };
41
+ const stageKey = (k) => (k == null ? k : LEGACY[k] || k);
42
+
20
43
  // Which stages each product-code lane uses. Stages not listed read `skipped`.
21
44
  const LANE_STAGES = {
22
45
  feature: STAGES,
23
- discovery: ['discover', 'ideate', 'strategize', 'prioritize', 'evaluate'],
24
- chore: ['plan', 'build', 'evaluate'],
46
+ discovery: ['triage', 'discover', 'prioritize', 'evaluate'],
47
+ chore: ['plan', 'build', 'deliver', 'evaluate'],
25
48
  incident: ['build', 'deliver', 'monitor', 'evaluate'],
26
- content: ['ideate', 'plan', 'build', 'deliver'],
27
- prototype: ['discover', 'ideate', 'evaluate'],
49
+ content: ['discover', 'plan', 'build', 'deliver'],
50
+ prototype: ['triage', 'discover', 'evaluate'],
28
51
  };
29
52
 
30
53
  // Stages that have a derived signal today. Every other stage reads `no-signal` until its record exists.
31
- const SIGNALLED = new Set(['discover', 'plan', 'build', 'evaluate']);
54
+ const SIGNALLED = new Set(['triage', 'discover', 'plan', 'build', 'evaluate']);
32
55
 
33
56
  const RANK = { intake: 0, spec: 1, contract: 2, build: 3, eval: 4, accepted: 5 };
34
57
 
35
58
  // Stages that gain a signal only when the caller passes the records (scripts/records readAll plus optional `releases`).
36
- // With no records the output is exactly the older output, so the lifecycle-lens mirror stays equal.
37
- const RECORD_SIGNALLED = new Set(['ideate', 'strategize', 'prioritize', 'monitor', 'deliver']);
59
+ // With no records the output is exactly the records-free output, so the lifecycle-lens mirror stays equal.
60
+ const RECORD_SIGNALLED = new Set(['discover', 'prioritize', 'monitor', 'deliver']);
38
61
 
39
62
  // records: { initiative?, anchor?, ideas, hypotheses, decisions, bets, 'kr-metrics', releases } (every list optional).
40
63
  // The initiative id and anchor come from `derived` (id, anchor) or from records.initiative / records.anchor.
@@ -43,10 +66,12 @@ function recordSignals(derived, records, buildDone) {
43
66
  const anchor = (derived && derived.anchor) || records.anchor || null;
44
67
  const mine = (list) => (list || []).filter((r) => id && r.initiative === id);
45
68
  const kr = (records['kr-metrics'] || []).filter((m) => anchor && (m.rid === anchor || m.parent_kr === anchor || 'kr:' + m.rid === anchor));
69
+ const ranked = mine(records.bets).some((b) => ['now', 'next', 'later'].includes(b.horizon) && Number.isInteger(b.rank));
46
70
  return {
47
- ideate: mine(records.ideas).length + mine(records.hypotheses).length > 0,
48
- strategize: mine(records.decisions).length + mine(records.bets).length > 0,
49
- prioritize: mine(records.bets).some((b) => ['now', 'next', 'later'].includes(b.horizon) && Number.isInteger(b.rank)),
71
+ // was Ideate: an idea or hypothesis on the initiative
72
+ discover: mine(records.ideas).length + mine(records.hypotheses).length > 0,
73
+ // was Strategize (a decision or bet) or the old Prioritize (a ranked bet)
74
+ prioritize: ranked || mine(records.decisions).length + mine(records.bets).length > 0,
50
75
  monitor: !!buildDone && kr.some((m) => (m.readings || []).length > 0),
51
76
  deliver: mine(records.releases).length > 0,
52
77
  };
@@ -57,6 +82,7 @@ function nineStages(lane, derived, records) {
57
82
  const rank = RANK[derived && derived.stage] ?? 0;
58
83
  const step = (key) => (derived && derived.steps || []).find((s) => s.key === key);
59
84
  const done = {
85
+ triage: rank >= 1,
60
86
  discover: rank >= 1,
61
87
  plan: rank >= 2,
62
88
  build: rank >= 3 || (step('build') && step('build').status === 'done'),
@@ -64,18 +90,21 @@ function nineStages(lane, derived, records) {
64
90
  };
65
91
  const accepted = rank >= 5;
66
92
  const fromRecords = records && typeof records === 'object' ? recordSignals(derived, records, done.build) : null;
93
+ const signalled = (key) => SIGNALLED.has(key) || (fromRecords && RECORD_SIGNALLED.has(key) && (key !== 'deliver' || fromRecords.deliver));
67
94
  const out = [];
68
95
  let currentSet = false;
69
96
  for (const key of STAGES) {
70
97
  let status;
71
98
  if (!laneSet.has(key)) status = 'skipped';
72
- else if (!SIGNALLED.has(key) && !(fromRecords && RECORD_SIGNALLED.has(key) && (key !== 'deliver' || fromRecords.deliver))) status = 'no-signal';
99
+ else if (!signalled(key)) status = 'no-signal';
73
100
  else if (done[key] || (fromRecords && fromRecords[key])) status = 'done';
74
101
  else status = 'pending';
75
102
  if (status === 'pending' && !currentSet) { status = 'current'; currentSet = true; }
76
- out.push({ key, label: LABELS[key], status, accepted: key === 'evaluate' ? accepted : undefined });
103
+ const entry = { key, label: LABELS[key], status, accepted: key === 'evaluate' ? accepted : undefined };
104
+ if (MILESTONES.has(key)) entry.milestone = true;
105
+ out.push(entry);
77
106
  }
78
107
  return out;
79
108
  }
80
109
 
81
- module.exports = { STAGES, LABELS, LANE_STAGES, nineStages };
110
+ module.exports = { STAGES, LABELS, OUTPUTS, MILESTONES, LEGACY, LANE_STAGES, stageKey, nineStages, lifecycleStages: nineStages };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.395.0",
3
+ "version": "0.397.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.395.0",
9
+ "version": "0.397.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.395.0",
3
+ "version": "0.397.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-agreed-viewer-shots.js — screenshots of the initiative page and the Viewer in the Agreed design (initiative premium-agreed-design, area viewer).
4
+ * Not a suite: it serves the real page from the real server, answers the routes from the fixtures the browser suites use, and writes PNGs to
5
+ * the directory given as the first argument (default: ./shots). Run: node premium-agreed-viewer-shots.js /mnt/project-files/agreed-build */
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { spawn } = require('child_process');
9
+ const { findBrowser } = require('./lib/find-browser');
10
+ const T = require('./test-run').configure({ name: 'agreed-viewer-shots' });
11
+ const IP = require('./lib/initiative-premium.js');
12
+ const F = require('./fixtures/initiative-premium-facts.js');
13
+
14
+ const OUT = path.resolve(process.argv[2] || 'shots');
15
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
+ (async () => {
17
+ fs.mkdirSync(OUT, { recursive: true });
18
+ const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
19
+ await T.waitForServer(T.BASE);
20
+ const { chromium } = require('playwright-core');
21
+ const browser = await chromium.launch({ executablePath: findBrowser() });
22
+ const model = IP.build(F.facts());
23
+ const NOW = new Date(F.NOW);
24
+ const tickets = { ok: true, initiative: 'self-serve-v2', title: 'Self-serve onboarding v2', checkedAt: new Date(F.NOW - 12 * 60000).toISOString(), sectionNames: [{ key: 'story', name: 'User Story' }],
25
+ tickets: [{ id: 'TD-01', key: 'ONB-12', summary: 'Sandbox key step', type: 'Story', priority: 'High', depends: [], sections: { story: 'As a partner I get a sandbox key in one step.' }, jira: { status: 'In Progress', category: 'doing', assignee: { displayName: 'Rudi' }, sprint: { name: 'Sprint 14', state: 'active', start: '2026-10-07', end: '2026-10-21' } } }] };
26
+ const shot = async (name, w, h, theme, act) => {
27
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
28
+ const page = await ctx.newPage();
29
+ await page.clock.setFixedTime(NOW).catch(() => {});
30
+ await page.route('**/api/initiative-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: F.NOW }) }));
31
+ await page.route('**/api/jira/tickets*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(tickets) }));
32
+ await page.route('**/api/boards/sprints*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, source: 'none', sprints: [] }) }));
33
+ await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
34
+ await page.goto(T.BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme);
35
+ for (let i = 0; i < 100 && !(await page.$('#cIniTk')); i++) await sleep(100);
36
+ await sleep(600);
37
+ if (act) await act(page);
38
+ await page.screenshot({ path: path.join(OUT, name + '.png') });
39
+ await ctx.close();
40
+ };
41
+ await shot('viewer-initiative-1440', 1440, 900, 'light');
42
+ await shot('viewer-initiative-1440-dark', 1440, 900, 'dark');
43
+ await shot('viewer-initiative-390', 390, 844, 'light');
44
+ await shot('viewer-initiative-1440-folded', 1440, 900, 'light', async (p) => { await p.click('#czBox [data-czfold]'); await sleep(200); });
45
+ const ticket = async (p) => { await p.click('#cIniTk [data-task="task:ONB-12"]'); await sleep(1500); };
46
+ await shot('viewer-jira-1440', 1440, 900, 'light', ticket);
47
+ await shot('viewer-jira-390', 390, 844, 'light', ticket);
48
+ // the meeting views and the calendar in the cozy dialog: opened on this page with the shell's own dialog, from fixture answers
49
+ const iso = (d) => d.toISOString(), key = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
50
+ const START = new Date(F.NOW - 10 * 60000), END = new Date(START.getTime() + 45 * 60000);
51
+ const mon = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate() - ((NOW.getDay() + 6) % 7));
52
+ const cells = []; for (let i = 0; i < 7; i++) { const d = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + i); cells.push({ key: key(d), start: key(d), end: key(d), events: [] }); }
53
+ cells.find((c) => c.key === key(START)).events.push({ id: 'ev-sync', at: iso(START), end: iso(END), title: 'Weekly sync', attendees: ['Dara', 'Sam'] });
54
+ const week = { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: key(NOW), context: {}, link_boards: [], gantt: [] };
55
+ const NOTE = { id: 'n1', title: 'Weekly sync', state: 'ended', updated_at: iso(NOW), meeting_ms: 32 * 60000, series: { key: 'weekly-sync' },
56
+ meeting: { kind: 'event', event_id: 'ev-sync', start: iso(START), end: iso(END), title: 'Weekly sync', context: { with: 'Dara and Sam', purpose: 'Agree what blocks the release.', agenda: ['Migration check status'] } },
57
+ final_notes: { overview: 'The team reviewed the migration check.', decisions: [{ text: 'Keep the new copy', why: 'Completion rose six points.' }], actions: [{ text: 'Start the migration check', owner: 'Sam', due: '2026-10-22' }], questions: [{ text: 'Do old workspaces need a manual step?' }] },
58
+ final: { segments: [{ t: 61000, spk: 'meeting', text: 'The migration check status is not started.' }] }, speakers: { meeting: 'Dara' } };
59
+ const meet = async (p, which) => {
60
+ await p.route('**/api/calendar-views*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(week) }));
61
+ await p.route('**/api/notes/one*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, note: NOTE }) }));
62
+ await p.route('**/api/notes/series?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, series: { key: 'weekly-sync', meetings: [] } }) }));
63
+ await p.evaluate(async (w) => {
64
+ const S = await import('/pm/premium-shell.js');
65
+ const d = { ...S, pmGet: (u) => fetch(u).then((r) => r.json()).catch(() => null), pmPost: async () => ({ ok: true }), task: async () => ({ ok: false }), openRow: () => {} };
66
+ if (w === 'cal') { const C = await import('/pm/premium-vw-cal.js'); C.openCalendar(d); }
67
+ else { S.openDlg({ eye: 'Meeting · real data', title: 'Weekly sync', say: 'The notes of the meeting.', stream: S.turnA(S.ptx('The notes of the meeting.')), pane: '<article class="paper doc"><p class="note">The meeting.</p></article>', label: 'Meeting' }); const M = await import('/pm/premium-vw-meet.js'); await M.openNoteTab(d, 'n1'); }
68
+ }, which);
69
+ await sleep(1500);
70
+ };
71
+ await shot('viewer-calendar-1440', 1440, 900, 'light', (p) => meet(p, 'cal'));
72
+ await shot('viewer-meeting-1440', 1440, 900, 'light', (p) => meet(p, 'note'));
73
+ await shot('viewer-meeting-390', 390, 844, 'light', (p) => meet(p, 'note'));
74
+ await browser.close(); srv.kill('SIGKILL'); T.killTmux();
75
+ console.log('wrote', fs.readdirSync(OUT).filter((f) => /^viewer-/.test(f)).join(' '));
76
+ })().catch((e) => { console.error(e); process.exit(1); });
@@ -82,6 +82,7 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
82
82
  ok('A2 an ask shows its source, not an invented name', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#cAsks').textContent) && !/demo/i.test(document.querySelector('#cAsks').textContent)));
83
83
 
84
84
  /* T triage */
85
+ if (await p.evaluate(() => document.querySelector('#popAsks').hidden)) await p.click('#chAsks'); // the Agreed design keeps the asks behind the New asks chip (premium-agreed-design)
85
86
  await p.click(`#cAsks [data-ask="acc:${a1.body.ask.id}"]`); await dlgOn();
86
87
  const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && s.tagName === 'SELECT' && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
87
88
  ok('T1 Accept opens the form with the anchors the board declares', !!anc && anc.includes('health:tech'), JSON.stringify(anc));
@@ -91,6 +92,7 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
91
92
  ok('T3 Accept records the accept line and a new initiative, and says so', !!(await toastIs(/accepted in/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-accept' && l.ask === a1.body.ask.id), JSON.stringify(lines('boards.jsonl').map((l) => l.kind)));
92
93
  await dlgOff();
93
94
  ok('T4 the accepted ask leaves the card', await until(() => p.evaluate((id) => !document.querySelector(`#cAsks [data-ask="acc:${id}"]`) && document.querySelectorAll('#cAsks .baa').length === 1, a1.body.ask.id)));
95
+ if (await p.evaluate(() => document.querySelector('#popAsks').hidden)) await p.click('#chAsks'); // the Agreed design keeps the asks behind the New asks chip (premium-agreed-design)
94
96
  await p.click(`#cAsks [data-ask="dec:${a2.body.ask.id}"]`); await dlgOn();
95
97
  ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#paDGo').disabled));
96
98
  await p.fill('#paDW', 'Not tied to a goal this quarter'); await p.click('#paDGo');
@@ -76,7 +76,8 @@ const look = () => {
76
76
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
77
77
  await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-ch', goal: null } }));
78
78
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages } }));
79
- await p.goto(BASE + url);
79
+ await p.goto(BASE + url); // premium-agreed-design H3: /premium-chat.html opens Home; a desktop docks the chat, a phone opens it from the head's chat button
80
+ if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat'))); await p.click('#hChat'); }
80
81
  await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
81
82
  await sleep(500);
82
83
  return { p, ctx, errs };
@@ -124,18 +125,18 @@ const look = () => {
124
125
  await sleep(400);
125
126
  if (await p.locator('#dashBar').isHidden()) await p.click('#dashMore');
126
127
  const hasStudio = await p.evaluate(() => !!document.querySelector('#oMain .stu') || [...document.scripts].some((s) => /premium-studio/.test(s.src)));
127
- await Promise.all([p.waitForURL(/premium-chat\.html/), p.click('#pdEdit')]);
128
+ await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#pdEdit')]); // premium-agreed-design H3: /premium-chat.html opens Home with its query
128
129
  const u1 = new URL(p.url());
129
130
  await until(() => p.evaluate(() => [...document.querySelectorAll('#dOut .obody.vw')].some((x) => !x.hidden && /Partner growth/.test(x.textContent))));
130
131
  const s1 = await p.evaluate(look);
131
- ok('I1 Edit on a saved dashboard opens the Chat page with its Dashboard tab, saved', !hasStudio && u1.searchParams.get('open') === 'dashboard:' + D.id && /Saved dashboard/.test(s1.pane || ''), JSON.stringify([u1.search, s1.pane]));
132
+ ok('I1 Edit on a saved dashboard opens Home\'s chat with its Dashboard tab, saved', !hasStudio && u1.pathname === '/premium.html' && u1.searchParams.get('open') === 'dashboard:' + D.id && /Saved dashboard/.test(s1.pane || ''), JSON.stringify([u1.search, s1.pane]));
132
133
  await p.goto(BASE + '/premium-insights.html');
133
134
  await until(() => p.evaluate(() => !!document.querySelector('#dashBody .mch')));
134
135
  await p.evaluate(() => { const r = document.querySelector('[data-d="all"]'); if (r) r.click(); });
135
136
  if (await p.locator('#dashBar').isHidden()) await p.click('#dashMore');
136
- await Promise.all([p.waitForURL(/premium-chat\.html/), p.click('#pcNew')]);
137
+ await Promise.all([p.waitForURL(/\/premium\.html\?/), p.click('#pcNew')]);
137
138
  const s2 = await until(async () => { const v = await p.evaluate(look); return v.say ? v : null; }) || await p.evaluate(look);
138
- ok('I1 New chart opens the Chat page with a first message in the box, not sent', s2.say === 'Make a chart of ', JSON.stringify(s2.say));
139
+ ok('I1 New chart opens Home\'s chat with a first message in the box, not sent', s2.say === 'Make a chart of ', JSON.stringify(s2.say));
139
140
  ok('F1 no page error (Insights to Chat)', !errs.length, errs.join(' | '));
140
141
  await ctx.close(); }
141
142
 
@@ -7,7 +7,8 @@
7
7
  * C2 a new answer opens its main item in the viewer once, when Claude has finished, and not while it still works
8
8
  * C3 a Jira chip opens the ticket from the stored Jira reading, with Open in Jira; a key with no reading says so
9
9
  * C4 a Slack chip opens a tab with Open in Slack
10
- * C5 at 390 a new answer shows a bar over the message box instead of covering the conversation; its press opens the viewer layer
10
+ * C5 at 390 a new answer shows a bar over the message box instead of covering the conversation; its press opens the file on the Detail tab
11
+ * (since premium-agreed-design /premium-chat.html opens Home: a desktop docks the chat, a phone opens it as a popup from the head's chat button)
11
12
  * C6 every chip is at least 44 px; no sideways scroll; no page error
12
13
  * Set CHAT_CONTEXT_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
13
14
  const { findBrowser } = require('./lib/find-browser');
@@ -59,12 +60,13 @@ const second = (k) => [
59
60
  await p.route('**/api/doc/locate**', (r) => { const u = decodeURIComponent(r.request().url()); const rel = (u.match(/path=([^&]+)/) || [])[1] || 'x.md'; r.fulfill({ json: { ok: true, ws: F.ws, rel, name: rel.split('/').pop(), abs: '/x/' + rel, mtime: 1, size: MD.length } }); });
60
61
  await p.route('**/api/doc?**', (r) => r.fulfill({ contentType: 'text/plain', headers: { 'X-Doc-Kind': 'markdown' }, body: MD }));
61
62
  await p.goto(chat);
63
+ if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat')), 10000); await p.click('#hChat'); } // a phone: Home's list is the page; its chat button opens your chat
62
64
  await until(() => p.evaluate(() => document.querySelectorAll('#dBody .ctxchip').length > 0), 10000);
63
65
  return { p, ctx, errs, conv };
64
66
  };
65
67
  const look = () => {
66
68
  const g = document.querySelector('#dlg'), peek = document.querySelector('#ctxPeek');
67
- return { shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(document.querySelector('#dOut').getBoundingClientRect().width),
69
+ return { tab: document.querySelector('#dGrid').dataset.tab, shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(document.querySelector('#dOut').getBoundingClientRect().width),
68
70
  tabs: [...document.querySelectorAll('#vTabs .vtab')].filter((t) => !t.hidden).map((t) => t.textContent.trim()),
69
71
  chips: [...document.querySelectorAll('#dBody .ctxc')].map((c) => [...c.querySelectorAll('.ctxchip')].map((b) => b.dataset.ctx + ':' + b.querySelector('b').textContent + (b.classList.contains('lead') ? '*' : ''))),
70
72
  peek: peek && !peek.hidden ? peek.textContent.trim() : null, minH: Math.min(...[...document.querySelectorAll('#dBody .ctxchip')].map((b) => b.getBoundingClientRect().height)), wide: document.documentElement.scrollWidth > innerWidth + 1 };
@@ -106,12 +108,12 @@ const second = (k) => [
106
108
  await sleep(2500);
107
109
  await answer(p, conv, 2, false);
108
110
  const s0 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }, 6000) || await p.evaluate(look);
109
- ok(`C5 at 390 (${scheme}) a new answer shows a bar over the message box and leaves the conversation uncovered`, /Claude wrote this · signup-plan2\.md\s*View/.test(s0.peek || '') && !s0.layer, JSON.stringify(s0));
111
+ ok(`C5 at 390 (${scheme}) a new answer shows a bar over the message box and leaves the conversation uncovered`, /Claude wrote this · signup-plan2\.md\s*View/.test(s0.peek || '') && !s0.layer && s0.tab === 'chat', JSON.stringify(s0));
110
112
  if (shots) await p.screenshot({ path: `${shots}/chat-context-390-${scheme}.png` });
111
113
  await p.click('#ctxPeek');
112
- const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer ? v : null; }) || await p.evaluate(look);
113
- ok(`C5 at 390 (${scheme}) the bar's press opens the file in the viewer layer and the bar goes`, s1.layer && JSON.stringify(s1.tabs) === JSON.stringify(['signup-plan2.md']) && !s1.peek, JSON.stringify(s1));
114
- await p.click('#vBack');
114
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'out' && v.tabs.length ? v : null; }) || await p.evaluate(look);
115
+ ok(`C5 at 390 (${scheme}) the bar's press opens the file on the popup's Detail tab and the bar goes`, s1.tab === 'out' && s1.out >= 340 && JSON.stringify(s1.tabs) === JSON.stringify(['signup-plan2.md']) && !s1.peek, JSON.stringify(s1));
116
+ await p.click('#dTabs [data-t="chat"]');
115
117
  const s2 = await p.evaluate(look);
116
118
  ok(`C6 at 390 (${scheme}) every chip is at least 44 px and nothing scrolls sideways`, s2.minH >= 44 && !s2.wide, JSON.stringify(s2));
117
119
  ok(`C6 no page error at 390 (${scheme})`, errs.length === 0, errs.join(' | '));
@@ -6,7 +6,8 @@
6
6
  * G2 a goal that changes state opens the Goal tab by itself on a desktop, and the open tab follows the next change
7
7
  * G3 a ready goal: the conversation shows only the chip; the plan, SMART and Start / Change / Cancel are in the Goal tab
8
8
  * G4 Stop the goal is in the Goal tab and reaches the server
9
- * G5 at 390 the chip covers the page with the Goal tab and Back; a change offers the goal in the bar over the box
9
+ * G5 at 390 the chip shows the Goal tab on the popup's Detail tab; a change offers the goal in the bar over the box
10
+ * (since premium-agreed-design /premium-chat.html opens Home: a desktop docks the chat, a phone opens it as a popup from the head's chat button)
10
11
  * Set GOAL_VIEW_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
11
12
  const { findBrowser } = require('./lib/find-browser');
12
13
  require('./test-run').configure({ name: 'premium-chat-goal-view' });
@@ -38,7 +39,7 @@ const goalOf = (state, extra = {}) => ({ id: 'g1', state, draft: DRAFT, met: [],
38
39
  const look = () => {
39
40
  const g = document.querySelector('#dlg'), out = document.querySelector('#dOut').getBoundingClientRect(), gp = document.querySelector('#dOut .obody.vw[data-vw="goal"]');
40
41
  const peek = document.querySelector('#ctxPeek');
41
- return { shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
42
+ return { tab: document.querySelector('#dGrid').dataset.tab, shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
42
43
  cardInChat: !!document.querySelector('#dBody .gcard'), chip: (document.querySelector('#dBody [data-goal-open]') || {}).textContent || null,
43
44
  smart: !!document.querySelector('#dBody .smart'), start: !!document.querySelector('#dBody [data-goal="start"]'),
44
45
  tabs: [...document.querySelectorAll('#vTabs .vtab')].map((t) => t.textContent.trim()), on: (document.querySelector('#vTabs .vtab[aria-selected="true"]') || {}).textContent || null,
@@ -64,6 +65,7 @@ const look = () => {
64
65
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
65
66
  await p.route('**/api/briefing-premium/goal**', (r) => { st.posts.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ json: { ok: true } }); });
66
67
  await p.goto(chat);
68
+ if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat'))); await p.click('#hChat'); } // a phone: Home's list is the page; its chat button opens your chat
67
69
  await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
68
70
  await sleep(400);
69
71
  return { p, ctx, errs, st };
@@ -109,16 +111,16 @@ const look = () => {
109
111
  for (const scheme of ['light', 'dark']) {
110
112
  const { p, ctx, errs, st } = await open(390, scheme, { goal: goalOf('started', { met: [DRAFT.done[0]] }), messages: working });
111
113
  const s0 = await p.evaluate(look);
112
- ok(`G5 (${scheme}) at 390 the conversation shows the chip, not the card`, !s0.cardInChat && /Working/.test(s0.chip || '') && !s0.layer, JSON.stringify(s0));
114
+ ok(`G5 (${scheme}) at 390 the conversation shows the chip, not the card`, !s0.cardInChat && /Working/.test(s0.chip || '') && !s0.layer && s0.tab === 'chat', JSON.stringify(s0));
113
115
  if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
114
116
  await p.click('#dBody [data-goal-open]');
115
- const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer && v.pane && v.outH >= v.vh - 2 && v.railOff ? v : null; }) || await p.evaluate(look);
116
- ok(`G5 (${scheme}) the chip covers the page with the Goal tab and Back`, s1.layer && s1.back && /1 of 3 done points met/.test(s1.pane || '') && s1.outH >= s1.vh - 2, JSON.stringify(s1));
117
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'out' && v.pane ? v : null; }) || await p.evaluate(look);
118
+ ok(`G5 (${scheme}) the chip shows the Goal tab on the popup's Detail tab, the popup's full width`, s1.tab === 'out' && s1.out >= 340 && /1 of 3 done points met/.test(s1.pane || ''), JSON.stringify(s1));
117
119
  if (shots) await p.screenshot({ path: `${shots}/goal-390-${scheme}.png` });
118
- await p.click('#vBack'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('vw-layer')));
120
+ await p.click('#dTabs [data-t="chat"]'); await until(() => p.evaluate(() => document.querySelector('#dGrid').dataset.tab === 'chat'));
119
121
  st.goal = goalOf('waiting', { met: [DRAFT.done[0]] });
120
122
  const s2 = await until(async () => { const v = await p.evaluate(look); return v.peek ? v : null; }) || await p.evaluate(look);
121
- ok(`G5 (${scheme}) a change offers the goal in the bar over the box, without covering the conversation`, /Needs you/.test(s2.peek || '') && !s2.layer, JSON.stringify(s2));
123
+ ok(`G5 (${scheme}) a change offers the goal in the bar over the box, without covering the conversation`, /Needs you/.test(s2.peek || '') && !s2.layer && s2.tab === 'chat', JSON.stringify(s2));
122
124
  ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s2.wide, errs.join(' | '));
123
125
  await ctx.close();
124
126
  }
@@ -16,7 +16,7 @@ const lib = require('./lib/chat-files.js');
16
16
 
17
17
  const BASE = T.BASE;
18
18
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
19
- const until = async (fn, ms = 6000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
19
+ const until = async (fn, ms = 12000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
20
20
  const results = [];
21
21
  const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
22
22
  let srv = null; let browser = null;
@@ -136,7 +136,8 @@ const notes = (key = KEY) => lib.listNotes({ runtimeDir: T.STATE_DIR, key }).not
136
136
  ok(`N10 ${scheme}: Notes opens the viewer tab on a phone`, !!(await openNotes(page)));
137
137
  await shot(page, 'notes-390-' + scheme);
138
138
  ok(`N10 ${scheme}: the notepad fits the width`, await page.evaluate(() => { const w = innerWidth; return ['#ntEd', '.ntf', '.nth'].every((s) => { const r = document.querySelector(s).getBoundingClientRect(); return r.width > 0 && r.left >= 0 && r.right <= w + 1; }); }));
139
- ok(`N10 ${scheme}: the icon buttons are 44px targets`, await page.evaluate(() => [...document.querySelectorAll('.ntic')].every((b) => b.getBoundingClientRect().height >= 44)));
139
+ await until(async () => page.evaluate(() => !document.getAnimations().some((a) => a.playState === 'running'))); // the popup's entrance scales it: measure once it has settled
140
+ { const ic = await page.evaluate(() => [...document.querySelectorAll('.ntic')].map((b) => (b.dataset.nt || b.id || b.className) + ':' + Math.round(b.getBoundingClientRect().height))); ok(`N10 ${scheme}: the icon buttons are 44px targets`, ic.length > 0 && ic.every((x) => +x.split(':').pop() >= 44), ic.join()); }
140
141
  await page.click('[data-nt="share"]');
141
142
  ok(`N10 ${scheme}: Share with Claude goes back to the conversation with the chip`, !!(await until(async () => page.isVisible('#attRow .atc'))));
142
143
  ok(`N10 ${scheme}: no page errors`, errors.length === 0, errors.join(' | '));
@@ -63,6 +63,8 @@ const look = () => {
63
63
  await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-rep', goal: null } }));
64
64
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
65
65
  await p.goto(chat);
66
+ // re-pointed for premium-agreed-design: on a phone /premium-chat.html opens Home with the chat closed; the head's chat button opens it
67
+ if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat'))); if (!(await p.evaluate(() => document.querySelector('#dlg').classList.contains('on')))) await p.click('#hChat'); }
66
68
  await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream #thr')));
67
69
  await sleep(500);
68
70
  return { p, ctx, errs, st };
@@ -110,8 +112,12 @@ const look = () => {
110
112
  const { p, ctx, errs } = await open(390, scheme, [ASK, ANSWER]);
111
113
  if (shots) await p.screenshot({ path: `${shots}/chip-390-${scheme}.png` });
112
114
  await p.click('#dBody [data-report-open]');
113
- const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer && v.pane ? v : null; }) || await p.evaluate(look);
114
- ok(`R7 (${scheme}) at 390 the chip covers the page with the Report tab`, s1.layer && /Social login weekly/.test(s1.pane || '') && s1.secs === 7, JSON.stringify(s1));
115
+ // re-pointed for premium-agreed-design: on a phone the chat is Home's popup with the Detail / Conversation switch (no vw-layer), so the chip
116
+ // must bring the Detail side forward, covering the conversation, with the Report tab in it
117
+ const shown = () => p.evaluate(() => getComputedStyle(document.querySelector('#dOut')).display !== 'none' && document.querySelector('#dGrid').dataset.tab !== 'chat');
118
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && await shown() ? v : null; }) || await p.evaluate(look);
119
+ s1.detail = await shown();
120
+ ok(`R7 (${scheme}) at 390 the chip covers the page with the Report tab`, s1.detail && /Social login weekly/.test(s1.pane || '') && s1.secs === 7, JSON.stringify(s1));
115
121
  if (shots) await p.screenshot({ path: `${shots}/new-390-${scheme}.png` });
116
122
  ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s1.wide, errs.join(' | '));
117
123
  await ctx.close();
@@ -43,7 +43,9 @@ const icon = () => { const b = document.querySelector('#dTerm'); return b ? { sh
43
43
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
44
44
  await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], working: false, history: null, goal: null, ...thread } }));
45
45
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', messages: [{ role: 'assistant', text: 'Working on the sheet.', at: null }], turn: null } }));
46
- await p.goto(chat); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
46
+ await p.goto(chat); // premium-agreed-design H3: /premium-chat.html opens Home; a desktop docks the chat, a phone opens it from the head's chat button
47
+ if (width < 1000) { await until(() => p.evaluate(() => !!document.querySelector('#hChat'))); await p.click('#hChat'); }
48
+ await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
47
49
  // the Chat page draws a conversation once it has a key: give it one, as a press on a list row does
48
50
  await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.S.key = 'work:term-test'; await m.loadThread('work:term-test'); });
49
51
  return { p, ctx, errs };
@@ -2,10 +2,13 @@
2
2
  'use strict';
3
3
  /* premium-chat-viewer-test.js — the Chat page's viewer opens when something opens in it (initiative premium-chat-viewer, slice 1).
4
4
  * A real server on a scratch repository (c3-scan-fixture.js); the file reads are routed and the conversation is filled in the page.
5
- * V1 at 1280 the page opens with no viewer column; a file press opens it and folds the session list; closing its last tab closes it again
5
+ * Since premium-agreed-design (H2, H3) /premium-chat.html opens Home: on a desktop the chat is docked beside Home's list, on a phone it opens
6
+ * over the list as a popup from the head's chat button.
7
+ * V1 at 1280 the docked chat opens with no viewer column; a file press opens it beside a conversation of at least 360 px (the dock's
8
+ * minimum, cozy-home.css) while Home's list stays in view; closing its last tab closes it again
6
9
  * V3 a closed viewer with tabs shows the head's Viewer pill with the count, and the pill opens it
7
10
  * V4 in a full-screen dialog on another page, a folded viewer unfolds when something opens in it
8
- * V5 at 390 there is no Detail / Conversation switch; a file press covers the page with the file and Back; Back and Escape return
11
+ * V5 at 390 the chat is a popup on its Conversation tab; a file press shows the file on the Detail tab, the switch returns, Escape closes
9
12
  * V6 tabs that do not fit fold into "+N", whose menu opens each
10
13
  * Set CHAT_VIEWER_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
11
14
  const { findBrowser } = require('./lib/find-browser');
@@ -35,7 +38,8 @@ const fill = () => {
35
38
  const look = () => {
36
39
  const g = document.querySelector('#dlg'), w = (s) => { const e = document.querySelector(s); return e ? Math.round(e.getBoundingClientRect().width) : 0; }, pill = document.querySelector('#vwPill');
37
40
  const out = document.querySelector('#dOut').getBoundingClientRect();
38
- return { shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), srlMin: g.classList.contains('srl-min'), conv: w('#dBody'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
41
+ const st = document.querySelector('main.stage'), sr = st.getBoundingClientRect();
42
+ return { list: sr.width > 200 && sr.right <= g.getBoundingClientRect().left + 1 && !st.inert, tab: document.querySelector('#dGrid').dataset.tab, outShown: getComputedStyle(document.querySelector('#dOut')).display !== 'none', on: g.classList.contains('on'), shut: g.classList.contains('vw-shut'), layer: g.classList.contains('vw-layer'), srlMin: g.classList.contains('srl-min'), conv: w('#dBody'), out: Math.round(out.width), outH: Math.round(out.height), vh: innerHeight,
39
43
  sw: getComputedStyle(document.querySelector('#dTabs')).display, pill: pill && !pill.hidden ? pill.textContent.trim() : null, back: !!document.querySelector('#vBack') && getComputedStyle(document.querySelector('#vBack')).display !== 'none',
40
44
  tabs: [...document.querySelectorAll('#vTabs .vtab')].map((t) => (t.hidden ? '~' : '') + t.textContent.trim()), more: (document.querySelector('#vTabs .vmore') || {}).textContent || null,
41
45
  railOff: getComputedStyle(document.querySelector('.rail')).opacity === '0', wide: document.documentElement.scrollWidth > innerWidth + 1 };
@@ -55,7 +59,9 @@ const look = () => {
55
59
  const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
56
60
  await p.route('**/api/doc/locate**', (r) => { const rel = r.request().url().includes('prd') ? 'planning/prd/signup-fix.md' : 'planning/research/signup-drop.md'; r.fulfill({ json: { ok: true, ws: F.ws, rel, name: rel.split('/').pop(), abs: '/x/' + rel, mtime: 1, size: MD.length } }); });
57
61
  await p.route('**/api/doc?**', (r) => r.fulfill({ contentType: 'text/plain', headers: { 'X-Doc-Kind': 'markdown' }, body: MD }));
58
- await p.goto(chat); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
62
+ await p.goto(chat); await until(() => p.evaluate(() => /\/premium\.html$/.test(location.pathname) && !!document.querySelector('#hChat')));
63
+ if (width < 1000) await p.click('#hChat'); // a phone: the list is the page, and the head's chat button opens your chat
64
+ await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#dBody .stream')));
59
65
  await p.evaluate(fill); await sleep(300);
60
66
  return { p, ctx, errs };
61
67
  };
@@ -63,14 +69,14 @@ const look = () => {
63
69
 
64
70
  { const { p, ctx, errs } = await open(1280);
65
71
  const s0 = await p.evaluate(look);
66
- ok('V1 at 1280 the Chat page opens with no viewer column and the conversation wide', s0.shut && s0.out === 0 && s0.conv > 700 && !s0.pill && s0.tabs.length === 0, JSON.stringify(s0));
72
+ ok('V1 at 1280 /premium-chat.html opens Home with the chat docked beside the list, no viewer column and the conversation wide', s0.list && s0.shut && s0.out === 0 && s0.conv > 700 && !s0.pill && s0.tabs.length === 0, JSON.stringify(s0));
67
73
  await p.click('.fpath >> nth=0');
68
74
  const s1 = await until(async () => { const v = await p.evaluate(look); return !v.shut && v.out > 400 ? v : null; }) || await p.evaluate(look);
69
- ok('V1 a file press opens the viewer beside a conversation of at least 380 px and folds the session list', !s1.shut && s1.out > 400 && s1.conv >= 380 && s1.srlMin, JSON.stringify(s1));
75
+ ok('V1 a file press opens the viewer beside a conversation of at least 360 px, and Home\'s list stays in view beside them', !s1.shut && s1.out > 400 && s1.conv >= 360 && s1.list, JSON.stringify(s1));
70
76
  ok('V2 the placeholder is not a tab: the strip shows only the file', s1.tabs.length === 1 && /signup-drop\.md/.test(s1.tabs[0]), JSON.stringify(s1.tabs));
71
77
  await p.click('#vTabs [data-vx]');
72
78
  const s2 = await until(async () => { const v = await p.evaluate(look); return v.shut ? v : null; }) || await p.evaluate(look);
73
- ok('V1 closing the last tab closes the viewer and unfolds the list', s2.shut && s2.out === 0 && !s2.srlMin, JSON.stringify(s2));
79
+ ok('V1 closing the last tab closes the viewer, the conversation takes its width and the list stays', s2.shut && s2.out === 0 && s2.conv > 700 && s2.list, JSON.stringify(s2));
74
80
  await p.click('.fpath >> nth=0'); await p.click('.fpath >> nth=1'); await sleep(300);
75
81
  await p.click('#vFold');
76
82
  const s3 = await until(async () => { const v = await p.evaluate(look); return v.shut && v.pill ? v : null; }) || await p.evaluate(look);
@@ -93,25 +99,25 @@ const look = () => {
93
99
  for (const scheme of ['light', 'dark']) {
94
100
  const { p, ctx, errs } = await open(390, scheme);
95
101
  const s0 = await p.evaluate(look);
96
- ok(`V5 (${scheme}) at 390 there is no Detail / Conversation switch and no viewer`, s0.sw === 'none' && !s0.layer && s0.conv > 300, JSON.stringify(s0));
102
+ ok(`V5 (${scheme}) at 390 the chat opens over Home's list as a popup on its Conversation tab, with the Detail / Conversation switch and no file yet`, s0.on && s0.tab === 'chat' && s0.sw !== 'none' && !s0.layer && s0.conv > 300 && s0.tabs.length === 0, JSON.stringify(s0));
97
103
  await p.click('.fpath >> nth=0');
98
- const s1 = await until(async () => { const v = await p.evaluate(look); return v.layer && v.outH >= v.vh - 2 && v.railOff ? v : null; }) || await p.evaluate(look);
99
- ok(`V5 (${scheme}) a file press covers the page with the file, Back shows and the rail steps aside`, s1.layer && s1.outH >= s1.vh - 2 && s1.back && s1.railOff, JSON.stringify(s1));
104
+ const s1 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'out' && v.outShown && v.tabs.some((t) => /signup-drop\.md/.test(t)) ? v : null; }) || await p.evaluate(look);
105
+ ok(`V5 (${scheme}) a file press shows the file on the Detail tab, the full width of the popup`, s1.tab === 'out' && s1.outShown && s1.out >= 340 && /signup-drop\.md/.test(s1.tabs.join()), JSON.stringify(s1));
100
106
  if (shots) await p.screenshot({ path: `${shots}/chat-viewer-390-${scheme}.png` });
101
- await p.click('#vBack');
102
- const s2 = await until(async () => { const v = await p.evaluate(look); return !v.layer && !v.railOff ? v : null; }) || await p.evaluate(look);
103
- ok(`V5 (${scheme}) Back returns to the conversation, the pill shows the count`, !s2.layer && /1/.test(s2.pill || '') && !s2.railOff, JSON.stringify(s2));
104
- await p.click('#vwPill'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('vw-layer')));
107
+ await p.click('#dTabs [data-t="chat"]');
108
+ const s2 = await until(async () => { const v = await p.evaluate(look); return v.tab === 'chat' ? v : null; }) || await p.evaluate(look);
109
+ ok(`V5 (${scheme}) the Conversation tab returns to the conversation and the file stays open on Detail`, s2.tab === 'chat' && s2.conv > 300 && /signup-drop\.md/.test(s2.tabs.join()), JSON.stringify(s2));
105
110
  await p.keyboard.press('Escape');
106
- const s3 = await until(async () => { const v = await p.evaluate(look); return !v.layer ? v : null; }) || await p.evaluate(look);
107
- ok(`V5 (${scheme}) Escape returns to the conversation`, !s3.layer, JSON.stringify(s3));
111
+ const s3 = await until(async () => { const v = await p.evaluate(look); return !v.on ? v : null; }) || await p.evaluate(look);
112
+ ok(`V5 (${scheme}) Escape closes the popup and Home's list is live again`, !s3.on && await p.evaluate(() => !document.querySelector('main.stage').inert), JSON.stringify(s3));
108
113
  ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s3.wide, errs.join(' | '));
109
114
  await ctx.close();
110
115
  }
111
116
 
112
117
  { const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 } }); const p = await ctx.newPage();
113
118
  await p.addInitScript(() => { try { localStorage.setItem('pmos.srl.view', 'min'); } catch { /* none */ } });
114
- await p.goto(`${F.BASE}/premium.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!document.querySelector('.rail')));
119
+ // another page: Home now holds the chat docked (its viewer never folds to vw-min), so this runs on Insights, a page whose dialogs are popups
120
+ await p.goto(`${F.BASE}/premium-insights.html?ws=${encodeURIComponent(F.ws)}`); await until(() => p.evaluate(() => !!document.querySelector('#dlg') && !!document.querySelector('.rail')));
115
121
  await p.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.openDlg({ eye: 'Goal', title: 'Check the funnel', html: '<p>detail</p>', say: 'Hello', noteKey: 'work:x' }); m.setFull(true); });
116
122
  await sleep(300);
117
123
  const before = await p.evaluate(() => document.querySelector('#dlg').classList.contains('vw-min'));
@@ -90,6 +90,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
90
90
  const P = await open('/premium-board.html'), p = P.page;
91
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
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)
93
94
  await p.click(`#docBody [data-doc="${bkey}"]`); await dlgOn(p);
94
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));
95
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)));
@@ -162,6 +163,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
162
163
  for (const [w, h, theme] of [[390, 844, 'light'], [390, 844, 'dark'], [1280, 900, 'dark']]) {
163
164
  const S = await open('/premium-board.html', { w, h, theme });
164
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)
165
167
  await S.page.click(`#docBody [data-doc="${k4}"]`); await dlgOn(S.page);
166
168
  await until(() => S.page.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
167
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 }));
@@ -130,8 +130,10 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
130
130
  const fr = await frameOf(page);
131
131
  if (fr) await until(() => fr.evaluate(() => document.querySelectorAll('.row').length === 6), 6000);
132
132
  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));
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; });
134
+ // 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
+ // 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
+ 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
137
  if (SHOTS) { fs.mkdirSync(SHOTS, { recursive: true }); await sleep(300); await page.screenshot({ path: path.join(SHOTS, `${TAG}-${w}-${theme}.png`) }); }
136
138
  await ctx.close();
137
139
  }