create-pmos 0.616.0 → 0.617.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.
@@ -0,0 +1,115 @@
1
+ /* pm/cozy-buddy.js — the meeting buddy page, /premium-buddy.html (initiative meeting-buddy; Exploring 2, "Meeting buddy and one-press start").
2
+ *
3
+ * The PMOS extension frames this page over a Google Meet call (extension/panel.js): ?meet=<abc-defg-hij>&mtitle=<tab title>. The page finds
4
+ * the meeting on the calendar (GET /api/meeting-focus/now), then reads it every 10 s (GET /api/meeting-focus), which also lets the read-only
5
+ * companion run while the meeting records. With no meeting that fits, it lists today's meetings to pick from.
6
+ *
7
+ * Drawn (pm/buddy-core.js): the header (Listening · Topic n of N, Paused, Not listening), the topic and its minutes, Now, the time nudge,
8
+ * the consent line, Filed rows with Undo, Context, drafts for the call chat, the last answer, and a line to ask PMOS quietly.
9
+ * Not listening: one play icon that starts listening to this meeting in the PMOS recording tab (Chrome then asks which tab to share).
10
+ *
11
+ * Writes, each on a press: POST /api/notes/bullet (Undo: drop the filed bullet; Undo again: take it back), POST /api/meeting-focus/raise
12
+ * (a chat draft copied or put away), POST /api/meeting-focus/ask (a question). Copy puts a line on the clipboard; nothing here posts to the
13
+ * call or its chat. The consent line's copy and the nudge's dismiss are kept in this browser only (buddy-core.js marksOf, per meeting).
14
+ * Fold sends { pmosFocus: 'fold' | 'open' } to the panel, which shrinks to a pill. */
15
+ import { pmGet, pmPost } from './http.js';
16
+ import { buddyModel, buddyHtml, headOf, marksOf } from './buddy-core.js';
17
+ import { press, newMem, mergeMarks } from './buddy-press.js';
18
+ import { recCore } from './premium-meeting.js';
19
+
20
+ const q = new URLSearchParams(location.search);
21
+ const $ = (id) => document.getElementById(id);
22
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
+ const READ_MS = 10000, ASK_MS = 3000;
24
+ const S = { ev: null, date: '', F: null, html: '', folded: false, timer: null, busy: false };
25
+
26
+ const ls = () => { try { return window.localStorage; } catch { return null; } };
27
+ const MEM = newMem(); // the PM's marks when the store is blocked: this view only
28
+ const local = () => mergeMarks(marksOf(ls(), S.F), MEM);
29
+
30
+ function say(text) { const m = $('mbMsg'); m.textContent = text || ''; m.hidden = !text; }
31
+ function draw() {
32
+ const L = local();
33
+ const m = buddyModel(S.F, L);
34
+ const h = headOf(m);
35
+ $('mbDot').className = 'mb-dot ' + h.tone;
36
+ $('mbHead').textContent = (S.ev ? h.text : 'Looking for the meeting');
37
+ let body = buddyHtml(m);
38
+ if (!m.listening && !m.paused && S.ev) {
39
+ body = `<div class="mb-r mb-start"><span class="t"><small>${esc(m.title)}</small>PMOS is not listening to this meeting.</span>`
40
+ + `<button type="button" class="mb-ib go" data-mb="listen" aria-label="Start listening in PMOS" title="Start listening in PMOS"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></button></div>` + body;
41
+ }
42
+ if (body !== S.html) { S.html = body; $('mbBody').innerHTML = body; }
43
+ $('mbAsk').hidden = !S.ev || S.folded;
44
+ const working = m.answer && m.answer.state === 'working';
45
+ clearTimeout(S.timer); S.timer = setTimeout(read, working ? ASK_MS : READ_MS);
46
+ }
47
+
48
+ async function read() {
49
+ if (!S.ev) return;
50
+ const F = await pmGet('/api/meeting-focus?event=' + encodeURIComponent(S.ev.id) + '&date=' + encodeURIComponent(S.date));
51
+ if (F && F.ok) { S.F = F; say(''); } else if (!S.F) say((F && F.error) || 'PMOS did not answer.');
52
+ draw();
53
+ }
54
+
55
+ /** Which meeting this call is. With none that fits, today's meetings to pick from. */
56
+ async function find() {
57
+ if (q.get('event')) { S.ev = { id: q.get('event') }; S.date = q.get('date') || ''; return read(); }
58
+ const r = await pmGet('/api/meeting-focus/now?meet=' + encodeURIComponent(q.get('meet') || '') + '&title=' + encodeURIComponent(q.get('mtitle') || ''));
59
+ if (r && r.ok) { S.ev = r.event; S.date = r.date; return read(); }
60
+ const ch = (r && r.choices) || [];
61
+ $('mbHead').textContent = 'Which meeting is this?';
62
+ $('mbBody').innerHTML = ch.length
63
+ ? ch.map((c, i) => `<button type="button" class="mb-pick" data-mb="pick" data-i="${i}"><b>${esc(c.title || 'Meeting')}</b><span class="mb-sm">${esc(String(c.at || '').slice(11, 16))}</span></button>`).join('')
64
+ : '<p class="mb-sm mb-none">No meeting on your PMOS calendar today.</p>';
65
+ S.choices = ch;
66
+ setTimeout(find, 30000); // a meeting added to the calendar later is found
67
+ }
68
+
69
+ /** Start listening: the PMOS recording tab opens on this meeting's note and asks where the meeting is (Google Meet in Chrome). */
70
+ async function listen() {
71
+ const C = recCore({ pmGet, pmPost, ws: () => null });
72
+ const ev = (S.F && S.F.event) || S.ev;
73
+ const call = ev.call || null;
74
+ const res = await C.record({ id: ev.id, at: ev.at, end: ev.end, title: ev.title, app: call ? (call.app === 'teams' ? 'other' : call.app) : 'meet' });
75
+ say(res && res.ok ? 'The PMOS recording tab opened. Pick this call in Chrome\'s window and tick tab sound.' : (res && res.error) || 'Listening did not start.');
76
+ read();
77
+ }
78
+
79
+ document.addEventListener('click', async (e) => {
80
+ const b = e.target.closest('[data-mb]'); if (!b || b.disabled) return;
81
+ const act = b.dataset.mb;
82
+ if (act === 'pick') { const c = S.choices[+b.dataset.i]; if (c) { S.ev = c; S.date = String(c.at || '').slice(0, 10); read(); } return; }
83
+ if (act === 'listen') { b.disabled = true; try { await listen(); } finally { b.disabled = false; } return; }
84
+ b.disabled = true;
85
+ let r = null;
86
+ try { r = await press(b, S.F, { pmPost, storage: ls(), mem: MEM }); } finally { b.disabled = false; }
87
+ if (!r) return;
88
+ if (r.undo) { const m2 = $('mbMsg'); m2.hidden = false; m2.innerHTML = esc(r.msg) + ' <button type="button" class="mb-undo" data-mb="redo" data-bid="' + esc(r.undo) + '">Undo</button>'; }
89
+ else say(r.msg);
90
+ if (r.read) read(); else draw();
91
+ });
92
+
93
+ $('mbAsk').addEventListener('submit', async (e) => {
94
+ e.preventDefault();
95
+ const i = $('mbQ'), text = i.value.trim(); if (!text || !S.ev) return;
96
+ i.disabled = true;
97
+ const m = S.F || {};
98
+ const r = await pmPost('/api/meeting-focus/ask', { ...(m.note ? { note: m.note.id } : {}), event: S.ev.id, date: S.date, question: text });
99
+ i.disabled = false;
100
+ if (!r || !r.ok) { say('PMOS could not take the question: ' + ((r && r.error) || 'no answer')); return; }
101
+ i.value = ''; say(r.state === 'offered' ? 'PMOS offers to show it in the recording tab.' : '');
102
+ read();
103
+ });
104
+
105
+ $('mbFold').addEventListener('click', () => {
106
+ S.folded = !S.folded;
107
+ document.body.classList.toggle('folded', S.folded);
108
+ const b = $('mbFold'); b.setAttribute('aria-expanded', String(!S.folded));
109
+ b.setAttribute('aria-label', S.folded ? 'Open PMOS' : 'Fold PMOS'); b.title = b.getAttribute('aria-label');
110
+ // the panel (extension/panel.js) passes this on to the Meet page, which shrinks the frame to a pill. It carries no data.
111
+ if (window.parent !== window) window.parent.postMessage({ pmosFocus: S.folded ? 'fold' : 'open' }, '*');
112
+ draw();
113
+ });
114
+
115
+ find();
@@ -15,9 +15,13 @@
15
15
  * The panel has no tabs and no header. Every part is silent at zero: no topics, no prompts, no counts, no answer → no line.
16
16
  * 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),
17
17
  * 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, Undo; ✓ on a ✦ Show it? offer starts a live round), POST /api/notes/save
18
- * (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read). */
18
+ * (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read).
19
+ * The meeting buddy's card (meeting-buddy, pm/buddy-core.js heardHtml) sits under Raise now: the consent line, the time nudge, Filed with
20
+ * Undo and the drafts for the call chat; its presses go through pm/buddy-press.js. A chat draft is never a Raise now prompt. */
19
21
  import { pmGet, pmPost } from './http.js';
20
22
  import { agendaHtml, ensureCss as agendaCss, press as agendaPress } from './agenda-live.js';
23
+ import { buddyModel, heardHtml, marksOf } from './buddy-core.js';
24
+ import { press as buddyPress, newMem, mergeMarks } from './buddy-press.js';
21
25
 
22
26
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
27
  const P = {
@@ -54,7 +58,7 @@ export function raiseLabel(r) {
54
58
  }
55
59
 
56
60
  /** What the Now panel shows. F = GET /api/meeting-focus's answer; one = GET /api/notes/one's answer. Nothing is invented. */
57
- export function nowModel(F, one, { now = Date.now() } = {}) {
61
+ export function nowModel(F, one, { now = Date.now(), marks = null } = {}) {
58
62
  const f = F && F.ok ? F : {};
59
63
  const n = one && one.ok && one.note ? one.note : null;
60
64
  const nowMs = Number.isFinite(f.now_ms) ? f.now_ms : now;
@@ -75,7 +79,7 @@ export function nowModel(F, one, { now = Date.now() } = {}) {
75
79
  if (counts.decisions) parts.push(plural(counts.decisions, 'decision', 'decisions'));
76
80
  if (counts.steps) parts.push(plural(counts.steps, 'next step', 'next steps'));
77
81
  if (counts.highlights) parts.push(plural(counts.highlights, 'highlight', 'highlights'));
78
- 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) }));
82
+ const raise = (Array.isArray(f.raise) ? f.raise : []).filter((r) => r && r.kind !== 'chat').slice(0, 2).map((r) => ({ id: r.id, kind: r.kind, text: r.text, label: raiseLabel(r) }));
79
83
  // the last question asked in this meeting and its answer (or that Claude is on it, or why it failed)
80
84
  const asks = Array.isArray(f.asks) ? f.asks : [];
81
85
  const lastAsk = asks.length ? asks[asks.length - 1] : null;
@@ -94,6 +98,8 @@ export function nowModel(F, one, { now = Date.now() } = {}) {
94
98
  gist: typeof f.gist === 'string' ? f.gist.trim().slice(0, 400) : '',
95
99
  // the agenda in 3 to 5 topics (lib/agenda-topics.js liveModel), drawn the same as the Viewer's Agenda
96
100
  agenda: f.agenda && Array.isArray(f.agenda.topics) && f.agenda.topics.length ? f.agenda : null,
101
+ // the meeting buddy (meeting-buddy): the consent line, the time nudge, Filed with Undo, the drafts for the call chat
102
+ buddy: buddyModel(F, marks || {}),
97
103
  };
98
104
  }
99
105
 
@@ -144,6 +150,8 @@ export function nowHtml(m, { room = false } = {}) {
144
150
  + `<button type="button" class="rn-ib" data-rn="skip" aria-label="Not now" title="Not now">${svg(P.x)}</button></div>`).join('')
145
151
  + '</div></section>';
146
152
  }
153
+ const heard = m.buddy ? heardHtml(m.buddy) : '';
154
+ if (heard) h += `<section class="rn-sec" aria-label="PMOS heard">${room ? '' : '<h5>PMOS heard</h5>'}${heard}</section>`;
147
155
  h += caughtHtml(m);
148
156
  if (m.answer) {
149
157
  const a = m.answer;
@@ -206,6 +214,13 @@ export function mountNow(slots, ctx) {
206
214
  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', '');
207
215
  document.head.appendChild(l);
208
216
  }
217
+ if (!document.querySelector('link[data-mb-css]')) {
218
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-buddy.css', import.meta.url).href; l.setAttribute('data-mb-css', '');
219
+ document.head.appendChild(l);
220
+ }
221
+ const ls = () => { try { return window.localStorage; } catch { return null; } };
222
+ const mem = newMem(); // the buddy's marks when the store is blocked
223
+ const marksNow = (F) => mergeMarks(marksOf(ls(), F), mem);
209
224
  const wrap = document.createElement('div');
210
225
  wrap.className = 'rn';
211
226
  wrap.innerHTML = `<div class="rn-nw" data-rn-body></div><p class="rn-err" role="alert" hidden></p>`
@@ -274,7 +289,8 @@ export function mountNow(slots, ctx) {
274
289
  if (stopped) return;
275
290
  place();
276
291
  const one = oneNow();
277
- const h = nowHtml(nowModel(focusNow(), one), { room });
292
+ const F = focusNow();
293
+ const h = nowHtml(nowModel(F, one, { marks: marksNow(F) }), { room });
278
294
  if (h !== last) {
279
295
  // a topic the PM unfolded stays unfolded when the minutes change
280
296
  const opened = new Set([...body.querySelectorAll('details.mg-th[open] > summary b')].map((x) => x.textContent));
@@ -348,6 +364,21 @@ export function mountNow(slots, ctx) {
348
364
  });
349
365
 
350
366
  body.addEventListener('click', async (e) => {
367
+ const mb = e.target.closest('[data-mb]');
368
+ if (mb && !mb.disabled) {
369
+ mb.disabled = true;
370
+ let r = null;
371
+ try { r = await buddyPress(mb, focusNow(), { pmPost, storage: ls(), mem }); } finally { mb.disabled = false; }
372
+ if (!r) return;
373
+ if (r.undo) {
374
+ say(r.msg + ' ', true);
375
+ const u = document.createElement('button'); u.type = 'button'; u.className = 'rn-undo'; u.textContent = 'Undo';
376
+ u.addEventListener('click', async () => { u.disabled = true; const x = await pmPost('/api/notes/bullet', { id: noteId(), bullet: r.undo, drop: false }); say(x && x.ok ? 'Back in the notes.' : 'Not undone: ' + ((x && x.error) || 'no answer'), !!(x && x.ok)); read(); });
377
+ err.appendChild(u);
378
+ } else say(r.msg, true);
379
+ last = ''; if (r.read) read(); else draw();
380
+ return;
381
+ }
351
382
  if (e.target.closest('[data-ag]')) {
352
383
  const f = focusNow();
353
384
  const r = await agendaPress(e.target, f && f.agenda, { ws: ctx.ws });
@@ -1,4 +1,4 @@
1
- /* pm/cozy-rec-tab.js — the recording tab, /premium-rec.html?note=<id>&ws=<ws>[&go=1] (batch 12 item 1, slice S1; canvas In development,
1
+ /* pm/cozy-rec-tab.js — the recording tab, /premium-rec.html?note=<id>&ws=<ws>[&go=1][&app=meet|zoom|other] (batch 12 item 1, slice S1; canvas In development,
2
2
  * XrtA1Tab, XrtA7Room, XrtA6States, XrtA5PhoneRec).
3
3
  *
4
4
  * A meeting records in its own tab, named 'pmos-rec' (rec-tab-core.js). The tab holds the recorder (premium-meeting.js recCore) and
@@ -29,6 +29,7 @@ import { pmGet, pmPost } from './http.js';
29
29
  import { recCore, STOP_LINE } from './premium-meeting.js';
30
30
  import { post, listen, tabUrl, clockOf, modeOf, endOf, marksOf } from './rec-tab-core.js';
31
31
  import { adler } from './cozy-adler.js';
32
+ import { recall, remember } from './listen-sources.js';
32
33
 
33
34
  const q = new URLSearchParams(location.search);
34
35
  const ID = q.get('note') || '', WS = q.get('ws') || '';
@@ -237,6 +238,9 @@ else {
237
238
  await readFocus(); mountSlots();
238
239
  // opened by Record on another page: listen now; the Listen sheet's press here gives the share its permission
239
240
  if (q.get('go') === '1') {
241
+ // started from the meeting's play icon or the buddy (meeting-buddy): the Listen sheet opens on the meeting's app
242
+ const app = q.get('app');
243
+ if (app) { try { const s = window.localStorage; remember(s, { ...recall(s), app }); } catch { /* a blocked store: the sheet keeps the last choice */ } }
240
244
  history.replaceState(null, '', tabUrl(ID, { ws: WS }));
241
245
  if (S.row && S.row.state !== 'recording' && S.row.state !== 'ended') act('start');
242
246
  }
@@ -4,7 +4,8 @@
4
4
  * { S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now(), rank() → rankMove's answer, rows() → Home's rows by id (a Map),
5
5
  * titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m), startCalls(ids) → { started, failed },
6
6
  * openCalendar(), openInbox(), openLab(l), reload(), review() → the weekly review's model, meetings() → today's meetings, news() → how
7
- * many are new for you, chatNow() → the chat's target }
7
+ * many are new for you, chatNow() → the chat's target, record(row) → the page recorder's record (premium-meeting.js recCore; the
8
+ * agenda's play icon, meeting-buddy) }
8
9
  * → { on() → Today is drawn, draw(), read() }
9
10
  *
10
11
  * Today draws into #tdPage, the only thing on the white page panel; Home's list and chat column are not drawn (cozy-today-page.css), so the
@@ -322,6 +323,17 @@ export function mountToday(ctx) {
322
323
  return after(false);
323
324
  } finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
324
325
  }
326
+ if (act === 'play') {
327
+ // meeting-buddy: the link opens the call (the browser's own default, not stopped here); right after, the recording starts in the
328
+ // PMOS recording tab with its Listen sheet on the call's app. Chrome then asks which tab to share: the PM picks the call.
329
+ const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x || !x.ref) return;
330
+ const m = x.ref;
331
+ setTimeout(async () => {
332
+ const res = await ctx.record({ id: m.id, at: m.start, end: m.end, title: m.title, app: x.app === 'teams' ? 'other' : x.app });
333
+ ctx.toast(res && res.ok ? 'The call opened. Pick it in Chrome\'s window, with tab sound, so PMOS hears it.' : (res && res.error) || 'The recording did not start. The call opened.');
334
+ }, 0);
335
+ return;
336
+ }
325
337
  if (act === 'ev') {
326
338
  const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x) return;
327
339
  if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
@@ -400,7 +400,10 @@ export function agendaModel(o = {}) {
400
400
  for (const m of o.meetings || []) {
401
401
  if (!m || !m.start || Number.isNaN(Date.parse(m.start)) || dayKey(Date.parse(m.start)) !== today) continue;
402
402
  const s = span(m);
403
- items.push({ key: 'm:' + (m.id || m.start + m.title), kind: 'meeting', title: m.title || 'Meeting', sub: hm(s.a) + ' to ' + hm(s.b), a: s.a, b: s.b, ini: iniOf(m) || null, ref: m });
403
+ // the call's address (meeting-buddy): the play icon opens it and starts the recording; only an https Meet, Zoom or Teams address
404
+ const join = typeof m.join === 'string' && /^https:\/\//i.test(m.join) ? m.join : null;
405
+ items.push({ key: 'm:' + (m.id || m.start + m.title), kind: 'meeting', title: m.title || 'Meeting', sub: hm(s.a) + ' to ' + hm(s.b), a: s.a, b: s.b, ini: iniOf(m) || null, ref: m,
406
+ ...(join ? { join, app: ['meet', 'zoom', 'teams'].includes(m.app) ? m.app : 'other' } : {}) });
404
407
  }
405
408
  for (const e of o.own || []) {
406
409
  if (!e || e.bullet !== 'event' || !e.time || e.day !== today || e.done) continue;
@@ -435,7 +438,7 @@ export function agendaModel(o = {}) {
435
438
  const from = Math.min(8, first), to = Math.max(18, Math.min(24, last));
436
439
  const base = new Date(now); base.setHours(from, 0, 0, 0);
437
440
  const H = 60 * 60000;
438
- for (const x of items) { x.top = (x.a - base.getTime()) / H; x.h = Math.max(0.5, (x.b - x.a) / H); x.past = x.b <= now; x.nowOn = x.a <= now && now < x.b; }
441
+ for (const x of items) { x.top = (x.a - base.getTime()) / H; x.h = Math.max(0.5, (x.b - x.a) / H); x.past = x.b <= now; x.nowOn = x.a <= now && now < x.b; x.play = !!x.join && !x.past; }
439
442
  // side by side, never on top of each other: items whose boxes meet share the width (a box is at least 40 px, about MIN_BOX minutes, tall, so a short
440
443
  // meeting is never cut by the next one); each gets its column and the number of columns of its cluster
441
444
  const MIN_BOX = 40 * 60000, endOf = (x) => Math.max(x.b, x.a + MIN_BOX);
@@ -143,6 +143,12 @@ button.td-ev:focus-visible { outline: 2px solid var(--cz-blue); outline-offset:
143
143
  .td-ev.own { background: none; box-shadow: inset 0 0 0 1.5px var(--cz-hair); }
144
144
  .td-ev.on { box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
145
145
  .td-ev.past b { color: var(--cz-ink3); }
146
+ /* meeting-buddy: the play icon on a meeting with a call (join and record in one press), at the top right of the meeting's own box */
147
+ .td-ev.has-play { padding-right: 40px; }
148
+ .td-play { position: absolute; left: calc(4px + (100% - 4px) * (var(--c, 0) + 1) / var(--n, 1) - 35px); top: calc(var(--t) + 1px); width: 28px; height: 28px; border-radius: 6px;
149
+ display: inline-flex; align-items: center; justify-content: center; background: var(--cz-solid); color: var(--cz-onsolid); text-decoration: none; }
150
+ .td-play:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
151
+ @media (hover: hover) { .td-play:hover { background: var(--cz-blueink); } }
146
152
  .td-now { position: absolute; left: -6px; right: 0; top: var(--t); height: 2px; background: var(--cz-late); }
147
153
  .td-now::before { content: ''; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-late); }
148
154
 
@@ -10,14 +10,15 @@
10
10
  * A row: "!" when the PM marked it first, its bullet (• task, ○ event, – note, × done, ✦ a PMOS suggestion), What, Work, Job, When, and on
11
11
  * hover or focus three plain icons: done, move to tomorrow, set a date. A Lab finding has ✓ (keep: start an initiative) and ✕ (drop).
12
12
  * Waiting too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
13
- * Press a row or an agenda event: the popup on its work (home-app.js).
13
+ * Press a row or an agenda event: the popup on its work (home-app.js). A meeting with a call that is not over has a play icon: one
14
+ * press opens the call and starts the recording (meeting-buddy).
14
15
  * Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
15
16
 
16
17
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
17
18
  const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
18
19
  export const I = {
19
20
  done: 'M5 12.5l4.5 4.5L19 7.5', tomorrow: 'M5 12h14M13 6l6 6-6 6', date: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', plus: 'M12 6v12M6 12h12',
20
- yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4',
21
+ yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4', play: 'M8 5v14l11-7z',
21
22
  };
22
23
  /** The small sign of each type in the Type column (one stroke icon, the word beside it). */
23
24
  const TI = {
@@ -124,7 +125,10 @@ export function agendaHtml(A) {
124
125
  const inner = `<b>${mark}${esc(x.title)}</b><small>${esc(x.sub)}</small>`;
125
126
  if (x.kind === 'own' || x.kind === 'report') return `<div class="${cls}" style="${st}" aria-label="${esc(label)}">${inner}</div>`;
126
127
  if (x.kind === 'focus') return `<button type="button" class="${cls}" style="${st}" data-td="open" data-key="${esc(x.row)}" aria-label="${esc(label)}">${inner}</button>`;
127
- return `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
128
+ return `<button type="button" class="${cls}${x.play ? ' has-play' : ''}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`
129
+ // meeting-buddy: one press opens the call and starts the recording. A link, so the browser always opens the call, even when the
130
+ // recording tab is held back; cozy-today-app.js starts the recording on the same press.
131
+ + (x.play ? `<a class="td-play" style="${st}" href="${esc(x.join)}" target="_blank" rel="noopener noreferrer" data-td="play" data-key="${esc(x.key)}" aria-label="${esc('Join ' + x.title + ' and record it')}" title="Join and record">${svg(I.play, 13)}</a>` : '');
128
132
  }).join('');
129
133
  const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
130
134
  return `<aside class="td-ag${A.quiet && !A.items.length ? ' quiet' : ''}" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.quiet && !A.items.length ? A.sub.split(' · ')[0] : A.sub)}</small>`
@@ -2410,7 +2410,7 @@ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isP
2410
2410
  for (const id of ids) { const r = N.find((x) => x.id === id), w = r && r.row && r.row.dialog && r.row.dialog.write; if (!w || w.kind !== 'start') { failed++; continue; }
2411
2411
  const x = await startAgent({ ws: w.ws || WS || undefined, task: 'draft', initiative: w.initiative, what: w.what }); if (x.ok) started++; else failed++; }
2412
2412
  if (started) load(); return { started, failed, error: started ? '' : 'PMOS did not start them. Nothing changed.' }; },
2413
- openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2413
+ openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D), record: (row) => (REC ? REC.record(row) : Promise.resolve({ ok: false, error: 'PMOS is still starting. Press play again in a moment.' })),
2414
2414
  news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2415
2415
  openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
2416
2416
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
@@ -373,7 +373,7 @@ export function recCore(d) {
373
373
  return R;
374
374
  }
375
375
  /* not the recording tab: the recording tab listens (rec-tab-core.js), and the press there gives the share its permission */
376
- async function inTab(T, id) { goTab(T, tabUrl(id, { ws: (d.ws ? d.ws() : '') || '', go: true })); await readNotes(); return { ok: true, tab: true }; }
376
+ async function inTab(T, id, app) { goTab(T, tabUrl(id, { ws: (d.ws ? d.ws() : '') || '', go: true, app: app || '' })); await readNotes(); return { ok: true, tab: true }; }
377
377
  const setHold = (id) => { HOLD = id ? { id } : null; window.__premiumHolding = HOLD; bump(); };
378
378
  const started = () => { const r = window.__premiumRecorder || R; return r ? r.started() : null; };
379
379
  const C = {
@@ -385,7 +385,7 @@ export function recCore(d) {
385
385
  const T = ownTab() ? openTab(null) : null; // before the first await, so the browser lets the tab open
386
386
  const made = await d.pmPost('/api/notes/new', noteBody(row));
387
387
  if (!made || made.ok !== true) { dropTab(T); return { ok: false, error: (made && made.error) || 'The note was not made.' }; }
388
- return T ? inTab(T, made.note.id) : C.resume(made.note.id);
388
+ return T ? inTab(T, made.note.id, row && row.app) : C.resume(made.note.id);
389
389
  },
390
390
  /** New meeting: an untitled note with no calendar event, listened to at once (the console's recordNew). */
391
391
  async fresh() {
@@ -5,7 +5,8 @@
5
5
  * press brings the recording tab forward. Only the recording tab controls the meeting; the channel below carries its state, never a press.
6
6
  *
7
7
  * TAB, MAIN the window names: the recording tab, and the PMOS tab its links open in
8
- * tabUrl(id, { ws, go }) the recording tab's address for one note; go: start listening when it opens
8
+ * tabUrl(id, { ws, go, app }) the recording tab's address for one note; go: start listening when it opens; app: meet | zoom | other,
9
+ * where the Listen sheet starts (meeting-buddy)
9
10
  * isTab() this page is the recording tab
10
11
  * ownTab() a Record pressed on this page records in the recording tab (not on a phone, not in the recording tab;
11
12
  * a browser under automation only when the suite asks with window.__pmRecOwnTab)
@@ -20,7 +21,9 @@ export const TAB = 'pmos-rec';
20
21
  export const MAIN = 'pmos-main';
21
22
  const CHANNEL = 'pmos-rec';
22
23
 
23
- export const tabUrl = (id, { ws = '', go = false } = {}) => '/premium-rec.html?note=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) : '') + (go ? '&go=1' : '');
24
+ const APPS = ['meet', 'zoom', 'other'];
25
+ /** app: where the meeting is (meeting-buddy): the recording tab's Listen sheet opens on it. */
26
+ export const tabUrl = (id, { ws = '', go = false, app = '' } = {}) => '/premium-rec.html?note=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) : '') + (go ? '&go=1' : '') + (APPS.includes(app) ? '&app=' + app : '');
24
27
  export const isTab = () => typeof location !== 'undefined' && /^\/premium-rec(\.html)?$/.test(location.pathname);
25
28
  const phone = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
26
29
  export function ownTab() {
@@ -0,0 +1,27 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>PMOS · Meeting buddy</title>
8
+ <!-- The meeting buddy (initiative meeting-buddy; Exploring 2, "Meeting buddy and one-press start", boards 1, 2 and 4). The PMOS extension frames
9
+ it over a Google Meet call: /premium-buddy.html?meet=<abc-defg-hij>&mtitle=<tab title>. It can also name its meeting: ?event=<id>&date=YYYY-MM-DD.
10
+ Only the PM sees it. Its links open in a new tab, so the call never navigates away. pm/cozy-buddy.js draws it. -->
11
+ <base target="_blank" />
12
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
13
+ <link rel="stylesheet" href="/pm/cozy.css" />
14
+ <link rel="stylesheet" href="/pm/cozy-buddy.css" />
15
+ </head>
16
+ <body class="cz mb-page">
17
+ <main class="mb" id="mb">
18
+ <header class="mb-h"><i class="mb-dot" id="mbDot" aria-hidden="true"></i><b>PMOS</b><span class="mb-sm" id="mbHead">Looking for the meeting</span>
19
+ <button type="button" class="mb-ib" id="mbFold" aria-expanded="true" aria-label="Fold PMOS" title="Fold PMOS"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg></button></header>
20
+ <section class="mb-b" id="mbBody" aria-live="polite"></section>
21
+ <p class="mb-msg" id="mbMsg" role="status" hidden></p>
22
+ <form class="mb-ask" id="mbAsk" hidden><input type="text" id="mbQ" autocomplete="off" aria-label="Ask PMOS. Only you see this." placeholder="Ask PMOS. Only you see this." maxlength="1000" />
23
+ <button type="submit" class="mb-ib go" aria-label="Ask PMOS" title="Ask PMOS"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12l16-8-6 16-3-7z"/></svg></button></form>
24
+ </main>
25
+ <script type="module" src="/pm/cozy-buddy.js"></script>
26
+ </body>
27
+ </html>
@@ -7361,7 +7361,7 @@ async function handleRequest(req, res) {
7361
7361
  res.writeHead(302, { Location: '/premium.html?onboard=1', 'Cache-Control': 'no-store' });
7362
7362
  return res.end();
7363
7363
  }
7364
- const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-welcome': 'premium-welcome.html', '/premium-welcome.html': 'premium-welcome.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html' };
7364
+ const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-welcome': 'premium-welcome.html', '/premium-welcome.html': 'premium-welcome.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html', '/premium-buddy': 'premium-buddy.html', '/premium-buddy.html': 'premium-buddy.html' };
7365
7365
  const page = capture ? 'capture.html' : Object.prototype.hasOwnProperty.call(PAGES, p) ? PAGES[p] : null;
7366
7366
  if (page) {
7367
7367
  // pm-os-absorb Run 2 (R25, X11): the per-launch nonce goes into the base meta line, nowhere else. no-store, so a
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "The meeting buddy and the one-press start (initiative meeting-buddy, done test T1-T6): lib/meeting-focus.js callLinkOf and the caught bullet ids, pm/buddy-core.js, the Meet panel's address, Today's play icon. Pure, node.",
3
+ "modules": [
4
+ "meeting-buddy.test.js"
5
+ ],
6
+ "seconds": {
7
+ "meeting-buddy.test.js": 2
8
+ }
9
+ }