create-pmos 0.574.0 → 0.575.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.
- package/package.json +14 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-calendar-3-test.js +3 -10
- package/workspace/changelog.json +13 -0
- package/workspace/fixtures/agenda/invites.json +73 -0
- package/workspace/guide/notes.md +1 -1
- package/workspace/lib/agenda-topics.js +401 -0
- package/workspace/lib/meeting-focus.js +26 -13
- package/workspace/lib/routes-meeting-focus.js +79 -10
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/agenda-live.css +44 -0
- package/workspace/public/pm/agenda-live.js +100 -0
- package/workspace/public/pm/cozy-rec-now.js +20 -2
- package/workspace/public/pm/premium-vw-mtg.js +20 -21
- package/workspace/test-lists/live-agenda-topics.json +7 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* { k: 'out', at, gist, chips, topic, notes, raise } its parsed answer
|
|
20
20
|
* { k: 'raise', at, id, action: 'raised'|'skip' } the PM's answer to a Raise now item (✓ raised it, ✗ not now)
|
|
21
21
|
* { k: 'fail', at, error } the run ended without a usable answer
|
|
22
|
-
* { k: 'move', at, action: 'set'|'add'|'park', topic } the PM's correction
|
|
22
|
+
* { k: 'move', at, action: 'set'|'add'|'park'|'back', topic } the PM's correction; back = "Not this one": the line before it is on again
|
|
23
23
|
* { k: 'ask', id, at, question } a private question
|
|
24
24
|
* { k: 'answer', id, at, notes } its answer, as notes (or { k: 'fail', id, … })
|
|
25
25
|
*/
|
|
@@ -29,7 +29,7 @@ const MIN_GAP_MS = 40000; // the companion runs at most this often per
|
|
|
29
29
|
const AUTH_WAIT_MS = 120000; // after a run found Claude signed out, wait this long before the next try
|
|
30
30
|
const TAIL_MINUTES = 5; // how much of the talk the companion reads
|
|
31
31
|
const TAIL_MAX = 40; // and at most this many lines
|
|
32
|
-
const TOPICS_MAX =
|
|
32
|
+
const TOPICS_MAX = 30; // every invite line is kept; lib/agenda-topics.js shows them under 3 to 5 topics
|
|
33
33
|
const NOTES_MAX = 5;
|
|
34
34
|
const CHIPS_MAX = 4;
|
|
35
35
|
const RAISE_KINDS = Object.freeze(['check', 'follow-up', 'no-owner']);
|
|
@@ -150,7 +150,10 @@ function companionPrompt(input) {
|
|
|
150
150
|
for (const r of b.refs || []) L.push('Reference: ' + r.label + (r.source ? ' (' + r.source + ')' : '') + (r.link ? ' ' + r.link : ''));
|
|
151
151
|
L.push('');
|
|
152
152
|
L.push('## Topics' + (i.current ? ' (the room is on: ' + i.current + ')' : ''));
|
|
153
|
-
|
|
153
|
+
if (Array.isArray(i.groups) && i.groups.length) {
|
|
154
|
+
// the agenda as its 3 to 5 topics (lib/agenda-topics.js), each line under its topic
|
|
155
|
+
for (const g of i.groups) { L.push('### ' + str(g.title, 80)); for (const t of g.lines || []) L.push('- ' + str(typeof t === 'string' ? t : t && t.text, 160)); }
|
|
156
|
+
} else for (const t of i.topics || []) L.push('- ' + (t.text || t));
|
|
154
157
|
L.push('');
|
|
155
158
|
L.push('## The last minutes of the talk');
|
|
156
159
|
const tail = i.tail || [];
|
|
@@ -188,9 +191,10 @@ function companionPrompt(input) {
|
|
|
188
191
|
L.push('Answer with ONE JSON object and nothing else, in this shape:');
|
|
189
192
|
L.push('{"gist":"one sentence on what is being said now",');
|
|
190
193
|
L.push(' "chips":[{"label":"a name or thing said","sub":"what PMOS holds on it","ref":{"type":"initiative|plan-item|release|item|jira|ask|report|note|decision","id":"..."}} or {"label":"...","sub":"...","url":"https://..."}],');
|
|
191
|
-
L.push(' "topic":{"current":"the exact text of a
|
|
194
|
+
L.push(' "topic":{"current":"the exact text of a line above, or a new line","add":["new lines that came up"],"under":"the name of the topic (### above) a new line belongs to"},');
|
|
192
195
|
L.push(' "notes":[{"cat":"' + CATS.join('|') + '","heard":"the line it answers","body":"the answer","why":"why now","src":"where it came from","from":["' + FROM.join('","') + '"],"acts":[{"label":"Open the record","ref":{"type":"...","id":"..."}}],"show":"now|hold","when":"when to show a held note"}],');
|
|
193
196
|
L.push(' "raise":[{"kind":"' + RAISE_KINDS.join('|') + '","text":"one short line to raise","from":"the screen, or the date of the last meeting"}]}');
|
|
197
|
+
L.push('Prefer a line that is already above. Add a line only for a subject no line covers, and never one that says the same as a line above. A new line always goes under one of the topics: name it in "under".');
|
|
194
198
|
L.push('At most ' + CHIPS_MAX + ' chips and ' + NOTES_MAX + ' notes. Keep each body to two sentences. Name your source in "src". Use only references and links that you read in this repository or in the brief above; never invent one.');
|
|
195
199
|
return L.join('\n');
|
|
196
200
|
}
|
|
@@ -253,6 +257,7 @@ function parseCompanion(text) {
|
|
|
253
257
|
const chips = (Array.isArray(o.chips) ? o.chips : []).map(chipOf).filter(Boolean).slice(0, CHIPS_MAX);
|
|
254
258
|
const t = o.topic && typeof o.topic === 'object' && !Array.isArray(o.topic) ? o.topic : {};
|
|
255
259
|
const topic = { current: str(t.current, 120) || null, add: (Array.isArray(t.add) ? t.add : []).map((x) => str(x, 120)).filter(Boolean).slice(0, 3) };
|
|
260
|
+
if (str(t.under, 80)) topic.under = str(t.under, 80);
|
|
256
261
|
const notes = (Array.isArray(o.notes) ? o.notes : []).map(noteOf).filter(Boolean).slice(0, NOTES_MAX);
|
|
257
262
|
const raise = (Array.isArray(o.raise) ? o.raise : []).map(raiseOf).filter(Boolean).slice(0, RAISE_MAX);
|
|
258
263
|
if (!gist && !chips.length && !topic.current && !topic.add.length && !notes.length && !raise.length) return null;
|
|
@@ -277,10 +282,10 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
277
282
|
return byKey.get(k);
|
|
278
283
|
};
|
|
279
284
|
for (const t of topics) addTopic(t.text || t, t.src || 'steps');
|
|
280
|
-
let current = null; const runs = []; let gist = ''; let chips = []; const notes = []; let seen = 0; let lastRunAt = 0; let pending = false; let error = null; let authAt = 0;
|
|
281
|
-
const asks = new Map(); const raises = new Map();
|
|
285
|
+
let current = null; const runs = []; let veto = null; let gist = ''; let chips = []; const notes = []; let seen = 0; let lastRunAt = 0; let pending = false; let error = null; let authAt = 0;
|
|
286
|
+
const asks = new Map(); const raises = new Map(); // veto: the line the PM said "Not this one" to, kept off for 5 min
|
|
282
287
|
const close = (at) => { const r = runs[runs.length - 1]; if (r && r.to == null) r.to = at; };
|
|
283
|
-
const switchTo = (row, at) => { if (!row || (current && current.id === row.id && runs.length && runs[runs.length - 1].to == null)) return; close(at); row.parked = false; current = row; runs.push({ topic: row.id, from: at, to: null }); };
|
|
288
|
+
const switchTo = (row, at, by) => { if (!row || (current && current.id === row.id && runs.length && runs[runs.length - 1].to == null)) return; close(at); row.parked = false; current = row; runs.push({ topic: row.id, from: at, to: null, by: by || 'PMOS' }); };
|
|
284
289
|
const nextOpen = () => order.find((r) => r !== current && !r.parked && !runs.some((x) => x.topic === r.id));
|
|
285
290
|
for (const l of lines || []) {
|
|
286
291
|
if (!l || typeof l !== 'object') continue;
|
|
@@ -292,19 +297,27 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
292
297
|
if (l.gist) gist = l.gist;
|
|
293
298
|
if (Array.isArray(l.chips)) chips = l.chips;
|
|
294
299
|
const tp = l.topic || {};
|
|
295
|
-
|
|
296
|
-
|
|
300
|
+
const under = tp.under ? { under: str(tp.under, 80) } : {};
|
|
301
|
+
for (const a of tp.add || []) addTopic(a, 'added', { at, by: 'PMOS', ...under });
|
|
302
|
+
if (tp.current) { const row = addTopic(tp.current, 'added', { at, by: 'PMOS', ...under }); if (!(veto && row && row.id === veto.id && at < veto.until)) switchTo(row, at, 'PMOS'); }
|
|
297
303
|
for (const n of l.notes || []) notes.push({ ...n, id: 'n' + notes.length, at });
|
|
298
304
|
for (const r of Array.isArray(l.raise) ? l.raise : []) if (r && r.id && !raises.has(r.id)) raises.set(r.id, { id: r.id, kind: r.kind, text: r.text, from: r.from || '', at, state: 'open' });
|
|
299
305
|
} else if (l.k === 'raise') {
|
|
300
306
|
const r = raises.get(l.id); if (r) r.state = l.action === 'raised' ? 'raised' : 'skipped';
|
|
307
|
+
} else if (l.k === 'move' && l.action === 'back') {
|
|
308
|
+
// "Not this one": the line before the one PMOS moved to is on again; PMOS does not move back to it for 5 minutes
|
|
309
|
+
if (!current) continue;
|
|
310
|
+
veto = { id: current.id, until: at + 5 * 60000 };
|
|
311
|
+
const before = runs.slice().reverse().find((r) => r.topic !== current.id);
|
|
312
|
+
const row = before ? order.find((x) => x.id === before.topic) : null;
|
|
313
|
+
if (row) switchTo(row, at, 'you'); else { close(at); current = null; }
|
|
301
314
|
} else if (l.k === 'move') {
|
|
302
315
|
const row = addTopic(l.topic, 'pm', { at, by: 'you' });
|
|
303
316
|
if (!row) continue;
|
|
304
|
-
if (l.action === 'set') switchTo(row, at);
|
|
317
|
+
if (l.action === 'set') switchTo(row, at, 'you');
|
|
305
318
|
else if (l.action === 'park') {
|
|
306
319
|
row.parked = true;
|
|
307
|
-
if (current && current.id === row.id) { close(at); current = null; const nx = nextOpen(); if (nx) switchTo(nx, at); }
|
|
320
|
+
if (current && current.id === row.id) { close(at); current = null; const nx = nextOpen(); if (nx) switchTo(nx, at, 'you'); }
|
|
308
321
|
}
|
|
309
322
|
} else if (l.k === 'ask') asks.set(l.id, { id: l.id, at, question: str(l.question, 1000), state: 'working' });
|
|
310
323
|
else if (l.k === 'answer') {
|
|
@@ -313,12 +326,12 @@ function foldState(lines, { topics = [], startMs = null, nowMs = Date.now() } =
|
|
|
313
326
|
}
|
|
314
327
|
}
|
|
315
328
|
const minOf = (ms) => (startMs == null ? 0 : (ms - startMs) / 60000);
|
|
316
|
-
const outRuns = runs.map((r) => ({ topic: r.topic, from_min: Math.round(minOf(r.from) * 10) / 10, to_min: r.to == null ? null : Math.round(minOf(r.to) * 10) / 10 }));
|
|
329
|
+
const outRuns = runs.map((r) => ({ topic: r.topic, from_min: Math.round(minOf(r.from) * 10) / 10, to_min: r.to == null ? null : Math.round(minOf(r.to) * 10) / 10, by: r.by }));
|
|
317
330
|
const spent = (id) => runs.filter((r) => r.topic === id).reduce((s, r) => s + ((r.to == null ? nowMs : r.to) - r.from), 0) / 60000;
|
|
318
331
|
const outTopics = order.map((r) => {
|
|
319
332
|
const minutes = Math.round(spent(r.id));
|
|
320
333
|
const state = current && current.id === r.id ? 'now' : r.parked ? 'parked' : spent(r.id) > 0 ? 'discussed' : 'notyet';
|
|
321
|
-
return { id: r.id, text: r.text, src: r.src, state, minutes, ...(r.at ? { at: r.at } : {}), ...(r.by ? { by: r.by } : {}) };
|
|
334
|
+
return { id: r.id, text: r.text, src: r.src, state, minutes, ...(r.at ? { at: r.at } : {}), ...(r.by ? { by: r.by } : {}), ...(r.under ? { under: r.under } : {}) };
|
|
322
335
|
});
|
|
323
336
|
const allRaise = [...raises.values()];
|
|
324
337
|
const raise = allRaise.filter((r) => r.state === 'open').sort((a, b) => b.at - a.at).slice(0, RAISE_MAX).map(({ state, ...r }) => r);
|
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
* → { ok, event: { id, title, at, end }, date, by: 'meet'|'title'|'time' }, or a 404 { ok:false, error, choices:[{ id, title, at, end }] }
|
|
12
12
|
* Which meeting a Google Meet call is: the one whose links carry the Meet code, else the one titled like the tab, else the one under way now
|
|
13
13
|
* (lib/meeting-focus.js pickNow). It reads the same calendar as the read above and writes nothing.
|
|
14
|
-
*
|
|
14
|
+
* agenda: lib/agenda-topics.js liveModel — the invite's lines merged into 3 to 5 topics, the lines the talk added under them, minutes,
|
|
15
|
+
* marks and the Now card. The one model the Viewer's Agenda and the recording tab's To cover draw (pm/agenda-live.js). Before the meeting
|
|
16
|
+
* (no note yet) the read starts PMOS's AI merge once per invite (origin focus-companion:agenda-<sig>, read only); until it answers, and
|
|
17
|
+
* whenever the AI is off or a note already exists, the rules merge is used and kept.
|
|
18
|
+
* POST /api/meeting-focus/topic { event | note, date?, action: 'set'|'add'|'park'|'back', topic } page press; the PM's correction, appended to the state
|
|
19
|
+
* back = "Not this one": the line before is on again
|
|
20
|
+
* POST /api/meeting-focus/agenda { sig, action: 'undo' } page press; Undo the merge for that invite (every line is its topic again)
|
|
15
21
|
* POST /api/meeting-focus/ask { event, note?, date?, question } page press; one headless read-only run with the PM's question
|
|
16
22
|
* POST /api/meeting-focus/raise { event | note, date?, id, action: 'raised'|'skip' } page press; the PM's ✓ or ✗ on a Raise now item (the recording tab's Now panel)
|
|
17
23
|
* GET /api/meeting-focus/ask?id= → { ok, id, state: working | answered | failed, error? } the answer itself comes back as a note in GET /api/meeting-focus
|
|
@@ -27,6 +33,7 @@ const guard = require('./pm-guard.js');
|
|
|
27
33
|
const headless = require('./headless.js');
|
|
28
34
|
const notes = require('./notes.js');
|
|
29
35
|
const F = require('./meeting-focus.js');
|
|
36
|
+
const AT = require('./agenda-topics.js');
|
|
30
37
|
|
|
31
38
|
const fail = (status, error, extra) => ({ status, body: { ok: false, error, ...(extra || {}) } });
|
|
32
39
|
const dirOf = (runtimeDir) => path.join(runtimeDir, 'focus');
|
|
@@ -143,20 +150,21 @@ function framesOf(runtimeDir, note) {
|
|
|
143
150
|
if (!note || note.private) return [];
|
|
144
151
|
try { return require('./notes-screen.js').list(runtimeDir, note.id); } catch { return []; }
|
|
145
152
|
}
|
|
146
|
-
function inputFor(ctx, ev, brief, note, state, topics, question) {
|
|
153
|
+
function inputFor(ctx, ev, brief, note, state, topics, question, agenda) {
|
|
147
154
|
const now = ctx.nowMs;
|
|
148
155
|
const names = new Map(state.topics.map((t) => [t.id, t.text]));
|
|
149
156
|
const frames = framesOf(ctx.runtimeDir, note);
|
|
150
157
|
return { event: ev, brief: brief || {}, topics: state.topics.length ? state.topics : topics, current: state.current ? names.get(state.current) : null,
|
|
151
158
|
tail: note ? F.tailOf(note, { now }) : [], earlier: state.notes, question: question || null, now,
|
|
152
|
-
screen: F.screenOf(frames), shots: frames.length, raised: state.raised || []
|
|
159
|
+
screen: F.screenOf(frames), shots: frames.length, raised: state.raised || [],
|
|
160
|
+
groups: agenda && agenda.topics.length ? agenda.topics.map((t) => ({ title: t.title, lines: t.lines.map((l) => l.text) })) : null };
|
|
153
161
|
}
|
|
154
162
|
|
|
155
|
-
function startRun(ctx, key, ev, brief, note, state, topics, now) {
|
|
163
|
+
function startRun(ctx, key, ev, brief, note, state, topics, now, agenda) {
|
|
156
164
|
const origin = 'focus-companion:' + key;
|
|
157
165
|
const lines = note ? (note.transcript || []).length : 0;
|
|
158
166
|
append(ctx.runtimeDir, key + '.jsonl', { k: 'run', at: now, lines });
|
|
159
|
-
const prompt = F.companionPrompt(inputFor({ ...ctx, nowMs: now }, ev, brief, note, state, topics, null));
|
|
167
|
+
const prompt = F.companionPrompt(inputFor({ ...ctx, nowMs: now }, ev, brief, note, state, topics, null, agenda));
|
|
160
168
|
let s = null;
|
|
161
169
|
try {
|
|
162
170
|
s = ctx.spawnSession({ name: 'focus: companion', agent: 'claude', ws: ctx.w ? ctx.w.id : undefined, origin, initialInput: prompt,
|
|
@@ -165,6 +173,56 @@ function startRun(ctx, key, ev, brief, note, state, topics, now) {
|
|
|
165
173
|
if (!s || s.state === 'exited') append(ctx.runtimeDir, key + '.jsonl', { k: 'fail', at: now, error: 'The companion could not start: ' + ((s && s.note) || 'no session') + '.' });
|
|
166
174
|
}
|
|
167
175
|
|
|
176
|
+
/* ── the agenda in 3 to 5 topics ──────────────────────────────────────────────────────────────────────────────────── */
|
|
177
|
+
|
|
178
|
+
/** What PMOS's AI merge answered → the merge kept for the invite; an answer it cannot use keeps the rules merge instead. */
|
|
179
|
+
function settleMerge(ctx, sig, invite, k, done, now) {
|
|
180
|
+
const at = typeof now === 'function' ? now() : Date.now();
|
|
181
|
+
const res = done && done.result;
|
|
182
|
+
const groups = res && res.ok && !res.isError ? AT.parseMerge(res.text, invite, k) : null;
|
|
183
|
+
return AT.writeMerge(ctx.runtimeDir, sig, groups ? { groups, by: 'PMOS', at } : { groups: AT.ruleMerge(invite, k), by: 'rules', at });
|
|
184
|
+
}
|
|
185
|
+
/** The merge in force for an invite: { groups, merge } (both null when every line is its own topic). Starts the AI merge before the meeting. */
|
|
186
|
+
function mergeFor(ctx, { invite, lenMin, note, ev, nowMs, env }) {
|
|
187
|
+
if (!ctx.runtimeDir || !AT.needsMerge(invite.length, lenMin)) return { groups: null, merge: null };
|
|
188
|
+
const sig = AT.sigOf(invite), k = AT.target(invite.length, lenMin);
|
|
189
|
+
const M = AT.readMerge(ctx.runtimeDir, sig);
|
|
190
|
+
if (M.undone) return { groups: null, merge: null };
|
|
191
|
+
if (M.groups) return { groups: M.groups, merge: { by: M.by } };
|
|
192
|
+
const rules = AT.ruleMerge(invite, k);
|
|
193
|
+
const timeout = headless.timeoutMs(env);
|
|
194
|
+
const ai = !note && !F.off(env) && spawnable(ctx);
|
|
195
|
+
if (!ai) { AT.writeMerge(ctx.runtimeDir, sig, { groups: rules, by: 'rules', at: nowMs }); return { groups: rules, merge: { by: 'rules' } }; }
|
|
196
|
+
if (!M.pendingAt || nowMs - M.pendingAt > timeout) {
|
|
197
|
+
AT.pendingMerge(ctx.runtimeDir, sig, nowMs);
|
|
198
|
+
let s = null;
|
|
199
|
+
try {
|
|
200
|
+
s = ctx.spawnSession({ name: 'focus: agenda', agent: 'claude', ws: ctx.w ? ctx.w.id : undefined, origin: 'focus-companion:agenda-' + sig,
|
|
201
|
+
initialInput: AT.mergePrompt(invite, k, { title: ev.title, length: lenMin }), onDone: (done) => settleMerge(ctx, sig, invite, k, done, ctx.now) });
|
|
202
|
+
} catch { s = null; }
|
|
203
|
+
if (!s || s.state === 'exited') { AT.writeMerge(ctx.runtimeDir, sig, { groups: rules, by: 'rules', at: nowMs }); return { groups: rules, merge: { by: 'rules' } }; }
|
|
204
|
+
}
|
|
205
|
+
return { groups: rules, merge: { by: 'rules', pending: true } };
|
|
206
|
+
}
|
|
207
|
+
/** The minutes each invite line names or the PM set on the Viewer (lib/viewer-meeting.js), else null. */
|
|
208
|
+
function explicitOf(ctx, ev, invite) {
|
|
209
|
+
const VM = require('./viewer-meeting.js');
|
|
210
|
+
const series = ev.series && typeof ev.series === 'object' ? ev.series.key || ev.series.id || '' : ev.series || '';
|
|
211
|
+
let rows = [];
|
|
212
|
+
try { rows = VM.agendaOf(ctx.runtimeDir, { key: VM.keyOf({ series, event: ev.id, title: ev.title }), topics: invite, length_min: 0 }).topics; } catch { rows = []; }
|
|
213
|
+
return invite.map((t, i) => (rows[i] && rows[i].set ? rows[i].min : AT.cleanLine(t).min));
|
|
214
|
+
}
|
|
215
|
+
function agendaOf(ctx, { ev, note, topics, state, startMs, nowMs, env, day, captured }) {
|
|
216
|
+
const invite = topics.map((t) => t.text);
|
|
217
|
+
const endMs = Date.parse(ev.end);
|
|
218
|
+
const lenMin = Number.isFinite(startMs) && Number.isFinite(endMs) && endMs > startMs ? (endMs - startMs) / 60000 : 0;
|
|
219
|
+
const { groups, merge } = mergeFor(ctx, { invite, lenMin, note, ev, nowMs, env });
|
|
220
|
+
const qs = (captured && captured.questions) || [];
|
|
221
|
+
return AT.liveModel({ invite, explicit: explicitOf(ctx, ev, invite), groups, merge, state, startMs: Number.isFinite(startMs) ? startMs : null, endMs: Number.isFinite(endMs) ? endMs : null,
|
|
222
|
+
nowMs, question: qs.length ? qs[qs.length - 1].text : '', sig: invite.length ? AT.sigOf(invite) : '',
|
|
223
|
+
ref: { event: String(ev.id).startsWith('note:') ? null : ev.id, note: note ? note.id : null, date: day } });
|
|
224
|
+
}
|
|
225
|
+
|
|
168
226
|
/* ── GET /api/meeting-focus ───────────────────────────────────────────────────────────────────────────────────────── */
|
|
169
227
|
|
|
170
228
|
async function read(q, ctx) {
|
|
@@ -194,8 +252,11 @@ async function read(q, ctx) {
|
|
|
194
252
|
const env = ctx.env || process.env;
|
|
195
253
|
const call = F.shouldRun(nowMs, state, note ? { state: note.state, lines: (note.transcript || []).length } : null, { env, timeoutMs: headless.timeoutMs(env) });
|
|
196
254
|
let started = false;
|
|
197
|
-
|
|
255
|
+
const captured = F.capturedFrom(note);
|
|
256
|
+
const agendaArgs = { ev, note, topics, startMs, nowMs, env, day, captured };
|
|
257
|
+
if (call.run && spawnable(ctx)) { startRun(ctx, key, ev, brief, note, state, topics, nowMs, agendaOf(ctx, { ...agendaArgs, state })); started = true; }
|
|
198
258
|
const fresh = started ? F.foldState(linesOf(ctx.runtimeDir, keys), { topics, startMs: Number.isFinite(startMs) ? startMs : null, nowMs }) : state;
|
|
259
|
+
const agenda = agendaOf(ctx, { ...agendaArgs, state: fresh });
|
|
199
260
|
const links = [];
|
|
200
261
|
const seen = new Set();
|
|
201
262
|
for (const l of [...(Array.isArray(ev.links) ? ev.links : []), ...((brief && brief.links) || []), ...(((brief && brief.refs) || []).filter((r) => r.link).map((r) => ({ label: r.label, url: r.link })))]) {
|
|
@@ -213,7 +274,7 @@ async function read(q, ctx) {
|
|
|
213
274
|
material,
|
|
214
275
|
note: note ? { id: note.id, title: note.title || ev.title, state: note.state, recorded_from: note.recorded_from || null, lines: (note.transcript || []).length, sessions } : null,
|
|
215
276
|
topics: fresh.topics, current: fresh.current, runs: fresh.runs,
|
|
216
|
-
tail: note ? F.tailOf(note, { now: nowMs }) : [], captured
|
|
277
|
+
tail: note ? F.tailOf(note, { now: nowMs }) : [], captured, agenda,
|
|
217
278
|
gist: fresh.gist, chips: fresh.chips, notes: fresh.notes, raise: fresh.raise, asks: fresh.asks,
|
|
218
279
|
companion: { on: !F.off(env) && kindOk() && typeof ctx.spawnSession === 'function', running: !!fresh.pending, started, reason: call.reason, last_run_at: fresh.last_run_at || null, error: fresh.error },
|
|
219
280
|
} };
|
|
@@ -235,7 +296,7 @@ function nowRoute(q, ctx) {
|
|
|
235
296
|
async function topic(req, body, ctx) {
|
|
236
297
|
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
237
298
|
const action = String(body.action || '');
|
|
238
|
-
if (!['set', 'add', 'park'].includes(action)) return fail(400, 'action must be set, add or
|
|
299
|
+
if (!['set', 'add', 'park', 'back'].includes(action)) return fail(400, 'action must be set, add, park or back');
|
|
239
300
|
const text = F.str(body.topic, 120);
|
|
240
301
|
if (!text) return fail(400, 'Name the topic.');
|
|
241
302
|
const key = await keyFromBody(body, ctx); if (key.error) return key.error;
|
|
@@ -243,6 +304,14 @@ async function topic(req, body, ctx) {
|
|
|
243
304
|
append(ctx.runtimeDir, key.key + '.jsonl', F.moveLine(action, text, now));
|
|
244
305
|
return { status: 200, body: { ok: true, key: key.key } };
|
|
245
306
|
}
|
|
307
|
+
/* ── POST /api/meeting-focus/agenda ───────────────────────────────────────────────────────────────────────────────── */
|
|
308
|
+
|
|
309
|
+
async function agendaPress(req, body, ctx) {
|
|
310
|
+
const g = guard.requirePagePress(req, body); if (!g.ok) return fail(g.status, g.error);
|
|
311
|
+
if (String(body.action || '') !== 'undo') return fail(400, 'action must be undo');
|
|
312
|
+
const r = AT.undoMerge(ctx.runtimeDir, String(body.sig || ''), typeof ctx.now === 'function' ? ctx.now() : Date.now());
|
|
313
|
+
return r.ok ? { status: 200, body: { ok: true } } : fail(r.status || 400, r.error);
|
|
314
|
+
}
|
|
246
315
|
/* ── POST /api/meeting-focus/raise ────────────────────────────────────────────────────────────────────────────────── */
|
|
247
316
|
|
|
248
317
|
async function raise(req, body, ctx) {
|
|
@@ -342,7 +411,7 @@ const respond = (ctx, res, r) => { ctx.json(res, r.body, r.status); return true;
|
|
|
342
411
|
|
|
343
412
|
module.exports = {
|
|
344
413
|
prefixes: ['/api/meeting-focus'],
|
|
345
|
-
read, now: nowRoute, topic, raise, ask, askState, settleAsk, settleRun, findEvent, keyOf, linesOf, noteFor, noteEvent, realBrief,
|
|
414
|
+
read, now: nowRoute, topic, raise, ask, agenda: agendaPress, settleMerge, askState, settleAsk, settleRun, findEvent, keyOf, linesOf, noteFor, noteEvent, realBrief,
|
|
346
415
|
handle: async (req, res, url, ctx) => {
|
|
347
416
|
const p = url.pathname;
|
|
348
417
|
const wsId = url.searchParams.get('ws');
|
|
@@ -351,7 +420,7 @@ module.exports = {
|
|
|
351
420
|
if (req.method === 'GET' && p === '/api/meeting-focus') return respond(ctx, res, await read(Object.fromEntries(url.searchParams), base));
|
|
352
421
|
if (req.method === 'GET' && p === '/api/meeting-focus/now') return respond(ctx, res, nowRoute(Object.fromEntries(url.searchParams), base));
|
|
353
422
|
if (req.method === 'GET' && p === '/api/meeting-focus/ask') return respond(ctx, res, askState(Object.fromEntries(url.searchParams), base));
|
|
354
|
-
const fn = req.method === 'POST' && { '/api/meeting-focus/topic': topic, '/api/meeting-focus/raise': raise, '/api/meeting-focus/ask': ask }[p];
|
|
423
|
+
const fn = req.method === 'POST' && { '/api/meeting-focus/topic': topic, '/api/meeting-focus/raise': raise, '/api/meeting-focus/ask': ask, '/api/meeting-focus/agenda': agendaPress }[p];
|
|
355
424
|
if (!fn) return false;
|
|
356
425
|
const got = await ctx.readJson(req);
|
|
357
426
|
if (!got.ok) return respond(ctx, res, fail(400, 'invalid JSON body'));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.575.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.575.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* pm/agenda-live.css — the agenda in 3 to 5 topics (pm/agenda-live.js; boards MgD and MgRD, initiative live-agenda-topics). Cozy tokens only. */
|
|
2
|
+
.mg { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
|
|
3
|
+
.mg * { box-sizing: border-box; }
|
|
4
|
+
.mg .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
5
|
+
.mg-tm { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-label); color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
|
|
6
|
+
.mg-tm b { color: var(--cz-ink); font-weight: var(--fw-strong); }
|
|
7
|
+
.mg-tm .sp { flex: 1 1 0%; }
|
|
8
|
+
.mg-pr { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--cz-well); }
|
|
9
|
+
.mg-pr .st { color: var(--cz-blueink); margin-top: 2px; display: inline-flex; }
|
|
10
|
+
.mg-pr .tx { flex: 1 1 0%; font-size: var(--fs-body); line-height: 1.5; color: var(--cz-ink); }
|
|
11
|
+
.mg-pr .tx small { display: block; margin-top: 2px; font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
12
|
+
.mg-pr button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 0; cursor: pointer; background: var(--cz-card); color: var(--cz-ink2); flex: 0 0 auto; }
|
|
13
|
+
@media (hover: hover) { .mg-pr button:hover { color: var(--cz-ink); } }
|
|
14
|
+
.mg-th { display: flex; flex-direction: column; gap: 6px; border-radius: 8px; background: var(--cz-well); padding: 10px 12px; }
|
|
15
|
+
.mg-th[open] { gap: 6px; }
|
|
16
|
+
.mg-th.now { background: var(--cz-bluebg); }
|
|
17
|
+
.mg-th > summary { list-style: none; cursor: pointer; }
|
|
18
|
+
.mg-th > summary::-webkit-details-marker { display: none; }
|
|
19
|
+
.mg-th[data-one] > summary { cursor: default; }
|
|
20
|
+
.mg-th .hr { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-body); color: var(--cz-ink); }
|
|
21
|
+
.mg-th .hr .tx { flex: 1 1 0%; min-width: 0; line-height: 1.35; }
|
|
22
|
+
.mg-th .hr .tx b { font-weight: var(--fw-strong); }
|
|
23
|
+
.mg-th .hr .tx small { display: block; font-size: var(--fs-label); color: var(--cz-ink3); margin-top: 1px; }
|
|
24
|
+
.mg-th[data-mark="skipped"] .hr .tx b { color: var(--cz-ink2); font-weight: var(--fw-regular); }
|
|
25
|
+
.mg .mk { width: 18px; height: 18px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; margin-top: 2px; }
|
|
26
|
+
.mg .mk.ok { color: var(--cz-ok); }
|
|
27
|
+
.mg .mk .ndot { width: 9px; height: 9px; border-radius: 50%; background: var(--cz-blue); display: block; }
|
|
28
|
+
.mg .mk .pdot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--cz-ink3); opacity: .55; display: block; }
|
|
29
|
+
.mg .mk .odot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--cz-ink3); background: linear-gradient(90deg, var(--cz-ink3) 50%, transparent 50%); display: block; opacity: .7; }
|
|
30
|
+
.mg .t4 { margin-left: auto; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
|
|
31
|
+
.mg .t4.ov { color: var(--cz-risk); }
|
|
32
|
+
.mg-now { background: var(--cz-card); border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
|
|
33
|
+
.mg-now small { font-size: var(--fs-label); color: var(--cz-blueink); font-weight: var(--fw-strong); }
|
|
34
|
+
.mg-now h4 { margin: 0; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); line-height: 1.35; }
|
|
35
|
+
.mg-now p { margin: 0; font-size: var(--fs-body); color: var(--cz-ink2); line-height: 1.5; }
|
|
36
|
+
.mg-now .ft { display: flex; align-items: center; gap: 10px; font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
37
|
+
.mg-now .ft .sp { flex: 1 1 0%; }
|
|
38
|
+
.mg-lk { border: 0; background: none; padding: 6px 0; font: inherit; color: var(--cz-blueink); font-weight: var(--fw-strong); cursor: pointer; min-height: 32px; }
|
|
39
|
+
.mg-r { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; font-size: var(--fs-body); line-height: 1.4; color: var(--cz-ink); }
|
|
40
|
+
.mg-r .tx { flex: 1 1 0%; min-width: 0; }
|
|
41
|
+
.mg-r .tx small { display: block; font-size: var(--fs-label); color: var(--cz-ink3); margin-top: 1px; line-height: 1.4; }
|
|
42
|
+
.mg-r .tx small.ok { color: var(--cz-ok); }
|
|
43
|
+
.mg-r.dn .tx, .mg-r.pl .tx { color: var(--cz-ink2); }
|
|
44
|
+
.mg-r[data-mark="skipped"] .tx { color: var(--cz-ink3); }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* pm/agenda-live.js — a meeting's agenda as 3 to 5 topics (initiative live-agenda-topics, batch 30 item 3; boards MgD and MgRD).
|
|
2
|
+
*
|
|
3
|
+
* agendaHtml(A, { now? }) → string the agenda GET /api/meeting-focus answers as `agenda` (lib/agenda-topics.js liveModel): the end time and
|
|
4
|
+
* minutes left, "PMOS merged …" with Undo, then each topic. The open topic holds the Now card and its lines.
|
|
5
|
+
* nowSummary(A) → string "Add-on eligibility, in Subscribers and add-on" for a one-line summary; '' with no line on
|
|
6
|
+
* press(el, A, { ws? }) → Promise<{ ok, error?, said? } | null> a press inside the agenda: Undo (POST /api/meeting-focus/agenda) or Not this one
|
|
7
|
+
* (POST /api/meeting-focus/topic, action back). null when the press was not the agenda's.
|
|
8
|
+
* ensureCss() loads agenda-live.css once
|
|
9
|
+
*
|
|
10
|
+
* The Viewer's Agenda (premium-vw-mtg.js) and the recording tab's To cover (cozy-rec-now.js) both draw it, so they say the same minutes the same
|
|
11
|
+
* way: minutes used of minutes planned, amber when over, nothing at zero. There is no Change topic: PMOS follows the talk and the PM corrects it. */
|
|
12
|
+
import { pmPost } from './http.js';
|
|
13
|
+
|
|
14
|
+
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
16
|
+
const hm = (ms) => { const d = new Date(ms); return Number.isFinite(d.getTime()) ? pad(d.getHours()) + ':' + pad(d.getMinutes()) : ''; };
|
|
17
|
+
const svg = (d, n = 16, w = 1.9) => `<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
18
|
+
const P = { check: 'M5 12.5l4.5 4.5L19 7.5', undo: 'M9 14L4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11',
|
|
19
|
+
spark: 'M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z' };
|
|
20
|
+
|
|
21
|
+
export function ensureCss() {
|
|
22
|
+
if (typeof document === 'undefined' || document.querySelector('link[data-ag-css]')) return;
|
|
23
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./agenda-live.css', import.meta.url).href; l.setAttribute('data-ag-css', '');
|
|
24
|
+
document.head.appendChild(l);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const MARK = { now: '<i class="ndot"></i>', settled: svg(P.check, 16), open: '<i class="odot"></i>', notyet: '<i class="pdot"></i>', skipped: '<i class="pdot"></i>' };
|
|
28
|
+
const markHtml = (k, cls = '') => `<span class="mk${k === 'settled' ? ' ok' : ''}${cls}" aria-hidden="true">${MARK[k] || MARK.notyet}</span>`;
|
|
29
|
+
const WORD = { now: 'Now', settled: 'Settled', open: 'Talked, still open', notyet: 'Not yet', skipped: 'Skipped' };
|
|
30
|
+
|
|
31
|
+
function lineHtml(l) {
|
|
32
|
+
const small = l.mark === 'skipped' ? 'Skipped' : l.note;
|
|
33
|
+
return `<div class="mg-r ${l.mark === 'notyet' || l.mark === 'skipped' ? 'pl' : 'dn'}" data-mark="${esc(l.mark)}">${markHtml(l.mark)}`
|
|
34
|
+
+ `<span class="tx"><span class="sr">${esc(WORD[l.mark] || '')}: </span>${esc(l.text)}${small ? `<small class="${l.mark === 'settled' ? 'ok' : ''}">${esc(small)}</small>` : ''}</span>`
|
|
35
|
+
+ (l.say ? `<span class="t4${l.over ? ' ov' : ''}">${esc(l.say)}</span>` : '') + '</div>';
|
|
36
|
+
}
|
|
37
|
+
function nowCard(A) {
|
|
38
|
+
const N = A.now;
|
|
39
|
+
if (!N) return '';
|
|
40
|
+
const on = Math.round(N.onIt || 0);
|
|
41
|
+
const who = N.at ? (N.by === 'you' ? 'You moved here at ' : 'PMOS moved here at ') + hm(N.at) : '';
|
|
42
|
+
const ft = [N.onIt > 0 ? (on < 1 ? '<1' : on) + ' min on it' : '', who].filter(Boolean).join(' · ');
|
|
43
|
+
return `<div class="mg-now" aria-live="polite"><small>Now · line ${N.n} of ${N.of}</small><h4>${esc(N.text)}</h4>`
|
|
44
|
+
+ (N.question ? `<p>${esc('Open: ' + N.question)}</p>` : '')
|
|
45
|
+
+ `<div class="ft"><span>${esc(ft)}</span><span class="sp"></span><button type="button" class="mg-lk" data-ag="back">Not this one</button></div></div>`;
|
|
46
|
+
}
|
|
47
|
+
function topicHtml(A, t) {
|
|
48
|
+
const head = `<summary class="hr">${markHtml(t.mark)}<span class="tx"><b>${esc(t.title)}</b>${t.sub ? `<small>${esc(t.sub)}</small>` : ''}</span>`
|
|
49
|
+
+ (t.say ? `<span class="t4${t.over ? ' ov' : ''}">${esc(t.say)}</span>` : '') + '</summary>';
|
|
50
|
+
const lines = t.lines.filter((l) => !l.now);
|
|
51
|
+
// a topic of one line is that line: nothing to unfold unless it is the open one
|
|
52
|
+
const body = (t.now ? nowCard(A) : '') + (t.lines.length > 1 || t.now ? lines.map(lineHtml).join('') : '');
|
|
53
|
+
return `<details class="mg-th${t.now ? ' now' : ''}" data-mark="${esc(t.mark)}"${t.now ? ' open' : ''}${body ? '' : ' data-one=""'}>${head}${body}</details>`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The agenda's html. Silent at zero: no topics → ''. */
|
|
57
|
+
export function agendaHtml(A) {
|
|
58
|
+
if (!A || !Array.isArray(A.topics) || !A.topics.length) return '';
|
|
59
|
+
const h = ['<div class="mg" data-ag-root="">'];
|
|
60
|
+
const tm = [];
|
|
61
|
+
if (A.ends) tm.push(`<span>Ends <b>${esc(hm(A.ends))}</b>${A.live && A.left != null ? ` · <b>${A.left} min</b> left` : ''}</span>`);
|
|
62
|
+
if (A.live && A.plannedLeft != null) tm.push('<span class="sp"></span>', `<span>${A.plannedLeft} min planned for what is left</span>`);
|
|
63
|
+
if (tm.length) h.push(`<div class="mg-tm">${tm.join('')}</div>`);
|
|
64
|
+
if (A.merge) {
|
|
65
|
+
const M = A.merge;
|
|
66
|
+
h.push(`<div class="mg-pr"><span class="st">${svg(P.spark, 16, 1.7)}</span><div class="tx">PMOS merged the invite’s ${M.lines} lines into ${M.topics} topics${M.length ? ' for a ' + M.length + ' min meeting' : ''}. The lines stay under their topic.`
|
|
67
|
+
+ (M.length ? '<small>Minutes are shared out by how many lines each topic holds</small>' : '')
|
|
68
|
+
+ `</div><button type="button" data-ag="undo" aria-label="Undo the merge" title="Undo the merge">${svg(P.undo, 16)}</button></div>`);
|
|
69
|
+
}
|
|
70
|
+
for (const t of A.topics) h.push(topicHtml(A, t));
|
|
71
|
+
h.push('</div>');
|
|
72
|
+
return h.join('');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function nowSummary(A) {
|
|
76
|
+
if (!A || !A.now) return '';
|
|
77
|
+
const t = A.topics[A.now.topic];
|
|
78
|
+
return A.now.text + (t && t.title !== A.now.text ? ', in ' + t.title : '');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A press inside the agenda. el = the pressed element (or one inside it). */
|
|
82
|
+
export async function press(el, A, { ws } = {}) {
|
|
83
|
+
const b = el && el.closest ? el.closest('[data-ag]') : null;
|
|
84
|
+
if (!b || !A) return null;
|
|
85
|
+
const ref = A.ref || {};
|
|
86
|
+
const where = ref.note ? { note: ref.note } : ref.event ? { event: ref.event, date: ref.date || '' } : null;
|
|
87
|
+
b.disabled = true;
|
|
88
|
+
try {
|
|
89
|
+
if (b.dataset.ag === 'undo') {
|
|
90
|
+
const r = await pmPost('/api/meeting-focus/agenda', { sig: A.sig, action: 'undo', ...(ws ? { ws } : {}) });
|
|
91
|
+
return r && r.ok ? { ok: true, said: 'Undone. Every line of the invite is its own topic again.' } : { ok: false, error: (r && r.error) || 'no answer' };
|
|
92
|
+
}
|
|
93
|
+
if (b.dataset.ag === 'back') {
|
|
94
|
+
if (!where || !A.now) return { ok: false, error: 'this meeting has no line on now' };
|
|
95
|
+
const r = await pmPost('/api/meeting-focus/topic', { ...where, action: 'back', topic: A.now.text, ...(ws ? { ws } : {}) });
|
|
96
|
+
return r && r.ok ? { ok: true, said: 'Moved back. PMOS keeps off that line for 5 minutes.' } : { ok: false, error: (r && r.error) || 'no answer' };
|
|
97
|
+
}
|
|
98
|
+
} finally { b.disabled = false; }
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* XrtA7Transcript, XrtA5PhoneRec on the main canvas).
|
|
3
3
|
*
|
|
4
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, Caught so far, the last answer
|
|
5
|
+
* nowHtml(m, { room? }) → string To cover (or, in the room, the topic now big with chips), Raise now, Caught so far, the last answer.
|
|
6
|
+
* To cover is the meeting's agenda in 3 to 5 topics (pm/agenda-live.js), the same as the Viewer's Agenda.
|
|
6
7
|
* transcriptModel(one, { max? }) → [Line] pure: the live transcript, oldest first, with the highlight and decision marks
|
|
7
8
|
* transcriptHtml(lines) → string the 420px card's feed
|
|
8
9
|
* kindOf(text) → 'ask' | 'note' a line that ends with "?" asks Claude; anything else is kept as a note
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
* 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
17
|
* (a note, or an answer kept with +), POST /api/meeting-focus/ask (a question; the answer comes back on the next read). */
|
|
17
18
|
import { pmGet, pmPost } from './http.js';
|
|
19
|
+
import { agendaHtml, ensureCss as agendaCss, press as agendaPress } from './agenda-live.js';
|
|
18
20
|
|
|
19
21
|
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
20
22
|
const P = {
|
|
@@ -87,6 +89,8 @@ export function nowModel(F, one, { now = Date.now() } = {}) {
|
|
|
87
89
|
left, raise, counts: parts.join(' · '), answer,
|
|
88
90
|
// Caught so far (batch 23 item 1): the companion's gist of the talk, as the Viewer's meeting card shows it
|
|
89
91
|
gist: typeof f.gist === 'string' ? f.gist.trim().slice(0, 400) : '',
|
|
92
|
+
// the agenda in 3 to 5 topics (lib/agenda-topics.js liveModel), drawn the same as the Viewer's Agenda
|
|
93
|
+
agenda: f.agenda && Array.isArray(f.agenda.topics) && f.agenda.topics.length ? f.agenda : null,
|
|
90
94
|
};
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -122,6 +126,8 @@ export function nowHtml(m, { room = false } = {}) {
|
|
|
122
126
|
if (m.next) chips.push(`<span role="listitem"><b></b>Next: ${esc(m.next.text)}</span>`);
|
|
123
127
|
if (!m.current && !chips.length && m.topics.length) m.topics.forEach((t) => chips.push(`<span role="listitem"><b></b>${esc(t.text)}</span>`));
|
|
124
128
|
if (chips.length) h += `<div class="rn-stp" role="list" aria-label="To cover">${chips.join('')}</div>`;
|
|
129
|
+
} else if (m.agenda) {
|
|
130
|
+
h += `<section class="rn-sec" aria-label="To cover"><h5>To cover</h5>${agendaHtml(m.agenda)}</section>`;
|
|
125
131
|
} else if (m.topics.length) {
|
|
126
132
|
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">`
|
|
127
133
|
+ 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('')
|
|
@@ -191,6 +197,7 @@ export function mountNow(slots, ctx) {
|
|
|
191
197
|
const noteId = () => { const o = oneNow(); return o && o.note ? o.note.id : ''; };
|
|
192
198
|
const modeNow = () => { try { return typeof ctx.mode === 'function' ? ctx.mode() : 'screen'; } catch { return 'screen'; } };
|
|
193
199
|
|
|
200
|
+
agendaCss();
|
|
194
201
|
if (!document.querySelector('link[data-rn-css]')) {
|
|
195
202
|
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', '');
|
|
196
203
|
document.head.appendChild(l);
|
|
@@ -253,7 +260,12 @@ export function mountNow(slots, ctx) {
|
|
|
253
260
|
place();
|
|
254
261
|
const one = oneNow();
|
|
255
262
|
const h = nowHtml(nowModel(focusNow(), one), { room });
|
|
256
|
-
if (h !== last) {
|
|
263
|
+
if (h !== last) {
|
|
264
|
+
// a topic the PM unfolded stays unfolded when the minutes change
|
|
265
|
+
const opened = new Set([...body.querySelectorAll('details.mg-th[open] > summary b')].map((x) => x.textContent));
|
|
266
|
+
body.innerHTML = h; last = h;
|
|
267
|
+
body.querySelectorAll('details.mg-th > summary b').forEach((x) => { if (opened.has(x.textContent)) x.closest('details').open = true; });
|
|
268
|
+
}
|
|
257
269
|
if (open) {
|
|
258
270
|
const t = transcriptHtml(transcriptModel(one));
|
|
259
271
|
if (t !== lastT) {
|
|
@@ -320,6 +332,12 @@ export function mountNow(slots, ctx) {
|
|
|
320
332
|
});
|
|
321
333
|
|
|
322
334
|
body.addEventListener('click', async (e) => {
|
|
335
|
+
if (e.target.closest('[data-ag]')) {
|
|
336
|
+
const f = focusNow();
|
|
337
|
+
const r = await agendaPress(e.target, f && f.agenda, { ws: ctx.ws });
|
|
338
|
+
if (r) { say(r.ok ? '' : 'Not changed: ' + r.error); read(); }
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
323
341
|
const b = e.target.closest('[data-rn]'); if (!b) return;
|
|
324
342
|
const act = b.getAttribute('data-rn');
|
|
325
343
|
if (act === 'raised' || act === 'skip') {
|