create-pmos 0.263.0 → 0.264.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.263.0",
3
+ "version": "0.264.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@3f8ffb3
1
+ kernel-source: pmos@4f2710e
2
2
  assembled: 2026-10-18
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-18T08:08:29Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T08:53:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-18T08:08:29Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T08:53:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-18T08:08:29Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-18T08:53:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -0,0 +1,195 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* briefing-premium-calendar-test.js — the Today / This week switch and the meeting dialog on the premium Briefing (initiative briefing-premium-calendar, slice 1;
4
+ * planning/prd/briefing-premium-calendar-prd.md C1 to C10). Serves the real page from the real server. The Briefing model, the calendar answer, the replay and the material
5
+ * are answered by stand-ins, so each press can be read off the request the page sent; the routes' own behaviour is in their own suites.
6
+ * C1 the switch · C2 the week · C3 honest states · C4 the dialog · C5 link it · C6 notes · C7 material · C8 replay summary · C9 only the link write · C10 floors and fidelity
7
+ * Every wait polls the page; no fixed sleep stands in for a state. */
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { spawn } = require('child_process');
11
+ const { findBrowser } = require('./lib/find-browser');
12
+ const T = require('./test-run').configure({ name: 'briefing-premium-calendar' });
13
+ const B = require('./lib/briefing-premium.js');
14
+ const F = require('./fixtures/briefing-premium-facts.js');
15
+
16
+ const BASE = T.BASE;
17
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
18
+ 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); } };
19
+ const results = [];
20
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
21
+ let srv = null; let browser = null;
22
+ const finish = async (code) => {
23
+ if (browser) await browser.close().catch(() => {});
24
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
25
+ T.killTmux();
26
+ const bad = results.filter((x) => !x.cond).length;
27
+ console.log(`\n${results.length - bad}/${results.length} briefing-premium-calendar assertions passed`);
28
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
29
+ };
30
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
31
+
32
+ const pad = (n) => String(n).padStart(2, '0');
33
+ const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
34
+ 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)}`; };
35
+ const NOW = new Date();
36
+ const at = (h, m, plus = 0) => { const d = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate() + plus, h, m, 0, 0); return d; };
37
+ const monday = () => { const d = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate()); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
38
+ const weekAnswer = () => {
39
+ const m = monday(), cells = [];
40
+ 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: [] }); }
41
+ const put = (d, e) => cells.find((c) => c.key === dayKey(d)).events.push(e);
42
+ put(at(9, 30), { id: 'ev-checkout', at: iso(at(9, 30)), end: iso(at(10, 15)), title: 'Checkout sync', attendees: ['Priya', 'Dara'] });
43
+ put(at(14, 0), { id: 'ev-sprint', at: iso(at(14, 0)), end: iso(at(15, 0)), title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'], series: 'sprint-planning' });
44
+ const other = at(9, 30, NOW.getDay() === 0 ? -1 : 1); // a day other than today, still in the week unless it runs off the end
45
+ if (cells.some((c) => c.key === dayKey(other))) put(other, { id: 'ev-standup', at: iso(other), end: iso(new Date(other.getTime() + 30 * 60000)), title: 'Standup', attendees: [] });
46
+ return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(NOW),
47
+ context: { 'ev-sprint': { phase: 'upcoming', level: { kind: 'board', ws: 'w1', id: 'idpf', name: 'IDPF', why: 'you linked it to the board', by: 'pm' } } },
48
+ link_boards: [{ ws: 'w1', id: 'idpf', name: 'IDPF' }, { ws: 'w1', id: 'pay', name: 'Payments' }], gantt: [{ id: 'premium-ux', title: 'Premium UX' }] };
49
+ };
50
+ const REPLAY = { ok: true, note: { id: 'n1', title: 'Sprint planning notes' }, meeting: { title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'] }, audio: { url: '/x', ms: 1500000 }, length_ms: 1500000, lines: [{}],
51
+ keys: [{ k: 'decision', text: 'Plan the sprint with eight people', state: 'draft' }, { k: 'action', text: 'Sam confirms the data fix owner', owner: 'Sam', due: 'Tue', state: 'owner' }, { k: 'question', text: 'Does a release eat the capacity?', state: 'open' }] };
52
+ const MATERIAL = { ok: true, key: 'k', items: [{ id: 'm1', kind: 'doc', ref: 'r', title: 'Capacity sheet', scope: 'series' }, { id: 'm2', kind: 'link', url: 'https://x.example', title: 'Roadmap', scope: 'meeting' }] };
53
+ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html'), 'utf8');
54
+
55
+ (async () => {
56
+ const exe = findBrowser();
57
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
58
+ let chromium;
59
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
60
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
61
+ await T.waitForServer(BASE);
62
+ browser = await chromium.launch({ executablePath: exe });
63
+
64
+ const facts = () => { const f = F.facts(); f.meetings = [{ start: at(14, 0).getTime(), end: at(15, 0).getTime(), title: 'Sprint planning', with: 'Dara, Priya, Sam', initiative: null }]; return f; };
65
+ const open = async ({ w = 1280, h = 900, theme = 'light', week = weekAnswer(), replay = 404, material = MATERIAL, linkRes = { ok: true, link: { kind: 'portfolio' } } } = {}) => {
66
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
67
+ const page = await ctx.newPage();
68
+ const S = { errors: [], reqs: [], posts: [], weekGets: [], replayGets: [] };
69
+ page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
70
+ page.on('request', (r) => { if (r.url().startsWith(BASE)) S.reqs.push(r.method() + ' ' + new URL(r.url()).pathname); });
71
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
72
+ await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(facts()), as_of: Date.now() }));
73
+ await page.route('**/api/calendar-views*', (r) => { S.weekGets.push(new URL(r.request().url()).search); json(r, week, week && week.ok === false ? 500 : 200); });
74
+ await page.route('**/api/meeting-replay*', (r) => { S.replayGets.push(new URL(r.request().url()).search); if (replay === 404) json(r, { ok: false, error: 'no note for that meeting' }, 404); else json(r, replay); });
75
+ await page.route('**/api/meeting-material*', (r) => json(r, material));
76
+ await page.route('**/api/calendar-links', (r) => { S.posts.push(JSON.parse(r.request().postData() || '{}')); json(r, linkRes, linkRes.ok ? 200 : 403); });
77
+ await page.goto(BASE + '/premium.html?theme=' + theme);
78
+ S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0), 20000);
79
+ return Object.assign(S, { ctx, page });
80
+ };
81
+ const week = (p) => p.click('#rng [data-r=week]').then(() => until(() => p.evaluate(() => !document.querySelector('#tl').hasAttribute('aria-busy') && (!!document.querySelector('#tl .wkd') || /Calendar not read/.test(document.querySelector('#tl').textContent)))));
82
+
83
+ const A = await open();
84
+ ok('0 the page draws the list and Today', A.up);
85
+ if (!A.up) return finish(1);
86
+ const p = A.page;
87
+
88
+ /* C1 */
89
+ const sw = await p.evaluate(() => ({ labels: [...document.querySelectorAll('#rng button')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')), box: [...document.querySelectorAll('#rng button')].map((b) => { const r = b.getBoundingClientRect(); return Math.round(Math.min(r.width, r.height)); }), ahead: !!document.querySelector('#tl .grp'), group: document.querySelector('#rng').getAttribute('role') }));
90
+ ok('C1 the switch is beside the title, Today is pressed by default and Today is unchanged', sw.labels.join() === 'Today:true,This week:false' && sw.ahead && sw.group === 'group', JSON.stringify(sw));
91
+ ok('C1 both switch buttons are at least 44 px', sw.box.every((n) => n >= 44), JSON.stringify(sw.box));
92
+ ok('C1 the week is not read until the PM presses it', A.weekGets.length === 0);
93
+
94
+ /* C2 */
95
+ await week(p);
96
+ const wk = await p.evaluate(() => ({
97
+ days: [...document.querySelectorAll('#tl .wkd')].map((d) => d.textContent), rows: [...document.querySelectorAll('#tl .ev')].map((e) => e.querySelector('b').textContent + '|' + e.querySelector('time').textContent + '|' + e.querySelector('.d').textContent),
98
+ now: document.querySelector('#tl .wkd.now') && document.querySelector('#tl .wkd.now').textContent, empty: document.querySelectorAll('#tl .empty').length, cap: document.querySelector('#rcap').textContent, capShown: !document.querySelector('#rcap').hidden,
99
+ filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display, pressed: document.querySelector('#rng [data-r=week]').getAttribute('aria-pressed'), past: document.querySelectorAll('#tl .ev.wkpast').length,
100
+ label: document.querySelector('#tl').getAttribute('aria-label') }));
101
+ ok('C2 pressing This week reads the week once, for today\'s date', A.weekGets.length === 1 && /view=week/.test(A.weekGets[0]) && A.weekGets[0].includes('date=' + dayKey(NOW)), JSON.stringify(A.weekGets));
102
+ ok('C2 the card lists seven days with their counts and marks today', wk.days.length === 7 && /today/.test(wk.now || '') && wk.days.some((d) => /2 meetings/.test(d)), JSON.stringify(wk.days));
103
+ ok('C2 a row shows time, title, length, people and what it is about', wk.rows.some((r) => r === 'Sprint planning|14:00|1 h · with Dara, Priya, Sam · Board: IDPF') && wk.rows.some((r) => r === 'Checkout sync|09:30|45 min · with Priya, Dara'), JSON.stringify(wk.rows));
104
+ ok('C2 days with no meetings say so', wk.empty >= 3, String(wk.empty));
105
+ ok('C2 the caption counts the meetings, the switch shows the week, the filter is hidden', /meetings? · /.test(wk.cap) && wk.capShown && wk.pressed === 'true' && wk.filter === 'none' && /This week/.test(wk.label), JSON.stringify(wk));
106
+ await p.click('#rng [data-r=today]');
107
+ const back = await p.evaluate(() => ({ ahead: !!document.querySelector('#tl .grp'), wk: !!document.querySelector('#tl .wkd'), filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display, cap: document.querySelector('#todayCap').textContent }));
108
+ ok('C2 Today comes back unchanged', back.ahead && !back.wk && back.filter !== 'none' && /earlier · \d+ ahead/.test(back.cap), JSON.stringify(back));
109
+ await week(p);
110
+ ok('C2 pressing This week again reads again', await until(() => A.weekGets.length === 2));
111
+
112
+ /* C4 C5 C6 C7 C8: the dialog from a week row */
113
+ await p.focus('#tl .ev[data-w]');
114
+ const rowKey = await p.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning'); r.id = 'rowSprint'; return r.dataset.w; });
115
+ await p.click('#rowSprint');
116
+ const dlg = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Capacity sheet/.test(document.querySelector('#oMain').textContent) ? { title: document.querySelector('#dTitle').textContent, eye: document.querySelector('#dEye').textContent, sub: document.querySelector('#dSub').textContent, text: document.querySelector('#oMain').textContent, ask: document.querySelector('#askF').hidden } : null));
117
+ ok('C4 a week row opens the standard dialog with its title and when', dlg && dlg.title === 'Sprint planning' && /14:00/.test(dlg.sub) && /Calendar/.test(dlg.eye), JSON.stringify(dlg));
118
+ ok('C4 the dialog reads the replay and the material of that meeting', A.replayGets.some((q) => q.includes('event=ev-sprint')) && !!dlg);
119
+ ok('C6 with no note the dialog says so', dlg && /No notes for this meeting\./.test(dlg.text));
120
+ ok('C7 the material is listed with the scope it was linked at', dlg && /Capacity sheet/.test(dlg.text) && /every meeting of this series/.test(dlg.text) && /Roadmap/.test(dlg.text) && /for this meeting/.test(dlg.text));
121
+ ok('C8 with no recording the dialog draws no Replay', dlg && !/Replay/.test(dlg.text) && !/recording/i.test(dlg.text));
122
+ ok('C4 the conversation is not offered on a week row', dlg && dlg.ask === true);
123
+ ok('C5 the dialog says what it is about, and that the calendar is never written', dlg && /It is about Board: IDPF/.test(dlg.text) && /calendar itself is never written/.test(dlg.text));
124
+ await p.keyboard.press('Escape');
125
+ const closed = await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
126
+ ok('C4 Escape closes it and focus returns to the row', closed && await p.evaluate(() => document.activeElement && document.activeElement.id === 'rowSprint'));
127
+
128
+ /* C5 link it */
129
+ await p.click('#rowSprint');
130
+ await until(() => p.evaluate(() => !!document.querySelector('#mtgSel') && /Capacity sheet/.test(document.querySelector('#oMain').textContent)));
131
+ const dis = await p.evaluate(() => document.querySelector('#mtgLink').disabled);
132
+ ok('C5 Link it is off until a choice is made', dis === true);
133
+ const optsText = await p.evaluate(() => [...document.querySelectorAll('#mtgSel option')].map((o) => o.textContent));
134
+ ok('C5 the choices are the Portfolio, the answer\'s boards and initiatives, and removing the link', optsText.includes('Portfolio') && optsText.includes('Board: Payments') && optsText.includes('Initiative: Premium UX') && optsText.includes('Remove the link'), JSON.stringify(optsText));
135
+ await p.selectOption('#mtgSel', 'board|w1|pay');
136
+ await p.click('#mtgLink');
137
+ await until(() => A.posts.length === 1);
138
+ ok('C5 the press posts one link to /api/calendar-links for the meeting and its series', A.posts.length === 1 && A.posts[0].kind === 'board' && A.posts[0].board === 'pay' && A.posts[0].ws === 'w1' && A.posts[0].event.title === 'Sprint planning' && A.posts[0].event.series === 'sprint-planning', JSON.stringify(A.posts));
139
+ ok('C5 after the write the week is read again', await until(() => A.weekGets.length >= 3));
140
+ await p.keyboard.press('Escape');
141
+
142
+ /* C3 honest states */
143
+ const E = await open({ week: { ok: false, error: 'the calendar could not read the repository: boom' } });
144
+ await week(E.page);
145
+ const er = await E.page.evaluate(() => ({ text: document.querySelector('#tl').textContent, rows: document.querySelectorAll('#tl .ev').length, cap: document.querySelector('#rcap').textContent }));
146
+ ok('C3 a failed read says "Calendar not read" with the reason and draws no meeting', /Calendar not read\./.test(er.text) && /boom/.test(er.text) && er.rows === 0 && er.cap === 'Calendar not read', JSON.stringify(er));
147
+ const Z = await open({ week: Object.assign(weekAnswer(), { cells: weekAnswer().cells.map((c) => Object.assign({}, c, { events: [] })), context: {} }) });
148
+ await week(Z.page);
149
+ ok('C3 an empty week says so', await Z.page.evaluate(() => /No meetings this week/.test(document.querySelector('#rcap').textContent) && document.querySelectorAll('#tl .ev').length === 0));
150
+
151
+ /* C6 C8 with a note and a recording */
152
+ const R = await open({ replay: REPLAY });
153
+ await week(R.page);
154
+ await R.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning').click(); });
155
+ const rd = await until(() => R.page.evaluate(() => /Decisions/.test(document.querySelector('#oMain').textContent) ? document.querySelector('#oMain').textContent : null));
156
+ ok('C6 the note\'s decisions, next steps and questions are listed as the note holds them', rd && /Plan the sprint with eight people/.test(rd) && /Sam confirms the data fix owner/.test(rd) && /Sam · Tue/.test(rd) && /Does a release eat the capacity\?/.test(rd) && /Sprint planning notes/.test(rd), String(rd).slice(0, 300));
157
+ ok('C8 a kept recording is summarised, and Replay opens in the console', rd && /A recording is kept: 25 min, 3 key points/.test(rd) && /Replay opens in the console/.test(rd));
158
+ ok('C6 the replay answer\'s people are used only when the calendar lists none', rd && /Dara, Priya, Sam/.test(rd));
159
+
160
+ /* C4 a Today row opens the same dialog when the calendar answer knows the meeting */
161
+ const Tt = await open({ replay: REPLAY });
162
+ await Tt.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning').click(); });
163
+ const td = await until(() => Tt.page.evaluate(() => /Capacity sheet/.test(document.querySelector('#oMain').textContent) ? { ask: document.querySelector('#askF').hidden, title: document.querySelector('#dTitle').textContent } : null));
164
+ ok('C4 a Today meeting row opens the full dialog and keeps its conversation', td && td.title === 'Sprint planning' && td.ask === false, JSON.stringify(td));
165
+ const Mg = await open({ week: { ok: false, error: 'down' } });
166
+ await Mg.page.evaluate(() => { [...document.querySelectorAll('#tl .ev')].find((e) => e.dataset.kind !== 'x' && e.querySelector('b').textContent === 'Sprint planning').click(); });
167
+ ok('C4 when the calendar answer is down, a Today row keeps the plain dialog', await until(() => Mg.page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && document.querySelector('#dTitle').textContent === 'Sprint planning' && !document.querySelector('#mtgSel'))));
168
+
169
+ /* C9 */
170
+ const allPosts = [].concat(A.reqs, R.reqs, Tt.reqs).filter((r) => /^POST /.test(r));
171
+ ok('C9 the only write the page sent is the link', allPosts.length === 1 && allPosts[0] === 'POST /api/calendar-links', JSON.stringify(allPosts));
172
+ ok('C9 no recording, Focus or material request was sent', ![].concat(A.reqs, R.reqs, Tt.reqs).some((r) => /\/api\/(notes|meeting-focus)|POST \/api\/meeting-material/.test(r)));
173
+ ok('C9 no page error', [A, E, Z, R, Tt, Mg].every((x) => x.errors.length === 0), JSON.stringify([A, E, Z, R, Tt, Mg].map((x) => x.errors)));
174
+
175
+ /* C10 floors and fidelity */
176
+ for (const th of ['light', 'dark']) {
177
+ const P = await open({ w: 390, h: 844, theme: th });
178
+ await week(P.page);
179
+ const f = await P.page.evaluate(() => ({ scroll: document.documentElement.scrollWidth <= innerWidth + 1, rows: [...document.querySelectorAll('#tl .ev')].map((e) => e.getBoundingClientRect().height), sw: [...document.querySelectorAll('#rng button')].map((b) => Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height)) }));
180
+ ok(`C10 at 390 px (${th}) there is no sideways scroll and rows and switch buttons are at least 44 px`, f.scroll && f.rows.every((h) => h >= 44) && f.sw.every((n) => n >= 44), JSON.stringify(f));
181
+ await P.ctx.close();
182
+ }
183
+ const css = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); if (!e) return null; const c = getComputedStyle(e); return ['fontSize', 'fontWeight', 'letterSpacing', 'textTransform', 'borderRadius', 'paddingTop', 'color'].map((k) => c[k]).join('|'); }, sel);
184
+ const mk = await browser.newContext({ viewport: { width: 1280, height: 900 } }); const mp = await mk.newPage();
185
+ await mp.setContent(MOCKUP); await mp.waitForTimeout(500);
186
+ const F1 = await open();
187
+ const pairs = [['#todayCard', '#todayCard'], ['#tl .ev b', '#tl .ev b'], ['#tl .nowl', '#tl .nowl']];
188
+ for (const [a, b] of pairs) { const x = await css(mp, a), y = await css(F1.page, b); ok('C10 fidelity: ' + a + ' keeps the mockup\'s computed style at 1280 px', x === y || (x === null && true), x + ' vs ' + y); }
189
+ const grp = await css(mp, '#tl .grp');
190
+ await week(F1.page);
191
+ const wd = await css(F1.page, "#tl .wkd");
192
+ ok('C10 fidelity: a day heading uses the mockup\'s group-heading type', grp && wd && wd.split('|').slice(0, 4).join('|') === grp.split('|').slice(0, 4).join('|'), grp + ' vs ' + wd);
193
+ await mk.close();
194
+ return finish();
195
+ })().catch((e) => { console.error(e); finish(1); });
@@ -82,6 +82,14 @@ The pin on a row keeps it at the top for this session.
82
82
 
83
83
  Today lists the day in time order: what is ahead, a marker for the time the data was read, and what came earlier. It has three sources: the calendar PMOS holds, merges to `main`, and agent runs. The filter button turns a source on or off. Press an item to read it.
84
84
 
85
+ ### This week
86
+
87
+ The Today card has a **Today / This week** switch. **This week** lists the meetings of the current week from the calendar PMOS holds, grouped by day. It reads the week once when you press it; while it reads, the list says so. If the calendar cannot be read, the card says "Calendar not read" and gives the reason, and does not guess. A meeting in the past is shown dimmer. The switch changes only what the card shows and records nothing.
88
+
89
+ Press a meeting, from Today or from the week, to open the meeting dialog. It shows the time, the people, and what the meeting is about. It also shows the notes (decisions, next steps and open questions), the material, and, when a recording was kept, its length and the key points. Each part appears only when a record holds it.
90
+
91
+ When the meeting is not linked, the dialog has a **Link it** press. You choose the portfolio, a board, an initiative or none. The press writes one calendar link, through a check that only a real press from this page can pass, so an agent session is refused. After the write, the page reads the week again. Adding or removing material, routing next steps, recording and Focus stay in the console for now.
92
+
85
93
  ## The dock
86
94
 
87
95
  When you scroll past the hero, the hero folds into a bar at the top. The bar shows how many rows need you and the next item in Today.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.263.0",
3
+ "version": "0.264.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.263.0",
9
+ "version": "0.264.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.263.0",
3
+ "version": "0.264.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,169 @@
1
+ /* pm/premium-meeting.js — Calendar in the premium Briefing's Today card (initiative briefing-premium-calendar, slice 1).
2
+ * The Today / This week switch, the week list and the meeting dialog. Reads GET /api/calendar-views?view=week, GET /api/meeting-replay and GET /api/meeting-material.
3
+ * The one write is "Link it", through POST /api/calendar-links. Every word is a field of a record: the pure half (weekView, meetingView) takes the routes' answers and
4
+ * returns what the page draws, so a test reads it without a DOM. Recording, Focus and material changes are later slices. */
5
+
6
+ const pad = (n) => String(n).padStart(2, '0');
7
+ const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
8
+ const DOW = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
9
+ const dayLabel = (key) => { const [y, m, d] = key.split('-').map(Number); const wd = (new Date(Date.UTC(y, m - 1, d)).getUTCDay() + 6) % 7; return `${DOW[wd]} ${d} ${MON[m - 1]}`; };
10
+ const hasTime = (s) => typeof s === 'string' && /T\d{2}:\d{2}/.test(s);
11
+ const hhmm = (s) => (hasTime(s) ? s.slice(11, 16) : 'All day');
12
+ const minutesBetween = (a, b) => (hasTime(a) && hasTime(b) ? Math.round((Date.parse(b) - Date.parse(a)) / 60000) : null);
13
+ const lengthText = (m) => (m == null || m <= 0 ? '' : m < 60 ? m + ' min' : m % 60 ? Math.floor(m / 60) + ' h ' + (m % 60) + ' min' : m / 60 + ' h');
14
+
15
+ /** What a meeting is about, in words, from the calendar answer's `context[id].level`. A past meeting carries no level in the answer, so it says nothing. */
16
+ export function aboutOf(level) {
17
+ if (!level || !level.kind) return '';
18
+ if (['portfolio'].includes(level.kind)) return 'Portfolio';
19
+ return (level.kind === 'board' ? 'Board: ' : 'Initiative: ') + clip(level.name || level.id || '', 60);
20
+ }
21
+
22
+ /** The week as the card draws it. `r` is the answer of GET /api/calendar-views?view=week, or { ok:false, error }. `today` is 'YYYY-MM-DD'. */
23
+ export function weekView(r, today) {
24
+ if (!r || r.ok !== true) return { state: 'error', reason: clip((r && r.error) || 'The calendar did not answer.', 160), days: [], total: 0, caption: 'Calendar not read' };
25
+ const cells = Array.isArray(r.cells) ? r.cells : [], ctx = r.context && typeof r.context === 'object' ? r.context : {};
26
+ const days = cells.map((c) => {
27
+ const rows = (c.events || []).filter((e) => e && e.title).slice().sort((a, b) => String(a.at).localeCompare(String(b.at))).map((e) => {
28
+ const mins = minutesBetween(e.at, e.end), who = Array.isArray(e.attendees) ? e.attendees.filter(Boolean) : [], level = (ctx[e.id] || {}).level;
29
+ return {
30
+ id: e.id, series: e.series || null, title: clip(e.title, 120), at: e.at, end: e.end || null, time: hhmm(e.at), len: lengthText(mins), who,
31
+ sub: [lengthText(mins), who.length ? 'with ' + who.join(', ') : ''].filter(Boolean).join(' · '),
32
+ about: aboutOf(level), level: level || null, past: c.end < today, day: c.key,
33
+ };
34
+ });
35
+ return { key: c.key, label: dayLabel(c.key), today: c.key === today, past: c.end < today, rows };
36
+ });
37
+ const total = days.reduce((s, d) => s + d.rows.length, 0), range = r.range || {};
38
+ const span = range.start && range.end ? `${Number(range.start.slice(8))}–${Number(range.end.slice(8))} ${MON[Number(range.end.slice(5, 7)) - 1]}` : '';
39
+ return { state: 'ok', days, total, caption: total ? `${total} ${total === 1 ? 'meeting' : 'meetings'}${span ? ' · ' + span : ''}` : 'No meetings this week',
40
+ boards: Array.isArray(r.link_boards) ? r.link_boards.map((b) => ({ ws: b.ws, id: b.id, name: b.name })) : [],
41
+ initiatives: (Array.isArray(r.gantt) ? r.gantt : []).filter((g) => g && g.id).slice(0, 60).map((g) => ({ id: g.id, name: clip(g.title || g.id, 70) })) };
42
+ }
43
+
44
+ /** The meeting dialog's sections. `row` is a weekView row; `replay` is { state:'none'|'ok'|'error', body }; `material` is { state, items }. Nothing here is invented. */
45
+ export function meetingView(row, replay, material) {
46
+ const rep = replay && replay.state === 'ok' ? replay.body : null;
47
+ const people = row.who && row.who.length ? row.who : (rep && rep.meeting && Array.isArray(rep.meeting.attendees) ? rep.meeting.attendees : []);
48
+ const keys = rep && Array.isArray(rep.keys) ? rep.keys : [];
49
+ const pick = (k) => keys.filter((x) => x.k === k).map((x) => ({ text: clip(x.text, 240), owner: x.owner || '', due: x.due || '', open: x.state === 'open' || x.state === 'owner' }));
50
+ const notes = rep ? { title: clip((rep.note && rep.note.title) || '', 120), decisions: pick('decision'), actions: pick('action'), questions: pick('question') } : null;
51
+ const heard = rep && Number(rep.length_ms) > 0 ? Math.round(rep.length_ms / 60000) : 0;
52
+ return {
53
+ people,
54
+ notes, notesState: replay ? replay.state : 'none',
55
+ notesLine: !replay ? 'Reading the notes.' : replay.state === 'error' ? 'The notes could not be read: ' + clip(replay.error, 120) : replay.state === 'none' ? 'No notes for this meeting.' : '',
56
+ replay: rep && (rep.audio || heard) ? { minutes: heard, keyPoints: keys.length, lines: Array.isArray(rep.lines) ? rep.lines.length : 0 } : null,
57
+ material: material && material.state === 'ok' ? (material.items || []).map((i) => ({ title: clip(i.title || i.ref || i.url, 120), kind: i.kind || '', scope: i.scope === 'series' ? 'every meeting of this series' : 'this meeting' })) : null,
58
+ materialLine: !material ? 'Reading the material.' : material.state === 'error' ? 'The material could not be read: ' + clip(material.error, 120) : (material.items || []).length ? '' : 'No material is linked to this meeting.',
59
+ row,
60
+ };
61
+ }
62
+
63
+ /** The body of POST /api/calendar-links for a choice made in the dialog: 'portfolio', 'none', 'board|<ws>|<id>' or 'initiative|<id>'. */
64
+ export function linkBody(row, choice, boards) {
65
+ const event = { title: row.title, ...(row.series ? { series: row.series } : {}) };
66
+ if (['portfolio', 'none'].includes(choice)) return { event, kind: choice };
67
+ const [k, a, b] = String(choice).split('|');
68
+ if (k === 'board') { const bd = (boards || []).find((x) => x.id === b && String(x.ws) === a); return { event, kind: 'board', ws: a, board: b, ...(bd ? { title: bd.name } : {}) }; }
69
+ if (k === 'initiative') return { event, kind: 'initiative', initiative: a };
70
+ return null;
71
+ }
72
+
73
+ /* ── the page half ─────────────────────────────────────────────────────────────────────────────────────── */
74
+
75
+ /** deps: { $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, wsq(), ws() }. Returns { mode, draw, openToday }. */
76
+ export function mountMeeting(d) {
77
+ const { $, $$, esc } = d;
78
+ let mode = 'today', W = null, seq = 0, busy = false;
79
+ const today = () => { const t = new Date(); return `${t.getFullYear()}-${pad(t.getMonth() + 1)}-${pad(t.getDate())}`; };
80
+ const wsq = (first) => { const w = d.ws(); return w ? (first ? '?' : '&') + 'ws=' + encodeURIComponent(w) : ''; };
81
+ const ICON = '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>';
82
+
83
+ async function readWeek() {
84
+ const n = ++seq; busy = true;
85
+ const res = await d.pmGet('/api/calendar-views?view=week&date=' + today() + wsq());
86
+ if (n !== seq) return;
87
+ busy = false; W = weekView(res, today());
88
+ }
89
+ const rowHtml = (r, k) => `<button class="ev src-meeting${r.past ? ' wkpast' : ''}" data-w="${esc(k)}" aria-haspopup="dialog"><time>${esc(r.time)}</time><span class="gl-t"><svg class="i" viewBox="0 0 24 24">${ICON}</svg></span><span><b>${esc(r.title)}</b><span class="d">${esc([r.sub, r.about].filter(Boolean).join(' · ') || 'No other people listed')}</span></span></button>`;
90
+ function draw() {
91
+ const card = $('#todayCard');
92
+ $$('#rng button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.r === mode));
93
+ card.classList.toggle('wkm', mode === 'week'); $('#rcap').hidden = mode !== 'week';
94
+ if (mode !== 'week') return false;
95
+ $('#tl').setAttribute('aria-label', 'This week. Use the up and down arrow keys to move between rows.');
96
+ if (!W) { $('#todayCap').textContent = $('#rcap').textContent = 'Reading the calendar'; $('#tl').innerHTML = '<div class="empty">Reading the calendar PMOS holds.</div>'; return true; }
97
+ $('#todayCap').textContent = $('#rcap').textContent = W.caption;
98
+ if (W.state === 'error') { $('#tl').innerHTML = `<div class="empty" role="status">Calendar not read. ${esc(W.reason)}</div>`; return true; }
99
+ $('#tl').innerHTML = W.days.map((x) => `<div class="wkd${x.today ? ' now' : ''}">${esc(x.label)}${x.today ? ' · today' : ''}<em>${x.rows.length ? x.rows.length + (x.rows.length === 1 ? ' meeting' : ' meetings') : ''}</em></div>${x.rows.length ? x.rows.map((r, i) => rowHtml(r, x.key + '|' + i)).join('') : '<div class="empty">No meetings.</div>'}`).join('');
100
+ $$('#tl .ev').forEach((e, i) => { e.tabIndex = i ? -1 : 0; });
101
+ return true;
102
+ }
103
+ const rowOf = (k) => { const [day, i] = k.split('|'); const x = W && W.days.find((y) => y.key === day); return x ? x.rows[+i] : null; };
104
+
105
+ async function setMode(m, redraw) {
106
+ mode = m;
107
+ if (m === 'week') { $('#tl').setAttribute('aria-busy', 'true'); draw(); await readWeek(); $('#tl').removeAttribute('aria-busy'); }
108
+ redraw();
109
+ }
110
+
111
+ /* the dialog */
112
+ const sec = (label, body) => `<div class="mtg-sec"><span class="label">${esc(label)}</span>${body}</div>`;
113
+ const items = (L) => `<ul class="mtg-l">${L.map((x) => `<li>${esc(x.text)}${x.owner || x.due ? `<em>${esc([x.owner, x.due].filter(Boolean).join(' · '))}</em>` : ''}</li>`).join('')}</ul>`;
114
+ function paneHtml(v, boards, inis, saved) {
115
+ const r = v.row, lv = r.level;
116
+ const aboutNow = lv ? aboutOf(lv) : saved || '';
117
+ const opts = [['', aboutNow ? 'Change what it is about' : 'Choose what it is about'], ['portfolio', 'Portfolio']].concat(boards.map((b) => ['board|' + b.ws + '|' + b.id, 'Board: ' + b.name]), inis.map((i) => ['initiative|' + i.id, 'Initiative: ' + i.name]), [['none', 'Remove the link']]);
118
+ const about = `<p>${aboutNow ? 'It is about <b>' + esc(aboutNow) + '</b>.' + (lv && lv.why ? ' ' + esc(lv.why) + '.' : '') : (r.past ? 'The calendar answer holds no link for an earlier meeting.' : 'Not linked to anything yet.')}</p>
119
+ <div class="mtg-link"><select id="mtgSel" aria-label="What this meeting is about">${opts.map(([val, t]) => `<option value="${esc(val)}">${esc(t)}</option>`).join('')}</select><button class="cta" id="mtgLink" disabled>Link it</button></div>
120
+ <p class="note" id="mtgMsg" role="status">The link applies to every occurrence of “${esc(r.title)}”. The calendar itself is never written.</p>`;
121
+ const n = v.notes;
122
+ const notes = v.notesLine ? `<p class="note">${esc(v.notesLine)}</p>` : [n.title ? `<p><b>${esc(n.title)}</b></p>` : '',
123
+ n.decisions.length ? `<h4 class="mtg-h">Decisions ${n.decisions.length}</h4>${items(n.decisions)}` : '', n.actions.length ? `<h4 class="mtg-h">Next steps ${n.actions.length}</h4>${items(n.actions)}` : '',
124
+ n.questions.length ? `<h4 class="mtg-h">Open questions ${n.questions.length}</h4>${items(n.questions)}` : '', (n.decisions.length + n.actions.length + n.questions.length) ? '' : '<p class="note">The note holds no decisions, next steps or questions yet.</p>'].join('');
125
+ const mat = v.materialLine ? `<p class="note">${esc(v.materialLine)}</p>` : `<ul class="mtg-l">${v.material.map((m) => `<li>${esc(m.title)}<em>${esc([m.kind, 'for ' + m.scope].filter(Boolean).join(' · '))}</em></li>`).join('')}</ul>`;
126
+ const rep = v.replay ? `<p>A recording is kept: ${v.replay.minutes ? v.replay.minutes + ' min, ' : ''}${v.replay.keyPoints} key ${v.replay.keyPoints === 1 ? 'point' : 'points'}.</p><p class="note">Replay opens in the console for now.</p>` : '';
127
+ return `<article class="paper doc mtg">${d.kv([['When', r.day + ' · ' + r.time + (r.len ? ' · ' + r.len : '')], ['People', v.people.join(', ') || 'The calendar lists no other people.']])}${sec('What it is about', about)}${sec('Notes', notes)}${sec('Material', mat)}${rep ? sec('Replay', rep) : ''}</article>`;
128
+ }
129
+
130
+ async function openRow(row, via) {
131
+ let replay = null, material = null, boards = W ? W.boards : [], inis = W ? W.initiatives : [], saved = '';
132
+ const paint = () => { $('#oMain').innerHTML = paneHtml(meetingView(row, replay, material), boards, inis, saved); };
133
+ d.openDlg({ eye: 'Calendar · real data', title: row.title, sub: [row.day, row.time, row.len].filter(Boolean).join(' · '), noteKey: via === 'today' ? 'ev:meeting:' + Date.parse(row.at) : null,
134
+ stream: d.turnA(d.ptx('This meeting is in the calendar PMOS holds. Its notes, material and recording appear here only if PMOS holds them.')), pane: paneHtml(meetingView(row, null, null), boards, inis, ''), label: 'Meeting' });
135
+ if (via !== 'today') $('#askF').hidden = true;
136
+ const [rp, mt] = await Promise.all([d.pmGet('/api/meeting-replay?event=' + encodeURIComponent(row.id) + '&date=' + row.day), d.pmGet('/api/meeting-material?event=' + encodeURIComponent(row.id) + '&title=' + encodeURIComponent(row.title) + (row.series ? '&series=' + encodeURIComponent(row.series) : '') + '&date=' + row.day)]);
137
+ if ($('#dTitle').textContent !== row.title) return;
138
+ replay = rp && rp.ok === true ? { state: 'ok', body: rp } : rp && rp.status === 404 ? { state: 'none' } : { state: 'error', error: (rp && rp.error) || 'no answer' };
139
+ material = mt && mt.ok === true ? { state: 'ok', items: mt.items || [] } : { state: 'error', error: (mt && mt.error) || 'no answer' };
140
+ paint();
141
+ const sel = () => $('#mtgSel');
142
+ $('#oMain').onchange = (e) => { if (e.target.id === 'mtgSel') $('#mtgLink').disabled = !e.target.value; };
143
+ $('#oMain').onclick = async (e) => {
144
+ if (!e.target.closest('#mtgLink')) return;
145
+ const body = linkBody(row, sel().value, boards);
146
+ if (!body) return;
147
+ const go = $('#mtgLink'); go.disabled = true;
148
+ const res = await d.pmPost('/api/calendar-links', body);
149
+ if (!res || res.ok !== true) { go.disabled = false; $('#mtgMsg').textContent = (res && res.error) || 'The link could not be saved.'; return; }
150
+ saved = body.kind === 'none' ? '' : sel().selectedOptions[0].textContent;
151
+ d.toast(body.kind === 'none' ? 'The link is removed for every occurrence of this meeting.' : 'Linked. It applies to every occurrence of this meeting.');
152
+ await readWeek(); paint(); if (mode === 'week') draw();
153
+ $('#oMain').onchange = (ev) => { if (ev.target.id === 'mtgSel') $('#mtgLink').disabled = !ev.target.value; };
154
+ };
155
+ }
156
+
157
+ /** A Today row: the week answer says which calendar event it is. With no match the page keeps the plain dialog. */
158
+ async function openToday(e) {
159
+ if (!W || W.state !== 'ok') await readWeek();
160
+ const hit = W && W.state === 'ok' ? W.days.flatMap((x) => x.rows).find((r) => Date.parse(r.at) === e.at && r.title === clip(e.title, 120)) : null;
161
+ if (!hit) return false;
162
+ await openRow(hit, 'today');
163
+ return true;
164
+ }
165
+
166
+ $('#rng').addEventListener('click', (e) => { const b = e.target.closest('button'); if (b && b.dataset.r !== mode && d.redraw) setMode(b.dataset.r, d.redraw); });
167
+ $('#tl').addEventListener('click', (e) => { const b = e.target.closest('.ev[data-w]'); if (!b) return; e.stopImmediatePropagation(); const r = rowOf(b.dataset.w); if (r) openRow(r, 'week'); }, true);
168
+ return { mode: () => mode, draw, openToday, busy: () => busy };
169
+ }
@@ -1287,3 +1287,26 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
1287
1287
  .sr button{min-height:44px;min-width:64px;flex:none}
1288
1288
  .sr .fchip[aria-checked="true"]{background:var(--solid);color:var(--on-solid)}
1289
1289
  @media (max-width:600px){.pkmenu{left:0;right:auto}} /* three round header buttons leave the picker too far left for a right-aligned menu (initiative premium-settings) */
1290
+
1291
+ /* ── Today / This week and the meeting dialog (initiative briefing-premium-calendar) ─────────────────────────────────── */
1292
+ #rng{margin-left:4px;flex:none;overflow:visible;max-width:none}
1293
+ #rng button{min-height:44px;min-width:44px}
1294
+ #rng button[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
1295
+ #todayCard .ch h2{flex:none;margin:0}
1296
+ #todayCard .ch small{display:none}
1297
+ #todayCard .ch .fbtn{margin-left:auto}
1298
+ #todayCard.wkm .fbtn,#todayCard.wkm #todayOpts{display:none}
1299
+ .rcap{font-size:var(--t-small);color:var(--ink-3);margin-top:2px}
1300
+ .wkd{font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);padding:14px 0 6px;display:flex;gap:10px;align-items:center}
1301
+ .wkd.now{color:var(--ember-ink)}.wkd.now::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--ember)}
1302
+ .wkd em{font-style:normal;margin-left:auto;letter-spacing:0;text-transform:none;font-weight:500}
1303
+ .ev.wkpast{opacity:.55}
1304
+ .mtg-sec{margin-top:20px}.mtg-sec>.label{display:block;margin-bottom:8px}
1305
+ .mtg-sec p{margin:0 0 8px;color:var(--ink-2);line-height:1.55}
1306
+ .mtg-h{font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);margin:14px 0 6px}
1307
+ .mtg-l{margin:0;padding:0;list-style:none;display:grid;gap:6px}
1308
+ .mtg-l li{padding:8px 0;border-top:1px solid var(--hair)}.mtg-l li:first-child{border-top:0}
1309
+ .mtg-l em{display:block;font-style:normal;font-size:var(--t-small);color:var(--ink-3)}
1310
+ .mtg-link{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:10px 0 8px}
1311
+ .mtg-link select{flex:1 1 220px;min-width:0;min-height:44px;border-radius:18px;border:1px solid var(--hair);background:var(--well);padding:0 14px;font:inherit;color:inherit}
1312
+ @media (max-width:700px){#todayCard .ch{flex-wrap:wrap;row-gap:8px}}
@@ -2,7 +2,8 @@
2
2
  * lib/briefing-premium.js builds: the hero, "What you need to do", Today, the dock and the standard dialog. The read is one GET; the only writes are the PM's own presses (slice 2, below). A row clears when the repository's record changes, so there is nothing to press to clear it.
3
3
  * Slice 2 (initiative briefing-premium-writes): the buttons that record the PM's own calls post to /api/briefing-premium/{decide,put-off,return}.
4
4
  * Slice 3: the reply box asks a read-only agent. A control with nothing honest to write stays disabled and says why. */
5
- import { pmPost } from './http.js';
5
+ import { pmPost, pmGet } from './http.js';
6
+ import { mountMeeting } from './premium-meeting.js';
6
7
  import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail } from './premium-shell.js';
7
8
  const ICON = {
8
9
  meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
@@ -16,6 +17,7 @@ const on = new Set(Object.keys(SRC));
16
17
  const pinned = new Set();
17
18
 
18
19
  wireRail('brief');
20
+ const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => drawTl() });
19
21
 
20
22
  /* ── a day's baseline, kept on this device, so "N of M done" counts rows that cleared since the page first read today ────── */
21
23
  const dayKey = () => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -74,6 +76,7 @@ function drawChips() {
74
76
  $('#srcChips').innerHTML = Object.entries(SRC).filter(([k]) => k !== 'digest' || M.today.counts.digest).map(([k, n]) => `<button class="fchip" data-k="${k}" aria-pressed="${on.has(k)}">${n}<em>${M.today.counts[k] || 0}</em></button>`).join('');
75
77
  }
76
78
  function drawTl() {
79
+ if (week.draw()) return;
77
80
  const T = M.today, all = ALL(), ahead = T.ahead.filter((e) => on.has(e.kind)), early = T.earlier.filter((e) => on.has(e.kind));
78
81
  $('#todayCap').textContent = `${early.length} earlier · ${ahead.length} ahead`;
79
82
  $('#tl').innerHTML = `<div class="grp">Ahead</div>${ahead.length ? ahead.map((e) => evHtml(e, all.indexOf(e))).join('') : '<div class="empty">Nothing ahead in these sources.</div>'}<div class="nowl">${esc(T.now.t)} · ${esc(T.now.label)}</div><div class="grp" style="padding-top:6px">Earlier today</div><div class="early">${early.length ? early.map((e) => evHtml(e, all.indexOf(e))).join('') : `<div class="empty">${esc(T.note || 'Nothing yet in these sources.')}</div>`}</div>`;
@@ -89,7 +92,12 @@ $('#tl').addEventListener('keydown', (e) => {
89
92
  const j = e.key === 'ArrowDown' ? Math.min(L.length - 1, i + 1) : e.key === 'ArrowUp' ? Math.max(0, i - 1) : e.key === 'Home' ? 0 : L.length - 1;
90
93
  L.forEach((x) => { x.tabIndex = -1; }); L[j].tabIndex = 0; L[j].focus();
91
94
  });
92
- $('#tl').addEventListener('click', (e) => { const b = e.target.closest('.ev'); if (b) openEvent(ALL()[+b.dataset.i]); });
95
+ $('#tl').addEventListener('click', async (e) => {
96
+ const b = e.target.closest('.ev'); if (!b || b.dataset.w) return;
97
+ const ev = ALL()[+b.dataset.i];
98
+ if (ev && ev.kind === 'meeting' && await week.openToday(ev)) return; // the calendar answer knows this meeting: the full meeting dialog
99
+ openEvent(ev);
100
+ });
93
101
  document.addEventListener('click', (e) => {
94
102
  const fb = e.target.closest('.fbtn');
95
103
  if (fb) { const o = $('#' + fb.dataset.opts), v = !o.classList.contains('on'); o.classList.toggle('on', v); o.inert = !v; fb.setAttribute('aria-expanded', v); }
@@ -57,7 +57,8 @@
57
57
  </div>
58
58
  <div>
59
59
  <section class="card rise" id="todayCard" style="--d:7" aria-labelledby="hToday">
60
- <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span><h2 id="hToday">Today</h2><small id="todayCap"></small><button class="fbtn" data-opts="todayOpts" aria-expanded="false" aria-controls="todayOpts" aria-label="Filter sources"><svg class="i" viewBox="0 0 24 24"><path d="M4 7h9M17 7h3M4 17h3M11 17h9"/><circle cx="15" cy="7" r="2"/><circle cx="9" cy="17" r="2"/></svg></button></div>
60
+ <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span><h2 id="hToday">Today</h2><div class="seg" id="rng" role="group" aria-label="Range"><button type="button" data-r="today" aria-pressed="true">Today</button><button type="button" data-r="week" aria-pressed="false">This week</button></div><small id="todayCap"></small><button class="fbtn" data-opts="todayOpts" aria-expanded="false" aria-controls="todayOpts" aria-label="Filter sources"><svg class="i" viewBox="0 0 24 24"><path d="M4 7h9M17 7h3M4 17h3M11 17h9"/><circle cx="15" cy="7" r="2"/><circle cx="9" cy="17" r="2"/></svg></button></div>
61
+ <p class="rcap" id="rcap" hidden></p>
61
62
  <div class="opts" id="todayOpts" inert><div><div class="chips" id="srcChips" role="group" aria-label="Sources"></div></div></div>
62
63
  <div class="tl" id="tl" role="group" aria-label="Today. Use the up and down arrow keys to move between rows."></div>
63
64
  </section>
@@ -45,6 +45,7 @@
45
45
  "briefing-premium-adddoc.test.js",
46
46
  "briefing-premium-reports.test.js",
47
47
  "briefing-premium-doc-edit.test.js",
48
+ "briefing-premium-calendar.test.js",
48
49
  "briefing-premium-products.test.js",
49
50
  "briefing-premium-sources.test.js",
50
51
  "briefing-premium-metrics.test.js",
@@ -211,6 +212,7 @@
211
212
  "briefing-premium-adddoc.test.js": 1,
212
213
  "briefing-premium-reports.test.js": 1,
213
214
  "briefing-premium-doc-edit.test.js": 1,
215
+ "briefing-premium-calendar.test.js": 1,
214
216
  "briefing-premium-products.test.js": 1,
215
217
  "briefing-premium-sources.test.js": 1,
216
218
  "briefing-premium-metrics.test.js": 1,
@@ -8,6 +8,7 @@
8
8
  "briefing-premium-initiative-test.js",
9
9
  "briefing-premium-adddoc-test.js",
10
10
  "briefing-premium-doc-edit-test.js",
11
+ "briefing-premium-calendar-test.js",
11
12
  "briefing-premium-products-test.js",
12
13
  "briefing-premium-sources-test.js",
13
14
  "briefing-premium-metrics-test.js",
@@ -21,6 +22,7 @@
21
22
  "briefing-premium-initiative-test.js": 120,
22
23
  "briefing-premium-adddoc-test.js": 120,
23
24
  "briefing-premium-doc-edit-test.js": 90,
25
+ "briefing-premium-calendar-test.js": 90,
24
26
  "briefing-premium-products-test.js": 90,
25
27
  "briefing-premium-sources-test.js": 90,
26
28
  "briefing-premium-metrics-test.js": 120,