create-pmos 0.615.0 → 0.617.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 (57) hide show
  1. package/package.json +75 -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/changelog.json +115 -1940
  7. package/workspace/extension/README.md +13 -1
  8. package/workspace/extension/panel.js +7 -5
  9. package/workspace/guide/backlog.md +70 -0
  10. package/workspace/guide/cli.md +1 -0
  11. package/workspace/guide/index.md +1 -0
  12. package/workspace/guide/layout.md +3 -2
  13. package/workspace/guide/notes.md +17 -3
  14. package/workspace/guide/programs.md +1 -1
  15. package/workspace/guide/routine.md +1 -1
  16. package/workspace/lib/backlog.js +323 -0
  17. package/workspace/lib/day-run.js +3 -2
  18. package/workspace/lib/doc-library.js +26 -3
  19. package/workspace/lib/jira-status.js +4 -1
  20. package/workspace/lib/meeting-focus.js +40 -8
  21. package/workspace/lib/mention-cli.js +7 -5
  22. package/workspace/lib/mention-store.js +9 -5
  23. package/workspace/lib/route-modules.js +1 -0
  24. package/workspace/lib/routes-backlog.js +283 -0
  25. package/workspace/lib/routes-boards.js +13 -0
  26. package/workspace/lib/routes-brief-page.js +6 -2
  27. package/workspace/lib/routes-meeting-focus.js +3 -1
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/public/pm/bd-backlog.css +158 -0
  31. package/workspace/public/pm/bd-backlog.js +531 -0
  32. package/workspace/public/pm/bk-model.js +169 -0
  33. package/workspace/public/pm/buddy-core.js +166 -0
  34. package/workspace/public/pm/buddy-press.js +66 -0
  35. package/workspace/public/pm/cozy-buddy.css +52 -0
  36. package/workspace/public/pm/cozy-buddy.js +115 -0
  37. package/workspace/public/pm/cozy-pick.js +6 -3
  38. package/workspace/public/pm/cozy-rec-now.js +35 -4
  39. package/workspace/public/pm/cozy-rec-tab.js +5 -1
  40. package/workspace/public/pm/cozy-routine.js +3 -2
  41. package/workspace/public/pm/cozy-today-app.js +36 -6
  42. package/workspace/public/pm/cozy-today-model.js +49 -12
  43. package/workspace/public/pm/cozy-today-page.css +15 -1
  44. package/workspace/public/pm/cozy-today-view.js +21 -12
  45. package/workspace/public/pm/home-app.js +6 -1
  46. package/workspace/public/pm/mention-one-model.js +6 -4
  47. package/workspace/public/pm/premium-board.js +21 -3
  48. package/workspace/public/pm/premium-goals.js +12 -9
  49. package/workspace/public/pm/premium-library.js +15 -3
  50. package/workspace/public/pm/premium-meeting.js +2 -2
  51. package/workspace/public/pm/rec-tab-core.js +5 -2
  52. package/workspace/public/premium-board.html +1 -0
  53. package/workspace/public/premium-buddy.html +27 -0
  54. package/workspace/server.js +1 -1
  55. package/workspace/skills/morning-brief.skill +1 -1
  56. package/workspace/test-lists/backlog.json +9 -0
  57. package/workspace/test-lists/meeting-buddy.json +9 -0
@@ -15,9 +15,13 @@
15
15
  * The panel has no tabs and no header. Every part is silent at zero: no topics, no prompts, no counts, no answer → no line.
16
16
  * Reads: the tab's own reads (ctx.note(): GET /api/notes/one, for the highlights and the transcript; ctx.focus(): GET /api/meeting-focus, every 15 s),
17
17
  * redrawn on the tab's 'note', 'mode' and 'tick'. After a press, and every 3 s while Claude answers a question, it reads GET /api/meeting-focus itself. Writes, each on a press: POST /api/meeting-focus/raise (✓ raised, ✗ not now, Undo; ✓ on a ✦ Show it? offer starts a live round), POST /api/notes/save
18
- * (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read). */
18
+ * (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read).
19
+ * The meeting buddy's card (meeting-buddy, pm/buddy-core.js heardHtml) sits under Raise now: the consent line, the time nudge, Filed with
20
+ * Undo and the drafts for the call chat; its presses go through pm/buddy-press.js. A chat draft is never a Raise now prompt. */
19
21
  import { pmGet, pmPost } from './http.js';
20
22
  import { agendaHtml, ensureCss as agendaCss, press as agendaPress } from './agenda-live.js';
23
+ import { buddyModel, heardHtml, marksOf } from './buddy-core.js';
24
+ import { press as buddyPress, newMem, mergeMarks } from './buddy-press.js';
21
25
 
22
26
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
27
  const P = {
@@ -54,7 +58,7 @@ export function raiseLabel(r) {
54
58
  }
55
59
 
56
60
  /** What the Now panel shows. F = GET /api/meeting-focus's answer; one = GET /api/notes/one's answer. Nothing is invented. */
57
- export function nowModel(F, one, { now = Date.now() } = {}) {
61
+ export function nowModel(F, one, { now = Date.now(), marks = null } = {}) {
58
62
  const f = F && F.ok ? F : {};
59
63
  const n = one && one.ok && one.note ? one.note : null;
60
64
  const nowMs = Number.isFinite(f.now_ms) ? f.now_ms : now;
@@ -75,7 +79,7 @@ export function nowModel(F, one, { now = Date.now() } = {}) {
75
79
  if (counts.decisions) parts.push(plural(counts.decisions, 'decision', 'decisions'));
76
80
  if (counts.steps) parts.push(plural(counts.steps, 'next step', 'next steps'));
77
81
  if (counts.highlights) parts.push(plural(counts.highlights, 'highlight', 'highlights'));
78
- const raise = (Array.isArray(f.raise) ? f.raise : []).slice(0, 2).map((r) => ({ id: r.id, kind: r.kind, text: r.text, label: raiseLabel(r) }));
82
+ const raise = (Array.isArray(f.raise) ? f.raise : []).filter((r) => r && r.kind !== 'chat').slice(0, 2).map((r) => ({ id: r.id, kind: r.kind, text: r.text, label: raiseLabel(r) }));
79
83
  // the last question asked in this meeting and its answer (or that Claude is on it, or why it failed)
80
84
  const asks = Array.isArray(f.asks) ? f.asks : [];
81
85
  const lastAsk = asks.length ? asks[asks.length - 1] : null;
@@ -94,6 +98,8 @@ export function nowModel(F, one, { now = Date.now() } = {}) {
94
98
  gist: typeof f.gist === 'string' ? f.gist.trim().slice(0, 400) : '',
95
99
  // the agenda in 3 to 5 topics (lib/agenda-topics.js liveModel), drawn the same as the Viewer's Agenda
96
100
  agenda: f.agenda && Array.isArray(f.agenda.topics) && f.agenda.topics.length ? f.agenda : null,
101
+ // the meeting buddy (meeting-buddy): the consent line, the time nudge, Filed with Undo, the drafts for the call chat
102
+ buddy: buddyModel(F, marks || {}),
97
103
  };
98
104
  }
99
105
 
@@ -144,6 +150,8 @@ export function nowHtml(m, { room = false } = {}) {
144
150
  + `<button type="button" class="rn-ib" data-rn="skip" aria-label="Not now" title="Not now">${svg(P.x)}</button></div>`).join('')
145
151
  + '</div></section>';
146
152
  }
153
+ const heard = m.buddy ? heardHtml(m.buddy) : '';
154
+ if (heard) h += `<section class="rn-sec" aria-label="PMOS heard">${room ? '' : '<h5>PMOS heard</h5>'}${heard}</section>`;
147
155
  h += caughtHtml(m);
148
156
  if (m.answer) {
149
157
  const a = m.answer;
@@ -206,6 +214,13 @@ export function mountNow(slots, ctx) {
206
214
  const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-rec-now.css', import.meta.url).href; l.setAttribute('data-rn-css', '');
207
215
  document.head.appendChild(l);
208
216
  }
217
+ if (!document.querySelector('link[data-mb-css]')) {
218
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-buddy.css', import.meta.url).href; l.setAttribute('data-mb-css', '');
219
+ document.head.appendChild(l);
220
+ }
221
+ const ls = () => { try { return window.localStorage; } catch { return null; } };
222
+ const mem = newMem(); // the buddy's marks when the store is blocked
223
+ const marksNow = (F) => mergeMarks(marksOf(ls(), F), mem);
209
224
  const wrap = document.createElement('div');
210
225
  wrap.className = 'rn';
211
226
  wrap.innerHTML = `<div class="rn-nw" data-rn-body></div><p class="rn-err" role="alert" hidden></p>`
@@ -274,7 +289,8 @@ export function mountNow(slots, ctx) {
274
289
  if (stopped) return;
275
290
  place();
276
291
  const one = oneNow();
277
- const h = nowHtml(nowModel(focusNow(), one), { room });
292
+ const F = focusNow();
293
+ const h = nowHtml(nowModel(F, one, { marks: marksNow(F) }), { room });
278
294
  if (h !== last) {
279
295
  // a topic the PM unfolded stays unfolded when the minutes change
280
296
  const opened = new Set([...body.querySelectorAll('details.mg-th[open] > summary b')].map((x) => x.textContent));
@@ -348,6 +364,21 @@ export function mountNow(slots, ctx) {
348
364
  });
349
365
 
350
366
  body.addEventListener('click', async (e) => {
367
+ const mb = e.target.closest('[data-mb]');
368
+ if (mb && !mb.disabled) {
369
+ mb.disabled = true;
370
+ let r = null;
371
+ try { r = await buddyPress(mb, focusNow(), { pmPost, storage: ls(), mem }); } finally { mb.disabled = false; }
372
+ if (!r) return;
373
+ if (r.undo) {
374
+ say(r.msg + ' ', true);
375
+ const u = document.createElement('button'); u.type = 'button'; u.className = 'rn-undo'; u.textContent = 'Undo';
376
+ u.addEventListener('click', async () => { u.disabled = true; const x = await pmPost('/api/notes/bullet', { id: noteId(), bullet: r.undo, drop: false }); say(x && x.ok ? 'Back in the notes.' : 'Not undone: ' + ((x && x.error) || 'no answer'), !!(x && x.ok)); read(); });
377
+ err.appendChild(u);
378
+ } else say(r.msg, true);
379
+ last = ''; if (r.read) read(); else draw();
380
+ return;
381
+ }
351
382
  if (e.target.closest('[data-ag]')) {
352
383
  const f = focusNow();
353
384
  const r = await agendaPress(e.target, f && f.agenda, { ws: ctx.ws });
@@ -1,4 +1,4 @@
1
- /* pm/cozy-rec-tab.js — the recording tab, /premium-rec.html?note=<id>&ws=<ws>[&go=1] (batch 12 item 1, slice S1; canvas In development,
1
+ /* pm/cozy-rec-tab.js — the recording tab, /premium-rec.html?note=<id>&ws=<ws>[&go=1][&app=meet|zoom|other] (batch 12 item 1, slice S1; canvas In development,
2
2
  * XrtA1Tab, XrtA7Room, XrtA6States, XrtA5PhoneRec).
3
3
  *
4
4
  * A meeting records in its own tab, named 'pmos-rec' (rec-tab-core.js). The tab holds the recorder (premium-meeting.js recCore) and
@@ -29,6 +29,7 @@ import { pmGet, pmPost } from './http.js';
29
29
  import { recCore, STOP_LINE } from './premium-meeting.js';
30
30
  import { post, listen, tabUrl, clockOf, modeOf, endOf, marksOf } from './rec-tab-core.js';
31
31
  import { adler } from './cozy-adler.js';
32
+ import { recall, remember } from './listen-sources.js';
32
33
 
33
34
  const q = new URLSearchParams(location.search);
34
35
  const ID = q.get('note') || '', WS = q.get('ws') || '';
@@ -237,6 +238,9 @@ else {
237
238
  await readFocus(); mountSlots();
238
239
  // opened by Record on another page: listen now; the Listen sheet's press here gives the share its permission
239
240
  if (q.get('go') === '1') {
241
+ // started from the meeting's play icon or the buddy (meeting-buddy): the Listen sheet opens on the meeting's app
242
+ const app = q.get('app');
243
+ if (app) { try { const s = window.localStorage; remember(s, { ...recall(s), app }); } catch { /* a blocked store: the sheet keeps the last choice */ } }
240
244
  history.replaceState(null, '', tabUrl(ID, { ws: WS }));
241
245
  if (S.row && S.row.state !== 'recording' && S.row.state !== 'ended') act('start');
242
246
  }
@@ -18,7 +18,7 @@ import * as VW from './cozy-viewer.js';
18
18
  import * as POP from './cozy-popup.js';
19
19
  import { KINDS, routineRows, routineGroups, didLine, kindCounts, productsOf, productName } from './cozy-routine-model.js';
20
20
  import * as PK from './cozy-pick.js'; // the saved product pick of Work, Today and Goals
21
- import { scopeChipHtml, openScope, scopeWords, whenNames, displayName } from './scope-chip.js'; // one chip for products, programs and projects (shared with Events)
21
+ import { scopeChipHtml, openScope, scopeWords, whenNames, displayName, productName as shownName } from './scope-chip.js'; // one chip for products, programs and projects (shared with Events)
22
22
  import { atOf } from './cozy-evmodel.js';
23
23
  import { openReport } from './cozy-routine-pop.js';
24
24
  import { openJob, openNew } from './cozy-routine-job.js'; // reads, jobs, services and your tasks: manage them in the popup (round 3 item 3)
@@ -59,7 +59,8 @@ async function load() {
59
59
  return up && up !== x ? up : null;
60
60
  };
61
61
  const own = displayName; // the chip's rule (pm/scope-chip.js), so the column and the chip agree
62
- S.ws = raw.map((x) => { const m = mainOf(x); return { id: x.id, name: m ? own(m) : own(x), slug: x.name || x.id, main: m ? m.id : null }; });
62
+ await whenNames(); // every page prints a product by the one shared name (productName in pm/scope-chip.js), never a second map
63
+ S.ws = raw.map((x) => { const m = mainOf(x); return { id: x.id, name: shownName(x.id, m ? own(m) : own(x)), slug: x.name || x.id, main: m ? m.id : null }; });
63
64
  const home = (raw.find((x) => x.home) || raw[0] || {}).id; // Horizon scan and Report finder are settings of the home product
64
65
  const per = await Promise.all(S.ws.map((x) => Promise.all([pmGet('/api/report-setups/routine?ws=' + enc(x.id)).catch(() => null), pmGet('/api/autonomy?ws=' + enc(x.id)).catch(() => null)])));
65
66
  const [rf, sc, pk, scan, rs, pg] = await Promise.all([pmGet('/api/refresh').catch(() => null), pmGet('/api/schedules?all=1').catch(() => null), PK.readPick().catch(() => null),
@@ -2,9 +2,10 @@
2
2
  *
3
3
  * mountToday(ctx) once, from home-app.js on today.html (body[data-today]). ctx is what Home already has:
4
4
  * { S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now(), rank() → rankMove's answer, rows() → Home's rows by id (a Map),
5
- * titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m),
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
@@ -14,12 +15,13 @@
14
15
  * a Lab finding kept or dropped (POST /api/lab/*). Each says what it did in the toast, with Undo. Reads: GET /api/today-log, and GET
15
16
  * /api/events-place for the reports that go out today (placed at their time on the agenda). */
16
17
  import * as TM from './cozy-today-model.js';
18
+ import { productName, whenNames } from './scope-chip.js';
17
19
  import * as TP from './cozy-today-view.js';
18
20
  import * as OM from './mention-one-model.js'; // the one mention's title and the self check's proof line (Today round 3)
19
21
 
20
22
  const ASK_SEND = new Set(['session']);
21
23
  export function mountToday(ctx) {
22
- const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), type: '', open: false, hide: new Set() };
24
+ const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set(), type: '', open: false, hide: new Set(), sopen: new Set() };
23
25
  const el = document.getElementById('tdPage');
24
26
  const on = () => !!el && !ctx.isPhone();
25
27
  const day = () => TM.dayKey(ctx.now());
@@ -46,6 +48,12 @@ export function mountToday(ctx) {
46
48
  const tabs = (ctx.S.D.work && ctx.S.D.work.queue && ctx.S.D.work.queue.tabs) || [];
47
49
  return ((tabs.find((t) => t.key === 'today') || { groups: [] }).groups || []).flatMap((g) => g.rows || []);
48
50
  };
51
+ /* a product's display name, never its id (audit round 2): the one name function every page prints (pm/scope-chip.js); redrawn once the names are in */
52
+ let namesIn = false;
53
+ function productOf(ws) {
54
+ if (!namesIn) { namesIn = true; Promise.resolve(whenNames()).then(() => { X.html = ''; draw(); }).catch(() => {}); }
55
+ return productName(ws, '');
56
+ }
49
57
  function models() {
50
58
  const S = ctx.S, D = S.D, now = ctx.now(), byId = ctx.rows();
51
59
  // Your move's rows, with what Home's own rows know of each (its task and its due day): a late task is dated, a next step is not
@@ -55,7 +63,7 @@ export function mountToday(ctx) {
55
63
  const R = ctx.review();
56
64
  const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
57
65
  const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
58
- own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, now });
66
+ own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, productOf, now });
59
67
  const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
60
68
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
61
69
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
@@ -81,7 +89,7 @@ export function mountToday(ctx) {
81
89
  }
82
90
  if (X.type && !(L.types || {})[X.type]) X.type = '';
83
91
  const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
84
- const html = TP.pageHtml(L, A, { draft, overview: O, type: X.type, open: X.open || !!X.type, handled: X.type && X.type !== 'Ask' ? [] : handled(), hopen: X.hopen });
92
+ const html = TP.pageHtml(L, A, { draft, overview: O, type: X.type, open: X.open || !!X.type, handled: X.type && X.type !== 'Ask' ? [] : handled(), hopen: X.hopen, sopen: [...X.sopen] });
85
93
  if (html === X.html && el.firstChild) return;
86
94
  X.html = html;
87
95
  const st = el.parentNode ? el.parentNode.scrollTop : 0;
@@ -89,7 +97,7 @@ export function mountToday(ctx) {
89
97
  if (el.parentNode) el.parentNode.scrollTop = st;
90
98
  const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
91
99
  }
92
- const rowOf = (key) => (X.model ? X.model.rows.find((r) => r.key === key) : null);
100
+ const rowOf = (key) => (X.model ? X.model.rows.flatMap((r) => [r, ...(r.members || [])]).find((r) => r.key === key) : null);
93
101
  const snap = (r) => ({ title: r.title, work: r.work, job: r.job, type: r.type });
94
102
  async function mark1(key, act, extra) {
95
103
  const r = await ctx.pmPost('/api/today-log/mark', { key, act, day: day(), ...extra }).catch(() => null);
@@ -121,6 +129,7 @@ export function mountToday(ctx) {
121
129
  function open(r) {
122
130
  if (!r) return;
123
131
  const ref = r.ref || {};
132
+ if (r.members) { if (X.sopen.has(r.key)) X.sopen.delete(r.key); else X.sopen.add(r.key); draw(); return; } // the same step for N initiatives: list them
124
133
  X.last = r.key; // ↑ ↓ (j k) step from here (round 3 point 6)
125
134
  if (r.src === 'ask') {
126
135
  // a mention opens that one mention in the popup, about it, with the chat hidden (round 3 points 1 to 7); never the Mentions list
@@ -209,6 +218,15 @@ export function mountToday(ctx) {
209
218
  ctx.toastUndo('Dropped from your log.', async () => { const u = await mark(r.key, 'undrop'); after(false); return u; });
210
219
  return after(false);
211
220
  }
221
+ /** ✓ on "N initiatives have no PRD": PMOS starts one draft per initiative, each for the PM to read; ✕ is not offered again for a month. */
222
+ async function same(r, yes) {
223
+ if (!yes) { const m = await mark1(r.key, 'keep', {}); if (!m.ok) return ctx.toast('It did not go through: ' + m.error + '.'); ctx.toast('PMOS will not offer it again for a month.'); return after(false); }
224
+ const ids = r.members.map((x) => x.ref && x.ref.call && x.ref.call.id).filter(Boolean);
225
+ const res = ctx.startCalls ? await ctx.startCalls(ids).catch(() => null) : null;
226
+ if (!res || !res.started) return ctx.toast((res && res.error) || 'PMOS did not start them. Nothing changed.');
227
+ ctx.toast('PMOS started ' + res.started + (res.started === 1 ? ' draft' : ' drafts') + '. Each waits for you to read' + (res.failed ? '; ' + res.failed + ' did not start' : '') + '.');
228
+ return after(true);
229
+ }
212
230
  async function keep(r) {
213
231
  const m = await mark(r.key, 'keep');
214
232
  if (!m.ok) return ctx.toast('It was not kept: ' + m.error + '.');
@@ -305,6 +323,17 @@ export function mountToday(ctx) {
305
323
  return after(false);
306
324
  } finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
307
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
+ }
308
337
  if (act === 'ev') {
309
338
  const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x) return;
310
339
  if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
@@ -322,6 +351,7 @@ export function mountToday(ctx) {
322
351
  else if (act === 'keep') await keep(r);
323
352
  else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
324
353
  else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
354
+ else if (act === 'same-yes' || act === 'same-no') await same(r, act === 'same-yes');
325
355
  } finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
326
356
  });
327
357
  // the first line: Enter adds the row, and nothing else happens (no popup, no session)
@@ -63,6 +63,9 @@ const DECIDE_RE = /^(decide|confirm|choose|pick|approve|accept|sign|agree|review
63
63
  const jobOfAsk = (r) => (r.kind === 'call' ? (r.call && r.call.kind === 'update' ? 'Send' : DECIDE_RE.test(String((r.call && r.call.name) || r.title || '')) ? 'Decide' : 'Do')
64
64
  : r.kind === 'mention' ? 'Reply' : SEND_KINDS.has(r.kind) ? 'Send' : r.kind === 'kr' || r.kind === 'extra' ? 'Do' : 'Decide');
65
65
  const cap1 = (s) => String(s || '').replace(/^[a-z]/, (c) => c.toUpperCase());
66
+ /** No ids in a title (audit round 2): "KR-A1 Signup conversion up: …" reads "Signup conversion up: …". */
67
+ const ID_SHAPED = /^(?:[0-9a-f]{8,}|[a-z0-9]+(?:[-_][a-z0-9]+)+)$/;
68
+ export const noId = (t) => String(t || '').replace(/^(?:[A-Z]{1,4}-[A-Z0-9][\w.]*|health:[\w-]+)\s+/, '');
66
69
  /** An ask's What and Work, split as the board says them: the rank names a row "<work>: <what>" (a verdict, a grill finding, a meeting's or a
67
70
  * program's milestone changes, the changes to keep); What is the thing to do, Work the initiative or program it is about. */
68
71
  export function splitAsk(r, workName) {
@@ -145,6 +148,8 @@ export function logModel(o = {}) {
145
148
  const marks = o.marks || {}, titleOf = typeof o.titleOf === 'function' ? o.titleOf : () => '';
146
149
  const out = [], seen = new Set(), old = [];
147
150
  const work = (ini, fallback) => (ini ? titleOf(ini) || fallback || '' : fallback || '');
151
+ // a product's display name (o.productOf(ws)); a bare id ("pmos-idpf", a hex hash) is never shown
152
+ const productOf = (x) => { const v = String(x || '').trim(); if (!v) return ''; const n = typeof o.productOf === 'function' ? o.productOf(v) || '' : ''; return n || (ID_SHAPED.test(v) ? '' : v); };
148
153
  const put = (r) => {
149
154
  if (!r.key || seen.has(r.key)) return;
150
155
  seen.add(r.key);
@@ -185,8 +190,10 @@ export function logModel(o = {}) {
185
190
  did: didLeft(m).did, ...(m.looks ? { looks: { who: String(m.looks.who || '').trim().split(/\s+/)[0], text: m.looks.text } } : {}) });
186
191
  continue;
187
192
  }
188
- put({ key: c ? 'call:' + c.id : r.key, src: 'ask', bullet: 'task', title: sp.what || r.title || (c && c.name) || '', ini: r.ini || (c && c.ini) || null, ws: r.ws || '',
189
- work: work(r.ini || (c && c.ini), c ? c.sub : (r.shared || [])[0] || '') || sp.work, job: jobOfAsk(r), carried, late: carried >= LATE_DAYS,
193
+ // Work holds an initiative; a product shows by its display name, never its id (audit round 2)
194
+ const prodW = c ? c.sub : (r.shared || []).map((x) => productOf(x)).filter(Boolean)[0] || productOf(r.ws || '');
195
+ put({ key: c ? 'call:' + c.id : r.key, src: 'ask', bullet: 'task', title: noId(sp.what || r.title || (c && c.name) || ''), ini: r.ini || (c && c.ini) || null, ws: r.ws || '',
196
+ work: work(r.ini || (c && c.ini), prodW) || sp.work, job: jobOfAsk(r), carried, late: carried >= LATE_DAYS,
190
197
  when: whenWord({ carried, send }, today), first: r.rank <= 2 || (c && c.kind === 'update' && /^(today|now)/i.test(String(c.when || ''))) || false, ref: r });
191
198
  }
192
199
  // the rest of Your move: the PM's own late tasks and the next steps (a call is in the asks already; an item is in the items)
@@ -227,6 +234,7 @@ export function logModel(o = {}) {
227
234
  const ex = (rank.expired || []).length;
228
235
  if (ex) out.push({ key: 'expired:' + today, keys: ['expired:' + today], src: 'note', bullet: 'note', type: 'Note', first: false, title: plural(ex, 'ask', 'asks') + ' expired after 14 days with no answer. PMOS wrote why in History',
229
236
  work: '', ini: null, ws: '', job: 'Note', when: '', late: false, carried: 0, done: false, drop: false, dates: 'mark', ref: null });
237
+ sameJob(out, marks);
230
238
  const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
231
239
  const n = (j) => open.filter((r) => r.job === j).length;
232
240
  const counts = { decide: n('Decide'), do: n('Do'), reply: n('Reply'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
@@ -241,14 +249,37 @@ export function logModel(o = {}) {
241
249
  const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
242
250
  return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old };
243
251
  }
252
+ /** SAME JOB, MANY INITIATIVES (audit round 2): open asks that read the same for two or more initiatives ("Draft the PRD, or let PMOS draft
253
+ * it" five times) become one row: "5 initiatives have no PRD", its members under it when opened. When each one is a step PMOS drafts, a ✦
254
+ * line says "PMOS drafts them for you to read" with ✓ ✕ (✕ is kept for a month as the mark kept on the group). In place, on out. */
255
+ export function sameJob(out, marks = {}) {
256
+ const by = new Map();
257
+ for (const r of out) {
258
+ if (r.done || r.src !== 'ask' || !r.ref || r.ref.kind !== 'call' || !(r.ini || r.work)) continue;
259
+ const k = r.job + '|' + String(r.title).toLowerCase(); if (!by.has(k)) by.set(k, []); by.get(k).push(r);
260
+ }
261
+ for (const L of by.values()) {
262
+ const inis = new Set(L.map((r) => r.ini || r.work)); if (inis.size < 2) continue; // the initiative, or its name when the call carries no id
263
+ const t = L[0].title, m = /^Draft the (.+?)(?:, or let PMOS draft it)?$/i.exec(t), n = inis.size;
264
+ const key = 'same:' + String(t).toLowerCase().replace(/[^a-z0-9]+/g, '-'), mk = marks[key] || {};
265
+ const at = out.indexOf(L[0]);
266
+ const row = { ...L[0], key, keys: L.flatMap((r) => r.keys || [r.key]), title: m ? n + ' initiatives have no ' + m[1] : n + ' initiatives: ' + t, ini: null, work: '',
267
+ carried: Math.max(...L.map((r) => r.carried || 0)), late: L.some((r) => r.late), first: L.some((r) => r.first), members: L.map((r) => ({ ...r, member: true, title: r.work || r.title, work: '', type: '', job: '', reason: '' })), ref: { kind: 'same' }, // under the group each one is named by its initiative
268
+ drafts: !!m && !(mk.kept), reason: '' };
269
+ row.when = '';
270
+ for (const r of L) out.splice(out.indexOf(r), 1);
271
+ out.splice(Math.min(at, out.length), 0, row);
272
+ }
273
+ return out;
274
+ }
244
275
  /** PMOS HANDLED (design check of round 3, point 6): the asks the self check cleared today from proof (his reply, a closed ticket, the ask
245
276
  * taken back), as the folded last group, each with Undo. answered: the Mentions answered list; o: { today, now, cleared: ids PMOS saw
246
277
  * leave Today today }. A row: { id, title, proof }. An ask whose proof is from today, or that PMOS saw leave today, is one of them. */
247
278
  export function handledModel(answered, o = {}) {
248
279
  const today = o.today || dayKey(o.now || Date.now()), cleared = new Set(o.cleared || []);
249
- return (answered || []).filter((m) => m && m.auto && m.proof && (cleared.has(m.id) || dayKey(Date.parse(m.proof.at || '') || 0) === today))
280
+ return (answered || []).filter((m) => m && m.auto && m.proof && (cleared.has(m.id) || dayKey(Date.parse(m.proof.cleared || m.proof.at || '') || 0) === today))
250
281
  .map((m) => { const who = (Array.isArray(m.people) && m.people.length ? m.people : [m.who || '']).map((x) => String(x).trim().split(/\s+/)[0]).filter(Boolean);
251
- return { id: m.id, title: (who.length ? names(who) + ': ' : '') + askTitle(m), proof: proofText(m.proof, o.now) }; });
282
+ return { id: m.id, title: (who.length ? names(who) + ': ' : '') + askTitle(m), proof: proofText(m.proof, o.now, { full: true }) }; });
252
283
  }
253
284
  /** A task late more than this many days is an old import, not a Today row (round 3 point 12). */
254
285
  export const OLD_TASK_DAYS = 30;
@@ -270,6 +301,7 @@ export function whyOf(r, today) {
270
301
  if (r.src === 'draft') return 'PMOS finished it, needs your look';
271
302
  if (r.src === 'review') return 'Your weekly review is open';
272
303
  if (r.src === 'lab') return 'PMOS found it, keep or drop';
304
+ if (ref.kind === 'same') return ''; // the title says it already; the ✦ line is the whole of it (design check of #1392)
273
305
  if (c) {
274
306
  if (c.kind === 'update') return c.when ? 'Goes out ' + c.when : 'Ready to send';
275
307
  if (c.kind === 'session' && (c.state === 'blocked' || c.state === 'needs')) return 'A session waits on you';
@@ -368,7 +400,10 @@ export function agendaModel(o = {}) {
368
400
  for (const m of o.meetings || []) {
369
401
  if (!m || !m.start || Number.isNaN(Date.parse(m.start)) || dayKey(Date.parse(m.start)) !== today) continue;
370
402
  const s = span(m);
371
- 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' } : {}) });
372
407
  }
373
408
  for (const e of o.own || []) {
374
409
  if (!e || e.bullet !== 'event' || !e.time || e.day !== today || e.done) continue;
@@ -382,18 +417,18 @@ export function agendaModel(o = {}) {
382
417
  items.push({ key: 'r:' + (r.key || r.title), kind: 'report', title: r.title || 'A report', sub: r.time + ' · the report goes out', a: a.getTime(), b: a.getTime() + 30 * 60000, ini: null, ref: r });
383
418
  }
384
419
  items.sort((x, y) => x.a - y.a);
385
- // focus time: the first open row of the log, in the first free stretch of 30 minutes or more from now until 18:00 (a dashed box)
386
- const F = o.focus;
387
- if (F && F.key && F.title) {
420
+ // focus time: the first open row of the log, in the first free gap of 30 minutes or more BETWEEN two events from now (a dashed box; audit
421
+ // round 2: it ends at the next event, never after the last one, and none on a day with no events)
422
+ const F = o.focus, evs = items.filter((y) => y.kind === 'meeting' || y.kind === 'own');
423
+ if (F && F.key && F.title && evs.length) {
388
424
  const end = new Date(now); end.setHours(18, 0, 0, 0);
389
425
  const d8 = new Date(now); d8.setHours(8, 0, 0, 0); // focus time is in the working day: from now, never before 08:00
390
426
  let at = Math.max(Math.ceil(now / (5 * 60000)) * 5 * 60000, d8.getTime()), got = null;
391
- for (const x of items.filter((y) => y.kind !== 'report')) {
427
+ for (const x of evs) { // the gap ends at the next event's start; the stretch after the last event is not a gap
392
428
  if (x.b <= at) continue;
393
429
  if (x.a - at >= 30 * 60000) { got = [at, Math.min(x.a, end.getTime())]; break; }
394
430
  at = Math.max(at, x.b);
395
431
  }
396
- if (!got && end.getTime() - at >= 30 * 60000) got = [at, end.getTime()];
397
432
  if (got && got[1] - got[0] >= 30 * 60000) {
398
433
  items.push({ key: 'f:' + F.key, kind: 'focus', title: F.title, sub: hm(got[0]) + ' to ' + hm(got[1]) + ' · focus time PMOS holds for this call', a: got[0], b: got[1], ini: null, ref: F, row: F.key });
399
434
  items.sort((x, y) => x.a - y.a);
@@ -403,7 +438,7 @@ export function agendaModel(o = {}) {
403
438
  const from = Math.min(8, first), to = Math.max(18, Math.min(24, last));
404
439
  const base = new Date(now); base.setHours(from, 0, 0, 0);
405
440
  const H = 60 * 60000;
406
- 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; }
407
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
408
443
  // meeting is never cut by the next one); each gets its column and the number of columns of its cluster
409
444
  const MIN_BOX = 40 * 60000, endOf = (x) => Math.max(x.b, x.a + MIN_BOX);
@@ -421,7 +456,9 @@ export function agendaModel(o = {}) {
421
456
  const sub = DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()] + (free ? ' · ' + durWord(free) + ' free' : '');
422
457
  const meets = items.filter((x) => x.kind === 'meeting' || x.kind === 'own');
423
458
  const nx = meets.find((x) => x.a >= now);
424
- return { items, from, to, now: t >= 0 && t <= to - from ? t : null, sub, empty: !items.length, free, next: nx ? hm(nx.a) : '', nextFirst: !!nx && !meets.some((x) => x.a < now) };
459
+ // a day with no event: one quiet line, not an empty grid (audit round 2)
460
+ const quiet = meets.length ? '' : 'No events today' + (free ? ' · ' + durWord(free) + ' free' : '');
461
+ return { items, from, to, now: t >= 0 && t <= to - from ? t : null, sub, empty: !items.length, quiet, free, next: nx ? hm(nx.a) : '', nextFirst: !!nx && !meets.some((x) => x.a < now) };
425
462
  }
426
463
 
427
464
  const DOW_LONG = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
@@ -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
 
@@ -156,4 +162,12 @@ button.td-ev:focus-visible { outline: 2px solid var(--cz-blue); outline-offset:
156
162
  /* PMOS handled · N (design check of round 3): the asks the self check cleared today, each with Undo */
157
163
  .td-undo { border: 0; background: none; padding: 4px 6px; font: inherit; font-size: var(--fs-meta); color: var(--cz-blueink); cursor: pointer; }
158
164
  .td-undo:hover, .td-undo:focus-visible { text-decoration: underline; }
159
- .td-r.hd .td-rs { text-decoration: none; }
165
+ .td-r.hd .td-rs { text-decoration: none; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; } /* the proof in full: it is why he can trust it */
166
+ .td-r.hd .td-a { opacity: 1; } /* Undo on every handled row, not only on hover */
167
+ /* audit round 2: the same step for N initiatives lists its members under it when opened; a day with no event is one quiet line */
168
+ .td-t svg { vertical-align: -2px; margin-left: 4px; color: var(--cz-ink3); }
169
+ .td-t[aria-expanded="true"] svg { transform: rotate(180deg); }
170
+ .td-r.mem .td-wt { padding-left: 18px; }
171
+ .td-r.mem .td-t { font-weight: var(--fw-regular); }
172
+ .td-ag.quiet { align-self: start; }
173
+ .td-quiet { margin: 6px 0 0; font-size: var(--fs-row); color: var(--cz-ink2); }
@@ -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 = {
@@ -28,19 +29,22 @@ const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', '
28
29
  const ib = (act, label, d, key, extra = '') => `<button type="button" class="td-ib" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${svg(d)}</button>`;
29
30
 
30
31
  /** One row of the log. */
31
- export function rowHtml(r) {
32
+ export function rowHtml(r, o = {}) {
32
33
  const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
33
34
  const acts = r.done || r.src === 'note' ? '' : r.src === 'lab'
34
35
  ? ib('lab-keep', 'Keep it: start an initiative from ' + r.title, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + r.title, I.no, r.key)
35
36
  : ib('done', 'Done: ' + r.title, I.done, r.key) + ib('tomorrow', 'Move to tomorrow: ' + r.title, I.tomorrow, r.key) + ib('date', 'Set a date: ' + r.title, I.date, r.key, ' aria-haspopup="dialog"');
36
- const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : ''].filter(Boolean).join(' ');
37
+ const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : '', r.member ? 'mem' : ''].filter(Boolean).join(' ');
37
38
  // a note, an own event and a done row open nothing: their words are the whole of it
38
39
  const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
39
- const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
40
+ const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? svg(I.more, 13) : ''}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
40
41
  const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS suggests: drop it from your log.</span>`
41
42
  + ib('drop', 'Drop it', I.yes, r.key) + ib('keep', 'Keep it', I.no, r.key) + '</div>' : '';
42
43
  const lk = r.looks && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
43
44
  + ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key) + ib('lk-no', 'No, it still waits on me', I.no, r.key) + '</div>' : '';
45
+ // the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
46
+ const sj = r.members && r.drafts && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS drafts them for you to read.</span>`
47
+ + ib('same-yes', 'Yes, draft them', I.yes, r.key) + ib('same-no', 'No, not now', I.no, r.key) + '</div>' : '';
44
48
  const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
45
49
  // what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
46
50
  const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
@@ -49,7 +53,7 @@ export function rowHtml(r) {
49
53
  return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done && r.src === 'own' ? '<b aria-label="First">!</b>' : ''}</span>`
50
54
  + `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}${reason}</span>${type}`
51
55
  + `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
52
- + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${lk}${why}</div>`;
56
+ + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${sj}${lk}${why}</div>`;
53
57
  }
54
58
 
55
59
  /** The Overview, one grey box under the head, written by PMOS (✦): where to start and why, the free time, the suggestions with ✓ ✕,
@@ -77,15 +81,17 @@ export function logHtml(L, o = {}) {
77
81
  + `<input id="tdCap" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" />`
78
82
  + `<span class="td-key" id="tdCapKey" aria-label="Start with o for an event, a dash for a note, ! for first">•<em>task</em>o<em>event</em>–<em>note</em>!<em>first</em></span></form>`;
79
83
  const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
84
+ const so = new Set(o.sopen || []);
85
+ const rowHtml1 = (r) => (r.members ? rowHtml(r, { sopen: so.has(r.key) }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r));
80
86
  const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
81
87
  let body = '';
82
- if (first.length) body += groupRow('Do first') + first.map(rowHtml).join('');
83
- if (today.length) body += groupRow('Today') + today.map(rowHtml).join('');
88
+ if (first.length) body += groupRow('Do first') + first.map(rowHtml1).join('');
89
+ if (today.length) body += groupRow('Today') + today.map(rowHtml1).join('');
84
90
  if (wait.length) {
85
91
  const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
86
92
  const said = (first.length || today.length ? wait.length + ' more' : plural2(wait.length)) + (oldest ? ' · the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '');
87
93
  body += `<div class="td-gr" role="row"><span role="cell"><button type="button" class="td-fold" data-td="fold" aria-expanded="${!!o.open}">Can wait <em>${esc(said)}</em>${svg(I.more, 14)}</button></span></div>`;
88
- if (o.open) body += wait.map(rowHtml).join('');
94
+ if (o.open) body += wait.map(rowHtml1).join('');
89
95
  }
90
96
  // PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
91
97
  const hd = o.handled || [];
@@ -119,12 +125,15 @@ export function agendaHtml(A) {
119
125
  const inner = `<b>${mark}${esc(x.title)}</b><small>${esc(x.sub)}</small>`;
120
126
  if (x.kind === 'own' || x.kind === 'report') return `<div class="${cls}" style="${st}" aria-label="${esc(label)}">${inner}</div>`;
121
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>`;
122
- 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>` : '');
123
132
  }).join('');
124
133
  const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
125
- return `<aside class="td-ag" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.sub)}</small>`
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>`
126
135
  + `<a class="td-evl" href="/premium-events.html">Events</a></div>`
127
- + `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`;
136
+ + (A.quiet && !A.items.length ? `<p class="td-quiet">${esc(A.quiet)}</p></aside>` : `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`);
128
137
  }
129
138
 
130
139
  /** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
@@ -2405,7 +2405,12 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
2405
2405
  openMention: (id, o) => { const L = MEN.mentionsOf(S.D), m = [...L.waiting, ...L.toread, ...L.answered].find((x) => x.id === id) || (o && o.m); if (!m) return false; MEN.openOneMention(m, menCtx(), o || {}); return true; },
2406
2406
  mentions: () => MEN.mentionsOf(S.D), mentionAct: (id, act) => pmPost('/api/mentions/act', { id, act }), reloadMentions: () => MEN.load(menCtx()).then(() => drawList()),
2407
2407
  movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
2408
- openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2408
+ // the same step for N initiatives (audit round 2): ✓ starts each one's ✦ proposal (a draft PMOS writes for the PM to read), never more
2409
+ startCalls: async (ids) => { let started = 0, failed = 0; const N = H.needsOf(S.D);
2410
+ 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
+ const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
2412
+ 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), record: (row) => (REC ? REC.record(row) : Promise.resolve({ ok: false, error: 'PMOS is still starting. Press play again in a moment.' })),
2409
2414
  news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2410
2415
  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)) })) });
2411
2416
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
@@ -14,7 +14,7 @@ const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
14
14
  const MO = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
15
15
  const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'email', gmail: 'Gmail', figma: 'Figma', doc: 'the document' };
16
16
  const T = (iso) => { const t = typeof iso === 'number' ? iso : Date.parse(iso || ''); return Number.isFinite(t) ? t : 0; };
17
- const clip = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
17
+ const clip0 = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
18
18
  const first = (who) => String(who || 'someone').replace(/[,;:]+$/, '').trim().split(/\s+/)[0];
19
19
  export const srcName = (s) => SRC[s] || (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : 'its source');
20
20
  const hm = (t) => { const d = new Date(t); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
@@ -37,7 +37,7 @@ export function askTitle(m) {
37
37
  if (!s) return 'An ask';
38
38
  if (notASentence(s)) return asWritten(m);
39
39
  s = s.charAt(0).toUpperCase() + s.slice(1);
40
- return clip(s, 120);
40
+ return clip0(s, 120);
41
41
  }
42
42
  /** The cleaner made no sentence of it ("the PM whether the PM requires …", "for test card details …"): design check of round 3, point 3. */
43
43
  export const notASentence = (s) => /^(the pm|pm|you|him|her|them|for|to|about|that|of)\b/i.test(String(s || '').trim());
@@ -74,10 +74,12 @@ export function blanksOf(text) { const out = []; let m, i = 0; BLANK.lastIndex =
74
74
  export function fill(text, values = []) { let i = 0; return String(text || '').replace(BLANK, (all) => { const v = String(values[i++] || '').trim(); return v || all; }); }
75
75
 
76
76
  /** The proof the self check found, said once: "You replied Tue 17 Nov: “We go with CAS.”" */
77
- export function proofText(p, now = Date.now()) {
77
+ export function proofText(p, now = Date.now(), o = {}) {
78
78
  if (!p) return '';
79
+ const clip = (t, n) => (o.full ? String(t || '').replace(/\s+/g, ' ').trim() : clip0(t, n)); // full: PMOS handled shows the proof whole
79
80
  if (p.how === 'replied') return 'You replied ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
80
81
  if (p.how === 'closed') return 'The ticket is ' + String(p.text || 'closed').toLowerCase() + ' (read ' + whenText(p.at, now) + ')';
82
+ if (p.how === 'others') return (p.who ? first(p.who) : 'Someone') + ' answered ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
81
83
  if (p.how === 'withdrawn') return 'They took the ask back' + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
82
84
  return '';
83
85
  }
@@ -99,7 +101,7 @@ export function didLeft(m, o = {}) {
99
101
  const blanks = m && m.draft ? blanksOf(m.draft) : [];
100
102
  if (m && m.draft && !m.drafted) did.push(blanks.length ? 'started the reply' : 'drafted the reply');
101
103
  if (m && m.drafted) did.push('copied the reply for ' + (typeof m.drafted === 'string' ? m.drafted : src));
102
- if (m && m.task) did.push('made it a task: ' + clip(m.task.title || 'Reply to ' + who, 60));
104
+ if (m && m.task) did.push('made it a task: ' + clip0(m.task.title || 'Reply to ' + who, 60));
103
105
  if (m && m.watch) did.push('is watching for ' + m.watch.what);
104
106
  if (m && m.proof) did.push('checked ' + src + ': ' + proofText(m.proof, o.now).replace(/^You/, 'you').replace(/^The/, 'the').replace(/^They/, 'they'));
105
107
  let left;