create-pmos 0.424.0 → 0.426.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 (110) hide show
  1. package/package.json +25 -25
  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/board-deliveries-test.js +153 -0
  7. package/workspace/board-programs-test.js +60 -36
  8. package/workspace/board-shot.js +4 -3
  9. package/workspace/briefing-premium-board-test.js +9 -6
  10. package/workspace/briefing-premium-insights-test.js +31 -15
  11. package/workspace/briefing-premium-products-test.js +46 -43
  12. package/workspace/calm-timeline-test.js +190 -0
  13. package/workspace/changelog.json +24 -0
  14. package/workspace/ev-everywhere-test.js +3 -1
  15. package/workspace/guide/briefing-premium.md +3 -2
  16. package/workspace/guide/claude-proposes.md +16 -1
  17. package/workspace/guide/home.md +2 -2
  18. package/workspace/guide/index.md +1 -0
  19. package/workspace/guide/notes.md +39 -1
  20. package/workspace/guide/present-in-a-meeting.md +57 -0
  21. package/workspace/guide/programs.md +4 -3
  22. package/workspace/lib/board-premium.js +3 -1
  23. package/workspace/lib/briefing-premium-products.js +18 -4
  24. package/workspace/lib/chat-file-locate.js +40 -2
  25. package/workspace/lib/engine/boards.js +8 -2
  26. package/workspace/lib/idle-close.js +60 -0
  27. package/workspace/lib/loose-proposals.js +302 -0
  28. package/workspace/lib/meeting-focus.js +64 -14
  29. package/workspace/lib/my-work-premium.js +1 -1
  30. package/workspace/lib/proposal-runs.js +77 -2
  31. package/workspace/lib/propose-cli.js +42 -1
  32. package/workspace/lib/route-modules.js +1 -0
  33. package/workspace/lib/routes-boards.js +16 -4
  34. package/workspace/lib/routes-brief-page.js +9 -1
  35. package/workspace/lib/routes-briefing-premium.js +19 -0
  36. package/workspace/lib/routes-loose.js +210 -0
  37. package/workspace/lib/routes-meeting-focus.js +28 -6
  38. package/workspace/lib/routes-pm-items.js +27 -17
  39. package/workspace/lib/settings-store.js +2 -1
  40. package/workspace/lib/task-cli.js +18 -11
  41. package/workspace/milestone-pins-test.js +170 -0
  42. package/workspace/package-lock.json +2 -2
  43. package/workspace/package.json +1 -1
  44. package/workspace/premium-board-actions-test.js +2 -1
  45. package/workspace/premium-briefing-depth-test.js +2 -2
  46. package/workspace/premium-chat-term-test.js +13 -2
  47. package/workspace/premium-core-doc-issue-test.js +1 -1
  48. package/workspace/premium-rec-now-test.js +153 -0
  49. package/workspace/premium-rec-tab-test.js +167 -0
  50. package/workspace/product-lane-test.js +30 -17
  51. package/workspace/public/pm/bd-acts.js +6 -3
  52. package/workspace/public/pm/bd-deliveries.js +218 -0
  53. package/workspace/public/pm/bd-pin-card.css +16 -0
  54. package/workspace/public/pm/bd-pin-card.js +80 -0
  55. package/workspace/public/pm/bd-pins.js +33 -0
  56. package/workspace/public/pm/bd-pop.js +2 -0
  57. package/workspace/public/pm/bd-prog.js +5 -4
  58. package/workspace/public/pm/bd-span.js +140 -102
  59. package/workspace/public/pm/cozy-aud.css +9 -0
  60. package/workspace/public/pm/cozy-aud.js +80 -0
  61. package/workspace/public/pm/cozy-board.css +73 -11
  62. package/workspace/public/pm/cozy-home.css +16 -1
  63. package/workspace/public/pm/cozy-live-pill.js +3 -0
  64. package/workspace/public/pm/cozy-pick.css +41 -0
  65. package/workspace/public/pm/cozy-pick.js +134 -0
  66. package/workspace/public/pm/cozy-rec-bridge.js +32 -0
  67. package/workspace/public/pm/cozy-rec-now.css +104 -0
  68. package/workspace/public/pm/cozy-rec-now.js +330 -0
  69. package/workspace/public/pm/cozy-rec-present.css +69 -0
  70. package/workspace/public/pm/cozy-rec-present.js +467 -0
  71. package/workspace/public/pm/cozy-rec-tab.css +90 -0
  72. package/workspace/public/pm/cozy-rec-tab.js +219 -0
  73. package/workspace/public/pm/cozy-settings.js +8 -2
  74. package/workspace/public/pm/cozy-today.css +4 -0
  75. package/workspace/public/pm/home-app.js +51 -22
  76. package/workspace/public/pm/home-data.js +5 -3
  77. package/workspace/public/pm/home-list.js +63 -15
  78. package/workspace/public/pm/home-more.js +2 -31
  79. package/workspace/public/pm/home-today.js +19 -9
  80. package/workspace/public/pm/ini-tasks.js +4 -1
  81. package/workspace/public/pm/live-model.js +1 -1
  82. package/workspace/public/pm/loose-props.css +54 -0
  83. package/workspace/public/pm/loose-props.js +262 -0
  84. package/workspace/public/pm/premium-board.js +65 -30
  85. package/workspace/public/pm/premium-insights.js +42 -24
  86. package/workspace/public/pm/premium-meeting.js +17 -4
  87. package/workspace/public/pm/premium-mtg-present.js +4 -3
  88. package/workspace/public/pm/premium-report-read.js +2 -0
  89. package/workspace/public/pm/premium-vw-mtg.js +15 -7
  90. package/workspace/public/pm/rec-state.js +13 -5
  91. package/workspace/public/pm/rec-tab-core.js +92 -0
  92. package/workspace/public/pm/term-view.js +81 -10
  93. package/workspace/public/pm/view-notes.js +9 -0
  94. package/workspace/public/premium-aud.html +22 -0
  95. package/workspace/public/premium-board.html +2 -0
  96. package/workspace/public/premium-insights.html +2 -1
  97. package/workspace/public/premium-rec.html +30 -0
  98. package/workspace/public/premium.html +1 -0
  99. package/workspace/rec-present-test.js +229 -0
  100. package/workspace/server.js +116 -7
  101. package/workspace/skills/loose-propose.skill +39 -0
  102. package/workspace/task-milestones-test.js +15 -6
  103. package/workspace/test-lists/board-deliveries.json +13 -0
  104. package/workspace/test-lists/calm-timeline.json +5 -0
  105. package/workspace/test-lists/loose-props.json +9 -0
  106. package/workspace/test-lists/milestone-pins.json +6 -0
  107. package/workspace/test-lists/rec-now.json +6 -0
  108. package/workspace/test-lists/rec-present.json +13 -0
  109. package/workspace/test-lists/recording-tab.json +13 -0
  110. package/workspace/timeline-holds-test.js +44 -42
@@ -0,0 +1,330 @@
1
+ /* pm/cozy-rec-now.js — the recording tab's Now panel and its live transcript (batch 12 item 1, slice S2; frames XrtA1Tab side, XrtA7Room,
2
+ * XrtA7Transcript, XrtA5PhoneRec on the main canvas).
3
+ *
4
+ * nowModel(F, one, { now? }) → Model pure: what the Now panel shows, from GET /api/meeting-focus (F) and GET /api/notes/one (one)
5
+ * nowHtml(m, { room? }) → string To cover (or, in the room, the topic now big with chips), Raise now, the counts line, the last answer
6
+ * transcriptModel(one, { max? }) → [Line] pure: the live transcript, oldest first, with the highlight and decision marks
7
+ * transcriptHtml(lines) → string the 420px card's feed
8
+ * kindOf(text) → 'ask' | 'note' a line that ends with "?" asks Claude; anything else is kept as a note
9
+ * fromLine(note) → string "From the talk and last time": where an answer came from
10
+ * mountNow(slots, ctx) → { stop, refresh, toggleTranscript } pm/cozy-rec-tab.js mounts it: with a screen the panel fills `side`, in the room
11
+ * it fills the light `stage`; the side-panel toggle and the transcript icon go in the bar's [data-slot="now"]; the transcript card sits beside.
12
+ *
13
+ * The panel has no tabs and no header. Every part is silent at zero: no topics, no prompts, no counts, no answer → no line.
14
+ * Reads: the tab's own reads (ctx.note(): GET /api/notes/one, for the highlights and the transcript; ctx.focus(): GET /api/meeting-focus, every 15 s),
15
+ * redrawn on the tab's 'note', 'mode' and 'tick'. After a press, and every 3 s while Claude answers a question, it reads GET /api/meeting-focus itself. Writes, each on a press: POST /api/meeting-focus/raise (✓ raised, ✗ not now), POST /api/notes/save
16
+ * (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read). */
17
+ import { pmGet, pmPost } from './http.js';
18
+
19
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
20
+ const P = {
21
+ check: 'M5 12.5l4.5 4.5L19 7.5',
22
+ x: 'M6 6l12 12M18 6L6 18',
23
+ up: 'M12 19V5M6 11l6-6 6 6',
24
+ plus: 'M12 5v14M5 12h14',
25
+ lines: 'M4 6h16M4 11h16M4 16h10',
26
+ star: 'M12 4l2.4 5 5.6.8-4 3.9 1 5.5-5-2.7-5 2.7 1-5.5-4-3.9 5.6-.8z',
27
+ spark: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
28
+ };
29
+ const svg = (d, n = 17, w = 1.8, fill = false) => `<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="${fill ? 'currentColor' : 'none'}" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
30
+ const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
31
+ const mmss = (ms) => { const s = Math.max(0, Math.floor((Number(ms) || 0) / 1000)); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0'); };
32
+ const FROM_WORDS = { talk: 'the talk', screen: 'the screen', prep: 'the prep', last: 'last time' };
33
+ const RAISE_LABEL = { check: 'Check', 'follow-up': 'Follow-up', 'no-owner': 'No owner yet' };
34
+ export const BOX_HINT = 'Note, or ask Claude…';
35
+
36
+ export const kindOf = (text) => (/\?\s*$/.test(String(text || '').trim()) ? 'ask' : 'note');
37
+
38
+ /** "From the talk and last time" from an answer note's `from` list; its free `src` when it names none. */
39
+ export function fromLine(note) {
40
+ const words = (Array.isArray(note && note.from) ? note.from : []).map((k) => FROM_WORDS[k]).filter(Boolean);
41
+ if (!words.length) return note && note.src ? 'From ' + String(note.src).replace(/^from\s+/i, '') : '';
42
+ return 'From ' + (words.length === 1 ? words[0] : words.slice(0, -1).join(', ') + ' and ' + words[words.length - 1]);
43
+ }
44
+
45
+ /** The small line over a Raise now prompt: "Check · from the screen", "Follow-up · from Oct 19", "No owner yet". */
46
+ export function raiseLabel(r) {
47
+ const head = RAISE_LABEL[r && r.kind] || 'Raise';
48
+ return r && r.from && r.kind !== 'no-owner' ? head + ' · from ' + String(r.from).replace(/^from\s+/i, '') : head;
49
+ }
50
+
51
+ /** What the Now panel shows. F = GET /api/meeting-focus's answer; one = GET /api/notes/one's answer. Nothing is invented. */
52
+ export function nowModel(F, one, { now = Date.now() } = {}) {
53
+ const f = F && F.ok ? F : {};
54
+ const n = one && one.ok && one.note ? one.note : null;
55
+ const nowMs = Number.isFinite(f.now_ms) ? f.now_ms : now;
56
+ const ev = f.event || {};
57
+ const startMs = Date.parse(ev.at);
58
+ const endMs = Date.parse(ev.end);
59
+ const nowMin = Number.isFinite(startMs) ? (nowMs - startMs) / 60000 : null;
60
+ const runs = Array.isArray(f.runs) ? f.runs : [];
61
+ const spentMs = (id) => runs.filter((r) => r.topic === id).reduce((s, r) => s + ((r.to_min == null ? (nowMin == null ? r.from_min : nowMin) : r.to_min) - r.from_min) * 60000, 0);
62
+ const topics = (Array.isArray(f.topics) ? f.topics : []).filter((t) => t && t.state !== 'parked').map((t) => ({
63
+ id: t.id, text: t.text, state: t.state === 'now' ? 'now' : t.state === 'discussed' ? 'done' : 'open', spent: Math.max(0, spentMs(t.id)),
64
+ }));
65
+ const current = topics.find((t) => t.state === 'now') || null;
66
+ const left = Number.isFinite(endMs) && endMs > nowMs ? Math.ceil((endMs - nowMs) / 60000) : null;
67
+ const cap = f.captured || {};
68
+ const counts = { decisions: (cap.decisions || []).length, steps: (cap.actions || []).length, highlights: n && !n.private && Array.isArray(n.highlights) ? n.highlights.length : 0 };
69
+ const parts = [];
70
+ if (counts.decisions) parts.push(plural(counts.decisions, 'decision', 'decisions'));
71
+ if (counts.steps) parts.push(plural(counts.steps, 'next step', 'next steps'));
72
+ if (counts.highlights) parts.push(plural(counts.highlights, 'highlight', 'highlights'));
73
+ const raise = (Array.isArray(f.raise) ? f.raise : []).slice(0, 2).map((r) => ({ id: r.id, kind: r.kind, text: r.text, label: raiseLabel(r) }));
74
+ // the last question asked in this meeting and its answer (or that Claude is on it, or why it failed)
75
+ const asks = Array.isArray(f.asks) ? f.asks : [];
76
+ const lastAsk = asks.length ? asks[asks.length - 1] : null;
77
+ let answer = null;
78
+ if (lastAsk) {
79
+ const a = (Array.isArray(f.notes) ? f.notes : []).filter((x) => x.ask === lastAsk.id).pop() || null;
80
+ answer = { id: lastAsk.id, question: lastAsk.question, state: a ? 'answered' : lastAsk.state === 'failed' ? 'failed' : 'working',
81
+ body: a ? a.body : lastAsk.state === 'failed' ? (lastAsk.error || 'Claude could not answer. Ask again.') : '', from: a ? fromLine(a) : '' };
82
+ }
83
+ return {
84
+ noteId: n ? n.id : (f.note && f.note.id) || '',
85
+ topics, current, next: topics.find((t) => t.state === 'open') || null,
86
+ onIt: current ? Math.max(0, Math.round(current.spent / 60000)) : null,
87
+ left, raise, counts: parts.join(' · '), answer,
88
+ };
89
+ }
90
+
91
+ const mark = (state) => (state === 'done' ? svg(P.check, 16) : state === 'now' ? '<i></i>' : '<b></b>');
92
+
93
+ /** The panel's body (not the note box, which the page keeps so a half-typed line survives a redraw). */
94
+ export function nowHtml(m, { room = false } = {}) {
95
+ let h = '';
96
+ if (room) {
97
+ if (m.current) {
98
+ const sub = [m.onIt != null ? m.onIt + ' min on it' : '', m.left != null ? m.left + ' min left' : ''].filter(Boolean).join(' · ');
99
+ h += `<div class="rn-now"><small>Now</small><h1>${esc(m.current.text)}</h1>${sub ? `<p>${esc(sub)}</p>` : ''}</div>`;
100
+ }
101
+ const chips = m.topics.filter((t) => t.state === 'done').map((t) => `<span class="dn" role="listitem">${svg(P.check, 15)}${esc(t.text)}</span>`);
102
+ if (m.next) chips.push(`<span role="listitem"><b></b>Next: ${esc(m.next.text)}</span>`);
103
+ if (!m.current && !chips.length && m.topics.length) m.topics.forEach((t) => chips.push(`<span role="listitem"><b></b>${esc(t.text)}</span>`));
104
+ if (chips.length) h += `<div class="rn-stp" role="list" aria-label="To cover">${chips.join('')}</div>`;
105
+ } else if (m.topics.length) {
106
+ h += `<section class="rn-sec" aria-label="To cover"><h5>To cover${m.left != null ? `<span class="r">${m.left} min left</span>` : ''}</h5><div class="rn-ag">`
107
+ + m.topics.map((t) => `<div class="rn-ai ${t.state === 'done' ? 'dn' : t.state === 'now' ? 'now' : ''}"${t.state === 'now' ? ' aria-current="true"' : ''}><span class="m" aria-hidden="true">${mark(t.state)}</span><span class="tx">${esc(t.text)}</span>${t.state === 'done' && t.spent >= 30000 ? `<span class="t4">${mmss(t.spent)}</span>` : ''}</div>`).join('')
108
+ + '</div></section>';
109
+ }
110
+ if (m.raise.length) {
111
+ h += `<section class="rn-sec" aria-label="Raise now">${room ? '' : '<h5>Raise now</h5>'}<div class="rn-rz">`
112
+ + m.raise.map((r) => `<div class="rn-rq" data-raise="${esc(r.id)}"><span class="w"><small>${esc(r.label)}</small>${esc(r.text)}</span>`
113
+ + `<button type="button" class="rn-ib" data-rn="raised" aria-label="Raised" title="Raised">${svg(P.check)}</button>`
114
+ + `<button type="button" class="rn-ib" data-rn="skip" aria-label="Not now" title="Not now">${svg(P.x)}</button></div>`).join('')
115
+ + '</div></section>';
116
+ }
117
+ if (m.counts) h += `<div class="rn-cgl" aria-label="Caught so far"><span class="dm2" aria-hidden="true"></span>${esc(m.counts)}</div>`;
118
+ if (m.answer) {
119
+ const a = m.answer;
120
+ h += `<div class="rn-chx" aria-live="polite"><div class="q">${esc(a.question)}</div>`
121
+ + `<div class="ca${a.state === 'failed' ? ' bad' : ''}" data-answer="${esc(a.id)}"><span class="sp" aria-hidden="true">${svg(P.spark, 14, 2)}</span>`
122
+ + (a.state === 'working' ? '<span class="w"><span class="rn-dots" role="status" aria-label="Claude is answering"><i></i><i></i><i></i></span></span>'
123
+ : `<span class="w">${esc(a.body)}${a.from ? `<span class="src">${esc(a.from)}</span>` : ''}</span>`)
124
+ + (a.state === 'answered' ? `<button type="button" class="rn-ib" data-rn="keep" aria-label="Keep as a note" title="Keep as a note">${svg(P.plus)}</button>` : '')
125
+ + '</div></div>';
126
+ }
127
+ return h;
128
+ }
129
+
130
+ /** The live transcript, oldest first: { t, who, text, hl, dec, now }. A highlight marks the line said at or just before it; a decision line carries ◆. */
131
+ export function transcriptModel(one, { max = 80 } = {}) {
132
+ const n = one && one.ok && one.note ? one.note : null;
133
+ if (!n || n.private) return [];
134
+ const names = n.speakers || {};
135
+ const who = (src) => names[src] || { mic: 'You', meeting: 'Meeting', speech: 'You', typed: 'You (typed)' }[src] || 'You';
136
+ const tr = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && typeof x.text === 'string' && x.text.trim());
137
+ const rows = tr.slice(-max).map((x) => ({ t: Number.isFinite(x.t) ? x.t : null, who: who(x.source), text: x.text.trim(), hl: false, dec: x.cat === 'decision', now: false }));
138
+ for (const h of Array.isArray(n.highlights) ? n.highlights : []) {
139
+ const ht = Number(h && (h.t != null ? h.t : h.from));
140
+ if (!Number.isFinite(ht)) continue;
141
+ let hit = null; for (const r of rows) if (r.t != null && r.t <= ht + 1000) hit = r;
142
+ if (hit) hit.hl = true;
143
+ }
144
+ if (rows.length) rows[rows.length - 1].now = true;
145
+ return rows;
146
+ }
147
+
148
+ export function transcriptHtml(lines) {
149
+ if (!lines.length) return '';
150
+ return lines.map((l) => `<div class="l${l.now ? ' now' : ''}"><span class="t">${l.t != null ? mmss(l.t) : ''}</span><b>${esc(l.who)}</b><span>${esc(l.text)}`
151
+ + (l.hl ? `<span class="mk hl" role="img" aria-label="Your highlight">${svg(P.star, 12, 1.8, true)}</span>` : '')
152
+ + (l.dec ? '<span class="mk" role="img" aria-label="Decision"><i class="dm"></i></span>' : '') + '</span></div>').join('');
153
+ }
154
+
155
+ /* ── the page part ─────────────────────────────────────────────────────────────────────────────────────────────── */
156
+
157
+ const ASK_POLL_MS = 3000; // while Claude answers, the panel reads the meeting itself instead of waiting for the tab's 15 s read
158
+
159
+ /**
160
+ * Mount the Now panel into the recording tab (pm/cozy-rec-tab.js calls it). slots = { stage, side, bar }; ctx = { ws, note(), mode(), on(evt, fn),
161
+ * focus(), event }. With a screen the panel fills `side` (unhidden here); in the room (microphone only) it fills the light `stage`. The bar's
162
+ * [data-slot="now"] takes the side-panel toggle (only with a screen) and the transcript icon. → { stop, refresh, toggleTranscript }
163
+ */
164
+ export function mountNow(slots, ctx) {
165
+ const noop = { stop() {}, refresh() {}, toggleTranscript() {} };
166
+ if (!slots || !ctx || (!slots.side && !slots.stage)) return noop;
167
+ const q = (o) => new URLSearchParams(Object.fromEntries(Object.entries(o).filter(([, v]) => v != null && v !== ''))).toString();
168
+ const oneNow = () => { try { return typeof ctx.note === 'function' ? ctx.note() : null; } catch { return null; } };
169
+ const noteId = () => { const o = oneNow(); return o && o.note ? o.note.id : ''; };
170
+ const modeNow = () => { try { return typeof ctx.mode === 'function' ? ctx.mode() : 'screen'; } catch { return 'screen'; } };
171
+
172
+ if (!document.querySelector('link[data-rn-css]')) {
173
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-rec-now.css', import.meta.url).href; l.setAttribute('data-rn-css', '');
174
+ document.head.appendChild(l);
175
+ }
176
+ const wrap = document.createElement('div');
177
+ wrap.className = 'rn';
178
+ wrap.innerHTML = `<div class="rn-nw" data-rn-body></div><p class="rn-err" role="alert" hidden></p>`
179
+ + `<form class="rn-mine" data-rn-box><textarea rows="1" aria-label="${BOX_HINT}" placeholder="${BOX_HINT}"></textarea>`
180
+ + `<button type="submit" class="rn-send" aria-label="Keep the note" title="Keep the note">${svg(P.up, 16)}</button></form>`;
181
+ const body = wrap.querySelector('[data-rn-body]');
182
+ const err = wrap.querySelector('.rn-err');
183
+ const box = wrap.querySelector('[data-rn-box]');
184
+ const ta = box.querySelector('textarea');
185
+ const send = box.querySelector('.rn-send');
186
+
187
+ // the bar's icons: the side panel (with a screen only) and the transcript
188
+ const slot = slots.bar ? slots.bar.querySelector('[data-slot="now"]') || slots.bar : null;
189
+ const iconBtn = (label, d) => { const b = document.createElement('button'); b.type = 'button'; b.className = 'rt-b'; b.setAttribute('aria-label', label); b.title = label; b.innerHTML = svg(d); return b; };
190
+ const sideBtn = slot ? iconBtn('Hide the side panel', 'M3.5 7.5a3 3 0 013-3h11a3 3 0 013 3v9a3 3 0 01-3 3h-11a3 3 0 01-3-3zM14 4.5v15') : null;
191
+ const tBtn = slot ? iconBtn('Live transcript', P.lines) : null;
192
+ if (sideBtn) { sideBtn.classList.add('rn-sbtn'); sideBtn.setAttribute('aria-pressed', 'true'); slot.appendChild(sideBtn); }
193
+ if (tBtn) { tBtn.classList.add('rn-tbtn'); tBtn.setAttribute('aria-pressed', 'false'); slot.appendChild(tBtn); }
194
+
195
+ // the transcript: a 420px card beside the panel, closed by default
196
+ const card = document.createElement('aside');
197
+ card.className = 'rn-trp'; card.hidden = true; card.setAttribute('aria-label', 'Live transcript');
198
+ card.innerHTML = `<div class="th2"><span>Live transcript</span><button type="button" class="rn-ib" data-rn="tclose" aria-label="Close" title="Close">${svg(P.x)}</button></div><div class="tfeed" aria-live="polite"></div>`;
199
+ const feed = card.querySelector('.tfeed');
200
+
201
+ let room = null, sideOpen = true, open = false, last = '', lastT = '', own = null, askTimer = null, stopped = false;
202
+ /** Where the panel lives: the light page in the room, the side card with a screen. Paused or idle keeps the last place. */
203
+ const place = () => {
204
+ const md = modeNow();
205
+ // nothing to follow before the meeting records or after it stopped; paused keeps the last place (the light page at first)
206
+ wrap.hidden = !['room', 'screen', 'paused'].includes(md);
207
+ const want = md === 'room' ? true : md === 'screen' ? false : room == null ? true : room;
208
+ if (want !== room || !wrap.parentElement) {
209
+ room = want || !slots.side;
210
+ const host = room ? slots.stage : slots.side;
211
+ if (!host) return;
212
+ wrap.classList.toggle('rn-room', room); wrap.classList.toggle('rn-side', !room);
213
+ host.appendChild(wrap);
214
+ (slots.side || host).after(card); // the card sits after the side card in both modes: its own rounded card beside everything
215
+ last = '';
216
+ }
217
+ if (slots.side) slots.side.hidden = room || !sideOpen || wrap.hidden;
218
+ if (sideBtn) sideBtn.hidden = room || wrap.hidden;
219
+ if (tBtn) tBtn.hidden = wrap.hidden;
220
+ if (wrap.hidden && open) setOpen(false);
221
+ };
222
+ const focusNow = () => {
223
+ let f = null; try { f = typeof ctx.focus === 'function' ? ctx.focus() : null; } catch { f = null; }
224
+ // the panel's own read (after a press, or while Claude answers) wins until the tab's read is newer
225
+ if (own && (!f || !f.ok || !(f.now_ms > own.now_ms))) return own;
226
+ own = null; return f;
227
+ };
228
+ const say = (msg) => { err.textContent = msg || ''; err.hidden = !msg; };
229
+ const draw = () => {
230
+ if (stopped) return;
231
+ place();
232
+ const one = oneNow();
233
+ const h = nowHtml(nowModel(focusNow(), one), { room });
234
+ if (h !== last) { body.innerHTML = h; last = h; }
235
+ if (open) {
236
+ const t = transcriptHtml(transcriptModel(one));
237
+ if (t !== lastT) {
238
+ const atEnd = feed.scrollHeight - feed.scrollTop - feed.clientHeight < 40;
239
+ feed.innerHTML = t; lastT = t;
240
+ if (atEnd) feed.scrollTop = feed.scrollHeight;
241
+ }
242
+ }
243
+ };
244
+ /** Read the meeting now (after a press; while a question is answered). */
245
+ const read = async () => {
246
+ const id = noteId(); if (!id || stopped) return;
247
+ const f = await pmGet('/api/meeting-focus?' + q({ note: id, ws: ctx.ws }));
248
+ if (stopped || !f || !f.ok) return;
249
+ own = f; draw();
250
+ const working = (f.asks || []).some((a) => a.state === 'working');
251
+ clearTimeout(askTimer); askTimer = working ? setTimeout(read, ASK_POLL_MS) : null;
252
+ };
253
+
254
+ const setOpen = (v) => {
255
+ open = !!v; card.hidden = !open;
256
+ if (tBtn) { tBtn.setAttribute('aria-pressed', String(open)); tBtn.classList.toggle('on', open); }
257
+ if (open) { lastT = ''; draw(); feed.scrollTop = feed.scrollHeight; }
258
+ };
259
+ if (tBtn) tBtn.addEventListener('click', () => setOpen(!open));
260
+ if (sideBtn) sideBtn.addEventListener('click', () => {
261
+ sideOpen = !sideOpen; if (slots.side && !room) slots.side.hidden = !sideOpen;
262
+ const label = sideOpen ? 'Hide the side panel' : 'Show the side panel';
263
+ sideBtn.setAttribute('aria-label', label); sideBtn.title = label; sideBtn.setAttribute('aria-pressed', String(sideOpen));
264
+ });
265
+
266
+ /** Add a line to the note's own notes (the same body the Viewer's Your notes edits). */
267
+ const keep = async (line) => {
268
+ const n = (oneNow() || {}).note;
269
+ if (!n) { say('The note was not found, so nothing was kept.'); return false; }
270
+ const before = String(n.body || '').replace(/\s+$/, '');
271
+ const next = before + (before ? '\n' : '') + line;
272
+ const r = await pmPost('/api/notes/save', { id: n.id, body: next });
273
+ if (!r || !r.ok) { say('Not kept: ' + ((r && r.error) || 'no answer')); return false; }
274
+ n.body = next; say(''); return true;
275
+ };
276
+
277
+ ta.addEventListener('input', () => {
278
+ const ask = kindOf(ta.value) === 'ask';
279
+ send.setAttribute('aria-label', ask ? 'Ask Claude' : 'Keep the note'); send.title = ask ? 'Ask Claude' : 'Keep the note';
280
+ ta.style.height = ''; if (ta.value) ta.style.height = Math.min(ta.scrollHeight, 120) + 'px';
281
+ });
282
+ ta.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.shiftKey && !e.isComposing) { e.preventDefault(); box.requestSubmit(); } });
283
+ box.addEventListener('submit', async (e) => {
284
+ e.preventDefault();
285
+ const text = ta.value.trim(); if (!text) return;
286
+ send.disabled = true;
287
+ try {
288
+ if (kindOf(text) === 'ask') {
289
+ const r = await pmPost('/api/meeting-focus/ask', { note: noteId(), question: text, ws: ctx.ws });
290
+ if (!r || !r.ok) { say('Claude could not take the question: ' + ((r && r.error) || 'no answer')); return; }
291
+ // the question shows at once; the answer arrives on a later read
292
+ const f = focusNow() || { ok: true };
293
+ own = { ...f, now_ms: Number(f.now_ms) || 0, asks: [...(f.asks || []), { id: r.id, question: text, state: 'working' }] };
294
+ draw(); clearTimeout(askTimer); askTimer = setTimeout(read, ASK_POLL_MS);
295
+ } else if (!(await keep(text))) return;
296
+ ta.value = ''; ta.dispatchEvent(new Event('input')); say('');
297
+ } finally { send.disabled = false; }
298
+ });
299
+
300
+ body.addEventListener('click', async (e) => {
301
+ const b = e.target.closest('[data-rn]'); if (!b) return;
302
+ const act = b.getAttribute('data-rn');
303
+ if (act === 'raised' || act === 'skip') {
304
+ const row = b.closest('[data-raise]'); const id = row && row.getAttribute('data-raise'); if (!id) return;
305
+ b.disabled = true;
306
+ const r = await pmPost('/api/meeting-focus/raise', { note: noteId(), id, action: act, ws: ctx.ws });
307
+ if (!r || !r.ok) { b.disabled = false; say('Not saved: ' + ((r && r.error) || 'no answer')); return; }
308
+ const f = focusNow();
309
+ if (f) own = { ...f, now_ms: Number(f.now_ms) || 0, raise: (f.raise || []).filter((x) => x.id !== id) };
310
+ say(''); draw(); read();
311
+ } else if (act === 'keep') {
312
+ const m = nowModel(focusNow(), oneNow());
313
+ if (!m.answer || !m.answer.body) return;
314
+ b.disabled = true;
315
+ if (await keep(m.answer.body)) { b.innerHTML = svg(P.check); b.setAttribute('aria-label', 'Kept as a note'); b.title = 'Kept as a note'; }
316
+ else b.disabled = false;
317
+ }
318
+ });
319
+ card.addEventListener('click', (e) => { if (e.target.closest('[data-rn="tclose"]')) { setOpen(false); if (tBtn) tBtn.focus(); } });
320
+
321
+ const offs = [];
322
+ if (typeof ctx.on === 'function') for (const evt of ['note', 'mode', 'tick']) { const off = ctx.on(evt, draw); if (typeof off === 'function') offs.push(off); }
323
+ draw();
324
+ if (!focusNow()) read();
325
+ return {
326
+ stop() { stopped = true; clearTimeout(askTimer); offs.forEach((f) => f()); wrap.remove(); card.remove(); if (sideBtn) sideBtn.remove(); if (tBtn) tBtn.remove(); },
327
+ refresh: read,
328
+ toggleTranscript: (v) => setOpen(v === undefined ? !open : v),
329
+ };
330
+ }
@@ -0,0 +1,69 @@
1
+ /* pm/cozy-rec-present.css — Present in the recording tab (batch 12 item 1, S3: XrtA8Pick, XrtA9Present, XrtA9Window). Added by
2
+ * cozy-rec-present.js. The presenter view sits on the recording tab's dark stage; the picker is a light card above the Present button.
3
+ * Colours are the cozy tokens of pm/cozy.css only. */
4
+
5
+ /* ── the Present button in the bottom bar: a round icon, white while presenting ── */
6
+ .rxp-pb { width: 52px; height: 52px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 0; padding: 0; cursor: pointer;
7
+ background: var(--cz-c-33363c); color: var(--cz-c-ffffff); }
8
+ .rxp-pb svg, .rxp svg, .rxp-pop svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
9
+ .rxp-pb.on { background: var(--cz-c-ffffff); color: var(--cz-c-2a2e35); }
10
+ .rxp-pb:focus-visible, .rxp button:focus-visible, .rxp-pop button:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
11
+ @media (hover: hover) { .rxp-pb:not(.on):hover { background: var(--cz-c-3a3d44); } }
12
+
13
+ /* ── the picker: From the prep, Find in PMOS, File or link, a tab, a window or the screen ── */
14
+ .rxp-pop { position: fixed; z-index: 1100; left: var(--rxp-x, 16px); bottom: var(--rxp-b, 96px); width: min(360px, calc(100vw - 32px)); max-height: calc(100vh - 140px); overflow: auto;
15
+ padding: 8px; border-radius: 18px; background: var(--cz-card); color: var(--cz-ink); box-shadow: var(--cz-lift); font-family: var(--cz-sans); }
16
+ .rxp-pick { display: flex; flex-direction: column; }
17
+ .rxp-ph { margin: 6px 10px 4px; font-size: 13px; font-weight: 700; color: var(--cz-ink2); }
18
+ .rxp-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
19
+ .rxp-row:focus-visible { background: var(--cz-well); }
20
+ @media (hover: hover) { .rxp-row:hover { background: var(--cz-well); } }
21
+ .rxp-fi { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--cz-well); color: var(--cz-ink2); flex: none; }
22
+ .rxp-w { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; font-weight: 700; }
23
+ .rxp-w span { font-size: 12px; font-weight: 500; color: var(--cz-ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
24
+ .rxp-pick hr { border: 0; border-top: 1px solid var(--cz-hair); margin: 6px 10px; }
25
+ .rxp-in { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; }
26
+ .rxp-in input { flex: 1; min-width: 0; min-height: 32px; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--cz-ink); outline: none; }
27
+ .rxp-in input::placeholder { color: var(--cz-ink3); }
28
+ .rxp-none, .rxp-err { margin: 2px 10px 6px 54px; font-size: 12.5px; color: var(--cz-ink3); }
29
+ .rxp-err { color: var(--cz-red); }
30
+ .rxp-pop .rxp-ib { color: var(--cz-ink2); background: var(--cz-well); }
31
+
32
+ /* ── the presenter view on the dark stage, in place of what the stage showed ── */
33
+ .rxp-away { display: none !important; }
34
+ .rxp-host { flex: 1; min-height: 0; display: flex; width: 100%; height: 100%; }
35
+ .rxp { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; color: var(--cz-c-ffffff); font-family: var(--cz-sans); }
36
+ .rxp p { margin: 0; }
37
+ .rxp-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
38
+ .rxp-main.rxp-one { grid-template-columns: minmax(0, 1fr); }
39
+ .rxp-they { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 56px 24px 24px; border-radius: 16px; background: var(--cz-c-17191c); overflow: hidden; }
40
+ .rxp-pill { position: absolute; left: 12px; top: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px;
41
+ background: var(--cz-c-2546b8); color: var(--cz-c-ffffff); font-size: 12.5px; font-weight: 800; }
42
+ .rxp-audb { position: absolute; right: 12px; top: 10px; z-index: 1; }
43
+ .rxp-ib { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 0; padding: 0; cursor: pointer; background: var(--cz-c-2a2d33); color: var(--cz-c-ffffff); }
44
+ .rxp-ib:disabled { opacity: .35; cursor: default; }
45
+ .rxp-slot { width: 100%; height: 100%; display: grid; place-items: center; }
46
+ .rxp-slot .vzx-box, .rxp-nx .vzx-box { cursor: default; border-radius: 6px; }
47
+ .rxp-doc { width: 100%; height: 100%; overflow: auto; padding: 28px 32px; border-radius: 10px; background: var(--cz-c-ffffff); color: var(--cz-c-2a2e35); }
48
+ .rxp-doc .vzx-page { font-size: 16px; }
49
+ .rxp-img { max-width: 100%; max-height: 100%; display: block; }
50
+ .rxp-pdf { width: 100%; height: 100%; border: 0; border-radius: 6px; background: var(--cz-c-ffffff); pointer-events: none; }
51
+ .rxp-video { width: 100%; height: 100%; object-fit: contain; display: block; }
52
+ .rxp-msg { max-width: 520px; display: flex; align-items: center; gap: 14px; font-size: 15px; line-height: 1.5; color: var(--cz-c-d9dce1); }
53
+ .rxp-col { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
54
+ .rxp-card { padding: 14px 14px 16px; border-radius: 14px; background: var(--cz-c-2a2d33); font-size: 14.5px; line-height: 1.5; }
55
+ .rxp-card h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--cz-c-9aa1ab); }
56
+ .rxp-card ul { margin: 0; padding-left: 18px; }
57
+ .rxp-card li + li { margin-top: 8px; }
58
+ .rxp-nx { height: 160px; display: grid; place-items: center; border-radius: 10px; overflow: hidden; }
59
+ .rxp-nav { display: flex; align-items: center; gap: 10px; min-height: 44px; }
60
+ .rxp-count { min-width: 56px; text-align: center; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
61
+ .rxp-sp { flex: 1; }
62
+ .rxp-on { font-size: 13px; font-weight: 700; color: var(--cz-c-9aa1ab); font-variant-numeric: tabular-nums; }
63
+ .rxp-shots { display: flex; gap: 8px; }
64
+ .rxp-shots img { width: 56px; height: 32px; object-fit: cover; border-radius: 6px; background: var(--cz-c-33363c); }
65
+
66
+ @media (max-width: 900px) {
67
+ .rxp-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 1fr) auto; }
68
+ .rxp-nx { height: 120px; }
69
+ }