create-pmos 0.324.0 → 0.326.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 (45) hide show
  1. package/package.json +1 -1
  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/briefing-premium-calendar-2-test.js +8 -6
  7. package/workspace/briefing-premium-calendar-3-test.js +7 -4
  8. package/workspace/briefing-premium-calendar-test.js +4 -2
  9. package/workspace/guide/briefing-premium.md +23 -2
  10. package/workspace/lib/engine/boards.js +28 -1
  11. package/workspace/lib/routes-boards.js +2 -2
  12. package/workspace/package-lock.json +2 -2
  13. package/workspace/package.json +1 -1
  14. package/workspace/premium-vw-backlog-test.js +127 -0
  15. package/workspace/premium-vw-doc-test.js +3 -1
  16. package/workspace/premium-vw-item-test.js +128 -0
  17. package/workspace/premium-vw-meet-test.js +210 -0
  18. package/workspace/premium-vw-notes-test.js +161 -0
  19. package/workspace/premium-vw-rec-test.js +209 -0
  20. package/workspace/public/pm/premium-board.js +13 -1
  21. package/workspace/public/pm/premium-initiative.js +7 -2
  22. package/workspace/public/pm/premium-meeting.js +106 -32
  23. package/workspace/public/pm/premium-shell.js +8 -2
  24. package/workspace/public/pm/premium-vw-backlog.css +30 -0
  25. package/workspace/public/pm/premium-vw-backlog.js +91 -0
  26. package/workspace/public/pm/premium-vw-doc-model.js +3 -2
  27. package/workspace/public/pm/premium-vw-doc.css +1 -0
  28. package/workspace/public/pm/premium-vw-doc.js +7 -4
  29. package/workspace/public/pm/premium-vw-item-model.js +58 -0
  30. package/workspace/public/pm/premium-vw-item.css +25 -0
  31. package/workspace/public/pm/premium-vw-item.js +66 -0
  32. package/workspace/public/pm/premium-vw-jira.js +3 -1
  33. package/workspace/public/pm/premium-vw-meet.css +87 -0
  34. package/workspace/public/pm/premium-vw-meet.js +322 -0
  35. package/workspace/public/pm/premium-vw-notes.css +43 -0
  36. package/workspace/public/pm/premium-vw-notes.js +188 -0
  37. package/workspace/public/pm/premium-vw-rec.css +75 -0
  38. package/workspace/public/pm/premium-vw-rec.js +257 -0
  39. package/workspace/public/pm/premium.js +2 -0
  40. package/workspace/test-files.json +2 -0
  41. package/workspace/test-lists/premium-viewer.json +4 -2
  42. package/workspace/test-lists/premium-vw-backlog.json +13 -0
  43. package/workspace/test-lists/premium-vw-item.json +13 -0
  44. package/workspace/test-lists/premium-vw-meet.json +13 -0
  45. package/workspace/test-lists/premium-vw-notes.json +13 -0
@@ -0,0 +1,209 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-vw-rec-test.js — note recording in the premium viewer (initiative premium-viewer, S4; the prototype Wawan approved on 2026-10-19). Serves the real pages from the
4
+ * real server. The Briefing model, the calendar, the notes and Focus are answered by stand-ins, so each press can be read off the request the page sent; the recorder is a
5
+ * stand-in that makes the same requests the console's recorder makes (record, pause, stop) and opens no microphone. The routes' own behaviour is in their own suites.
6
+ * R1 the Record control · R2 the chip · R3 the Live notes tab · R4 Focus · R5 floors
7
+ * Every wait polls the page; no fixed sleep stands in for a state. */
8
+ const path = require('path');
9
+ const { spawn } = require('child_process');
10
+ const { findBrowser } = require('./lib/find-browser');
11
+ const T = require('./test-run').configure({ name: 'premium-vw-rec' });
12
+ const B = require('./lib/briefing-premium.js');
13
+ const F = require('./fixtures/briefing-premium-facts.js');
14
+
15
+ const BASE = T.BASE;
16
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
17
+ const until = async (fn, ms = 10000, 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); } };
18
+ const results = [];
19
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
20
+ let srv = null; let browser = null;
21
+ const finish = async (code) => {
22
+ if (browser) await browser.close().catch(() => {});
23
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
24
+ T.killTmux();
25
+ const bad = results.filter((x) => !x.cond).length;
26
+ console.log(`\n${results.length - bad}/${results.length} premium-vw-rec assertions passed`);
27
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
28
+ };
29
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
30
+
31
+ const pad = (n) => String(n).padStart(2, '0');
32
+ const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
33
+ const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); return `${dayKey(d)}T${pad(d.getHours())}:${pad(d.getMinutes())}:00${off >= 0 ? '+' : '-'}${pad(Math.floor(a / 60))}:${pad(a % 60)}`; };
34
+ const NOW = new Date();
35
+ const midnight = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate());
36
+ const monday = () => { const d = new Date(midnight); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
37
+ /* "Live review" is under way now (it starts at most 10 minutes ago, never before midnight), so the Record menu lists it. */
38
+ const START = new Date(Math.max(midnight.getTime(), Math.floor((NOW.getTime() - 10 * 60000) / 60000) * 60000)), END = new Date(START.getTime() + 60 * 60000);
39
+ const weekAnswer = () => {
40
+ const m = monday(), cells = [];
41
+ for (let i = 0; i < 7; i++) { const d = new Date(m.getFullYear(), m.getMonth(), m.getDate() + i); cells.push({ key: dayKey(d), start: dayKey(d), end: dayKey(d), events: [] }); }
42
+ cells.find((c) => c.key === dayKey(START)).events.push({ id: 'ev-live', at: iso(START), end: iso(END), title: 'Live review', attendees: ['Priya', 'Dara'] });
43
+ return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(NOW), context: {}, link_boards: [], gantt: [] };
44
+ };
45
+ const FOCUS = () => ({ ok: true, now_ms: Date.now(), date: dayKey(NOW), event: { id: 'ev-live', title: 'Live review', at: iso(START), end: iso(END), attendees: ['Priya', 'Dara'] },
46
+ note: { id: 'n1', title: 'Live review', state: 'recording', lines: 3 }, topics: [{ id: 'capacity', text: 'Capacity', state: 'discussed', minutes: 4 }, { id: 'risks', text: 'Risks', state: 'now', minutes: 2 }],
47
+ runs: [{ topic: 'capacity', from_min: 0, to_min: 4 }, { topic: 'risks', from_min: 4, to_min: null }], gist: 'The room is weighing the risks to the date.', chips: [], tail: [{ who: 'Dara', text: 'Next the risks' }],
48
+ captured: { decisions: [{ text: 'Plan with eight people' }], actions: [], questions: [] }, material: [{ title: 'Q4 deck', kind: 'pmos-deck', ref: 'reports/q4', topic: 'Risks' }, { title: 'Wiki page', kind: 'link', url: 'https://x.example/w' }],
49
+ companion: { on: true, running: false, error: null } });
50
+
51
+ /* the stand-in recorder: the console's recorder makes these same requests; this one opens no microphone */
52
+ const RECORDER = () => {
53
+ window.__premiumRecorder = {
54
+ _id: null, _started: null, _banner: null, _hl: 0,
55
+ async listen(id) {
56
+ const r = await fetch('/api/notes/record', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }).then((x) => x.json());
57
+ if (!r.ok) { this._banner = r.error; return false; }
58
+ this._id = id; this._started = Date.now() - 65000; return true;
59
+ },
60
+ async pause() { await fetch('/api/notes/pause', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: this._id }) }); this._id = null; },
61
+ async stop(id) { await fetch('/api/notes/stop', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }); this._id = null; return { discarded: false }; },
62
+ highlight() { this._hl++; return true; }, highlighting() { return this._hl ? { state: 'listening', open: true } : null; },
63
+ listening() { return this._id; }, started() { return this._started; }, banner() { const b = this._banner; this._banner = null; return b; },
64
+ };
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
+
76
+ const facts = () => { const f = F.facts(); f.meetings = [{ start: START.getTime(), end: END.getTime(), title: 'Live review', with: 'Priya, Dara', initiative: null }]; return f; };
77
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
78
+ const open = async ({ w = 1280, h = 900, theme = 'light', notes = [], url = '/premium.html' } = {}) => {
79
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
80
+ const page = await ctx.newPage();
81
+ const S = { errors: [], reqs: [], notes: notes.map((n) => ({ ...n })), newPosts: [], recPosts: [], pausePosts: [], stopPosts: [], savePosts: [], privPosts: [], focusGets: 0 };
82
+ page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
83
+ page.on('dialog', (d) => d.dismiss());
84
+ page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
85
+ const noteBy = (id) => S.notes.find((n) => n.id === id);
86
+ const body = (r) => JSON.parse(r.request().postData() || '{}');
87
+ await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(facts()), as_of: Date.now() }));
88
+ await page.route('**/api/calendar-views*', (r) => json(r, weekAnswer()));
89
+ await page.route('**/api/meeting-replay*', (r) => json(r, { ok: false, error: 'none' }, 404));
90
+ await page.route('**/api/meeting-material*', (r) => json(r, { ok: true, key: 'k', items: [] }));
91
+ await page.route('**/api/notes/one*', (r) => {
92
+ const n = noteBy(new URL(r.request().url()).searchParams.get('id'));
93
+ if (!n) return json(r, { ok: false, error: 'no such note' }, 404);
94
+ return json(r, { ok: true, note: { body: '', speakers: { system: 'Dara' }, transcript: [{ t: 4000, source: 'mic', text: 'Welcome everyone' }, { t: 9000, source: 'system', text: 'We plan eight people' }], highlights: [{ id: 'h1', text: 'Plan with eight people', from: 61000, cat: 'decision' }], ...n }, screen: { frames: [] } });
95
+ });
96
+ await page.route('**/api/notes/new', (r) => {
97
+ const b = body(r); S.newPosts.push(b);
98
+ const m = b.meeting || null;
99
+ let n = m ? S.notes.find((x) => x.meeting && x.meeting.event_id === m.event_id) : null;
100
+ if (!n) { n = { id: 'n' + (S.notes.length + 1), title: (m && m.title) || '', state: 'idle', updated_at: new Date().toISOString(), meeting: m ? { kind: 'event', event_id: m.event_id, start: m.start, title: m.title } : null }; S.notes.push(n); }
101
+ return json(r, { ok: true, note: n, reused: false });
102
+ });
103
+ await page.route('**/api/notes/record', (r) => { const b = body(r); S.recPosts.push(b); noteBy(b.id).state = 'recording'; return json(r, { ok: true }); });
104
+ await page.route('**/api/notes/pause', (r) => { const b = body(r); S.pausePosts.push(b); const n = noteBy(b.id); if (n) { n.state = 'paused'; n.resume_until = new Date(Date.now() + 3600000).toISOString(); } return json(r, { ok: true }); });
105
+ await page.route('**/api/notes/stop', (r) => { const b = body(r); S.stopPosts.push(b); const n = noteBy(b.id); if (n) n.state = 'ended'; return json(r, { ok: true }); });
106
+ await page.route('**/api/notes/save', (r) => { const b = body(r); S.savePosts.push(b); const n = noteBy(b.id); if (n) n.body = b.body; return json(r, { ok: true }); });
107
+ await page.route('**/api/notes/private', (r) => { const b = body(r); S.privPosts.push(b); const n = noteBy(b.id); if (n) n.private = !!b.private; return json(r, { ok: true, private: !!b.private }); });
108
+ await page.route(/\/api\/notes$/, (r) => json(r, { ok: true, notes: S.notes }));
109
+ await page.route(/\/api\/meeting-focus(\?|$)/, (r) => { S.focusGets++; return json(r, FOCUS()); });
110
+ await page.route('**/api/calendar-links', (r) => json(r, { ok: true }));
111
+ await page.addInitScript(RECORDER);
112
+ await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
113
+ if (url === '/premium.html') S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && !!document.querySelector('#recCtl')), 20000);
114
+ return Object.assign(S, { ctx, page });
115
+ };
116
+ const chip = (p) => p.evaluate(() => { const c = document.querySelector('#recChip'); return c && !c.hidden ? c.textContent : null; });
117
+ const tabs = (p) => p.evaluate(() => [...document.querySelectorAll('#vTabs .vtab')].map((t) => t.textContent.trim()).join('|'));
118
+ const pane = (p, id) => p.evaluate((x) => { const e = document.querySelector(`#dOut .obody.vw[data-vw="${x}"]`); return e && !e.hidden ? e.textContent : ''; }, id);
119
+
120
+ /* R1 the Record control */
121
+ const A = await open();
122
+ ok('0 the Briefing opens with the Record control on its top bar', A.up);
123
+ if (!A.up) return finish(1);
124
+ const p = A.page;
125
+ ok('R1 Record says what it does before the press, and nothing was sent', await p.evaluate(() => /stay on this machine/.test(document.querySelector('#recCtl [data-rc="new"]').title)) && !A.reqs.some((r) => /^POST \/api\/notes/.test(r)));
126
+ await p.click('#recCtl [data-rc="menu"]');
127
+ const menu = await until(() => p.evaluate(() => { const m = document.querySelector('#recCtl .recm'); return m && !m.hidden ? m.textContent : ''; }));
128
+ if (process.env.SHOTS) await p.screenshot({ path: path.join(process.env.SHOTS, 'menu-1280.png') });
129
+ ok('R1 the arrow lists today\'s meeting under way, marked Now, and New note', /Live review/.test(menu) && /Now/.test(menu) && /New note/.test(menu), menu);
130
+ await p.click('#recCtl [data-rc="ev"]');
131
+ ok('R1 the first start asks "Tell everyone first" and sends nothing', await until(() => p.evaluate(() => /Tell everyone first/.test(document.querySelector('#recCtl .recm').textContent))) && A.newPosts.length === 0);
132
+ await p.click('#recCtl [data-rc="no"]');
133
+ ok('R1 Not yet closes the ask and sends nothing', await until(() => p.evaluate(() => document.querySelector('#recCtl .recm').hidden)) && A.newPosts.length === 0);
134
+ await p.click('#recCtl [data-rc="menu"]'); await until(() => p.evaluate(() => !!document.querySelector('#recCtl [data-rc="ev"]')));
135
+ await p.click('#recCtl [data-rc="ev"]'); await p.click('#recCtl [data-rc="go"]');
136
+ ok('R1 "I told them, start" makes the meeting\'s note and listens on it', await until(() => A.recPosts.length === 1) && A.newPosts[0].meeting && A.newPosts[0].meeting.event_id === 'ev-live' && A.recPosts[0].id === 'n1', JSON.stringify(A.newPosts));
137
+ ok('R1 the Record control hides while a note records', await until(() => p.evaluate(() => document.querySelector('#recCtl').hidden)));
138
+
139
+ /* R3 the Live notes tab */
140
+ ok('R3 the meeting\'s dialog opens with a Live notes tab beside its detail', await until(async () => /Live notes/.test(await tabs(p)) && /Live review/.test(await p.evaluate(() => document.querySelector('#dTitle').textContent))), await tabs(p));
141
+ const lv = await until(async () => { const t = await pane(p, 'rec:n1'); return /We plan eight people/.test(t) ? t : ''; });
142
+ ok('R3 the tab shows Recording with the clock, Highlight, Pause, Stop, Focus and Private', /Recording/.test(lv) && /1:0\d/.test(lv) && /Highlight/.test(lv) && /Pause/.test(lv) && /Stop/.test(lv) && /Focus/.test(lv) && /Private/.test(lv), lv.slice(0, 300));
143
+ ok('R3 the transcript names who spoke, and the highlight comes from the note', /You/.test(lv) && /Dara/.test(lv) && /Plan with eight people/.test(lv));
144
+ await p.fill('#dOut [data-rv-mine]', 'Ask Sam about the meter'); await p.click('#dOut .rvt');
145
+ ok('R3 your notes are saved through POST /api/notes/save when you leave the box', await until(() => A.savePosts.length === 1) && A.savePosts[0].id === 'n1' && A.savePosts[0].body === 'Ask Sam about the meter', JSON.stringify(A.savePosts));
146
+ await p.click('#dOut [data-rv="private"]');
147
+ ok('R3 Private asks first, saying what it deletes, and sends nothing yet', await until(() => p.evaluate(() => /deleted now/.test((document.querySelector('#dOut .vcf') || {}).textContent || ''))) && A.privPosts.length === 0);
148
+ await p.click('#dOut .vcf [data-a="0"]');
149
+ ok('R3 Cancel keeps the note as it was', await until(() => p.evaluate(() => !document.querySelector('#dOut .vcf'))) && A.privPosts.length === 0);
150
+
151
+ /* R2 the chip on the Briefing (the dialog sits over it, so it is closed first) */
152
+ await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
153
+ const c1 = await until(async () => { const t = await chip(p); return t && /Recording Live review/.test(t) ? t : ''; });
154
+ ok('R2 the chip on the Briefing has Highlight, Pause, Focus, Open and Stop', await p.evaluate(() => ['hl', 'pause', 'fv', 'open', 'stop'].every((a) => !!document.querySelector(`#recChip [data-r="${a}"]`))), c1);
155
+ await p.click('#recChip [data-r="hl"]');
156
+ ok('R2 Highlight starts the recorder\'s highlight and says so', await until(async () => /Highlighting/.test((await chip(p)) || '')) && await p.evaluate(() => window.__premiumRecorder._hl === 1));
157
+
158
+ /* R4 Focus */
159
+ await p.click('#recChip [data-r="fv"]');
160
+ const fv = await until(async () => { const t = await pane(p, 'focus:n1'); return /Risks/.test(t) ? t : ''; });
161
+ ok('R4 Focus opens as a tab with the topic now, the sentence, the lines, the counts and the material', /Now/.test(fv) && /weighing the risks/.test(fv) && /Next the risks/.test(fv) && /Captured so far/.test(fv) && /Q4 deck/.test(fv) && /Wiki page/.test(fv), fv.slice(0, 300));
162
+ ok('R4 a PMOS deck has Present and Audience view; a link has Open', await p.evaluate(() => { const li = [...document.querySelectorAll('#dOut .fvst li')]; return li.length === 2 && !!li[0].querySelector('[data-fv="present"]') && !!li[0].querySelector('[data-fv="aud"]') && !!li[1].querySelector('[data-fv="open"]') && !li[1].querySelector('[data-fv="present"]'); }));
163
+ const g0 = A.focusGets;
164
+ ok('R4 Focus reads again every 3 seconds while its tab is shown', await until(() => A.focusGets >= g0 + 2, 9000), String(A.focusGets - g0));
165
+ await p.click('#vTabs .vtab[data-vw="rec:n1"]');
166
+ const g1 = A.focusGets; await sleep(4000);
167
+ ok('R4 Focus stops reading while its tab is hidden', A.focusGets <= g1 + 1, String(A.focusGets - g1));
168
+
169
+ /* R3 Pause, Resume, Stop from the tab */
170
+ await p.click('#dOut [data-rv="pause"]');
171
+ ok('R3 Pause pauses through the route and the tab says Paused with Resume', await until(() => A.pausePosts.length === 1) && await until(async () => /Paused/.test(await pane(p, 'rec:n1')) && /Resume/.test(await pane(p, 'rec:n1'))));
172
+ await p.click('#dOut [data-rv="resume"]');
173
+ ok('R3 Resume listens again on the same note without asking twice', await until(() => A.recPosts.length === 2) && A.newPosts.length === 1);
174
+ await until(async () => /Recording/.test(await pane(p, 'rec:n1')));
175
+ await p.click('#dOut [data-rv="stop"]');
176
+ ok('R3 Stop asks first and says a stopped meeting cannot be resumed', await until(async () => /cannot be resumed/.test(await pane(p, 'rec:n1'))) && A.stopPosts.length === 0);
177
+ await p.click('#dOut [data-rv="stopgo"]');
178
+ ok('R3 Stop for good ends it through the route, and the Record control comes back', await until(() => A.stopPosts.length === 1) && await until(() => p.evaluate(() => !document.querySelector('#recCtl').hidden)));
179
+ ok('R5 no page error on the Briefing', A.errors.length === 0, A.errors.join(' | '));
180
+ await A.ctx.close();
181
+
182
+ /* R1 New note */
183
+ const N = await open();
184
+ await N.page.click('#recCtl [data-rc="new"]'); await N.page.click('#recCtl [data-rc="go"]');
185
+ ok('R1 New makes an untitled note with no meeting and listens on it', await until(() => N.recPosts.length === 1) && N.newPosts[0].title === '' && !N.newPosts[0].meeting);
186
+ ok('R1 a note with no meeting opens in a dialog of its own with its Live notes tab', await until(async () => /Live notes/.test(await tabs(N.page)) && /Untitled note/.test(await N.page.evaluate(() => document.querySelector('#dTitle').textContent))), await tabs(N.page));
187
+ ok('R1 the tab of a note with no meeting has no Focus', await until(async () => /Recording/.test(await pane(N.page, 'rec:n1'))) && !(await N.page.evaluate(() => !!document.querySelector('#dOut [data-rv="fv"]'))));
188
+ ok('R5 no page error with a new note', N.errors.length === 0, N.errors.join(' | '));
189
+ await N.ctx.close();
190
+
191
+ /* R2 another page */
192
+ const live = { id: 'n1', title: 'Live review', state: 'recording', updated_at: new Date().toISOString(), meeting: { kind: 'event', event_id: 'ev-live', start: iso(START), title: 'Live review' } };
193
+ const W = await open({ notes: [live], url: '/premium-work.html' });
194
+ ok('R2 My work shows the chip with only Open and Stop, and no Record control', await until(async () => !!(await chip(W.page))) && await W.page.evaluate(() => [...document.querySelectorAll('#recChip button')].map((b) => b.dataset.r).join() === 'open,stop' && !document.querySelector('#recCtl')), String(await chip(W.page)));
195
+ await W.ctx.close();
196
+
197
+ /* R5 floors: 390 px, light and dark */
198
+ for (const [w, th] of [[390, 'light'], [390, 'dark'], [1280, 'dark']]) {
199
+ const P = await open({ w, h: 844, theme: th });
200
+ await P.page.click('#recCtl [data-rc="new"]'); await P.page.click('#recCtl [data-rc="go"]');
201
+ await until(async () => /Recording/.test(await pane(P.page, 'rec:n1')));
202
+ if (w < 1000) await P.page.evaluate(() => { const t = document.querySelector('#dlg [data-tab="out"], #tabOut'); if (t) t.click(); });
203
+ const f = await P.page.evaluate(() => ({ scroll: document.documentElement.scrollWidth <= innerWidth + 1, btn: [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) button, #recChip button')].filter((b) => b.offsetParent).map((b) => b.offsetHeight), who: [...document.querySelectorAll('#dOut .obody.vw:not([hidden]) button, #recChip button')].filter((b) => b.offsetParent && b.offsetHeight < 44).map((b) => b.className + ':' + b.textContent.trim()) }));
204
+ if (process.env.SHOTS) { await sleep(900); await P.page.screenshot({ path: path.join(process.env.SHOTS, `live-${w}-${th}.png`) }); await P.page.evaluate(() => { const b = document.querySelector('#dOut [data-rv="fv"]'); if (b) b.click(); }); await until(() => P.page.evaluate(() => !!document.querySelector('#dOut .fvnow'))); await P.page.screenshot({ path: path.join(process.env.SHOTS, `focus-${w}-${th}.png`) }); }
205
+ ok(`R5 at ${w} px (${th}) the Live notes tab has no sideways scroll and every press is at least 44 px`, f.scroll && f.btn.length && f.btn.every((n) => n >= 43.5), JSON.stringify(f));
206
+ await P.ctx.close();
207
+ }
208
+ return finish();
209
+ })().catch((e) => { console.error(e); finish(1); });
@@ -3,7 +3,9 @@
3
3
  * Coming up cards, Core documents, the dock and the standard dialog. The presses are Draft it on a core document, through POST /api/core-docs/draft,
4
4
  * and the board's own presses of pm/premium-acts.js (initiative premium-board-actions): the New asks card, New initiative, and a row's menu (move,
5
5
  * hold, cancel, archive and their Undo). Issue it on a document draft, read in a dialog, is POST /api/core-docs/issue (initiative premium-core-doc-issue). */
6
+ import { openWorkItem, recordPress } from './premium-vw-item.js';
6
7
  import { pmPost } from './http.js';
8
+ import { openBacklog } from './premium-vw-backlog.js';
7
9
  import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, CHECK, AI, store, crumbHtml, wireCrumb, kv, H, openAddDoc, setPageGaps } from './premium-shell.js';
8
10
  import { issueBody } from './premium-doc-edit.js';
9
11
  import { mountDocSheet } from './premium-doc-sheet.js';
@@ -115,6 +117,7 @@ function drawSide() {
115
117
  : `<p class="empty3 plain">${esc(R.why)}</p>`;
116
118
  }
117
119
  $('#cSpr').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
120
+ $('#cSpr').addEventListener('click', (e) => { if (e.target.closest('[data-open="board:sprint"]')) backlogBtn(); }); // after openRow: the sprint dialog's own detail gets "Open the backlog" (premium-viewer R10)
118
121
  $('#cRel').addEventListener('click', (e) => { const b = e.target.closest('[data-open]'); if (b) openRow(rowOf(b.dataset.open)); });
119
122
  function docRow(d) {
120
123
  const act = !d.act ? '' : d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="spin"></span>' : ICO('<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>')}${esc(d.act.label)}</button>` : `<button class="dmcta alt" data-tab="${esc(d.act.tab)}">${esc(d.act.label)}</button>`;
@@ -182,16 +185,25 @@ function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textConten
182
185
  function cardHtml(r) { return `<div class="acard" id="card"><p class="ct">What this page can do</p><p class="nodef" id="holdWhy">${esc(r.dialog.hold)}</p></div>`; }
183
186
  function paneHtml(r) {
184
187
  const p = r.dialog.pane;
185
- return `<article class="paper doc">${p.file ? `<p class="dpath">${esc(p.file)}</p>` : ''}${p.rows.length ? `<div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div>` : ''}<p class="xn">${esc(p.note || 'The initiative as the board holds it.')}</p></article>`;
188
+ return `<article class="paper doc">${p.file ? `<p class="dpath">${esc(p.file)}</p>` : ''}${p.rows.length ? `<div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div>` : ''}<p class="xn">${esc(p.note || 'The initiative as the board holds it.')}</p>${r.id && r.dialog.eye === 'Initiative' ? recordPress() : ''}</article>`;
186
189
  }
187
190
  function openRow(r) {
188
191
  if (!r) return;
189
192
  const d = r.dialog;
190
193
  openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub + (r.statusLabel ? ' · ' + r.statusLabel : ''), say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: d.pane.label });
194
+ const vb = $('#oMain [data-vwopen]'); if (vb) vb.onclick = () => openWorkItem({ kind: 'initiative', id: r.id, title: r.title, ws: M.board.ws, board: M.board.id }); // its record, checks, tasks and links as a viewer tab (premium-viewer S7)
191
195
  loadThread(r.key);
192
196
  if (r.key === 'board:sprint') openSprint({ ws: M.board.ws, board: M.board.id, name: r.title }); // the sprint as a board by status, beside its facts (premium-viewer S5)
193
197
  setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
194
198
  }
199
+ /* the sprint dialog opens the board's Jira backlog beside it, as a viewer tab (premium-viewer R10); the button is added to #oMain, never re-rendering it */
200
+ function backlogBtn() {
201
+ const at = $('#oMain .paper'); if (!at || !M.board.id) return;
202
+ const w = document.createElement('div'); w.className = 'cact';
203
+ const b = document.createElement('button'); b.type = 'button'; b.className = 'cta alt'; b.id = 'openBacklog'; b.textContent = 'Open the backlog';
204
+ b.onclick = () => openBacklog({ ws: M.board.ws, board: M.board.id, title: 'Backlog' });
205
+ w.append(b); at.append(w);
206
+ }
195
207
  $('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
196
208
 
197
209
  /* ── load: the routes derive the initiatives in the background, so the first answers are "reading" ───────────── */
@@ -8,6 +8,7 @@ import { pmPost } from './http.js';
8
8
  import { mountDocSheet } from './premium-doc-sheet.js';
9
9
  import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, CHEV, crumbHtml, wireCrumb, AI, openAddDoc, setPageGaps } from './premium-shell.js';
10
10
  import { barHtml, onBar, closeMenu } from './premium-acts.js';
11
+ import { openWorkItem, recordPress } from './premium-vw-item.js';
11
12
  import { openTicket } from './premium-vw-jira.js';
12
13
 
13
14
  let M = null; // the model
@@ -133,7 +134,8 @@ function openTask(t) {
133
134
  const rows = [['Type', t.kind || (taskKind(t) === 'req' ? 'PRD requirement' : 'Task')], ['Reference', t.ref], ['Source', t.src], ['Owner', t.owner], ['Starts', t.start ? when(t.start) : ''], ['Due', t.end ? when(t.end) : ''], ['Status', t.state || 'No result recorded']];
134
135
  const say = t.title + (t.state ? ' is ' + t.state.toLowerCase() + '.' : ' has no result recorded. The repository records none for a PRD requirement.');
135
136
  const act = t.pmos ? `<div class="tkact"><span class="label">Status</span><div class="seg tkst" role="group" aria-label="Status"><i class="pill"></i>${STATES.map((s) => `<button data-tks="${esc(s)}" aria-pressed="${t.state === s}">${s}</button>`).join('')}</div></div><p class="note" style="margin-top:12px">A PMOS task is kept on the board. Jira tickets are read-only here: Jira owns their status and dates.</p>` : `<p class="xn">${t.src === 'PRD requirement' ? 'Read from the initiative’s PRD. Nothing on this page changes it.' : 'Read from the board. Jira owns its status and dates.'}</p>`;
136
- openDlg({ eye: 'Task · real data', title: t.title, sub: M.title, say, stream: turnA(ptx(say)), noteKey: null, pane: `<article class="paper doc">${kv(rows)}${act}</article>`, label: 'Task' });
137
+ openDlg({ eye: 'Task · real data', title: t.title, sub: M.title, say, stream: turnA(ptx(say)), noteKey: null, pane: `<article class="paper doc">${kv(rows)}${act}${recordPress('Open the initiative')}</article>`, label: 'Task' });
138
+ wireRecord();
137
139
  $('#askF').hidden = true; if ($('#oMain .tkst')) pillOf($('#oMain .tkst'));
138
140
  if (taskKind(t) === 'jira' && t.ref) openTicket({ ws: M.board.ws, board: M.board.id, initiative: M.id, ref: t.ref }); // the ticket beside its facts (premium-viewer S5)
139
141
  $$('#oMain [data-tks]').forEach((b) => { b.onclick = async () => {
@@ -143,6 +145,8 @@ function openTask(t) {
143
145
  toast('Status changed to ' + b.dataset.tks.toLowerCase() + '.'); closeDlg(); await load();
144
146
  }; });
145
147
  }
148
+ /** The pane's press that opens this initiative's record, checks, tasks and links as a viewer tab beside the dialog (premium-viewer S7). */
149
+ function wireRecord() { const b = $('#oMain [data-vwopen]'); if (b) b.onclick = () => openWorkItem({ kind: 'initiative', id: M.id, title: M.crumbTitle || M.title, ws: M.board.ws, board: M.board.id }); }
146
150
  function openAddTask() {
147
151
  const prefs = ['Research plan', 'Release plan', 'UAT', 'Rollback plan', 'Support briefing', 'Legal review'];
148
152
  const form = `<div class="addf"><p class="note" style="margin:0">Use a task for work that is not a Jira ticket, such as a research plan, a release plan or UAT. It is kept on the board and it is not a Jira ticket.</p>
@@ -224,7 +228,8 @@ async function draft(b) {
224
228
  /* ── the initiative's own dialog: the read-only agent about this initiative, with an optional first question ─────────────────────── */
225
229
  function openAsk(q) {
226
230
  const r = M.rows[0]; if (!r) return;
227
- openDlg({ eye: 'Initiative · real data', title: r.title, sub: r.sub, say: r.dialog.say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Read the initiative from the board and its sheet', 'Read its workflow steps from the workflow engine', 'Changed nothing'] })) + turnA(ptx(r.dialog.say)), noteKey: r.key, pane: `<article class="paper doc">${kv(r.dialog.facts)}<p class="xn">The initiative as the board holds it. Ask the agent anything about it; it reads this repository and changes nothing.</p></article>`, label: 'Initiative' });
231
+ openDlg({ eye: 'Initiative · real data', title: r.title, sub: r.sub, say: r.dialog.say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Read the initiative from the board and its sheet', 'Read its workflow steps from the workflow engine', 'Changed nothing'] })) + turnA(ptx(r.dialog.say)), noteKey: r.key, pane: `<article class="paper doc">${kv(r.dialog.facts)}<p class="xn">The initiative as the board holds it. Ask the agent anything about it; it reads this repository and changes nothing.</p>${recordPress()}</article>`, label: 'Initiative' });
232
+ wireRecord();
228
233
  loadThread(r.key);
229
234
  if (q) { const i = $('#askIn'); i.value = q; $('#askF').dispatchEvent(new Event('submit', { cancelable: true, bubbles: true })); }
230
235
  setMode('chat');