create-pmos 0.397.0 → 0.398.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 (145) hide show
  1. package/package.json +13 -13
  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 +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -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 +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -0,0 +1,182 @@
1
+ 'use strict';
2
+ /* fixtures/premium-viewer-fixtures.js — stand-in answers for the Viewer's meeting, calendar, notes and report (initiative premium-agreed-design,
3
+ * area viewer). The browser suites and the screenshot run open /premium-viewer.html?open=… on the real server and answer the reads with these,
4
+ * so each press can be read off the request the page sent. Each answer has the shape its real route returns.
5
+ * install(page, o) → S o = { scene: 'notes' | 'live' | 'prep', now } S records the posts: S.posts [{ path, body }]
6
+ * The meeting is "Viewer sync" (a series of 4, about the Viewer initiative); "Rail review" starts in 30 minutes; the report is a
7
+ * leadership review with five sections. */
8
+ const pad = (n) => String(n).padStart(2, '0');
9
+ const dayKey = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
10
+ const iso = (d) => { const off = -d.getTimezoneOffset(), a = Math.abs(off); return `${dayKey(d)}T${pad(d.getHours())}:${pad(d.getMinutes())}:00${off >= 0 ? '+' : '-'}${pad(Math.floor(a / 60))}:${pad(a % 60)}`; };
11
+
12
+ function world(now = new Date()) {
13
+ const mid = new Date(now.getFullYear(), now.getMonth(), now.getDate());
14
+ const at = (h, m) => new Date(mid.getFullYear(), mid.getMonth(), mid.getDate(), h, m);
15
+ const mon = new Date(mid); mon.setDate(mon.getDate() - ((mon.getDay() + 6) % 7));
16
+ const minute = Math.floor(now.getTime() / 60000) * 60000;
17
+ const SYNC = new Date(Math.max(mid.getTime(), minute - 40 * 60000)), SYNC_END = new Date(SYNC.getTime() + 31 * 60000);
18
+ const RAIL = new Date(minute + 30 * 60000), RAIL_END = new Date(RAIL.getTime() + 30 * 60000);
19
+ const LIVE = new Date(Math.max(mid.getTime(), minute - 12 * 60000)), LIVE_END = new Date(LIVE.getTime() + 30 * 60000);
20
+ const lvl = { kind: 'initiative', id: 'viewer', ws: 'w1', name: 'Viewer' };
21
+ const week = () => {
22
+ const cells = [];
23
+ for (let i = 0; i < 7; i++) { const d = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + i); cells.push({ key: dayKey(d), start: dayKey(d), end: dayKey(d), events: [] }); }
24
+ const cell = (d) => cells.find((c) => c.key === dayKey(d));
25
+ cell(SYNC).events.push({ id: 'ev-sync', at: iso(SYNC), end: iso(SYNC_END), title: 'Viewer sync', attendees: ['Ana', 'Dita', 'Wawan'], series: 'viewer-sync' });
26
+ if (cell(RAIL)) cell(RAIL).events.push({ id: 'ev-rail', at: iso(RAIL), end: iso(RAIL_END), title: 'Rail review', attendees: ['Sam', 'Wawan'] });
27
+ if (cell(LIVE)) cell(LIVE).events.push({ id: 'ev-live', at: iso(LIVE), end: iso(LIVE_END), title: 'Design crit', attendees: ['Ana', 'Wawan'] });
28
+ for (let i = 0; i < 5; i++) { const d = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + i, 15, 0); if (dayKey(d) !== dayKey(mid)) cell(d).events.push({ id: 'ev-1on1-' + i, at: iso(d), end: iso(new Date(d.getTime() + 30 * 60000)), title: '1:1 with Dita', attendees: ['Dita'] }); }
29
+ return { ok: true, view: 'week', range: { start: cells[0].key, end: cells[6].key }, cells, events_source: 'calendar-memory', today: dayKey(now), context: { 'ev-sync': { level: lvl }, 'ev-rail': { level: lvl } }, link_boards: [{ id: 'b1', ws: 'w1', name: 'Growth' }], gantt: [] };
30
+ };
31
+ const NOTE = {
32
+ id: 'n1', title: 'Viewer sync', state: 'ended', updated_at: SYNC_END.toISOString(), meeting_ms: 31 * 60000 + 5000,
33
+ meeting: { kind: 'event', event_id: 'ev-sync', start: iso(SYNC), end: iso(SYNC_END), title: 'Viewer sync', context: { with: 'Ana, Dita and Wawan', purpose: 'Agree how the Viewer ships.', agenda: ['Viewer beside the chat', 'Saved views and the migration', 'Print preview'] } },
34
+ initiative: { id: 'viewer', ws: 'w1', title: 'Viewer' }, series: { key: 'viewer-sync' },
35
+ final_notes: { overview: 'The Viewer opens next to the chat, not in place of it. Saved views move to the new store in their own work-item, which can slip a sprint without blocking the rest.',
36
+ decisions: [{ text: 'Diffs can be approved from the Viewer.', why: 'One place to read and approve; the separate review page was used twice.' }, { text: 'Migration V.3 always goes to you before release.', why: 'It moves saved views for every team.' }],
37
+ actions: [{ text: 'Add a print view for documents', owner: 'Ana', due: '' }, { text: 'Move saved views to the new store', owner: 'Dita', due: '' }, { text: 'Tell Communicator about the release', owner: 'Wawan', due: '' }],
38
+ questions: [{ text: 'Do old workspaces need a manual step?' }] },
39
+ final: { segments: [{ t: 190000, spk: 'meeting', text: 'The Viewer sits beside the chat now.' }, { t: 760000, spk: 'mic', text: 'Saved views move in their own work-item.' }, { t: 895000, spk: 'meeting', text: 'Approve the diff from the Viewer.' }] },
40
+ speakers: { meeting: 'Dita' },
41
+ transcript: [{ t: 400000, text: 'Completion is 81% on the web.', cat: 'statement', source: 'meeting', check: { doc: 'planning/okrs/q4.md', verdict: 'agrees' } }, { t: 500000, text: 'About half the teams use saved views.', cat: 'statement', source: 'mic' }],
42
+ };
43
+ const PLACE = { key: 'viewer-sync', title: 'Viewer sync', pos: 4, count: 4, by: 'calendar', prev: { id: 'n0', at: '2026-10-15T10:00:00Z', overview: 'The Viewer split.' }, next: null,
44
+ since: { at: '2026-10-15T10:00:00Z', items: [{ text: 'Show the Viewer at tablet width', owner: 'Designer', state: 'done' }, { text: 'Decide where saved views live', owner: 'Wawan', state: 'again' }, { text: 'Ask legal about exported PDFs', owner: 'Dita', state: 'open' }], fresh: [{ text: 'Add a print view for documents', owner: 'Ana' }] },
45
+ carried_in: [], carried: {} };
46
+ const LIVE_NOTE = { id: 'n2', title: 'Design crit', state: 'recording', updated_at: now.toISOString(), meeting_ms: 12 * 60000 + 4000, recorded_from: iso(LIVE),
47
+ meeting: { kind: 'event', event_id: 'ev-live', start: iso(LIVE), end: iso(LIVE_END), title: 'Design crit' }, body: 'Ask Ana for the tablet frames.',
48
+ transcript: [{ t: 300000, source: 'meeting', text: 'The report panel keeps one toolbar row.' }, { t: 420000, source: 'mic', text: 'And Issue is the blue button.' }, { t: 610000, source: 'meeting', text: 'Completion is 81% on the web.', cat: 'statement' }],
49
+ highlights: [{ t: 420000, text: 'Issue is the blue button.' }], speakers: { meeting: 'Ana' } };
50
+ const ROWS = [
51
+ { id: 'n1', title: 'Viewer sync', state: 'ended', updated_at: NOTE.updated_at, meeting: { kind: 'event', event_id: 'ev-sync', start: iso(SYNC), title: 'Viewer sync' }, series: { key: 'viewer-sync' }, initiative: NOTE.initiative, meeting_ms: NOTE.meeting_ms, summary_lines: [NOTE.final_notes.overview] },
52
+ { id: 'n0', title: 'Viewer sync', state: 'ended', updated_at: '2026-10-15T10:31:00Z', meeting: { kind: 'event', event_id: 'ev-sync-0', start: '2026-10-15T10:00:00Z', title: 'Viewer sync' }, series: { key: 'viewer-sync' }, initiative: NOTE.initiative },
53
+ { id: 'n2', title: 'Design crit', state: 'recording', updated_at: now.toISOString(), meeting: LIVE_NOTE.meeting, meeting_ms: LIVE_NOTE.meeting_ms },
54
+ { id: 'n3', title: 'Compare meeting note apps', state: 'ended', updated_at: iso(at(9, 30)), created_at: iso(at(9, 0)), meeting: null, meeting_ms: 20 * 60000 },
55
+ { id: 'n4', title: 'Saved views interview', state: 'ended', updated_at: '2026-10-14T14:00:00Z', created_at: '2026-10-14T13:30:00Z', meeting: null, initiative: { id: 'saved-views', title: 'Saved views for teams' } },
56
+ ];
57
+ return { now, SYNC, RAIL, LIVE, week, NOTE, PLACE, LIVE_NOTE, ROWS, lvl };
58
+ }
59
+
60
+ const REPORT_PATH = 'reports/leadership-review/2026-10-21.md';
61
+ const REPORT = '---\ntype: Report\ntitle: "Password login and sign-up"\n---\n\n# Password login and sign-up\n\n## Summary\nLogin success is **81%** (597 of 733 web logins), as of 19 Oct 2026.\n\n## Login and sign-up success\n- Web: 81%\n- App: 88%\n\n## Why people drop\n- The code email arrives late\n- The password rules are unclear\n\n## Next steps\n- Ship the magic link\n- Rewrite the rules text\n\n## Sources reached and not reached\n- Reached: analytics, support, app store\n';
62
+
63
+ function install(page, o = {}) {
64
+ const W = world(o.now || new Date());
65
+ const S = { posts: [], gets: [], scene: o.scene || 'notes', W };
66
+ const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
67
+ const body = (r) => { try { return JSON.parse(r.request().postData() || '{}'); } catch { return {}; } };
68
+ const post = (r) => { const b = body(r); S.posts.push({ path: new URL(r.request().url()).pathname, body: b }); return b; };
69
+ page.on('request', (r) => { if (r.method() === 'GET' && /\/api\//.test(r.url())) S.gets.push(new URL(r.url()).pathname + new URL(r.url()).search); });
70
+ S.store = { n1: W.NOTE, n2: W.LIVE_NOTE, n0: { ...W.ROWS[1], body: '', transcript: [] }, n3: { ...W.ROWS[3], body: '', transcript: [] }, n4: { ...W.ROWS[4], body: '', transcript: [] } }; S.made = 0;
71
+ S.rows = (S.scene === 'prep' || o.noLive ? W.ROWS.filter((x) => x.id !== 'n2') : W.ROWS).map((x) => ({ ...x }));
72
+ if (S.scene === 'prep' || o.noLive) delete S.store.n2;
73
+ const notesRows = () => S.rows;
74
+ return Promise.all([
75
+ page.route('**/api/calendar-views*', (r) => json(r, W.week())),
76
+ page.route(/\/api\/notes(\?.*)?$/, (r) => (r.request().method() === 'GET' ? json(r, { ok: true, notes: notesRows(), series_open: { 'viewer-sync': { open: 2, carried: true } } }) : json(r, { ok: true }))),
77
+ page.route('**/api/notes/one*', (r) => {
78
+ const id = new URL(r.request().url()).searchParams.get('id'), n = S.store[id];
79
+ if (!n) return json(r, { ok: false, error: 'no such note' }, 404);
80
+ if (id === 'n1') return json(r, { ok: true, note: n, recording: { bytes: 64 }, screen: { frames: [{ t: 190000, why: 'Viewer beside the chat' }, { t: 895000, why: 'Diff approve button' }, { t: 1470000, why: 'Print preview' }] }, place: S.out ? null : W.PLACE });
81
+ return json(r, { ok: true, note: n, screen: { frames: id === 'n2' ? [{ t: 300000 }, { t: 400000 }, { t: 500000 }, { t: 600000 }] : [] }, place: null });
82
+ }),
83
+ page.route('**/api/notes/series?*', (r) => json(r, { ok: true, series: { key: 'viewer-sync', meetings: [{ id: 'n0', at: '2026-10-15T10:00:00Z', decided: 1, steps: 3 }, { id: 'n1', at: W.NOTE.meeting.start, decided: 2, steps: 3 }] } })),
84
+ page.route('**/api/notes/search*', (r) => json(r, { ok: true, ids: ['n4'] })),
85
+ page.route('**/api/notes/new', (r) => {
86
+ const b = post(r), id = 'new' + (++S.made);
87
+ const n = { id, title: b.title || '', state: 'idle', created_at: new Date().toISOString(), updated_at: new Date().toISOString(), meeting: b.meeting || (b.event ? { kind: 'event', event_id: b.event.id || b.event, start: b.event.at, title: b.event.title } : null), transcript: [] };
88
+ S.store[id] = n; S.rows.unshift({ ...n });
89
+ return json(r, { ok: true, id, note: n });
90
+ }),
91
+ page.route(/\/api\/notes\/(record|pause|stop)$/, (r) => {
92
+ const b = post(r), k = new URL(r.request().url()).pathname.split('/').pop(), n = S.store[b.id];
93
+ if (n) { n.state = k === 'record' ? 'recording' : k === 'pause' ? 'paused' : 'ended'; const row = S.rows.find((x) => x.id === b.id); if (row) row.state = n.state; }
94
+ return json(r, { ok: true });
95
+ }),
96
+ page.route(/\/api\/notes\/(save|private|speaker|series-member|link|highlight)$/, (r) => {
97
+ const b = post(r), k = new URL(r.request().url()).pathname.split('/').pop(), n = S.store[b.id];
98
+ if (n && k === 'save') n.body = b.body;
99
+ if (n && k === 'private') { n.private = !!b.private; n.transcript = []; }
100
+ if (k === 'series-member') S.out = b.key === 'off';
101
+ if (k === 'link') { const set = { initiative: b.initiative || null, board: b.board || null, portfolio: !!b.portfolio }; if (n) Object.assign(n, set); const row = S.rows.find((x) => x.id === b.id); if (row) Object.assign(row, set); }
102
+ return json(r, { ok: true, private: !!b.private });
103
+ }),
104
+ page.route('**/api/notes/recording*', (r) => r.fulfill({ status: 200, contentType: 'audio/wav', body: Buffer.alloc(0) })),
105
+ page.route('**/api/notes/screen*', (r) => r.fulfill({ status: 200, contentType: 'image/png', body: Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==', 'base64') })),
106
+ page.route('**/api/meeting-focus?*', (r) => {
107
+ const u = new URL(r.request().url()), ev = u.searchParams.get('event'), note = u.searchParams.get('note');
108
+ const live = ev === 'ev-live' || note === 'n2';
109
+ /* a note with no calendar event has no event, brief or topics */
110
+ if (!ev && note && note !== 'n1' && note !== 'n2') return json(r, { ok: true, now_ms: Date.now(), event: null, note: { id: note, state: (S.store[note] || {}).state || 'ended' }, brief: null, material: [], topics: [], runs: [], captured: {}, tail: [] });
111
+ const base = { ok: true, now_ms: Date.now(), event: live ? { id: 'ev-live', title: 'Design crit', at: W.LIVE_NOTE.meeting.start, end: W.LIVE_NOTE.meeting.end, attendees: ['Ana', 'Wawan'] } : ev === 'ev-rail' ? { id: 'ev-rail', title: 'Rail review', at: iso(W.RAIL), attendees: ['Sam', 'Wawan'] } : { id: 'ev-sync', title: 'Viewer sync', at: W.NOTE.meeting.start, end: W.NOTE.meeting.end, attendees: ['Ana', 'Dita', 'Wawan'] },
112
+ note: live ? { id: 'n2', state: 'recording' } : ev === 'ev-rail' ? null : { id: 'n1', state: 'ended' },
113
+ brief: { gist: ['Agree the rail before the Commit.'], purpose: 'Agree the rail before the Commit.', matters: [{ tag: 'Late', tone: 'bad', text: 'The SSO spike', meta: 'due 14 Oct' }, { tag: 'Changed', tone: '', text: 'The report panel design', meta: 'Oct 21' }], last: { id: 'n0', at: '2026-10-15T10:00:00Z', decisions: [{ text: 'a' }], actions: [{ text: 'b' }, { text: 'c' }] }, prep: 'Read the rail PRD.', initiative: { id: 'viewer', title: 'Viewer', ws: 'w1' } },
114
+ material: [{ kind: 'pmos-doc', title: 'Rail PRD', ref: 'planning/prd/rail.md', from: 'you' }, { kind: 'link', title: 'Figma: report panel', url: 'https://x.example/f', topic: 'The report panel' }],
115
+ topics: live ? [{ id: 't1', text: 'One toolbar row', state: 'discussed', minutes: 6 }, { id: 't2', text: 'The Issue button', state: 'now', minutes: 8 }, { id: 't3', text: 'Phone layout', state: 'plan', minutes: 10 }] : [{ id: 't1', text: 'Viewer beside the chat', state: 'plan', minutes: 10 }, { id: 't2', text: 'Saved views and the migration', state: 'plan', minutes: 10 }, { id: 't3', text: 'Print preview', state: 'plan', minutes: 10 }],
116
+ runs: live ? [{ topic: 't1', from_min: 0, to_min: 6 }, { topic: 't2', from_min: 6, to_min: null }] : [], captured: live ? { decisions: [{}], actions: [{}, {}], questions: [] } : {}, tail: [] };
117
+ return json(r, base);
118
+ }),
119
+ page.route('**/api/meeting-focus/topic', (r) => { post(r); return json(r, { ok: true }); }),
120
+ page.route('**/api/meeting-replay*', (r) => (new URL(r.request().url()).searchParams.get('note') !== 'n1' ? json(r, { ok: false, error: 'no recording' }) : null) || json(r, { ok: true, length_ms: 31 * 60000 + 5000, note: { id: 'n1', title: 'Viewer sync' }, meeting: { title: 'Viewer sync', at: W.NOTE.meeting.start, attendees: ['Ana', 'Dita', 'Wawan'] },
121
+ topics: [{ id: 't1', text: 'Viewer beside the chat' }, { id: 't2', text: 'Saved views and the migration' }, { id: 't3', text: 'Print preview' }],
122
+ runs: [{ topic: 't1', from_ms: 0, to_ms: 600000 }, { topic: 't2', from_ms: 600000, to_ms: 1300000 }, { topic: 't3', from_ms: 1300000, to_ms: 1865000 }],
123
+ keys: [{ k: 'decision', text: 'Diffs can be approved from the Viewer.', t: 895000 }, { k: 'action', text: 'Add a print view', t: 1500000 }, { k: 'decision', text: 'Migration V.3', t: 1700000 }],
124
+ shots: [{ t: 190000, why: 'Viewer beside the chat' }, { t: 895000, why: 'Diff approve button' }, { t: 1470000, why: 'Print preview' }],
125
+ lines: [{ t: 190000, who: 'Dita', text: 'The Viewer sits beside the chat now.' }, { t: 760000, who: 'You', text: 'Saved views move in their own work-item.' }] })),
126
+ page.route('**/api/meeting-material*', (r) => (r.request().method() === 'POST' ? (post(r), json(r, { ok: true })) : json(r, { ok: true, key: 'k', items: [] }))),
127
+ page.route('**/api/viewer-meeting?*', (r) => {
128
+ const u = new URL(r.request().url()), topics = u.searchParams.getAll('topic');
129
+ return json(r, { ok: true, agenda: { key: 's:viewer-sync', total: 30, topics: topics.map((t, i) => ({ n: i + 1, text: t, min: 10, set: i === 0 })) }, capture: { app: 'zoom', shots: 'on' }, steps: { links: S.links || {}, tasks: [] } });
130
+ }),
131
+ page.route(/\/api\/viewer-meeting\/(agenda|capture)/, (r) => { const b = post(r); return json(r, { ok: true, capture: { app: b.app || 'zoom', shots: b.shots || 'on' } }); }),
132
+ page.route('**/api/viewer-meeting/work-item', (r) => { const b = post(r); const k = require('../lib/viewer-meeting.js').stepKey(b.step && b.step.text); const had = (S.links = S.links || {})[k]; if (!had) S.links[k] = 'V.' + (4 + Object.keys(S.links).length); return json(r, { ok: true, ticket: S.links[k], created: !had }); }),
133
+ page.route('**/api/plan-items*', (r) => (r.request().method() === 'POST' ? (post(r), json(r, { ok: true, written: [{ item: 'item-9' }] })) : json(r, { ok: true, stages: [{ id: 'st1', label: 'Intake' }] }))),
134
+ page.route('**/api/calendar-links', (r) => { post(r); return json(r, { ok: true }); }),
135
+ page.route('**/api/boards', (r) => json(r, { ok: true, boards: [{ id: 'b1', ws: 'w1', name: 'Growth' }] })),
136
+ page.route('**/api/boards/backlog*', (r) => json(r, { ok: true, rows: [{ id: 'viewer', title: 'Viewer' }] })),
137
+ /* the report */
138
+ page.route('**/api/doc?*', (r) => r.fulfill({ status: 200, contentType: 'text/markdown', body: S.reportText || REPORT })),
139
+ page.route('**/api/report-design/cycle?*', (r) => json(r, { ok: true, designed: false })),
140
+ page.route('**/api/report-setups?*', (r) => json(r, { ok: true, setups: S.setup ? [S.setup] : [] })),
141
+ page.route('**/api/report-setups/*', (r) => { const b = post(r); S.setup = { id: 'leadership-review', name: 'Password login and sign-up', audience: 'Leadership review', status: 'active', schedule: b.schedule || (b.proposal && b.proposal.schedule) }; return json(r, { ok: true, setup: S.setup }); }),
142
+ page.route('**/api/report-documents?*', (r) => json(r, { ok: true, docs: [{ path: REPORT_PATH, slot: '2026-10-21', state: 'draft' }, { path: 'reports/leadership-review/2026-10-14.md', slot: '2026-10-14', state: 'issued' }, { path: 'reports/leadership-review/2026-10-07.md', slot: '2026-10-07', state: 'issued' }, { path: 'reports/leadership-review/2026-09-30.md', slot: '2026-09-30', state: 'issued', archived: true }] })),
143
+ page.route('**/api/report-documents/*', (r) => { post(r); return json(r, { ok: true }); }),
144
+ page.route('**/api/viewer-report/checks*', (r) => json(r, { ok: true, checks: [{ id: 'sources', ok: true, text: 'All 3 sources reached · data from Oct 19' }, { id: 'sections', ok: true, text: '5 slides, every section filled' }, { id: 'figures', ok: false, text: 'The 81% figure is 2 days old. Refresh it first?' }] })),
145
+ page.route('**/api/report/draft*', (r) => json(r, { ok: true, exists: true, sha: 'abc', markdown: S.reportText || REPORT })),
146
+ page.route('**/api/report/issue', (r) => { post(r); return json(r, { ok: true }); }),
147
+ page.route('**/api/shares', (r) => (r.request().method() === 'POST' ? (post(r), json(r, { ok: true, url: 'https://share.example/s/abc', ends: '2026-10-29T00:00:00Z' })) : json(r, { ok: true, shares: S.shares || [] }))),
148
+ page.route('**/api/shares/password', (r) => json(r, { ok: true, password: 'velvet-pepper-planet-35' })),
149
+ page.route('**/api/shares/off', (r) => { post(r); return json(r, { ok: true }); }),
150
+ ]).then(() => S);
151
+ }
152
+
153
+ /* the stand-in recorder: the console's recorder (view-notes.js) makes these same requests; this one opens no microphone */
154
+ const RECORDER = () => {
155
+ window.__premiumRecorder = {
156
+ _id: null, _started: null, _banner: null, _hl: 0,
157
+ async listen(id) {
158
+ const r = await fetch('/api/notes/record', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }).then((x) => x.json());
159
+ if (!r.ok) { this._banner = r.error; return false; }
160
+ this._id = id; this._started = Date.now() - 65000; return true;
161
+ },
162
+ async pause() { await fetch('/api/notes/pause', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: this._id }) }); this._id = null; },
163
+ async stop(id) { await fetch('/api/notes/stop', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id }) }); this._id = null; return { discarded: false }; },
164
+ highlight() { this._hl++; return true; }, highlighting() { return this._hl ? { state: 'listening', open: true } : null; },
165
+ listening() { return this._id; }, started() { return this._started; }, banner() { const b = this._banner; this._banner = null; return b; },
166
+ };
167
+ };
168
+
169
+ /** One page on the Viewer: a context, the stand-ins, the stand-in recorder, and the page opened at `url`. → { ctx, page, S, errors } */
170
+ async function open(browser, base, url, o = {}) {
171
+ const ctx = await browser.newContext({ viewport: { width: o.w || 1280, height: o.h || 900 }, acceptDownloads: true });
172
+ const page = await ctx.newPage(), errors = [];
173
+ page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
174
+ const S = await install(page, o);
175
+ await page.addInitScript(RECORDER);
176
+ if (o.init) await page.addInitScript(o.init);
177
+ await page.goto(base + url);
178
+ return { ctx, page, S, errors };
179
+ }
180
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await new Promise((r) => setTimeout(r, step)); } };
181
+
182
+ module.exports = { open, until, RECORDER, install, world, REPORT, REPORT_PATH, dayKey, iso };
@@ -2,11 +2,13 @@
2
2
  type: Guide
3
3
  title: "The premium Briefing (/premium.html)"
4
4
  description: "The Briefing page at /premium.html: the hero sentence, What you need to do, Today, the dock, and what each one reads from the repository."
5
- timestamp: 2026-10-22
5
+ timestamp: 2026-10-23
6
6
  ---
7
7
 
8
8
  # The premium Briefing
9
9
 
10
+ > Home now follows the Agreed design. [Home](home.md) describes the page as it works today and the cards marked **Waiting for design**. The sections below describe the features that those cards keep.
11
+
10
12
  The premium Briefing is a page of its own at `/premium.html`. The console at `/` stays the default page. This page reads the repositories of the products you pick (see "Products"). It writes only when you press a button that says it records (see "What the buttons record"), plus one derived copy of its last answer, described below.
11
13
 
12
14
  Every premium page uses the console's type: Space Grotesk for text, IBM Plex Mono for times and labels, and the same sizes and weights as the console. A premium page and the console at the same place read at the same size.
@@ -0,0 +1,47 @@
1
+ ---
2
+ type: Guide
3
+ title: "Home (/premium.html) and the features that wait for design"
4
+ description: "Home in the Agreed design: the list, the Viewer, the place menu, and the plain cards for the features the design does not draw yet."
5
+ timestamp: 2026-10-23
6
+ ---
7
+
8
+ # Home
9
+
10
+ Home is the page at `/premium.html`. It follows the Agreed design. The left side is one list: what needs you, today's meetings, and the files of an open initiative. The right side is the Viewer. A row opens its item in the Viewer. On a phone the list is a sheet that opens from the top bar.
11
+
12
+ Some features of the earlier premium pages are not in the Agreed design yet. Home keeps each one usable as a plain card in the Viewer. Each such card shows the label **Waiting for design**. The label means that the card works, but its look is not final. A designed version replaces the card later.
13
+
14
+ ## The place menu
15
+
16
+ Press the round button at the bottom of the page, then **More**. The menu lists these items:
17
+
18
+ - **My work.** Your list, in four tabs: **Your list**, **Waiting on others**, **Weekly review** and **Untouched**. Type a line and press **Add** to add an item. Press **Done** to mark an item done. Press a row to open the item in the same card:
19
+ - **Edit** opens the fields: **When** (Today, Not yet, Not before a date, Someday), **Waiting on**, **Who does it** (the steps) and **Priority · Due**. **Keep it** and **Drop it** are under the fields.
20
+ - **The agent** can draft the item. A draft shows under the item with **Open** and **Copy**. Nothing goes out until you confirm **Post it**. **Send it back with a note** asks for a new draft.
21
+ - **Back to My work**, or Escape, returns to the list. Escape closes the fields first.
22
+ - **Focus** at the top of Your list opens **Focus and jobs**: accept or skip a suggestion, and add a job ("When …, I want …, so …").
23
+ - On a focused row, J and K move between rows. The right and left arrows do what the row says, for example Done and Tomorrow. A drag of a row to the right or left does the same. Most presses show **Undo** for a few seconds.
24
+ - **Around you.** The six rows of the earlier Briefing card: agent proposals, mentions, portfolio pulse, horizon scan, report found and data freshness. The card also shows the prep line for your next meeting and today's digests. A row opens its view in the same card. **Back** returns to the six rows. The presses are the same as before. See "Around you" in [the premium Briefing](briefing-premium.md).
25
+ - **Agent results.** What the agents finished that waits on you.
26
+ - **End of the day.** What finished today, the recap, and tomorrow's meetings.
27
+ - **Calendar**, **Record a note** and **Settings**.
28
+ - **Search.** Find an initiative, a core document or a session by name. Press Ctrl K (⌘K on a Mac) to open it from anywhere on Home.
29
+ - **Products.** The products that Home reads. A switch turns one product on or off. **Back to the default** goes back to the default list. With `?ws=` in the address, **All picked products** goes back to the full list.
30
+ - **Sources.** The state of each source that Home reads, with a dot that shows its health. **What Home shows** says which sources give the Today and Needs you lists.
31
+
32
+ To open Around you at one row, add `?around=` to the address with one of `prop`, `men`, `pulse`, `scan`, `rep` or `src`.
33
+
34
+ ## A need row in the Viewer
35
+
36
+ A need opens in the Viewer with its title, its facts and its choices. A need from a source starts with **Why now**. If the source gives a web address, **Open it** opens it in a new tab.
37
+
38
+ ## Your first Briefing
39
+
40
+ After an import in Welcome, Home opens with `first=` in the address. A card at the top of the list shows what came in and the state of each tool that you ticked. **Undo this import** reverses the import and returns to Welcome. The card shows **Waiting for design**.
41
+
42
+ ## A document page
43
+
44
+ A document opens as a page in the Viewer. Use **Page**, **Edit** or **Markdown** to read it, edit it in place, or edit the file as text. Under the page, a section marked **Waiting for design** holds two lists:
45
+
46
+ - **Edit log.** Each version of the file, with its reason, who changed it, and the day.
47
+ - **Proposals.** The agent's proposed changes. **Open proposals** shows each open proposal with the request and each section. **Accept** takes only the sections that are still current. If no section is current, the proposal says that it cannot be accepted. **Reject** asks for a reason first. **Closed** lists the accepted and rejected proposals with their reasons. If the server refuses a press, the section shows the server's reason.
@@ -28,6 +28,7 @@ On a desktop the workspace is one frame. [Layout](layout.md) explains each part.
28
28
  | The sessions of a repository, by initiative | The agent dock. ⌘K → **Branches and sessions** lists the branches. |
29
29
  | The items of an initiative | Board, or Breakdown in the initiative detail |
30
30
  | How the Briefing cards, day part, Portfolio pulse and overdue items work | [Briefing](briefing-cards.md) |
31
+ | Home in the Agreed design, and the cards marked Waiting for design | [Home](home.md) |
31
32
  | The premium Briefing page at /premium.html | [Premium Briefing](briefing-premium.md) |
32
33
  | Run reports | Reports |
33
34
  | Whether a document is the same as its Google Docs or Confluence copy | Docs: ⌘K → **Docs**, or press `g d` |
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+ /* agent-roles.js — the role name a session shows in the chat and the list (initiative premium-agreed-design, Home).
3
+ *
4
+ * roleOf({ skill, origin, first }) → { key, name, initial }
5
+ * ROLES · TABLE
6
+ *
7
+ * The Agreed design names each agent by its role ("Communicator", "Delivery lead") with a two-letter avatar. A session has no role
8
+ * record of its own, so the role is DERIVED from the skill that started it, in this order:
9
+ * 1. skill the skill the session was spawned for (server.js keeps it as modelAsk.skill and persists it)
10
+ * 2. origin a skill named in the origin tag ("schedule:<skill>", "skill:<skill>", "core-doc:<skill>")
11
+ * 3. first the first slash command of the conversation ("/prd …"), which the client reads from the transcript
12
+ * A session that names none of the skills below is "Claude" (initial C): the fallback, never a guess.
13
+ * Pure: the client imports the same table through GET /api/home-desk (roles), so both sides say the same name. */
14
+
15
+ const ROLES = Object.freeze({
16
+ claude: { key: 'claude', name: 'Claude', initial: 'C' },
17
+ spec: { key: 'spec', name: 'Spec writer', initial: 'Sp' },
18
+ eval: { key: 'eval', name: 'Evaluator', initial: 'Ev' },
19
+ strategy: { key: 'strategy', name: 'Strategist', initial: 'St' },
20
+ research: { key: 'research', name: 'Researcher', initial: 'Re' },
21
+ design: { key: 'design', name: 'Designer', initial: 'De' },
22
+ delivery: { key: 'delivery', name: 'Delivery lead', initial: 'Dl' },
23
+ comms: { key: 'comms', name: 'Communicator', initial: 'Co' },
24
+ build: { key: 'build', name: 'Builder', initial: 'Bu' },
25
+ });
26
+
27
+ /** [role key, pattern over a skill name]. The first match wins, so the narrow patterns come first. */
28
+ const TABLE = Object.freeze([
29
+ ['eval', /^(eval-rubric|evaluator|explain-run|correction-signal-derive|eval|evals?-.+|.*-eval)$/],
30
+ ['spec', /^(prd|requirements-elicitation|write-spec|spec|.*-prd)$/],
31
+ ['design', /^(design-brief|design-reconcile|prototype|prototype-grill|design.*)$/],
32
+ ['delivery', /^(tracker-handoff|sprint-planning|jira.*|delivery.*|release-plan.*)$/],
33
+ ['comms', /^(pm-communication|stakeholder-update|weekly-update|copywriting|release-notes?|roadmap-update|status-report|comms.*)$/],
34
+ ['research', /^(discovery|source-to-concept|synthesize-research|research.*|interview.*|ingest-repo)$/],
35
+ ['strategy', /^(okr|strategic-brief|pmos-router|metrics-review|health-budgets?|strategy.*|okrs?-.+)$/],
36
+ ['build', /^(builder|factory.*|build-.+)$/],
37
+ ]);
38
+
39
+ const clean = (s) => String(s == null ? '' : s).trim().toLowerCase().replace(/^\//, '').replace(/\.skill$/, '').replace(/^.*[/:]/, '');
40
+
41
+ /** The role of one skill name, or null. */
42
+ function roleOfSkill(skill) {
43
+ const k = clean(skill);
44
+ if (!k || !/^[a-z0-9][a-z0-9._-]{0,80}$/.test(k)) return null;
45
+ for (const [role, re] of TABLE) if (re.test(k)) return ROLES[role];
46
+ return null;
47
+ }
48
+
49
+ /** A skill named in an origin tag: "schedule:okr", "skill:prd", "core-doc:prd:viewer" → the first part that is a known skill. */
50
+ function skillOfOrigin(origin) {
51
+ const parts = String(origin || '').split(':').slice(1);
52
+ for (const p of parts) if (roleOfSkill(p)) return p;
53
+ return null;
54
+ }
55
+
56
+ /** The first slash command of a conversation's first user text ("/prd viewer" → "prd"), or null. */
57
+ function slashOf(text) {
58
+ const m = /^\s*\/([a-z0-9][a-z0-9._:-]{0,60})/i.exec(String(text || ''));
59
+ return m ? m[1] : null;
60
+ }
61
+
62
+ function roleOf({ skill, origin, first } = {}) {
63
+ return roleOfSkill(skill) || roleOfSkill(skillOfOrigin(origin)) || roleOfSkill(slashOf(first)) || ROLES.claude;
64
+ }
65
+
66
+ /** The table as plain data for the page: [{ key, name, initial, patterns: [source] }]. */
67
+ function tableForPage() {
68
+ return Object.values(ROLES).map((r) => ({ ...r, patterns: TABLE.filter(([k]) => k === r.key).map(([, re]) => re.source) }));
69
+ }
70
+
71
+ module.exports = { ROLES, TABLE, roleOf, roleOfSkill, skillOfOrigin, slashOf, tableForPage };
@@ -89,35 +89,93 @@ function ticketsBy(sprints, items) {
89
89
  }
90
90
  return by;
91
91
  }
92
- /** The stage track of one row: its step, the output that finishes it, progress toward it and the tickets behind that progress. */
92
+ /** The parts that finish each step, as the Agreed design's "What finishes each step" frame names them. Only Build and Deliver (Jira tickets),
93
+ * Plan (dates and pushed tickets) and Prioritize (anchor and rank) have a record PMOS reads; the other parts are named but not counted. */
94
+ const PARTS = {
95
+ triage: ['business case', 'who asked', 'problem', 'success measure'],
96
+ discover: ['problem', 'users', 'evidence', 'scope', 'success metric', 'risks'],
97
+ plan: ['scope', 'timeline', 'tickets in Jira'],
98
+ prioritize: ['KR or health budget', 'rank'],
99
+ monitor: ['days of data', 'outcome report'],
100
+ evaluate: ['report', 'evaluation', 'your verdict'],
101
+ };
102
+ /** A progress the record holds: the route gives a fraction (0..1), older readings a percent. → a whole percent, or null. */
103
+ const pctOf = (v) => { const n = Number(v); if (v == null || v === '' || !Number.isFinite(n)) return null; return Math.max(0, Math.min(100, Math.round(n <= 1 ? n * 100 : n))); };
104
+ /** The stage track of one row: its step, the output that finishes it, the parts or tickets counted toward it, the steps it skipped
105
+ * (a move past a stage leaves a "Skipped <stage>" warning on the row) and what waits on the PM. Nothing is invented: a part PMOS
106
+ * has no record for is named and left uncounted. */
93
107
  function trackOf(r, tickets, today, release) {
94
- const k = stepIndex(r.stage, r.cat), step = STEPS[k] || null;
108
+ const k = stepIndex(r.stage, r.cat), step = STEPS[k] || null, key = step ? step.key : null;
95
109
  const tk = (tickets || []).slice(0, 40);
96
110
  const done = tk.filter((t) => t.status === 'Done').length, blocked = tk.filter((t) => t.blocked);
97
111
  const pts = tk.filter((t) => t.points != null), ptsAll = pts.reduce((n, t) => n + t.points, 0), ptsDone = pts.filter((t) => t.status === 'Done').reduce((n, t) => n + t.points, 0);
98
112
  const byPts = pts.length === tk.length && ptsAll > 0;
99
- const jira = !!(step && (step.key === 'build' || step.key === 'deliver') && tk.length);
113
+ const jira = !!((key === 'build' || key === 'deliver') && tk.length);
100
114
  let out = step ? step.output : 'No step on record';
101
- if (step && step.key === 'deliver' && release) out = release + ' shipped + your sign-off';
115
+ if (key === 'deliver' && release) out = release + ' shipped + your sign-off';
116
+ const pct = r.progress != null ? r.progress : null;
102
117
  const prog = jira
103
118
  ? { done: byPts ? ptsDone : done, total: byPts ? ptsAll : tk.length, unit: byPts ? 'pts' : 'tickets', parts: tk.map((t) => t.cls || '') }
104
- : r.progress != null ? { done: Math.round(r.progress), total: 100, unit: '%', parts: null } : null;
105
- const review = tk.filter((t) => t.status === 'In review');
106
- const next = blocked.length ? { tone: 'red', text: blocked[0].key + ' blocked' + (blocked[0].reason ? ' · ' + blocked[0].reason : '') }
107
- : review.length ? { tone: '', text: review.map((t) => t.key).slice(0, 2).join(', ') + ' in review' }
108
- : prog ? null : { tone: '', text: step ? 'Nothing is counted toward it yet' : 'Its stage is not one of the eight steps' };
119
+ : pct != null ? { done: pct, total: 100, unit: '%', parts: null } : null;
120
+ // the segments of the Output bar and the words under it
121
+ let segs = [], count = '', line = [];
122
+ if (jira) {
123
+ segs = tk.map((t) => ({ cls: t.cls || '', tk: t.key }));
124
+ count = prog.done + ' of ' + prog.total + (byPts ? ' pts' : '');
125
+ if (blocked.length) line.push({ text: blocked[0].key + ' blocked' + (blocked[0].reason ? ' · ' + blocked[0].reason : ''), tone: 'red' });
126
+ const review = tk.filter((t) => t.status === 'In review');
127
+ if (review.length) line.push({ text: review.map((t) => t.key + (review.length === 1 ? ' ' + t.title : '')).slice(0, 2).join(', ') + ' in review' });
128
+ if (!line.length) { const doing = tk.filter((t) => t.status === 'In progress'); line.push({ text: doing.length ? doing.length + ' in progress · ' + (tk.length - done - doing.length) + ' to do' : done === tk.length ? 'Every ticket is done' : (tk.length - done) + ' to do' }); }
129
+ } else if (key === 'plan' || key === 'prioritize') {
130
+ const have = key === 'plan' ? [null, !!(r.start && r.end), tk.length > 0] : [!!r.anchor, Number.isInteger(r.rank)];
131
+ segs = have.map((h, i) => ({ cls: h ? 'dn' : '', name: cap1(PARTS[key][i], 0), st: h === true ? 'done' : h === null ? 'not on record' : 'to do' }));
132
+ const n = have.filter(Boolean).length, known = have.filter((h) => h !== null).length;
133
+ count = n + ' of ' + have.length;
134
+ const words = PARTS[key].map((w, i) => (have[i] === true ? cap1(w, i) + ' ✓' : have[i] === null ? cap1(w, i) + ' not on record' : cap1(w, i)));
135
+ if (key === 'prioritize' && !r.anchor) line.push({ text: 'Needs a KR or health budget' });
136
+ else line.push({ text: words.join(' · ') });
137
+ if (known === 0) count = '— of ' + have.length;
138
+ } else if (step && PARTS[key]) {
139
+ segs = PARTS[key].map((w) => ({ cls: '', name: cap1(w, 0), st: 'not counted' }));
140
+ count = '— of ' + PARTS[key].length + ' parts';
141
+ line.push({ text: PARTS[key].map(cap1).join(' · '), muted: true });
142
+ } else if (key === 'build' || key === 'deliver') {
143
+ segs = [{ cls: 'na' }];
144
+ count = 'No tickets yet';
145
+ line.push({ text: 'No Jira ticket has been read for it yet', muted: true });
146
+ } else if (step) {
147
+ count = 'Not counted yet';
148
+ line.push({ text: 'Nothing is counted toward it yet' });
149
+ } else line.push({ text: 'Its stage is not one of the eight steps' });
150
+ if (!jira && pct != null) { count = pct + '%'; }
151
+ // a step the row was moved past (lib/routes-boards.js keeps the move's "Skipped <stage>" warning)
152
+ const skipped = [...new Set((r.warnings || []).map((w) => (typeof w === 'string' ? /^Skipped (.+)$/.exec(w) : null)).filter(Boolean).map((m) => stepIndex(m[1], null)).filter((i) => i >= 0 && (k < 0 || i < k)))].sort((a, b) => a - b);
153
+ // what waits on the PM: the sign-off of a release whose tickets are all done (the last part of Deliver is the PM's)
154
+ const you = key === 'deliver' && tk.length && done === tk.length ? 'Your sign-off' + (release ? ' · ' + release : '') : null;
109
155
  const upd = r.updated ? days(String(r.updated).slice(0, 10), today) : null;
110
156
  const fc = tk.filter((t) => t.status !== 'Done' && t.sprintEnd).map((t) => t.sprintEnd).sort().pop() || null;
111
- return { k, key: step ? step.key : null, label: step ? step.label : (r.stage || 'No stage'), ms: !!(step && step.ms), output: out, prog, next, tickets: tk, blocked: blocked.length,
112
- idle: upd != null && upd >= 30 && r.status !== 'done' ? upd : null, forecast: fc, forecastLabel: fc ? shortDate(fc) : '' };
157
+ const next = line.find((x) => x.tone === 'red') || null;
158
+ return { k, key, label: step ? step.label : (r.stage || 'No stage'), ms: !!(step && step.ms), output: out, prog, pct: jira ? null : pct, segs, count, line, next, tickets: tk, blocked: blocked.length, skipped, you,
159
+ days: null, idle: upd != null && upd >= 30 && r.status !== 'done' ? upd : null, forecast: fc, forecastLabel: fc ? shortDate(fc) : '' };
160
+ }
161
+ const cap1 = (w, i) => (i === 0 ? w.charAt(0).toUpperCase() + w.slice(1) : w);
162
+ /** The short label of an anchor: q3-2026:o2:kr1 → KR 2.1; health:<id> → Health budget. */
163
+ function krShort(anchor) {
164
+ const a = String(anchor || '');
165
+ if (!a) return '';
166
+ if (/^health:/.test(a)) return 'Health budget';
167
+ const m = /:o(\d+):kr(\d+)/i.exec(a);
168
+ return m ? 'KR ' + m[1] + '.' + m[2] : clip(a, 24);
113
169
  }
114
170
  /** The anchor's theme, for the long timeline spans: the objective a KR belongs to, or the health budgets. */
115
171
  function themeOf(anchor) {
116
172
  const a = String(anchor || '');
117
- if (!a) return { key: 'none', label: 'No anchor' };
118
- if (/^health:/.test(a)) return { key: 'health', label: 'Health budgets' };
119
- const m = /^(.*?):(o\d+)/i.exec(a);
120
- return m ? { key: m[1] + ':' + m[2], label: m[2].toUpperCase() + ' · ' + m[1] } : { key: a, label: a };
173
+ if (!a) return { key: 'none', label: 'No anchor', kind: 'none', period: '' };
174
+ if (/^health:/.test(a)) return { key: 'health', label: 'Health budgets', kind: 'health', period: '' };
175
+ const m = /^(.*?):o(\d+)/i.exec(a);
176
+ if (!m) return { key: a, label: clip(a, 40), kind: 'other', period: '' };
177
+ const q = /^q(\d)-(\d{4})$/i.exec(m[1]);
178
+ return { key: m[1] + ':o' + m[2], label: 'Objective ' + m[2], kind: 'kr', period: q ? 'Q' + q[1] + ' ' + q[2] : m[1] };
121
179
  }
122
180
 
123
181
  /** What the row's ⋯ menu and the initiative page's bar can do, from the row's own fields (initiative premium-board-actions): its workflow's stage names,
@@ -143,7 +201,7 @@ function rowOf(r, wf, today) {
143
201
  const facts = [
144
202
  ['Lane', r.lane], ['Stage', r.stage ? r.stage + (r.stageSource ? ' (' + r.stageSource + ')' : '') : ''], ['Anchor', r.anchor], ['Horizon', r.horizon],
145
203
  ['Status', STATUS_LABEL[r.status] || (r.status ? r.status.charAt(0).toUpperCase() + r.status.slice(1) : '')], ['Owner', r.owner],
146
- ['Progress', r.progress != null ? Math.round(r.progress) + '%' : ''], ['Starts', r.start ? shortDate(r.start) : ''], ['Ends', r.end ? shortDate(r.end) : ''],
204
+ ['Progress', pctOf(r.progress) != null ? pctOf(r.progress) + '%' : ''], ['Starts', r.start ? shortDate(r.start) : ''], ['Ends', r.end ? shortDate(r.end) : ''],
147
205
  ['Last changed', r.updated ? shortDate(String(r.updated).slice(0, 10)) : ''], ['Possible duplicate of', r.dupOf], ['Warnings', (r.warnings || []).map((w) => (typeof w === 'string' ? w : w && (w.text || w.message || w.id)) || '').filter(Boolean).join('; ')],
148
206
  ].filter((x) => x[1]);
149
207
  const over = r.end && today && days(r.end, today) > 0 && r.status !== 'done';
@@ -151,9 +209,9 @@ function rowOf(r, wf, today) {
151
209
  key: 'board:' + r.id, id: r.id, title: clip(r.title, 140), sub: [r.owner || 'No owner', r.lane].filter(Boolean).join(' · '),
152
210
  status: r.status || null, statusLabel: r.status && r.status !== 'on track' ? (STATUS_LABEL[r.status] || r.status) : null, bad, late: r.status === 'late',
153
211
  stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
154
- seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: r.progress != null ? Math.max(0, Math.min(100, Math.round(r.progress))) : null,
212
+ seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: pctOf(r.progress),
155
213
  finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
156
- owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, updated: r.updated || null, overDays: over ? days(r.end, today) : 0,
214
+ owner: r.owner || null, lane: r.lane || null, anchor: r.anchor || null, kr: krShort(r.anchor), rank: Number.isInteger(r.rank) ? r.rank : null, warnings: (r.warnings || []).filter((w) => typeof w === 'string').slice(0, 12), epics: Array.isArray(r.epics) ? r.epics.filter((e) => typeof e === 'string').slice(0, 6) : [], updated: r.updated || null, reading: r.reading || null, overDays: over ? days(r.end, today) : 0,
157
215
  acts: actsOf(r, names),
158
216
  dialog: {
159
217
  eye: 'Initiative', logTitle: 'Read from the board',
@@ -183,7 +241,15 @@ function build(f) {
183
241
  // the Agreed design's stage track (premium-agreed-design): tickets, output and progress per row
184
242
  const tkBy = ticketsBy((f.sprints && Array.isArray(f.sprints.sprints)) ? f.sprints.sprints : [], f.items || []);
185
243
  const relOfIni = new Map(); if (f.nextRelease && f.nextRelease.at) for (const id of f.nextRelease.ini || []) relOfIni.set(id, f.nextRelease.name || f.nextRelease.id);
186
- for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.track) { r.track = trackOf(r, tkBy.get(r.id), todayIso, relOfIni.get(r.id)); r.theme = themeOf(r.anchor); }
244
+ const relAt = f.nextRelease && f.nextRelease.at ? String(f.nextRelease.at).slice(0, 10) : null;
245
+ // the Jira epic of each initiative, from the board's work items (Linked: Epic <key>)
246
+ const epicBy = new Map(); for (const w of f.items || []) if (w && w.kind === 'Epic' && w.key && w.ini && !epicBy.has(w.ini)) epicBy.set(w.ini, w.key);
247
+ for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.track) {
248
+ r.track = trackOf(r, tkBy.get(r.id), todayIso, relOfIni.get(r.id)); r.theme = themeOf(r.anchor);
249
+ if (epicBy.has(r.id) && !r.epics.includes(epicBy.get(r.id))) r.epics.unshift(epicBy.get(r.id));
250
+ // the release it rides on, with the days to it (the status line says when it ships)
251
+ r.release = relOfIni.has(r.id) && relAt ? { name: relOfIni.get(r.id), at: shortDate(relAt), iso: relAt, days: days(todayIso, relAt) } : null;
252
+ }
187
253
  // the timeline: only an initiative with both a start and an end date has a bar
188
254
  const dated = rows.filter((r) => r.start && r.end && isoDay(r.start) && isoDay(r.end));
189
255
  let timeline;