create-pmos 0.396.0 → 0.397.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 (98) hide show
  1. package/package.json +13 -13
  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/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +20 -40
  8. package/workspace/briefing-premium-board-test.js +145 -107
  9. package/workspace/briefing-premium-calendar-2-test.js +5 -2
  10. package/workspace/briefing-premium-calendar-3-test.js +13 -8
  11. package/workspace/briefing-premium-calendar-test.js +16 -5
  12. package/workspace/briefing-premium-initiative-test.js +50 -41
  13. package/workspace/briefing-premium-insights-test.js +104 -85
  14. package/workspace/briefing-premium-metrics-test.js +11 -32
  15. package/workspace/briefing-premium-sources-test.js +42 -21
  16. package/workspace/briefing-premium-test.js +112 -98
  17. package/workspace/briefing-premium-work-test.js +78 -64
  18. package/workspace/changelog.json +12 -0
  19. package/workspace/fixtures/board-premium-facts.js +2 -1
  20. package/workspace/fixtures/board-premium-jira.js +28 -0
  21. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  22. package/workspace/fixtures/initiatives-api/list.json +30 -42
  23. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  24. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  25. package/workspace/fixtures/insights-premium-facts.js +11 -2
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/guide/lifecycle.md +51 -0
  28. package/workspace/home-shot.js +38 -0
  29. package/workspace/lib/board-premium.js +92 -1
  30. package/workspace/lib/engine/boards.js +15 -14
  31. package/workspace/lib/engine/nine-stages.js +49 -20
  32. package/workspace/lib/engine/signals/detectors.js +13 -11
  33. package/workspace/lib/insights-premium.js +78 -1
  34. package/workspace/lib/routes-board-premium.js +3 -2
  35. package/workspace/lib/routes-initiatives.js +1 -1
  36. package/workspace/lib/routes-insights-premium.js +8 -1
  37. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/premium-agreed-viewer-shots.js +76 -0
  41. package/workspace/premium-board-actions-test.js +2 -0
  42. package/workspace/premium-chat-chart-tab-test.js +6 -5
  43. package/workspace/premium-chat-context-test.js +8 -6
  44. package/workspace/premium-chat-goal-view-test.js +9 -7
  45. package/workspace/premium-chat-notes-test.js +3 -2
  46. package/workspace/premium-chat-report-tab-test.js +8 -2
  47. package/workspace/premium-chat-term-test.js +3 -1
  48. package/workspace/premium-chat-viewer-test.js +23 -17
  49. package/workspace/premium-core-doc-issue-test.js +2 -0
  50. package/workspace/premium-html-viewer-test.js +4 -2
  51. package/workspace/premium-phone-card-test.js +1 -0
  52. package/workspace/premium-phone-room-test.js +16 -11
  53. package/workspace/premium-report-read-test.js +1 -1
  54. package/workspace/premium-vw-backlog-test.js +2 -0
  55. package/workspace/premium-vw-cal-test.js +9 -4
  56. package/workspace/premium-vw-doc-test.js +1 -1
  57. package/workspace/premium-vw-item-test.js +1 -0
  58. package/workspace/premium-vw-jira-test.js +4 -1
  59. package/workspace/premium-vw-notes-test.js +2 -1
  60. package/workspace/premium-vw-rec-test.js +3 -2
  61. package/workspace/premium-vw-slides-test.js +2 -2
  62. package/workspace/premium-work-depth-test.js +7 -3
  63. package/workspace/public/pm/bd-span.js +120 -0
  64. package/workspace/public/pm/bd-stages.js +33 -0
  65. package/workspace/public/pm/cozy-board.css +373 -0
  66. package/workspace/public/pm/cozy-home.css +152 -0
  67. package/workspace/public/pm/cozy-home.js +170 -0
  68. package/workspace/public/pm/cozy-initiative.css +138 -0
  69. package/workspace/public/pm/cozy-insights.css +292 -0
  70. package/workspace/public/pm/cozy-nav.js +54 -0
  71. package/workspace/public/pm/cozy-viewer.css +143 -0
  72. package/workspace/public/pm/cozy.css +172 -0
  73. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  74. package/workspace/public/pm/lifecycle-lens.js +22 -11
  75. package/workspace/public/pm/premium-board.js +329 -67
  76. package/workspace/public/pm/premium-brief.js +1 -1
  77. package/workspace/public/pm/premium-chat.js +17 -10
  78. package/workspace/public/pm/premium-initiative-head.js +138 -0
  79. package/workspace/public/pm/premium-initiative.js +28 -4
  80. package/workspace/public/pm/premium-insights.js +530 -244
  81. package/workspace/public/pm/premium-shell.js +40 -10
  82. package/workspace/public/pm/premium-viewer.js +5 -0
  83. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  84. package/workspace/public/pm/premium-vw-jira.css +11 -0
  85. package/workspace/public/pm/premium-vw-jira.js +11 -4
  86. package/workspace/public/pm/premium-vw-rec.js +5 -2
  87. package/workspace/public/pm/premium-work.js +18 -8
  88. package/workspace/public/pm/premium.js +19 -6
  89. package/workspace/public/premium-board.html +82 -47
  90. package/workspace/public/premium-chat.html +7 -33
  91. package/workspace/public/premium-initiative.html +15 -8
  92. package/workspace/public/premium-insights.html +82 -43
  93. package/workspace/public/premium-work.html +6 -72
  94. package/workspace/public/premium.html +61 -15
  95. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  96. package/workspace/server.js +7 -0
  97. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  98. package/workspace/third-party/README.md +1 -0
@@ -20,6 +20,10 @@ import { mountNotes, openNotes, flushNotes, syncNotes } from './premium-notes.js
20
20
  import { attachMarkup, attachRowMarkup, mountAttach, attachNames, clearAttach, syncAttach, dropFiles, splitFiles, filesHtml, openAttachment } from './premium-attach.js';
21
21
  import { railModel, railHtml, teaser, menuCount, loudestRow, factsOf, titleOf, endAsks, DOT, WORD } from './session-rail.js';
22
22
  export const $ = (s, r = document) => r.querySelector(s);
23
+ /* Home (initiative premium-agreed-design, H2): on a desktop the chat is docked beside Home's list, as the middle and right panes, instead of a
24
+ * popup. It is the Chat page's held-open dialog (chatpg) placed right of the list; on a phone, and on every other page, the dialog stays a popup. */
25
+ if (document.body.classList.contains('cz-home') && innerWidth >= 1000) document.body.classList.add('chatpg', 'cz-dock');
26
+ export const homeDock = () => document.body.classList.contains('cz-dock');
23
27
  export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
24
28
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
25
29
  export const RM = matchMedia('(prefers-reduced-motion: reduce)').matches;
@@ -255,8 +259,10 @@ export function openChatPage(key, label) {
255
259
  ? 'Talk to Claude about ' + label + '. It works in a real Claude Code session: it can read, change files, run commands and take slash commands.'
256
260
  : 'Talk to Claude. It works in a real Claude Code session: it can read, change files, run commands and take slash commands. Pick another session from the list.';
257
261
  openDlg({ eye: label ? 'Chat · ' + label : 'Chat', title: label ? 'Ask about ' + label : 'Chat', say, stream: turnA(ptx(say)), noteKey: key, pane: `<article class="paper doc"><p class="note">${esc(label ? 'This conversation is about ' + label + '. Files Claude opens show here.' : 'Files Claude opens show here.')}</p></article>`, paneEmpty: true, label: label || 'Chat', sessions: true });
258
- $$('.rail').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
259
- $('#veil').classList.remove('on');
262
+ if (chatPage()) { // the held-open chat (desktop Home) leaves the rail live; on a phone Home's chat is a popup and keeps openDlg's veil and inert page
263
+ $$('.rail').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
264
+ $('#veil').classList.remove('on');
265
+ }
260
266
  $('#askIn').placeholder = label ? 'Message Claude about ' + label : 'Message Claude, or type /';
261
267
  if (desk()) setFull(true); else setTab('chat');
262
268
  vwShutPane(); // premium-chat-viewer V1: the conversation has the room until something opens in the viewer
@@ -327,8 +333,17 @@ export function openDlg(o) {
327
333
  $('#veil').classList.add('on'); $('#dlg').classList.add('on');
328
334
  $$('#dGrid .pane').forEach((p) => { p.scrollTop = 0; });
329
335
  railOnOpen(o);
336
+ if (homeDock()) dockOpen(o);
330
337
  setTimeout(() => $('#dlg').focus(), 60);
331
338
  }
339
+ /* Home on a desktop: the dialog is the docked chat. The list stays live beside it, nothing is veiled, and the Viewer shows when the row has a
340
+ * detail to show; a placeholder note leaves it folded, and the icon at the chat's top right opens it again. */
341
+ function dockOpen(o) {
342
+ $('#dlg').setAttribute('aria-modal', 'false'); // docked, the list beside it stays live: a modal flag would hide the list from a screen reader
343
+ $('#veil').classList.remove('on'); $$('.rail,main.stage').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
344
+ setFull(true);
345
+ if (o.paneEmpty || o.sessions) vwShutPane(); else vwOpenPane(true);
346
+ }
332
347
  /* The compact head clamps a long title; a press on it shows the whole title and sub line, a second press clamps them again. */
333
348
  $('#dTitle').addEventListener('click', () => { const g = $('#dlg'); if (g.classList.contains('cmp') && innerWidth < 1000) g.classList.toggle('tfull'); });
334
349
  /* A compact dialog on a phone: once the detail scrolls, the head keeps only the title and the tools, so the detail gets the screen.
@@ -349,6 +364,12 @@ export function setFocus(f) {
349
364
  }
350
365
  $('#dFocus').onclick = () => setFocus(!$('#dlg').classList.contains('focus'));
351
366
  export function closeDlg() {
367
+ if (homeDock()) { // Home: closing a row's conversation goes back to your own chat, and the focus goes back to the row that opened it
368
+ const back = lastFocus;
369
+ openChatPage('chat:main', '');
370
+ if (back && back.isConnected && !$('#dlg').contains(back)) setTimeout(() => { try { back.focus(); } catch { /* gone */ } }, 80); // after openDlg's own focus at 60 ms
371
+ return;
372
+ }
352
373
  if (chatPage()) return;
353
374
  clearTimeout(threadTimer); S.key = null; syncTerm(null); flushNotes(); railOnClose();
354
375
  park();
@@ -392,7 +413,9 @@ $('#dTabs').addEventListener('click', (e) => { const b = e.target.closest('[data
392
413
  addEventListener('keydown', (e) => {
393
414
  if (e.key !== 'Escape' || !$('#dlg').classList.contains('on')) return;
394
415
  if (chatPage() && $('#dlg').classList.contains('vw-layer') && !document.querySelector('[data-esc-layer]')) { vwBack(); return; }
395
- if (document.querySelector('[data-esc-layer]') || chatPage()) return; // a layer open over the dialog (a viewer menu, Present) closes itself first
416
+ if (document.querySelector('[data-esc-layer]')) return; // a layer open over the dialog (a viewer menu, Present) closes itself first
417
+ if (homeDock()) { if (S.key !== 'chat:main') closeDlg(); return; } // Home: Escape takes a row's chat back to your own chat, which stays open
418
+ if (chatPage()) return;
396
419
  if ($('#dlg').classList.contains('full')) { setFull(false); e.stopImmediatePropagation(); return; }
397
420
  closeDlg();
398
421
  }, true);
@@ -549,7 +572,7 @@ function ctxPeek(it) {
549
572
  const f = $('#askF'); if (!f) return;
550
573
  if (!b) { f.insertAdjacentHTML('beforebegin', '<button type="button" class="ctxpeek" id="ctxPeek" hidden></button>'); b = $('#ctxPeek'); }
551
574
  b.innerHTML = `<span>${esc(it.sub)} · <b>${esc(it.title)}</b></span><em>View</em>`; b.hidden = false;
552
- b.onclick = () => { ctxPeek(null); if (it.kind === 'goal') openGoal(); else if (it.kind === 'report') openBlockTab(it.block); else openCtx(it, ctxWhere()); };
575
+ b.onclick = () => { ctxPeek(null); if (it.kind === 'goal') openGoal(); else if (it.kind === 'report') openBlockTab(it.block); else openCtx(it, ctxWhere()); if (!desk()) setTab('out'); }; // View shows it: a phone popup (Home's chat) brings its Detail tab forward
553
576
  CTX.peekTimer = setTimeout(() => ctxPeek(null), 15000);
554
577
  }
555
578
  $('#dBody').addEventListener('click', (e) => {
@@ -752,7 +775,7 @@ export function onScroll() {
752
775
  if (!RM) { big.style.transform = `translateY(${-p * 30}px) scale(${1 - p * 0.12})`; big.style.opacity = 1 - p * 0.9; }
753
776
  document.body.classList.toggle('docked', p > 0.62);
754
777
  if (!$('#dlg').classList.contains('on')) $('#dock').inert = p <= 0.62;
755
- $$('.ch').forEach((c) => c.classList.toggle('stuck', c.getBoundingClientRect().top <= 61 && c.closest('.card').getBoundingClientRect().bottom > 140));
778
+ $$('.ch').forEach((c) => { const k = c.closest('.card, .cz-grp'); if (k) c.classList.toggle('stuck', c.getBoundingClientRect().top <= 61 && k.getBoundingClientRect().bottom > 140); });
756
779
  });
757
780
  }
758
781
  addEventListener('scroll', onScroll, { passive: true }); addEventListener('resize', onScroll);
@@ -774,7 +797,7 @@ if (window.visualViewport) {
774
797
  }
775
798
 
776
799
  /* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
777
- const GO = { brief: '/premium.html', work: '/premium-work.html', chat: '/premium-chat.html', init: '/premium-board.html', rep: '/premium-insights.html' };
800
+ const GO = { brief: '/premium.html', work: '/premium.html', chat: '/premium.html', init: '/premium-board.html', rep: '/premium-insights.html' }; // Home holds what Briefing, My work and Chat did (premium-agreed-design H3)
778
801
  /* ── the recording chip: while a note records or is paused, every premium page says so and can stop it (initiative briefing-premium-calendar, slice 3) ───────────────
779
802
  * It reads GET /api/notes. Only the Briefing holds a recorder; the other pages show what the server holds, and Stop there ends the meeting through POST /api/notes/stop. */
780
803
  function mountRecChip(here) {
@@ -905,7 +928,7 @@ const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/>
905
928
  const BELL = '<svg class="i" viewBox="0 0 24 24"><path d="M6 16V11a6 6 0 0 1 12 0v5l2 2H4z"/><path d="M10 20a2 2 0 0 0 4 0"/></svg>';
906
929
  const IC = (d) => `<svg class="i" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
907
930
  const GL = { place: IC('M4 5h16v14H4zM4 10h16'), ini: IC('M12 3l9 9-9 9-9-9z'), doc: IC('M6 3h9l4 4v14H6zM14 3v5h5'), ses: IC('M5 4l14 8-14 8z'), need: IC('M12 4v10M12 18v2') };
908
- const PLACES = [['Briefing', '/premium.html'], ['My work', '/premium-work.html'], ['Board', '/premium-board.html'], ['Insights', '/premium-insights.html']];
931
+ const PLACES = [['Home', '/premium.html'], ['Board', '/premium-board.html'], ['Insights', '/premium-insights.html']];
909
932
  const PV_WS = new URLSearchParams(location.search).get('ws');
910
933
  const pvQ = (sep) => (PV_WS ? sep + 'ws=' + encodeURIComponent(PV_WS) : '');
911
934
  async function pvGet(u) { try { const r = await fetch(u, { credentials: 'same-origin' }); return { status: r.status, j: await r.json() }; } catch { return { status: 0, j: null }; } }
@@ -927,6 +950,7 @@ export function pvClose() {
927
950
  if (pvOv.kind === 'bell' && IB.shown.length) { const ids = IB.shown.slice(0, 100); IB.shown = []; pmPost('/api/inbox/seen', { ids }).then(ibRead); } // seen is not done: they move to Still waiting
928
951
  pvOv.kind = null; $('#pvOv').hidden = true; $('#pvOv').inert = true; $('#pvScrim').classList.remove('on');
929
952
  $$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; }); $('#dock').inert = !document.body.classList.contains('docked'); document.documentElement.style.overflow = '';
953
+ if (homeDock()) $('#dlg').inert = false;
930
954
  if (pvOv.back) { try { pvOv.back.focus(); } catch { /* gone */ } }
931
955
  }
932
956
  export const pvOpenBell = () => pvOpen('bell');
@@ -936,6 +960,7 @@ function pvOpen(kind) {
936
960
  const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $(kind === 'pal' ? '#moreBtn' : '#pvBell');
937
961
  pvOv.kind = kind; pvOv.at = 0;
938
962
  $$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
963
+ if (homeDock()) $('#dlg').inert = true;
939
964
  const o = $('#pvOv'); o.className = 'pv-ov ' + kind; o.setAttribute('aria-label', kind === 'pal' ? 'Search' : 'Needs you'); o.hidden = false; o.inert = false; $('#pvScrim').classList.add('on');
940
965
  if (kind === 'pal') { o.innerHTML = '<div class="pv-pin">' + SRCH + '<input id="pvQ" type="text" placeholder="Search places, initiatives, documents and sessions" aria-label="Search" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="pvList"><kbd>Esc</kbd></div><div id="pvList" role="listbox" aria-label="Results"></div><p class="pv-note">Ctrl K or / opens this from any page. Arrow keys move, Enter opens.</p>'; $('#pvQ').focus(); pvPal(); }
941
966
  else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small><button type="button" class="ib-all" id="ibAll" hidden>Mark all seen</button></div><div id="pvList" class="pv-lst"></div>'; pvBellDraw(); pvNeeds(); ibRead(); }
@@ -978,7 +1003,7 @@ const IB_GL = { 'work-draft': IC('M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12zM1
978
1003
  const ibAgo = (ms) => { if (ms == null) return ''; const m = Math.round((Date.now() - ms) / 60000); return m < 1 ? 'just now' : m < 60 ? m + ' min ago' : m < 1440 ? Math.round(m / 60) + ' h ago' : Math.round(m / 1440) + (Math.round(m / 1440) === 1 ? ' day ago' : ' days ago'); };
979
1004
  const ibOld = (ms) => { if (ms == null) return ''; const d = Math.floor((Date.now() - ms) / 86400000); return d < 1 ? 'oldest is from today' : 'oldest is ' + d + (d === 1 ? ' day old' : ' days old'); };
980
1005
  /** The deep link of an inbox item or bundle: the Briefing opens it (premium.js openParam); a My work item (item:<id>) opens its dialog on My work. */
981
- export const ibHref = (open, pws) => /^item:/.test(open) ? '/premium-work.html?' + ['item=' + encodeURIComponent(open.slice(5)), PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&') : '/premium.html?' + ['open=' + encodeURIComponent(open), pws ? 'pws=' + encodeURIComponent(pws) : '', PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&');
1006
+ export const ibHref = (open, pws) => /^item:/.test(open) ? '/premium.html?' + ['item=' + encodeURIComponent(open.slice(5)), PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&') : '/premium.html?' + ['open=' + encodeURIComponent(open), pws ? 'pws=' + encodeURIComponent(pws) : '', PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&');
982
1007
  /** The last inbox answer, for the Briefing's count line: { count, newCount, oldest } or null. */
983
1008
  export const ibState = () => IB.r;
984
1009
  async function ibRead() {
@@ -1044,8 +1069,9 @@ addEventListener('keydown', (e) => {
1044
1069
  else if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvClose(); }
1045
1070
  return;
1046
1071
  }
1047
- if ($('#dlg').classList.contains('on') || !$('#pvSearch')) return;
1072
+ if (!$('#pvSearch') || ($('#dlg').classList.contains('on') && !homeDock())) return; // Home's docked chat is always open: Ctrl K still searches
1048
1073
  if ((e.ctrlKey || e.metaKey) && !e.altKey && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvOpen('pal'); return; }
1074
+ if ($('#dlg').classList.contains('on')) return;
1049
1075
  const t = document.activeElement;
1050
1076
  if (e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !(t && t.matches && t.matches('input,textarea,select,[contenteditable="true"]'))) { e.preventDefault(); pvOpen('pal'); }
1051
1077
  }, true);
@@ -1258,6 +1284,7 @@ const railShowing = () => $('#dlg').classList.contains('on') && $('#dlg').classL
1258
1284
  function railMount() {
1259
1285
  const g = $('#dGrid'); if (!g || $('#sRail')) return;
1260
1286
  g.insertAdjacentHTML('afterbegin', `<aside class="srl" id="sRail" aria-label="Sessions"><div class="srl-hd"><b>Sessions</b><button type="button" class="srl-fold" id="srlFold" aria-label="Fold the list" title="Fold the list"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="M9 4v16"/></svg></button></div><div class="srl-list" id="srlList"></div><div class="srl-lg" aria-hidden="true"><span><i class="sdot2 ready"></i>Ready</span><span><i class="sdot2 run"></i>Running</span><span><i class="sdot2 blk"></i>Maybe blocked</span></div></aside>`);
1287
+ { const home = homeDock() && $('#hSessions'); if (home) home.appendChild($('#sRail')); } // Home: the session list is a group of the list on the left
1261
1288
  $('#dlg .dtools').insertAdjacentHTML('afterbegin', '<button type="button" class="stease" id="sTease" aria-haspopup="true" hidden><i class="sdot2" aria-hidden="true"></i><span>Sessions</span><em></em></button>');
1262
1289
  const ot = $('#dOut .otop'); if (ot) ot.insertAdjacentHTML('afterbegin', '<button type="button" class="vfold" id="vFold" aria-label="Fold the viewer" title="Fold the viewer"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="M15 4v16"/></svg></button>');
1263
1290
  $('#srlFold').onclick = () => { if (R.autoMin) { R.autoMin = false; railLayout(); return; } R.railMin = !R.railMin; store.set('pmos.srl.rail', R.railMin ? 'min' : 'open'); railLayout(); }; // a list the viewer folded opens again; the PM's own fold is remembered
@@ -1359,7 +1386,10 @@ function railDraw() {
1359
1386
  if (tz) { $('i', t).className = 'sdot2 ' + tz.dot; $('em', t).textContent = tz.text; t.setAttribute('aria-label', 'Sessions, ' + tz.text + '. Switch between sessions'); t.title = 'Switch between sessions'; t.setAttribute('aria-expanded', String($('#dlg').classList.contains('srl-open'))); }
1360
1387
  }
1361
1388
  sessBadge(menuCount(R.rows));
1389
+ document.dispatchEvent(new CustomEvent('pmos:sessions', { detail: m })); // Home's list counts them and finds an initiative's own sessions
1362
1390
  }
1391
+ /** Home: open one session from the list's own rows (an initiative's sessions). */
1392
+ export function openSessionRow(id) { if (R.model && R.model.rows.some((x) => x.id === id)) pickSession(id); }
1363
1393
  async function railRead() {
1364
1394
  const [s, g] = await Promise.all([pmGet('/api/sessions').catch(() => null), pmGet('/api/briefing-premium/goals').catch(() => null)]);
1365
1395
  if (s && Array.isArray(s.sessions)) R.rows = s.sessions;
@@ -1373,7 +1403,7 @@ function railOnOpen(o) {
1373
1403
  railMount(); clearTimeout(R.sidTimer); S.sid = null; R.ask = null; R.slow = null; R.err = '';
1374
1404
  $('#dlg').classList.remove('srl-open');
1375
1405
  const t = $('#sTease'); if (t) { if (o.noteKey || o.sessions) t.dataset.on = '1'; else delete t.dataset.on; }
1376
- $('#dlg').classList.toggle('srl-on', !!(o.noteKey || o.sessions)); // only a dialog with a conversation gets the list
1406
+ $('#dlg').classList.toggle('srl-on', !!(o.noteKey || o.sessions) || homeDock()); // only a dialog with a conversation gets the list
1377
1407
  R.sel = o.noteKey ? ((R.rows.find((x) => x.origin === 'chat:' + o.noteKey && x.shown !== 'exited') || {}).id || null) : null;
1378
1408
  railLayout(); railDraw(); railRead().then(() => { if (o.noteKey && !R.sel) { R.sel = (R.rows.find((x) => x.origin === 'chat:' + o.noteKey && x.shown !== 'exited') || {}).id || null; railDraw(); } });
1379
1409
  railTick();
@@ -146,4 +146,9 @@ export function vwConfirm(el, o) {
146
146
  el.prepend(c); const f = c.querySelector('[data-a="1"]'); if (f) f.focus();
147
147
  });
148
148
  }
149
+ /* The Agreed design (initiative premium-agreed-design): the dialog and the Viewer take the cozy look on a page whose body has class cz.
150
+ * The sheet is inert elsewhere, so it is loaded on every page that imports the viewer. */
151
+ if (typeof document !== 'undefined' && document.head && !document.querySelector('link[href="/pm/cozy-viewer.css"]')) {
152
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/cozy-viewer.css'; document.head.append(l);
153
+ }
149
154
  if (typeof window !== 'undefined') window.__premiumViewer = { vwOpen, vwClose, vwShow, vwReset, vwState, vwStyle, vwConfirm, vwCount };
@@ -2,8 +2,10 @@
2
2
  * request: it turns the answers of the two routes the views read into what they draw, so a node test loads it with import().
3
3
  * GET /api/jira/tickets?ws&initiative → the initiative's ticket draft and the last Jira reading of each pushed ticket (lib/jira-tickets.js view)
4
4
  * GET /api/boards/sprints?ws&board → the board's sprints from the cached Jira readings (scripts/boards.js sprintsOf)
5
- * Every value comes from one of the two answers. The readings hold titles, statuses, sprints, subtask counts and points only (lib/jira-status.js:
6
- * "never a description, a comment or a person"), so the ticket draws no assignee and no subtask list, and says that the rest stays in Jira.
5
+ * Every value comes from one of the two answers. The readings hold titles, statuses, sprints, subtask counts and points (lib/jira-status.js).
6
+ * Agreed design V1 (initiative premium-agreed-design): the ticket names its engineer assignee when a reading holds one (`assignee`, a name or
7
+ * { name | displayName }) and says "Not in the Jira read" otherwise, never a guess; and it says how long ago Jira was read (agoLine).
8
+ * Engineers build outside PMOS, in Jira: the ticket's build story is its Jira status and assignee, never a PMOS agent or pull request.
7
9
  * Nothing here writes to Jira: PMOS owns the ticket text and Jira owns its status (D88). */
8
10
 
9
11
  export const COLS = [['todo', 'To do'], ['doing', 'In progress'], ['done', 'Done']];
@@ -11,6 +13,8 @@ const CAT = { todo: 'To do', doing: 'In progress', done: 'Done' };
11
13
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
12
14
  const str = (s) => (typeof s === 'string' ? s.trim() : '');
13
15
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
16
+ /** A reading's assignee as a name: a string, or an object with name or displayName; '' when the reading holds none. */
17
+ export const personOf = (a) => (typeof a === 'string' ? a.trim() : a && typeof a === 'object' ? str(a.displayName) || str(a.name) : '');
14
18
 
15
19
  /** 2026-10-07 → "7 Oct"; anything else → '' */
16
20
  export function day(iso) {
@@ -59,9 +63,10 @@ export function ticketModel(view, ref, sprints = null) {
59
63
  const epic = view && view.epic && view.epic.key ? { key: view.epic.key, title: view.epic.summary || '' } : null;
60
64
  const points = hit && typeof hit.issue.points === 'number' ? hit.issue.points : null;
61
65
  const flagged = !!((j && j.flagged) || (hit && hit.issue.flagged));
66
+ const assignee = personOf(j && j.assignee) || personOf(hit && hit.issue.assignee) || personOf(t && t.assignee) || null;
62
67
  return {
63
68
  ok: true, id: t ? t.id : '', key, inJira: !!key && (!t || !!t.key), title: (t && t.summary) || (hit && hit.issue.summary) || key,
64
- type: (t && t.type) || '', priority: (t && t.priority) || '', estimate: (t && t.estimate) || '', points,
69
+ type: (t && t.type) || '', priority: (t && t.priority) || '', estimate: (t && t.estimate) || '', points, assignee,
65
70
  status: status || (t && !t.key ? 'Not in Jira yet' : ''), category: category || (t && !t.key ? 'draft' : 'todo'),
66
71
  sprint: sp && sp.name ? { name: sp.name, state: sp.state || '', dates: [day(sp.start), day(sp.end)].filter(Boolean).join(' – ') } : null,
67
72
  flagged, reason: flagged ? (j && j.reason) || (hit && hit.issue.reason) || 'Flagged in Jira' : '',
@@ -100,7 +105,7 @@ export function sprintModel(sprints, name, { today } = {}) {
100
105
  const a = Date.parse(String(sp.end).slice(0, 10)), b = Date.parse(String(today).slice(0, 10));
101
106
  if (Number.isFinite(a) && Number.isFinite(b)) { const d = Math.round((a - b) / 864e5); left = d < 0 ? 'ended ' + plural(-d, 'day', 'days') + ' ago' : d === 0 ? 'ends today' : plural(d, 'day', 'days') + ' left'; }
102
107
  }
103
- const cards = (sp.issues || []).map((i) => ({ key: i.key, title: i.summary || i.key, status: i.status || CAT[i.category] || '', cat: CAT[i.category] ? i.category : 'todo',
108
+ const cards = (sp.issues || []).map((i) => ({ key: i.key, title: i.summary || i.key, status: i.status || CAT[i.category] || '', cat: CAT[i.category] ? i.category : 'todo', assignee: personOf(i.assignee) || null,
104
109
  points: typeof i.points === 'number' ? i.points : null, initiative: i.initiative || null, url: safeUrl(i.url), flagged: !!i.flagged, reason: i.flagged ? i.reason || 'Flagged in Jira' : '' }));
105
110
  const cols = COLS.map(([cat, label]) => ({ cat, label, cards: cards.filter((c) => c.cat === cat) }));
106
111
  const other = cards.filter((c) => !c.initiative).length;
@@ -120,6 +125,18 @@ export function readLine(iso, now = Date.now()) {
120
125
  return 'read ' + (same ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON[d.getMonth()]);
121
126
  }
122
127
 
128
+ /** "Jira · read 12 min ago" (V1): just now, minutes, hours, then days; a time no record holds says so. */
129
+ export function agoLine(iso, now = Date.now()) {
130
+ const t = Date.parse(String(iso || ''));
131
+ if (!Number.isFinite(t)) return 'Jira · no read time on record';
132
+ const m = Math.max(0, Math.round((now - t) / 60000));
133
+ if (m < 1) return 'Jira · read just now';
134
+ if (m < 60) return 'Jira · read ' + m + ' min ago';
135
+ const h = Math.round(m / 60);
136
+ if (h < 24) return 'Jira · read ' + plural(h, 'hour', 'hours') + ' ago';
137
+ return 'Jira · read ' + plural(Math.round(h / 24), 'day', 'days') + ' ago';
138
+ }
139
+
123
140
  /**
124
141
  * A ticket that is in no ticket draft and no sprint read, from GET /api/jira/ticket (popup context slice 4): the newest Jira check
125
142
  * snapshot that holds it, or else the stored Jira source read. ans: that answer (or null), ref: the key.
@@ -138,7 +155,7 @@ export function storedModel(ans, ref) {
138
155
  const sub = t.subtasks && Number.isInteger(t.subtasks.total) && t.subtasks.total > 0 ? { done: Math.min(t.subtasks.done || 0, t.subtasks.total), total: t.subtasks.total } : null;
139
156
  const about = [str(t.about), t.who && t.ask ? `${str(t.who)} asks: ${str(t.ask)}` : str(t.ask)].filter(Boolean).join('\n\n');
140
157
  return {
141
- ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null,
158
+ ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null, assignee: personOf(t.assignee) || null,
142
159
  status: str(t.status) || (src === 'source-read' ? 'Status not in the read' : 'No status read'), category: t.category || 'todo', sprint: sp,
143
160
  flagged: !!t.flagged, reason: t.flagged ? str(t.reason) || 'Flagged in Jira' : '', stale: false,
144
161
  sections: about ? [{ key: 'about', name: 'What the Jira read says', text: about }] : [], subtasks: sub, links: [], epic: null, prd: '', initiative: '',
@@ -1,3 +1,7 @@
1
+ @font-face{font-family:"Space Grotesk";src:url(/vendor/space-grotesk-var.woff2) format("woff2");font-weight:300 700;font-display:swap}
2
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-400.woff2) format("woff2");font-weight:400;font-display:swap}
3
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-500.woff2) format("woff2");font-weight:500;font-display:swap}
4
+ @font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-700.woff2) format("woff2");font-weight:600 700;font-display:swap}
1
5
  :root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
2
6
  /* pm/premium-vw-jira.css — the Jira ticket and sprint tabs of the premium viewer (initiative premium-viewer, S5). Loaded once by
3
7
  * pm/premium-vw-jira.js. Console type only: sizes var(--fs-1..6), weights 400, 500 and 600. */
@@ -86,3 +90,10 @@ button.jcrd{cursor:pointer}
86
90
  .jbrd{grid-template-columns:1fr}
87
91
  }
88
92
  @media (hover:hover){.jbtn:hover{background:var(--well)}.jln button:hover b{text-decoration:underline}button.jcrd:hover{box-shadow:0 6px 16px -10px rgba(0,0,0,.35)}}
93
+ /* Agreed design V1: the ticket's facts grid (Status, Assignee, Points, Sprint, Initiative, Jira read), two columns of soft wells */
94
+ .jfields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0 4px}
95
+ .jfd{padding:10px 12px;border-radius:8px;background:var(--well);min-width:0}
96
+ .jfd dt{font-size:var(--fs-1);font-weight:600;color:var(--ink-3)}
97
+ .jfd dd{margin:2px 0 0;font-size:var(--fs-3);font-weight:600;color:var(--ink);overflow-wrap:anywhere}
98
+ .jfd.mut dd{font-weight:600;color:var(--ink-3)}
99
+ .jago{color:var(--ink-3)}
@@ -4,12 +4,14 @@
4
4
  * history or fields panel; those stay in Jira)
5
5
  * openSprint({ ws, board, name }) a sprint of the board as columns by status; a card of the board opens its ticket
6
6
  * Reads GET /api/jira/tickets and GET /api/boards/sprints only; the model is pm/premium-vw-jira-model.js. Read-only: Jira owns status, sprint and
7
- * assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing. */
7
+ * assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing.
8
+ * Agreed design V1: the ticket's facts grid names the engineer assignee and "Jira · read N min ago". Engineers build in Jira, so the ticket never
9
+ * shows a PMOS builder agent, a pull request, CI or a diff as its build story. */
8
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
9
11
  import { openBacklog } from './premium-vw-backlog.js';
10
12
  import { mdRender } from './markdown.js';
11
13
  import { esc, toast, askHere } from './premium-shell.js';
12
- import { ticketModel, sprintModel, readLine, storedModel } from './premium-vw-jira-model.js';
14
+ import { ticketModel, sprintModel, readLine, storedModel, agoLine } from './premium-vw-jira-model.js';
13
15
 
14
16
  const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
15
17
  const EXT = ICO('<path d="M14 4h6v6M20 4l-9 9M18 14v6H4V6h6"/>');
@@ -23,7 +25,7 @@ async function getJson(p, q) {
23
25
  }
24
26
  // mdRender builds nodes, never a string, so nothing in a ticket's text runs
25
27
  const md = (t) => { try { const d = document.createElement('div'); d.append(...mdRender(String(t)).blocks.map((b) => b.node || b)); return d.innerHTML; } catch { return `<p>${esc(t)}</p>`; } };
26
- const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}</span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
28
+ const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}<span class="jago"> · ${esc(agoLine(m.readAt).replace(/^Jira · /, ''))}</span></span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
27
29
  // the bars' widths are run-time geometry, set as a property rather than an inline style
28
30
  const bars = (el) => el.querySelectorAll('[data-pct]').forEach((i) => i.style.setProperty('--bd-w', Math.max(0, Math.min(100, +i.dataset.pct || 0)) + '%'));
29
31
  const empty = (why, canRead) => `<div class="jv"><div class="jempty"><b>${canRead ? 'Not read yet' : 'Nothing to show'}</b><p>${esc(why)}</p>${canRead ? '<button type="button" class="jbtn" data-jread>Read it now</button>' : ''}</div></div>`;
@@ -44,6 +46,10 @@ function ticketHtml(m) {
44
46
  const links = m.links.length || m.prd ? `<h3>Linked</h3><div class="jlinks">${m.links.map((l) => `<div class="jln"><em>${esc(l.rel)}</em>${l.open
45
47
  ? `<button type="button" data-jt="${esc(l.ref)}">${LINK}<span class="jk">${esc(l.key || l.ref)}</span><b>${esc(l.title)}</b></button>`
46
48
  : `<span class="jlx">${LINK}<span class="jk">${esc(l.ref)}</span></span>`}</div>`).join('')}${m.prd ? `<div class="jln"><em>from</em><span class="jlx">${DOC}<b>${esc(m.prd)}</b></span></div>` : ''}</div>` : '';
49
+ // V1: the design's facts grid. The assignee is the engineer the Jira read names; a read with no person says so rather than guess.
50
+ const fields = [['Status', m.status || 'No status read'], ['Assignee', m.assignee ? m.assignee + ' (engineer)' : 'Not in the Jira read'], ['Points', m.points != null ? String(m.points) : 'None on record'],
51
+ ['Sprint', m.sprint ? m.sprint.name + (m.sprint.dates ? ' · ' + m.sprint.dates : '') : 'No sprint'], ['Initiative', m.initiative || ''], ['Jira', agoLine(m.readAt).replace(/^Jira · /, '').replace(/^read/, 'Read')]].filter((f) => f[1]);
52
+ const facts = `<dl class="jfields" aria-label="Ticket facts">${fields.map(([k, v]) => `<div class="jfd${k === 'Assignee' && !m.assignee ? ' mut' : ''}" data-jf="${esc(k.toLowerCase())}"><dt>${esc(k)}</dt><dd>${esc(v)}</dd></div>`).join('')}</dl>`;
47
53
  const body = m.sections.length ? m.sections.map((s) => `<h3>${esc(s.name)}</h3><div class="jmd">${md(s.text)}</div>`).join('')
48
54
  : `<p class="jnote">${m.fromStore ? `This ticket is not in the initiative's ticket draft. Its title and status come from ${m.fromStore === 'source-read' ? 'the stored Jira read' : 'the last Jira check that held it'}.` : m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
49
55
  return `<div class="jv">${bar('ticket', m)}<article class="jtk">
@@ -53,8 +59,9 @@ function ticketHtml(m) {
53
59
  ${m.flagged ? `<p class="jflag">${FLAG}${esc(m.reason)}</p>` : ''}
54
60
  ${m.stale ? '<p class="jnote">The last Jira check did not return this ticket, so this is an older reading.</p>' : ''}
55
61
  ${m.readingOnly ? '<p class="jnote">This ticket is in Jira, but no Jira check has read it yet.</p>' : ''}
62
+ ${facts}
56
63
  <div class="jbody">${body}</div>${sub}${links}
57
- <p class="jfoot">Assignee, comments, history and the other fields stay in Jira.${m.url ? ` <a href="${esc(m.url)}" target="_blank" rel="noopener">Open in Jira</a>` : m.inJira ? ' The reading holds no link to the ticket.' : ' This ticket is not in Jira yet; push it from the initiative\'s Jira tickets tab.'}</p>
64
+ <p class="jfoot">Comments, history and the other fields stay in Jira. The engineers build there; Jira owns the status and the assignee.${m.url ? ` <a href="${esc(m.url)}" target="_blank" rel="noopener">Open in Jira</a>` : m.inJira ? ' The reading holds no link to the ticket.' : ' This ticket is not in Jira yet; push it from the initiative\'s Jira tickets tab.'}</p>
58
65
  </article></div>`;
59
66
  }
60
67
 
@@ -80,9 +80,12 @@ const fail = (d, res, what) => d.toast((res && res.error) || what);
80
80
 
81
81
  /** The dialog the tabs sit in: the open one, else the meeting's dialog on the Briefing, else a dialog of the note's own. */
82
82
  async function ensureDialog(id, d) {
83
- if ($('#dlg') && $('#dlg').classList.contains('on')) return true;
84
83
  const rec = REC(), n = rec ? rec.note(id) : null;
85
- if (rec && n && n.meeting && n.meeting.kind === 'event') { await rec.open(id); if ($('#dlg').classList.contains('on')) return true; }
84
+ // Home's docked chat (body.cz-dock) is always on: it counts as the note's dialog only when it already shows this note or its meeting (premium-agreed-design)
85
+ const dock = document.body.classList.contains('cz-dock');
86
+ const ours = () => !!$(`#vTabs [data-vw="rec:${id}"]`) || (!!n && !!$('#dTitle') && $('#dTitle').textContent === clip((n.meeting && n.meeting.title) || n.title || 'Untitled note', 120));
87
+ if ($('#dlg') && $('#dlg').classList.contains('on') && (!dock || ours())) return true;
88
+ if (rec && n && n.meeting && n.meeting.kind === 'event') { await rec.open(id); if ($('#dlg').classList.contains('on') && (!dock || ours())) return true; }
86
89
  if (!d.openDlg) return false;
87
90
  d.openDlg({ eye: 'Note', title: clip((n && n.title) || 'Untitled note', 120), label: 'Note',
88
91
  say: 'This note is not linked to a meeting in this week’s calendar. What it holds shows in the Live notes tab.', html: '<p class="note">The note has no meeting. Its live notes are in the next tab.</p>' });
@@ -20,7 +20,10 @@ const mdHtml = (t) => { try { const d = document.createElement('div'); d.append(
20
20
  const KIND = { ask: 'You asked', draft: 'Agent drafted', edit: 'You edited it', note: 'You sent it back', sent: 'Posted', post: 'Posted' };
21
21
  const turnsHtml = (a) => (a.turns && a.turns.length ? `<h3 class="h2">Conversation with the agent</h3><ol class="agturns">${a.turns.map((t, i) => `<li class="${t.who}"><b>${esc(t.who === 'agent' ? 'Agent' : 'You')}</b> ${esc(KIND[t.kind] || t.kind || 'said')}${t.at ? ' · ' + esc(String(t.at).slice(0, 10)) : ''}${t.text ? `<span>${esc(t.text)}</span>` : ''}${t.body ? `<button class="xtb" data-p="round" data-i="${i}" aria-expanded="${ui.round === i}">${t.who === 'agent' ? 'View round' : 'View your edit'}</button>${ui.round === i ? `<div class="mdr">${mdHtml(t.body)}</div>` : ''}` : ''}</li>`).join('')}</ol>` : '');
22
22
  const glyph = (src) => GLYPH[src] || '<circle cx="12" cy="12" r="4"/>';
23
- wireRail('work');
23
+ /* Home (initiative premium-agreed-design, H2) holds My work: the capture box, the Work queue, Waiting on others, the weekly review and Untouched
24
+ * are groups of Home's list. There the Briefing owns the summary, the place menu and the page's conversation, so this file draws only its own cards. */
25
+ const HOME = document.body.classList.contains('cz-home');
26
+ if (!HOME) wireRail('work');
24
27
  const WS = new URLSearchParams(location.search).get('ws') || '';
25
28
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
26
29
  const dayLabel = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso || ''); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
@@ -31,13 +34,14 @@ const SVG = { sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12
31
34
 
32
35
  /* ── hero and header ───────────────────────────────────────────────────────────────────────────────────── */
33
36
  function drawHero() {
37
+ if (HOME) return;
34
38
  $('#date').textContent = M.date;
35
39
  $('#brief').innerHTML = M.hero.map((s) => s.parts.map((p) => (p.s ? `<span class="k">${esc(p.t)}</span>` : esc(p.t))).join('')).join(' ');
36
40
  $('#snap').textContent = M.header.text;
37
41
  setPageGaps(((M.header && M.header.missing) || []).length);
38
42
  $('#snap').title = 'Every figure on this page comes from an item on your list. A date shows only when one was set.';
39
43
  }
40
- function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.needs === 0 ? 'to clear' : M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>Next <b>${esc(M.dock.next)}</b>` : 'Nothing more on your list'; }
44
+ function drawDock() { if (HOME) return; $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.needs === 0 ? 'to clear' : M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>Next <b>${esc(M.dock.next)}</b>` : 'Nothing more on your list'; }
41
45
 
42
46
  /* ── the Work queue ─────────────────────────────────────────────────────────────────────────────────────── */
43
47
  function rowHtml(r, o = {}) {
@@ -280,7 +284,10 @@ function mountBar(r) {
280
284
  $('#dTabs').insertAdjacentHTML('beforeend', `<div class="ibar" id="card">${cardInner(r)}</div>`);
281
285
  $('#dlg').classList.add('itm');
282
286
  }
283
- function unmountBar() { const c = $('#card'); if (c) c.remove(); $('#dlg').classList.remove('itm'); }
287
+ /* Home (premium-agreed-design) loads this file beside premium.js, whose row dialogs carry their own #card in the conversation: this file's
288
+ * card is only the bar in the switch row, so every lookup of it is scoped to #dTabs and never removes or redraws the Briefing's card */
289
+ const myBar = () => $('#dTabs #card');
290
+ function unmountBar() { const c = myBar(); if (c) c.remove(); $('#dlg').classList.remove('itm'); }
284
291
  function placeSheet() {
285
292
  const s = $('#iSheet'); if (!s || s.hidden) return;
286
293
  const dl = $('#dlg').getBoundingClientRect(), t = $('#dTabs').getBoundingClientRect();
@@ -341,7 +348,7 @@ function openRow(r) {
341
348
  }
342
349
  /* redraw the card from what the model and the typed state hold; `sel` is the control to focus again */
343
350
  function paint(sel) {
344
- const c = $('#card'); if (!c || !openR) return;
351
+ const c = myBar(); if (!c || !openR) return;
345
352
  c.innerHTML = cardInner(openR); placeSheet();
346
353
  const ac = $('#agCard'), ah = agCardInner(openR);
347
354
  if (ac && ah) ac.innerHTML = ah; else if (ac) ac.remove(); else if (ah) $('#dBody .stream').insertAdjacentHTML('beforeend', agCardHtml(openR));
@@ -495,7 +502,8 @@ const onInput = (e) => {
495
502
  const onChange = (e) => { if (ui.ed && e.target.id === 'xeJ') ui.ed.job = e.target.value; };
496
503
  const onClick = (e) => {
497
504
  const lt = e.target.closest('#logT');
498
- if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); return; }
505
+ if (lt && e.pmLog) return; // Home: premium.js already toggled the activity log for this press; a second toggle would shut it again
506
+ if (lt) { e.pmLog = true; const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); return; }
499
507
  const b = e.target.closest('[data-p]');
500
508
  if (!b || b.disabled || !openR || dlgKind !== 'item') return;
501
509
  dlgClick(b, openR);
@@ -508,7 +516,7 @@ document.addEventListener('pointerdown', (e) => { if (ui.sheet && dlgKind === 'i
508
516
  addEventListener('keydown', (e) => { if (e.key === 'Escape' && ui.sheet && dlgKind === 'item' && $('#iSheet')) { e.stopImmediatePropagation(); shutSheet(true); } }, true);
509
517
  addEventListener('resize', placeSheet);
510
518
  /* the bar belongs to the item dialog: it goes when the dialog closes or another dialog takes its place */
511
- new MutationObserver(() => { if ($('#card') && (!dlgOpen() || dlgKind !== 'item' || !openR || $('#dTitle').textContent !== openR.title)) unmountBar(); })
519
+ new MutationObserver(() => { if (myBar() && (!dlgOpen() || dlgKind !== 'item' || !openR || $('#dTitle').textContent !== openR.title)) unmountBar(); })
512
520
  .observe($('#dlg'), { attributes: true, attributeFilter: ['class'], childList: true, subtree: true, characterData: true });
513
521
 
514
522
  /* ── Focus and jobs: the bar under the add line, and its dialog ─────────────────────────────────────────────────────────────── */
@@ -703,6 +711,7 @@ function openAsked() {
703
711
  async function load() {
704
712
  let r = null, status = 0;
705
713
  try { const res = await fetch('/api/my-work-premium', { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
714
+ if (HOME && (!r || !r.ok)) { $('#qNote').textContent = 'Your list could not be read, so it shows nothing rather than guess.' + (r && r.error ? ' The reason: ' + r.error : ''); return; }
706
715
  if (!r || !r.ok) {
707
716
  $('#snap').textContent = 'Your list could not be read';
708
717
  $('#brief').textContent = 'My work could not read your list, so it shows nothing rather than guess.' + (r && r.error ? ' The reason: ' + r.error : status ? ' (the server answered ' + status + ')' : ' The server did not answer.');
@@ -714,6 +723,7 @@ async function load() {
714
723
  if (mine && dlgKind === 'item') refreshOpen(); else if (mine) drawFocusDlg();
715
724
  }
716
725
  setInterval(() => { if (M && M.agents && M.agents.counts.running > 0 && !document.hidden) load(); }, 15000); // an agent's state changes without a press
717
- chatAbout('work:this-page', 'My work'); // the rail's Chat opens the Chat page on this page's conversation (premium-chat-page)
718
- $('#brief').textContent = 'Reading your list.';
726
+ if (!HOME) { chatAbout('work:this-page', 'My work'); $('#brief').textContent = 'Reading your list.'; } // the rail's Chat opens the Chat page on this page's conversation (premium-chat-page)
727
+ /* Home: a row of Needs you that is an item of your list opens that item's dialog here (premium.js sends it). */
728
+ document.addEventListener('pmos:item', (e) => { ASKED = e.detail && e.detail.id; if (M) openAsked(); });
719
729
  load();
@@ -12,6 +12,7 @@ import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words
12
12
  import { consoleReads, briefOf, needsListOf } from './premium-brief.js';
13
13
  import { mountDocSheet } from './premium-doc-sheet.js';
14
14
  import { momentOf, inText } from './c3-phone-model.js';
15
+ import { drawSummary, drawMeetLine } from './cozy-home.js';
15
16
  import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, popKey, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, allText, sourcesNow, readLine, chatAbout, pvOpenBell, ibState } from './premium-shell.js';
16
17
  const ICON = {
17
18
  meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
@@ -129,10 +130,18 @@ $('#rank').addEventListener('click', (e) => {
129
130
  const r = LIST().rows.find((x) => x.key === h.closest('.rr').dataset.key);
130
131
  if (r && r.prop) { openPropsDlg(r.prop); return; }
131
132
  if (r && r.docs) { openCoreDraft(r.docs); return; } // portfolio documents: the document sheet, with Read and Issue it // the agent's drafts: the Agent proposals dialog, that target's proposals only
133
+ if (r && r.go && homeItem(r.go)) return; // Home holds My work: an item of your list opens its own dialog here
132
134
  if (r && r.go) { location.assign(r.go); return; } // a console row opens its item on its own page: My work, the initiative or the board
133
135
  openRow(r);
134
136
  });
135
137
 
138
+ /** A row whose page is Home itself with ?item=<id> opens that item on this page (premium-work.js listens). */
139
+ function homeItem(go) {
140
+ const m = /^\/premium\.html\?(.*)$/.exec(go || ''), id = m && new URLSearchParams(m[1]).get('item');
141
+ if (!id || !document.getElementById('queue')) return false;
142
+ document.dispatchEvent(new CustomEvent('pmos:item', { detail: { id } }));
143
+ return true;
144
+ }
136
145
  /* ── today ──────────────────────────────────────────────────────────────────────────────────────────────── */
137
146
  const linkOf = (r) => ((r.from || []).find((x) => /^meeting:/.test(x)) || '').replace(/^meeting:/, '');
138
147
  function evHtml(e, i) {
@@ -153,7 +162,7 @@ function drawPrep() {
153
162
  c.innerHTML = `<svg width="44" height="44" viewBox="0 0 44 44" role="img" aria-label="${ok} of ${left.length} prepped"><circle class="rb" cx="22" cy="22" r="${R}" fill="none" stroke-width="6"/><circle class="rg" cx="22" cy="22" r="${R}" fill="none" stroke-width="6" stroke-linecap="round" stroke-dasharray="${(C * ok / left.length).toFixed(2)} ${C.toFixed(2)}" transform="rotate(-90 22 22)"/><text class="rt" x="22" y="26">${ok}/${left.length}</text></svg><div>${nxt ? `<b>${esc(nxt.title)}${cur ? ' is on now' : ' at ' + pHm(nxt.start) + ' is next'}</b>` : ''}<span>${pl(left.length, 'meeting', 'meetings')} left today. ${ok} of ${left.length} prepped.</span></div>`;
154
163
  c.hidden = false;
155
164
  }
156
- async function readPrep() { PREP = await briefPage(); drawPrep(); }
165
+ async function readPrep() { PREP = await briefPage(); drawPrep(); drawMeetLine(PREP, { open: (m) => week.openToday({ at: Date.parse(m.start), title: m.title }) }); }
157
166
  function drawTl() {
158
167
  if (week.draw()) { drawPrep(); return; }
159
168
  drawPrep();
@@ -192,6 +201,7 @@ document.addEventListener('keydown', (e) => { const cm = $('#calMenu'); if (e.ke
192
201
  /* ── dock ───────────────────────────────────────────────────────────────────────────────────────────────── */
193
202
  function drawDock() {
194
203
  const n = CL ? LIST().count : M.dock.needs;
204
+ drawSummary(n); // Home's summary line: Good afternoon. N things need you.
195
205
  $('#dN').textContent = n == null ? '·' : n; $('#dLab').textContent = n == null ? 'still reading' : n === 0 ? 'need you' : CL ? (n === 1 ? 'needs you' : 'need you') : M.dock.label;
196
206
  }
197
207
 
@@ -296,7 +306,8 @@ async function write(path, body, done) {
296
306
  }
297
307
  $('#dBody').addEventListener('click', (e) => {
298
308
  const lt = e.target.closest('#logT');
299
- if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); return; }
309
+ if (lt && e.pmLog) return; // Home also loads premium-work.js, which takes the same press: the log toggles once per press
310
+ if (lt) { e.pmLog = true; const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); return; }
300
311
  if (!openR) return;
301
312
  if (e.target.closest('#openProps')) { const r = openR; closeDlg(); openPropsDlg(rowTarget(r)); return; } // a drafts row: that target's proposals only
302
313
  const op = e.target.closest('[data-op]');
@@ -617,7 +628,8 @@ function bdDlg(key, eye, title, sub, say, draw, onPress, onInput) {
617
628
  setMode('detail');
618
629
  const o = $('#oMain'); o.dataset.bd = key;
619
630
  const redraw = (focus) => {
620
- $('.bd-a', o).innerHTML = draw();
631
+ const a = $('.bd-a', o); if (!a) return; // the dialog has moved on (on Home the dock goes back to your own chat): nothing of this row is left to redraw
632
+ a.innerHTML = draw();
621
633
  if (focus) { const f = $(focus, o) || $('.bd-a button:not([disabled]), .bd-a a', o); if (f) f.focus(); }
622
634
  };
623
635
  o.onclick = (e) => { if (o.dataset.bd === key) onPress(e, redraw); };
@@ -737,7 +749,7 @@ function rowKeyOf(it) {
737
749
  }
738
750
  function openOpenParam() {
739
751
  const q = new URLSearchParams(location.search), v = q.get('open');
740
- if (!v) return;
752
+ if (!v || /^(report|chart|dashboard):/.test(v)) return; // Home's chat (premium-chat.js) owns ?open=report: | chart: | dashboard: and keeps it in the address
741
753
  try { const u = new URL(location.href); u.searchParams.delete('open'); u.searchParams.delete('pws'); history.replaceState(history.state, '', u); } catch { /* no history */ }
742
754
  openParam(v, q.get('pws'));
743
755
  }
@@ -968,7 +980,8 @@ function mountAround() {
968
980
  const s = document.createElement('section');
969
981
  s.className = 'card rise'; s.id = 'aroundCard'; s.style.setProperty('--d', '8'); s.setAttribute('aria-labelledby', 'hAround');
970
982
  s.innerHTML = `<div class="ch"><span class="ic">${bdIco(BDI.at)}</span><h2 id="hAround">Around you</h2><small id="aroundCap">Reading</small></div><div id="aroundBody" class="bd-rows"></div><p class="note bd-note">Nothing here posts to Slack, Jira, Confluence or mail. A button that records something says what, before you press it.</p>`;
971
- t.insertAdjacentElement('afterend', s);
983
+ const slot = $('#prodSlot'); // Home: the product-wide signals are the list's Product group
984
+ if (slot) { slot.appendChild(s); $('#hAround', s).textContent = 'Product'; } else t.insertAdjacentElement('afterend', s);
972
985
  s.addEventListener('click', (e) => {
973
986
  const b = e.target.closest('[data-bd]'); if (!b) return;
974
987
  ({ prop: openPropsDlg, men: openMen, pulse: openPulse, scan: openScan, rep: openReport, src: openSrc })[b.dataset.bd]();
@@ -1089,7 +1102,7 @@ async function load() {
1089
1102
  return;
1090
1103
  }
1091
1104
  M = r.model; drawHero(); drawRows(); drawChips(); drawTl(); readPrep(); drawDock(); drawPick(); onScroll();
1092
- if (!AROUND) { AROUND = true; readAll().then(() => { openAroundParam(); openOpenParam(); }); setInterval(() => { if (!document.hidden && !$('#dlg').classList.contains('on')) readAll(); }, 300000); }
1105
+ if (!AROUND) { AROUND = true; readAll().then(() => { openAroundParam(); openOpenParam(); }); setInterval(() => { if (!document.hidden && (!$('#dlg').classList.contains('on') || document.body.classList.contains('cz-dock'))) readAll(); }, 300000); }
1093
1106
  const age = Date.now() - r.as_of;
1094
1107
  if (age > 5 * 60000) $('#snap').textContent += ' · read ' + ago(age) + (r.refreshing ? ', refreshing' : '');
1095
1108
  if (r.error) $('#snap').textContent += ' · the latest read failed: ' + r.error.slice(0, 120);