create-pmos 0.573.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.
@@ -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
- * POST /api/meeting-focus/topic { event | note, date?, action: 'set'|'add'|'park', topic } page press; the PM's correction, appended to the state
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
- if (call.run && spawnable(ctx)) { startRun(ctx, key, ev, brief, note, state, topics, nowMs); started = true; }
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: F.capturedFrom(note),
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 park');
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.573.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.573.0",
9
+ "version": "0.575.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.573.0",
3
+ "version": "0.575.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -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) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[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
+ }
@@ -476,6 +476,14 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
476
476
  .hv-why input, .hv-why select, .hv-why textarea { font-size: var(--fs-field); min-height: 44px; }
477
477
  .hx-row select, .hx-add input { font-size: var(--fs-field); min-height: 44px; } /* a task's status and Add a task: 44 px targets that do not zoom the page */
478
478
  .hm-foot { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cz-ground); } /* the composer stays on the screen while the conversation scrolls */
479
+ /* Home's composer is fixed to the screen's bottom, not sticky (batch 30 item 2): the place menu's button is fixed just above it, so the
480
+ * two share one layer and the button's offset is the composer's height alone. Sticky with a measured offset left the button over the
481
+ * messages after touch scrolling on iOS. The chat keeps the composer's height under its last message. */
482
+ body.cz-home #hmFoot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
483
+ body.cz-home #hmChat { box-sizing: border-box; padding-bottom: var(--bd-hmfoot, 232px); }
484
+ /* a short fade over the text that scrolls under the button, so the button never sits on a readable line; home-line.css takes it away
485
+ * where the phone chat has no button */
486
+ body.cz-home #hmFoot::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 72px; pointer-events: none; background: var(--cz-ground); background-size: 100% 1000px; -webkit-mask-image: linear-gradient(to bottom, transparent, black 40%); mask-image: linear-gradient(to bottom, transparent, black 40%); } /* the ground is a gradient: its first colours meet the composer's top */
479
487
  .hm-x { opacity: 1; }
480
488
  .hm-unfold, .hm-folded .hm-unfold { display: none; }
481
489
  .hm-reopen { display: none; }
@@ -484,7 +492,9 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
484
492
  }
485
493
  /* the menu button sits just above the foot (the box, its bars and the hint: home-chat.js keeps --bd-hmfoot), never over a press; the log ends
486
494
  * with room for it, so the last message scrolls clear of it */
487
- @media (max-width: 760px) { body.cz-home .cz-fabw { bottom: calc(var(--bd-hmfoot, 232px) + 10px); } body.cz-home.hm-sheet .cz-fabw { bottom: 118px; } .hm-log { padding-bottom: 76px; } }
495
+ @media (max-width: 760px) { body.cz-home .cz-fabw { bottom: calc(var(--bd-hmfoot, 232px) + 10px); } body.cz-home.hm-sheet .cz-fabw { bottom: 118px; } .hm-log { padding-bottom: 76px; }
496
+ /* the Live pill sits beside the button, inside the fade, not stacked over the messages (batch 30 item 2) */
497
+ body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw .cz-live { left: auto; right: 68px; bottom: 6px; } }
488
498
  .hv-term { margin: 0; height: 100%; box-sizing: border-box; padding: 16px 20px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--cz-mono); font-size: var(--fs-meta); line-height: 1.5; color: var(--cz-ink2); background: var(--cz-well); }
489
499
  .hv-xt { height: 100%; box-sizing: border-box; padding: 12px 16px; overflow: auto; background: var(--cz-well); } /* term-view.js: the session's terminal drawn by xterm.js, read only */
490
500
  .hv-xt .xterm { display: inline-block; zoom: .8; } /* xterm's 15px default drawn at 12px */
@@ -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) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[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) { body.innerHTML = h; last = h; }
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') {
@@ -59,6 +59,7 @@ import { mountRecRow, clockOf as recClock } from './home-rec-row.js';
59
59
  import { mountSesName } from './home-ses-name.js'; // session names A: tap the session's name to rename it (canvas XmsNames)
60
60
  import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
61
61
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other, LpA4Phone)
62
+ import { wireSettle } from './vv-settle.js'; // the phone's fixed layer back in place after the keyboard and touch scrolls (batch 30 item 2)
62
63
  import * as CW from './ctx-wedge.js'; // how full a session's context is, and Claude's ✦ Compact (batch 13 item 8, XctxA1Desk)
63
64
  import * as SO from './sort-order.js'; // the sort button and ONE order with the Board (batch 14 item 8, canvas SoAHomePhone)
64
65
  import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
@@ -84,6 +85,7 @@ const BOARD = P.get('board') || ''; // the Board's expand link names its board
84
85
  const boardQ = (pre = '?') => (BOARD ? pre + 'board=' + encodeURIComponent(BOARD) : '');
85
86
  const PHONE = 760;
86
87
  const isPhone = () => innerWidth <= PHONE;
88
+ if (navigator.maxTouchPoints > 0) wireSettle(window); // a touch screen only: on a desktop the page does not scroll and the nudge is not needed
87
89
  const SVG = (d, w = 16, sw = 1.8) => `<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>`;
88
90
  /** The Everything chip's globe (chief-of-staff C1, board CsA). */
89
91
  const GLOBE = 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18';
@@ -75,19 +75,12 @@ export function mountChat(el, host) {
75
75
  const toEnd = () => { log.scrollTop = log.scrollHeight; if (log.clientHeight && pageScrolls()) { const se = document.scrollingElement || document.documentElement; se.scrollTop = se.scrollHeight; } };
76
76
  if (typeof ResizeObserver === 'function') new ResizeObserver(() => { if (C.jump && log.clientHeight) { toEnd(); if (C.conv) C.jump = false; } }).observe(log);
77
77
  reopen.onclick = () => host.reopenViewer();
78
- // for the place menu's button on a phone (cozy-home.css): the room from the top of the foot to the bottom of the screen, so the button
79
- // sits just above the box and its bars. Not the foot's height: when the page is short the foot ends above the screen's bottom (the page's
80
- // own padding is under it) and a height alone put the button over the box's right end (batch 29 item 2)
81
- const footRoom = () => {
82
- const r = foot.getBoundingClientRect(); if (!r.height) return;
83
- const vh = window.innerHeight || r.bottom;
84
- document.body.style.setProperty('--bd-hmfoot', Math.round(Math.min(Math.max(r.height, vh - r.top), vh - 72)) + 'px');
85
- };
86
- let roomQ = 0;
87
- const roomSoon = () => { if (!roomQ) roomQ = requestAnimationFrame(() => { roomQ = 0; footRoom(); }); };
88
- if (typeof ResizeObserver === 'function') new ResizeObserver(roomSoon).observe(foot);
89
- window.addEventListener('resize', roomSoon, { passive: true });
90
- window.addEventListener('scroll', roomSoon, { passive: true });
78
+ // for the place menu's button on a phone (cozy-home.css): the composer's height. On a phone the composer is fixed to the screen's bottom
79
+ // and the button is fixed just above it, so both sit in the same layer and the height alone places the button. #1280 measured the room
80
+ // from the composer's top to innerHeight instead; after touch scrolling on iOS that room was wrong and the button floated over the
81
+ // messages (batch 30 item 2). The chat also keeps this much room under its last message.
82
+ const footRoom = () => { const h = foot.getBoundingClientRect().height; if (h) document.body.style.setProperty('--bd-hmfoot', Math.round(h) + 'px'); };
83
+ if (typeof ResizeObserver === 'function') new ResizeObserver(footRoom).observe(foot);
91
84
 
92
85
  const role = () => (C.t && C.t.role) || roleOf(C.sess || null, host.roles(), firstUser());
93
86
  const firstUser = () => { const m = ((C.conv && C.conv.messages) || []).find((x) => x.role === 'user'); return m ? m.text : ''; };
@@ -56,4 +56,5 @@ body.cz-home:not(.hm-vw-open) .hm-plw { box-sizing: border-box; width: 100%; max
56
56
  /* a phone chat has no floating menu (the line and the top bar hold what it held), and the log needs no room for it */
57
57
  body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw { display: none; }
58
58
  body.cz-home:not(.hm-plist) .hm-log { padding-bottom: 12px; }
59
+ body.cz-home:not(.hm-plist) #hmFoot::before { content: none; } /* no button, so no fade over the last message (cozy-home.css) */
59
60
  }