create-pmos 0.398.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 (126) 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/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +18 -14
  7. package/workspace/briefing-premium-board-test.js +80 -48
  8. package/workspace/briefing-premium-calendar-2-test.js +36 -36
  9. package/workspace/briefing-premium-calendar-3-test.js +39 -39
  10. package/workspace/briefing-premium-calendar-test.js +23 -24
  11. package/workspace/briefing-premium-doc-edit-test.js +6 -2
  12. package/workspace/briefing-premium-initiative-test.js +38 -16
  13. package/workspace/briefing-premium-insights-test.js +114 -37
  14. package/workspace/briefing-premium-metrics-test.js +6 -4
  15. package/workspace/briefing-premium-products-test.js +10 -7
  16. package/workspace/briefing-premium-sources-test.js +25 -22
  17. package/workspace/briefing-premium-test.js +46 -42
  18. package/workspace/briefing-premium-work-test.js +9 -9
  19. package/workspace/changelog.json +12 -0
  20. package/workspace/ev-everywhere-test.js +210 -0
  21. package/workspace/fixtures/premium-viewer-fixtures.js +11 -6
  22. package/workspace/guide/home.md +39 -18
  23. package/workspace/guide/index.md +1 -1
  24. package/workspace/lib/board-grill.js +63 -0
  25. package/workspace/lib/board-premium.js +36 -5
  26. package/workspace/lib/initiative-layout.js +77 -0
  27. package/workspace/lib/insights-premium.js +3 -2
  28. package/workspace/lib/insights-records.js +21 -7
  29. package/workspace/lib/meeting-points.js +52 -0
  30. package/workspace/lib/news-for-you.js +88 -0
  31. package/workspace/lib/notes-series.js +29 -6
  32. package/workspace/lib/report-confirm.js +48 -0
  33. package/workspace/lib/route-modules.js +8 -0
  34. package/workspace/lib/routes-board-docs.js +46 -0
  35. package/workspace/lib/routes-board-grill.js +90 -0
  36. package/workspace/lib/routes-home-review.js +108 -0
  37. package/workspace/lib/routes-initiative-layout.js +57 -0
  38. package/workspace/lib/routes-insights-premium.js +4 -1
  39. package/workspace/lib/routes-insights-records.js +8 -4
  40. package/workspace/lib/routes-meeting-points.js +37 -0
  41. package/workspace/lib/routes-news.js +57 -0
  42. package/workspace/lib/routes-notes.js +2 -1
  43. package/workspace/lib/routes-report-confirm.js +31 -0
  44. package/workspace/lib/routes-search.js +38 -0
  45. package/workspace/lib/search-index.js +176 -0
  46. package/workspace/package-lock.json +2 -2
  47. package/workspace/package.json +1 -1
  48. package/workspace/premium-board-actions-test.js +86 -50
  49. package/workspace/premium-briefing-depth-test.js +55 -54
  50. package/workspace/premium-chat-chart-tab-test.js +4 -2
  51. package/workspace/premium-chat-report-tab-test.js +16 -2
  52. package/workspace/premium-core-doc-issue-test.js +15 -13
  53. package/workspace/premium-phone-card-test.js +5 -3
  54. package/workspace/premium-report-read-test.js +55 -18
  55. package/workspace/premium-vw-backlog-test.js +2 -2
  56. package/workspace/premium-vw-cal-test.js +50 -35
  57. package/workspace/premium-vw-doc-test.js +9 -3
  58. package/workspace/premium-vw-item-test.js +1 -1
  59. package/workspace/premium-vw-jira-test.js +2 -2
  60. package/workspace/premium-vw-meet-test.js +37 -40
  61. package/workspace/premium-vw-notes-test.js +21 -19
  62. package/workspace/premium-vw-rec-test.js +11 -12
  63. package/workspace/premium-welcome-test.js +3 -3
  64. package/workspace/premium-work-depth-test.js +3 -3
  65. package/workspace/public/pm/bd-acts.js +303 -225
  66. package/workspace/public/pm/bd-asks.js +261 -0
  67. package/workspace/public/pm/bd-pop.js +59 -0
  68. package/workspace/public/pm/bd-span.js +49 -13
  69. package/workspace/public/pm/bd-views.js +169 -0
  70. package/workspace/public/pm/cozy-board.css +301 -0
  71. package/workspace/public/pm/cozy-ev.css +228 -0
  72. package/workspace/public/pm/cozy-evmodel.js +106 -0
  73. package/workspace/public/pm/cozy-evui.js +47 -0
  74. package/workspace/public/pm/cozy-insights.css +148 -10
  75. package/workspace/public/pm/cozy-nav.js +103 -39
  76. package/workspace/public/pm/cozy-news.js +140 -0
  77. package/workspace/public/pm/cozy-search.js +203 -0
  78. package/workspace/public/pm/cozy-settings.js +198 -0
  79. package/workspace/public/pm/cozy-sources.js +89 -0
  80. package/workspace/public/pm/cozy-today.css +217 -0
  81. package/workspace/public/pm/cozy-viewer.js +1 -0
  82. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  83. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  84. package/workspace/public/pm/home-adddoc.js +5 -5
  85. package/workspace/public/pm/home-app.js +329 -55
  86. package/workspace/public/pm/home-around.js +24 -126
  87. package/workspace/public/pm/home-chat.js +67 -14
  88. package/workspace/public/pm/home-data.js +6 -6
  89. package/workspace/public/pm/home-dictate.js +54 -0
  90. package/workspace/public/pm/home-draft.js +6 -6
  91. package/workspace/public/pm/home-ini-model.js +190 -0
  92. package/workspace/public/pm/home-ini.css +171 -0
  93. package/workspace/public/pm/home-ini.js +456 -0
  94. package/workspace/public/pm/home-list.js +276 -0
  95. package/workspace/public/pm/home-more.js +17 -134
  96. package/workspace/public/pm/home-phone-card.js +4 -4
  97. package/workspace/public/pm/home-review.js +104 -0
  98. package/workspace/public/pm/home-task.js +67 -0
  99. package/workspace/public/pm/home-today.js +144 -0
  100. package/workspace/public/pm/home-work.js +54 -26
  101. package/workspace/public/pm/premium-board.js +163 -39
  102. package/workspace/public/pm/premium-chart-tab.js +4 -5
  103. package/workspace/public/pm/premium-first.js +5 -7
  104. package/workspace/public/pm/premium-insights.js +499 -202
  105. package/workspace/public/pm/premium-mtg-present.js +138 -0
  106. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  107. package/workspace/public/pm/premium-report-read.js +216 -52
  108. package/workspace/public/pm/premium-report-tab.js +44 -19
  109. package/workspace/public/pm/premium-shell.js +7 -7
  110. package/workspace/public/pm/premium-vw-cal.js +150 -60
  111. package/workspace/public/pm/premium-vw-mtg.js +488 -261
  112. package/workspace/public/pm/premium-vw-notes.js +61 -0
  113. package/workspace/public/pm/rp-parts.js +269 -0
  114. package/workspace/public/premium-board.html +4 -3
  115. package/workspace/public/premium-insights.html +10 -10
  116. package/workspace/public/premium.html +3 -1
  117. package/workspace/r/m1.png +0 -0
  118. package/workspace/r/m2.png +0 -0
  119. package/workspace/r/m3.png +0 -0
  120. package/workspace/r/nl.png +0 -0
  121. package/workspace/test-lists/initiative-layout.json +9 -0
  122. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  123. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  124. package/workspace/test-lists/uf-everywhere.json +15 -0
  125. package/workspace/test-lists/uf-home.json +9 -0
  126. package/workspace/test-lists/uncovered-board.json +9 -0
@@ -4,12 +4,13 @@
4
4
  * Initiatives and Documents tabs and the chips (Jira read time, sprint and release, new asks, late, at risk, blocked, idle, This sprint).
5
5
  * · the stage track (default): each initiative is a row across the six stages and two milestones (◆), with the parts or tickets counted
6
6
  * toward the output that finishes its current step. Monitor and Evaluate rows fold under the table after the first of each.
7
- * · the timeline (pm/bd-span.js): Quarter, Year and 5 yr.
7
+ * · List and By stage (pm/bd-views.js; BdList, BdByStage) and the timeline (pm/bd-span.js): Sprint, Quarter, Half, Year, 2 yr and 5 yr.
8
8
  * · a row opens the initiative panel and a ticket opens the Jira ticket panel, in the side panel (a bottom sheet on a phone).
9
9
  * · the Board has no chat: "Ask about this" sends the question to Home (/premium.html?ask=<initiative>&q=<question>).
10
- * What the Agreed design has no frame for (List, By stage, Documents, the Sprint, Half and 2 yr spans, Find, Filter, New initiative, the new
11
- * asks, the sprint and release, Metrics, cancelled and archived, the initiative actions) works as a plain version with a "Waiting for design"
12
- * tag (pm/bd-acts.js), in the side panel, and no older UI.
10
+ * The uncovered features (initiative premium-uncovered-features: BdList, BdByStage, BdDocs, BdSpans, BdAsks, BdNew, BdGrill, BdActions, BdFilter,
11
+ * BdSprint, BdPanel, BdPhone, BdHead) are drawn by pm/bd-views.js (the views and Documents), pm/bd-asks.js (new asks, New initiative and its first
12
+ * questions), pm/bd-acts.js (the row actions, Find, Filter, the sprint and release, the trends, the document panel) and pm/bd-pop.js (popovers).
13
+ * A phone has List, By stage and the stage track; the timeline needs a wider screen (BdPhone).
13
14
  * After the model, GET /api/board-trail (lib/board-trail.js) adds what the model does not carry: days in the step and the usual days, the
14
15
  * skipped steps and why, the parts of the output, what waits on you, tickets drafted in PMOS, PRD drift, links, dependencies and themes.
15
16
  * Where no record holds a value for an initiative, the element says so: nothing is invented. */
@@ -19,19 +20,24 @@ import { mountNav } from './cozy-nav.js';
19
20
  import { stepsHelpHtml, rulesHelpHtml } from './bd-stages.js';
20
21
  import { timelineHtml, SPANS, GROUPS, md } from './bd-span.js';
21
22
  import * as Acts from './bd-acts.js';
23
+ import * as V from './bd-views.js';
24
+ import * as Asks from './bd-asks.js';
22
25
  import { open as viewerOpen } from './cozy-viewer.js';
23
26
 
24
- const VIEW_KEY = 'pmos.board.view', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group';
27
+ const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group';
25
28
  let M = null; // the model
26
29
  let TR = null; // the trail (GET /api/board-trail): { usual, themes, items: { [id]: item } }
27
30
  let group = GROUPS.some(([k]) => k === store.get(GROUP_KEY)) ? store.get(GROUP_KEY) : 'theme';
28
31
  let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? store.get(VIEW_KEY) : 'track';
32
+ let pview = ['list', 'stages', 'track'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
29
33
  let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
30
34
  let tab = 'ini';
31
35
  let readTimer = null;
32
36
  let foldOpen = false; // the Monitor and Evaluate rows under the table
33
37
  let sprintSet = false; // "This sprint" starts on, once, when the board has a sprint
34
- const F = { chips: new Set(), q: '', owners: new Set(), lanes: new Set() }; // the chip filters, Find and Filter
38
+ const F = { chips: new Set(), q: '', owners: new Set(), lanes: new Set(), sprints: new Set() }; // the chip filters, Find and Filter
39
+ let GR = {}; // the first questions still open per initiative (GET /api/board-grill?ids=): { [id]: { open, total, later } }
40
+ let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
35
41
  let peek = null; // the open panel: { kind: 'ini' | 'tk' | 'acts', key, tk, from: 'track' | 'time' }
36
42
  mountNav('board');
37
43
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
@@ -48,10 +54,14 @@ const ago = (iso, short) => { const t = Date.parse(iso || ''); if (!t) return ''
48
54
  const isoDate = (iso) => { const x = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return x ? new Date(+x[1], +x[2] - 1, +x[3]) : null; };
49
55
  const fmt = (iso) => { const d = isoDate(iso); return d ? md(d) : ''; };
50
56
  const PHONE = matchMedia('(max-width: 720px)');
51
- const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || null;
57
+ const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
58
+ const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
52
59
 
53
- /** A plain panel of pm/bd-acts.js: it goes in the side panel like the others. */
54
- function actsPanel(html, from) { peek = { kind: 'acts', key: peek && peek.key }; showPeek(html, from); } // keeps the initiative, so Close goes back to its row
60
+ /** A panel of pm/bd-acts.js or pm/bd-asks.js: it goes in the side panel like the others; cls widens it (pk-new, pk-wide, pk-doc). */
61
+ function actsPanel(html, from, cls) {
62
+ peek = { kind: 'acts', key: peek && peek.key }; showPeek(html, from); // keeps the initiative, so Close goes back to its row
63
+ const pk = $('#peek'); pk.classList.remove('pk-new', 'pk-wide', 'pk-doc'); if (cls) pk.classList.add(cls);
64
+ }
55
65
 
56
66
  /* ── the toast: the Agreed design's dark pill ─────────────────────────────────────────────────────────────────────────────── */
57
67
  let toastT = null;
@@ -105,7 +115,12 @@ function drawChips() {
105
115
  }
106
116
  $('#bdChipset').addEventListener('click', (e) => {
107
117
  const f = e.target.closest('[data-f]');
108
- if (f) { const k = f.dataset.f; if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); drawChips(); drawInit(); return; }
118
+ if (f) {
119
+ const k = f.dataset.f;
120
+ // a metric chip opens its trend (BdPanel), whose "Show only" filters; a chip that is on turns off at once
121
+ if (k !== 'sprint' && !F.chips.has(k)) { Acts.open.trend(k, f); return; }
122
+ if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); drawChips(); drawInit(); return;
123
+ }
109
124
  const g = e.target.closest('[data-grp]');
110
125
  if (g) { group = g.dataset.grp; store.set(GROUP_KEY, group); drawChips(); drawInit(); const c = $('#chGroup'); if (c) c.focus(); return; }
111
126
  const b = e.target.closest('button'); if (!b) return;
@@ -163,16 +178,27 @@ function visible() {
163
178
  if (F.q && !String(r.title || '').toLowerCase().includes(F.q.toLowerCase())) return false;
164
179
  if (F.owners.size && !F.owners.has(r.owner || 'No owner')) return false;
165
180
  if (F.lanes.size && !F.lanes.has(r.lane)) return false;
181
+ if (F.sprints.size && !(t.tickets || []).some((k) => F.sprints.has(k.sprint || 'Backlog'))) return false;
166
182
  return true;
167
183
  });
168
184
  }
169
- const filtered = () => [...F.chips].some((k) => k !== 'sprint') || !!F.q || F.owners.size > 0 || F.lanes.size > 0;
170
- const clearFilters = () => { F.chips.forEach((k) => { if (k !== 'sprint') F.chips.delete(k); }); F.q = ''; F.owners.clear(); F.lanes.clear(); };
185
+ const filtered = () => [...F.chips].some((k) => k !== 'sprint') || !!F.q || F.owners.size > 0 || F.lanes.size > 0 || F.sprints.size > 0;
186
+ const clearFilters = () => { F.chips.forEach((k) => { if (k !== 'sprint') F.chips.delete(k); }); F.q = ''; F.owners.clear(); F.lanes.clear(); F.sprints.clear(); };
187
+ /** The "Showing" bar (BdFilter): what Filter has on, each with its own ×, Clear all, and how many initiatives show. */
188
+ function showingHtml(n) {
189
+ const G = [['owners', 'Owner'], ['lanes', 'Kind'], ['sprints', 'Sprint']].filter(([k]) => F[k].size);
190
+ if (!G.length && !F.q) return '';
191
+ const cap = (x) => (x ? x.charAt(0).toUpperCase() + x.slice(1) : x);
192
+ const chips = G.map(([k, n2]) => `<button type="button" class="bd-chip on" data-unf="${k}" aria-label="Remove ${n2}: ${esc([...F[k]].join(', '))}">${esc(n2)}: ${esc([...F[k]].map((v) => (k === 'lanes' ? cap(v) : v)).join(', '))}${SV(I.x)}</button>`).join('')
193
+ + (F.q ? `<button type="button" class="bd-chip on" data-unf="q" aria-label="Remove the search">“${esc(F.q)}”${SV(I.x)}</button>` : '');
194
+ return `<div class="bd-showing" role="status"><span class="bd-mlbl">Showing</span>${chips}<button type="button" class="dlink" id="fClear">Clear all</button><span class="bd-sp"></span><span class="bd-amut">${n} of ${M.initiatives.list.rows.length} initiatives</span></div>`;
195
+ }
171
196
  /** The status line of a row: on hold, waiting on you, late, at risk, idle, shipping, on track. A blocked ticket stays on its ticket. */
172
197
  function statusOf(r) {
173
198
  const t = r.track || {};
174
199
  if (r.acts && r.acts.life === 'hold') return { tone: 'q', mo: '', text: 'On hold' + (r.acts.back ? ' · back ' + r.acts.back : '') };
175
200
  if (t.you) return { tone: 'you', mo: 'm-info', text: t.you };
201
+ const g = r.id && GR[r.id]; if (g && g.open && !g.later) return { tone: 'you', mo: 'm-info', text: g.open + ' ' + plural(g.open, 'question', 'questions') + ' before the BRD' };
176
202
  if (r.late) return { tone: 'late', mo: 'm-warn', text: r.overDays > 0 ? r.overDays + ' ' + plural(r.overDays, 'day', 'days') + ' over' : 'Late' };
177
203
  if (r.status === 'at risk') return { tone: 'risk', mo: 'm-warn', text: 'At risk' + (r.owner ? '' : ' · no owner') };
178
204
  if (t.idle != null) return { tone: 'q', mo: '', text: 'Idle ' + t.idle + ' days' };
@@ -226,41 +252,53 @@ function drawTrack(L) {
226
252
  const tf = more > 0 && !foldOpen ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${more} more in Monitor and Evaluate</button>`
227
253
  : foldOpen && meTotal > 1 ? `<button type="button" class="dlink" id="fold" aria-expanded="true">${SV(I.chevUp)}Fold Monitor and Evaluate${meTotal > meShown ? ` · ${meTotal - meShown} more are not loaded` : ''}</button>` : '<span></span>';
228
254
  if (!L.length) return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}<p class="bt-empty">${filtered() ? 'No initiative matches the chips, Find or Filter. <button type="button" class="dlink" id="fClear">Clear them</button>' : 'No initiatives are on this board\'s now view.'}</p></div>`;
229
- return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${shown.map(trackRow).join('')}<div class="bt-tf">${tf}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx">${Acts.WTAG}<span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
255
+ return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${shown.map(trackRow).join('')}<div class="bt-tf">${tf}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
230
256
  }
231
257
 
232
258
  /* ── the timeline (AgBoardTimeline, AgBoardTlYear, AgBoardTl5y, AgBoardTimelinePhone) ───────────────────────────────────────── */
233
- /** The phone has no frame for the span rules, Year and 5 yr: a plain row under its timeline reaches them, with a "Waiting for design" tag. */
234
- function phoneSpans(sp) {
235
- return `<div class="bd-whead bd-phx">${Acts.WTAG}<span class="bd-phb">${[['quarter', 'Quarter'], ['year', 'Year'], ['y5', '5 yr']].map(([k, n]) => `<button type="button" class="bd-chip${sp === k ? ' on' : ''}" data-span-go="${k}" aria-pressed="${sp === k}">${n}</button>`).join('')}<button type="button" class="bd-chip" data-rules aria-haspopup="dialog">How the spans group</button></span></div>`;
236
- }
237
259
  function drawTime(L) {
238
- const phone = PHONE.matches, long = span === 'year' || span === 'y5';
239
- const S = M.steps || [], sp = phone && span !== 'sprint' && !long ? 'quarter' : span; // a phone draws Quarter and Sprint (AgBoardTimelinePhone); Year and 5 yr as the desktop frame, scrolled
240
- const T = timelineHtml(L, M, sp, { phone: phone && !long, sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, hiddenCount: (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), themes: (TR && TR.themes) || [], group,
260
+ const S = M.steps || [];
261
+ const T = timelineHtml(L, M, span, { sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, hiddenCount: (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), themes: (TR && TR.themes) || [], group, avatar: (n) => V.avatar(n, 'sm'),
241
262
  askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
242
- return phone ? (long ? `<div class="bd-phscroll">${T.html}</div>` : T.html) + phoneSpans(sp) : T.html;
263
+ return T.html;
243
264
  }
265
+ /** A phone's view switch (BdPhone): List and By stage, and the stage track; the timeline needs a wider screen. */
266
+ const phoneSeg = (v) => `<div class="bd-phseg"><div class="bd-seg" role="group" aria-label="View">${[['list', 'List'], ['stages', 'By stage'], ['track', 'Track']].map(([k, n]) => `<button type="button" data-pv="${k}" aria-pressed="${v === k}">${n}</button>`).join('')}</div><span class="bd-amut">Timeline needs a wider screen.</span></div>`;
244
267
  function drawInit() {
245
268
  $('#nIni').textContent = String(M.initiatives.open || M.initiatives.list.rows.length);
246
- const L = visible(), v = PHONE.matches && (view === 'stages' || view === 'list') ? 'track' : view;
269
+ const phone = PHONE.matches, L = visible(), v = phone ? pview : view;
247
270
  const body = $('#ibBody');
248
271
  body.dataset.view = v; body.dataset.span = v === 'time' ? span : '';
249
- body.innerHTML = v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? Acts.listHtml(L) : Acts.stagesHtml(L);
272
+ const html = v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? (phone ? V.phoneListHtml(L) : V.listHtml(L, filtered())) : V.stagesHtml(L, { phone });
273
+ // a phone has no ⋯ menu: Metrics and Cancelled and archived stay one press away in every view, not only the track
274
+ const phx = phone && v !== 'track' ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : '';
275
+ body.innerHTML = (phone ? phoneSeg(v) : '') + html + phx;
276
+ $('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
250
277
  $$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
251
278
  $('#bdView').innerHTML = SV(v === 'time' ? I.time : I.track); $('#bdView').setAttribute('aria-label', 'Change view. Now: ' + (v === 'time' ? 'Timeline' : 'Stage track'));
252
- $('#bdSpans').hidden = v !== 'time' || PHONE.matches;
279
+ $('#bdSpans').hidden = v !== 'time' || phone;
253
280
  $$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
254
281
  document.body.dataset.bdView = v;
255
282
  }
256
283
  PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
257
- function setView(v) { view = v; store.set(VIEW_KEY, view); closePeek(); drawChips(); drawInit(); }
284
+ function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else { view = v; store.set(VIEW_KEY, view); } closePeek(); drawChips(); drawInit(); }
258
285
  $('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
259
- $('#bdView').addEventListener('click', () => { if (M) setView(view === 'time' ? 'track' : 'time'); });
286
+ $('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : 'list') : view === 'time' ? 'track' : 'time'); });
287
+ $('#bdShowing').addEventListener('click', (e) => {
288
+ if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
289
+ const u = e.target.closest('[data-unf]'); if (!u) return;
290
+ if (u.dataset.unf === 'q') F.q = ''; else F[u.dataset.unf].clear(); drawChips(); drawInit();
291
+ });
260
292
  $('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; span = b.dataset.sp; store.set(SPAN_KEY, span); drawChips(); drawInit(); });
261
293
  $('#ibBody').addEventListener('click', (e) => {
262
294
  if (e.target.closest('#fold')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold'); if (f) f.focus(); return; }
263
295
  if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
296
+ const pv = e.target.closest('[data-pv]'); if (pv) { setView(pv.dataset.pv); const b = $(`#ibBody [data-pv="${pv.dataset.pv}"]`); if (b) b.focus(); return; }
297
+ const so = e.target.closest('[data-sort]'); if (so) { V.setSort(so.dataset.sort); drawInit(); const b = $(`#ibBody [data-sort="${so.dataset.sort}"]`); if (b) b.focus(); return; }
298
+ if (e.target.closest('[data-me]')) { V.toggleME(); drawInit(); const b = $('#ibBody [data-me]'); if (b) b.focus(); return; }
299
+ const sr = e.target.closest('[data-strip]'); if (sr) { V.toggleStrip(sr.dataset.strip); drawInit(); const b = $(`#ibBody [data-strip="${sr.dataset.strip}"]`); if (b) b.focus(); return; }
300
+ const rm = e.target.closest('[data-rowmenu]'); if (rm) { const r = rowOf(rm.dataset.rowmenu); if (r) Acts.open.row(r, rm); return; }
301
+ if (e.target.closest('[data-backlog]')) return; // pm/bd-acts.js opens the backlog
264
302
  const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
265
303
  const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
266
304
  const ru = e.target.closest('[data-rules]'); if (ru) { togglePop('popRules', ru); return; }
@@ -271,6 +309,28 @@ $('#ibBody').addEventListener('click', (e) => {
271
309
  const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
272
310
  });
273
311
  $('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('[data-steps]')) { e.preventDefault(); togglePop('popSteps', e.target); } });
312
+ /* By stage (BdByStage): a card dragged to another column moves the initiative there (POST /api/boards/move), with Undo in the toast. The column is
313
+ * one of the eight steps; the move goes to the first of the board's own stages that maps onto it. */
314
+ let dragKey = null;
315
+ $('#ibBody').addEventListener('dragstart', (e) => { const c = e.target.closest('.bd-bc[draggable]'); if (!c) return; dragKey = c.dataset.key; e.dataTransfer.effectAllowed = 'move'; try { e.dataTransfer.setData('text/plain', dragKey); } catch { /* some browsers refuse */ } c.classList.add('drag'); });
316
+ $('#ibBody').addEventListener('dragend', () => { dragKey = null; $$('#ibBody .drag, #ibBody .drop').forEach((x) => x.classList.remove('drag', 'drop')); });
317
+ $('#ibBody').addEventListener('dragover', (e) => { const col = dragKey && e.target.closest('.bd-scol[data-step]'); if (!col) return; e.preventDefault(); $$('#ibBody .bd-scol.drop').forEach((x) => { if (x !== col) x.classList.remove('drop'); }); col.classList.add('drop'); });
318
+ $('#ibBody').addEventListener('drop', async (e) => {
319
+ const col = e.target.closest('.bd-scol[data-step]'); if (!col || !dragKey) return;
320
+ e.preventDefault();
321
+ const r = rowOf(dragKey), j = +col.dataset.step; dragKey = null; col.classList.remove('drop');
322
+ if (!r || !r.track || r.track.k === j || !r.acts) return;
323
+ const step = M.steps[j], to = (r.acts.stages || []).find((n) => stepOfName(n) === step.key);
324
+ if (!to) { say(step.label + ' is not one of this board\'s stages, so it did not move.'); return; }
325
+ const from = r.acts.stage, body = { ws: M.board.ws, board: M.board.id, id: r.id };
326
+ const res = await pmPost('/api/boards/move', { ...body, to }).catch(() => null);
327
+ if (!res || !res.ok) { say((res && res.error) || 'It did not move. The server did not say why.'); return; }
328
+ say('Moved to ' + to + ' · ' + r.title + '.', async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
329
+ load();
330
+ });
331
+ /** The step key of one of the board's own stage names, by the same old-name map as the model (lib/board-premium.js OLD_STEP). */
332
+ const OLD_STEP = { ideate: 'discover', ideation: 'discover', strategize: 'prioritize', intake: 'triage', ship: 'deliver', release: 'deliver', learn: 'monitor' };
333
+ function stepOfName(n) { const k = String(n || '').trim().toLowerCase(); const s = (M.steps || []).find((x) => x.key === k || x.label.toLowerCase() === k); return s ? s.key : OLD_STEP[k] || null; }
274
334
 
275
335
  /* ── "Ask about this": the Board has no chat; the question goes to Home as a quick ask in that initiative (B3) ───────────────── */
276
336
  function askHref(r, q) {
@@ -361,6 +421,36 @@ function linkedHtml(r) {
361
421
  + (epic ? `<span class="bd-chip">${SV(I.jira)}${esc('Epic ' + epic)}</span>` : '');
362
422
  return chips ? `<div class="pk-sec"><p class="lbl">Linked</p><div class="pk-lk">${chips}</div></div>` : '';
363
423
  }
424
+ /** Dates (BdPanel): when the step started (days in the step, from the trail), the planned end (yours) and the end Jira's pace expects. */
425
+ function datesHtml(r) {
426
+ const t = r.track || {};
427
+ const st = t.days != null ? md(new Date(Date.now() - t.days * 86400000)) : null, end = r.end ? fmt(r.end) : null, exp = t.forecast ? fmt(t.forecast) : null;
428
+ if (!st && !end && !exp) return '';
429
+ const late = !!(r.end && t.forecast && t.forecast.slice(0, 10) > r.end.slice(0, 10));
430
+ const box = (label, v, cls) => `<div class="bd-box${cls ? ' ' + cls : ''}"><span class="bd-amut">${esc(label)}</span><b>${esc(v || '—')}</b></div>`;
431
+ return `<div class="pk-sec"><p class="lbl">Dates</p><div class="pk-dg">${box('Started ' + (t.label || 'the step'), st)}${box('Planned end', end)}${box('Now expected', exp, late ? 'late' : '')}</div><p class="pk-mut">Planned end is yours. Expected comes from Jira pace, and moves when tickets move.</p></div>`;
432
+ }
433
+ /** In Jira (BdPanel): the step's tickets as a table, each opening its ticket panel. */
434
+ function jiraHtml(r) {
435
+ const t = r.track || {}, tk = (t.tickets || []).slice().sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0)), sp = [...new Set(tk.map((k) => k.sprint).filter(Boolean))];
436
+ const st = (k) => (k.blocked ? 'Blocked' : k.status === 'In progress' ? 'Doing' : k.status) + (k.age != null && k.status !== 'Done' ? ' · ' + k.age + 'd' : '');
437
+ const rows = tk.slice(0, 12).map((k) => `<button type="button" class="pk-jt" data-tk="${esc(k.key)}" data-ini="${esc(r.key)}"><span class="bd-pill">${esc(k.key)}</span><span class="bd-ell">${esc(k.title)}</span><span class="${k.blocked ? 's-red' : k.status === 'Done' || k.status === 'To do' ? 'bd-amut' : ''}">${esc(st(k))}</span>${k.assignee ? V.avatar(k.assignee, 'sm') : '<span class="bd-amut">—</span>'}</button>`).join('');
438
+ // Deliver's two parts that are not tickets: the release notes and your sign-off
439
+ const dl = t.key === 'deliver' ? `<div class="pk-tks">${'<p class="gi gm"><i class="k"></i><span class="n">Release notes</span><span class="r">not on record</span></p>'}<p class="gi gm"><i class="k${t.you ? ' yo' : ''}"></i><span class="n">Your sign-off</span><span class="r">${t.you ? 'waiting' : 'after the tickets'}</span></p></div>` : '';
440
+ return `<div class="pk-sec"><p class="lbl">In Jira${sp.length === 1 ? ' · ' + esc(sp[0]) : ''}</p><div class="pk-jtw"><div class="pk-jt h"><span>Key</span><span>Work-item</span><span>Status</span><span>Who</span></div>${rows}${tk.length > 12 ? `<p class="pk-mut">${tk.length - 12} more in Jira</p>` : ''}</div>${dl}</div>`;
441
+ }
442
+ /** Progress (BdPanel): points done of the total; where Jira has no points, the work-items done by count, striped so a count never reads as points. */
443
+ function progHtml(r) {
444
+ const p = (r.track || {}).prog; if (!p || !p.total) return '';
445
+ const pct = Math.round((p.done / p.total) * 100), count = p.unit === 'tickets';
446
+ const what = p.unit === 'pts' ? p.done + ' of ' + p.total + ' points' : count ? p.done + ' of ' + p.total + ' work-items done' : p.done + '% on record';
447
+ return `<div class="pk-sec"><p class="lbl">Progress</p><div class="bd-box"><div class="bd-boxh"><b>${esc(what)}</b><span class="bd-amut">${pct}%${count ? ' · by count' : ''}</span></div>${V.barHtml({ pct, count, label: what })}${count ? '<p class="pk-mut">The bar is striped so a count never reads as points.</p>' : ''}</div></div>`;
448
+ }
449
+ /** The first questions before the BRD (BdGrill), while some are open: the count and a button that opens them. */
450
+ function grillHtml(r) {
451
+ const g = r.id && GR[r.id]; if (!g || !g.open) return '';
452
+ return `<div class="pk-nb"><div class="t"><b>${g.open} ${plural(g.open, 'question', 'questions')} before the BRD</b><div>${g.later ? 'You chose to answer later. ' : ''}PMOS asks what the BRD needs that the Why does not say yet.</div></div><button type="button" class="bd-ib solid" data-pk="grill" aria-label="Answer the questions" title="Answer the questions">${SV(I.next)}</button></div>`;
453
+ }
364
454
  function iniPanel(r) {
365
455
  const t = r.track || {}, s0 = statusOf(r);
366
456
  const s = r.release && /^Ships /.test(s0.text) ? { ...s0, text: 'On track' } : s0; // the line already says when it ships
@@ -370,7 +460,10 @@ function iniPanel(r) {
370
460
  + `<div class="pk-tools">${r.id ? `<a class="bd-ib" data-pk="expand" href="${esc(pageHref(r))}" aria-label="Open the initiative page" title="Open the initiative page">${SV(I.expand)}</a>` : ''}<button type="button" class="bd-ib" data-pk="acts" aria-label="Initiative actions" title="Initiative actions">${SV(I.more)}</button><button type="button" class="bd-ib" data-pk="close" aria-label="Close" title="Close">${SV(I.x)}</button></div></div>`
371
461
  + `<div class="pk-b">${ladderHtml(t)}${skipHtml(t)}`
372
462
  + nextHtml(r)
373
- + `<div class="pk-box"><div class="t1"><b>${esc(t.output || 'No step on record')}</b><span>${esc(t.count || '')}</span></div>${segHtml(r, true)}<div class="pk-tks">${outRows(r)}</div>${typeof t.next === 'string' && t.next && !(t.tickets || []).length ? `<p class="pk-nx">Next: <b>${esc(t.next)}</b></p>` : ''}</div>`
463
+ + grillHtml(r)
464
+ + ((t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length ? jiraHtml(r)
465
+ : `<div class="pk-box"><div class="t1"><b>${esc(t.output || 'No step on record')}</b><span>${esc(t.count || '')}</span></div>${segHtml(r, true)}<div class="pk-tks">${outRows(r)}</div>${typeof t.next === 'string' && t.next && !(t.tickets || []).length ? `<p class="pk-nx">Next: <b>${esc(t.next)}</b></p>` : ''}</div>`)
466
+ + datesHtml(r) + progHtml(r)
374
467
  + draftedHtml(r) + driftHtml(r) + linkedHtml(r) // the dependencies are Linked chips, as AgBoardPanel draws them
375
468
  + `</div>${askForm(r, r.title)}`;
376
469
  }
@@ -459,6 +552,7 @@ $('#peek').addEventListener('click', (e) => {
459
552
  else if (a === 'jira') refreshJira(b);
460
553
  else if (a === 'drift') { const q = $('#peek form.pk-ask input[name="q"]'); if (q) { q.value = b.dataset.q || ''; q.focus(); } }
461
554
  else if (a === 'acts' && r) Acts.open.row(r, b);
555
+ else if (a === 'grill' && r) Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b);
462
556
  });
463
557
  /** A linked document opens in the Viewer: GET /api/doc, shown as its text. */
464
558
  document.addEventListener('click', (e) => {
@@ -489,21 +583,37 @@ function setTab(t) {
489
583
  tab = t;
490
584
  $('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
491
585
  $('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
492
- if (t === 'docs') { closePeek(); $('#docBody').innerHTML = M ? Acts.docsHtml() : ''; }
586
+ if (t === 'docs') { closePeek(); drawDocs(); loadDocMeta(); }
493
587
  }
494
588
  $('#tabIni').onclick = () => setTab('ini');
495
589
  $('#tabDocs').onclick = () => setTab('docs');
496
590
  $('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const n = tab === 'ini' ? 'docs' : 'ini'; setTab(n); $(n === 'ini' ? '#tabIni' : '#tabDocs').focus(); });
497
591
 
592
+ /** Documents (BdDocs): the kind chips, the rows and their history; a row opens the document's panel (pm/bd-acts.js). */
593
+ function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
594
+ $('#docBody').addEventListener('click', (e) => { const k = e.target.closest('[data-dkind]'); if (k) { V.setDocKind(k.dataset.dkind); drawDocs(); const b = $(`#docBody [data-dkind="${k.dataset.dkind}"]`); if (b) b.focus(); } });
595
+ /** The history of the documents on screen (GET /api/board-docs): when each last changed, by whom, its last commits. Read-only. */
596
+ async function loadDocMeta(paths) {
597
+ if (!M) return;
598
+ const P = (paths || V.docRows().map((x) => x.path)).filter((p) => p && !DM[p]).slice(0, 40);
599
+ if (!P.length) return;
600
+ let r = null; try { r = await (await fetch('/api/board-docs?ws=' + encodeURIComponent(M.board.ws || '') + '&paths=' + P.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
601
+ if (!r || !r.ok) return;
602
+ for (const p of P) DM[p] = r.docs[p] || { none: true };
603
+ if (tab === 'docs') drawDocs();
604
+ }
605
+ const docMeta = (p) => { const d = DM[p]; return d && !d.none ? d : null; };
606
+
498
607
  /* ── the shell's bell sits before New initiative, as the design orders the tools; Escape closes a popover, then the panel ──────── */
499
- /* the ⋯ menu ("More: sources, archived, export" in AgBoard): the Board adds Metrics and Cancelled and archived, plain versions waiting for design */
608
+ /* the ⋯ menu ("More: sources, archived, export" in AgBoard and BdHead): the Board adds Metrics and Cancelled and archived */
500
609
  {
501
- const st = $('#settingsBtn');
502
- if (st) st.insertAdjacentHTML('beforebegin', ['metrics', 'gone'].map((k) => `<button role="menuitem" id="${k === 'metrics' ? 'bdMetrics' : 'bdGone'}" aria-haspopup="dialog" data-open="${k}">${k === 'metrics' ? 'Metrics' : 'Cancelled and archived'}<span class="bd-wtag">Waiting for design</span></button>`).join(''));
610
+ const st = $('#settingsBtn'), mb = $('#moreBtn');
611
+ if (mb) { mb.setAttribute('aria-label', 'More: sources, archived, export'); mb.title = 'More: sources, archived, export'; }
612
+ if (st) st.insertAdjacentHTML('beforebegin', ['metrics', 'gone'].map((k) => `<button role="menuitem" id="${k === 'metrics' ? 'bdMetrics' : 'bdGone'}" aria-haspopup="dialog" data-open="${k}">${k === 'metrics' ? 'Metrics' : 'Cancelled and archived'}</button>`).join(''));
503
613
  $$('#moreMenu [data-open]').forEach((b) => { b.onclick = () => { if (M) Acts.open[b.dataset.open]($('#moreBtn')); }; });
504
614
  }
505
615
  window.addEventListener('keydown', (e) => {
506
- if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden])')) return;
616
+ if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden])')) return;
507
617
  if ($$('.bd-pop').some((p) => !p.hidden)) { closePops(true); return; }
508
618
  if (!$('#peek').hidden) closePeek();
509
619
  }, true);
@@ -541,18 +651,26 @@ async function loadTrail() {
541
651
  if (!r || !r.ok) { TR = TR || { usual: {}, themes: [], items: {}, failed: true }; return; }
542
652
  TR = r; mergeTrail(); draw();
543
653
  }
654
+ /** The first questions still open (GET /api/board-grill?ids=): an initiative started on the Board shows "N questions before the BRD". */
655
+ async function loadGrill() {
656
+ const ids = [...new Set((M.rows || []).filter((r) => r.id && r.track && r.track.k <= 1).map((r) => r.id))].slice(0, 150);
657
+ if (!ids.length) return;
658
+ let r = null; try { r = await (await fetch('/api/board-grill?ws=' + encodeURIComponent(M.board.ws || '') + '&ids=' + ids.map(encodeURIComponent).join(','), { credentials: 'same-origin' })).json(); } catch { r = null; }
659
+ if (!r || !r.ok) return;
660
+ GR = r.items || {}; draw();
661
+ }
544
662
 
545
663
  function draw() {
546
664
  mergeTrail();
547
665
  if (!sprintSet && M.jira && M.jira.sprint) { F.chips.add('sprint'); sprintSet = true; }
548
666
  drawHead(); drawChips(); drawInit();
549
- $('#docCap').textContent = M.docs && M.docs.rows ? String(M.docs.rows.length) : '';
550
667
  { const g = $('#bdGone'), G = M.initiatives.gone || { cancelled: [], archived: [] }, n = [G.cancelled.length ? G.cancelled.length + ' cancelled' : '', G.archived.length ? G.archived.length + ' archived' : ''].filter(Boolean).join(' · ');
551
- if (g) g.firstChild.textContent = 'Cancelled and archived' + (n ? ' · ' + n : ''); } // the ⋯ menu item counts them
552
- if (tab === 'docs') $('#docBody').innerHTML = Acts.docsHtml();
668
+ if (g) g.textContent = 'Cancelled and archived' + (n ? ' · ' + n : ''); } // the ⋯ menu item counts them
669
+ if (tab === 'docs') drawDocs();
670
+ $('#docCap').textContent = String(V.docRows().length);
553
671
  // an open panel follows the new read
554
672
  if (peek && peek.kind !== 'acts' && !$('#peek').contains(document.activeElement)) {
555
- const r = rowOf(peek.key);
673
+ const r = (M.rows || []).find((x) => x.key === peek.key); // a row that left the Board (cancelled, archived) closes its panel
556
674
  if (!r) closePeek(); else if (peek.kind === 'ini') showPeek(peek.from === 'time' ? timePanel(r) : iniPanel(r));
557
675
  }
558
676
  }
@@ -586,8 +704,14 @@ async function load() {
586
704
  M = r.model; draw();
587
705
  focusOnce();
588
706
  if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
589
- else loadTrail();
590
- }
591
- Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePeek, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: (r) => openIni(r, $('#bdBell'), 'track') });
707
+ else { loadTrail(); loadGrill(); }
708
+ }
709
+ const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
710
+ const anchors = async () => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(M.board.ws || '') + '&board=' + encodeURIComponent(M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
711
+ const openIniAny = (r) => openIni(r, $('#bdBell'), 'track');
712
+ V.init({ M: () => M, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel() });
713
+ Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePeek, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors });
714
+ Acts.init({ M: () => M, load, say, panel: actsPanel, close: closePeek, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
715
+ openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc });
592
716
  setTab('ini');
593
717
  load();
@@ -3,11 +3,11 @@
3
3
  * `pmos-report` block of kind chart or dashboard (public/pm/report-chat.js), and this view draws it from the KR metric records.
4
4
  *
5
5
  * A CHART (block.kind 'chart'): the design's metrics view: three stat tiles (now, since the last reading, the target), then the readings as a
6
- * chart with the newest one in ember. Below it, the parts the design does not draw yet ("Waiting for design"): the four forms to pick from
6
+ * chart with the newest one in ember. Below it, the setup block (premium-uncovered-features, drawn in the cozy viewer style): the four forms to pick from
7
7
  * (Line, Bars, Number, Meter), Save chart (POST /api/premium-charts/save), and Delete chart, which asks once in the card ({ id, remove: true }).
8
8
  * A saved chart (block.id) shows as saved; a change Claude proposes to it shows drawn, and Save the change posts the whole chart.
9
9
  * A DASHBOARD (block.kind 'dashboard'): its charts in order as small tiles (a measure with fewer than two readings is named, not drawn), then
10
- * Save dashboard (POST /api/premium-dashboards/save) and Delete dashboard, Waiting for design. Pinning stays on the Insights page.
10
+ * Save dashboard (POST /api/premium-dashboards/save) and Delete dashboard. Pinning stays on the Insights page.
11
11
  *
12
12
  * The model is GET /api/insights-premium (the board Insights shows). Every value drawn is a reading of a record. Every write is a press here,
13
13
  * behind the launch nonce (http.js pmPost). Claude writes nothing: the routes refuse an agent session. Nothing is sent outward.
@@ -21,7 +21,6 @@ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&':
21
21
  const FORMS = [['line', 'Line'], ['bars', 'Bars'], ['number', 'Number'], ['meter', 'Meter']];
22
22
  const ws = () => new URLSearchParams(location.search).get('ws') || '';
23
23
  const post = (p, body) => pmPost(p, Object.assign(ws() ? { ws: ws() } : {}, body)).catch(() => null);
24
- const WAIT = (f) => `<span class="vz-wait" data-cz-placeholder="${esc(f)}">Waiting for design</span>`;
25
24
  const btn = (a, label, o = {}) => `<button type="button" class="${o.sec ? 'vz-sec2' : 'vz-issue'} vz-hv${o.cls ? ' ' + o.cls : ''}" data-ct="${esc(a)}"${o.off ? ' disabled' : ''}>${esc(label)}</button>`;
26
25
 
27
26
  const T = new Map(); // view id → its state
@@ -117,7 +116,7 @@ function chartHtml(t) {
117
116
  }
118
117
  const meter = form === 'meter' && (d.target === null || d.target === undefined) ? '<p class="vz-note">A meter needs a target. Say one in the chat, or pick another form.</p>' : '';
119
118
  return shown
120
- + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3>${WAIT('Chart setup from a chat')}</div>`
119
+ + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3></div>`
121
120
  + `<p class="vz-note">${esc(base ? base.title : d.measure)}${d.range ? ' · last ' + d.range + ' readings' : ' · every reading'}${d.target != null ? ' · target ' + esc(d.target) : ''}</p>`
122
121
  + `<div class="vz-sg" role="group" aria-label="Form">${FORMS.map(([f, l]) => `<button type="button" data-ct="form|${f}" aria-pressed="${form === f}">${l}</button>`).join('')}</div>${meter}`
123
122
  + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save chart', { off: t.busy || !base || !!meter })}</div>` : '')
@@ -142,7 +141,7 @@ function dashHtml(t) {
142
141
  }).join('');
143
142
  const many = d.charts.length > 6 ? '<p class="vz-note">This dashboard holds more than six charts. A dashboard that serves one routine usually holds six or fewer.</p>' : '';
144
143
  return `${d.purpose ? `<p class="vz-sum">${esc(d.purpose)}</p>` : ''}<div class="vz-mx-grid">${tiles}</div>${many}`
145
- + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3>${WAIT('Dashboard setup from a chat')}</div>`
144
+ + `<section class="vz-blk" aria-label="${esc(eye)}"><div class="vz-r1"><h3>${esc(eye)}</h3></div>`
146
145
  + `<p class="vz-note">${d.charts.length} ${d.charts.length === 1 ? 'chart' : 'charts'}${s && s.main ? ' · pinned on Insights' : ''}</p>`
147
146
  + (changed ? `<div class="vz-r1">${btn('save', t.busy ? 'Saving' : s ? 'Save the change' : 'Save dashboard', { off: t.busy })}</div>` : '')
148
147
  + `<p class="vz-note">${s ? 'It is in the list on Insights.' : 'Saved, it is in the list on Insights, where you can pin it.'} Ask in the chat to change it.</p>`
@@ -1,6 +1,5 @@
1
1
  /* pm/premium-first.js — the "Your first Briefing" card on Home (initiative premium-welcome; rebuilt for the Agreed design, initiative
2
- * premium-agreed-design, Home). The Agreed design does not draw a first-run card, so this is a plain minimal cozy card with a
3
- * "Waiting for design" marker. It shows only when Home was opened with first=<import id>, which the premium Welcome sets after an import.
2
+ * premium-agreed-design, Home; restyled for premium-uncovered-features to the Today card of canvas HmDay). It shows only when Home was opened with first=<import id>, which the premium Welcome sets after an import.
4
3
  * It reads GET /api/onboarding/briefing, lists each item, the state of the tools the PM ticked (what Welcome recorded in this browser) and
5
4
  * Undo this import (POST /api/onboarding/undo), which goes back to Welcome's found step.
6
5
  * mountFirst() → the card element (a <section id="wlFirst">), or null when the address has no first=. Home puts it at the top of its list.
@@ -9,7 +8,6 @@ import { pmGet, pmPost } from './http.js';
9
8
  import { firstView, FIRST_KEY } from './premium-welcome-model.js';
10
9
 
11
10
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
12
- const WAIT = '<p class="hx-wait"><i aria-hidden="true"></i>Waiting for design</p>';
13
11
 
14
12
  function toolState() {
15
13
  try { return JSON.parse(sessionStorage.getItem(FIRST_KEY) || '{}'); } catch { return {}; }
@@ -18,16 +16,16 @@ export function mountFirst() {
18
16
  const q = new URLSearchParams(location.search), id = q.get('first'), ws = q.get('ws') || '';
19
17
  if (!id) return null;
20
18
  const sec = document.createElement('section');
21
- sec.className = 'hm-first hx'; sec.id = 'wlFirst'; sec.setAttribute('aria-labelledby', 'hWl');
22
- sec.innerHTML = `${WAIT}<h2 id="hWl">Your first Briefing</h2><p class="hx-n">Reading what the scan found.</p>`;
19
+ sec.className = 'hm-first hx hm-tc'; sec.id = 'wlFirst'; sec.setAttribute('aria-labelledby', 'hWl');
20
+ sec.innerHTML = '<h2 id="hWl" class="ut-h2">Your first Briefing</h2><p class="ut-small ut-mut">Reading what the scan found.</p>';
23
21
  pmGet(`/api/onboarding/briefing?ws=${encodeURIComponent(ws)}`).then((r) => {
24
22
  const v = firstView(r, toolState());
25
23
  const items = v.items.map((f) => `<li class="hx-row"><span class="hx-t"><b>${esc(f.title)}</b>${f.why ? `<em>${esc(f.why)}</em>` : ''}<small>${f.ini ? esc(f.ini) + ' · ' : ''}${esc(f.ref)}</small></span></li>`).join('');
26
24
  const tools = v.tools.map((t) => `<li class="hx-row"><span class="hx-t"><b>${esc(t.name)}</b><em${t.started ? '' : ' class="bad"'}>${t.started ? `${esc(t.name)} is being read in an agent session. Its items join your list when it finishes.` : esc(t.error || 'It did not start.')}</em></span></li>`).join('');
27
25
  const lede = r && r.ok ? (v.calm ? 'Your portfolio is in. Nothing needs you right now.' : 'Your portfolio is in. These need you first.') : esc((r && r.error) || 'The scan\'s Briefing could not be read.');
28
- sec.innerHTML = `${WAIT}<h2 id="hWl">Your first Briefing</h2><p class="hx-n">${lede}</p>`
26
+ sec.innerHTML = `<h2 id="hWl" class="ut-h2">Your first Briefing</h2><p class="ut-small ut-mut">${lede}</p>`
29
27
  + (items ? `<ol class="hm-first-l">${items}</ol>` : '') + (tools ? `<h4>Your tools</h4><ul class="hm-first-l">${tools}</ul>` : '')
30
- + '<div class="hx-top"><button class="hx-b" type="button" id="wlUndo">Undo this import</button></div><p class="hx-n" id="wlUndoErr" role="alert" hidden></p>';
28
+ + '<div class="ut-acts"><button class="ut-btn sm ghost" type="button" id="wlUndo">Undo this import</button></div><p class="hx-n" id="wlUndoErr" role="alert" hidden></p>';
31
29
  });
32
30
  sec.onclick = async (e) => {
33
31
  const b = e.target.closest('#wlUndo'); if (!b || b.disabled) return;