create-pmos 0.424.0 → 0.426.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 (110) hide show
  1. package/package.json +25 -25
  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/state/discoveries.md +1 -1
  6. package/workspace/board-deliveries-test.js +153 -0
  7. package/workspace/board-programs-test.js +60 -36
  8. package/workspace/board-shot.js +4 -3
  9. package/workspace/briefing-premium-board-test.js +9 -6
  10. package/workspace/briefing-premium-insights-test.js +31 -15
  11. package/workspace/briefing-premium-products-test.js +46 -43
  12. package/workspace/calm-timeline-test.js +190 -0
  13. package/workspace/changelog.json +24 -0
  14. package/workspace/ev-everywhere-test.js +3 -1
  15. package/workspace/guide/briefing-premium.md +3 -2
  16. package/workspace/guide/claude-proposes.md +16 -1
  17. package/workspace/guide/home.md +2 -2
  18. package/workspace/guide/index.md +1 -0
  19. package/workspace/guide/notes.md +39 -1
  20. package/workspace/guide/present-in-a-meeting.md +57 -0
  21. package/workspace/guide/programs.md +4 -3
  22. package/workspace/lib/board-premium.js +3 -1
  23. package/workspace/lib/briefing-premium-products.js +18 -4
  24. package/workspace/lib/chat-file-locate.js +40 -2
  25. package/workspace/lib/engine/boards.js +8 -2
  26. package/workspace/lib/idle-close.js +60 -0
  27. package/workspace/lib/loose-proposals.js +302 -0
  28. package/workspace/lib/meeting-focus.js +64 -14
  29. package/workspace/lib/my-work-premium.js +1 -1
  30. package/workspace/lib/proposal-runs.js +77 -2
  31. package/workspace/lib/propose-cli.js +42 -1
  32. package/workspace/lib/route-modules.js +1 -0
  33. package/workspace/lib/routes-boards.js +16 -4
  34. package/workspace/lib/routes-brief-page.js +9 -1
  35. package/workspace/lib/routes-briefing-premium.js +19 -0
  36. package/workspace/lib/routes-loose.js +210 -0
  37. package/workspace/lib/routes-meeting-focus.js +28 -6
  38. package/workspace/lib/routes-pm-items.js +27 -17
  39. package/workspace/lib/settings-store.js +2 -1
  40. package/workspace/lib/task-cli.js +18 -11
  41. package/workspace/milestone-pins-test.js +170 -0
  42. package/workspace/package-lock.json +2 -2
  43. package/workspace/package.json +1 -1
  44. package/workspace/premium-board-actions-test.js +2 -1
  45. package/workspace/premium-briefing-depth-test.js +2 -2
  46. package/workspace/premium-chat-term-test.js +13 -2
  47. package/workspace/premium-core-doc-issue-test.js +1 -1
  48. package/workspace/premium-rec-now-test.js +153 -0
  49. package/workspace/premium-rec-tab-test.js +167 -0
  50. package/workspace/product-lane-test.js +30 -17
  51. package/workspace/public/pm/bd-acts.js +6 -3
  52. package/workspace/public/pm/bd-deliveries.js +218 -0
  53. package/workspace/public/pm/bd-pin-card.css +16 -0
  54. package/workspace/public/pm/bd-pin-card.js +80 -0
  55. package/workspace/public/pm/bd-pins.js +33 -0
  56. package/workspace/public/pm/bd-pop.js +2 -0
  57. package/workspace/public/pm/bd-prog.js +5 -4
  58. package/workspace/public/pm/bd-span.js +140 -102
  59. package/workspace/public/pm/cozy-aud.css +9 -0
  60. package/workspace/public/pm/cozy-aud.js +80 -0
  61. package/workspace/public/pm/cozy-board.css +73 -11
  62. package/workspace/public/pm/cozy-home.css +16 -1
  63. package/workspace/public/pm/cozy-live-pill.js +3 -0
  64. package/workspace/public/pm/cozy-pick.css +41 -0
  65. package/workspace/public/pm/cozy-pick.js +134 -0
  66. package/workspace/public/pm/cozy-rec-bridge.js +32 -0
  67. package/workspace/public/pm/cozy-rec-now.css +104 -0
  68. package/workspace/public/pm/cozy-rec-now.js +330 -0
  69. package/workspace/public/pm/cozy-rec-present.css +69 -0
  70. package/workspace/public/pm/cozy-rec-present.js +467 -0
  71. package/workspace/public/pm/cozy-rec-tab.css +90 -0
  72. package/workspace/public/pm/cozy-rec-tab.js +219 -0
  73. package/workspace/public/pm/cozy-settings.js +8 -2
  74. package/workspace/public/pm/cozy-today.css +4 -0
  75. package/workspace/public/pm/home-app.js +51 -22
  76. package/workspace/public/pm/home-data.js +5 -3
  77. package/workspace/public/pm/home-list.js +63 -15
  78. package/workspace/public/pm/home-more.js +2 -31
  79. package/workspace/public/pm/home-today.js +19 -9
  80. package/workspace/public/pm/ini-tasks.js +4 -1
  81. package/workspace/public/pm/live-model.js +1 -1
  82. package/workspace/public/pm/loose-props.css +54 -0
  83. package/workspace/public/pm/loose-props.js +262 -0
  84. package/workspace/public/pm/premium-board.js +65 -30
  85. package/workspace/public/pm/premium-insights.js +42 -24
  86. package/workspace/public/pm/premium-meeting.js +17 -4
  87. package/workspace/public/pm/premium-mtg-present.js +4 -3
  88. package/workspace/public/pm/premium-report-read.js +2 -0
  89. package/workspace/public/pm/premium-vw-mtg.js +15 -7
  90. package/workspace/public/pm/rec-state.js +13 -5
  91. package/workspace/public/pm/rec-tab-core.js +92 -0
  92. package/workspace/public/pm/term-view.js +81 -10
  93. package/workspace/public/pm/view-notes.js +9 -0
  94. package/workspace/public/premium-aud.html +22 -0
  95. package/workspace/public/premium-board.html +2 -0
  96. package/workspace/public/premium-insights.html +2 -1
  97. package/workspace/public/premium-rec.html +30 -0
  98. package/workspace/public/premium.html +1 -0
  99. package/workspace/rec-present-test.js +229 -0
  100. package/workspace/server.js +116 -7
  101. package/workspace/skills/loose-propose.skill +39 -0
  102. package/workspace/task-milestones-test.js +15 -6
  103. package/workspace/test-lists/board-deliveries.json +13 -0
  104. package/workspace/test-lists/calm-timeline.json +5 -0
  105. package/workspace/test-lists/loose-props.json +9 -0
  106. package/workspace/test-lists/milestone-pins.json +6 -0
  107. package/workspace/test-lists/rec-now.json +6 -0
  108. package/workspace/test-lists/rec-present.json +13 -0
  109. package/workspace/test-lists/recording-tab.json +13 -0
  110. package/workspace/timeline-holds-test.js +44 -42
@@ -5,7 +5,7 @@
5
5
  * pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]
6
6
  * a new task, by the same function as the page's Add a task (lib/routes-boards.js taskAdd, POST /api/boards/tasks/add)
7
7
  * pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start …|none] [--owner <who>] [--notes <text>]
8
- * [--milestone|--no-milestone]
8
+ * [--milestone|--no-milestone] [--pin|--no-pin|--pin-default]
9
9
  * place tasks under a workflow stage of their initiative, or change their dates, owner or notes, by the same function as the Viewer's
10
10
  * edit (lib/routes-boards.js taskEdit, POST /api/boards/tasks/edit). The Tasks section groups tasks by stage (feedback batch 6:
11
11
  * an agent asked to group tasks by stage had no command for it).
@@ -38,9 +38,11 @@ const USAGE = [
38
38
  ' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]',
39
39
  ' Add a task. Every new task goes here; pmos item add is the older breakdown record.',
40
40
  ' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
41
- ' [--milestone|--no-milestone]',
41
+ ' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default]',
42
42
  ' Group tasks under a stage of the initiative\'s workflow (key or name; none takes it out), or change dates, owner or notes.',
43
43
  ' --milestone makes a task a milestone: its due date shows as ◇ on the Board and the timeline. Set it only when the PM asks.',
44
+ ' --pin shows a milestone on the Board timeline, --no-pin hides it, --pin-default goes back to the rule (the last milestone',
45
+ ' shows). Set it only when the PM asks.',
44
46
  ' pmos task list <initiative> [--all] its open tasks; --all adds Done, Won\'t do and Archived',
45
47
  ' pmos task remove <task> [<task> …] [--why <text>]',
46
48
  ' Delete a task added by mistake (a placeholder, a duplicate) when the PM asks. It goes from every list; the page\'s Undo brings',
@@ -58,7 +60,8 @@ const USAGE = [
58
60
  ' pmos task unlink <from> <to>',
59
61
  ' every command: [--json] [--root <dir>]. Nothing is sent.',
60
62
  ];
61
- const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'propose']);
63
+ const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'pin', 'no-pin', 'pin-default', 'propose']);
64
+ const PIN_FLAGS = ['pin', 'no-pin', 'pin-default'];
62
65
  const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag']);
63
66
  const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage'], link: ['type', 'lag', 'why'], unlink: [] };
64
67
  const OPEN = new Set(['To do', 'In progress']);
@@ -102,7 +105,7 @@ function boardsCtx(root, stateDir) {
102
105
  const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
103
106
  return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
104
107
  }
105
- const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.milestone ? ' · ◇ milestone' : ''}${t.stage ? ' · under ' + t.stage : ''}${t.due ? ' · due ' + t.due : ''}`;
108
+ const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.milestone ? ' · ◇ milestone' : ''}${t.pinned === true ? ' · pinned' : t.pinned === false ? ' · not pinned' : ''}${t.stage ? ' · under ' + t.stage : ''}${t.due ? ' · due ' + t.due : ''}`;
106
109
  /** The workflow row of an initiative, deriving the rows when they are still being read. */
107
110
  function rowOf(boards, ctx, w, id) {
108
111
  let r = boards.initiativeWorkflow(ctx, w, id);
@@ -128,6 +131,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
128
131
  if (flags.all && verb !== 'list') return fail(`--all is not an option of ${verb}`, 2);
129
132
  for (const k of ['milestone', 'no-milestone']) if (flags[k] && verb !== 'set') return fail(`--${k} is not an option of ${verb}`, 2);
130
133
  if (flags.milestone && flags['no-milestone']) return fail('--milestone and --no-milestone contradict each other', 2);
134
+ for (const k of PIN_FLAGS) if (flags[k] && verb !== 'set') return fail(`--${k} is not an option of ${verb}`, 2);
135
+ if (PIN_FLAGS.filter((k) => flags[k]).length > 1) return fail('give one of --pin, --no-pin and --pin-default', 2);
131
136
  if (flags.propose && verb !== 'link') return fail(`--propose is not an option of ${verb}`, 2);
132
137
  const root = flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd);
133
138
  const stateDir = driver.stateDirOf(root, { create: verb !== 'list' });
@@ -141,11 +146,12 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
141
146
  const tasksOf = (id) => {
142
147
  const r = rowOf(boards, ctx, w, id);
143
148
  const board = r.ok ? r.board.id : null;
144
- const F = boards.foldOf(ctx, w), S = F.sections || new Map(), MS = F.milestones || new Map();
149
+ const F = boards.foldOf(ctx, w), S = F.sections || new Map(), MS = F.milestones || new Map(), PN = F.pins || new Map();
150
+ const pinOf = (tid) => (PN.has(tid) ? { pinned: PN.get(tid) } : {}); // the PM's pin on the Board timeline (batch 13 item 4); unset = the rule
145
151
  const msOf = (tid, own) => (MS.has(tid) ? MS.get(tid) : !!own); // the PM's ◇ flag (feedback batch 11 item 3)
146
152
  const stageOf = (tid, from) => (S.has(tid) ? S.get(tid) : (from && from.stage) || ''); // the group the Tasks section shows it under
147
- const own = [...(F.tasks || new Map()).values()].filter((t) => t.initiative === id).map((t) => ({ ...t, stage: stageOf(t.id, t.from), milestone: msOf(t.id) }));
148
- const items = TI.rowsOf(root, new Set([id]), board).map((x) => ({ id: x.uid, board, kind: 'Task', title: x.title, state: x.status, owner: x.owner, due: x.end, store: 'item', stage: stageOf(x.uid), milestone: msOf(x.uid, x.milestone) }));
153
+ const own = [...(F.tasks || new Map()).values()].filter((t) => t.initiative === id).map((t) => ({ ...t, stage: stageOf(t.id, t.from), milestone: msOf(t.id), ...pinOf(t.id) }));
154
+ const items = TI.rowsOf(root, new Set([id]), board).map((x) => ({ id: x.uid, board, kind: 'Task', title: x.title, state: x.status, owner: x.owner, due: x.end, store: 'item', stage: stageOf(x.uid), milestone: msOf(x.uid, x.milestone), ...pinOf(x.uid) }));
149
155
  return own.concat(items);
150
156
  };
151
157
 
@@ -176,7 +182,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
176
182
  try { boards.seedInitiative(ctx, w, id); } catch { /* the To finish tasks are made on the next read */ }
177
183
  const all = tasksOf(id);
178
184
  const shown = flags.all ? all : all.filter((t) => OPEN.has(t.state));
179
- if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, due: t.due, stage: t.stage || '', ...(t.milestone ? { milestone: true } : {}), ...(t.from ? { from: t.from } : {}) })) })); return 0; }
185
+ if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, due: t.due, stage: t.stage || '', ...(t.milestone ? { milestone: true } : {}), ...(typeof t.pinned === 'boolean' ? { pinned: t.pinned } : {}), ...(t.from ? { from: t.from } : {}) })) })); return 0; }
180
186
  if (!shown.length) { say(all.length ? `No open task on ${id}. --all lists the ${all.length} closed.` : `No task on ${id}.`); return 0; }
181
187
  for (const t of shown) say(line(t));
182
188
  return 0;
@@ -194,8 +200,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
194
200
  };
195
201
 
196
202
  if (verb === 'set') {
197
- const keys = ['stage', 'due', 'start', 'owner', 'notes'].filter((k) => flags[k] !== undefined).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []);
198
- if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>] [--milestone|--no-milestone]'); return 2; }
203
+ const keys = ['stage', 'due', 'start', 'owner', 'notes'].filter((k) => flags[k] !== undefined).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
204
+ if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>] [--milestone|--no-milestone] [--pin|--no-pin|--pin-default]'); return 2; }
199
205
  const folded = boards.foldOf(ctx, w);
200
206
  const done = [], refused = [];
201
207
  for (const id of pos) {
@@ -212,11 +218,12 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
212
218
  for (const k of ['due', 'start']) if (flags[k] !== undefined) body[k] = String(flags[k]).toLowerCase() === 'none' ? '' : flags[k];
213
219
  for (const k of ['owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
214
220
  if (flags.milestone || flags['no-milestone']) body.milestone = !!flags.milestone;
221
+ if (PIN_FLAGS.some((k) => flags[k])) body.pinned = flags.pin ? true : flags['no-pin'] ? false : null;
215
222
  const e = boards.taskEdit(ctx, body, g);
216
223
  if (!e.body || e.body.ok !== true) refused.push({ task: id, error: (e.body && e.body.error) || 'the write was refused' });
217
224
  else done.push({ task: id, title: t.title, set: Object.fromEntries(keys.map((k) => [k, k === 'stage' ? body.section : body[k]])) });
218
225
  }
219
- const what = (x) => Object.entries(x).map(([k, v]) => (k === 'stage' ? (v ? 'under ' + v : 'under no stage') : k === 'milestone' ? (v ? 'a milestone' : 'not a milestone') : v === '' ? 'no ' + k : k + ' ' + v)).join(', ');
226
+ const what = (x) => Object.entries(x).map(([k, v]) => (k === 'stage' ? (v ? 'under ' + v : 'under no stage') : k === 'milestone' ? (v ? 'a milestone' : 'not a milestone') : k === 'pinned' ? (v === true ? 'pinned to the timeline' : v === false ? 'off the timeline' : 'pinned by the rule') : v === '' ? 'no ' + k : k + ' ' + v)).join(', ');
220
227
  // a date changed outside a drag: inside the approved links, what waits on it moves quietly (batch 11 item 15, the grey ✦ on the page)
221
228
  let kept = 0;
222
229
  if (done.length && (flags.due !== undefined || flags.start !== undefined)) {
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* milestone-pins-test.js — choose which milestones the Board timeline shows, on the page (feedback batch 13 item 4, calmer timeline A5; canvas
4
+ * Ready for development, row "Calmer Board timeline": XcalmA5Milestones). Serves the real page from the real server; GET /api/board-premium
5
+ * answers a board built by lib/board-premium.js. POST /api/boards/tasks/edit is answered here and its bodies are kept.
6
+ * C the ◇ card: a press on a row's ◇ (`[data-ms-pick]`; one is put on the row when pm/bd-span.js draws none yet) opens a card with the
7
+ * milestone's name, its date and "N of M milestones on the timeline", then every milestone with an icon-only pin toggle
8
+ * T a toggle writes { task, pinned } at once, the card counts again and keeps the focus; a refused write puts it back and says why
9
+ * F the Filter on the timeline: "Milestones on the timeline: Pinned · All · None" with its line; a pick is remembered; Clear goes back
10
+ * to Pinned; the List view's Filter has no such group
11
+ * P the phone: the card is a bottom sheet
12
+ * SHOTS_4B=<dir>: the card and the Filter, desktop and phone, into <dir>. */
13
+ const path = require('path');
14
+ const { spawn } = require('child_process');
15
+ const { findBrowser } = require('./lib/find-browser');
16
+ const T = require('./test-run').configure({ name: 'milestone-pins' });
17
+ const BP = require('./lib/board-premium.js');
18
+ const F = require('./fixtures/board-premium-facts.js');
19
+
20
+ const BASE = T.BASE;
21
+ const results = [];
22
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
23
+ let srv = null; let browser = null;
24
+ const finish = async (code) => {
25
+ if (browser) await browser.close().catch(() => {});
26
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
27
+ T.killTmux();
28
+ const bad = results.filter((x) => !x.cond).length;
29
+ console.log(`\n${results.length - bad}/${results.length} milestone-pins assertions passed`);
30
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
31
+ };
32
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
+
34
+ const ROWS = [
35
+ F.row('migration', 'Migration — move from Okta to Descope', { owner: 'Wawan', stage: 'Build', start: '2026-10-01', end: '2027-09-05', progress: 20 }),
36
+ F.row('passkey', 'Passkey sign-in', { owner: 'Lee', start: '2026-09-15', end: '2027-02-26', progress: 45 }),
37
+ ];
38
+ const it = (ini, uid, title, o) => ({ uid, key: '', kind: 'Task', src: 'pmos', title, status: 'To do', owner: 'Wawan', ini, start: null, end: null, ref: uid, board: 'w1', milestone: true, ...o });
39
+ const ITEMS = [
40
+ it('migration', 'm-it1', 'Iteration 1 live', { end: '2027-01-20' }),
41
+ it('migration', 'm-it2', 'Iteration 2 live', { end: '2027-03-25' }),
42
+ it('migration', 'm-rel', 'Release: all users on Descope', { end: '2027-06-01', pinned: true }),
43
+ it('migration', 'm-eval', 'Evaluation at 30 days', { end: '2027-07-01' }),
44
+ it('migration', 'm-okta', 'Okta decommissioned', { end: '2027-09-05' }),
45
+ it('passkey', 'p-beta', 'Beta to staff', { end: '2026-12-18' }),
46
+ ];
47
+
48
+ (async () => {
49
+ const exe = findBrowser();
50
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
51
+ let chromium;
52
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
53
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
54
+ await T.waitForServer(BASE);
55
+ browser = await chromium.launch({ executablePath: exe });
56
+
57
+ /** The Board on the timeline. o: { w, h, phone, refuse, view } */
58
+ const open = async (o = {}) => {
59
+ const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.phone, isMobile: !!o.phone });
60
+ const page = await ctx.newPage();
61
+ const errors = [], posts = [];
62
+ page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
63
+ await page.clock.setFixedTime(new Date(F.NOW));
64
+ // the pins written so far come back on the next read, as the server's would
65
+ const PIN = new Map();
66
+ const model = () => BP.build(F.facts({ rows: ROWS.map((r) => ({ ...r })), total: ROWS.length, columns: [], items: ITEMS.map((x) => (PIN.has(x.uid) ? { ...x, pinned: PIN.get(x.uid) } : { ...x })) }));
67
+ await page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: model(), as_of: Date.now() }) }));
68
+ await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: [] }) }));
69
+ await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
70
+ await page.route('**/api/boards/tasks/edit', (r) => {
71
+ const b = JSON.parse(r.request().postData() || '{}'); posts.push(b);
72
+ if (o.refuse) return r.fulfill({ status: 409, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'no state folder here' }) });
73
+ PIN.set(b.task, b.pinned);
74
+ return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, from: { pinned: null }, item: null }) });
75
+ });
76
+ await page.addInitScript(([s]) => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); for (const [k, v] of Object.entries(s)) localStorage.setItem(k, v); } } catch { /* none */ } }, [{ 'pmos.board.view': o.view || 'time', 'pmos.board.pview': o.view || 'time', 'pmos.board.span': 'year' }]);
77
+ await page.goto(BASE + '/premium-board.html?ws=w1&board=w1');
78
+ await page.waitForSelector('#ibBody [data-row]', { timeout: 15000 });
79
+ await page.waitForTimeout(400);
80
+ return { ctx, page, errors, posts };
81
+ };
82
+ const shots = process.env.SHOTS_4B;
83
+ const shot = async (p, name) => { if (shots) await p.screenshot({ path: path.join(shots, name + '.png') }); };
84
+ /** The row's ◇ for a milestone: pm/bd-span.js's, else one put on the row's lane the way it draws it (the lead build draws them). */
85
+ const pick = async (p, key, id) => {
86
+ await p.evaluate(([k, i]) => {
87
+ if (document.querySelector(`[data-ms-pick="${k}"][data-ms-id="${i}"]`)) return;
88
+ const lane = document.querySelector(`#ibBody [data-row="${k}"] .tg-p`) || document.querySelector(`#ibBody [data-row="${k}"]`);
89
+ const b = document.createElement('button'); b.type = 'button'; b.className = 'tg-tm'; b.dataset.msPick = k; b.dataset.msId = i; b.setAttribute('aria-label', 'Milestone'); b.style.cssText = 'position:absolute;left:60%;top:8px;width:14px;height:14px';
90
+ lane.appendChild(b);
91
+ }, [key, id]);
92
+ await p.click(`[data-ms-pick="${key}"][data-ms-id="${id}"]`);
93
+ await p.waitForSelector('#bdPop.bd-pc:not([hidden])', { timeout: 4000 });
94
+ };
95
+ const card = (p) => p.evaluate(() => {
96
+ const c = document.querySelector('#bdPop'); if (!c || c.hidden) return null;
97
+ return { h: (c.querySelector('.bd-pc-h') || {}).textContent || '', sub: (c.querySelector('.bd-pc-sub') || {}).textContent || '',
98
+ rows: [...c.querySelectorAll('.bd-pc-r')].map((r) => { const b = r.querySelector('[data-pin-ms]'); return [r.querySelector('.bd-pc-n').textContent, b.getAttribute('aria-pressed'), b.textContent.trim(), b.getAttribute('aria-label')]; }),
99
+ focus: document.activeElement && document.activeElement.dataset ? document.activeElement.dataset.pinMs || '' : '' };
100
+ });
101
+
102
+ /* C T — desktop */
103
+ {
104
+ const { ctx, page: p, errors, posts } = await open();
105
+ await pick(p, 'board:migration', 'm-rel');
106
+ let c = await card(p);
107
+ ok('C the card names the ◇ pressed, its date and how many milestones are on the timeline',
108
+ c && c.h === 'Release: all users on Descope' && c.sub === 'Jun 1 ’27 · 2 of 5 milestones on the timeline', JSON.stringify(c));
109
+ ok('C every milestone by date, pinned = the PM\'s pin plus the last one; each toggle is an icon with a label',
110
+ c && c.rows.map((r) => r[0] + '|' + r[1]).join(',') === 'Iteration 1 liveJan 20 ’27|false,Iteration 2 liveMar 25 ’27|false,Release: all users on DescopeJun 1 ’27|true,Evaluation at 30 daysJul 1 ’27|false,Okta decommissionedSep 5 ’27|true'
111
+ && c.rows.every((r) => r[2] === '' && /^Show(n)? on the timeline: /.test(r[3])), JSON.stringify(c && c.rows));
112
+ await shot(p, 'pins-card-1440');
113
+ await p.click('#bdPop [data-pin-ms="m-it2"]');
114
+ await p.waitForTimeout(500);
115
+ c = await card(p);
116
+ ok('T a toggle writes pinned true for that task, on this board', posts.length === 1 && posts[0].task === 'm-it2' && posts[0].pinned === true && posts[0].board === 'w1', JSON.stringify(posts));
117
+ ok('T the card stays open, counts again and keeps the focus on the toggle', c && /3 of 5 milestones on the timeline/.test(c.sub) && c.rows[1][1] === 'true' && c.focus === 'm-it2', JSON.stringify(c));
118
+ await p.click('#bdPop [data-pin-ms="m-okta"]');
119
+ await p.waitForTimeout(500);
120
+ c = await card(p);
121
+ ok('T unpinning the last one writes pinned false', posts[1] && posts[1].task === 'm-okta' && posts[1].pinned === false && c && /2 of 5/.test(c.sub), JSON.stringify(posts));
122
+ await p.keyboard.press('Escape');
123
+ ok('C Escape closes the card', await p.evaluate(() => document.querySelector('#bdPop').hidden));
124
+ ok('C the ◇ press does not open the initiative', await p.evaluate(() => !document.querySelector('.iv-tr')));
125
+
126
+ /* F — the Filter */
127
+ await p.click('#bdFilter');
128
+ const f = await p.evaluate(() => { const c = document.querySelector('#bdPop'); const g = c.querySelector('[role="radiogroup"][aria-label="Milestones on the timeline"]'); return g ? { chips: [...g.querySelectorAll('[data-msmode]')].map((b) => b.textContent + '|' + b.getAttribute('aria-checked')), line: c.textContent.includes('Pinned = the last milestone, plus any you pin.') } : null; });
129
+ ok('F the timeline\'s Filter has "Milestones on the timeline: Pinned · All · None" with its line, Pinned on', f && f.chips.join() === 'Pinned|true,All|false,None|false' && f.line, JSON.stringify(f));
130
+ await shot(p, 'pins-filter-1440');
131
+ await p.click('#bdPop [data-msmode="all"]');
132
+ ok('F All is picked and remembered', await p.evaluate(() => localStorage.getItem('pmos.board.msMode') === 'all' && document.querySelector('#bdPop [data-msmode="all"]').getAttribute('aria-checked') === 'true'));
133
+ await p.click('#bdPop [data-fclear]');
134
+ ok('F Clear goes back to Pinned', await p.evaluate(() => localStorage.getItem('pmos.board.msMode') === 'pinned'));
135
+ ok('the Board threw nothing', !errors.length, errors.join('\n'));
136
+ await ctx.close();
137
+ }
138
+
139
+ /* T — a refused write */
140
+ {
141
+ const { ctx, page: p } = await open({ refuse: true });
142
+ await pick(p, 'board:migration', 'm-rel');
143
+ await p.click('#bdPop [data-pin-ms="m-it1"]');
144
+ await p.waitForTimeout(400);
145
+ const c = await card(p), toast = await p.evaluate(() => document.body.textContent.includes('no state folder here'));
146
+ ok('T a refused write puts the toggle back and says why', c && c.rows[0][1] === 'false' && /2 of 5/.test(c.sub) && toast, JSON.stringify(c));
147
+ await ctx.close();
148
+ }
149
+
150
+ /* F — no group off the timeline */
151
+ {
152
+ const { ctx, page: p } = await open({ view: 'list' });
153
+ await p.click('#bdFilter');
154
+ ok('F the List view\'s Filter has no milestone group', await p.evaluate(() => !document.querySelector('#bdPop [data-msmode]')));
155
+ await ctx.close();
156
+ }
157
+
158
+ /* P — the phone */
159
+ {
160
+ const { ctx, page: p, errors } = await open({ w: 390, h: 844, phone: true });
161
+ await pick(p, 'board:migration', 'm-okta');
162
+ const sheet = await p.evaluate(() => document.querySelector('#bdPop').classList.contains('sheet'));
163
+ const c = await card(p);
164
+ ok('P the card is a bottom sheet with the same list', sheet && c && c.rows.length === 5 && c.h === 'Okta decommissioned', JSON.stringify(c));
165
+ await shot(p, 'pins-card-390');
166
+ ok('the phone threw nothing', !errors.length, errors.join('\n'));
167
+ await ctx.close();
168
+ }
169
+ finish();
170
+ })();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.424.0",
3
+ "version": "0.426.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.424.0",
9
+ "version": "0.426.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.424.0",
3
+ "version": "0.426.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",
@@ -246,7 +246,8 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
246
246
 
247
247
  /* P the POST allow-list and the refusals */
248
248
  const all = P.posts.concat(I.posts);
249
- const other = all.filter((x) => !ALLOWED.test(x.path) && x.path !== '/api/briefing-premium/seen'); // an opened popup's record (popup context slice 11, R1) is not a press
249
+ const other = all.filter((x) => !ALLOWED.test(x.path) && x.path !== '/api/briefing-premium/seen' // an opened popup's record (popup context slice 11, R1) is not a press
250
+ && x.path !== '/api/loose-props/rows'); // what Home shows loose, sent once when it changed so Claude can propose a clean-up (batch 13 item 3); it changes no work
250
251
  ok('P1 the pages post only to the asks, move, lifecycle, archive, initiative-layout and proposals/look routes', all.length > 10 && !other.length, JSON.stringify(other));
251
252
  const noNonce = await post('/api/boards/move', { id: 'fx-bare', to: ready.model.board.stages[1] }, { 'Content-Type': 'application/json', Origin: BASE });
252
253
  const lifeNo = await post('/api/lifecycle', { initiative_id: 'fx-bare', state: 'on-hold' }, { 'Content-Type': 'application/json', Origin: BASE });
@@ -326,7 +326,7 @@ const GANTT = [
326
326
  repReply = null;
327
327
 
328
328
  /* W: the POST allow-list */
329
- const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh', '/api/sources/refresh-all', '/api/report-setups/setup', '/api/report-setups/dismiss', '/api/briefing-premium/seen', '/api/news-for-you/seen']); // news-for-you/seen: closing New for you marks what it showed seen // seen: an opened popup's record (popup context slice 11, R1)
329
+ const allowed = new Set(['/api/mentions/read', '/api/pm-items/add', '/api/driver/keep', '/api/driver/return', '/api/driver/drop', '/api/scan/proposal', '/api/scan/now', '/api/scan/stop', '/api/sources/refresh', '/api/sources/refresh-all', '/api/report-setups/setup', '/api/report-setups/dismiss', '/api/briefing-premium/seen', '/api/news-for-you/seen', '/api/loose-props/rows']); // news-for-you/seen: closing New for you marks what it showed seen // seen: an opened popup's record (popup context slice 11, R1) // loose-props/rows: what Home shows loose, sent when it changed (batch 13 item 3); it changes no work
330
330
  const strays = posts.filter((x) => !allowed.has(x.path) && !/^\/api\/home-desk\//.test(x.path)); // /api/home-desk/*: Home's own chat (a conversation seen), not Around you
331
331
  ok('W1 every POST is one of the existing routes in the PRD', posts.length > 0 && strays.length === 0, JSON.stringify(strays));
332
332
  const fields = { '/api/driver/keep': ['ws', 'proposal'], '/api/driver/return': ['ws', 'proposal', 'note'], '/api/driver/drop': ['ws', 'proposal'], '/api/mentions/read': ['id', 'read'], '/api/pm-items/add': ['line'], '/api/scan/proposal': ['ws', 'id', 'action', 'why'], '/api/scan/now': ['ws'], '/api/sources/refresh': ['ws', 'source'], '/api/sources/refresh-all': ['ws'], '/api/report-setups/setup': ['ws', 'finding'], '/api/report-setups/dismiss': ['ws', 'finding', 'name'] };
@@ -350,7 +350,7 @@ const GANTT = [
350
350
  await p.unroute('**/api/brief-page*');
351
351
  await p.route('**/api/brief-page*', async (r) => { const res = await r.fetch(); const b = await res.json(); json(r, { ...b, today: TODAY.map((m) => ({ ...m, state: 'past' })) }); });
352
352
  await p.reload(); await openCard();
353
- ok('PR2 the ring is not shown when no meeting is left today', await p.evaluate(() => { const c = document.querySelector('#czViewer #prep'); return !!c && c.hidden; }));
353
+ ok('PR2 the ring is not shown when no meeting is left today', !!(await until(() => p.evaluate(() => { const c = document.querySelector('#czViewer #prep'); return !!c && c.hidden; }), 10000)));
354
354
  await p.unroute('**/api/brief-page*');
355
355
 
356
356
  /* L: floors */
@@ -6,6 +6,7 @@
6
6
  * header, so the icon sits in the box's toolbar; nothing links to the console)
7
7
  * O2 an ended chat: the icon copies the line that resumes it
8
8
  * O3 no session: no icon
9
+ * O4 the terminal is drawn from the raw bytes by a read-only xterm.js: cursor moves and redraws land as on screen; later reads ask only for what is new
9
10
  * Set CHAT_TERM_SHOTS=<dir> to save the header at 1280 light and 390 dark. */
10
11
  const { findBrowser } = require('./lib/find-browser');
11
12
  require('./test-run').configure({ name: 'premium-chat-term' });
@@ -53,12 +54,22 @@ const pressTerm = async (p) => { await p.click('#hmAdd'); await p.click('#hmTerm
53
54
  { const { p, ctx, errs } = await open({ session: 'sess-7' });
54
55
  const i = await until(async () => { const v = await p.evaluate(icon); return v && v.shown ? v : null; }) || await p.evaluate(icon);
55
56
  ok('O1 a running session shows the terminal in the box\'s + menu', i && i.shown && i.label === 'Watch its terminal' && i.inBox, JSON.stringify(i));
56
- let read = null; await p.route('**/api/sessions/transcript?**', (r) => { read = new URL(r.request().url()).searchParams.get('id'); r.fulfill({ json: { ok: true, id: 'sess-7', text: 'claude> working on the sheet' } }); });
57
+ // raw=1 (PM, 2026-10-27 "Broken format on terminal view"): the bytes as printed, drawn in a read-only terminal; then only what is new
58
+ let read = null; const asked = [];
59
+ const RAW = 'claude> working\x1b[1Con the sheet\r\n\x1b[2m*Compacting\x1b[0m\r*Compacted.\r\n';
60
+ await p.route('**/api/sessions/transcript?**', (r) => { const q = new URL(r.request().url()).searchParams; read = q.get('id'); asked.push(q.get('since'));
61
+ if (q.get('raw') !== '1') return r.fulfill({ json: { ok: true, id: 'sess-7', text: 'claude> working on the sheet' } });
62
+ if (q.get('since') === String(RAW.length) && q.get('gen') === '0') return r.fulfill({ json: { ok: true, id: 'sess-7', cols: 60, rows: 12, gen: 0, end: RAW.length + 6, reset: false, data: 'next\r\n' } });
63
+ r.fulfill({ json: { ok: true, id: 'sess-7', cols: 60, rows: 12, gen: 0, end: RAW.length, reset: true, data: RAW } }); });
57
64
  let pops = 0; ctx.on('page', () => { pops++; });
58
65
  await pressTerm(p);
59
- const v = await until(() => p.evaluate(() => { const w = document.querySelector('#czViewer:not([hidden])'); return w && /working on the sheet/.test(w.textContent) ? (w.querySelector('.cz-vw-kind') || {}).textContent : null; }));
66
+ const v = await until(() => p.evaluate(() => { const w = document.querySelector('#czViewer:not([hidden])'); return w && /working/.test(w.textContent) ? (w.querySelector('.cz-vw-kind') || {}).textContent : null; }));
60
67
  ok('O1 pressing it shows that same session\'s terminal, read only, in the Viewer; no tab opens and nothing links to the console', v === 'Terminal · read only' && read === 'sess-7' && pops === 0
61
68
  && !(await p.evaluate(() => [...document.querySelectorAll('a[href]')].some((a) => /console/.test(a.getAttribute('href'))))), JSON.stringify([v, read, pops]));
69
+ const lines = () => p.evaluate(() => [...document.querySelectorAll('#czViewer .xterm-rows > div')].map((d) => d.textContent.replace(/\u00a0/g, ' ').trimEnd()).filter(Boolean));
70
+ const l1 = await until(async () => { const l = await lines(); return l.includes('next') ? l : null; }, 9000) || await lines();
71
+ ok('O4 the terminal draws the bytes as a terminal would: a cursor move is a space and a redraw replaces its line, not a new one', l1[0] === 'claude> working on the sheet' && l1[1] === '*Compacted.' && !l1.some((x) => /Compacting/.test(x)), JSON.stringify(l1));
72
+ ok('O4 after the first read it asks only for what is new', l1.includes('next') && asked.includes(String(RAW.length)) && l1.filter((x) => x === 'claude> working on the sheet').length === 1, JSON.stringify([asked, l1]));
62
73
  if (shots) await p.screenshot({ path: `${shots}/term-1280-light.png` });
63
74
  ok('O1 no error on the page', !errs.length, errs.join(' | '));
64
75
  await ctx.close();
@@ -163,7 +163,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
163
163
 
164
164
  /* P the POST allow-list and the refusals */
165
165
  const all = P.posts.concat(I.posts, J.posts);
166
- const other = all.filter((x) => !ALLOWED.test(x.path));
166
+ const other = all.filter((x) => !ALLOWED.test(x.path) && x.path !== '/api/loose-props/rows'); // what Home shows loose, sent when it changed so Claude can propose a clean-up (batch 13 item 3); it changes no work
167
167
  ok('P1 the pages post only to the issue route (and the conversation note)', all.length >= 3 && !other.length, JSON.stringify(other));
168
168
  const sentAll = all.filter((x) => x.path === '/api/core-docs/issue');
169
169
  ok('P2 every issue press carried the nonce and no writer field', sentAll.length >= 3 && sentAll.every((x) => x.headers['x-pmos-nonce'] === nonce && !['by', 'via', 'at', 'actor', 'pm', 'nonce'].some((k) => k in x.body)));
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-rec-now-test.js — the recording tab's Now panel and live transcript (batch 12 item 1, slice S2; canvas XrtA1Tab side, XrtA7Room,
4
+ * XrtA7Transcript, XrtA5PhoneRec). Serves the real /premium-rec.html from the real server; the notes and the meeting are answered by stand-ins
5
+ * (fixtures/premium-viewer-fixtures.js, plus GET /api/meeting-focus with Raise now items and a question here) for the whole browser context.
6
+ * The tab opens with go=1 and starts the stand-in recorder on note n2 itself, so it holds the recorder and is in the room; window.__rtShare gives it a picture.
7
+ * N1 in the room: the topic now big, chips, Raise now, the counts line · N2 ✓ on a prompt · N3 a note is kept · N4 a question and its answer, kept with +
8
+ * N5 the live transcript card · N6 a shared screen: the panel moves to the side card, which the bar can hide · N7 a phone
9
+ * Every wait polls the page; no fixed sleep stands in for a state. */
10
+ const path = require('path');
11
+ const { spawn } = require('child_process');
12
+ const { findBrowser } = require('./lib/find-browser');
13
+ const T = require('./test-run').configure({ name: 'premium-rec-now' });
14
+ const F = require('./fixtures/premium-viewer-fixtures.js');
15
+
16
+ const BASE = T.BASE, until = F.until;
17
+ const results = [];
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
19
+ let srv = null; let browser = null;
20
+ const finish = async (code) => {
21
+ if (browser) await browser.close().catch(() => {});
22
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
23
+ T.killTmux();
24
+ const bad = results.filter((x) => !x.cond).length;
25
+ console.log(`\n${results.length - bad}/${results.length} premium-rec-now assertions passed`);
26
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
27
+ };
28
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
29
+
30
+ /* the stand-in recorder's picture, as premium-rec-tab-test.js gives it */
31
+ const SCREEN = () => {
32
+ window.__pmRecOwnTab = true;
33
+ const wire = () => { const R = window.__premiumRecorder; if (R) R.screen = () => window.__rtScr || { track: null, shared: false, paused: false, silent: false }; };
34
+ wire(); document.addEventListener('DOMContentLoaded', wire);
35
+ window.__rtShare = () => {
36
+ const c = document.createElement('canvas'); c.width = 320; c.height = 180;
37
+ c.getContext('2d').fillRect(0, 0, 320, 180);
38
+ window.__rtScr = { track: c.captureStream(5).getVideoTracks()[0], shared: true, paused: false, silent: false };
39
+ };
40
+ };
41
+
42
+ async function context(o = {}) {
43
+ const ctx = await browser.newContext({ viewport: { width: o.w || 1280, height: o.h || 860 } });
44
+ const S = await F.install(ctx, {});
45
+ // the recording tab starts listening itself (go=1), so its page holds the recorder: the note waits idle until then
46
+ S.store.n2.state = 'idle'; for (const r of S.rows) if (r.id === 'n2') r.state = 'idle';
47
+ const W = F.world();
48
+ const M = { raise: [{ id: 'r1', kind: 'check', text: 'Issue colour: the slide says grey, Ana said blue.', from: 'the screen' }, { id: 'r2', kind: 'follow-up', text: 'Ana owes the tablet frames.', from: 'Oct 15' }], asks: [], notes: [], focusReads: 0 };
49
+ const json = (r, b) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(b) });
50
+ // registered after the fixtures, so these answer first
51
+ await ctx.route('**/api/meeting-focus?*', (r) => {
52
+ M.focusReads++;
53
+ return json(r, { ok: true, now_ms: Date.now(), event: { id: 'ev-live', title: 'Design crit', at: W.LIVE_NOTE.meeting.start, end: W.LIVE_NOTE.meeting.end },
54
+ note: { id: 'n2', state: 'recording' }, topics: [{ id: 't1', text: 'One toolbar row', state: 'discussed' }, { id: 't2', text: 'The Issue button', state: 'now' }, { id: 't3', text: 'Phone layout', state: 'notyet' }],
55
+ runs: [{ topic: 't1', from_min: 0, to_min: 6 }, { topic: 't2', from_min: 6, to_min: null }], captured: { decisions: [{ text: 'a' }], actions: [{ text: 'b' }, { text: 'c' }], questions: [] },
56
+ raise: M.raise, asks: M.asks, notes: M.notes, tail: [] });
57
+ });
58
+ await ctx.route('**/api/meeting-focus/raise', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.posts.push({ path: '/api/meeting-focus/raise', body: b }); M.raise = M.raise.filter((x) => x.id !== b.id); return json(r, { ok: true }); });
59
+ await ctx.route('**/api/meeting-focus/ask', (r) => { const b = JSON.parse(r.request().postData() || '{}'); S.posts.push({ path: '/api/meeting-focus/ask', body: b }); M.asks.push({ id: 'fa1', question: b.question, state: 'working' }); return json(r, { ok: true, id: 'fa1', state: 'working' }); });
60
+ const errors = [];
61
+ ctx.on('page', (pg) => pg.on('pageerror', (e) => errors.push(String((e && e.message) || e))));
62
+ await ctx.addInitScript(F.RECORDER);
63
+ await ctx.addInitScript(SCREEN);
64
+ return { ctx, S, M, errors };
65
+ }
66
+
67
+ (async () => {
68
+ const exe = findBrowser();
69
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
70
+ let chromium;
71
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
72
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
73
+ await T.waitForServer(BASE);
74
+ browser = await chromium.launch({ executablePath: exe });
75
+ const posted = (S, pth) => S.posts.filter((x) => x.path === pth);
76
+ // REC_NOW_SHOTS=<dir> keeps a picture of each state for the design review
77
+ const shot = async (pg, name) => { if (process.env.REC_NOW_SHOTS) await pg.screenshot({ path: path.join(process.env.REC_NOW_SHOTS, name + '.png') }); };
78
+
79
+ /* N1 in the room */
80
+ const A = await context();
81
+ const p = await A.ctx.newPage();
82
+ await p.goto(BASE + '/premium-rec.html?note=n2&go=1');
83
+ ok('N1 in the room the Now panel fills the light page; the side card stays hidden', await until(() => p.evaluate(() => document.getElementById('rt').dataset.mode === 'room' && !!document.querySelector('#rtStage .rn.rn-room h1') && document.getElementById('rtSide').hidden), 15000),
84
+ await p.evaluate(() => document.getElementById('rt').dataset.mode));
85
+ const room = await p.evaluate(() => ({ now: document.querySelector('.rn-now').innerText, chips: [...document.querySelectorAll('.rn-stp span')].map((s) => s.textContent.trim()), raise: [...document.querySelectorAll('.rn-rq')].map((r) => r.innerText), counts: (document.querySelector('.rn-cgl') || {}).textContent }));
86
+ ok('N1 the topic now is big, with minutes on it and minutes left', /^Now\s+The Issue button\s+\d+ min on it · \d+ min left$/.test(room.now.trim()), room.now);
87
+ ok('N1 chips for the done topic and Next', JSON.stringify(room.chips) === JSON.stringify(['One toolbar row', 'Next: Phone layout']), JSON.stringify(room.chips));
88
+ ok('N1 Raise now: the two prompts with where they came from', room.raise.length === 2 && /Check · from the screen/.test(room.raise[0]) && /Follow-up · from Oct 15/.test(room.raise[1]), JSON.stringify(room.raise));
89
+ ok('N1 one quiet counts line', room.counts === '1 decision · 2 next steps · 1 highlight', room.counts);
90
+ const icons = await p.evaluate(() => [...document.querySelectorAll('#rtBar [data-slot="now"] button')].map((b) => [b.getAttribute('aria-label'), getComputedStyle(b).display === 'none', b.textContent.trim()]));
91
+ ok('N1 the bar holds the transcript icon; the side-panel toggle is hidden in the room; both icon only', icons.length === 2 && icons.some((x) => x[0] === 'Live transcript' && !x[1]) && icons.some((x) => /side panel/.test(x[0]) && x[1]) && icons.every((x) => x[2] === ''), JSON.stringify(icons));
92
+ ok('N1 every button in the panel is icon only with a label', await p.evaluate(() => [...document.querySelectorAll('.rn button')].every((b) => b.getAttribute('aria-label') && !b.textContent.trim())));
93
+
94
+ await shot(p, 'room-1280');
95
+ /* N2 ✓ on a prompt */
96
+ await p.$eval('.rn-rq[data-raise="r1"] [data-rn="raised"]', (b) => b.click());
97
+ ok('N2 ✓ tells the server it was raised, and the prompt goes away', await until(() => posted(A.S, '/api/meeting-focus/raise').some((x) => x.body.id === 'r1' && x.body.action === 'raised' && x.body.note === 'n2') && p.evaluate(() => !document.querySelector('[data-raise="r1"]') && !!document.querySelector('[data-raise="r2"]'))));
98
+
99
+ /* N3 a note */
100
+ await p.fill('.rn-mine textarea', 'Ana sends the frames Friday');
101
+ ok('N3 a line with no question mark is a note', await p.$eval('.rn-send', (b) => b.getAttribute('aria-label')) === 'Keep the note');
102
+ await p.press('.rn-mine textarea', 'Enter');
103
+ ok('N3 Enter keeps it as a line of the note, after what was there, and empties the box', await until(() => posted(A.S, '/api/notes/save').some((x) => x.body.id === 'n2' && /Ask Ana for the tablet frames\.\nAna sends the frames Friday$/.test(x.body.body)) && p.$eval('.rn-mine textarea', (t) => t.value === '')),
104
+ JSON.stringify(posted(A.S, '/api/notes/save')));
105
+
106
+ /* N4 a question */
107
+ await p.fill('.rn-mine textarea', 'Did Ana give a date?');
108
+ ok('N4 a line that ends with ? asks Claude', await p.$eval('.rn-send', (b) => b.getAttribute('aria-label')) === 'Ask Claude');
109
+ await p.press('.rn-mine textarea', 'Enter');
110
+ ok('N4 the question goes to Claude with the note, and shows at once with Claude at work', await until(() => posted(A.S, '/api/meeting-focus/ask').some((x) => x.body.question === 'Did Ana give a date?' && x.body.note === 'n2') && p.evaluate(() => /Did Ana give a date\?/.test(document.querySelector('.rn-chx .q').textContent) && !!document.querySelector('.rn-chx [aria-label="Claude is answering"]'))));
111
+ A.M.asks[0].state = 'answered';
112
+ A.M.notes.push({ ask: 'fa1', cat: 'Answer', body: 'Yes: Friday (she said it at 4:05).', from: ['talk', 'last'], show: 'now' });
113
+ ok('N4 the answer arrives above the box with its source, without waiting for the tab\'s 15 s read', await until(() => p.evaluate(() => { const a = document.querySelector('.rn-chx .ca'); return !!a && /Yes: Friday/.test(a.textContent) && /From the talk and last time/.test(a.textContent); }), 10000));
114
+ await shot(p, 'room-answer-1280');
115
+ await p.$eval('.rn-chx [data-rn="keep"]', (b) => b.click());
116
+ ok('N4 + keeps the answer as a note', await until(() => posted(A.S, '/api/notes/save').some((x) => /Yes: Friday \(she said it at 4:05\)\.$/.test(x.body.body)) && p.evaluate(() => !!document.querySelector('.rn-chx [aria-label="Kept as a note"]'))));
117
+
118
+ /* N5 the transcript */
119
+ ok('N5 the live transcript is closed by default', await p.evaluate(() => document.querySelector('.rn-trp').hidden));
120
+ await p.$eval('.rn-tbtn', (b) => b.click());
121
+ const tr = await until(() => p.evaluate(() => { const c = document.querySelector('.rn-trp'); return !c.hidden && c.querySelectorAll('.l').length ? { after: c.previousElementSibling && c.previousElementSibling.id, lines: [...c.querySelectorAll('.l')].map((l) => l.innerText.replace(/\s+/g, ' ')), hl: !!c.querySelector('[aria-label="Your highlight"]'), w: Math.round(c.getBoundingClientRect().width), pressed: document.querySelector('.rn-tbtn').getAttribute('aria-pressed') } : null; }));
122
+ ok('N5 the icon opens a 420px card right after the side card, with times, speakers and the highlight', !!tr && tr.after === 'rtSide' && tr.w === 420 && tr.lines.length === 3 && /^5:00 Ana The report panel/.test(tr.lines[0]) && /^7:00 You And Issue/.test(tr.lines[1]) && tr.hl && tr.pressed === 'true', JSON.stringify(tr));
123
+ await shot(p, 'room-transcript-1280');
124
+ await p.$eval('.rn-trp [data-rn="tclose"]', (b) => b.click());
125
+ ok('N5 Close closes it', await until(() => p.evaluate(() => document.querySelector('.rn-trp').hidden && document.querySelector('.rn-tbtn').getAttribute('aria-pressed') === 'false')));
126
+
127
+ /* N6 a shared screen */
128
+ await p.evaluate(() => window.__rtShare());
129
+ ok('N6 with a screen the panel moves into the side card, with To cover and the minutes left', await until(() => p.evaluate(() => document.getElementById('rt').dataset.mode === 'screen' && !document.getElementById('rtSide').hidden && !!document.querySelector('#rtSide .rn.rn-side')
130
+ && /^To cover\d+ min left$/.test(document.querySelector('#rtSide .rn-sec h5').textContent) && !!document.querySelector('#rtSide .rn-ai.now[aria-current="true"]')), 12000));
131
+ await shot(p, 'screen-side-1280');
132
+ await p.$eval('.rn-tbtn', (b) => b.click()); await shot(p, 'screen-transcript-1280'); await p.$eval('.rn-tbtn', (b) => b.click());
133
+ if (process.env.REC_NOW_SHOTS) { await p.evaluate(() => document.documentElement.setAttribute('data-theme', 'dark')); await shot(p, 'screen-side-1280-dark'); await p.evaluate(() => document.documentElement.removeAttribute('data-theme')); }
134
+ await p.$eval('.rn-sbtn', (b) => b.click());
135
+ ok('N6 the side-panel icon hides the side card, and says how to show it', await until(() => p.evaluate(() => document.getElementById('rtSide').hidden && document.querySelector('.rn-sbtn').getAttribute('aria-label') === 'Show the side panel')));
136
+ await p.$eval('.rn-sbtn', (b) => b.click());
137
+ ok('N6 and shows it again', await until(() => p.evaluate(() => !document.getElementById('rtSide').hidden)));
138
+ ok('N6 no page error', A.errors.length === 0, A.errors.join(' | '));
139
+ await A.ctx.close();
140
+
141
+ /* N7 a phone */
142
+ const B = await context({ w: 390, h: 844 });
143
+ const q = await B.ctx.newPage();
144
+ await q.goto(BASE + '/premium-rec.html?note=n2&go=1');
145
+ await until(() => q.evaluate(() => !!document.querySelector('.rn-room h1')), 15000);
146
+ await shot(q, 'room-390');
147
+ await q.$eval('.rn-tbtn', (b) => b.click());
148
+ const fl = await until(() => q.evaluate(() => { const c = document.querySelector('.rn-trp'); return c && !c.hidden ? { over: document.documentElement.scrollWidth - innerWidth, w: Math.round(c.getBoundingClientRect().width) } : null; }));
149
+ ok('N7 on a phone the panel has no sideways scroll, and the transcript is a sheet the full width', !!fl && fl.over <= 0 && fl.w === 390, JSON.stringify(fl));
150
+ ok('N7 no page error', B.errors.length === 0, B.errors.join(' | '));
151
+ await B.ctx.close();
152
+ finish();
153
+ })();