create-pmos 0.616.0 → 0.618.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/package.json +51 -45
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-initiative-test.js +2 -1
  7. package/workspace/changelog.json +92 -1941
  8. package/workspace/extension/README.md +13 -1
  9. package/workspace/extension/panel.js +7 -5
  10. package/workspace/guide/layout.md +9 -4
  11. package/workspace/guide/notes.md +17 -3
  12. package/workspace/lib/board-premium.js +1 -0
  13. package/workspace/lib/board-trail.js +3 -1
  14. package/workspace/lib/core-docs.js +1 -1
  15. package/workspace/lib/engine/boards.js +2 -2
  16. package/workspace/lib/meeting-focus.js +40 -8
  17. package/workspace/lib/okr-goals.js +2 -1
  18. package/workspace/lib/routes-boards.js +20 -4
  19. package/workspace/lib/routes-brief-page.js +6 -2
  20. package/workspace/lib/routes-meeting-focus.js +3 -1
  21. package/workspace/lib/status-when.js +15 -2
  22. package/workspace/package-lock.json +2 -2
  23. package/workspace/package.json +1 -1
  24. package/workspace/premium-board-actions-test.js +1 -0
  25. package/workspace/public/pm/bd-work.css +5 -4
  26. package/workspace/public/pm/buddy-core.js +166 -0
  27. package/workspace/public/pm/buddy-press.js +66 -0
  28. package/workspace/public/pm/cozy-buddy.css +52 -0
  29. package/workspace/public/pm/cozy-buddy.js +115 -0
  30. package/workspace/public/pm/cozy-day-pick.css +9 -8
  31. package/workspace/public/pm/cozy-home.css +54 -2
  32. package/workspace/public/pm/cozy-pop-work.css +29 -0
  33. package/workspace/public/pm/cozy-pop-work.js +151 -13
  34. package/workspace/public/pm/cozy-popup.css +6 -1
  35. package/workspace/public/pm/cozy-popup.js +26 -7
  36. package/workspace/public/pm/cozy-rec-now.js +35 -4
  37. package/workspace/public/pm/cozy-rec-tab.js +5 -1
  38. package/workspace/public/pm/cozy-status-when.js +17 -2
  39. package/workspace/public/pm/cozy-task-pop.css +34 -0
  40. package/workspace/public/pm/cozy-task-pop.js +199 -0
  41. package/workspace/public/pm/cozy-today-app.js +13 -1
  42. package/workspace/public/pm/cozy-today-model.js +5 -2
  43. package/workspace/public/pm/cozy-today-page.css +6 -0
  44. package/workspace/public/pm/cozy-today-view.js +7 -3
  45. package/workspace/public/pm/home-app.js +8 -2
  46. package/workspace/public/pm/home-chat.js +13 -7
  47. package/workspace/public/pm/home-data.js +31 -1
  48. package/workspace/public/pm/home-ini.js +7 -1
  49. package/workspace/public/pm/page-chat.js +1 -1
  50. package/workspace/public/pm/premium-board.js +18 -4
  51. package/workspace/public/pm/premium-meeting.js +2 -2
  52. package/workspace/public/pm/rec-tab-core.js +5 -2
  53. package/workspace/public/premium-buddy.html +27 -0
  54. package/workspace/server.js +1 -1
  55. package/workspace/test-lists/chat-turns.json +9 -0
  56. package/workspace/test-lists/meeting-buddy.json +9 -0
@@ -0,0 +1,199 @@
1
+ /* pm/cozy-task-pop.js — one task in a small popup on top of the one popup (popup round 3 point 20, Wawan 2026-11-19: "When open task, can it also
2
+ * open a smaller popup on top of current one?"). The initiative popup stays behind it, dimmed a little, not closed and not scrolled.
3
+ *
4
+ * openTask(uid, ctx) opens the task. ctx: { ws, board, ini, pmPost(path, body), toast(msg, undo?), onChange(), iniTitle?(id),
5
+ * row?(uid) → the row the host drew (GET /api/boards/items adds the owner and notes when it answers), list?() → [uid] (↑ ↓ step through it),
6
+ * rename?(task, title) → Promise (the title,
7
+ * pressed, becomes a field; Enter or leaving it saves), onClose?(uid) (the host
8
+ * lights the row), openIni?(id) }
9
+ * closeTask() closes it, as ✕, Esc or a press outside do. Esc closes only the small popup.
10
+ *
11
+ * Inside: the kind (Task or Milestone, pressed to switch) and the title; the one task card (pm/task-card.js mountCard: status, due, owner, notes,
12
+ * where it sits, what PMOS changed) whose status pick asks when it really happened (pm/cozy-status-when.js, point 18); ⋯ with Make it a
13
+ * milestone and Archive (Undo). No chat inside: one level only, a second task replaces the content. On a phone it is a sheet from the bottom.
14
+ * Every write is the PM's press, on the board's own routes. The UI says PMOS, never Claude; icon-only buttons carry aria-label. */
15
+ import { taskOf, mountCard, boardSaver, cardStyle, historyFor } from './task-card.js';
16
+ import * as SWN from './cozy-status-when.js';
17
+
18
+ const CSS = new URL('./cozy-task-pop.css', import.meta.url).href;
19
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
20
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
21
+ }
22
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
23
+ const SVG = (d) => `<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
24
+ const P = {
25
+ x: 'M6 6l12 12M18 6L6 18', up: 'M7 14l5-5 5 5', down: 'M7 10l5 5 5-5', chat: 'M4 5h16v11H9l-5 4z', more: 'M5 12h.01M12 12h.01M19 12h.01',
26
+ dia: 'M12 4l8 8-8 8-8-8z', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
27
+ };
28
+ const ib = (attr, label, d) => `<button type="button" class="ctp-ib" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(d)}</button>`;
29
+
30
+ let S = null; // { el, scrim, uid, ctx, card, t, raw, nextDay, prevFocus }
31
+
32
+ /** The task's row: the board's items (its owner and notes too), else the row the host drew. */
33
+ async function rowOf(uid, ctx) {
34
+ const q = 'board=' + encodeURIComponent(ctx.board || '') + (ctx.ws ? '&ws=' + encodeURIComponent(ctx.ws) : '');
35
+ const I = ctx.board ? await fetch('/api/boards/items?' + q, { credentials: 'same-origin' }).then((x) => x.json()).catch(() => null) : null;
36
+ const it = I && I.ok ? (I.items || []).find((x) => x.uid === uid) : null;
37
+ const own = ctx.row ? ctx.row(uid) : null;
38
+ return it ? { ...(own || {}), ...it } : own || null;
39
+ }
40
+
41
+ export function closeTask() {
42
+ if (!S) return;
43
+ const { el, scrim, uid, ctx, prevFocus } = S;
44
+ S = null;
45
+ document.removeEventListener('keydown', onKey, true);
46
+ el.remove(); scrim.remove();
47
+ document.body.classList.remove('ctp-on');
48
+ if (ctx.onClose) ctx.onClose(uid);
49
+ if (prevFocus && prevFocus.isConnected) prevFocus.focus();
50
+ }
51
+
52
+ function onKey(e) {
53
+ if (!S) return;
54
+ if (e.key === 'Escape') {
55
+ // a picker open inside the card closes first (its own Escape); then only the small popup
56
+ if (e.target.closest && e.target.closest('.hi-pop, .dp-cal, [data-tkc-notes]')) return;
57
+ e.preventDefault(); e.stopPropagation(); closeTask(); return;
58
+ }
59
+ if ((e.key === 'ArrowUp' || e.key === 'ArrowDown') && S.el.contains(e.target) && !e.target.closest('input, textarea, [role="menu"], .sw, .tkc-dp')) {
60
+ const L = S.ctx.list ? S.ctx.list() : [], i = L.indexOf(S.uid), j = i + (e.key === 'ArrowUp' ? -1 : 1);
61
+ if (i >= 0 && j >= 0 && j < L.length) { e.preventDefault(); show(L[j]); }
62
+ }
63
+ }
64
+
65
+ /** Opens the small popup on top; a second call while it is open replaces its content (one level only). */
66
+ export async function openTask(uid, ctx = {}) {
67
+ cardStyle();
68
+ if (!S) {
69
+ const scrim = document.createElement('div'); scrim.className = 'ctp-scrim'; scrim.addEventListener('click', closeTask);
70
+ const el = document.createElement('div'); el.className = 'cz ctp'; el.setAttribute('role', 'dialog'); el.setAttribute('aria-modal', 'true'); el.setAttribute('data-esc-layer', '');
71
+ document.body.append(scrim, el);
72
+ document.body.classList.add('ctp-on');
73
+ S = { el, scrim, ctx, uid, prevFocus: document.activeElement };
74
+ document.addEventListener('keydown', onKey, true);
75
+ el.addEventListener('click', press);
76
+ // the status pick waits for the day (point 18): the card's own press is held here, the line opens under the card
77
+ el.addEventListener('click', holdStatus, true);
78
+ }
79
+ S.ctx = ctx;
80
+ await show(uid);
81
+ }
82
+
83
+ async function show(uid) {
84
+ if (!S) return;
85
+ const ctx = S.ctx;
86
+ S.uid = uid;
87
+ S.el.setAttribute('aria-busy', 'true');
88
+ const raw = await rowOf(uid, ctx);
89
+ if (!S || S.uid !== uid) return;
90
+ S.el.removeAttribute('aria-busy');
91
+ if (!raw) { S.el.innerHTML = `<div class="ctp-h">${ib('data-ctp-close', 'Close', P.x)}</div><p class="ctp-none">This task could not be read. It may have been removed.</p>`; return; }
92
+ const t = taskOf(raw, { iniTitle: ctx.iniTitle ? ctx.iniTitle(raw.ini || ctx.ini) : '', board: ctx.board, ini: ctx.ini });
93
+ S.raw = raw; S.t = t; S.nextDay = null;
94
+ const L = ctx.list ? ctx.list() : [], i = L.indexOf(uid);
95
+ const kind = `<button type="button" class="ctp-kind" data-ctp-kind aria-label="${esc(t.milestone ? 'Milestone. Make it a task' : 'Task. Make it a milestone')}"${t.jira ? ' disabled' : ''}>${SVG(t.milestone ? P.dia : P.box)}<span>${t.milestone ? 'Milestone' : 'Task'}</span></button>`;
96
+ const title = !t.jira && ctx.rename ? `<button type="button" class="ctp-t" data-ctp-rename aria-label="${esc('Rename ' + t.title)}">${esc(t.title)}</button>` : `<span class="ctp-t">${esc(t.title)}</span>`;
97
+ const step = L.length > 1 && i >= 0 ? ib(`data-ctp-step="-1"${i === 0 ? ' disabled' : ''}`, 'Previous task', P.up) + ib(`data-ctp-step="1"${i === L.length - 1 ? ' disabled' : ''}`, 'Next task', P.down) : '';
98
+ const more = !t.jira ? ib('data-ctp-more aria-haspopup="menu"', 'More for this task', P.more) : '';
99
+ S.el.setAttribute('aria-label', 'Task: ' + t.title);
100
+ S.el.innerHTML = `<div class="ctp-h">${kind}${title}<span class="ctp-tools">${step}${more}${ib('data-ctp-close', 'Close', P.x)}</span></div>`
101
+ + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
102
+ const base = boardSaver({ ws: ctx.ws, board: raw.board || ctx.board, t, post: (p, b) => ctx.pmPost(p, b) });
103
+ const save = (patch) => {
104
+ // a status the PM dated earlier carries that day; Undo and every other change go as they always did
105
+ const day = patch.status != null ? S && S.nextDay : null;
106
+ if (S) S.nextDay = null;
107
+ if (day && !t.jira) return ctx.pmPost('/api/boards/tasks/state', { ws: ctx.ws, board: raw.board || ctx.board, task: t.uid, state: patch.status, happened: day });
108
+ return base(patch);
109
+ };
110
+ const changed = () => { raw.status = t.status; raw.end = t.due; raw.start = t.start; raw.owner = t.owner; raw.notes = t.notes; raw.milestone = t.milestone; clearTimeout(changed.t); changed.t = setTimeout(() => { if (ctx.onChange) ctx.onChange(); }, 400); };
111
+ const toast = (msg, undo) => (ctx.toast ? ctx.toast(msg, undo) : undefined);
112
+ S.card = mountCard(S.el.querySelector('.ctp-b'), t, {
113
+ save, toast, changed, now: () => Date.now(),
114
+ openIni: (id) => { closeTask(); if (ctx.openIni) ctx.openIni(id); },
115
+ iniTitleOf: (id) => (ctx.iniTitle ? ctx.iniTitle(id) : id),
116
+ owners: () => (ctx.owners ? ctx.owners() : []),
117
+ inis: () => (ctx.inis ? ctx.inis() : []),
118
+ history: historyFor({ ws: ctx.ws, board: raw.board || ctx.board, t, post: (p, b) => ctx.pmPost(p, b) }),
119
+ });
120
+ const f = S.el.querySelector('.ctp-t') || S.el.querySelector('button'); if (f) f.focus();
121
+ }
122
+
123
+ /* the card's status press waits for "When did this happen?": Today preselected, so a second press of the status or Enter keeps today */
124
+ function holdStatus(e) {
125
+ if (!S || !S.t) return;
126
+ const b = e.target.closest('[data-tkc-state]'); if (!b || !S.el.contains(b) || S.t.jira) return;
127
+ const st = b.dataset.tkcState;
128
+ if (st === S.t.status) return;
129
+ if (S.held === st) { S.held = null; S.nextDay = null; hideWhen(); return; } // the second press of the same status: today, as the card does
130
+ e.stopPropagation(); e.preventDefault();
131
+ S.held = st;
132
+ // the line sits right under the facts card (the status row), the card does not redraw while it waits
133
+ const w = S.el.querySelector('.ctp-when'), facts = S.el.querySelector('.ctp-b .tkc-f');
134
+ if (facts && w.previousElementSibling !== facts) facts.after(w);
135
+ w.hidden = false; w.innerHTML = '';
136
+ S.el.querySelectorAll('[data-tkc-state]').forEach((x) => x.classList.toggle('ctp-held', x.dataset.tkcState === st));
137
+ const pick = (day) => { const s = S; if (!s) return; s.held = null; s.nextDay = day && day !== SWN.localDay() ? day : null; hideWhen(); s.card.setStatus(st); };
138
+ const head = document.createElement('p'); head.className = 'ctp-wh'; head.textContent = st; w.appendChild(head);
139
+ const box = document.createElement('div'); w.appendChild(box);
140
+ SWN.askWhen(box, { since: S.raw.since || '', onPick: pick });
141
+ const t0 = box.querySelector('[data-sw]'); if (t0) t0.focus();
142
+ }
143
+ function hideWhen() { if (!S) return; const w = S.el.querySelector('.ctp-when'); if (w) { w.hidden = true; w.innerHTML = ''; S.el.appendChild(w); } S.el.querySelectorAll('.ctp-held').forEach((x) => x.classList.remove('ctp-held')); }
144
+
145
+ async function press(e) {
146
+ if (!S) return;
147
+ const b = e.target.closest('button'); if (!b || b.disabled || !S.el.contains(b)) return;
148
+ const d = b.dataset, ctx = S.ctx, t = S.t;
149
+ if ('ctpClose' in d) { closeTask(); return; }
150
+ if (d.ctpStep) { const L = ctx.list ? ctx.list() : [], j = L.indexOf(S.uid) + Number(d.ctpStep); if (j >= 0 && j < L.length) show(L[j]); return; }
151
+ if ('ctpRename' in d && t && ctx.rename) { renameField(b); return; }
152
+ if ('ctpKind' in d && t) { kindOf(!t.milestone); return; }
153
+ if ('ctpMore' in d && t) { moreMenu(b); return; }
154
+ }
155
+ /* Task or Milestone: the card's own write (POST /api/boards/tasks/edit milestone), with Undo */
156
+ async function kindOf(on) {
157
+ const s = S; if (!s) return;
158
+ const post = (v) => s.ctx.pmPost('/api/boards/tasks/edit', { ws: s.ctx.ws, board: s.raw.board || s.ctx.board, task: s.t.uid, milestone: v });
159
+ const r = await post(on).catch(() => null);
160
+ if (!r || r.ok === false) { if (s.ctx.toast) s.ctx.toast((r && r.error) || 'Nothing was changed.'); return; }
161
+ s.raw.milestone = on;
162
+ if (s.ctx.toast) s.ctx.toast(on ? 'It is a milestone now.' : 'It is a task now.', async () => { const u = await post(!on).catch(() => null); if (u && u.ok !== false) { s.raw.milestone = !on; if (S === s) show(s.uid); if (s.ctx.onChange) s.ctx.onChange(); } return u || { ok: false }; });
163
+ if (s.ctx.onChange) s.ctx.onChange();
164
+ if (S === s) show(s.uid);
165
+ }
166
+ function moreMenu(btn) {
167
+ const s = S; if (!s) return;
168
+ let m = s.el.querySelector('.ctp-menu');
169
+ if (m) { m.remove(); btn.setAttribute('aria-expanded', 'false'); return; }
170
+ m = document.createElement('div'); m.className = 'ctp-menu'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'More for this task');
171
+ m.innerHTML = `<button type="button" role="menuitem" data-k="kind">${SVG(s.t.milestone ? P.box : P.dia)}${s.t.milestone ? 'Make it a task' : 'Make it a milestone'}</button>`
172
+ + (s.t.status !== 'Archived' ? '<button type="button" role="menuitem" data-k="arch">Archive</button>' : '');
173
+ btn.setAttribute('aria-expanded', 'true');
174
+ btn.closest('.ctp-h').appendChild(m);
175
+ m.querySelector('button').focus();
176
+ m.addEventListener('click', (e) => {
177
+ const x = e.target.closest('[data-k]'); if (!x) return;
178
+ e.stopPropagation(); m.remove(); btn.setAttribute('aria-expanded', 'false');
179
+ if (x.dataset.k === 'kind') kindOf(!s.t.milestone);
180
+ else if (x.dataset.k === 'arch') s.card.setStatus('Archived');
181
+ });
182
+ m.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); m.remove(); btn.setAttribute('aria-expanded', 'false'); btn.focus(); } });
183
+ }
184
+ /* the title becomes a field: Enter or leaving it saves (the host's rename, with its Undo); Escape keeps the old name */
185
+ function renameField(btn) {
186
+ const s = S; if (!s) return;
187
+ const inp = document.createElement('input');
188
+ inp.className = 'ctp-t ctp-ti'; inp.value = s.t.title; inp.maxLength = 200; inp.setAttribute('aria-label', 'Name of the task');
189
+ btn.replaceWith(inp); inp.focus(); inp.select();
190
+ let done = false;
191
+ const leave = async (save) => {
192
+ if (done) return; done = true;
193
+ const v = inp.value.trim();
194
+ if (save && v && v !== s.t.title) { await Promise.resolve(s.ctx.rename(s.raw, v)).catch(() => null); s.raw.title = v; }
195
+ if (S === s) show(s.uid);
196
+ };
197
+ inp.addEventListener('blur', () => leave(true));
198
+ inp.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); leave(true); } else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); leave(false); } });
199
+ }
@@ -4,7 +4,8 @@
4
4
  * { S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now(), rank() → rankMove's answer, rows() → Home's rows by id (a Map),
5
5
  * titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m), startCalls(ids) → { started, failed },
6
6
  * openCalendar(), openInbox(), openLab(l), reload(), review() → the weekly review's model, meetings() → today's meetings, news() → how
7
- * many are new for you, chatNow() → the chat's target }
7
+ * many are new for you, chatNow() → the chat's target, record(row) → the page recorder's record (premium-meeting.js recCore; the
8
+ * agenda's play icon, meeting-buddy) }
8
9
  * → { on() → Today is drawn, draw(), read() }
9
10
  *
10
11
  * Today draws into #tdPage, the only thing on the white page panel; Home's list and chat column are not drawn (cozy-today-page.css), so the
@@ -322,6 +323,17 @@ export function mountToday(ctx) {
322
323
  return after(false);
323
324
  } finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
324
325
  }
326
+ if (act === 'play') {
327
+ // meeting-buddy: the link opens the call (the browser's own default, not stopped here); right after, the recording starts in the
328
+ // PMOS recording tab with its Listen sheet on the call's app. Chrome then asks which tab to share: the PM picks the call.
329
+ const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x || !x.ref) return;
330
+ const m = x.ref;
331
+ setTimeout(async () => {
332
+ const res = await ctx.record({ id: m.id, at: m.start, end: m.end, title: m.title, app: x.app === 'teams' ? 'other' : x.app });
333
+ ctx.toast(res && res.ok ? 'The call opened. Pick it in Chrome\'s window, with tab sound, so PMOS hears it.' : (res && res.error) || 'The recording did not start. The call opened.');
334
+ }, 0);
335
+ return;
336
+ }
325
337
  if (act === 'ev') {
326
338
  const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x) return;
327
339
  if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
@@ -400,7 +400,10 @@ export function agendaModel(o = {}) {
400
400
  for (const m of o.meetings || []) {
401
401
  if (!m || !m.start || Number.isNaN(Date.parse(m.start)) || dayKey(Date.parse(m.start)) !== today) continue;
402
402
  const s = span(m);
403
- items.push({ key: 'm:' + (m.id || m.start + m.title), kind: 'meeting', title: m.title || 'Meeting', sub: hm(s.a) + ' to ' + hm(s.b), a: s.a, b: s.b, ini: iniOf(m) || null, ref: m });
403
+ // the call's address (meeting-buddy): the play icon opens it and starts the recording; only an https Meet, Zoom or Teams address
404
+ const join = typeof m.join === 'string' && /^https:\/\//i.test(m.join) ? m.join : null;
405
+ items.push({ key: 'm:' + (m.id || m.start + m.title), kind: 'meeting', title: m.title || 'Meeting', sub: hm(s.a) + ' to ' + hm(s.b), a: s.a, b: s.b, ini: iniOf(m) || null, ref: m,
406
+ ...(join ? { join, app: ['meet', 'zoom', 'teams'].includes(m.app) ? m.app : 'other' } : {}) });
404
407
  }
405
408
  for (const e of o.own || []) {
406
409
  if (!e || e.bullet !== 'event' || !e.time || e.day !== today || e.done) continue;
@@ -435,7 +438,7 @@ export function agendaModel(o = {}) {
435
438
  const from = Math.min(8, first), to = Math.max(18, Math.min(24, last));
436
439
  const base = new Date(now); base.setHours(from, 0, 0, 0);
437
440
  const H = 60 * 60000;
438
- for (const x of items) { x.top = (x.a - base.getTime()) / H; x.h = Math.max(0.5, (x.b - x.a) / H); x.past = x.b <= now; x.nowOn = x.a <= now && now < x.b; }
441
+ for (const x of items) { x.top = (x.a - base.getTime()) / H; x.h = Math.max(0.5, (x.b - x.a) / H); x.past = x.b <= now; x.nowOn = x.a <= now && now < x.b; x.play = !!x.join && !x.past; }
439
442
  // side by side, never on top of each other: items whose boxes meet share the width (a box is at least 40 px, about MIN_BOX minutes, tall, so a short
440
443
  // meeting is never cut by the next one); each gets its column and the number of columns of its cluster
441
444
  const MIN_BOX = 40 * 60000, endOf = (x) => Math.max(x.b, x.a + MIN_BOX);
@@ -143,6 +143,12 @@ button.td-ev:focus-visible { outline: 2px solid var(--cz-blue); outline-offset:
143
143
  .td-ev.own { background: none; box-shadow: inset 0 0 0 1.5px var(--cz-hair); }
144
144
  .td-ev.on { box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
145
145
  .td-ev.past b { color: var(--cz-ink3); }
146
+ /* meeting-buddy: the play icon on a meeting with a call (join and record in one press), at the top right of the meeting's own box */
147
+ .td-ev.has-play { padding-right: 40px; }
148
+ .td-play { position: absolute; left: calc(4px + (100% - 4px) * (var(--c, 0) + 1) / var(--n, 1) - 35px); top: calc(var(--t) + 1px); width: 28px; height: 28px; border-radius: 6px;
149
+ display: inline-flex; align-items: center; justify-content: center; background: var(--cz-solid); color: var(--cz-onsolid); text-decoration: none; }
150
+ .td-play:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
151
+ @media (hover: hover) { .td-play:hover { background: var(--cz-blueink); } }
146
152
  .td-now { position: absolute; left: -6px; right: 0; top: var(--t); height: 2px; background: var(--cz-late); }
147
153
  .td-now::before { content: ''; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-late); }
148
154
 
@@ -10,14 +10,15 @@
10
10
  * A row: "!" when the PM marked it first, its bullet (• task, ○ event, – note, × done, ✦ a PMOS suggestion), What, Work, Job, When, and on
11
11
  * hover or focus three plain icons: done, move to tomorrow, set a date. A Lab finding has ✓ (keep: start an initiative) and ✕ (drop).
12
12
  * Waiting too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
13
- * Press a row or an agenda event: the popup on its work (home-app.js).
13
+ * Press a row or an agenda event: the popup on its work (home-app.js). A meeting with a call that is not over has a play icon: one
14
+ * press opens the call and starts the recording (meeting-buddy).
14
15
  * Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
15
16
 
16
17
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
17
18
  const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
18
19
  export const I = {
19
20
  done: 'M5 12.5l4.5 4.5L19 7.5', tomorrow: 'M5 12h14M13 6l6 6-6 6', date: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', plus: 'M12 6v12M6 12h12',
20
- yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4',
21
+ yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4', play: 'M8 5v14l11-7z',
21
22
  };
22
23
  /** The small sign of each type in the Type column (one stroke icon, the word beside it). */
23
24
  const TI = {
@@ -124,7 +125,10 @@ export function agendaHtml(A) {
124
125
  const inner = `<b>${mark}${esc(x.title)}</b><small>${esc(x.sub)}</small>`;
125
126
  if (x.kind === 'own' || x.kind === 'report') return `<div class="${cls}" style="${st}" aria-label="${esc(label)}">${inner}</div>`;
126
127
  if (x.kind === 'focus') return `<button type="button" class="${cls}" style="${st}" data-td="open" data-key="${esc(x.row)}" aria-label="${esc(label)}">${inner}</button>`;
127
- return `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
128
+ return `<button type="button" class="${cls}${x.play ? ' has-play' : ''}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`
129
+ // meeting-buddy: one press opens the call and starts the recording. A link, so the browser always opens the call, even when the
130
+ // recording tab is held back; cozy-today-app.js starts the recording on the same press.
131
+ + (x.play ? `<a class="td-play" style="${st}" href="${esc(x.join)}" target="_blank" rel="noopener noreferrer" data-td="play" data-key="${esc(x.key)}" aria-label="${esc('Join ' + x.title + ' and record it')}" title="Join and record">${svg(I.play, 13)}</a>` : '');
128
132
  }).join('');
129
133
  const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
130
134
  return `<aside class="td-ag${A.quiet && !A.items.length ? ' quiet' : ''}" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.quiet && !A.items.length ? A.sub.split(' · ')[0] : A.sub)}</small>`
@@ -77,6 +77,7 @@ import { mountPull } from './cozy-pull.js'; // pull to refresh on Your day, Ad
77
77
  import * as DB from './dash-view.js'; // the page model's parts on the product page: the reports, the proposals (batch 17 item 1)
78
78
  import * as PV from './prog-page.js'; // the product page is the one program and product page (batch 21 item 2, canvas RdProgL–RdProgP)
79
79
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
80
+ import * as SWN from './cozy-status-when.js'; // a stage move asks when it really happened (round 3 follow-up of point 18)
80
81
 
81
82
  const $ = (s, r = document) => r.querySelector(s);
82
83
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -1891,7 +1892,12 @@ function openOverview() {
1891
1892
  const after = async (r, ok) => { if (r && r.ok !== false) { toast(ok); await load(); if (S.ini === id && S.IM) M = S.IM; draw(body); } else { const m = body.querySelector('#ovMsg'); if (m) m.textContent = (r && r.error) || 'Nothing was changed.'; } };
1892
1893
  body.onclick = async (e) => {
1893
1894
  const t = e.target.closest('button'); if (!t || !M) return;
1894
- if (t.dataset.ovMove) { if (t.getAttribute('aria-pressed') === 'true') return; after(await pmPost('/api/boards/move', { ...bw(), id, to: t.dataset.ovMove }), 'Moved to ' + t.dataset.ovMove + '.'); return; }
1895
+ if (t.dataset.ovMove) { // asks when it really happened (round 3 follow-up of point 18)
1896
+ if (t.getAttribute('aria-pressed') === 'true') return;
1897
+ const to = t.dataset.ovMove;
1898
+ SWN.whenPop(t, { title: 'Move to ' + to, since: (M.acts && M.acts.movedOn) || '', onPick: async (day) => { await after(await pmPost('/api/boards/move', { ...bw(), id, to, ...(day ? { happened: day } : {}) }), SWN.whenWords('Moved to ' + to, day)); } });
1899
+ return;
1900
+ }
1895
1901
  if (t.dataset.ovLife === 'active') { after(await pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: '' }), 'Recorded.'); return; }
1896
1902
  if (t.dataset.ovLife) { ask = t.dataset.ovLife; draw(body); const w = body.querySelector('#ovWhy'); if (w) w.focus(); return; } // the reason is asked inline, not in a browser dialog
1897
1903
  if ('ovLifeNo' in t.dataset) { ask = null; draw(body); return; }
@@ -2410,7 +2416,7 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
2410
2416
  for (const id of ids) { const r = N.find((x) => x.id === id), w = r && r.row && r.row.dialog && r.row.dialog.write; if (!w || w.kind !== 'start') { failed++; continue; }
2411
2417
  const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
2412
2418
  if (started) load(); return { started, failed, error: started ? '' : 'PMOS did not start them. Nothing changed.' }; },
2413
- openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2419
+ openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D), record: (row) => (REC ? REC.record(row) : Promise.resolve({ ok: false, error: 'PMOS is still starting. Press play again in a moment.' })),
2414
2420
  news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2415
2421
  openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
2416
2422
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
@@ -1,7 +1,7 @@
1
1
  /* pm/home-chat.js — Home's chat column (initiative premium-agreed-design, Home; mockup Main.dc.html section "Conversation", AgChat*).
2
2
  *
3
3
  * On a desktop a header line names what is open: its mark, its title and the chip of where it sits (HvACDesk; host.head(t) draws it).
4
- * Home's own chat has none. The stream: the role's avatar and name over each agent message with Copy, Retry and Make a work-item; the
4
+ * Home's own chat has none. The stream: the role's avatar and name over each agent message with Copy, Retry and Make it a task; the
5
5
  * PM's bubbles with "You · HH:MM"; "Worked …" folds (under the message that asks, while it asks); a Today divider; "New since you left"; "N earlier messages · show";
6
6
  * a permission card with the change before → after, Allow and Deny. At the top of the chat, the progress line (XcbOptions B, home-line.js): one
7
7
  * line for the goal or the session while it works, with Stop; a tap opens its steps in place on a phone and in the Viewer on a desktop; blue while
@@ -15,7 +15,7 @@
15
15
  * started, POST /ask and /press) or a session with no chat key (GET /api/sessions/conversation?id=, POST /api/session/say and /keys).
16
16
  * A loose session the host can place (host.suggestLink(target, firstText) → { id, title }) shows one chip: Link it (host.linkTo) or × (host.dismissLink).
17
17
  * On a phone (batch 31 item 5) the stream is messages only: no avatar column and no name or time line (both still read out), and
18
- * Copy, Retry and Make a work-item show on the newest message; an older one shows them on press and hold. The In:/To: chip and the
18
+ * Copy, Retry and Make it a task show on the newest message; an older one shows them on press and hold. The In:/To: chip and the
19
19
  * waiting bar leave the box there: the top bar's context line and ⋯ hold them (pm/phone-chat-head.js).
20
20
  * Every write is the PM's press. mountChat(el, host) returns { open(target), refresh(), focus(), send(text) }.
21
21
  * target: { key?, sid?, title, scope: { text, icon, loose }, role: { name, initial }, intro?: { role, text, at, mood? (Adler as the avatar while the log is empty), pills: [{ label, primary, go }] },
@@ -161,8 +161,10 @@ export function mountChat(el, host) {
161
161
  const id = 'w' + i, on = C.open.has(id);
162
162
  // the tool steps of one answer fold into one grey line, "5 steps" (popup round 3 point 9); the press opens them
163
163
  const n = it.calls.length || Object.values(it.tools || {}).reduce((k, v) => k + (Number(v) || 0), 0);
164
- const what = n ? n + (n === 1 ? ' step' : ' steps') : 'Worked' + (it.took ? ' ' + it.took : '');
164
+ const what = it.folded ? 'Worked ' + (n + (it.notes || []).length) + ((n + (it.notes || []).length) === 1 ? ' step' : ' steps') + (it.took ? ' · ' + it.took : '')
165
+ : n ? n + (n === 1 ? ' step' : ' steps') : 'Worked' + (it.took ? ' ' + it.took : '');
165
166
  return `<div class="hm-worked"><button type="button" class="hm-wk" data-hm-wk="${id}" aria-expanded="${on}" title="${esc(toolLine(it.tools) + (it.took ? ' · ' + it.took : ''))}">${SVG(CHEV, 12, 2.4)}<span>${esc(what)}</span></button>`
167
+ + (on && it.notes && it.notes.length ? `<div class="hm-notes">${it.notes.slice(0, 20).map((t) => `<p>${esc(t)}</p>`).join('')}</div>` : '')
166
168
  + (on ? `<ol class="hm-calls">${it.calls.slice(0, 40).map((c) => `<li><b>${esc(c.tool.split(/__|\//).pop())}</b><code>${esc(c.target || '')}</code></li>`).join('')}</ol>` : '') + '</div>'
167
169
  + (it.ask ? askHtmlOf(it, R) : '');
168
170
  }
@@ -176,7 +178,7 @@ export function mountChat(el, host) {
176
178
  const stopAt = R.stop && i === R.lastAgent;
177
179
  const av = last && isClaude(R.role) ? adlerAvHtml(asking || ak.block ? 'needs-you' : stopAt ? 'honest' : running() ? 'thinking' : 'handled') : avHtml(R.role);
178
180
  return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}${last ? ' last' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? verHtml(rp.text) : ''}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
179
- + (asking ? '' : `<div class="hm-tools" role="group" aria-label="Message actions"><button type="button" data-hm-copy="${i}">Copy</button>${last && !running() && !(stopAt && R.stop.actions.length) ? `<button type="button" data-hm-retry>Retry</button>` : ''}<button type="button" data-hm-wi="${i}">Make a work-item</button></div>`) + '</div></div>'
181
+ + (asking ? '' : `<div class="hm-tools" role="group" aria-label="Message actions"><button type="button" data-hm-copy="${i}">Copy</button>${last && !running() && !(stopAt && R.stop.actions.length) ? `<button type="button" data-hm-retry>Retry</button>` : ''}<button type="button" data-hm-wi="${i}">Make it a task</button></div>`) + '</div></div>'
180
182
  + (stopAt && R.stop.actions.length ? `<div class="hm-fix" role="group" aria-label="What to do next">${R.stop.actions.map((a, k) => iconBtn({ icon: a.icon, label: a.label, attr: a.data, pri: k === 0 })).join('')}</div>` : '')
181
183
  + blockAskHtml(ak.block, it, R);
182
184
  }
@@ -266,7 +268,9 @@ export function mountChat(el, host) {
266
268
  drawSug();
267
269
  const R = { role: role() };
268
270
  const msgs = (C.conv && C.conv.messages) || [];
269
- const items = streamOf(msgs, { seen: C.seenAt, show: C.show });
271
+ // the narrow chat (the popup's column, a phone): one turn = one answer, its notes and steps in one line (popup round 3 point 19c)
272
+ const narrow = !!(el.closest && el.closest('.cz-pop-chat')) || (typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches);
273
+ const items = streamOf(msgs, { seen: C.seenAt, show: C.show, turns: narrow, live: running() });
270
274
  R.lastAgent = -1; items.forEach((it, i) => { if (it.t === 'agent') R.lastAgent = i; });
271
275
  R.asking = !!(C.conv && C.conv.state !== 'ended' && C.conv.ask);
272
276
  // while it asks, the "Worked …" line of its turn sits under the message that asks, over the permission card (AgChatAsk)
@@ -286,7 +290,9 @@ export function mountChat(el, host) {
286
290
  html += GU.choiceHtml(); // /goal while a goal works here: In a new chat, or Here instead
287
291
  for (const n of C.notes || []) if (t.ini && n.ini === t.ini) html += `<p class="hm-note hm-you">${esc(n.text)}</p>`;
288
292
  if (C.th && C.th.working) html += `<p class="hm-note" role="status">The agent is answering. You can write again when it has.</p>`;
289
- if (C.conv && C.conv.state === 'ended') html += '<p class="hm-note">This session has ended. Your conversation is kept here, and your next message picks it up.</p>';
293
+ // the narrow chat says it as one quiet divider (popup round 3 point 19f)
294
+ if (C.conv && C.conv.state === 'ended') html += narrow ? '<div class="hm-day hm-ended" role="separator"><span></span>Session ended · continues when you write<span></span></div>'
295
+ : '<p class="hm-note">This session has ended. Your conversation is kept here, and your next message picks it up.</p>';
290
296
  // an empty chat: Adler resting, because nothing runs here yet (canvas AdH1)
291
297
  if (!html) html = `<div class="hm-empty hm-empty-ad">${adler('resting', 'l', { id: 'chatempty' })}<p>${esc(t.empty || 'Ask anything. It works in a real Claude Code session.')}</p></div>`;
292
298
  put(log, html);
@@ -734,7 +740,7 @@ export function mountChat(el, host) {
734
740
  // a hand edit in the canvas's inspector (pm/cozy-proto.js 'pmos:note'): one quiet line in the conversation, so it shows on both sides.
735
741
  // It lives on this page only; the next version reads the edit itself from edits.json.
736
742
  window.addEventListener('pmos:note', (e) => { if (!mine(e) || !e.detail.text) return; C.notes = [...(C.notes || []).filter((n) => n.ini === C.t.ini), { ini: C.t.ini, text: String(e.detail.text).slice(0, 200) }].slice(-4); draw(); });
737
- /* An older message's Copy, Retry and Make a work-item on a phone (batch 31 item 5): press and hold the message to show them (the CSS
743
+ /* An older message's Copy, Retry and Make it a task on a phone (batch 31 item 5): press and hold the message to show them (the CSS
738
744
  * shows them on the newest message, and on focus for a keyboard). A tap elsewhere hides them again. */
739
745
  let holdT = null;
740
746
  const unhold = () => el.querySelectorAll('.hm-a.held').forEach((x) => x.classList.remove('held'));
@@ -8,7 +8,8 @@
8
8
  * productCard(D) the product's card (every anchor from D.board.anchorRows when sent): "This week", the KRs and the budget on track or at risk, Then, the next routine, the CTA
9
9
  * weeklyUpdate(D) the weekly update the Viewer shows and Send turns into a mail draft: risks to confirm, At risk, Needs a decision, On track,
10
10
  * Not read (workspace grill W2); updateNews(D) says whether there is one to draft this week
11
- * streamOf(conv, o) the chat's stream: day dividers, "New since you left", "N earlier messages", messages, Worked-for folds
11
+ * streamOf(conv, o) the chat's stream: day dividers, "New since you left", "N earlier messages", messages, Worked-for folds;
12
+ * o.turns folds each turn's notes and steps into one worked line above its answer (the narrow chat), o.live: the newest turn works
12
13
  * meetLineOf(P) the meeting line: the current or next meeting, +N for the rest of the day
13
14
  * roleOf(s, roles) an agent's role name and initial for a session ("Claude" when no skill names one)
14
15
  * D is { brief, board, sessions, desk, trail, today, schedules, now }: the answers of GET /api/briefing-premium, /api/board-premium,
@@ -354,6 +355,7 @@ export function streamOf(messages, o = {}) {
354
355
  lastAt = m.at || lastAt;
355
356
  }
356
357
  for (const it of items) if (it.t === 'worked') it.took = it.start && it.end ? dur(Date.parse(it.end) - Date.parse(it.start)) : '';
358
+ if (o.turns) foldTurns(items, o.live);
357
359
  const show = o.show == null ? 12 : o.show;
358
360
  const hidden = Math.max(0, items.length - show);
359
361
  const shown = items.slice(hidden);
@@ -370,6 +372,34 @@ export function streamOf(messages, o = {}) {
370
372
  }
371
373
  return out;
372
374
  }
375
+ /** One turn = one answer (popup round 3 point 19c, the narrow chat): inside one turn (from a message of the PM to the next) the small progress
376
+ * notes and the step lines fold into ONE worked line above the final answer, "Worked 6 steps · 20 s", which opens them. Only the last answer
377
+ * shows in full. A turn still at work (live, the newest) keeps its steps as they are: the progress line shows the current one. Mutates items. */
378
+ function foldTurns(items, live) {
379
+ let i = 0;
380
+ while (i < items.length) {
381
+ if (items[i].t === 'user') { i++; continue; }
382
+ let j = i; while (j < items.length && items[j].t !== 'user') j++;
383
+ const turn = items.slice(i, j), lastAgent = turn.map((x) => x.t).lastIndexOf('agent');
384
+ const atWork = live && j === items.length;
385
+ const before = lastAgent < 0 ? [] : turn.slice(0, lastAgent);
386
+ if (!atWork && (before.some((x) => x.t === 'agent') || before.filter((x) => x.t === 'worked').length > 1)) {
387
+ const w = { t: 'worked', tools: {}, calls: [], notes: [], start: null, end: null, at: null, ask: null, askMsg: null, mi: before[0].mi, folded: true };
388
+ for (const x of before) {
389
+ if (x.t === 'agent') { if (x.text) w.notes.push(x.text); if (!w.start) w.start = x.at; continue; }
390
+ for (const [k, v] of Object.entries(x.tools || {})) w.tools[k] = (w.tools[k] || 0) + v;
391
+ w.calls = w.calls.concat(x.calls || []); w.start = w.start || x.start; w.end = x.end || w.end; w.at = x.at || w.at;
392
+ if (x.ask) { w.ask = x.ask; w.askMsg = x.askMsg; }
393
+ }
394
+ w.end = turn[lastAgent].at || w.end;
395
+ w.took = w.start && w.end ? dur(Date.parse(w.end) - Date.parse(w.start)) : '';
396
+ items.splice(i, before.length, w);
397
+ j -= before.length - 1;
398
+ }
399
+ i = j;
400
+ }
401
+ return items;
402
+ }
373
403
  /** The live run: who works, on which step, how long, and how far (for the steps card and the run strip). */
374
404
  export function runOf(conv, role, now = Date.now()) {
375
405
  if (!conv || (conv.turn !== 'agent' && conv.turn !== 'tool')) return null;
@@ -699,7 +699,13 @@ function wire(body, id) {
699
699
  }
700
700
  if ('ovAdddoc' in d) { addDoc(id); return; }
701
701
  // stage
702
- if (d.ovMove) { if (t.getAttribute('aria-pressed') === 'true') return; const ok = await after(await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to: d.ovMove, why: 'Moved by hand' }), 'Moved to ' + d.ovMove + '.'); void ok; return; }
702
+ // a stage move asks when it really happened (round 3 follow-up of point 18): Today preselected, an earlier day never before the last move
703
+ if (d.ovMove) {
704
+ if (t.getAttribute('aria-pressed') === 'true') return;
705
+ const to = d.ovMove;
706
+ SWN.whenPop(t, { title: 'Move to ' + to, since: (M.acts && M.acts.movedOn) || '', onPick: async (day) => { await after(await X.ctx.pmPost('/api/boards/move', { ...bw(M), id, to, why: 'Moved by hand', ...(day ? { happened: day } : {}) }), SWN.whenWords('Moved to ' + to, day)); } });
707
+ return;
708
+ }
703
709
  if (d.ovLife === 'active') { after(await X.ctx.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: '' }), 'Recorded.'); return; }
704
710
  if (d.ovLife) { STAGE_ASK = d.ovLife; redrawView(); const w = body.querySelector('#ovWhy'); if (w) w.focus(); return; }
705
711
  if ('ovLifeNo' in d) { STAGE_ASK = null; redrawView(); return; }
@@ -66,7 +66,7 @@ function host() {
66
66
  if (c && ((c.cos && c.here) || c.popAbout)) { Q.t = cosTarget('', c.ws); Q.chat.open(Q.t); }
67
67
  },
68
68
  onTo: () => {}, onLink: () => {},
69
- workItem: () => toast('Make a work-item from Home, in the initiative’s own chat.'),
69
+ workItem: () => toast('Make it a task from Home, in the initiative’s own chat.'),
70
70
  viewerClosed: () => false, reopenViewer: () => {}, desk: () => true, head: () => '',
71
71
  // a finished turn: the page reads its records again, so what Claude changed shows with no refresh (as Home, batch 25 item 3)
72
72
  turnEnded: () => document.dispatchEvent(new CustomEvent('cz:chat-turn')),
@@ -674,7 +674,21 @@ function stageMenu(r, el) {
674
674
  const b = el.getBoundingClientRect();
675
675
  m.style.left = Math.max(8, Math.min(b.left, innerWidth - m.offsetWidth - 8)) + 'px'; m.style.top = Math.max(8, Math.min(b.bottom + 4, innerHeight - m.offsetHeight - 8)) + 'px';
676
676
  (m.querySelector('.on') || m.querySelector('[data-to]')).focus();
677
- m.addEventListener('click', (e) => { const x = e.target.closest('[data-to]'); if (!x) return; closeStageMenu(); el.focus(); if (x.dataset.to !== cur) moveStage(r, cur, x.dataset.to); });
677
+ // a pick asks when it really happened (round 3 follow-up of point 18): Today is preselected, so a second press of the stage or Enter keeps it
678
+ let picked = null;
679
+ const go = (to, day) => { closeStageMenu(); el.focus(); moveStage(r, cur, to, day && day !== SWN.localDay() ? day : null); };
680
+ m.addEventListener('click', (e) => {
681
+ const x = e.target.closest('[data-to]'); if (!x) return;
682
+ const to = x.dataset.to;
683
+ if (to === cur && !picked) { closeStageMenu(); el.focus(); return; }
684
+ if (picked === to) { go(to, null); return; }
685
+ picked = to;
686
+ m.querySelectorAll('[data-to]').forEach((b) => { const on = b.dataset.to === to; b.setAttribute('aria-checked', String(on)); b.classList.toggle('on', on); });
687
+ let w = m.querySelector('.wk-when'); if (!w) { w = document.createElement('div'); w.className = 'wk-when'; m.appendChild(w); } else w.innerHTML = '';
688
+ SWN.askWhen(w, { since: r.acts.movedOn || '', onPick: (day) => go(to, day) });
689
+ const t = w.querySelector('[data-sw]'); if (t) t.focus();
690
+ m.style.top = Math.max(8, Math.min(b.bottom + 4, innerHeight - m.offsetHeight - 8)) + 'px';
691
+ });
678
692
  m.addEventListener('keydown', (e) => {
679
693
  if (e.key === 'Escape' || e.key === 'Tab') { e.preventDefault(); e.stopPropagation(); closeStageMenu(); el.focus(); return; }
680
694
  if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
@@ -890,11 +904,11 @@ $('#ibBody').addEventListener('drop', async (e) => {
890
904
  moveStage(r, from, to);
891
905
  });
892
906
  /** Move an initiative to another of its stages (POST /api/boards/move), with Undo in the toast: the By stage drag and Work's Stage cell. */
893
- async function moveStage(r, from, to) {
907
+ async function moveStage(r, from, to, happened) {
894
908
  const body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, id: r.id };
895
- const res = await pmPost('/api/boards/move', { ...body, to }).catch(() => null);
909
+ const res = await pmPost('/api/boards/move', { ...body, to, ...(happened ? { happened } : {}) }).catch(() => null);
896
910
  if (!res || !res.ok) { say((res && res.error) || 'It did not move. The server did not say why.'); return; }
897
- say('Moved to ' + to + ' · ' + r.title + '.', async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
911
+ say(r.title + ' · ' + SWN.whenWords('Moved to ' + to, happened), async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
898
912
  load();
899
913
  }
900
914
  /** The step key of one of the board's own stage names, by the same old-name map as the model (lib/board-premium.js OLD_STEP). */
@@ -373,7 +373,7 @@ export function recCore(d) {
373
373
  return R;
374
374
  }
375
375
  /* not the recording tab: the recording tab listens (rec-tab-core.js), and the press there gives the share its permission */
376
- async function inTab(T, id) { goTab(T, tabUrl(id, { ws: (d.ws ? d.ws() : '') || '', go: true })); await readNotes(); return { ok: true, tab: true }; }
376
+ async function inTab(T, id, app) { goTab(T, tabUrl(id, { ws: (d.ws ? d.ws() : '') || '', go: true, app: app || '' })); await readNotes(); return { ok: true, tab: true }; }
377
377
  const setHold = (id) => { HOLD = id ? { id } : null; window.__premiumHolding = HOLD; bump(); };
378
378
  const started = () => { const r = window.__premiumRecorder || R; return r ? r.started() : null; };
379
379
  const C = {
@@ -385,7 +385,7 @@ export function recCore(d) {
385
385
  const T = ownTab() ? openTab(null) : null; // before the first await, so the browser lets the tab open
386
386
  const made = await d.pmPost('/api/notes/new', noteBody(row));
387
387
  if (!made || made.ok !== true) { dropTab(T); return { ok: false, error: (made && made.error) || 'The note was not made.' }; }
388
- return T ? inTab(T, made.note.id) : C.resume(made.note.id);
388
+ return T ? inTab(T, made.note.id, row && row.app) : C.resume(made.note.id);
389
389
  },
390
390
  /** New meeting: an untitled note with no calendar event, listened to at once (the console's recordNew). */
391
391
  async fresh() {
@@ -5,7 +5,8 @@
5
5
  * press brings the recording tab forward. Only the recording tab controls the meeting; the channel below carries its state, never a press.
6
6
  *
7
7
  * TAB, MAIN the window names: the recording tab, and the PMOS tab its links open in
8
- * tabUrl(id, { ws, go }) the recording tab's address for one note; go: start listening when it opens
8
+ * tabUrl(id, { ws, go, app }) the recording tab's address for one note; go: start listening when it opens; app: meet | zoom | other,
9
+ * where the Listen sheet starts (meeting-buddy)
9
10
  * isTab() this page is the recording tab
10
11
  * ownTab() a Record pressed on this page records in the recording tab (not on a phone, not in the recording tab;
11
12
  * a browser under automation only when the suite asks with window.__pmRecOwnTab)
@@ -20,7 +21,9 @@ export const TAB = 'pmos-rec';
20
21
  export const MAIN = 'pmos-main';
21
22
  const CHANNEL = 'pmos-rec';
22
23
 
23
- export const tabUrl = (id, { ws = '', go = false } = {}) => '/premium-rec.html?note=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) : '') + (go ? '&go=1' : '');
24
+ const APPS = ['meet', 'zoom', 'other'];
25
+ /** app: where the meeting is (meeting-buddy): the recording tab's Listen sheet opens on it. */
26
+ export const tabUrl = (id, { ws = '', go = false, app = '' } = {}) => '/premium-rec.html?note=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) : '') + (go ? '&go=1' : '') + (APPS.includes(app) ? '&app=' + app : '');
24
27
  export const isTab = () => typeof location !== 'undefined' && /^\/premium-rec(\.html)?$/.test(location.pathname);
25
28
  const phone = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
26
29
  export function ownTab() {
@@ -0,0 +1,27 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>PMOS · Meeting buddy</title>
8
+ <!-- The meeting buddy (initiative meeting-buddy; Exploring 2, "Meeting buddy and one-press start", boards 1, 2 and 4). The PMOS extension frames
9
+ it over a Google Meet call: /premium-buddy.html?meet=<abc-defg-hij>&mtitle=<tab title>. It can also name its meeting: ?event=<id>&date=YYYY-MM-DD.
10
+ Only the PM sees it. Its links open in a new tab, so the call never navigates away. pm/cozy-buddy.js draws it. -->
11
+ <base target="_blank" />
12
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
13
+ <link rel="stylesheet" href="/pm/cozy.css" />
14
+ <link rel="stylesheet" href="/pm/cozy-buddy.css" />
15
+ </head>
16
+ <body class="cz mb-page">
17
+ <main class="mb" id="mb">
18
+ <header class="mb-h"><i class="mb-dot" id="mbDot" aria-hidden="true"></i><b>PMOS</b><span class="mb-sm" id="mbHead">Looking for the meeting</span>
19
+ <button type="button" class="mb-ib" id="mbFold" aria-expanded="true" aria-label="Fold PMOS" title="Fold PMOS"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg></button></header>
20
+ <section class="mb-b" id="mbBody" aria-live="polite"></section>
21
+ <p class="mb-msg" id="mbMsg" role="status" hidden></p>
22
+ <form class="mb-ask" id="mbAsk" hidden><input type="text" id="mbQ" autocomplete="off" aria-label="Ask PMOS. Only you see this." placeholder="Ask PMOS. Only you see this." maxlength="1000" />
23
+ <button type="submit" class="mb-ib go" aria-label="Ask PMOS" title="Ask PMOS"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12l16-8-6 16-3-7z"/></svg></button></form>
24
+ </main>
25
+ <script type="module" src="/pm/cozy-buddy.js"></script>
26
+ </body>
27
+ </html>