create-pmos 0.761.0 → 0.763.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +39 -51
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +38 -0
  7. package/workspace/guide/cli.md +6 -0
  8. package/workspace/guide/home.md +2 -1
  9. package/workspace/guide/notes.md +15 -0
  10. package/workspace/lib/actor.js +8 -3
  11. package/workspace/lib/contradictions.js +137 -0
  12. package/workspace/lib/meeting-focus.js +14 -1
  13. package/workspace/lib/open-questions.js +23 -5
  14. package/workspace/lib/outcome-judge.js +1 -1
  15. package/workspace/lib/outcome-props.js +51 -5
  16. package/workspace/lib/outcomes-cli.js +49 -3
  17. package/workspace/lib/plan-baseline.js +106 -0
  18. package/workspace/lib/proposal-runs.js +1 -1
  19. package/workspace/lib/proposals.js +1 -1
  20. package/workspace/lib/propose-cli.js +16 -7
  21. package/workspace/lib/route-modules.js +1 -0
  22. package/workspace/lib/routes-drift.js +30 -0
  23. package/workspace/lib/routes-meeting-focus.js +6 -1
  24. package/workspace/lib/routes-open-questions.js +9 -2
  25. package/workspace/lib/routes-tracker-sync.js +64 -0
  26. package/workspace/lib/task-jira.js +9 -3
  27. package/workspace/lib/tracker-sync-take.js +92 -0
  28. package/workspace/lib/week-moves.js +8 -2
  29. package/workspace/package-lock.json +2 -2
  30. package/workspace/package.json +1 -1
  31. package/workspace/premium-rec-tab-test.js +2 -1
  32. package/workspace/public/pm/buddy-core.js +162 -0
  33. package/workspace/public/pm/buddy-float.js +63 -0
  34. package/workspace/public/pm/cozy-buddy.css +26 -0
  35. package/workspace/public/pm/cozy-buddy.js +59 -7
  36. package/workspace/public/pm/cozy-rec-tab.js +10 -2
  37. package/workspace/public/pm/cozy-today-app.js +40 -1
  38. package/workspace/public/pm/cozy-today-model.js +27 -0
  39. package/workspace/public/pm/cozy-today-view.js +14 -2
  40. package/workspace/public/pm/cozy-today.css +2 -0
  41. package/workspace/public/pm/moves-view.js +11 -1
  42. package/workspace/public/pm/open-questions-view.js +1 -0
  43. package/workspace/public/premium-buddy.html +4 -0
  44. package/workspace/skills/initiative-propose.skill +2 -2
  45. package/workspace/test-lists/outcome-checks-finish.json +9 -0
  46. package/workspace/test-lists/slip-baseline-contradictions.json +9 -0
  47. package/workspace/test-lists/tracker-sync-on-today.json +9 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.761.0",
3
+ "version": "0.763.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",
@@ -86,7 +86,8 @@ async function context(o = {}) {
86
86
  ok('T1 in the room (no screen) the tab is the light page: no dark stage, no picture', await until(() => tab.evaluate(() => document.getElementById('rt').dataset.mode === 'room' && !document.querySelector('.rt-scr'))), await tab.evaluate(() => document.getElementById('rt').dataset.mode));
87
87
  ok('T1 the header is the clock and the title; the browser tab says the clock', await until(() => tab.evaluate(() => /^\d+:\d{2}$/.test(document.getElementById('rtClock').textContent) && document.getElementById('rtTitle').textContent === 'Design crit' && /^\d+:\d{2} · Design crit$/.test(document.title))));
88
88
  const bar = await tab.evaluate(() => [...document.querySelectorAll('#rtBar > .rt-b')].map((b) => [b.getAttribute('aria-label'), b.textContent.trim()]));
89
- ok('T1 the bar is icon only: Highlight, Pause, then the red Stop (no screenshots toggle in the room)', JSON.stringify(bar.map((x) => x[0])) === JSON.stringify(['Highlight the last 30 seconds', 'Pause', 'Stop the recording']) && bar.every((x) => x[1] === ''), JSON.stringify(bar));
89
+ // meeting-float: Float PMOS over the call sits before Stop where the browser can float a page (Document Picture-in-Picture)
90
+ ok('T1 the bar is icon only: Highlight, Pause, Float where the browser can, then the red Stop (no screenshots toggle in the room)', JSON.stringify(bar.map((x) => x[0]).filter((l) => l !== 'Float PMOS over the call')) === JSON.stringify(['Highlight the last 30 seconds', 'Pause', 'Stop the recording']) && bar.every((x) => x[1] === ''), JSON.stringify(bar));
90
91
  ok('T1 the slots for the Now panel and Present are in the bar', await tab.evaluate(() => !!document.querySelector('#rtBar [data-slot="now"]') && !!document.querySelector('#rtBar [data-slot="present"]')));
91
92
  ok('T1 links in the recording tab open in the other PMOS tab', await tab.evaluate(() => document.querySelector('base').target === 'pmos-main') && await p.evaluate(() => window.name === 'pmos-main'));
92
93
 
@@ -164,3 +164,165 @@ export function heardHtml(m) {
164
164
  const h = consentHtml(m) + nudgeHtml(m) + filedHtml(m) + draftsHtml(m);
165
165
  return h ? `<div class="mb-card">${h}</div>` : '';
166
166
  }
167
+
168
+ /* ── the float (initiative meeting-float; Exploring 3, page "Meeting companion floats over the call") ─────────────────────────────────────
169
+ * walkInModel(F, { now }) → { title, at, startsIn, rows } | null the walk-in card: 2 min before the start until PMOS listens
170
+ * walkInHtml(w) → string
171
+ * openModel(F, m) → { forTopic, people, filed } the wide view (the open size)
172
+ * openHtml(m, o) → string two columns: Now and For this topic · People, Filed, drafts
173
+ * roomModel(F, m) → { asked, table, agreed } room view: what the user shares on screen in the call
174
+ * roomHtml(m, r) → string no private row and no press: no drafts, consent, Undo, own asks, People */
175
+ export const WALK_BEFORE_MIN = 2, WALK_AFTER_MIN = 10;
176
+ const MINE = /^(me|i|you|myself|pm)$/i;
177
+ const OPEN_MAX = 6, ROOM_ASKED_MAX = 4;
178
+ const dayOf = (iso) => { const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return ''; const d = new Date(t); return d.getDate() + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()]; };
179
+ const tokens = (s) => String(s == null ? '' : s).toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);
180
+ /** Which attendee an owner names: the attendee's full name, or a first name both share. null when none. */
181
+ export function attendeeOf(owner, attendees) {
182
+ const o = tokens(owner); if (!o.length) return null;
183
+ for (const a of attendees || []) {
184
+ const t = tokens(a); if (!t.length) continue;
185
+ if (t.join(' ') === o.join(' ') || t[0] === o[0]) return String(a);
186
+ }
187
+ return null;
188
+ }
189
+ const iniHref = (ini) => (ini && ini.id ? '/premium.html?ini=' + encodeURIComponent(ini.id) : null);
190
+ const goalText = (g) => (g && g.title ? clip(g.title, 90) : '');
191
+ /** What each side owes, from the last meeting's actions and the user's own late items. */
192
+ function owesOf(f) {
193
+ const b = f.brief || {}; const att = (f.event && f.event.attendees) || [];
194
+ const theirs = [], mine = [];
195
+ for (const a of (b.last && Array.isArray(b.last.actions) ? b.last.actions : [])) {
196
+ if (!a || !a.text) continue;
197
+ const text = clip(a.text, 140) + (a.due ? ', due ' + (dayOf(a.due) || a.due) : '');
198
+ if (a.owner && MINE.test(String(a.owner).trim())) mine.push({ who: '', text });
199
+ else { const who = attendeeOf(a.owner, att); if (who) theirs.push({ who, text }); }
200
+ }
201
+ for (const x of Array.isArray(b.matters) ? b.matters : []) if (x && /^yours\b/.test(String(x.meta || '')) && x.text) mine.push({ who: '', text: clip(x.text, 140) });
202
+ return { theirs, mine };
203
+ }
204
+ /** The one thing to settle: a blocked item, then a late one, then decisions from last time still to confirm. */
205
+ function settleOf(b) {
206
+ const M = Array.isArray(b.matters) ? b.matters : [];
207
+ const blocked = M.find((x) => x && x.tag === 'Blocked'); if (blocked) return clip(blocked.text, 160);
208
+ const late = M.find((x) => x && x.tag === 'Late'); if (late) return clip(late.text, 140) + ': late';
209
+ const n = b.last && b.last.to_confirm; if (n > 0) return n + (n === 1 ? ' decision' : ' decisions') + ' from last time to confirm';
210
+ return '';
211
+ }
212
+ function iniRow(b) {
213
+ const ini = b.initiative; if (!ini || !ini.title) return null;
214
+ const blocked = (Array.isArray(b.matters) ? b.matters : []).filter((x) => x && x.tag === 'Blocked').length;
215
+ return { label: 'Work', text: clip(ini.title, 100) + (ini.status ? ' · ' + ini.status : ''), tag: blocked ? blocked + ' blocked' : '', sub: goalText(ini.goal) ? 'Goal: ' + goalText(ini.goal) : '', href: iniHref(ini) };
216
+ }
217
+ function goalRow(b) {
218
+ const g = b.initiative && b.initiative.goal; if (!g || !g.title) return null;
219
+ return { label: 'Goal', text: goalText(g), sub: g.kind === 'health' ? 'Health budget' : g.kind === 'objective' ? 'Objective' : 'Key result' };
220
+ }
221
+ function lastDecisionRow(b) {
222
+ const d = b.last && Array.isArray(b.last.decisions) ? b.last.decisions[0] : null; if (!d) return null;
223
+ const on = dayOf(b.last.at);
224
+ return { label: 'Decided before' + (on ? ' · ' + on : ''), text: clip(d, 160), sub: b.last.title ? 'From the notes of ' + clip(b.last.title, 60) : '' };
225
+ }
226
+ function docRows(f) {
227
+ const out = []; const seen = new Set();
228
+ const call = f.event && f.event.call ? f.event.call.url : '';
229
+ for (const m of Array.isArray(f.material) ? f.material : []) {
230
+ const title = m && (m.title || m.url || m.ref); if (!title) continue;
231
+ const url = m.url && /^https:\/\//i.test(m.url) ? m.url : null;
232
+ const k = url || title; if (seen.has(k)) continue; seen.add(k);
233
+ out.push({ label: 'Document', text: clip(title, 100), sub: 'Linked to the meeting', href: url });
234
+ }
235
+ for (const l of f.event && Array.isArray(f.event.links) ? f.event.links : []) {
236
+ if (!l || !l.url || l.url === call || seen.has(l.url) || !/^https:\/\//i.test(l.url)) continue;
237
+ seen.add(l.url); out.push({ label: 'Document', text: clip(l.label || l.url, 100), sub: 'In the invite', href: l.url });
238
+ }
239
+ return out.slice(0, 3);
240
+ }
241
+
242
+ export function walkInModel(F, { now = Date.now() } = {}) {
243
+ const f = F && F.ok ? F : {};
244
+ const ev = f.event; if (!ev || f.talk) return null;
245
+ const st = f.note ? f.note.state : null;
246
+ if (st === 'recording' || st === 'paused' || st === 'ended') return null;
247
+ const start = Date.parse(ev.at || ''); if (!Number.isFinite(start)) return null;
248
+ if (now < start - WALK_BEFORE_MIN * 60000 || now >= start + WALK_AFTER_MIN * 60000) return null;
249
+ const b = f.brief || {};
250
+ const rows = [];
251
+ if (b.initiative && b.initiative.title) rows.push({ label: 'For', text: clip(b.initiative.title, 100) + (goalText(b.initiative.goal) ? ' · ' + goalText(b.initiative.goal) : ''), href: iniHref(b.initiative) });
252
+ const o = owesOf(f);
253
+ for (const x of o.theirs.slice(0, 2)) rows.push({ label: 'Owed to you', who: x.who.split(/\s+/)[0], text: x.text });
254
+ for (const x of o.mine.slice(0, 2)) rows.push({ label: 'You owe', text: x.text });
255
+ const d = lastDecisionRow(b); if (d) rows.push({ label: d.label.replace('Decided before', 'Last decision'), text: d.text });
256
+ const s = settleOf(b); if (s) rows.push({ label: 'Settle today', text: s, settle: true });
257
+ if (!rows.length) return null;
258
+ return { title: clip(ev.title, 120), at: hm(start), startsIn: Math.round((start - now) / 60000), rows };
259
+ }
260
+ export function walkInHtml(w) {
261
+ if (!w) return '';
262
+ const when = w.startsIn > 0 ? 'Starts in ' + w.startsIn + ' min · ' + w.at : w.startsIn === 0 ? 'Starts now · ' + w.at : 'Started ' + -w.startsIn + ' min ago · ' + w.at;
263
+ return `<section class="mb-walk" aria-label="Before the meeting"><div class="mb-wh"><small>${esc(when)}</small><b>${esc(w.title)}</b></div>`
264
+ + w.rows.map((r) => `<div class="mb-r${r.settle ? ' mb-settle' : ''}"><span class="t"><small>${esc(r.label)}</small>${r.who ? '<b>' + esc(r.who) + '</b> · ' : ''}${esc(r.text)}</span>`
265
+ + (r.href ? `<a class="mb-ib pm-btn" href="${esc(r.href)}" target="_blank" rel="noopener noreferrer" aria-label="Open it" title="Open it">${svg(P.open)}</a>` : r.settle ? `<span class="mb-spark">${svg(P.spark, 14)}</span>` : '') + '</div>').join('')
266
+ + '</section>';
267
+ }
268
+
269
+ export function openModel(F, m) {
270
+ const f = F && F.ok ? F : {}; const b = f.brief || {};
271
+ const forTopic = [];
272
+ const notes = Array.isArray(f.notes) ? f.notes : [];
273
+ for (const n of notes.slice().reverse()) {
274
+ if (forTopic.length >= 3 || !n || n.ask || !['Context', 'Fact check', 'Decision', 'Follow-up'].includes(n.cat)) continue;
275
+ const act = (n.acts || []).find((a) => hrefOf(a));
276
+ forTopic.push({ label: n.cat === 'Context' ? 'Context' : n.cat, text: clip(n.body, 200), sub: n.src ? clip(n.src, 80) : '', href: act ? hrefOf(act) : null });
277
+ }
278
+ for (const c of Array.isArray(f.chips) ? f.chips : []) {
279
+ if (forTopic.length >= 4) break;
280
+ const href = hrefOf(c); if (!href) continue;
281
+ forTopic.push({ label: 'Context', text: clip(c.label + (c.sub ? ' · ' + c.sub : ''), 160), sub: '', href });
282
+ }
283
+ for (const r of [iniRow(b), lastDecisionRow(b), ...docRows(f)]) if (r && forTopic.length < OPEN_MAX + 2) forTopic.push(r);
284
+ const o = owesOf(f);
285
+ const people = ((f.event && f.event.attendees) || []).slice(0, 8).map((name) => {
286
+ const theirs = o.theirs.filter((x) => x.who === name).map((x) => 'Owes you ' + x.text);
287
+ return { name: clip(name, 60), initials: tokens(name).slice(0, 2).map((t) => t[0].toUpperCase()).join(''), sub: theirs[0] || '' };
288
+ });
289
+ const cap = f.captured || {};
290
+ const filed = [];
291
+ for (const [kind, key] of [['decision', 'decisions'], ['action', 'actions'], ['question', 'questions']]) {
292
+ for (const x of Array.isArray(cap[key]) ? cap[key] : []) if (x && x.bid && x.text) filed.push({ kind, label: 'Filed · ' + KIND_WORD[kind], text: clip(x.text, 200), bid: String(x.bid) });
293
+ }
294
+ filed.sort((a, b2) => a.bid.localeCompare(b2.bid, 'en', { numeric: true }));
295
+ return { forTopic, people, filed, youOwe: o.mine.slice(0, 3) };
296
+ }
297
+ const listRow = (r) => `<div class="mb-r"><span class="t"><small>${esc(r.label)}</small>${esc(r.text)}${r.tag ? ` <span class="mb-tag">${esc(r.tag)}</span>` : ''}${r.sub ? `<span class="mb-src">${esc(r.sub)}</span>` : ''}</span>`
298
+ + (r.href ? `<a class="mb-ib pm-btn" href="${esc(r.href)}" target="_blank" rel="noopener noreferrer" aria-label="Open it" title="Open it">${svg(P.open)}</a>` : '') + '</div>';
299
+ const sec = (t, n) => `<div class="mb-sec">${esc(t)}${n != null ? ` <span>${esc(n)}</span>` : ''}</div>`;
300
+ export function openHtml(m, o) {
301
+ const left = topicHtml(m) + nowHtml(m) + nudgeHtml(m) + consentHtml(m)
302
+ + (o.forTopic.length ? `<div class="mb-sec"><span class="mb-spark">${svg(P.spark, 12)}</span>For this topic</div>` + o.forTopic.map(listRow).join('') : '') + answerHtml(m);
303
+ const people = o.people.length ? sec('People', o.people.length + ' in the invite') + o.people.map((p) => `<div class="mb-r mb-person"><span class="mb-av" aria-hidden="true">${esc(p.initials)}</span><span class="t">${esc(p.name)}${p.sub ? `<span class="mb-src">${esc(p.sub)}</span>` : ''}</span></div>`).join('') : '';
304
+ const owe = o.youOwe.length ? sec('You owe') + o.youOwe.map((x) => `<div class="mb-r"><span class="t">${esc(x.text)}</span></div>`).join('') : '';
305
+ const filed = o.filed.length ? sec('Filed', o.filed.length) + o.filed.map((x) => row(x.label, esc(x.text), ib('undo', 'Undo: take it out of the notes', P.undo, ` data-bid="${esc(x.bid)}"`))).join('') : '';
306
+ const right = people + owe + filed + draftsHtml(m);
307
+ return `<div class="mb-wide"><div class="mb-col">${left}</div>${right ? `<div class="mb-col">${right}</div>` : ''}</div>`;
308
+ }
309
+
310
+ export function roomModel(F, m) {
311
+ const f = F && F.ok ? F : {}; const b = f.brief || {};
312
+ const notes = Array.isArray(f.notes) ? f.notes : [];
313
+ const asked = notes.filter((n) => n && !n.ask && n.heard && (n.cat === 'Answer' || n.cat === 'Fact check')).slice(-ROOM_ASKED_MAX)
314
+ .map((n) => ({ heard: clip(n.heard, 200), body: clip(n.body, 400), src: n.from && n.from.length ? 'From ' + n.from.map((k) => FROM_WORDS[k]).filter(Boolean).join(' and ') : n.src ? clip(n.src, 80) : '' }));
315
+ const table = [goalRow(b), iniRow(b), ...docRows(f)].filter(Boolean).map((r) => ({ ...r, href: null, sub: r.label === 'Work' ? '' : r.sub }));
316
+ const cap = f.captured || {};
317
+ const agreed = [...(cap.decisions || []).map((x) => ({ label: 'Decision', text: x && x.text })), ...(cap.actions || []).map((x) => ({ label: 'Action', text: x && x.text }))]
318
+ .filter((x) => x.text).slice(-6).map((x) => ({ label: x.label, text: clip(x.text, 200) }));
319
+ return { asked, table, agreed };
320
+ }
321
+ export function roomHtml(m, r) {
322
+ const asked = r.asked.map((a) => `<div class="mb-r mb-heard"><span class="t"><small>Asked in the room</small>${esc(a.heard)}</span></div>`
323
+ + `<div class="mb-r"><span class="t"><small>PMOS</small>${esc(a.body)}${a.src ? `<span class="mb-src">${esc(a.src)}</span>` : ''}</span><span class="mb-spark">${svg(P.spark, 14)}</span></div>`).join('');
324
+ const left = topicHtml(m) + nowHtml(m) + (asked || '<div class="mb-r mb-quiet"><span class="t mb-sm">Ask PMOS out loud: a number, a date, what was decided. The answer shows here.</span></div>');
325
+ const right = (r.table.length ? `<div class="mb-sec"><span class="mb-spark">${svg(P.spark, 12)}</span>On the table</div>` + r.table.map(listRow).join('') : '')
326
+ + (r.agreed.length ? sec('Agreed so far') + r.agreed.map((x) => row(x.label, esc(x.text))).join('') : '');
327
+ return `<div class="mb-wide mb-room"><div class="mb-col">${left}</div>${right ? `<div class="mb-col">${right}</div>` : ''}</div>`;
328
+ }
@@ -0,0 +1,63 @@
1
+ /* pm/buddy-float.js — the meeting buddy as a window that stays on top of the call app (initiative meeting-float; Exploring 3, page
2
+ * "Meeting companion floats over the call", boards Float starts here, Three sizes).
3
+ *
4
+ * Chrome's Document Picture-in-Picture: a small window the operating system keeps above every other window, Zoom and Teams desktop
5
+ * included. No install and no permission. The window frames the buddy page (/premium-buddy.html?float=1…), so every press is the
6
+ * buddy's own. The page that opens it must stay open (the recording tab, which never navigates away while it records).
7
+ *
8
+ * SIZES · sizeOf(name) → { w, h } pill 300 × 72, card 360 × 480, open 780 × 720; anything else is the card
9
+ * floatUrl({ event, date, note, ws }) → the framed page's address
10
+ * floatable(win) → bool the browser can float a page (Chrome or Edge on a computer)
11
+ * openFloat({ url, size, win }) → Promise<Window | null> opens it, or brings an open one forward; null when it cannot
12
+ * The framed page asks for another size with postMessage({ pmosFloat: 'size', size }); the window remembers the last size in this browser.
13
+ * Every open is one use-log line (control meetFloatOpen): local only, the health number of meeting-float. */
14
+ export const SIZES = Object.freeze({ pill: Object.freeze({ w: 300, h: 72 }), card: Object.freeze({ w: 360, h: 480 }), open: Object.freeze({ w: 780, h: 720 }) });
15
+ export const sizeOf = (name) => SIZES[Object.prototype.hasOwnProperty.call(SIZES, name) ? name : 'card'];
16
+ const KEY = 'pmos.float.size';
17
+ export function floatUrl({ event = '', date = '', note = '', ws = '' } = {}) {
18
+ const q = new URLSearchParams({ float: '1' });
19
+ if (event) q.set('event', event);
20
+ if (date) q.set('date', date);
21
+ if (note) q.set('note', note);
22
+ if (ws) q.set('ws', ws);
23
+ return '/premium-buddy.html?' + q.toString();
24
+ }
25
+ export function floatable(win = typeof window !== 'undefined' ? window : null) {
26
+ if (!win || !win.documentPictureInPicture || typeof win.documentPictureInPicture.requestWindow !== 'function') return false;
27
+ try { if (typeof win.matchMedia === 'function' && win.matchMedia('(max-width: 760px)').matches) return false; } catch { /* no media query: a computer */ }
28
+ return true;
29
+ }
30
+ const lastSize = (win) => { try { const s = win.localStorage.getItem(KEY); return SIZES[s] ? s : 'card'; } catch { return 'card'; } };
31
+ const keepSize = (win, s) => { try { win.localStorage.setItem(KEY, s); } catch { /* a blocked store: the next float opens as a card */ } };
32
+
33
+ export async function openFloat({ url, size, win = window } = {}) {
34
+ if (!floatable(win)) return null;
35
+ const D = win.documentPictureInPicture;
36
+ if (D.window && !D.window.closed) {
37
+ const fr = D.window.document.querySelector('iframe');
38
+ if (fr && url && fr.dataset.src !== url) { fr.src = url; fr.dataset.src = url; }
39
+ try { D.window.focus(); } catch { /* the system keeps the focus */ }
40
+ return D.window;
41
+ }
42
+ const name = size || lastSize(win);
43
+ const s = sizeOf(name);
44
+ let pip = null;
45
+ try { pip = await D.requestWindow({ width: s.w, height: s.h }); } catch { return null; }
46
+ const doc = pip.document;
47
+ doc.title = 'PMOS';
48
+ const st = doc.createElement('style');
49
+ st.textContent = 'html,body{margin:0;height:100%;overflow:hidden}iframe{border:0;width:100%;height:100%;display:block}';
50
+ doc.head.appendChild(st);
51
+ const fr = doc.createElement('iframe');
52
+ fr.title = 'PMOS'; fr.src = url; fr.dataset.src = url; fr.allow = 'clipboard-write';
53
+ doc.body.appendChild(fr);
54
+ pip.addEventListener('message', (e) => {
55
+ const d = e && e.data;
56
+ if (!d || d.pmosFloat !== 'size' || !SIZES[d.size] || e.source !== fr.contentWindow) return;
57
+ const z = sizeOf(d.size);
58
+ try { pip.resizeTo(z.w, z.h); } catch { /* the window keeps its size; the page still lays out for the new one */ }
59
+ keepSize(win, d.size);
60
+ });
61
+ try { const U = await import('./use-log.js'); if (U && typeof U.noteUse === 'function') U.noteUse('meetFloatOpen'); } catch { /* the log is optional */ }
62
+ return pip;
63
+ }
@@ -49,3 +49,29 @@ body.pm-ds.mb-page { margin: 0; height: 100vh; overflow: hidden; background: var
49
49
  .mb-card { border-radius: var(--radius-card); background: var(--card); border: 1px solid var(--line); box-shadow: var(--raise); overflow: hidden; }
50
50
  .mb-card > :last-child { border-bottom: 0; }
51
51
  .mb-clip { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
52
+
53
+ /* the float (initiative meeting-float): the same page in a window on top of the call app. pill · card · open; room view to share */
54
+ .mb-fl[hidden] { display: none; }
55
+ .mb-fl.on { color: var(--blue); }
56
+ body.mb-pill .mb-b, body.mb-pill .mb-msg, body.mb-pill .mb-ask { display: none; }
57
+ body.mb-pill .mb-h { border-bottom: 0; }
58
+ .mb-wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
59
+ .mb-wide > .mb-col + .mb-col { border-left: 1px solid var(--line); }
60
+ .mb-col > :last-child { border-bottom: 0; }
61
+ .mb-sec { display: flex; align-items: center; gap: 6px; padding: 10px 14px 2px; font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--muted); }
62
+ .mb-sec span { font-weight: var(--fw-regular); }
63
+ .mb-sec .mb-spark { padding-top: 0; }
64
+ .mb-tag { display: inline-block; padding: 0 6px; border-radius: var(--radius-sm); background: var(--alert-tint); color: var(--alert); font-size: var(--fs-meta); }
65
+ .mb-person { align-items: center; }
66
+ .mb-av { width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--well); color: var(--muted); font-size: var(--fs-meta); font-weight: var(--fw-strong); display: inline-flex; align-items: center; justify-content: center; flex: none; }
67
+ .mb-heard { background: var(--leaf-tint); }
68
+ .mb-room .mb-r { font-size: var(--fs-body); }
69
+ .mb-quiet { border-bottom: 0; }
70
+ /* the walk-in card: 2 minutes before the meeting */
71
+ .mb-walk { border-bottom: 1px solid var(--line); }
72
+ .mb-wh { padding: 12px 14px 4px; }
73
+ .mb-wh small { display: block; font-size: var(--fs-meta); color: var(--muted); }
74
+ .mb-wh b { font-size: var(--fs-body); }
75
+ .mb-walk .mb-r:last-child { border-bottom: 0; }
76
+ .mb-settle { background: var(--blue-tint); }
77
+ @media (max-width: 560px) { .mb-wide { grid-template-columns: minmax(0, 1fr); } .mb-wide > .mb-col + .mb-col { border-left: 0; border-top: 1px solid var(--line); } }
@@ -11,9 +11,17 @@
11
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
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
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. */
14
+ * Fold sends { pmosFocus: 'fold' | 'open' } to the panel, which shrinks to a pill.
15
+ *
16
+ * The float (initiative meeting-float, ?float=1): the page in a window on top of the call app (pm/buddy-float.js frames it). Fold makes a
17
+ * pill, Open wide shows two columns (For this topic · People, Filed), Room view is what the user shares on screen: answers to what the
18
+ * room asked, what is on the table and what was agreed, with no private row. Each size change asks the window for its size
19
+ * ({ pmosFloat: 'size', size }). From 2 minutes before the meeting until PMOS listens, the walk-in card leads the page (buddy-core.js
20
+ * walkInModel); a pill opens to a card for it once per meeting. A float that named no meeting finds the next one when this one is over.
21
+ * Opened in a tab of its own (not framed), the page offers the Float icon itself. */
15
22
  import { pmGet, pmPost } from './http.js';
16
- import { buddyModel, buddyHtml, headOf, marksOf } from './buddy-core.js';
23
+ import { buddyModel, buddyHtml, headOf, marksOf, walkInModel, walkInHtml, openModel, openHtml, roomModel, roomHtml } from './buddy-core.js';
24
+ import { floatable, openFloat, floatUrl, SIZES } from './buddy-float.js';
17
25
  import { press, newMem, mergeMarks } from './buddy-press.js';
18
26
  import { recCore } from './premium-meeting.js';
19
27
 
@@ -21,7 +29,10 @@ const q = new URLSearchParams(location.search);
21
29
  const $ = (id) => document.getElementById(id);
22
30
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
31
  const READ_MS = 10000, ASK_MS = 3000;
24
- const S = { ev: null, date: '', F: null, html: '', folded: false, timer: null, busy: false };
32
+ const S = { ev: null, date: '', F: null, html: '', folded: false, timer: null, busy: false, size: 'card', room: false, popped: new Set() };
33
+ const FLOAT = q.get('float') === '1';
34
+ const FRAMED = window.parent !== window;
35
+ const useLog = (c) => { import('./use-log.js').then((U) => { if (U.startUseLog) U.startUseLog(); if (U.noteUse) U.noteUse(c); }).catch(() => {}); }; // meeting-float's health number, local only
25
36
 
26
37
  const ls = () => { try { return window.localStorage; } catch { return null; } };
27
38
  const MEM = newMem(); // the PM's marks when the store is blocked: this view only
@@ -33,22 +44,29 @@ function draw() {
33
44
  const m = buddyModel(S.F, L);
34
45
  const h = headOf(m);
35
46
  $('mbDot').className = 'mb-dot ' + h.tone;
36
- $('mbHead').textContent = (S.ev ? h.text : 'Looking for the meeting');
37
- let body = buddyHtml(m);
47
+ $('mbHead').textContent = !S.ev ? 'Looking for the meeting' : FLOAT && S.room ? (m.listening ? 'Room view · listening to the room' : 'Room view') : h.text;
48
+ const w = walkInModel(S.F, { now: Date.now() });
49
+ // the walk-in card opens a pill once per meeting (meeting-float, board Walk-in card)
50
+ if (w && FLOAT && S.size === 'pill' && m.eventId && !S.popped.has(m.eventId)) { S.popped.add(m.eventId); setSize('card'); }
51
+ let body = FLOAT && S.room ? roomHtml(m, roomModel(S.F, m)) : FLOAT && S.size === 'open' ? openHtml(m, openModel(S.F, m)) : buddyHtml(m);
38
52
  if (!m.listening && !m.paused && S.ev) {
39
53
  body = `<div class="mb-r mb-start"><span class="t"><small>${esc(m.title)}</small>PMOS is not listening to this meeting.</span>`
40
54
  + `<button type="button" class="mb-ib pm-btn go primary" 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
55
  }
56
+ if (w && !(FLOAT && S.room)) body = walkInHtml(w) + body; // the walk-in card leads, above the play icon
42
57
  if (body !== S.html) { S.html = body; $('mbBody').innerHTML = body; }
43
- $('mbAsk').hidden = !S.ev || S.folded;
58
+ $('mbAsk').hidden = !S.ev || S.folded || (FLOAT && S.room);
44
59
  const working = m.answer && m.answer.state === 'working';
45
60
  clearTimeout(S.timer); S.timer = setTimeout(read, working ? ASK_MS : READ_MS);
46
61
  }
47
62
 
48
63
  async function read() {
49
64
  if (!S.ev) return;
50
- const F = await pmGet('/api/meeting-focus?event=' + encodeURIComponent(S.ev.id) + '&date=' + encodeURIComponent(S.date));
65
+ const F = await pmGet('/api/meeting-focus?event=' + encodeURIComponent(S.ev.id) + '&date=' + encodeURIComponent(S.date) + (q.get('ws') ? '&ws=' + encodeURIComponent(q.get('ws')) : ''));
51
66
  if (F && F.ok) { S.F = F; say(''); } else if (!S.F) say((F && F.error) || 'PMOS did not answer.');
67
+ // a float that named no meeting moves on to the next one 10 minutes after this one ends
68
+ const end = F && F.ok && F.event ? Date.parse(F.event.end || '') : NaN;
69
+ if (FLOAT && !q.get('event') && Number.isFinite(end) && Date.now() > end + 600000 && !(F.note && F.note.state === 'recording')) { S.ev = null; S.F = null; S.html = ''; return find(); }
52
70
  draw();
53
71
  }
54
72
 
@@ -82,6 +100,7 @@ document.addEventListener('click', async (e) => {
82
100
  const b = e.target.closest('[data-mb]'); if (!b || b.disabled) return;
83
101
  const act = b.dataset.mb;
84
102
  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; }
103
+ if (FLOAT) useLog('meetFloatAct');
85
104
  if (act === 'listen') { b.disabled = true; try { await listen(); } finally { b.disabled = false; } return; }
86
105
  b.disabled = true;
87
106
  let r = null;
@@ -104,7 +123,40 @@ $('mbAsk').addEventListener('submit', async (e) => {
104
123
  read();
105
124
  });
106
125
 
126
+ /* the float's sizes (meeting-float): the window takes the size; the page lays out for it */
127
+ function setSize(size) {
128
+ if (!SIZES[size]) return;
129
+ S.size = size; S.folded = size === 'pill';
130
+ document.body.classList.toggle('mb-pill', size === 'pill'); document.body.classList.toggle('mb-open', size === 'open');
131
+ const g = $('mbGrow'); const wide = size === 'open';
132
+ g.setAttribute('aria-label', wide ? 'Back to a card' : 'Open wide'); g.title = g.getAttribute('aria-label');
133
+ g.innerHTML = g.innerHTML.replace(/d="[^"]*"/, wide ? 'd="M10 4v6H4M14 20v-6h6M4 10l6-6M20 14l-6 6"' : 'd="M4 14v6h6M20 10V4h-6M4 20l7-7M20 4l-7 7"');
134
+ const f = $('mbFold'); f.setAttribute('aria-expanded', String(size !== 'pill'));
135
+ f.setAttribute('aria-label', size === 'pill' ? 'Open PMOS' : 'Fold to a pill'); f.title = f.getAttribute('aria-label');
136
+ if (FRAMED) window.parent.postMessage({ pmosFloat: 'size', size }, location.origin);
137
+ S.html = ''; draw();
138
+ }
139
+ if (FLOAT) {
140
+ document.body.classList.add('mb-float');
141
+ $('mbGrow').hidden = false; $('mbRoom').hidden = false;
142
+ let s0 = 'card'; try { const s = localStorage.getItem('pmos.float.size'); if (SIZES[s]) s0 = s; } catch { /* a card */ }
143
+ if (s0 !== 'card') setSize(s0);
144
+ useLog('meetFloatShown');
145
+ $('mbGrow').addEventListener('click', () => setSize(S.size === 'open' ? 'card' : 'open'));
146
+ $('mbRoom').addEventListener('click', () => {
147
+ S.room = !S.room; const r = $('mbRoom'); r.classList.toggle('on', S.room); r.setAttribute('aria-pressed', String(S.room));
148
+ r.setAttribute('aria-label', S.room ? 'Back to your own view' : 'Room view: share this window in the call'); r.title = r.getAttribute('aria-label');
149
+ document.body.classList.toggle('mb-roomview', S.room);
150
+ if (S.room && S.size !== 'open') setSize('open'); else { S.html = ''; draw(); }
151
+ });
152
+ } else if (!FRAMED && floatable()) {
153
+ // a buddy tab of its own: it can float itself (it stays open, so the float lives as long as this tab)
154
+ $('mbFloat').hidden = false;
155
+ $('mbFloat').addEventListener('click', () => { openFloat({ url: floatUrl({ event: S.ev ? S.ev.id : '', date: S.date }) }); });
156
+ }
157
+
107
158
  $('mbFold').addEventListener('click', () => {
159
+ if (FLOAT) { setSize(S.size === 'pill' ? 'card' : 'pill'); return; }
108
160
  S.folded = !S.folded;
109
161
  document.body.classList.toggle('folded', S.folded);
110
162
  const b = $('mbFold'); b.setAttribute('aria-expanded', String(!S.folded));
@@ -11,7 +11,8 @@
11
11
  * (microphone only) there is no dark stage: the light page, which slice S2 (cozy-rec-now.js) fills. Paused and not yet
12
12
  * started each say so, with the one press that goes on.
13
13
  * line the meeting so far, with a mark for each highlight; hover or focus a mark for the moment: its time, the line, the shot.
14
- * bar icon only: Highlight, Pause or Resume, Pause the screenshots (only with a screen), the slots, and the red Stop.
14
+ * bar icon only: Highlight, Pause or Resume, Pause the screenshots (only with a screen), Float PMOS over the call (meeting-float:
15
+ * the meeting buddy in a window on top of the call app, where the browser can), the slots, and the red Stop.
15
16
  * alert amber "Not hearing the meeting" with Share again, when the microphone is heard and the meeting is not.
16
17
  * ask Stop asks first. Record on the next meeting, pressed on another page, asks here once: "Stop X and record Y?".
17
18
  * Stop ends the meeting, and the tab then shows its notes (the Viewer, /premium-viewer.html?open=meeting).
@@ -31,6 +32,7 @@ import { recCore, STOP_LINE } from './premium-meeting.js';
31
32
  import { post, listen, tabUrl, clockOf, modeOf, endOf, marksOf } from './rec-tab-core.js';
32
33
  import { adler } from './cozy-adler.js';
33
34
  import { recall, remember } from './listen-sources.js';
35
+ import { floatable, openFloat, floatUrl } from './buddy-float.js';
34
36
 
35
37
  const q = new URLSearchParams(location.search);
36
38
  const ID = q.get('note') || '', WS = q.get('ws') || '';
@@ -44,7 +46,7 @@ const wall = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' +
44
46
  const P = { star: '<path d="M12 3.8l2.5 5.2 5.7.8-4.1 4 1 5.7L12 16.8l-5.1 2.7 1-5.7-4.1-4 5.7-.8z"/>', pause: '<path d="M9 6v12M15 6v12"/>', play: '<path d="M8 5v14l11-7z"/>',
45
47
  stop: '<rect x="7" y="7" width="10" height="10" rx="2"/>', eyeoff: '<path d="M3 3l18 18M10.6 6.1A9.8 9.8 0 0 1 12 6c5 0 9 6 9 6a15 15 0 0 1-3 3.5M6.6 6.7C4.3 8.2 3 12 3 12s4 6 9 6a8.6 8.6 0 0 0 4.3-1.1M9.9 9.9a3 3 0 0 0 4.2 4.2"/>',
46
48
  eye: '<path d="M3 12s4-6 9-6 9 6 9 6-4 6-9 6-9-6-9-6z"/><circle cx="12" cy="12" r="3"/>', share: '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M12 13V7M9 10l3-3 3 3M8 20h8"/>',
47
- rec: '<circle cx="12" cy="12" r="6"/>' };
49
+ rec: '<circle cx="12" cy="12" r="6"/>', float: '<rect x="4" y="5" width="16" height="11" rx="1.5"/><rect x="12" y="11" width="6" height="5" rx="1"/>' };
48
50
  const svg = (k, w = 18) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24">${P[k]}</svg>`;
49
51
  const btn = (a, label, icon, cls = '') => `<button type="button" class="rt-b${cls ? ' ' + cls : ''}" data-a="${a}" aria-label="${esc(label)}" title="${esc(label)}">${svg(icon, a === 'stop' ? 20 : 18)}</button>`;
50
52
 
@@ -93,6 +95,7 @@ function drawBar() {
93
95
  const parts = [];
94
96
  if (live) parts.push(btn('hl', 'Highlight the last 30 seconds', 'star'), btn('pause', 'Pause', 'pause'));
95
97
  else if (S.mode === 'paused') parts.push(btn('resume', 'Resume', 'play', 'dark'));
98
+ if ((live || S.mode === 'paused') && floatable()) parts.push(btn('float', 'Float PMOS over the call', 'float'));
96
99
  if (S.mode === 'screen') parts.push(scr.paused ? btn('shots', 'Keep screenshots again', 'eye', 'on') : btn('shots', 'Pause the screenshots (the sound goes on)', 'eyeoff'));
97
100
  bar.innerHTML = parts.join('');
98
101
  for (const k of ['now', 'present']) { const s = keep[k] || Object.assign(document.createElement('span'), { className: 'rt-slot' }); s.dataset.slot = k; bar.appendChild(s); }
@@ -203,6 +206,11 @@ async function act(a, t) {
203
206
  case 'resume': case 'start': return run(async () => { const r = await C.resume(ID); S.msg = r.ok ? '' : r.error; });
204
207
  case 'share': return run(async () => { await C.pause(); const r = await C.resume(ID); S.msg = r.ok ? '' : r.error; });
205
208
  case 'shots': { C.shots(!C.screen().paused); return draw(); }
209
+ case 'float': { // meeting-float: requestWindow needs this press, so nothing is awaited before it
210
+ const e = eventOf();
211
+ openFloat({ url: floatUrl({ event: e && e.id ? e.id : '', date: e ? e.date : '', ws: WS }) }).then((w) => { if (!w) { S.msg = 'This browser cannot float PMOS. Use Chrome or Edge on a computer.'; draw(); } });
212
+ return;
213
+ }
206
214
  case 'stop': S.ask = { kind: 'stop' }; return drawAsk();
207
215
  case 'askno': S.ask = null; drawAsk(); return draw();
208
216
  case 'stopgo': S.ask = null; drawAsk(); return run(async () => { const r = await C.stop(ID); S.msg = r.ok ? '' : r.error; if (r.ok) post({ id: ID, state: 'ended', title: title(), elapsedMs: elapsed(), silent: false }); });
@@ -43,6 +43,7 @@ export function mountToday(ctx) {
43
43
  readQuestions();
44
44
  readLine();
45
45
  readDigest();
46
+ readSync();
46
47
  }
47
48
  /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
48
49
  * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
@@ -58,6 +59,25 @@ export function mountToday(ctx) {
58
59
  X.questions = lines;
59
60
  draw();
60
61
  }
62
+ /* tracker-sync-on-today (board TrackerSyncDesk): each product's sync with its tracker (GET /api/tracker-sync). Only a product below 95%
63
+ * gets a ✦ row (TM.syncSuggest); ✕ hides it until its number changes (kept in this browser). */
64
+ const SYNC_NO = 'pmos.today.syncNo';
65
+ function syncHidden() { try { return new Map(Object.entries(JSON.parse(localStorage.getItem(SYNC_NO) || '{}'))); } catch { return new Map(); } }
66
+ async function readSync() {
67
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
68
+ const W = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
69
+ const got = await Promise.all(W.map((ws) => ctx.pmGet('/api/tracker-sync' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
70
+ X.sync = got.filter((r) => r && r.ok);
71
+ const low = X.sync.filter((r) => r.pct != null && r.pct < TM.SYNC_QUIET);
72
+ if (low.length) console.info('[tracker-sync-take] shown=' + low.map((r) => r.ws + ':' + r.pct).join(','));
73
+ X.html = ''; draw();
74
+ }
75
+ async function syncTake(ws, rows, said) {
76
+ const res = await ctx.pmPost('/api/tracker-sync/take', { ws, ...(rows ? { rows } : {}) }).catch(() => null);
77
+ if (!res || !res.ok) { ctx.toast((res && res.error) || 'Jira’s value was not taken. Nothing changed.'); return readSync(); }
78
+ ctx.toastUndo(said(res.n), async () => { const u = await ctx.pmPost('/api/tracker-sync/undo', { ws, batch: res.batch }).catch(() => null); await readSync(); ctx.reload && ctx.reload(); return u || { ok: false }; });
79
+ await readSync(); if (ctx.reload) ctx.reload();
80
+ }
61
81
  /* quiet-rows-digest (board QuietDigest): on a Monday, each product's part of last week's digest (GET /api/digest); off means none is made */
62
82
  async function readDigest() {
63
83
  if (new Date(ctx.now()).getDay() !== 1) return;
@@ -139,7 +159,7 @@ export function mountToday(ctx) {
139
159
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
140
160
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
141
161
  const O = DG && X.digest ? DG.withDigest(TM.overviewModel(L, A), X.digest, now) : TM.overviewModel(L, A);
142
- O.suggest = O.suggest.filter((x) => !X.hide.has(x.key));
162
+ O.suggest = O.suggest.filter((x) => !X.hide.has(x.key)).concat(TM.syncSuggest(X.sync || [], { nameOf: (ws) => productOf(ws), hidden: syncHidden(), open: X.syncOpen || new Set(), now }));
143
163
  return { L, A, O };
144
164
  }
145
165
  function draw() {
@@ -478,8 +498,27 @@ export function mountToday(ctx) {
478
498
  if (act === 'job') { X.job = key; draw(); return; }
479
499
  // the recorded meeting: ✓ keeps it filed where PMOS put it, and the block leaves Today
480
500
  if (act === 'filed-ok') { X.filedOk.add(key); draw(); return; }
501
+ if (act === 'sync-open') { X.syncOpen = X.syncOpen || new Set(); if (X.syncOpen.has(key)) X.syncOpen.delete(key); else X.syncOpen.add(key); X.html = ''; draw(); return; }
502
+ if (act === 'sync-take') {
503
+ const [ws, task, field] = String(key).split('|'); if (X.busy.has(key)) return;
504
+ X.busy.add(key); b.disabled = true;
505
+ try { await syncTake(ws, [{ task, field }], () => 'PMOS now says what Jira says for this task.'); } finally { X.busy.delete(key); }
506
+ return;
507
+ }
481
508
  if (act === 'ov-yes' || act === 'ov-no') {
482
509
  const sg = X.overview && X.overview.suggest.find((x) => x.key === key); if (!sg || X.busy.has(key)) return;
510
+ if (sg.act === 'sync') {
511
+ X.sheet = '';
512
+ if (act === 'ov-no') {
513
+ const h = syncHidden(); h.set(sg.ws, sg.sig);
514
+ try { localStorage.setItem(SYNC_NO, JSON.stringify(Object.fromEntries(h))); } catch { /* a private window: it shows again on the next read */ }
515
+ console.info('[tracker-sync-take] act=no ws=' + sg.ws);
516
+ ctx.toast('Kept what PMOS says. PMOS asks again when the number changes.'); X.html = ''; draw(); return;
517
+ }
518
+ X.busy.add(key); b.disabled = true;
519
+ try { await syncTake(sg.ws, null, (n) => 'Took Jira’s value on ' + n + (n === 1 ? ' task.' : ' tasks.')); } finally { X.busy.delete(key); }
520
+ return;
521
+ }
483
522
  X.busy.add(key); b.disabled = true; X.sheet = '';
484
523
  try {
485
524
  if (act === 'ov-no') { for (const k of sg.keys) await mark1(k, 'keep', {}); X.hide.add(key); ctx.toast('Kept. PMOS will not suggest it again for a month.'); return after(false); }
@@ -594,3 +594,30 @@ export function headModel(now = Date.now()) {
594
594
  const d = new Date(now), h = d.getHours();
595
595
  return { when: DOW_LONG[d.getDay()] + ' ' + d.getDate() + ' ' + MON_LONG[d.getMonth()] + ' · ' + hm(now), hello: h < 5 || h >= 18 ? 'Good evening' : h < 12 ? 'Good morning' : 'Good afternoon' };
596
596
  }
597
+
598
+ /* ── Tracker sync (initiative tracker-sync-on-today; board TrackerSyncDesk on Exploring 3) ──
599
+ * One ✦ Suggestion per product below SYNC_QUIET percent in sync with its tracker (GET /api/tracker-sync, lib/task-jira.js syncOf). At
600
+ * SYNC_QUIET or more, or with no read, the product says nothing (zero is silence). ✓ takes Jira's value on every difference, ✕ hides the
601
+ * row until the number changes (hidden: Map ws → the sig it was hidden at), and the list under it takes one difference at a time.
602
+ * syncSuggest(parts, { nameOf, hidden, open, now }) → [{ key, act: 'sync', ws, text, keys: [], items, why, rows, n, sig, open }] */
603
+ export const SYNC_QUIET = 95;
604
+ const FIELD_WORD = { owner: 'Owner', 'done day': 'Done day', state: 'State' };
605
+ const MON3 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
606
+ const dayWord = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(d || '')); return m ? +m[3] + ' ' + MON3[+m[2] - 1] : ''; };
607
+ /** "06:10" for a read today (local time), else "23 Nov"; '' with none. */
608
+ const readWord = (iso, now) => { const t = Date.parse(String(iso || '')); if (!Number.isFinite(t)) return ''; const d = new Date(t), n = new Date(now || Date.now());
609
+ return d.toDateString() === n.toDateString() ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON3[d.getMonth()]; };
610
+ export const syncSig = (p) => (p ? p.pct + '|' + (p.read - p.inSync) + '|' + (p.rows || []).length : '');
611
+ export function syncSuggest(parts, o = {}) {
612
+ const nameOf = o.nameOf || ((ws) => ws || 'This product');
613
+ const hidden = o.hidden || new Map(), open = o.open || new Set();
614
+ return (parts || []).filter((p) => p && p.ok && p.pct != null && p.pct < SYNC_QUIET && (p.rows || []).length && hidden.get(p.ws || '') !== syncSig(p)).map((p) => {
615
+ const ws = p.ws || '', n = p.read - p.inSync, name = nameOf(ws) || 'This product';
616
+ const rows = p.rows.map((r) => ({ ...r, ws, label: FIELD_WORD[r.field] || r.field }));
617
+ const at = readWord(p.readAt, o.now);
618
+ return { key: 'sync:' + ws, act: 'sync', ws, n, sig: syncSig(p), keys: [], rows, open: open.has('sync:' + ws),
619
+ text: name + ': ' + n + ' of ' + p.read + ' tasks differ from Jira, each set by hand in PMOS' + (at ? ' (Jira read ' + at + ')' : '') + '. Take Jira’s value on ' + (n === 1 ? 'it' : 'all ' + n),
620
+ items: rows.map((r) => r.key + ' ' + r.label.toLowerCase() + ': PMOS ' + (r.pmos || 'none') + (r.pmosAt ? ' (set ' + dayWord(r.pmosAt) + ')' : '') + ', Jira ' + r.tracker + (r.trackerAt ? ' (' + dayWord(r.trackerAt) + ')' : '')),
621
+ why: 'Someone set these in PMOS by hand, and Jira says otherwise. PMOS changes nothing in Jira. Undo puts back what PMOS said.' + (p.unread ? ' ' + p.unread + (p.unread === 1 ? ' task' : ' tasks') + ' could not be read and are not counted.' : '') };
622
+ });
623
+ }
@@ -94,6 +94,18 @@ export function rowHtml(r, o = {}) {
94
94
  return row + sug + sj + lk + lab;
95
95
  }
96
96
 
97
+ /** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
98
+ * the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
99
+ function syncHtml(x) {
100
+ const sg = sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep what PMOS says: ' + x.text], x.key, 'td-ovs');
101
+ const more = ib('sync-open', (x.open ? 'Hide the ' : 'See the ') + plural(x.rows.length, 'difference', 'differences'), x.open ? 'M7 14l5-5 5 5' : I.more, x.key, ` aria-expanded="${x.open ? 'true' : 'false'}"`);
102
+ const head = sg.replace(/<\/div>$/, more + '</div>');
103
+ if (!x.open) return head;
104
+ const rows = x.rows.map((r) => `<div class="pm-li td-sync"><span class="txt"><span class="t">${esc(r.key)} · ${esc(r.title.replace(/^\s*\[?[A-Z][A-Z0-9_]*-\d+\]?\s*[·:\-–]?\s*/, ''))}</span>`
105
+ + `<span class="w">${esc(r.label)}: PMOS says ${esc(r.pmos || 'none')}${r.pmosAt ? ', set by hand ' + esc(r.pmosAt) : ''} · Jira says ${esc(r.tracker)}${r.trackerAt ? ', ' + esc(r.trackerAt) : ''}</span></span>`
106
+ + ib('sync-take', 'Take Jira’s ' + r.label.toLowerCase() + ' for ' + r.key, I.yes, x.ws + '|' + r.task + '|' + r.field, '', 'outline') + '</div>').join('');
107
+ return head + `<div class="td-syncl" role="group" aria-label="${esc('Differs from Jira')}">${rows}</div>`;
108
+ }
97
109
  /** The Overview, a Summary block written by PMOS (✦): one sentence whose item names open the item, then PMOS's Suggestions.
98
110
  * O: overviewModel(). */
99
111
  export function overviewHtml(O) {
@@ -103,7 +115,7 @@ export function overviewHtml(O) {
103
115
  const t = esc(x.text), at = said.indexOf(t);
104
116
  if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
105
117
  }
106
- const sug = (O.suggest || []).map((x) => sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs')).join('');
118
+ const sug = (O.suggest || []).map((x) => (x.act === 'sync' ? syncHtml(x) : sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs'))).join('');
107
119
  return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
108
120
  }
109
121
  /* ── Your move (your-move, bet A468; board YourMoveDS, agreed 2026-11-23) ──
@@ -335,7 +347,7 @@ const clipT = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim();
335
347
  * with what changes, why, and Yes or No. sg: overviewModel().suggest[i]. '' with none. */
336
348
  export function phoneSheetHtml(sg) {
337
349
  if (!sg) return '';
338
- const items = (sg.items || []).slice(0, 5);
350
+ const items = (sg.items || []).slice(0, sg.act === 'sync' ? 50 : 5); // tracker sync: every difference (critic, 24 Nov)
339
351
  const more = (sg.keys || []).length - items.length;
340
352
  const what = items.length ? `<dt>What changes</dt><dd><ul>${items.map((t) => `<li>${esc(t)}</li>`).join('')}${more > 0 ? `<li>${esc(plural(more, 'more line', 'more lines'))}</li>` : ''}</ul></dd>` : '';
341
353
  return `<div class="tdp-sheet" role="dialog" aria-modal="true" aria-label="PMOS suggests"><button type="button" class="tdp-scrim" data-td="sheet-x" aria-label="Close"></button>`
@@ -744,3 +744,5 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
744
744
  .hy-lk { border: 0; background: none; padding: 0; font: inherit; color: var(--cz-blueink); font-weight: var(--fw-strong); cursor: pointer; }
745
745
  .ob-edit { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: var(--space-12) 14px; border-radius: 14px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); resize: vertical; }
746
746
  .ob-nc { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
747
+ /* tracker-sync-on-today (board TrackerSyncDesk): the differences under the ✦ row, each a List item with its own ✓ */
748
+ .td-syncl { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }