create-pmos 0.419.0 → 0.420.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 (58) hide show
  1. package/package.json +13 -18
  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/scripts/lane-defs.js +14 -1
  6. package/payload/scripts/workflow-state.js +2 -2
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/briefing-premium-board-test.js +9 -13
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/fixtures/report-api/draft.json +2 -1
  11. package/workspace/guide/home.md +2 -0
  12. package/workspace/home-other-product-test.js +18 -0
  13. package/workspace/home-rows-test.js +14 -0
  14. package/workspace/lib/board-premium.js +13 -3
  15. package/workspace/lib/brief.js +5 -0
  16. package/workspace/lib/engine/lane-defs.js +14 -1
  17. package/workspace/lib/engine/workflow-state.js +2 -2
  18. package/workspace/lib/hold-spans.js +64 -0
  19. package/workspace/lib/mention-store.js +49 -13
  20. package/workspace/lib/plan-tree.js +1 -1
  21. package/workspace/lib/report-draft.js +6 -0
  22. package/workspace/lib/routes-boards.js +22 -6
  23. package/workspace/lib/source-reads.js +5 -0
  24. package/workspace/lib/vendor/scripts/lane-defs.js +14 -1
  25. package/workspace/lib/vendor/scripts/workflow-state.js +2 -2
  26. package/workspace/package-lock.json +2 -2
  27. package/workspace/package.json +1 -1
  28. package/workspace/public/pm/bd-acts.js +49 -1
  29. package/workspace/public/pm/bd-ini-panel.js +15 -8
  30. package/workspace/public/pm/bd-next.js +119 -0
  31. package/workspace/public/pm/bd-prog.js +1 -1
  32. package/workspace/public/pm/bd-span.js +117 -22
  33. package/workspace/public/pm/bd-views.js +7 -5
  34. package/workspace/public/pm/cozy-board.css +54 -9
  35. package/workspace/public/pm/cozy-today.css +9 -0
  36. package/workspace/public/pm/cozy-viewer.js +7 -3
  37. package/workspace/public/pm/cozy.css +10 -0
  38. package/workspace/public/pm/home-app.js +39 -13
  39. package/workspace/public/pm/home-ini.js +42 -11
  40. package/workspace/public/pm/home-list.js +22 -2
  41. package/workspace/public/pm/home-mentions.js +1 -1
  42. package/workspace/public/pm/home-today.js +13 -2
  43. package/workspace/public/pm/ini-tasks.js +363 -0
  44. package/workspace/public/pm/ini-view-model.js +19 -11
  45. package/workspace/public/pm/ini-view.css +160 -0
  46. package/workspace/public/pm/ini-view.js +39 -8
  47. package/workspace/public/pm/premium-board.js +54 -17
  48. package/workspace/public/pm/premium-vw-mtg.js +2 -0
  49. package/workspace/public/pm/task-card.js +6 -0
  50. package/workspace/skills/day-check.skill +2 -2
  51. package/workspace/skills/morning-brief.skill +1 -1
  52. package/workspace/skills/sources-read.skill +8 -4
  53. package/workspace/task-press-test.js +120 -0
  54. package/workspace/task-views-test.js +245 -0
  55. package/workspace/test-lists/task-press.json +6 -0
  56. package/workspace/test-lists/task-views.json +6 -0
  57. package/workspace/test-lists/timeline-holds.json +6 -0
  58. package/workspace/timeline-holds-test.js +191 -0
@@ -236,7 +236,8 @@ function recOf() { // a recording that is on and is no calendar meeting: the T
236
236
  const r = recLive(); if (!r) return null;
237
237
  const n = REC && REC.note ? REC.note(r.id) : null;
238
238
  const meeting = !!(n && (n.meeting || n.event || n.calendar));
239
- return { id: r.id, title: r.title || (n && n.title) || '', at: (REC && REC.started && REC.started()) || (n && (n.started || n.created)) || null, paused: !!(n && n.state === 'paused'), meeting };
239
+ const event = n && n.meeting && n.meeting.kind === 'event' ? n.meeting : null; // which meeting it is, when meetings overlap
240
+ return { id: r.id, title: r.title || (n && n.title) || '', at: (REC && REC.started && REC.started()) || (n && (n.started || n.created)) || null, paused: !!(n && n.state === 'paused'), meeting, event };
240
241
  }
241
242
  function todayModel() {
242
243
  // a recording that is on is the pinned row at the top of the list (XvARecHome): the Today card does not say it again; its pause and stop are in the meeting
@@ -306,7 +307,7 @@ function imRowOf(id) {
306
307
  const M = S.IM && S.IMid === id ? S.IM : null; if (!M) return null;
307
308
  const stage = (M.head && M.head.stage) || '', k = STEPS.findIndex((x) => x.label === stage);
308
309
  return { id, key: 'board:' + id, title: M.title || id, lane: M.lane || null, track: { k, key: k >= 0 ? STEPS[k].key : null, label: stage },
309
- tasks: ((M.tasks && M.tasks.rows) || []).filter((x) => x.pmos && x.uid).map((x) => ({ uid: x.uid, title: x.title, status: x.state || 'To do', end: x.end || '', owner: x.owner || '' })) };
310
+ tasks: ((M.tasks && M.tasks.rows) || []).filter((x) => x.pmos && x.uid).map((x) => ({ uid: x.uid, title: x.title, status: x.state || 'To do', start: x.start || '', end: x.end || '', owner: x.owner || '' })) };
310
311
  }
311
312
  function iniRowOf(id) { return H.boardRows(S.D).find((r) => r.id === id) || (otherIni(id) || {}).row || null; }
312
313
  /** An initiative of another product Home reads (D.others): its row, and the workspace and board it is read from. Null for the board's own. */
@@ -513,8 +514,11 @@ function chatHeadOf(t, r, title) {
513
514
  return { row: r || ir, title, scope: ini ? iniTitle(ini) : '', at: b ? L.rowAt({ ...b, stage }) : L.stageAt(stage), steps: L.ownSteps(b), stage };
514
515
  }
515
516
  function scopeItems() {
517
+ const cur = chat.current(), fresh = cur && cur.newChat;
516
518
  return [{ label: 'All work', sub: 'Home', go: () => select(null) }, { label: H.productName(S.D) + ' · product', go: () => goIni('product') }]
517
- .concat(H.boardRows(S.D).map((r) => ({ label: r.title, sub: [r.lane, r.stage].filter(Boolean).join(' · '), go: () => goIni(r.id) })));
519
+ .concat(H.boardRows(S.D).map((r) => ({ label: r.title, sub: [r.lane, r.stage].filter(Boolean).join(' · '), go: () => goIni(r.id) })))
520
+ // a product's chat or an initiative's: a fresh conversation in the same place, beside its first (batch 9 item 3)
521
+ .concat(fresh ? [{ sep: true }, { label: 'A new session', sub: 'A fresh conversation in ' + cur.about, go: fresh }] : []);
518
522
  }
519
523
  function toItems(cur) {
520
524
  const id = S.ini, at = cur && cur.key;
@@ -559,7 +563,7 @@ const scopeOf = (ini) => (ini ? { text: iniTitle(ini), icon: I.flag } : { text:
559
563
  const rich = () => !!S.ini;
560
564
  function iniTarget(id) {
561
565
  const h = S.H || {};
562
- return { key: 'init:' + id, ini: id, ws: (otherIni(id) || {}).ws || WS || undefined, title: iniTitle(id), sub: (S.IMid === id && h.stage) || '', scope: scopeOf(id), rich: true, placeholder: 'Message Claude about ' + iniTitle(id),
566
+ return { key: 'init:' + id, ini: id, ws: (otherIni(id) || {}).ws || WS || undefined, title: iniTitle(id), about: iniTitle(id), newChat: () => newIn(id), sub: (S.IMid === id && h.stage) || '', scope: scopeOf(id), rich: true, placeholder: 'Message Claude about ' + iniTitle(id),
563
567
  empty: 'Ask about ' + iniTitle(id) + '. Claude reads its records and works in a real Claude Code session.', also: alsoOf(id),
564
568
  // the initiative's conversation opens on where it stands (AgInitYou), until it has messages of its own
565
569
  intro: S.IMid === id && h.cur ? { role: CLAUDE, onlyEmpty: true, text: h.cur + '. ' + h.doneOf + '.' + (h.rest.length ? ' Waiting: ' + h.rest.map((x) => x.label).join(', ') + '.' : ''), pills: [{ label: h.cta, primary: true, go: () => cta() }, { label: 'Discuss', go: () => chat.focus() }] } : undefined, context: h.payoff ? 'Initiative ' + id + ': ' + (h.stage || '') + '. ' + (h.time || '') : undefined };
@@ -643,7 +647,7 @@ function updateTarget() {
643
647
  /** The product's own conversation (its heading's name, HbCProduct): Claude with the product's goals as its context. */
644
648
  function productTarget() {
645
649
  const name = H.productName(S.D), C = H.productCard(S.D, S.D.now);
646
- return { key: 'chat:product', ini: 'product', ws: WS || undefined, title: name, sub: 'Product', scope: scopeOf('product'), rich: false, role: CLAUDE, to: null,
650
+ return { key: 'chat:product', ini: 'product', ws: WS || undefined, title: name, about: name, newChat: () => newProduct(productTarget()), sub: 'Product', scope: scopeOf('product'), rich: false, role: CLAUDE, to: null,
647
651
  placeholder: 'Message Claude about ' + name, empty: 'Ask about ' + name + '. Claude reads its goals, its initiatives and this week\'s update.',
648
652
  context: 'Product ' + name + '. ' + C.of + (C.items.length ? ': ' + C.items.map((x) => x.label).join('; ') : '') + '.', also: null };
649
653
  }
@@ -763,9 +767,11 @@ function goOtherProduct(g) {
763
767
  S.ini = null; S.sel = null; S.IM = null; S.head = g.key;
764
768
  if (isPhone()) sheet(false);
765
769
  syncUrl(); drawList();
766
- openTarget({ key: 'chat:product:' + ws, ws, title: name, sub: 'Product', scope: { text: name + ' · product', icon: I.flag }, rich: false, role: CLAUDE, to: null,
770
+ const t = { key: 'chat:product:' + ws, ws, title: name, about: name, sub: 'Product', scope: { text: name + ' · product', icon: I.flag }, rich: false, role: CLAUDE, to: null,
767
771
  placeholder: 'Message Claude about ' + name, empty: 'Ask about ' + name + '. Claude reads its goals, its initiatives and this week\'s update.',
768
- context: 'Product ' + name + '. ' + C.of + (C.items.length ? ': ' + C.items.map((x) => x.label).join('; ') : '') + '.', also: null });
772
+ context: 'Product ' + name + '. ' + C.of + (C.items.length ? ': ' + C.items.map((x) => x.label).join('; ') : '') + '.', also: null };
773
+ t.newChat = () => newProduct(t);
774
+ openTarget(t);
769
775
  pushPage();
770
776
  const own = '/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product';
771
777
  VW.open({ id: 'product:' + ws, kind: 'Product', title: name, icon: 'chart',
@@ -1197,10 +1203,11 @@ function openTerminal(sid) {
1197
1203
  /* ── meetings and the calendar (the Viewer's own modules, through window.czViews) ── */
1198
1204
  const views = import('./premium-vw-open.js').catch(() => null);
1199
1205
  async function V() { await views; return window.czViews || {}; }
1200
- async function openMeeting(m) {
1206
+ async function openMeeting(m, x = {}) {
1201
1207
  const v = await V();
1202
- if (typeof v.openMeeting === 'function') return v.openMeeting(m.note ? { note: m.note } : m, { ws: deskWs() });
1203
- try { const M = await import('./premium-vw-mtg.js'); return M.openMeeting(m.note ? { note: m.note } : m, { ws: deskWs() }); } catch { return VW.placeholder('Meeting', { icon: 'meet' }); }
1208
+ const o = { ws: deskWs(), ...(x.record ? { record: true } : {}) };
1209
+ if (typeof v.openMeeting === 'function') return v.openMeeting(m.note ? { note: m.note } : m, o);
1210
+ try { const M = await import('./premium-vw-mtg.js'); return M.openMeeting(m.note ? { note: m.note } : m, o); } catch { return VW.placeholder('Meeting', { icon: 'meet' }); }
1204
1211
  }
1205
1212
  async function openCalendar() {
1206
1213
  const v = await V();
@@ -1241,11 +1248,13 @@ function recLive() {
1241
1248
  function newItems() {
1242
1249
  const here = S.ini && S.ini !== 'product' ? S.ini : null;
1243
1250
  const inis = H.boardRows(S.D);
1251
+ const cur = chat.current(), prod = !here && cur && /^chat:product/.test(cur.key || '') && cur.newChat ? cur : null; // a product's chat is open: its own new session
1244
1252
  return [
1245
1253
  { label: 'A task', sub: 'Choose its initiative first', go: (b) => menu(b, inis.filter(H.OPEN).map((r) => ({ label: r.title, sub: r.stage, go: () => addTaskIn(r.id) }))
1246
1254
  .concat([{ sep: true }, { label: 'Not in an initiative', sub: 'Your own list', go: () => addTaskIn(null) }]), 'Under which initiative') },
1247
1255
  { label: 'Next step of an initiative', sub: 'Open where it waits', go: (b) => menu(b, inis.map((r) => ({ label: r.title, sub: r.stage, go: () => goIni(r.id) })), 'Which initiative') },
1248
- { label: here ? 'New session in ' + iniTitle(here) : 'New session in an initiative', sub: 'A fresh chat with its own history', go: (b) => (here ? newIn(here) : menu(b, inis.map((r) => ({ label: r.title, sub: r.stage, go: () => newIn(r.id) })), 'In which initiative')) },
1256
+ prod ? { label: 'New session in ' + prod.about, sub: 'A fresh chat with its own history', go: () => prod.newChat() }
1257
+ : { label: here ? 'New session in ' + iniTitle(here) : 'New session in an initiative', sub: 'A fresh chat with its own history', go: (b) => (here ? newIn(here) : menu(b, inis.map((r) => ({ label: r.title, sub: r.stage, go: () => newIn(r.id) })), 'In which initiative')) },
1249
1258
  { label: 'Quick ask', sub: 'Your own chat, about all work', go: () => { goHome(); chat.focus(); } },
1250
1259
  { label: 'Something unrelated', sub: 'A loose chat; link it later', go: () => newLoose() },
1251
1260
  { label: 'Record a note now', sub: 'A conversation that is not on the calendar', go: () => MORE.openRecorder().then(() => drawList()) },
@@ -1261,6 +1270,18 @@ function newIn(id) {
1261
1270
  openTarget({ ...iniTarget(id), key: 'init:' + id + ':' + n, title: 'New session · ' + iniTitle(id), empty: 'A new session in ' + iniTitle(id) + '. Say what it is for.' });
1262
1271
  chat.focus();
1263
1272
  }
1273
+ /** A fresh conversation in a product (its heading's chat, the board's own or another product's): the product's chat key with the next free
1274
+ * number, so it starts its own session beside the first, as an initiative's new session does (batch 9 item 3). The product stays selected. */
1275
+ function newProduct(t) {
1276
+ const base = String(t.key).replace(/:\d+$/, '');
1277
+ const used = new Set(S.D.sessions.map((s) => H.keyOfSession(s)).filter(Boolean));
1278
+ let n = 2; while (used.has(base + ':' + n)) n++;
1279
+ S.sel = null;
1280
+ S.phoneChat = isPhone();
1281
+ drawList();
1282
+ openTarget({ ...t, key: base + ':' + n, title: 'New session · ' + t.about, empty: 'A new session in ' + t.about + '. Say what it is for.' });
1283
+ chat.focus();
1284
+ }
1264
1285
  function newLoose() {
1265
1286
  const d = new Date(), p = (x) => String(x).padStart(2, '0');
1266
1287
  const key = 'chat:loose-' + d.getFullYear() + p(d.getMonth() + 1) + p(d.getDate()) + '-' + p(d.getHours()) + p(d.getMinutes()) + p(d.getSeconds());
@@ -1417,8 +1438,12 @@ function capMic(input, b) {
1417
1438
  async function todayPress(k, b) {
1418
1439
  const T = todayModel();
1419
1440
  if (k === 'cal') { if (isPhone()) day(true); else openCalendar(); return; }
1420
- if ((k === 'prep' || k === 'open') && T.meeting) { openMeeting(T.meeting); return; }
1421
- if (k === 'record') { MORE.openRecorder().then(() => drawList()); return; }
1441
+ // a line under the card (data-hm-mi) acts on its own meeting: overlapping meetings each open and record (batch 9 item 2)
1442
+ const mi = b && b.dataset.hmMi != null ? (T.also || [])[+b.dataset.hmMi] : null;
1443
+ const m = mi ? mi.meeting : T.meeting;
1444
+ if ((k === 'prep' || k === 'open') && m) { openMeeting(m); return; }
1445
+ // Record records the meeting it sits on: its page opens and asks the PM to tell everyone first; with no meeting it is a note now
1446
+ if (k === 'record') { if (m) openMeeting(m, { record: true }); else MORE.openRecorder().then(() => drawList()); return; }
1422
1447
  if (k === 'hl') { const r = REC && await REC.highlight(); toast(r && r.ok ? 'Highlighting the last 30 seconds and the next ones.' : (r && r.error) || 'The highlight did not start.'); return; }
1423
1448
  if (k === 'pause' || k === 'resume' || k === 'stop') {
1424
1449
  if (!REC || T.mode !== 'rec') return;
@@ -1456,6 +1481,7 @@ function cta() {
1456
1481
  /* ── start ── */
1457
1482
  mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni: (id, pre) => iniRenameOf(id, pre), renameTask: (t) => taskRenameOf(t), load: () => load(), loadIni: () => loadIni(), openFile: (f) => openFile(f), iniTitle: (id) => iniTitle(id), drawList: () => drawList(), wait: MORE.WAIT,
1458
1483
  // the initiative's page (HbCDesk): its card, its header and its ⋯
1484
+ openBoardTask: (t) => openBoardTask(t),
1459
1485
  cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), talk: () => talk(), view: (id) => iniViewOf(id), head: (id) => (S.H = headOf(id)), goProgram: (id) => goProgram(id),
1460
1486
  foldCard: () => { S.cardFold = !S.cardFold; store.set('pmos.home.cardfold', S.cardFold ? '1' : null); } });
1461
1487
  /* The program panel in Home's Viewer (HbCProg): Home's board model and programs; an initiative of it opens here, with ← back to the program.
@@ -267,7 +267,7 @@ function pageHtml(id, M) {
267
267
  // a phone: the page is a sheet over the list, and the chat is one press away (HbCPhone)
268
268
  const talk = isPhone() ? `<button type="button" class="hi-talk" data-hi-talk>Message Claude about ${esc(X.ctx.iniTitle(id))}</button>` : '';
269
269
  return `<div class="hi-v hi-page" data-hi-v="page">${WF.endedHtml(rowOf(id))}`
270
- + viewHtml(v, { add: true, adding: ADDING === id, next: !!v.stage.next, openTask: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
270
+ + viewHtml(v, { add: true, adding: ADDING === id, next: !!v.stage.next, openTask: true, quick: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
271
271
  + `${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
272
272
  }
273
273
  /** The one view's presses on Home's page. */
@@ -275,19 +275,21 @@ function wirePage(b, id) {
275
275
  const C = X.ctx, say = (m) => C.toast(m);
276
276
  wireView(b, {
277
277
  redraw: () => redrawView(),
278
+ // one press on the box marks done, with Undo in the toast (batch 9 item 5b); the caret and the date press change the rest
278
279
  check: async (uid, btn) => {
279
- const M = curM(); if (!M) return;
280
- const done = btn.getAttribute('aria-pressed') === 'true';
281
- const r = await C.pmPost('/api/boards/tasks/state', { ...bw(M), task: uid, state: done ? 'To do' : 'Done' });
282
- if (!r || r.ok === false) { say((r && r.error) || 'Nothing was changed.'); return; }
283
- await C.load(); redrawView();
280
+ await setState(id, uid, btn.getAttribute('aria-pressed') === 'true' ? 'To do' : 'Done');
284
281
  },
282
+ status: (uid, state) => setState(id, uid, state),
283
+ dates: (uid, patch) => setDates(id, uid, patch),
285
284
  openTask: (uid) => {
286
- const M = curM(); if (!M) return;
287
- const row = (M.tasks.rows || []).find((x) => x.uid === uid || x.key === uid || x.key === 'task:' + uid);
288
- // a task the model does not hold yet still opens its own editor, never the old Tasks list (batch 7 item 7)
289
- const key = row ? row.key : 'task:' + uid;
290
- C.VW.drill(); openTask(id, M, key);
285
+ const M = curM();
286
+ const row = M && (M.tasks.rows || []).find((x) => x.uid === uid || x.key === uid || x.key === 'task:' + uid);
287
+ if (row) { C.VW.drill(); openTask(id, M, row.key); return; }
288
+ // the page draws the board's row: a task the initiative's own read does not hold (or has not read yet) opens in the one task editor from
289
+ // that row, never a dead end (batch 9 item 5a: a press did nothing; batch 7 item 7: never the old Tasks list)
290
+ const r = rowOf(id), k = (r.tasks || []).find((x) => x.uid === uid);
291
+ if (k && C.openBoardTask) { C.VW.drill(); C.openBoardTask({ ...k, ini: id, ws: (M && M.board.ws) || r.ws || undefined, board: (M && M.board.id) || r.boardId || undefined }); return; }
292
+ if (M) { C.VW.drill(); openTask(id, M, 'task:' + uid); }
291
293
  },
292
294
  add: () => { ADDING = id; redrawView(); const f = BODY && BODY.querySelector('#ivAddTask'); if (f) f.focus(); },
293
295
  addCancel: () => { ADDING = null; redrawView(); },
@@ -308,6 +310,35 @@ function wirePage(b, id) {
308
310
  wf: (btn) => WF.openPicker(btn, wfUi(), id),
309
311
  });
310
312
  }
313
+ /** A task of the initiative as the one view reads it: the board row's (status, start, end), else the page's own read (state, start, end). */
314
+ function taskAt(id, uid) {
315
+ const k = (rowOf(id).tasks || []).find((x) => x.uid === uid); if (k) return k;
316
+ const M = curM(), x = M && ((M.tasks && M.tasks.rows) || []).find((y) => y.uid === uid);
317
+ return x ? { uid, title: x.title, status: x.state || 'To do', start: x.start || '', end: x.end || '', item: !x.pmos } : null;
318
+ }
319
+ /** The quick status (the box, its caret, a Kanban drag): POST /api/boards/tasks/state, Undo puts the old state back. A breakdown item set
320
+ * to Won't do is withdrawn, which the ledger cannot undo, so that toast has no Undo. */
321
+ async function setState(id, uid, state) {
322
+ const M = curM(); if (!M) return;
323
+ const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid };
324
+ const r = await C.pmPost('/api/boards/tasks/state', { ...body, state });
325
+ if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
326
+ await C.load(); redrawView();
327
+ const was = k && k.status;
328
+ if (was && was !== state && !(k.item && state === "Won't do")) undoToast(state + ': ' + k.title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/state', { ...body, state: was }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
329
+ else C.toast(state + (k ? ': ' + k.title : '') + '.');
330
+ }
331
+ /** The quick dates (the date press, a Timeline drag): POST /api/boards/tasks/edit, Undo puts the old days back. */
332
+ async function setDates(id, uid, patch) {
333
+ const M = curM(); if (!M) return;
334
+ const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid };
335
+ const r = await C.pmPost('/api/boards/tasks/edit', { ...body, ...patch });
336
+ if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
337
+ await C.load(); redrawView();
338
+ const back = {}; for (const f of Object.keys(patch)) back[f] = k ? (f === 'due' ? k.end : k[f]) || '' : '';
339
+ if (k) undoToast('Dates saved: ' + k.title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
340
+ else C.toast('Dates saved.');
341
+ }
311
342
  /** ⋯ of the page (HbCMore): change it, look at it elsewhere, then stop it, red and last. */
312
343
  function pageMore(id) {
313
344
  const M = curM(); if (!M) return [];
@@ -282,6 +282,25 @@ export function dayLoad(today, now = Date.now()) {
282
282
  const sub = L.length ? plural(L.length, 'meeting', 'meetings') + ' · ' + dur + ' · first at ' + hm(L[0].m.start) : 'No meeting today';
283
283
  return { segs: L.length ? segs : [], sub, n: L.length };
284
284
  }
285
+ /* Overlapping meetings (batch 9 item 2): the card leads with one meeting; the others on now, or starting in 15 minutes, sit under it as one
286
+ * compact line each, with their own Open and Record. At most two, the earliest first. */
287
+ const SOON_MS = 15 * 60000, ALSO_MAX = 2;
288
+ const evKey = (m) => (m ? String(m.id || '') || minuteKey(m.start) + '|' + String(m.title || '') : '');
289
+ const minuteKey = (iso) => { const t = Date.parse(iso || ''); return Number.isNaN(t) ? '' : String(Math.floor(t / 60000)); };
290
+ /** Does the recording that is on belong to this meeting? rec.event is the note's meeting ({ event_id, start, title }); an old note without it
291
+ * counts for the meeting the card leads with. */
292
+ function recFor(rec, m) {
293
+ const e = rec && rec.meeting && rec.event;
294
+ if (!e) return false;
295
+ if (e.event_id && m.id) return e.event_id === m.id;
296
+ return minuteKey(e.start) !== '' && minuteKey(e.start) === minuteKey(m.start) && String(e.title || '').trim() === String(m.title || '').trim();
297
+ }
298
+ const recIs = (rec, lead, also) => !!(rec && rec.meeting) && (recFor(rec, lead) || (!rec.event) || !also.some((x) => x.rec));
299
+ function alsoOf(t, lead, now, rec) {
300
+ return t.filter((m) => m !== lead && evKey(m) !== evKey(lead) && m.state !== 'past' && (m.state === 'now' || (Date.parse(m.start) > now && Date.parse(m.start) - now <= SOON_MS)))
301
+ .sort((a, b) => Date.parse(a.start) - Date.parse(b.start)).slice(0, ALSO_MAX)
302
+ .map((m) => { const on = m.state === 'now'; return { meeting: m, title: m.title, time: hm(m.start), when: on ? 'live' : 'in ' + Math.max(1, Math.round((Date.parse(m.start) - now) / 60000)) + ' min', live: on, rec: recFor(rec, m) }; });
303
+ }
285
304
  const listWords = (a) => (a.length <= 1 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
286
305
  /** The card's mode and words. o: { now, rec: { id, title, at, paused, meeting } | null, hidden (the end-of-day card was closed today), titleOf(ini) } */
287
306
  export function todayCard(D, o = {}) {
@@ -297,7 +316,8 @@ export function todayCard(D, o = {}) {
297
316
  if (nowM) {
298
317
  const mins = Math.max(0, Math.round((now - Date.parse(nowM.start)) / 60000));
299
318
  const done = (nowM.before || []).filter((x) => x && x.done).length, all = (nowM.before || []).length;
300
- return { mode: 'live', meeting: nowM, title: nowM.title, rec: !!(o.rec && o.rec.meeting), mins: mins + ' min', sub: all ? 'To do before: ' + done + ' of ' + all + ' done' : nowM.people && nowM.people.length ? 'With ' + listWords(nowM.people.slice(0, 3)) : 'On now' };
319
+ const also = alsoOf(t, nowM, now, o.rec);
320
+ return { mode: 'live', meeting: nowM, title: nowM.title, rec: recIs(o.rec, nowM, also), mins: mins + ' min', sub: all ? 'To do before: ' + done + ' of ' + all + ' done' : nowM.people && nowM.people.length ? 'With ' + listWords(nowM.people.slice(0, 3)) : 'On now', also };
301
321
  }
302
322
  const soon = t.find((m) => m.state !== 'past' && Date.parse(m.start) > now && Date.parse(m.start) - now <= 15 * 60000);
303
323
  if (soon) {
@@ -306,7 +326,7 @@ export function todayCard(D, o = {}) {
306
326
  const todo = (soon.before || []).filter((x) => x && !x.done).length;
307
327
  const parts = [soon.people && soon.people.length ? 'With ' + listWords(soon.people.slice(0, 3)) : '', ini ? titleOf(ini) : '', todo ? plural(todo, 'thing', 'things') + ' to do before' : '', soon.minutes ? soon.minutes + ' min' : ''].filter(Boolean);
308
328
  const link = [soon.join, soon.link, soon.url].find((u) => /^https:\/\//.test(String(u || ''))) || '';
309
- return { mode: 'soon', meeting: soon, time: hm(soon.start), title: soon.title, in: 'in ' + inMin + ' min', sub: parts.join(' · '), link, prep: (soon.prepared || []).length > 0 || todo > 0 };
329
+ return { mode: 'soon', meeting: soon, time: hm(soon.start), title: soon.title, in: 'in ' + inMin + ' min', sub: parts.join(' · '), link, prep: (soon.prepared || []).length > 0 || todo > 0, also: alsoOf(t, soon, now, o.rec) };
310
330
  }
311
331
  const h = new Date(now).getHours();
312
332
  if (h >= 17 && !o.hidden) {
@@ -95,7 +95,7 @@ export function dayLabel(at, now = Date.now()) {
95
95
  /** Where the mention is, the way the frames say it: "Slack #product", "SLV-144 comment", "comment on PRD v3", "email". */
96
96
  export function placeOf(m) {
97
97
  const w = String(m.where || '').trim();
98
- if (m.source === 'slack') return 'Slack' + (w ? ' ' + w : '');
98
+ if (m.source === 'slack') return 'Slack' + (w ? ' ' + w : m.via === 'dm' ? ' DM' : '');
99
99
  if (m.source === 'jira') return (w || 'Jira') + ' comment';
100
100
  if (isDoc(m.source)) return 'comment on ' + (w || srcName(m.source));
101
101
  if (isMail(m.source)) return 'email';
@@ -143,6 +143,17 @@ function looseHtml(g, o) {
143
143
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
144
144
 
145
145
  /* ── the Today card ── */
146
+ /** The other meetings on now or close (T.also): one quiet line each under the card's buttons, with icon-only Open and Record. Each press
147
+ * carries data-hm-mi, the line's place in T.also, so it acts on that meeting and not on the one the card leads with. */
148
+ function alsoHtml(T) {
149
+ if (!T.also || !T.also.length) return '';
150
+ return `<div class="hm-tco" role="group" aria-label="Also now">${T.also.map((x, i) => {
151
+ const say = x.title + ', ' + (x.live ? 'on now' : x.time + ', ' + x.when);
152
+ return `<div class="hm-tcr${x.live ? ' on' : ''}">${x.rec ? '<span class="ut-rec" aria-hidden="true"></span>' : svg(P.clock, 15)}<span class="t" title="${esc(x.title)}">${esc(x.title)}</span><span class="w">${esc(x.live ? 'live' : x.when)}</span>`
153
+ + `<button type="button" class="ut-ib" data-hm-tc="open" data-hm-mi="${i}" aria-label="Open ${esc(say)}" title="Open">${svg(P.chevR, 16)}</button>`
154
+ + (x.rec ? '' : `<button type="button" class="ut-ib" data-hm-tc="record" data-hm-mi="${i}" aria-label="Record ${esc(x.title)}" title="Record">${svg(P.mic, 16)}</button>`) + '</div>';
155
+ }).join('')}</div>`;
156
+ }
146
157
  /** The card's HTML. T is todayCard(); greet the greeting; sub the line under it when the day has no meeting. */
147
158
  export function todayHtml(T, o) {
148
159
  if (T.mode === 'rec') {
@@ -153,11 +164,11 @@ export function todayHtml(T, o) {
153
164
  if (T.mode === 'soon') {
154
165
  return `<div class="hm-tc soon" role="group" aria-label="${esc(T.time + ' ' + T.title + ', ' + T.in)}"><p class="hm-tch">${svg(P.clock, 18)}<b>${esc(T.time)} ${esc(T.title)}</b><span class="r">${esc(T.in)}</span></p>`
155
166
  + (T.sub ? `<p class="sub ut-small">${esc(T.sub)}</p>` : '')
156
- + `<p class="ut-acts"><button type="button" class="ut-btn sm pri" data-hm-tc="prep">Open prep</button>${T.link ? `<a class="ut-btn sm soft" href="${esc(T.link)}" target="_blank" rel="noopener noreferrer">Join</a>` : ''}</p></div>`;
167
+ + `<p class="ut-acts"><button type="button" class="ut-btn sm pri" data-hm-tc="prep">Open prep</button>${T.link ? `<a class="ut-btn sm soft" href="${esc(T.link)}" target="_blank" rel="noopener noreferrer">Join</a>` : ''}</p>${alsoHtml(T)}</div>`;
157
168
  }
158
169
  if (T.mode === 'live') {
159
170
  return `<div class="hm-tc live" role="group" aria-label="${esc(T.title)}, on now"><p class="hm-tch">${T.rec ? '<span class="ut-rec" aria-hidden="true"></span>' : svg(P.clock, 18)}<b>${esc(T.title)} · live</b><span class="r q">${esc(T.mins)}</span></p>`
160
- + `<p class="sub ut-small">${esc(T.sub)}</p><p class="ut-acts"><button type="button" class="ut-btn sm soft" data-hm-tc="open">Open</button>${T.rec ? '<button type="button" class="ut-btn sm ghost" data-hm-tc="hl">Highlight</button>' : '<button type="button" class="ut-btn sm ghost" data-hm-tc="record">Record</button>'}</p></div>`;
171
+ + `<p class="sub ut-small">${esc(T.sub)}</p><p class="ut-acts"><button type="button" class="ut-btn sm soft" data-hm-tc="open">Open</button>${T.rec ? '<button type="button" class="ut-btn sm ghost" data-hm-tc="hl">Highlight</button>' : '<button type="button" class="ut-btn sm ghost" data-hm-tc="record">Record</button>'}</p>${alsoHtml(T)}</div>`;
161
172
  }
162
173
  if (T.mode === 'eod') {
163
174
  return `<div class="hm-tc eod" role="group" aria-label="End of day"><p class="hm-tch"><b>End of day</b><span class="r q">${esc(T.time)}</span><button type="button" class="ut-ib" data-hm-tc="hide" aria-label="Hide until tomorrow" title="Hide until tomorrow">${svg(P.x, 14)}</button></p>`