create-pmos 0.397.0 → 0.399.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 (195) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  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/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +105 -52
  8. package/workspace/briefing-premium-board-test.js +284 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +85 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +99 -83
  13. package/workspace/briefing-premium-initiative-test.js +175 -290
  14. package/workspace/briefing-premium-insights-test.js +414 -219
  15. package/workspace/briefing-premium-metrics-test.js +55 -97
  16. package/workspace/briefing-premium-products-test.js +44 -28
  17. package/workspace/briefing-premium-sources-test.js +70 -49
  18. package/workspace/briefing-premium-test.js +155 -648
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +24 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/board-premium-trail.js +32 -0
  23. package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
  24. package/workspace/guide/briefing-premium.md +3 -1
  25. package/workspace/guide/home.md +68 -0
  26. package/workspace/guide/index.md +1 -0
  27. package/workspace/lib/agent-roles.js +71 -0
  28. package/workspace/lib/board-grill.js +63 -0
  29. package/workspace/lib/board-premium.js +121 -24
  30. package/workspace/lib/board-trail.js +223 -0
  31. package/workspace/lib/home-work-item.js +58 -0
  32. package/workspace/lib/initiative-layout.js +77 -0
  33. package/workspace/lib/insights-goals.js +196 -0
  34. package/workspace/lib/insights-premium.js +64 -15
  35. package/workspace/lib/insights-records.js +115 -0
  36. package/workspace/lib/jira-tickets.js +1 -1
  37. package/workspace/lib/meeting-points.js +52 -0
  38. package/workspace/lib/news-for-you.js +88 -0
  39. package/workspace/lib/notes-series.js +29 -6
  40. package/workspace/lib/report-confirm.js +48 -0
  41. package/workspace/lib/route-modules.js +12 -0
  42. package/workspace/lib/routes-board-docs.js +46 -0
  43. package/workspace/lib/routes-board-grill.js +90 -0
  44. package/workspace/lib/routes-board-trail.js +33 -0
  45. package/workspace/lib/routes-home-desk.js +176 -0
  46. package/workspace/lib/routes-home-review.js +108 -0
  47. package/workspace/lib/routes-initiative-layout.js +57 -0
  48. package/workspace/lib/routes-insights-premium.js +16 -4
  49. package/workspace/lib/routes-insights-records.js +133 -0
  50. package/workspace/lib/routes-meeting-points.js +37 -0
  51. package/workspace/lib/routes-news.js +57 -0
  52. package/workspace/lib/routes-notes.js +3 -1
  53. package/workspace/lib/routes-report-confirm.js +31 -0
  54. package/workspace/lib/routes-search.js +38 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/search-index.js +176 -0
  57. package/workspace/lib/transcript-steps.js +123 -0
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-board-actions-test.js +128 -82
  63. package/workspace/premium-briefing-depth-test.js +104 -90
  64. package/workspace/premium-chat-attach-test.js +54 -63
  65. package/workspace/premium-chat-chart-tab-test.js +37 -37
  66. package/workspace/premium-chat-context-test.js +19 -18
  67. package/workspace/premium-chat-goal-view-test.js +23 -23
  68. package/workspace/premium-chat-notes-test.js +26 -31
  69. package/workspace/premium-chat-report-tab-test.js +46 -28
  70. package/workspace/premium-chat-term-test.js +16 -16
  71. package/workspace/premium-chat-viewer-test.js +60 -59
  72. package/workspace/premium-core-doc-issue-test.js +52 -43
  73. package/workspace/premium-html-viewer-test.js +14 -17
  74. package/workspace/premium-phone-card-test.js +10 -3
  75. package/workspace/premium-phone-room-test.js +41 -35
  76. package/workspace/premium-report-read-test.js +152 -197
  77. package/workspace/premium-viewer-download-test.js +19 -22
  78. package/workspace/premium-viewer-flicker-test.js +11 -16
  79. package/workspace/premium-viewer-share-test.js +6 -9
  80. package/workspace/premium-viewer-test.js +41 -60
  81. package/workspace/premium-vw-backlog-test.js +53 -33
  82. package/workspace/premium-vw-cal-test.js +97 -128
  83. package/workspace/premium-vw-copy-test.js +17 -33
  84. package/workspace/premium-vw-doc-test.js +17 -10
  85. package/workspace/premium-vw-item-test.js +50 -49
  86. package/workspace/premium-vw-jira-test.js +53 -27
  87. package/workspace/premium-vw-meet-test.js +115 -187
  88. package/workspace/premium-vw-notes-test.js +88 -109
  89. package/workspace/premium-vw-rec-test.js +71 -194
  90. package/workspace/premium-vw-slides-test.js +46 -50
  91. package/workspace/premium-welcome-test.js +3 -2
  92. package/workspace/premium-work-depth-test.js +61 -53
  93. package/workspace/public/pm/bd-acts.js +383 -0
  94. package/workspace/public/pm/bd-asks.js +261 -0
  95. package/workspace/public/pm/bd-pop.js +59 -0
  96. package/workspace/public/pm/bd-span.js +222 -82
  97. package/workspace/public/pm/bd-stages.js +25 -11
  98. package/workspace/public/pm/bd-views.js +169 -0
  99. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  100. package/workspace/public/pm/c3-md.js +3 -395
  101. package/workspace/public/pm/c3-phone-detail.js +1 -1
  102. package/workspace/public/pm/c3-phone-model.js +3 -68
  103. package/workspace/public/pm/chat-term.js +3 -3
  104. package/workspace/public/pm/cozy-board.css +798 -230
  105. package/workspace/public/pm/cozy-ev.css +228 -0
  106. package/workspace/public/pm/cozy-evmodel.js +106 -0
  107. package/workspace/public/pm/cozy-evui.js +47 -0
  108. package/workspace/public/pm/cozy-home.css +570 -142
  109. package/workspace/public/pm/cozy-home.js +5 -3
  110. package/workspace/public/pm/cozy-insights.css +437 -170
  111. package/workspace/public/pm/cozy-md.js +396 -0
  112. package/workspace/public/pm/cozy-nav.js +104 -29
  113. package/workspace/public/pm/cozy-news.js +140 -0
  114. package/workspace/public/pm/cozy-placeholder.js +26 -0
  115. package/workspace/public/pm/cozy-search.js +203 -0
  116. package/workspace/public/pm/cozy-settings.js +198 -0
  117. package/workspace/public/pm/cozy-sources.js +89 -0
  118. package/workspace/public/pm/cozy-today.css +217 -0
  119. package/workspace/public/pm/cozy-viewer.css +3 -3
  120. package/workspace/public/pm/cozy-viewer.js +145 -0
  121. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  122. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  123. package/workspace/public/pm/cozy-vw.css +485 -0
  124. package/workspace/public/pm/cozy.css +83 -1
  125. package/workspace/public/pm/home-adddoc.js +48 -0
  126. package/workspace/public/pm/home-app.js +1179 -0
  127. package/workspace/public/pm/home-around.js +413 -0
  128. package/workspace/public/pm/home-chat.js +512 -0
  129. package/workspace/public/pm/home-data.js +312 -0
  130. package/workspace/public/pm/home-dictate.js +54 -0
  131. package/workspace/public/pm/home-draft.js +68 -0
  132. package/workspace/public/pm/home-ini-model.js +190 -0
  133. package/workspace/public/pm/home-ini.css +171 -0
  134. package/workspace/public/pm/home-ini.js +456 -0
  135. package/workspace/public/pm/home-list.js +276 -0
  136. package/workspace/public/pm/home-more.js +132 -0
  137. package/workspace/public/pm/home-phone-card.js +109 -0
  138. package/workspace/public/pm/home-review.js +104 -0
  139. package/workspace/public/pm/home-task.js +67 -0
  140. package/workspace/public/pm/home-today.js +144 -0
  141. package/workspace/public/pm/home-work.js +547 -0
  142. package/workspace/public/pm/phone-moment.js +69 -0
  143. package/workspace/public/pm/pm-work-view.js +1 -1
  144. package/workspace/public/pm/premium-attach.js +4 -0
  145. package/workspace/public/pm/premium-board.js +548 -395
  146. package/workspace/public/pm/premium-chart-tab.js +109 -62
  147. package/workspace/public/pm/premium-deck.js +3 -3
  148. package/workspace/public/pm/premium-first.js +23 -21
  149. package/workspace/public/pm/premium-insights.js +1102 -581
  150. package/workspace/public/pm/premium-meeting.js +61 -549
  151. package/workspace/public/pm/premium-mtg-present.js +138 -0
  152. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  153. package/workspace/public/pm/premium-notes.js +1 -1
  154. package/workspace/public/pm/premium-report-frame.css +20 -0
  155. package/workspace/public/pm/premium-report-read.js +669 -476
  156. package/workspace/public/pm/premium-report-tab.js +116 -67
  157. package/workspace/public/pm/premium-shell.js +76 -123
  158. package/workspace/public/pm/premium-viewer.js +22 -1
  159. package/workspace/public/pm/premium-vw-cal.js +277 -48
  160. package/workspace/public/pm/premium-vw-doc.css +6 -0
  161. package/workspace/public/pm/premium-vw-doc.js +40 -2
  162. package/workspace/public/pm/premium-vw-file.js +2 -2
  163. package/workspace/public/pm/premium-vw-meet.js +6 -83
  164. package/workspace/public/pm/premium-vw-mtg.js +958 -0
  165. package/workspace/public/pm/premium-vw-notes.js +116 -68
  166. package/workspace/public/pm/premium-vw-open.js +35 -0
  167. package/workspace/public/pm/premium-vw-page.js +16 -0
  168. package/workspace/public/pm/premium-vw-rec.js +11 -218
  169. package/workspace/public/pm/premium-vw-slides.css +5 -0
  170. package/workspace/public/pm/premium-vw-slides.js +44 -8
  171. package/workspace/public/pm/rp-parts.js +269 -0
  172. package/workspace/public/pm/term-view.js +22 -0
  173. package/workspace/public/premium-board.html +29 -70
  174. package/workspace/public/premium-initiative.html +8 -48
  175. package/workspace/public/premium-insights.html +26 -64
  176. package/workspace/public/premium-viewer.html +20 -0
  177. package/workspace/public/premium.html +18 -107
  178. package/workspace/r/m1.png +0 -0
  179. package/workspace/r/m2.png +0 -0
  180. package/workspace/r/m3.png +0 -0
  181. package/workspace/r/nl.png +0 -0
  182. package/workspace/server.js +18 -3
  183. package/workspace/test-files.json +1 -0
  184. package/workspace/test-lists/home-libs.json +9 -0
  185. package/workspace/test-lists/initiative-layout.json +9 -0
  186. package/workspace/test-lists/premium-report-read.json +1 -1
  187. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  188. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  189. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  190. package/workspace/test-lists/premium-vw-notes.json +1 -1
  191. package/workspace/test-lists/uf-everywhere.json +15 -0
  192. package/workspace/test-lists/uf-home.json +9 -0
  193. package/workspace/test-lists/uncovered-board.json +9 -0
  194. package/workspace/public/pm/premium-work.js +0 -729
  195. package/workspace/public/pm/premium.js +0 -1146
@@ -1,11 +1,9 @@
1
1
  /* pm/premium-shell.js — what the premium Briefing and My work pages share: the theme, the toast, the standard dialog and the read-only agent's conversation (initiatives briefing-premium and my-work-premium). */
2
2
  import { pmGet, pmPost } from './http.js';
3
- import { recChipView, STOP_LINE } from './premium-meeting.js';
4
3
  import { vwReset, vwOn, vwCount, vwOpen, vwStyle } from './premium-viewer.js';
5
4
  import { openChatFile, openWebLink } from './premium-vw-file.js';
6
5
  import { turnsOf } from './chat-context.js';
7
6
  import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
8
- import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
9
7
  import { lineItems, behindOf, whenRead } from './freshness-words.js';
10
8
  import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
11
9
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
@@ -13,17 +11,33 @@ import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
13
11
  import { askCardHtml, answerText } from './chat-ask.js';
14
12
  import { termTarget, TERM_ICON } from './chat-term.js';
15
13
  import { openReportTab } from './premium-report-tab.js';
14
+ import { placeholder as czPlaceholderView } from './cozy-viewer.js'; // the Agreed design's Viewer; imported first, so its Escape runs before the dialog's
16
15
  import { openChartTab } from './premium-chart-tab.js';
17
16
  /** A pmos-report block opens the Report tab, or the Chart tab for a chart or a dashboard (premium-reports-from-chat, slice C). */
18
17
  export const openBlockTab = (b) => (b && b.kind === 'report' ? openReportTab(b) : openChartTab(b));
19
18
  import { mountNotes, openNotes, flushNotes, syncNotes } from './premium-notes.js';
20
19
  import { attachMarkup, attachRowMarkup, mountAttach, attachNames, clearAttach, syncAttach, dropFiles, splitFiles, filesHtml, openAttachment } from './premium-attach.js';
21
- import { railModel, railHtml, teaser, menuCount, loudestRow, factsOf, titleOf, endAsks, DOT, WORD } from './session-rail.js';
22
- export const $ = (s, r = document) => r.querySelector(s);
20
+ import { railModel, railHtml, teaser, loudestRow, factsOf, titleOf, endAsks, DOT, WORD } from './session-rail.js';
21
+ /* premium-agreed-design (Home): a page without the old dialog (Home has none) can still import this module. Its top-level wiring then binds to a
22
+ * detached copy of the dialog's parts that is never put in the page, so nothing old shows and nothing throws. A page with #dlg is unchanged. */
23
+ const DETACHED = typeof document !== 'undefined' && !document.getElementById('dlg') ? (() => {
24
+ const d = document.createElement('div');
25
+ d.innerHTML = '<div class="veil" id="veil"></div><div class="dlg" id="dlg" data-mode="split"><p id="dEye"></p><h2 id="dTitle"></h2><p id="dSub"></p>'
26
+ + '<div class="dtools"><button id="dPane"></button><button id="dExpand"><svg><path id="dExpP"/></svg></button><button id="dClose"></button></div><div id="dTabs"></div>'
27
+ + '<div id="dGrid"><section id="dBody"></section><section id="dOut"><div class="otop"><span id="oLab"></span></div><div class="obody" id="oMain"></div><button id="tabGo"></button></section></div></div>'
28
+ + '<div id="toast"></div>';
29
+ return d;
30
+ })() : null;
31
+ export const $ = (s, r = document) => r.querySelector(s) || (DETACHED && r === document ? DETACHED.querySelector(s) : null);
23
32
  /* 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
33
  * 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
34
  if (document.body.classList.contains('cz-home') && innerWidth >= 1000) document.body.classList.add('chatpg', 'cz-dock');
26
35
  export const homeDock = () => document.body.classList.contains('cz-dock');
36
+ /* The Agreed design has one way between places, the floating place menu (cozy-nav.js). The old five-place rail (Briefing, My work, Chat,
37
+ * Board, Insights) and the old dock are no longer wired: the rail leaves the page, and the dock stays hidden and inert until the pages stop
38
+ * writing their counts into it (premium-agreed-design, shared foundation). */
39
+ document.querySelectorAll('nav.rail').forEach((n) => n.remove());
40
+ { const d = document.getElementById('dock'); if (d) { d.hidden = true; d.inert = true; } }
27
41
  export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
28
42
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
29
43
  export const RM = matchMedia('(prefers-reduced-motion: reduce)').matches;
@@ -42,35 +56,38 @@ export function flip() {
42
56
  theme(next); store.set(THEME_KEY, next); tbTheme();
43
57
  }
44
58
  { const t = new URLSearchParams(location.search).get('theme') || store.get(THEME_KEY); theme(t); }
45
- /* ── the top bar (initiative premium-topbar): where you are on the left; the Sources chip, the bell and one menu on the right. Chat is
46
- * the rail's middle place (premium-chat-rail). The menu holds what left the bar: Search, Console, Theme, Settings, and on Board how an initiative opens. Every item keeps
47
- * the id the pages and the code below wire, so a press does what it did as a round button. ── */
59
+ /* ── the top bar: one ⋯ menu (premium-agreed-design). The design draws no Sources chip, no bell, no mic and no help button, and leaves the menu's
60
+ * contents to be designed (only Insights names them: Sources, Export, About these numbers). So each item opens the Viewer on its placeholder, and
61
+ * Theme stays a plain switch. Nothing in the menu leads to the console. The ids moreBtn, moreMenu, modeRow and settingsBtn stay: pages add their
62
+ * own items before #settingsBtn and anchor their popovers on #moreBtn. ── */
48
63
  const MORE = '<svg class="i" viewBox="0 0 24 24"><circle cx="6" cy="12" r="1.3"/><circle cx="12" cy="12" r="1.3"/><circle cx="18" cy="12" r="1.3"/></svg>';
49
64
  const TH = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
65
+ /** The ⋯ menu's items that open a placeholder: [id, label, icon]. Insights adds what its own design names. Pure, for a unit test. */
66
+ export const moreItems = (path = location.pathname) => (/premium-insights/.test(path)
67
+ ? [['srcItem', 'Sources', 'source'], ['tbExport', 'Export', 'export'], ['tbAbout', 'About these numbers', 'info']]
68
+ : [['srcItem', 'Sources', 'source']]);
50
69
  function tbMount() {
51
70
  const t = $('.tools-top'); if (!t || $('#tbMore')) return;
52
- t.insertAdjacentHTML('beforeend', `<button type="button" class="schip" id="srcChip" aria-haspopup="dialog" title="When each source was last read"><i class="sdot" id="srcDot" aria-hidden="true"></i>Sources</button>`
53
- + `<span class="mwrap" id="tbMore"><button type="button" class="glass round" id="moreBtn" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More" title="More">${MORE}<i class="mdot" id="moreDot" hidden></i></button>`
71
+ const items = moreItems();
72
+ t.insertAdjacentHTML('beforeend', `<span class="mwrap" id="tbMore"><button type="button" class="glass round" id="moreBtn" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More" title="More">${MORE}</button>`
54
73
  + '<div class="crmenu tbmenu" id="moreMenu" role="menu" aria-label="More" hidden>'
55
- + '<button role="menuitem" id="pvSearch" aria-haspopup="dialog">Search<em>Ctrl K</em></button>'
56
- + '<button role="menuitem" id="srcItem" class="tbm-src" aria-haspopup="dialog">Sources</button>'
57
- + '<a role="menuitem" id="toConsole" href="/console.html" aria-label="Open the console">Console</a>'
74
+ + items.map(([id, label]) => `<button role="menuitem" id="${id}" aria-haspopup="dialog">${esc(label)}</button>`).join('')
58
75
  + '<div class="tbrow" id="modeRow" hidden><span>Open initiatives</span></div>'
59
76
  + `<div class="tbrow" role="group" aria-label="Theme"><span>Theme</span><span class="tbseg" id="tbTheme">${TH.map(([k, w]) => `<button role="menuitemradio" data-th="${k}" aria-checked="false">${w}</button>`).join('')}</span></div>`
60
- + '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings<em class="updpill" id="updPill" hidden></em></button></div></span>');
77
+ + '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings</button></div></span>');
61
78
  const ms = $('#modeSeg'); if (ms) { $('#modeRow').appendChild(ms); $('#modeRow').hidden = false; }
62
79
  tbTheme();
63
80
  const btn = $('#moreBtn'), menu = $('#moreMenu');
64
- const items = () => $$('#moreMenu [role^="menuitem"]').filter((x) => x.offsetParent !== null || x.closest('.tbseg'));
81
+ const live = () => $$('#moreMenu [role^="menuitem"]').filter((x) => x.offsetParent !== null || x.closest('.tbseg'));
65
82
  const close = (back) => { if (menu.hidden) return; menu.hidden = true; btn.setAttribute('aria-expanded', 'false'); if (back) btn.focus(); };
66
83
  btn.onclick = (e) => {
67
84
  e.stopPropagation();
68
85
  if (!menu.hidden) { close(); return; }
69
86
  menu.hidden = false; btn.setAttribute('aria-expanded', 'true');
70
87
  if ($('#modeSeg', menu)) pillOf($('#modeSeg', menu));
71
- const f = items()[0]; if (f) f.focus();
88
+ const f = live()[0]; if (f) f.focus();
72
89
  };
73
- // capture: the menu closes and focus goes back to its button before the item's own press runs, so a dialog it opens returns focus there
90
+ // capture: the menu closes and focus goes back to its button before the item's own press runs, so a view it opens returns focus there
74
91
  menu.addEventListener('click', (e) => {
75
92
  const th = e.target.closest('[data-th]');
76
93
  if (th) { const v = th.dataset.th; theme(v === 'auto' ? null : v); store.set(THEME_KEY, v === 'auto' ? '' : v); tbTheme(); return; }
@@ -81,10 +98,11 @@ function tbMount() {
81
98
  menu.addEventListener('keydown', (e) => {
82
99
  if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(true); return; }
83
100
  if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
84
- const L = items(), i = L.indexOf(document.activeElement); if (!L.length) return;
101
+ const L = live(), i = L.indexOf(document.activeElement); if (!L.length) return;
85
102
  e.preventDefault(); L[(i + (e.key === 'ArrowDown' ? 1 : L.length - 1) + (i < 0 ? 1 : 0)) % L.length].focus();
86
103
  });
87
- $('#srcChip').onclick = () => openSources(); $('#srcItem').onclick = () => openSources();
104
+ items.forEach(([id, label, icon]) => { $('#' + id).onclick = id === 'srcItem' ? () => import('./cozy-sources.js').then((M) => M.openSources()) // the designed Sources (premium-uncovered-features E3)
105
+ : () => czPlaceholderView(label, { icon }); });
88
106
  tbReadSrc();
89
107
  setInterval(() => { if (!document.hidden) tbReadSrc(); }, 300000);
90
108
  }
@@ -92,9 +110,8 @@ function tbTheme() {
92
110
  const cur = document.documentElement.dataset.theme || 'auto';
93
111
  $$('#tbTheme [data-th]').forEach((b) => b.setAttribute('aria-checked', String(b.dataset.th === cur)));
94
112
  }
95
- let ABOUT = null;
96
- /** The page the rail's Chat brings along (premium-chat-page): the conversation key of this page and its name. The Chat page opens that conversation. */
97
- export function chatAbout(key, label) { ABOUT = key ? { key, label: label || '' } : null; }
113
+ /** The page's own conversation (premium-chat-page). The rail's Chat that carried it is gone; the pages still name it, and nothing reads it now. */
114
+ export function chatAbout(key, label) { return key ? { key, label: label || '' } : null; }
98
115
  /** On the Chat page the dialog is the page: it never closes, Escape does nothing, and the rail stays live. */
99
116
  const chatPage = () => document.body.classList.contains('chatpg');
100
117
 
@@ -259,8 +276,8 @@ export function openChatPage(key, label) {
259
276
  ? 'Talk to Claude about ' + label + '. It works in a real Claude Code session: it can read, change files, run commands and take slash commands.'
260
277
  : '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.';
261
278
  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 });
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 = '';
279
+ if (chatPage()) { // the held-open chat (desktop Home) leaves the page live; on a phone Home's chat is a popup and keeps openDlg's veil and inert page
280
+ document.documentElement.style.overflow = '';
264
281
  $('#veil').classList.remove('on');
265
282
  }
266
283
  $('#askIn').placeholder = label ? 'Message Claude about ' + label : 'Message Claude, or type /';
@@ -268,9 +285,8 @@ export function openChatPage(key, label) {
268
285
  vwShutPane(); // premium-chat-viewer V1: the conversation has the room until something opens in the viewer
269
286
  loadThread(key);
270
287
  }
271
- tbMount(); // the top bar first: the menu holds the Settings, Sessions, Console and Search items the code below wires
272
- { const t2 = $('#theme2'); if (t2) t2.onclick = flip; }
273
- { const b = $('#settingsBtn'); if (b) b.onclick = () => openSettings(); } // hoisted: the function below is declared, not assigned
288
+ tbMount(); // the top bar first: the menu holds the Settings item the code below reads
289
+ { const b = $('#settingsBtn'); if (b) b.onclick = () => import('./cozy-settings.js').then((M) => M.openSettings()); } // the designed Settings (premium-uncovered-features E3)
274
290
 
275
291
  /* ── toast ──────────────────────────────────────────────────────────────────────────────────────────────── */
276
292
  let tt = null;
@@ -317,7 +333,7 @@ export function openDlg(o) {
317
333
  if (S.ctx) markSeen(S.key, S.ctx);
318
334
  park(); // a page's own control lent to the dialog (the Briefing's product picker) goes home before the pane is replaced
319
335
  const ae = document.activeElement; if (ae && ae !== document.body) lastFocus = ae;
320
- $$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; });
336
+ $$('main.stage').forEach((x) => { x.inert = true; });
321
337
  $('#dlg').inert = false; document.documentElement.style.overflow = 'hidden';
322
338
  $('#dEye').textContent = o.eye; $('#dTitle').textContent = o.title; $('#dSub').textContent = o.sub || ''; $('#dSub').hidden = !o.sub;
323
339
  $('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail';
@@ -340,7 +356,7 @@ export function openDlg(o) {
340
356
  * detail to show; a placeholder note leaves it folded, and the icon at the chat's top right opens it again. */
341
357
  function dockOpen(o) {
342
358
  $('#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 = '';
359
+ $('#veil').classList.remove('on'); $$('main.stage').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
344
360
  setFull(true);
345
361
  if (o.paneEmpty || o.sessions) vwShutPane(); else vwOpenPane(true);
346
362
  }
@@ -373,9 +389,8 @@ export function closeDlg() {
373
389
  if (chatPage()) return;
374
390
  clearTimeout(threadTimer); S.key = null; syncTerm(null); flushNotes(); railOnClose();
375
391
  park();
376
- $('#veil').classList.remove('on'); $$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; });
392
+ $('#veil').classList.remove('on'); $$('main.stage').forEach((x) => { x.inert = false; });
377
393
  $('#dlg').inert = true; document.documentElement.style.overflow = ''; $('#dlg').classList.remove('on');
378
- $('#dock').inert = !document.body.classList.contains('docked');
379
394
  if (lastFocus) { try { lastFocus.focus(); } catch { /* gone */ } }
380
395
  }
381
396
  export function pillOf(s) { const o = $('button[aria-pressed="true"]', s), p = $('.pill', s); requestAnimationFrame(() => { if (!o || !p) return; p.style.left = o.offsetLeft + 'px'; p.style.width = o.offsetWidth + 'px'; }); }
@@ -401,6 +416,7 @@ function syncTerm(t = null) {
401
416
  }
402
417
  $('#dTerm').onclick = async () => {
403
418
  const t = S.term; if (!t) return;
419
+ if (t.term) { import('./term-view.js').then((M) => M.openTermView(t.term, { title: ($('#dTitle') || {}).textContent || t.term })); return; }
404
420
  if (t.href) { window.open(t.href, '_blank', 'noopener'); return; }
405
421
  try { await navigator.clipboard.writeText(t.copy); toast('Copied. Paste it in Terminal on the computer PMOS runs on.'); }
406
422
  catch { toast('Copy did not work here. The command: ' + t.copy); }
@@ -421,6 +437,7 @@ addEventListener('keydown', (e) => {
421
437
  }, true);
422
438
  (() => {
423
439
  const g = $('#dlg .grab'); let y0 = null, dy = 0;
440
+ if (!g) return; // a page with no dialog (the DETACHED stub has no grab handle)
424
441
  g.addEventListener('pointerdown', (e) => { y0 = e.clientY; dy = 0; try { g.setPointerCapture(e.pointerId); } catch { /* none */ } });
425
442
  g.addEventListener('pointermove', (e) => { if (y0 == null) return; dy = Math.max(0, e.clientY - y0); $('#dlg').style.transition = 'none'; $('#dlg').style.transform = `translateY(${dy}px)`; });
426
443
  const end = () => { if (y0 == null) return; const d = dy; y0 = null; dy = 0; $('#dlg').style.transition = ''; $('#dlg').style.transform = ''; if (d > 90) closeDlg(); };
@@ -765,16 +782,12 @@ $('#dBody').addEventListener('submit', async (e) => {
765
782
  if (await sendText(key, text, files)) { inp.value = ''; inp.placeholder = 'Message Claude, or type /'; clearAttach(); drawSlash(); growAsk(); }
766
783
  });
767
784
 
768
- /* ── the hero folds into the dock on scroll ─────────────────────────────────────────────────────────────── */
785
+ /* ── on scroll: a card's head sticks while its card is on screen. The old hero no longer folds into a dock (premium-agreed-design). ── */
769
786
  let tick = false;
770
787
  export function onScroll() {
771
788
  if (tick) return; tick = true;
772
789
  requestAnimationFrame(() => {
773
790
  tick = false;
774
- const y = scrollY, h = $('.hero').offsetHeight, p = Math.max(0, Math.min(1, y / (h * 0.55))), big = $('.brief');
775
- if (!RM) { big.style.transform = `translateY(${-p * 30}px) scale(${1 - p * 0.12})`; big.style.opacity = 1 - p * 0.9; }
776
- document.body.classList.toggle('docked', p > 0.62);
777
- if (!$('#dlg').classList.contains('on')) $('#dock').inert = p <= 0.62;
778
791
  $$('.ch').forEach((c) => { const k = c.closest('.card, .cz-grp'); if (k) c.classList.toggle('stuck', c.getBoundingClientRect().top <= 61 && k.getBoundingClientRect().bottom > 140); });
779
792
  });
780
793
  }
@@ -796,64 +809,11 @@ if (window.visualViewport) {
796
809
  visualViewport.addEventListener('resize', () => { const shut = visualViewport.height >= innerHeight - 1; if (kb && shut) settleFixed(); kb = !shut; });
797
810
  }
798
811
 
799
- /* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
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)
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) ───────────────
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. */
803
- function mountRecChip(here) {
804
- const c = document.createElement('div'); c.className = 'recchip glass'; c.id = 'recChip'; c.hidden = true; c.setAttribute('role', 'status'); document.body.appendChild(c);
805
- let rows = [], ask = false, msg = '';
806
- const holding = () => (window.__premiumHolding && window.__premiumHolding.id) || null;
807
- const draw = () => {
808
- const v = recChipView(rows, { holdingId: holding(), here });
809
- if (!v) { c.hidden = true; c.innerHTML = ''; ask = false; return; }
810
- c.hidden = false; c.dataset.mode = v.mode;
811
- if (ask) { c.innerHTML = `<span>Stop “${esc(v.title)}” for good? ${esc(STOP_LINE)}</span><button data-r="no">Cancel</button>${v.held ? '<button data-r="pause">Pause instead</button>' : ''}<button data-r="stopgo">Stop for good</button>`; return; }
812
- const L = { hl: 'Highlight', pause: 'Pause', fv: 'Focus', open: 'Open', resume: 'Resume', stop: 'Stop' }; // the presses premium-vw-rec.js gives this page
813
- c.innerHTML = `<i${v.mode === 'paused' ? ' class="paused"' : ''}></i><span>${esc(msg || v.text)}</span>${chipActs(v, here).map((a) => `<button data-r="${a}"${a === 'hl' ? ` title="${esc(HL_LINE)}"` : ''}>${L[a]}</button>`).join('')}`;
814
- };
815
- const read = async () => { const r = await pmGet('/api/notes'); if (r && r.ok === true && Array.isArray(r.notes)) rows = r.notes; draw(); };
816
- c.addEventListener('click', async (e) => {
817
- const b = e.target.closest('button'); if (!b) return;
818
- const v = recChipView(rows, { holdingId: holding(), here }); if (!v) return;
819
- const act = b.dataset.r; msg = '';
820
- const d = { openDlg, toast, pmGet, pmPost };
821
- if (act === 'open') { if (here === 'brief' && window.__premiumRec) openLive(v.id, d); else location.assign('/premium.html?meeting=' + encodeURIComponent(v.id)); return; }
822
- if (act === 'fv') { openFocus(v.id, d); return; }
823
- if (act === 'stop') { ask = true; draw(); const g = c.querySelector('[data-r="no"]'); if (g) g.focus(); return; }
824
- if (act === 'no') { ask = false; draw(); return; }
825
- b.disabled = true;
826
- if (act === 'hl') { const r = window.__premiumRec ? await window.__premiumRec.highlight() : { ok: false }; msg = r.ok ? 'Highlighting the last 30 seconds and the next ones.' : (r.error || 'The highlight was not started.'); draw(); setTimeout(() => { msg = ''; draw(); }, 6000); return; }
827
- if (act === 'pause') { ask = false; const r = window.__premiumRec ? await window.__premiumRec.pause() : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not paused.'); }
828
- else if (act === 'resume') { const r = window.__premiumRec ? await window.__premiumRec.resume(v.id) : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not resumed.'); }
829
- else if (act === 'stopgo') {
830
- ask = false;
831
- const r = window.__premiumRec ? await window.__premiumRec.stop(v.id) : await pmPost('/api/notes/stop', { id: v.id });
832
- if (r && r.ok === true) toast('Stopped for good. The final notes are written now.'); else msg = (r && r.error) || 'The meeting was not stopped.';
833
- }
834
- await read();
835
- });
836
- addEventListener('premium-rec', read);
837
- read(); setInterval(read, 20000);
838
- mountRecord(here, { openDlg, toast, pmGet, pmPost });
839
- }
840
- export function wireRail(here) {
841
- mountRecChip(here);
842
- const rail = $('.rail');
843
- // premium-chat-rail: five places with Chat in the middle. The phone bar slides by whole places (--pi); the desktop rail's Chat is taller, so
844
- // the indicator there is placed at the current place's own top (--py).
845
- const cur = $(`.rail [data-go="${here}"]`), all = $$('.rail .pl');
846
- rail.style.setProperty('--pi', String(all.indexOf(cur)));
847
- const place = () => { if (cur) rail.style.setProperty('--py', (cur.offsetTop - all[0].offsetTop) + 'px'); };
848
- place(); addEventListener('resize', place);
849
- $$('.rail [data-go]').forEach((b) => { b.onclick = () => { if (b.dataset.go !== here) location.assign(b.dataset.go === 'chat' ? chatHref() : GO[b.dataset.go]); }; });
850
- }
851
- /** The Chat page's address: the workspace the PM is in, and the page they came from as the conversation it opens (premium-chat-page). */
852
- function chatHref() {
853
- const q = new URLSearchParams(), ws = new URLSearchParams(location.search).get('ws');
854
- if (ws) q.set('ws', ws);
855
- if (ABOUT) { q.set('about', ABOUT.key); if (ABOUT.label) q.set('label', ABOUT.label); }
856
- const s = q.toString(); return GO.chat + (s ? '?' + s : '');
812
+ /* ── a page's start (premium-agreed-design): the old rail, the floating record chip (#recChip) and the round mic (#recCtl) are gone; the place
813
+ * menu (cozy-nav.js) moves between places, and recording shows in the Viewer's recording bar and Home's meeting line. Recording starts from
814
+ * the Viewer (window.czViews.newNote, or a meeting's Record), so a page start draws no recorder; an old page's mic is taken out. ── */
815
+ export function wireRail() {
816
+ const mic = document.getElementById('recCtl'); if (mic) mic.remove();
857
817
  }
858
818
 
859
819
  /* ── the crumb: where you are and a menu to switch board or initiative. Its Chat moved to the rail (premium-chat-rail) ──────────── */
@@ -923,9 +883,9 @@ export function openAddDoc(o) {
923
883
  };
924
884
  }
925
885
 
926
- /* ── Search (Ctrl K or "/") and the bell, in the header of every premium page (initiative premium-search-bell). Reads only; a press goes to a page. ── */
886
+ /* ── Search (Ctrl K or "/") and the agent inbox (initiative premium-search-bell). Reads only; a press goes to a page.
887
+ * The Agreed design draws no bell, so none is drawn: the inbox is still read (its count, its toast and the panel premium.js opens). ── */
927
888
  const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>';
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>';
929
889
  const IC = (d) => `<svg class="i" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
930
890
  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') };
931
891
  const PLACES = [['Home', '/premium.html'], ['Board', '/premium-board.html'], ['Insights', '/premium-insights.html']];
@@ -937,10 +897,9 @@ const pvOv = { kind: null, back: null, at: 0, list: [], pal: null, need: null };
937
897
  * first read never toasts), shown the new ids the open panel shows (closing the panel marks them seen), toastAt the last toast (at most one per 15 min). */
938
898
  const IB = { r: null, ids: null, shown: [], toastAt: 0 };
939
899
  function pvMount() {
940
- const a = $('#tbMore'); if (!a || $('#pvBell')) return;
941
- a.insertAdjacentHTML('beforebegin', `<button class="glass round pv-hp" id="pvBell" aria-haspopup="dialog" aria-label="Needs you" title="Needs you">${BELL}<span class="pv-bdg" id="pvBdg" hidden></span></button>`);
900
+ if (!$('#tbMore') || $('#pvOv')) return;
942
901
  document.body.insertAdjacentHTML('beforeend', '<div class="pv-scrim" id="pvScrim"></div><div class="pv-ov" id="pvOv" role="dialog" aria-modal="true" hidden inert></div>');
943
- $('#pvSearch').onclick = () => pvOpen('pal'); $('#pvBell').onclick = () => pvOpen('bell'); $('#pvScrim').onclick = pvClose;
902
+ $('#pvScrim').onclick = pvClose;
944
903
  pvNeeds(); ibRead();
945
904
  setInterval(() => { if (!document.hidden) ibRead(); }, 60000);
946
905
  document.addEventListener('visibilitychange', () => { if (!document.hidden) ibRead(); });
@@ -949,23 +908,27 @@ export function pvClose() {
949
908
  if (!pvOv.kind) return;
950
909
  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
951
910
  pvOv.kind = null; $('#pvOv').hidden = true; $('#pvOv').inert = true; $('#pvScrim').classList.remove('on');
952
- $$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; }); $('#dock').inert = !document.body.classList.contains('docked'); document.documentElement.style.overflow = '';
911
+ $$('main.stage').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
953
912
  if (homeDock()) $('#dlg').inert = false;
954
913
  if (pvOv.back) { try { pvOv.back.focus(); } catch { /* gone */ } }
955
914
  }
956
915
  export const pvOpenBell = () => pvOpen('bell');
957
916
  function pvOpen(kind) {
917
+ // premium-uncovered-features: Search is the place menu's palette (E1) and the bell's results are in New for you (E2)
918
+ if (kind === 'pal') { import('./cozy-search.js').then((M) => M.openSearch({})); return; }
919
+ if (kind === 'bell') { import('./cozy-news.js').then((M) => M.openNews({})); return; }
958
920
  if (pvOv.kind === kind) { pvClose(); return; }
959
921
  if (pvOv.kind) pvClose();
960
- const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $(kind === 'pal' ? '#moreBtn' : '#pvBell');
922
+ const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $('#moreBtn');
961
923
  pvOv.kind = kind; pvOv.at = 0;
962
- $$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
924
+ $$('main.stage').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
963
925
  if (homeDock()) $('#dlg').inert = true;
964
926
  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');
965
927
  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(); }
966
928
  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(); }
967
929
  }
968
- const pvGo = (it) => { pvClose(); if (it.go) location.assign(it.go); };
930
+ /* A session opens in Home's chat: in place on Home, or Home opens on it (?session=<id>, read at the end of this file). Never the console. */
931
+ const pvGo = (it) => { pvClose(); if (it.sid && pvOnBriefing()) { openSessionAt(it.sid); return; } if (it.go) location.assign(it.go); };
969
932
  const pvRow = (it, i, sel) => `<button type="button" class="pv-row" role="option" id="pvo${i}" data-i="${i}" aria-selected="${sel}"><span class="gl">${GL[it.gl]}</span><span><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ''}</span></button>`;
970
933
  async function pvPal() {
971
934
  if (!pvOv.pal) {
@@ -973,7 +936,7 @@ async function pvPal() {
973
936
  const miss = [];
974
937
  const ini = b.j && b.j.ok && Array.isArray(b.j.rows) ? b.j.rows.map((r) => ({ g: 'Initiatives', gl: 'ini', t: r.title || r.id, s: [r.lane, r.stage].filter(Boolean).join(' · '), go: '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (b.j.ws ? '&ws=' + encodeURIComponent(b.j.ws) + '&board=' + encodeURIComponent(b.j.board) : '') })) : (miss.push('initiatives'), []);
975
938
  const docs = d.j && d.j.ok && Array.isArray(d.j.docs) ? d.j.docs.map((x) => ({ g: 'Documents', gl: 'doc', t: x.title || x.key, s: d.j.scope && d.j.scope.name ? d.j.scope.name : 'Board', go: '/premium-board.html' + pvQ('?') })) : (miss.push('documents'), []);
976
- const ses = s.j && Array.isArray(s.j.sessions) ? s.j.sessions.filter((x) => !x.automatic).map((x) => ({ g: 'Sessions', gl: 'ses', t: x.name || x.id, s: [x.cwd && x.cwd !== '.' ? x.cwd : '', x.state].filter(Boolean).join(' · '), go: '/console.html' })) : (miss.push('sessions'), []);
939
+ const ses = s.j && Array.isArray(s.j.sessions) ? s.j.sessions.filter((x) => !x.automatic).map((x) => ({ g: 'Sessions', gl: 'ses', t: x.name || x.id, s: [x.cwd && x.cwd !== '.' ? x.cwd : '', x.state].filter(Boolean).join(' · '), sid: x.id, go: '/premium.html?' + ['session=' + encodeURIComponent(x.id), PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&') })) : (miss.push('sessions'), []);
977
940
  pvOv.pal = { items: [...PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go })), ...ini, ...docs, ...ses], miss };
978
941
  }
979
942
  if (pvOv.kind === 'pal') pvPalDraw();
@@ -1069,11 +1032,7 @@ addEventListener('keydown', (e) => {
1069
1032
  else if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvClose(); }
1070
1033
  return;
1071
1034
  }
1072
- if (!$('#pvSearch') || ($('#dlg').classList.contains('on') && !homeDock())) return; // Home's docked chat is always open: Ctrl K still searches
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;
1075
- const t = document.activeElement;
1076
- if (e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !(t && t.matches && t.matches('input,textarea,select,[contenteditable="true"]'))) { e.preventDefault(); pvOpen('pal'); }
1035
+ // Ctrl K and / open Search from the place menu (cozy-nav.js), on every page
1077
1036
  }, true);
1078
1037
  pvMount();
1079
1038
  /* ── Settings: the two things that cannot be defaulted (initiative premium-settings) ────────────────────────────────────────────────────
@@ -1204,7 +1163,7 @@ export async function openSettings() {
1204
1163
  <div class="two" style="margin-top:10px"><label><input id="stP" maxlength="500" placeholder="Folder path of a repository" aria-label="Folder path of a repository"></label><button type="button" class="cta" id="stAdd">Add repository</button></div></div>
1205
1164
  <div><span class="label">Connectors</span><p class="note" style="margin:0 0 8px">Every connector your Claude session has. Your sessions can use all of them; a switch chooses only what PMOS reads on its own, such as the sources of the Briefing. PMOS keeps no passwords or keys.</p>${srcRows}${connRows}</div>
1206
1165
  <p class="note" id="stM" role="status" style="margin:0;min-height:1.2em">${esc(M.err)}</p>
1207
- <p class="note" style="margin:0">Everything else runs on a default. <a href="/console.html?tab=settings">More settings in the console</a>.</p></div></article>`;
1166
+ <p class="note" style="margin:0">Everything else runs on a default.</p></div></article>`;
1208
1167
  };
1209
1168
  openDlg({ eye: 'Settings · real data', title: 'Settings', say: 'Updates and what each kit changed, then two choices: which repositories PMOS works in, and which sources the Briefing reads.', stream: turnA(ptx('Updates and what each published kit changed, copied from its merged pull requests. Then two choices: which repositories PMOS works in, and which sources the Briefing reads. Each press saves that one record and changes nothing else.')), noteKey: popKey('settings'), pane: '<article class="paper doc"></article>', label: 'Settings' });
1210
1169
  setMode('detail'); draw();
@@ -1385,7 +1344,6 @@ function railDraw() {
1385
1344
  t.hidden = !tz || !t.dataset.on || $('#dlg').classList.contains('full');
1386
1345
  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'))); }
1387
1346
  }
1388
- sessBadge(menuCount(R.rows));
1389
1347
  document.dispatchEvent(new CustomEvent('pmos:sessions', { detail: m })); // Home's list counts them and finds an initiative's own sessions
1390
1348
  }
1391
1349
  /** Home: open one session from the list's own rows (an initiative's sessions). */
@@ -1453,7 +1411,7 @@ function cardDraw(r) {
1453
1411
  ${R.ask ? `<div class="ssc" role="group" aria-label="Confirm stop"><p><b>Stop “${esc(r.name)}”?</b> ${what} Files it already wrote stay where they are.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
1454
1412
  : R.slow ? `<div class="ssc" role="group" aria-label="Still running"><p><b>Asked “${esc(r.name)}” to end.</b> It has not exited yet. Press Stop again to remove it.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop again</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
1455
1413
  : `<div class="ssx"><button type="button" class="cta alt" data-stop="1"${R.busy ? ' disabled' : ''}>${R.busy ? 'Ending…' : 'Stop'}</button></div>`}
1456
- <p class="note" role="status">${esc(R.err)}</p><p class="note">Its terminal is in the console. <a href="/console.html">Open the console</a>.</p></article>`;
1414
+ <p class="note" role="status">${esc(R.err)}</p></article>`;
1457
1415
  }
1458
1416
  $('#oMain').addEventListener('click', async (e) => {
1459
1417
  const card = e.target.closest('.scard'); if (!card || R.busy) return;
@@ -1478,18 +1436,6 @@ $('#oMain').addEventListener('click', async (e) => {
1478
1436
  cardDraw(r);
1479
1437
  }
1480
1438
  });
1481
- /* The rail's Chat carries the count the ⋯ menu's Sessions used to: a dot when a session is Ready or Maybe blocked (premium-chat-rail C5). */
1482
- function sessBadge(n) {
1483
- const a = $('.rail [data-go="chat"]'); if (!a) return;
1484
- const d = $('.cdot', a); if (d) d.hidden = !n;
1485
- a.setAttribute('aria-label', n ? 'Chat, ' + n + (n === 1 ? ' session needs you' : ' sessions need you') : 'Chat');
1486
- }
1487
- {
1488
- if ($('.rail [data-go="chat"]')) {
1489
- const poll = async () => { if (document.hidden || railShowing()) return; const s = await pmGet('/api/sessions').catch(() => null); if (s && Array.isArray(s.sessions)) { R.rows = s.sessions; sessBadge(menuCount(R.rows)); } };
1490
- poll(); setInterval(poll, BADGE_POLL);
1491
- }
1492
- }
1493
1439
  /** The session list on its own (the rail's Chat on a page with no conversation): the chat panel, full screen with the list (the list itself on a phone), on the session that needs you most. */
1494
1440
  export async function openSessions() {
1495
1441
  openDlg({ eye: 'Sessions', title: 'Sessions', say: 'Pick a session from the list.', stream: turnA(ptx('Pick a session from the list. A dot shows its state: Ready, Running or Maybe blocked.')), noteKey: null, sessions: true, pane: '<article class="paper doc"><p class="note">Pick a session from the list.</p></article>', label: 'Session' });
@@ -1500,3 +1446,10 @@ export async function openSessions() {
1500
1446
  const top = loudestRow(R.model);
1501
1447
  if (top && desk()) pickSession(top.id);
1502
1448
  }
1449
+ /** Open one session in Home's chat: the session list opens on it (a desktop docks it beside the list; a phone shows the chat). */
1450
+ async function openSessionAt(id) {
1451
+ await openSessions();
1452
+ if (R.model && R.model.rows.some((x) => x.id === id)) pickSession(id); else toast('That session is not running any more.');
1453
+ }
1454
+ /* Home opened from a search result elsewhere: ?session=<id>. It waits one turn, so Home's own chat (premium-chat.js) opens first. */
1455
+ { const sid = new URLSearchParams(location.search).get('session'); if (sid && pvOnBriefing()) setTimeout(() => openSessionAt(sid), 0); }
@@ -9,6 +9,7 @@
9
9
  * premium-chat-viewer: #oMain with data-empty="1" holds only a placeholder note, so its tab is not drawn and closing the last other tab empties
10
10
  * the viewer. vwOn(fn) hears fn('open', id), fn('show', id) and fn('empty'): the Chat page opens and closes its viewer on them. Tabs that do not
11
11
  * fit fold, oldest first, into a "+N" button that lists them; the current tab always shows. */
12
+ import { open as czOpen, current as czCurrent, close as czClose } from './cozy-viewer.js';
12
13
  const MAX = 4;
13
14
  const IC = {
14
15
  doc: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5', cal: 'M3.5 5h17v15h-17zM3.5 10h17M8 3v4M16 3v4', notes: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5',
@@ -77,7 +78,25 @@ if (typeof ResizeObserver !== 'undefined') {
77
78
  setTimeout(watch, 0);
78
79
  vwOn(() => watch());
79
80
  }
80
- function pane(id) { return id === 'main' ? q('#oMain') : document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`); }
81
+ function pane(id) { return id === 'main' ? q('#oMain') : document.querySelector(`.obody.vw[data-vw="${CSS.escape(id)}"]`); }
82
+ /* A page with no dialog (Home in the Agreed design): a view opens in the cozy Viewer card (cozy-viewer.js) instead of a tab of #dOut, one at a time.
83
+ * The view draws into the same .obody.vw element, so its own code does not change. */
84
+ const CZ_ICON = { tk: 'jira', list: 'list', goal: 'goal', mic: 'mic', cal: 'cal', notes: 'notes', doc: 'doc' };
85
+ let czLast = null;
86
+ /** Opens again the last item the cozy Viewer showed through vwOpen (Home's "Open the Viewer" button). False when there is none. */
87
+ export function vwReopen() { if (!czLast) return false; czVw(czLast); return true; }
88
+ function czVw(it) {
89
+ let el = null; czLast = it;
90
+ czOpen({ id: 'vw:' + it.id, kind: it.kind || it.title || 'Item', title: it.name || it.title || 'Item', icon: CZ_ICON[it.icon] || 'doc', url: it.url || '',
91
+ render: (body) => {
92
+ el = document.createElement('div'); el.className = 'obody vw'; el.dataset.vw = it.id; el.setAttribute('role', 'region'); body.append(el);
93
+ if (it.render) it.render(el); else el.innerHTML = it.html || '';
94
+ if (it.wire) it.wire(el);
95
+ },
96
+ onClose: () => emit('empty') });
97
+ emit('open', it.id);
98
+ return el;
99
+ }
81
100
  export function vwShow(id) {
82
101
  if (id !== 'main' && !V.items.some((x) => x.id === id)) id = 'main';
83
102
  if (id === 'main' && !mainReal() && V.items.length) id = V.items[V.items.length - 1].id; // the placeholder is never a tab of its own
@@ -90,6 +109,7 @@ export function vwShow(id) {
90
109
  }
91
110
  export function vwOpen(it) {
92
111
  if (!it || !it.id) return null;
112
+ if (typeof document !== 'undefined' && !document.getElementById('dOut')) return czVw(it);
93
113
  const was = V.items.find((x) => x.id === it.id);
94
114
  if (was) { Object.assign(was, it); fill(was); vwShow(it.id); emit('open', it.id); return pane(it.id); }
95
115
  if (V.items.length >= MAX) vwClose(V.items[0].id, true);
@@ -105,6 +125,7 @@ function fill(rec) {
105
125
  if (rec.wire) rec.wire(el);
106
126
  }
107
127
  export function vwClose(id, quiet) {
128
+ if (typeof document !== 'undefined' && !document.getElementById('dOut')) { const c = czCurrent(); if (c && c.id === 'vw:' + id) czClose(); return; }
108
129
  const i = V.items.findIndex((x) => x.id === id); if (i < 0) return;
109
130
  V.items.splice(i, 1); const p = pane(id); if (p) p.remove();
110
131
  if (quiet) return;