create-pmos 0.311.0 → 0.312.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.311.0",
3
+ "version": "0.312.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@ae8712a
1
+ kernel-source: pmos@aa213c1
2
2
  assembled: 2026-10-19
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-19T12:56:28Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T13:02:02Z"}
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-19T12:56:28Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T13:02:02Z"}
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-19T12:56:28Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T13:02:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -104,8 +104,7 @@ const SUGGEST = { ok: true, suggested: [{ kind: 'pmos-doc', ref: 'planning/prd/p
104
104
  await page.route('**/api/calendar-links', (r) => json(r, { ok: true }));
105
105
  await page.goto(BASE + '/premium.html?theme=' + theme);
106
106
  S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0), 20000);
107
- await page.click('#rng [data-r=week]');
108
- await until(() => page.evaluate(() => !document.querySelector('#tl').hasAttribute('aria-busy') && !!document.querySelector('#tl .wkd')));
107
+ await until(() => page.evaluate(() => document.querySelectorAll('#wkStrip [data-day]').length === 5)); // the card's day strip: today is picked, so the row is a Today row
109
108
  await page.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Sprint planning'); r.id = 'rowSprint'; r.click(); });
110
109
  S.dlg = await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#mmAdd') && /Roadmap|No material/.test(document.querySelector('#oMain').textContent)));
111
110
  return Object.assign(S, { ctx, page });
@@ -37,7 +37,8 @@ const NOW = new Date();
37
37
  const midnight = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate());
38
38
  const monday = () => { const d = new Date(midnight); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
39
39
  /* "Live review" is under way now (it starts at most 10 minutes ago, never before midnight); "Retro" ended long ago when the day allows, so it cannot be recorded. */
40
- const START = new Date(Math.max(midnight.getTime(), NOW.getTime() - 10 * 60000)), END = new Date(START.getTime() + 60 * 60000);
40
+ /* START is in whole minutes, as the calendar answer holds them, so the Today row finds its event. */
41
+ const START = new Date(Math.max(midnight.getTime(), Math.floor((NOW.getTime() - 10 * 60000) / 60000) * 60000)), END = new Date(START.getTime() + 60 * 60000);
41
42
  const weekAnswer = () => {
42
43
  const m = monday(), cells = [];
43
44
  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: [] }); }
@@ -134,8 +135,7 @@ const RECORDER = () => {
134
135
  await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
135
136
  if (url === '/premium.html' && openDialog) {
136
137
  S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0), 20000);
137
- await page.click('#rng [data-r=week]');
138
- await until(() => page.evaluate(() => !document.querySelector('#tl').hasAttribute('aria-busy') && !!document.querySelector('#tl .wkd')));
138
+ await until(() => page.evaluate(() => document.querySelectorAll('#wkStrip [data-day]').length === 5)); // the card's day strip: today is picked, so the row is a Today row
139
139
  await page.evaluate(() => { const r = [...document.querySelectorAll('#tl .ev')].find((e) => e.querySelector('b').textContent === 'Live review'); r.click(); });
140
140
  S.dlg = await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#m3Rec')));
141
141
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
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;
3
+ /* briefing-premium-calendar-test.js — the Calendar card's day strip (initiative premium-calendar-card; it replaced the Today / This week switch) and the meeting dialog on the premium Briefing (initiative briefing-premium-calendar, slice 1;
4
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
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
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
@@ -35,16 +35,20 @@ const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); retu
35
35
  const NOW = new Date();
36
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
37
  const monday = () => { const d = new Date(NOW.getFullYear(), NOW.getMonth(), NOW.getDate()); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d; };
38
+ /* a weekday of this week that is not today: Tuesday when today is Monday, else Monday */
39
+ const OTHER = () => { const m = monday(); if (NOW.getDay() === 1) m.setDate(m.getDate() + 1); return m; };
38
40
  const weekAnswer = () => {
39
41
  const m = monday(), cells = [];
40
42
  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
43
  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: [] });
44
+ /* today holds Sprint planning (the Today row); another day of the strip holds Checkout sync and Sprint planning (the rows a picked day lists) */
45
+ const o = (h, mm) => { const x = OTHER(); x.setHours(h, mm, 0, 0); return x; };
46
+ put(at(14, 0), { id: 'ev-sprint-today', at: iso(at(14, 0)), end: iso(at(15, 0)), title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'], series: 'sprint-planning' });
47
+ put(o(9, 30), { id: 'ev-checkout', at: iso(o(9, 30)), end: iso(o(10, 15)), title: 'Checkout sync', attendees: ['Priya', 'Dara'] });
48
+ put(o(14, 0), { id: 'ev-sprint', at: iso(o(14, 0)), end: iso(o(15, 0)), title: 'Sprint planning', attendees: ['Dara', 'Priya', 'Sam'], series: 'sprint-planning' });
49
+ const lvl = { phase: 'upcoming', level: { kind: 'board', ws: 'w1', id: 'idpf', name: 'IDPF', why: 'you linked it to the board', by: 'pm' } };
46
50
  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' } } },
51
+ context: { 'ev-sprint': lvl, 'ev-sprint-today': lvl },
48
52
  link_boards: [{ ws: 'w1', id: 'idpf', name: 'IDPF' }, { ws: 'w1', id: 'pay', name: 'Payments' }], gantt: [{ id: 'premium-ux', title: 'Premium UX' }] };
49
53
  };
50
54
  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: [{}],
@@ -82,36 +86,50 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
82
86
  S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0), 20000);
83
87
  return Object.assign(S, { ctx, page });
84
88
  };
85
- 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)))));
89
+ const strip = (p) => until(() => p.evaluate(() => document.querySelectorAll('#wkStrip [data-day]').length === 5));
90
+ const week = (p) => strip(p).then(() => p.click(`#wkStrip [data-day="${dayKey(OTHER())}"]`)).then(() => until(() => p.evaluate(() => !!document.querySelector('#tl .wkd') || /Calendar not read/.test(document.querySelector('#tl').textContent))));
86
91
 
87
92
  const A = await open();
88
93
  ok('0 the page draws the list and Today', A.up);
89
94
  if (!A.up) return finish(1);
90
95
  const p = A.page;
91
96
 
92
- /* C1 */
93
- 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') }));
94
- 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));
95
- ok('C1 both switch buttons are at least 44 px', sw.box.every((n) => n >= 44), JSON.stringify(sw.box));
96
- ok('C1 the week is not read until the PM presses it', A.weekGets.length === 0);
97
+ /* C1 the card: titled Calendar, a strip of five days, today picked and the Today timeline below */
98
+ await strip(p);
99
+ const sw = await p.evaluate(() => ({ title: document.querySelector('#hToday').textContent, days: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => b.dataset.day + ':' + b.getAttribute('aria-pressed')), box: [...document.querySelectorAll('#wkStrip [data-day]')].map((b) => { const r = b.getBoundingClientRect(); return Math.round(Math.min(r.width, r.height)); }), ahead: !!document.querySelector('#tl .grp'), sw: !!document.querySelector('#rng'), fold: document.querySelector('#todayCard .foldb').getAttribute('aria-expanded') }));
100
+ const isWeekday = NOW.getDay() >= 1 && NOW.getDay() <= 5;
101
+ ok('C1 the card is titled Calendar, has no Today / This week switch, and is open at 1280 px', sw.title === 'Calendar' && !sw.sw && sw.fold === 'true', JSON.stringify(sw));
102
+ ok('C1 the strip has Monday to Friday, today is pressed, and Today is unchanged', sw.days.length === 5 && sw.days.filter((x) => /:true$/.test(x)).length === (isWeekday ? 1 : 0) && (!isWeekday || sw.days.includes(dayKey(NOW) + ':true')) && sw.ahead, JSON.stringify(sw.days));
103
+ ok('C1 each day button is at least 44 px', sw.box.every((n) => n >= 44), JSON.stringify(sw.box));
104
+ ok('C1 the week is read once when the page opens, 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));
97
105
 
98
- /* C2 */
106
+ /* C2 another day */
99
107
  await week(p);
100
108
  const wk = await p.evaluate(() => ({
101
109
  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),
102
- 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,
103
- filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display, pressed: document.querySelector('#rng [data-r=week]').getAttribute('aria-pressed'), past: document.querySelectorAll('#tl .ev.wkpast').length,
104
- label: document.querySelector('#tl').getAttribute('aria-label') }));
105
- 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));
106
- 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));
110
+ cap: document.querySelector('#todayCap').textContent, filter: getComputedStyle(document.querySelector('#todayCard .fbtn')).display,
111
+ pressed: [...document.querySelectorAll('#wkStrip [aria-pressed="true"]')].map((b) => b.dataset.day), label: document.querySelector('#tl').getAttribute('aria-label') }));
112
+ ok('C2 pressing a day lists that day only, with its count', wk.days.length === 1 && /2 meetings/.test(wk.days[0]) && wk.pressed.join() === dayKey(OTHER()), JSON.stringify(wk));
107
113
  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));
108
- ok('C2 days with no meetings say so', wk.empty >= 3, String(wk.empty));
109
- 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));
110
- await p.click('#rng [data-r=today]');
111
- 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 }));
112
- ok('C2 Today comes back unchanged', back.ahead && !back.wk && back.filter !== 'none' && /earlier · \d+ ahead/.test(back.cap), JSON.stringify(back));
113
- await week(p);
114
- ok('C2 pressing This week again reads again', await until(() => A.weekGets.length === 2));
114
+ ok('C2 the caption counts the day\'s meetings and the source filter is hidden', /^2 meetings/.test(wk.cap) && wk.filter === 'none', JSON.stringify(wk));
115
+ if (isWeekday) {
116
+ await p.click(`#wkStrip [data-day="${dayKey(NOW)}"]`);
117
+ 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 }));
118
+ ok('C2 pressing today brings Today back unchanged', back.ahead && !back.wk && back.filter !== 'none' && /earlier · \d+ ahead/.test(back.cap), JSON.stringify(back));
119
+ await week(p);
120
+ }
121
+
122
+ /* C11 hide and show */
123
+ await p.click('#todayCard .foldb');
124
+ const hid = await p.evaluate(() => ({ fold: document.querySelector('#todayCard').classList.contains('calhid'), tl: getComputedStyle(document.querySelector('#tl')).display, strip: getComputedStyle(document.querySelector('#wkStrip')).display, line: document.querySelector('#todayCard .folds').textContent, shown: !document.querySelector('#todayCard .folds').hidden, exp: document.querySelector('#todayCard .foldb').getAttribute('aria-expanded') }));
125
+ ok('C11 the chevron hides the card to its header and one line', hid.fold && hid.tl === 'none' && hid.strip === 'none' && hid.shown && hid.exp === 'false' && /meetings? this week/.test(hid.line), JSON.stringify(hid));
126
+ const H2p = await A.ctx.newPage(); await H2p.goto(BASE + '/premium.html?theme=light');
127
+ ok('C11 a reload keeps it hidden', await until(() => H2p.evaluate(() => document.querySelector('#todayCard').classList.contains('calhid'))));
128
+ await H2p.click('#todayCard .folds');
129
+ ok('C11 pressing the line shows it again, and that is kept', await until(() => H2p.evaluate(() => !document.querySelector('#todayCard').classList.contains('calhid') && localStorage.getItem('pmos.premium.calfold.brief') === '0')));
130
+ await H2p.close();
131
+ await p.click('#todayCard .foldb');
132
+ await until(() => p.evaluate(() => !document.querySelector('#todayCard').classList.contains('calhid')));
115
133
 
116
134
  /* C4 C5 C6 C7 C8: the dialog from a week row */
117
135
  await p.focus('#tl .ev[data-w]');
@@ -140,17 +158,17 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
140
158
  await p.click('#mtgLink');
141
159
  await until(() => A.posts.length === 1);
142
160
  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));
143
- ok('C5 after the write the week is read again', await until(() => A.weekGets.length >= 3));
161
+ ok('C5 after the write the week is read again', await until(() => A.weekGets.length >= 2));
144
162
  await p.keyboard.press('Escape');
145
163
 
146
164
  /* C3 honest states */
147
165
  const E = await open({ week: { ok: false, error: 'the calendar could not read the repository: boom' } });
148
166
  await week(E.page);
149
- const er = await E.page.evaluate(() => ({ text: document.querySelector('#tl').textContent, rows: document.querySelectorAll('#tl .ev').length, cap: document.querySelector('#rcap').textContent }));
167
+ const er = await E.page.evaluate(() => ({ text: document.querySelector('#tl').textContent, rows: document.querySelectorAll('#tl .ev').length, cap: document.querySelector('#todayCap').textContent }));
150
168
  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));
151
169
  const Z = await open({ week: Object.assign(weekAnswer(), { cells: weekAnswer().cells.map((c) => Object.assign({}, c, { events: [] })), context: {} }) });
152
170
  await week(Z.page);
153
- 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));
171
+ ok('C3 an empty day says so', await Z.page.evaluate(() => /^No meetings/.test(document.querySelector('#todayCap').textContent) && /No meetings\./.test(document.querySelector('#tl').textContent) && document.querySelectorAll('#tl .ev').length === 0));
154
172
 
155
173
  /* C6 C8 with a note and a recording */
156
174
  const R = await open({ replay: REPLAY });
@@ -179,9 +197,12 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
179
197
  /* C10 floors and fidelity */
180
198
  for (const th of ['light', 'dark']) {
181
199
  const P = await open({ w: 390, h: 844, theme: th });
200
+ await strip(P.page);
201
+ ok(`C10 at 390 px (${th}) the card starts hidden`, await P.page.evaluate(() => document.querySelector('#todayCard').classList.contains('calhid') && !document.querySelector('#todayCard .folds').hidden));
202
+ await P.page.click('#todayCard .folds');
182
203
  await week(P.page);
183
- 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)) }));
184
- 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));
204
+ 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('#wkStrip [data-day], #todayCard .foldb')].map((b) => Math.min(b.getBoundingClientRect().width, b.getBoundingClientRect().height)) }));
205
+ ok(`C10 at 390 px (${th}) there is no sideways scroll and rows, day buttons and the chevron are at least 44 px`, f.scroll && f.rows.every((h) => h >= 44) && f.sw.every((n) => n >= 44), JSON.stringify(f));
185
206
  await P.ctx.close();
186
207
  }
187
208
  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);
@@ -133,6 +133,7 @@ const sh = (cwd, args) => spawnSync('git', args, { cwd, encoding: 'utf8' });
133
133
  await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 1 && document.querySelectorAll('#tl .ev').length > 0));
134
134
  await m.evaluate((t) => { document.documentElement.dataset.theme = t; }, th);
135
135
  const R = await open({ w, h, theme: th });
136
+ if (w === 390) { await R.page.click('#todayCard .folds').catch(() => {}); await R.page.evaluate(() => scrollTo(0, 0)); } // the Calendar card starts hidden on a phone (premium-calendar-card); measure it open
136
137
  await R.page.evaluate(() => { window.__ev = (s) => { const d = document.querySelector('#tl .ev.src-digest'); return !d ? null : / time$/.test(s) ? d.querySelector('time') : / b$/.test(s) ? d.querySelector('b') : d; }; });
137
138
  await sleep(500);
138
139
  const a = await grab(m, PAIRS), c = await grab(R.page, PAIRS), diffs = [];
@@ -526,6 +526,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
526
526
  await until(() => m.evaluate(() => document.querySelectorAll('#rank .rr').length > 0 && document.querySelectorAll('#tl .ev').length > 0));
527
527
  await m.evaluate((t) => { document.documentElement.dataset.theme = t; }, th);
528
528
  const R = await open({ w, h, theme: th });
529
+ if (w === 390) { await R.page.click('#todayCard .folds').catch(() => {}); await R.page.evaluate(() => scrollTo(0, 0)); } // the Calendar card starts hidden on a phone (premium-calendar-card); measure it open
529
530
  await sleep(500);
530
531
  const a = await grab(m, PAIRS), c = await grab(R.page, PAIRS), diffs = [];
531
532
  for (const [n] of PAIRS) {
@@ -68,6 +68,15 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
68
68
  ok('M1 the rail names four places, My work is current and the indicator sits on it', rail.names.join() === 'Briefing,My work,Board,Insights' && rail.cur === 'My work' && rail.go.join() === 'brief,work,init,rep' && rail.pi === '1', JSON.stringify(rail));
69
69
  { const tc = await p.evaluate(() => { const a = document.querySelector('#toConsole'); if (!a) return null; const r = a.getBoundingClientRect(); return { href: a.getAttribute('href'), label: a.getAttribute('aria-label'), w: Math.round(r.width), h: Math.round(r.height), tab: a.tabIndex }; }); ok('M1 the header links to the console (premium-console-link)', tc && tc.href === '/console.html' && tc.label === 'Open the console' && tc.w >= 44 && tc.h >= 44 && tc.tab === 0, JSON.stringify(tc)); }
70
70
  const res = await fetch(BASE + '/premium-work').then((r) => r.status);
71
+ { /* the Calendar card shared with the Briefing (initiative premium-calendar-card) */
72
+ const cal = await until(() => p.evaluate(() => { const b = [...document.querySelectorAll('#weekBody [data-day]')]; return b.length === 5 && !/Reading/.test(document.querySelector('#wkList').textContent) ? { title: document.querySelector('#hWeek').textContent, pressed: b.filter((x) => x.getAttribute('aria-pressed') === 'true').length, list: !!document.querySelector('#wkList .wkd'), fold: document.querySelector('#weekCard .foldb').getAttribute('aria-expanded') } : null; }));
73
+ ok('M13 My work shows the same Calendar card: five day buttons, a day list and a chevron, open at 1280 px', cal && cal.title === 'Calendar' && cal.pressed <= 1 && cal.list && cal.fold === 'true', JSON.stringify(cal));
74
+ const other = await p.evaluate(() => { const b = document.querySelector('#weekBody [data-day][aria-pressed="false"]'); b.click(); return b.dataset.day; });
75
+ ok('M13 pressing a day lists that day', await until(() => p.evaluate((d) => document.querySelector('#weekBody [data-day="' + d + '"]').getAttribute('aria-pressed') === 'true' && !!document.querySelector('#wkList .wkd'), other)));
76
+ await p.click('#weekCard .foldb');
77
+ ok('M13 the chevron hides the card to one line', await p.evaluate(() => document.querySelector('#weekCard').classList.contains('calhid') && getComputedStyle(document.querySelector('#wkList')).display === 'none' && !document.querySelector('#weekCard .folds').hidden));
78
+ await p.click('#weekCard .folds');
79
+ }
71
80
  ok('M1 the page is served at /premium-work and /premium-work.html', res === 200 && (await fetch(BASE + '/premium-work.html')).status === 200);
72
81
  {
73
82
  const r2 = await open(); await r2.page.locator('.rail [data-go="brief"]').click();
@@ -96,17 +96,21 @@ The header counts "N of M done". A row counts as done when the record behind it
96
96
 
97
97
  The pin on a row keeps it at the top for this session.
98
98
 
99
- ## Today
99
+ ## Calendar
100
100
 
101
- 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.
101
+ The Calendar card holds the week and the day. Its top row is a strip of Monday to Friday: each day shows its meeting time from the calendar PMOS holds, and blocks for items done and due that day from your list. Today is picked when the page opens. Press another day to list its meetings; press today to come back. The same card is on My work.
102
102
 
103
- Above the list, on the **Today** view, a ring shows how many of the meetings still ahead are prepped. A meeting is prepped when no open item is linked to it as "Before you go". The line names the meeting that is on now or next. The ring reads the same day as the console's. With no meeting left, or on **This week**, it is not shown.
103
+ The chevron in the card header hides the card down to one line: the next meeting today (or "Nothing more today"), the week's meeting count and the items due. Press the line or the chevron to show the card again. The page remembers this in this browser. With nothing remembered, the card starts open on a computer and hidden on a phone.
104
104
 
105
- ### This week
105
+ With today picked, the card 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.
106
106
 
107
- 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.
107
+ Above the list, with today picked, a ring shows how many of the meetings still ahead are prepped. A meeting is prepped when no open item is linked to it as "Before you go". The line names the meeting that is on now or next. The ring reads the same day as the console's. With no meeting left, or with another day picked, it is not shown.
108
108
 
109
- 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.
109
+ ### Another day
110
+
111
+ With another day picked, the card lists that day's meetings from the calendar PMOS holds, and the items due that day. It reads the week once when the page opens. 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. Picking a day changes only what the card shows and records nothing.
112
+
113
+ Press a meeting, from today or from another day, 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.
110
114
 
111
115
  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. The **Material** part has **Add material** and a **Remove** on each row. Add material opens a sheet in the dialog with three ways to pick: **Suggested** (the documents of the meeting's initiative and the newest report cycles), **Find in PMOS** (type two letters or more) and **Paste a link** (an https address). A **For** choice says whether the material belongs to this meeting or to every meeting in the series. Before you press Add, the sheet says what it records: one line in PMOS's own record of the meeting. The calendar invite is never changed. After a write, the list is read again from the record. Remove names its scope and says the document itself is not changed. A few seconds of **Undo** put a removed item back.
112
116
 
@@ -194,7 +198,7 @@ The Start button on a blocked row stays off. Starting an agent that writes needs
194
198
 
195
199
  My work is the second place on the rail, at `/premium-work.html`. It reads the list the Work page reads, so the two pages show one list, and every press uses the Work page's own route. It adds no writer of its own.
196
200
 
197
- **This week.** A card at the top of the right column shows Monday to Friday. Each day has a grey bar for its meeting time, from your calendar, with black blocks for items done that day and orange hatched blocks for items due, from your list (at most three of each; they count items, not hours). A legend names the three. If PMOS cannot read the calendar, the card says so and draws no meeting bar. The mockup's hours done, hours free, warning line and Move to Friday need an estimate per item and working hours, which PMOS does not hold, so they are not drawn. It makes no "will not fit" note, because no item has a size and PMOS holds no working hours.
201
+ **Calendar.** The same Calendar card as on the Briefing sits at the top of the right column. Its strip shows Monday to Friday. Each day has a grey bar for its meeting time, from your calendar, with black blocks for items done that day and orange hatched blocks for items due, from your list (at most three of each; they count items, not hours). A legend names the three. If PMOS cannot read the calendar, the card says so and draws no meeting bar. The mockup's hours done, hours free, warning line and Move to Friday need an estimate per item and working hours, which PMOS does not hold, so they are not drawn. It makes no "will not fit" note, because no item has a size and PMOS holds no working hours. Press a day to list its meetings below the strip; here the rows are for reading only. The chevron hides the card, as on the Briefing.
198
202
 
199
203
  **Row suggestions and buttons.** A row shows a suggestion line only when a record backs it: an agent's offer on the item, a draft that is ready, or a date. A row has no button of its own. Press the row to open the item, where you review a draft, start the agent, or give the item a day. To act without opening it, swipe the row or press the right or left arrow key. A row in Today goes to Done (or opens its draft when one is ready) on the right and to Tomorrow on the left. Any other row goes to Today on the right and to Someday on the left. A row from Jira shows its Jira key.
200
204
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.311.0",
3
+ "version": "0.312.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.311.0",
9
+ "version": "0.312.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.311.0",
3
+ "version": "0.312.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",
@@ -322,9 +322,10 @@ const GANTT = [
322
322
  await until(() => p.evaluate(() => { const c = document.querySelector('#prep'); return c && !c.hidden && /prepped/.test(c.textContent); }), 30000);
323
323
  const prep = await p.evaluate(() => { const c = document.querySelector('#prep'); return { t: c.textContent, ring: !!c.querySelector('circle.rg'), l: c.querySelector('svg').getAttribute('aria-label') }; });
324
324
  ok('PR1 the ring counts the meetings left and those with nothing to do before them', /Meeting b at \d\d:\d\d is next/.test(prep.t) && /3 meetings left today\. 2 of 3 prepped\./.test(prep.t) && prep.ring && prep.l === '2 of 3 prepped', JSON.stringify(prep));
325
- await p.click('#rng [data-r="week"]');
325
+ await until(() => p.evaluate(() => document.querySelectorAll('#wkStrip [data-day]').length === 5));
326
+ await p.click('#wkStrip [data-day][aria-pressed="false"]');
326
327
  await until(() => p.evaluate(() => document.querySelector('#prep').hidden));
327
- ok('PR2 the ring is not shown on This week', await p.evaluate(() => document.querySelector('#prep').hidden));
328
+ ok('PR2 the ring is not shown on another day', await p.evaluate(() => document.querySelector('#prep').hidden));
328
329
  await p.unroute('**/api/brief-page*');
329
330
 
330
331
  /* L: floors */
@@ -42,6 +42,67 @@ export function weekView(r, today) {
42
42
  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) })) };
43
43
  }
44
44
 
45
+ /* ── the Calendar card shared by the Briefing and My work (initiative premium-calendar-card): the day strip, its summary line and the chevron ── */
46
+ const weekKeys = (today) => {
47
+ const [y, m, d] = today.split('-').map(Number), wd = (new Date(Date.UTC(y, m - 1, d)).getUTCDay() + 6) % 7;
48
+ return [0, 1, 2, 3, 4].map((i) => new Date(Date.UTC(y, m - 1, d - wd + i)).toISOString().slice(0, 10));
49
+ };
50
+ /** Monday to Friday, in the shape lib/my-work-premium.js weekOf draws: meeting minutes from the week answer `W` (weekView), done and due counts from the PM's
51
+ * list `items` (GET /api/pm-items). With no calendar the days still carry the list's counts and `calendar` is false. */
52
+ export function stripOf(W, items, today) {
53
+ const ok = !!(W && W.state === 'ok'), its = Array.isArray(items) ? items : [];
54
+ const days = weekKeys(today).map((k) => {
55
+ const rows = ok ? ((W.days.find((x) => x.key === k) || {}).rows || []) : [], wd = (new Date(k + 'T00:00:00Z').getUTCDay() + 6) % 7;
56
+ return { iso: k, dow: DOW[wd].toUpperCase(), n: Number(k.slice(8)), meetings: rows.length,
57
+ meet_min: rows.reduce((a, r) => { const v = minutesBetween(r.at, r.end); return a + (v > 0 && v < 1440 ? v : 0); }, 0),
58
+ done: its.filter((it) => it && it.done && String(it.done_at || '').slice(0, 10) === k).length,
59
+ due: its.filter((it) => it && !it.done && it.due === k).length, today: k === today, past: k < today };
60
+ });
61
+ return { days, calendar: ok };
62
+ }
63
+ /** The strip: one button per day, the picked one pressed. Its look is the My work This week card's (meeting bar, done and due blocks). */
64
+ export function stripHtml(S, picked, esc) {
65
+ const top = Math.max(60, ...S.days.map((d) => d.meet_min));
66
+ const blk = (n, c) => Array.from({ length: Math.min(n, 3) }, () => `<i class="${c}"></i>`).join('');
67
+ return `<div class="wks" role="group" aria-label="This week. Pick a day to see its meetings.">${S.days.map((d) => {
68
+ const h = d.meet_min ? Math.max(8, Math.round(d.meet_min / top * 40)) : 0, hrs = d.meet_min ? (Math.round(d.meet_min / 6) / 10) + ' h' : '';
69
+ const say = d.dow + ' ' + d.n + (d.today ? ', today' : '') + ': ' + (S.calendar ? (d.meet_min ? hrs + ' of meetings, ' : 'no meetings, ') : '') + d.done + ' done, ' + d.due + ' due';
70
+ return `<button type="button" class="wkc${d.today ? ' now' : ''}${d.past ? ' past' : ''}" data-day="${d.iso}" aria-pressed="${d.iso === picked}" aria-label="${esc(say)}"><span class="wkl">${d.dow}</span><b>${d.n}</b><span class="wkb">${h ? `<i class="wkm" style="height:${h}%"></i>` : ''}${blk(d.done, 'wkx')}${blk(d.due, 'wkp')}</span><span class="wkt">${S.calendar ? (hrs || '·') : '·'}</span><span class="wkn">${d.today ? 'today' : d.due ? d.due + ' due' : ''}</span></button>`;
71
+ }).join('')}</div><p class="wkg" aria-hidden="true"><span><i class="wkm"></i>Meetings</span><span><i class="wkx"></i>Done</span><span><i class="wkp"></i>Due</span></p>`;
72
+ }
73
+ /** The one line the card shows while hidden: the next meeting today, then the week's meetings and due items. Only what the answers hold. */
74
+ export function foldLine(S, W, now = Date.now()) {
75
+ const t = S.days.find((d) => d.today), rows = W && W.state === 'ok' && t ? ((W.days.find((x) => x.key === t.iso) || {}).rows || []) : [];
76
+ const next = rows.find((r) => hasTime(r.at) && Date.parse(r.at) > now);
77
+ const meet = S.days.reduce((a, d) => a + d.meetings, 0), due = S.days.reduce((a, d) => a + d.due, 0);
78
+ return [!S.calendar ? 'Calendar not read' : next ? 'Next ' + next.time + ' ' + next.title : t ? 'Nothing more today' : '',
79
+ S.calendar ? meet + ' ' + (meet === 1 ? 'meeting' : 'meetings') + ' this week' : '', due ? due + ' due' : ''].filter(Boolean).join(' · ');
80
+ }
81
+ /** The chevron that hides `card` down to its header and one summary line. Kept in this browser per page (`key`); with nothing kept, hidden at 640 px and narrower. */
82
+ export function mountFold(card, key) {
83
+ const k = 'pmos.premium.calfold.' + key;
84
+ let kept = null; try { kept = localStorage.getItem(k); } catch { /* no storage */ }
85
+ const btn = document.createElement('button'), sum = document.createElement('button');
86
+ btn.type = sum.type = 'button'; btn.className = 'foldb'; sum.className = 'folds';
87
+ card.querySelector('.ch').append(btn); card.querySelector('.ch').after(sum);
88
+ const set = (hid, save) => {
89
+ card.classList.toggle('calhid', hid); sum.hidden = !hid;
90
+ btn.setAttribute('aria-expanded', String(!hid)); btn.setAttribute('aria-label', hid ? 'Show calendar' : 'Hide calendar');
91
+ btn.innerHTML = `<svg class="i" viewBox="0 0 24 24"><path d="${hid ? 'm6 9 6 6 6-6' : 'm6 15 6-6 6 6'}"/></svg>`;
92
+ if (save) { try { localStorage.setItem(k, hid ? '1' : '0'); } catch { /* no storage */ } }
93
+ };
94
+ set(kept === null ? matchMedia('(max-width:640px)').matches : kept === '1', false);
95
+ btn.addEventListener('click', () => set(!card.classList.contains('calhid'), true));
96
+ sum.addEventListener('click', () => { set(false, true); btn.focus(); });
97
+ return {
98
+ line(S, text, esc) {
99
+ const top = Math.max(60, ...S.days.map((d) => d.meet_min));
100
+ sum.setAttribute('aria-label', 'Show calendar. ' + text);
101
+ sum.innerHTML = `<span>${esc(text)}</span><span class="wkmini" aria-hidden="true">${S.days.map((d) => `<i${d.today ? ' class="now"' : ''} style="height:${S.calendar && d.meet_min ? Math.max(15, Math.round(d.meet_min / top * 100)) : 10}%"></i>`).join('')}</span>`;
102
+ },
103
+ };
104
+ }
105
+
45
106
  /** 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. */
46
107
  export function meetingView(row, replay, material, extra) {
47
108
  const rep = replay && replay.state === 'ok' ? replay.body : null;
@@ -260,13 +321,15 @@ export function replayAt(m, pos) {
260
321
 
261
322
  /* ── the page half ─────────────────────────────────────────────────────────────────────────────────────── */
262
323
 
263
- /** deps: { $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, wsq(), ws() }. Returns { mode, draw, openToday }. */
324
+ /** deps: { $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, wsq(), ws() }. Returns { mode, draw, openToday }. The card's day strip and chevron are drawn here (initiative premium-calendar-card). */
264
325
  export function mountMeeting(d) {
265
326
  const { $, $$, esc } = d;
266
- let mode = 'today', W = null, seq = 0, busy = false;
327
+ let picked = null, W = null, listItems = null, seq = 0, busy = false;
267
328
  const today = () => { const t = new Date(); return `${t.getFullYear()}-${pad(t.getMonth() + 1)}-${pad(t.getDate())}`; };
329
+ const other = () => !!picked && picked !== today();
268
330
  const wsq = (first) => { const w = d.ws(); return w ? (first ? '?' : '&') + 'ws=' + encodeURIComponent(w) : ''; };
269
331
  const ICON = '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>';
332
+ const fold = mountFold($('#todayCard'), 'brief');
270
333
 
271
334
  async function readWeek() {
272
335
  const n = ++seq; busy = true;
@@ -274,29 +337,36 @@ export function mountMeeting(d) {
274
337
  if (n !== seq) return;
275
338
  busy = false; W = weekView(res, today());
276
339
  }
340
+ async function readItems() { const r = await d.pmGet('/api/pm-items' + wsq(true)); listItems = r && r.ok === true && Array.isArray(r.items) ? r.items : []; }
277
341
  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>`;
342
+ /** The day strip and the hidden line. Drawn once the week and the list are read. */
343
+ function drawStrip() {
344
+ if (!W || !listItems) return;
345
+ const S = stripOf(W, listItems, today());
346
+ $('#wkStrip').innerHTML = stripHtml(S, picked || today(), esc);
347
+ fold.line(S, foldLine(S, W), esc);
348
+ }
349
+ /** Today picked: false, and the page draws its Today timeline. Another day picked: that day's meetings and due items, and true. */
278
350
  function draw() {
279
351
  const card = $('#todayCard');
280
- $$('#rng button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.r === mode));
281
- card.classList.toggle('wkm', mode === 'week'); $('#rcap').hidden = mode !== 'week';
282
- if (mode !== 'week') return false;
283
- $('#tl').setAttribute('aria-label', 'This week. Use the up and down arrow keys to move between rows.');
284
- if (!W) { $('#todayCap').textContent = $('#rcap').textContent = 'Reading the calendar'; $('#tl').innerHTML = '<div class="empty">Reading the calendar PMOS holds.</div>'; return true; }
285
- $('#todayCap').textContent = $('#rcap').textContent = W.caption;
286
- if (W.state === 'error') { $('#tl').innerHTML = `<div class="empty" role="status">Calendar not read. ${esc(W.reason)}</div>`; return true; }
287
- $('#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('');
352
+ drawStrip();
353
+ card.classList.toggle('wkm', other());
354
+ if (!other()) { $('#tl').setAttribute('aria-label', 'Today. Use the up and down arrow keys to move between rows.'); return false; }
355
+ const x = W && W.state === 'ok' ? W.days.find((y) => y.key === picked) : null;
356
+ $('#tl').setAttribute('aria-label', (x ? x.label : 'That day') + '. Use the up and down arrow keys to move between rows.');
357
+ if (!W) { $('#todayCap').textContent = 'Reading the calendar'; $('#tl').innerHTML = '<div class="empty">Reading the calendar PMOS holds.</div>'; return true; }
358
+ if (W.state === 'error') { $('#todayCap').textContent = W.caption; $('#tl').innerHTML = `<div class="empty" role="status">Calendar not read. ${esc(W.reason)}</div>`; return true; }
359
+ const due = (listItems || []).filter((it) => it && !it.done && it.due === picked);
360
+ $('#todayCap').textContent = x ? (x.rows.length ? x.rows.length + (x.rows.length === 1 ? ' meeting' : ' meetings') : 'No meetings') + (due.length ? ' · ' + due.length + ' due' : '') : '';
361
+ $('#tl').innerHTML = x ? `<div class="wkd">${esc(x.label)}<em>${x.rows.length ? x.rows.length + (x.rows.length === 1 ? ' meeting' : ' meetings') : ''}</em></div>`
362
+ + due.map((it) => `<div class="wkdue"><span>Due</span><b>${esc(clip(it.title, 140))}</b></div>`).join('')
363
+ + (x.rows.length ? x.rows.map((r, i) => rowHtml(r, x.key + '|' + i)).join('') : '<div class="empty">No meetings.</div>') : '<div class="empty">That day is not in this week.</div>';
288
364
  $$('#tl .ev').forEach((e, i) => { e.tabIndex = i ? -1 : 0; });
289
365
  mark();
290
366
  return true;
291
367
  }
292
368
  const rowOf = (k) => { const [day, i] = k.split('|'); const x = W && W.days.find((y) => y.key === day); return x ? x.rows[+i] : null; };
293
369
 
294
- async function setMode(m, redraw) {
295
- mode = m;
296
- if (m === 'week') { $('#tl').setAttribute('aria-busy', 'true'); draw(); await readWeek(); $('#tl').removeAttribute('aria-busy'); }
297
- redraw();
298
- }
299
-
300
370
  /* ── recording: the notes the server holds, the recorder this page holds, and the presses on both ───────────────────────── */
301
371
  let NR = [], HOLD = null, R = null, evOf = null, cur = null;
302
372
  const bump = () => { try { window.dispatchEvent(new CustomEvent('premium-rec')); } catch { /* no window */ } };
@@ -696,7 +766,7 @@ export function mountMeeting(d) {
696
766
  if (!res || res.ok !== true) { t.disabled = false; $('#mtgMsg').textContent = (res && res.error) || 'The link could not be saved.'; return; }
697
767
  saved = body.kind === 'none' ? '' : $('#mtgSel').selectedOptions[0].textContent;
698
768
  d.toast(body.kind === 'none' ? 'The link is removed for every occurrence of this meeting.' : 'Linked. It applies to every occurrence of this meeting.');
699
- await readWeek(); paint(); if (mode === 'week') draw();
769
+ await readWeek(); paint(); if (other()) draw();
700
770
  };
701
771
  }
702
772
 
@@ -709,9 +779,10 @@ export function mountMeeting(d) {
709
779
  return true;
710
780
  }
711
781
 
712
- $('#rng').addEventListener('click', (e) => { const b = e.target.closest('button'); if (b && b.dataset.r !== mode && d.redraw) setMode(b.dataset.r, d.redraw); });
782
+ $('#wkStrip').addEventListener('click', (e) => { const b = e.target.closest('[data-day]'); if (!b || b.dataset.day === (picked || today())) return; picked = b.dataset.day; if (d.redraw) d.redraw(); });
783
+ Promise.all([readWeek(), readItems()]).then(() => { if (d.redraw) d.redraw(); else drawStrip(); });
713
784
  $('#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);
714
785
  readNotes().then(() => mark());
715
786
  { const want = new URLSearchParams(location.search).get('meeting'); if (want) { history.replaceState(null, '', location.pathname + location.search.replace(/[?&]meeting=[^&]*/, '').replace(/^&/, '?')); setTimeout(() => openNote(want), 600); } }
716
- return { mode: () => mode, draw, openToday, busy: () => busy, mark, openNote };
787
+ return { mode: () => (other() ? 'day' : 'today'), draw, openToday, busy: () => busy, mark, openNote };
717
788
  }
@@ -3,7 +3,8 @@
3
3
  * Every press goes to the Work page's own route under /api/pm-items, /api/pm-jobs or /api/my-work; this file adds no writer. A control with nothing honest to write stays off and says why.
4
4
  * My work depth (initiative premium-work-depth): the dialog's tool row (Edit, Who does each step, Not before, Someday), the Focus bar and its jobs, the agent on an item
5
5
  * (draft, stop, edit, post after a confirm, send back, try again), and keys and swipe on the rows. */
6
- import { pmPost } from './http.js';
6
+ import { pmPost, pmGet } from './http.js';
7
+ import { weekView, stripHtml, foldLine, mountFold } from './premium-meeting.js';
7
8
  import { mdRender } from './markdown.js';
8
9
  import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, turnU, ptx, CHECK, RM, S } from './premium-shell.js';
9
10
 
@@ -118,17 +119,30 @@ $('#frBody').addEventListener('click', (e) => {
118
119
  const st = M.friday.steps.find((x) => x.key === b.dataset.fr); const r = st && st.first ? rowOf(st.first) : null;
119
120
  if (r) openRow(r); else toast('Nothing to open here.');
120
121
  });
122
+ /* the Calendar card (initiative premium-calendar-card): the strip from this page's model, the picked day's meetings from GET /api/calendar-views (read-only here), a chevron */
123
+ let wkPick = null, WK = null, wkFold = null;
124
+ const wkToday = () => (M && M.today) || new Date().toISOString().slice(0, 10);
125
+ async function readWk() {
126
+ const w = new URLSearchParams(location.search).get('ws');
127
+ WK = weekView(await pmGet('/api/calendar-views?view=week&date=' + wkToday() + (w ? '&ws=' + encodeURIComponent(w) : '')), wkToday());
128
+ drawWeek();
129
+ }
121
130
  function drawWeek() {
122
131
  const W = M.week; if (!W) return;
132
+ if (!wkFold) wkFold = mountFold($('#weekCard'), 'work');
133
+ const pick = wkPick || wkToday(), S = { days: W.days.map((d) => ({ ...d, meetings: d.meetings || 0 })), calendar: W.calendar };
123
134
  $('#weekCap').textContent = W.cap;
124
- const top = Math.max(60, ...W.days.map((d) => d.meet_min));
125
- const blk = (n, c) => Array.from({ length: Math.min(n, 3) }, () => `<i class="${c}"></i>`).join('');
126
- $('#weekBody').innerHTML = `<div class="wkd" role="list">${W.days.map((d) => {
127
- const h = d.meet_min ? Math.max(8, Math.round(d.meet_min / top * 40)) : 0;
128
- const hrs = d.meet_min ? (Math.round(d.meet_min / 6) / 10) + ' h' : '';
129
- return `<div class="wkc${d.today ? ' now' : ''}${d.past ? ' past' : ''}" role="listitem" aria-label="${esc(d.dow + ' ' + d.n + ': ' + (W.calendar ? (d.meet_min ? hrs + ' of meetings, ' : 'no meetings, ') : '') + d.done + ' done, ' + d.due + ' due')}"><span class="wkl">${d.dow}</span><b>${d.n}</b><span class="wkb">${h ? `<i class="wkm" style="height:${h}%"></i>` : ''}${blk(d.done, 'wkx')}${blk(d.due, 'wkp')}</span><span class="wkt">${W.calendar ? (hrs || '·') : '·'}</span><span class="wkn">${d.done} done${d.due ? ' · ' + d.due + ' due' : ''}</span></div>`;
130
- }).join('')}</div><p class="wkg" aria-hidden="true"><span><i class="wkm"></i>Meetings</span><span><i class="wkx"></i>Done</span><span><i class="wkp"></i>Due</span></p><p class="note" style="margin-top:8px">${esc(W.note)}</p>`;
131
- }
135
+ $('#weekBody').innerHTML = stripHtml(S, pick, esc);
136
+ $('#weekNote').textContent = W.note;
137
+ wkFold.line(S, foldLine(S, WK), esc);
138
+ const x = WK && WK.state === 'ok' ? WK.days.find((y) => y.key === pick) : null;
139
+ const due = (M.rows || []).filter((r) => r.edit && r.edit.due === pick && r.list !== 'done');
140
+ $('#wkList').innerHTML = !WK ? '<div class="empty">Reading the calendar PMOS holds.</div>' : WK.state === 'error' ? `<div class="empty" role="status">Calendar not read. ${esc(WK.reason)}</div>`
141
+ : `<div class="wkd${x && x.today ? ' now' : ''}">${esc(x ? x.label : pick)}${x && x.today ? ' · today' : ''}<em>${x && x.rows.length ? x.rows.length + (x.rows.length === 1 ? ' meeting' : ' meetings') : ''}</em></div>`
142
+ + due.map((r) => `<div class="wkdue" role="listitem"><span>Due</span><b>${esc(r.title)}</b></div>`).join('')
143
+ + (x && x.rows.length ? x.rows.map((r) => `<div class="ev src-meeting${r.past || (x.today && Date.parse(r.end || r.at) < Date.now()) ? ' wkpast' : ''}" role="listitem"><time>${esc(r.time)}</time><span class="gl-t"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></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></div>`).join('') : '<div class="empty">No meetings.</div>');
144
+ }
145
+ $('#weekBody').addEventListener('click', (e) => { const b = e.target.closest('[data-day]'); if (!b || !M) return; wkPick = b.dataset.day; drawWeek(); });
132
146
  function draw() { drawHero(); drawWeek(); drawFriday(); drawFocus(); drawPlate(); drawTray(); drawAgents(); drawWaiting(); drawReview(); drawDock(); onScroll(); backFocus(); }
133
147
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
134
148
 
@@ -632,6 +646,7 @@ async function load() {
632
646
  return;
633
647
  }
634
648
  M = r.model; draw();
649
+ if (!WK) readWk();
635
650
  const mine = dlgOpen() && ((dlgKind === 'item' && openR && S.key === openR.key) || (dlgKind === 'fjobs' && S.key === 'focus:today'));
636
651
  if (mine && dlgKind === 'item') refreshOpen(); else if (mine) drawFocusDlg();
637
652
  }
@@ -1811,13 +1811,13 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1811
1811
  .dabt{margin:0;padding-left:18px;display:grid;gap:6px;color:var(--ink-2)}
1812
1812
 
1813
1813
  /* My work: the This week card. A row has no button of its own: the whole row opens the item, where every choice is made. */
1814
- .wkd{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
1814
+ .wks{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
1815
1815
  .wkc{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 4px 8px;border-radius:18px;border:1.5px solid transparent;font-size:12px;color:var(--ink-3)}
1816
1816
  .wkc.now{border-color:var(--ink)}.wkc.past{opacity:.75}
1817
1817
  .wkl{font:500 11px var(--mono);letter-spacing:.06em}.wkc b{font-size:20px;color:var(--ink);font-weight:650}
1818
1818
  .wkb{display:flex;align-items:flex-end;width:26px;height:84px;border-radius:10px;background:var(--well);overflow:hidden}.wkb i{display:block;width:100%;background:var(--ink-3);border-radius:10px 10px 0 0}
1819
1819
  .wkt{font-weight:650;color:var(--ink-2)}.wkn{font-size:11.5px;text-align:center}
1820
- @media (max-width:520px){.wkd{gap:4px}.wkn{font-size:11px}}
1820
+ @media (max-width:520px){.wks{gap:4px}.wkn{font-size:11px}}
1821
1821
 
1822
1822
  .agdraft .mdr{font-size:14px;line-height:1.55;overflow-x:auto}.agdraft .mdr table{border-collapse:collapse;margin:8px 0}.agdraft .mdr th,.agdraft .mdr td{border:1px solid var(--hair);padding:5px 9px;text-align:left}
1823
1823
  .agturns{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:8px;font-size:13px;color:var(--ink-3)}.agturns li b{color:var(--ink)}.agturns span{display:block;color:var(--ink-2)}
@@ -1978,7 +1978,7 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1978
1978
  .mhint .lk:hover{color:var(--ember-ink)}
1979
1979
 
1980
1980
  .rdbtns{display:inline-flex;gap:6px;align-items:center}
1981
- .wkd .wkc{font:400 12px var(--sans);letter-spacing:0;text-transform:none;padding:12px 4px 10px}
1981
+ .wks .wkc{font:400 12px var(--sans);letter-spacing:0;text-transform:none;padding:12px 4px 10px}
1982
1982
  .wkc .wkl{font:500 11px var(--mono);letter-spacing:.08em}
1983
1983
  .wkc .wkb{flex-direction:column-reverse;gap:3px;width:36px;height:100px;border-radius:12px;padding:0}.wkb i{flex:none;border-radius:4px}
1984
1984
  .wkb .wkm,.wkg .wkm{background:color-mix(in oklab,var(--ink) 22%,var(--well))}
@@ -1986,3 +1986,20 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1986
1986
  .wkb .wkp,.wkg .wkp{background:repeating-linear-gradient(135deg,var(--ember) 0 3px,color-mix(in oklab,var(--ember) 35%,var(--well)) 3px 6px)}
1987
1987
  .wkc .wkt{font-weight:600;color:var(--ink-2)}
1988
1988
  .wkg{display:flex;gap:14px;margin:12px 0 0;font-size:12px;color:var(--ink-3)}.wkg span{display:inline-flex;align-items:center;gap:6px}.wkg i{width:10px;height:10px;border-radius:50%;display:inline-block}
1989
+ /* the Calendar card shared by the Briefing and My work (initiative premium-calendar-card): a day strip to pick from, the picked day below, a chevron that hides it */
1990
+ .wks{margin-top:14px}
1991
+ .wks .wkc{width:100%;min-height:44px;cursor:pointer;transition:border-color .25s,background .25s}
1992
+ .wks .wkc.now{border-color:transparent}.wks .wkc.now .wkl,.wks .wkc.now .wkn{color:var(--ember-ink);font-weight:600}
1993
+ .wks .wkc[aria-pressed="true"]{border-color:var(--ink);background:var(--card)}
1994
+ .wks .wkc:hover{background:var(--well)}.wks .wkc[aria-pressed="true"]:hover{background:var(--card)}
1995
+ .wks .wkc .wkn{min-height:14px}
1996
+ .foldb{flex:none;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--well);color:var(--ink)}
1997
+ .folds{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;margin-top:8px;padding:0 2px;font-size:var(--t-small);color:var(--ink-3);text-align:left}
1998
+ .folds[hidden]{display:none}.folds>span:first-child{flex:1;min-width:0}
1999
+ .wkmini{display:flex;align-items:flex-end;gap:3px;height:22px;flex:none}.wkmini i{width:5px;border-radius:3px;background:color-mix(in oklab,var(--ink) 30%,var(--well))}.wkmini i.now{background:var(--ink)}
2000
+ .card.calhid>:not(.ch):not(.folds){display:none}
2001
+ .card.calhid .ch{position:static}
2002
+ .wkdue{display:grid;grid-template-columns:48px minmax(0,1fr);gap:12px;align-items:center;padding:10px 12px;margin:2px 0 6px;border-radius:14px;background:color-mix(in oklab,var(--ember) 12%,var(--card))}
2003
+ .wkdue span{font:600 12px var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ember-ink)}.wkdue b{font-weight:550}
2004
+ .tl.wkday{min-height:0}.tl.wkday .ev{cursor:default}
2005
+ #todayCard.wkm .foldb{margin-left:auto}
@@ -22,7 +22,7 @@ const on = new Set(Object.keys(SRC));
22
22
  const pinned = new Set();
23
23
 
24
24
  wireRail('brief');
25
- const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => drawTl() });
25
+ const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => { if (M) drawTl(); } });
26
26
 
27
27
  /* ── a day's baseline, kept on this device, so "N of M done" counts rows that cleared since the page first read today ────── */
28
28
  const dayKey = () => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
@@ -59,8 +59,10 @@
59
59
  </div>
60
60
  <div>
61
61
  <section class="card rise" style="--d:6" id="weekCard" aria-labelledby="hWeek">
62
- <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></svg></span><h2 id="hWeek">This week</h2><small id="weekCap"></small></div>
62
+ <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></svg></span><h2 id="hWeek">Calendar</h2><small id="weekCap"></small></div>
63
63
  <div id="weekBody"></div>
64
+ <div class="tl wkday" id="wkList" role="list" aria-label="Meetings of the picked day"></div>
65
+ <p class="note" id="weekNote" style="margin-top:8px"></p>
64
66
  </section>
65
67
  <section class="card rise" style="--d:7" id="agCard" aria-labelledby="hAg">
66
68
  <div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><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"/></svg></span><h2 id="hAg">With agents</h2><small id="agCap"></small></div>
@@ -67,8 +67,8 @@
67
67
  </div>
68
68
  <div>
69
69
  <section class="card rise" id="todayCard" style="--d:7" aria-labelledby="hToday">
70
- <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>
71
- <p class="rcap" id="rcap" hidden></p>
70
+ <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">Calendar</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>
71
+ <div id="wkStrip"></div>
72
72
  <div class="prep" id="prep" hidden></div>
73
73
  <div class="opts" id="todayOpts" inert><div><div class="chips" id="srcChips" role="group" aria-label="Sources"></div></div></div>
74
74
  <div class="tl" id="tl" role="group" aria-label="Today. Use the up and down arrow keys to move between rows."></div>