create-pmos 0.588.0 → 0.590.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.
@@ -132,7 +132,7 @@ const routePrograms = async (page) => {
132
132
  await routePrograms(page);
133
133
  const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
134
134
  await page.goto(BASE + '/premium.html?theme=light');
135
- await until(() => page.evaluate(() => !!document.querySelector('#hmList .hv-g.prg [data-po-id]')), 20000);
135
+ await until(() => page.evaluate(() => !!document.querySelector('#hmList .hv-g.prg [data-po-id]') && document.body.dataset.hmTop === '1'), 20000);
136
136
  return { ctx, page, errors };
137
137
  };
138
138
  const hkids = (p) => p.evaluate(() => [...document.querySelectorAll('#hmList .hv-g.prg [data-po-id]')].map((r) => r.dataset.poId));
@@ -160,6 +160,8 @@ const routePrograms = async (page) => {
160
160
  const grips = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-po-grip]')].filter((g) => getComputedStyle(g).display !== 'none').length);
161
161
  ok('H phone: no grip shows (hold the row instead)', grips === 0, String(grips));
162
162
  // a hold, then a drag, through the touch events the page reads (CDP touch input)
163
+ // the top of Home (Your move, Waiting on others) sits above the groups: bring the rows into view first
164
+ await p.evaluate(() => document.querySelector('#hmList [data-po-id="descope-parity"]').scrollIntoView({ block: 'center' }));
163
165
  const s = await p.locator('#hmList [data-po-id="descope-parity"]').boundingBox();
164
166
  const t = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
165
167
  const cdp = await ctx.newCDPSession(p);
@@ -210,6 +210,7 @@ body.cz-home .hm-r.lr .hm-tile { width: 32px; height: 32px; }
210
210
  body.cz-home.hm-plist .hm-list { display: flex; position: static; width: auto; background: none; padding: 22px 0 96px; border-radius: 0; box-shadow: none; border: 0; }
211
211
  body.cz-home.hm-plist .hm-lsc { margin: 0; padding: 0; overflow: visible; }
212
212
  body.cz-home.hm-plist .hm-chat, body.cz-home.hm-plist:not(.hm-vw-open) .hm-vw { display: none; }
213
+ body.cz-home.hm-plist.hm-vw-open { overflow: hidden; } /* the Viewer covers the list: the page under it does not scroll (a scroll would close an open picker) */
213
214
  body.cz-home.hm-plist .cz-fabw { bottom: 24px; }
214
215
  body.cz-home .hm-needs { display: none; }
215
216
  body.cz-home .hm-top .hm-back { display: grid; }
@@ -727,3 +728,30 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
727
728
  .yd-dn .yd-mvt b { font-weight: inherit; color: var(--cz-ink2); }
728
729
  .ob-d h3 { margin: 12px 0 6px; font-size: var(--fs-row); font-weight: var(--fw-strong); }
729
730
  .ob-body { white-space: pre-wrap; font: inherit; line-height: 1.5; margin: 8px 0; padding: 12px 14px; border-radius: 14px; background: var(--cz-well); color: var(--cz-ink); }
731
+
732
+ /* the top of Home: Your move and Waiting on others above today's list (home-your-move-waiting; board HmA2, A′). pm/home-top.js draws it. */
733
+ .hy { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
734
+ .hy * { box-sizing: border-box; }
735
+ .hy-h { display: flex; align-items: center; gap: 8px; padding: 6px 6px 2px; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); }
736
+ .hy-h + .hy-r { margin-top: 0; }
737
+ .hy .hy-h:not(:first-child) { margin-top: 6px; }
738
+ .hy-h .sp, .hy-q .sp, .hy-dn .sp { flex: 1 1 0%; }
739
+ .hy-h .n { font-variant-numeric: tabular-nums; }
740
+ .hy-r { display: flex; align-items: flex-start; gap: 10px; background: var(--cz-card); border-radius: 14px; padding: 10px 10px 10px 12px; }
741
+ .hy-r .st { color: var(--cz-blueink); margin-top: 2px; flex: 0 0 auto; }
742
+ .hy-r .st.w { color: var(--cz-ink3); }
743
+ .hy-r .tx { flex: 1 1 0%; min-width: 0; font-size: var(--fs-body); line-height: 1.38; color: var(--cz-ink); overflow-wrap: anywhere; }
744
+ .hy-r .tx b { font-weight: var(--fw-strong); }
745
+ .hy-r .tx small { display: block; margin-top: 2px; font-size: var(--fs-label); color: var(--cz-ink3); line-height: 1.4; }
746
+ .hy-r .tx small i { font-style: normal; color: var(--cz-risk); font-weight: var(--fw-strong); }
747
+ .hy-r .tx small i.k { color: var(--cz-ink2); }
748
+ .hy-r .tx small i svg { vertical-align: -2px; }
749
+ .hy-r .ac { display: flex; gap: 4px; flex: 0 0 auto; }
750
+ .hy-r .ac button { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; border: 0; cursor: pointer; background: var(--cz-well); color: var(--cz-ink2); }
751
+ .hy-r .ac button.ok { background: var(--cz-blueink); color: var(--cz-onsolid); }
752
+ .hy-r .ac button:disabled { opacity: .5; cursor: default; }
753
+ .hy-q { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 10px 6px; font: inherit; font-size: var(--fs-label); color: var(--cz-ink3); text-align: left; cursor: pointer; }
754
+ .hy-dn { font-size: var(--fs-label); color: var(--cz-ink3); padding: 2px 6px; display: flex; gap: 8px; align-items: center; line-height: 1.4; }
755
+ .hy-lk { border: 0; background: none; padding: 0; font: inherit; color: var(--cz-blueink); font-weight: var(--fw-strong); cursor: pointer; }
756
+ .ob-edit { width: 100%; box-sizing: border-box; font: inherit; line-height: 1.5; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); resize: vertical; }
757
+ .ob-nc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@@ -210,6 +210,7 @@ export function callKindOf(r) {
210
210
  if (r.kind === 'verdict') return 'Verdict';
211
211
  if (r.kind === 'mention' || r.kind === 'outbox') return 'Message';
212
212
  if (r.kind === 'meeting') return 'Move the team reads';
213
+ if (r.kind === 'owner') return 'Your call'; // an agreed action nobody owns (home-your-move-waiting)
213
214
  if (r.kind !== 'call' || !r.call) return null;
214
215
  const c = r.call, t = String(c.name || '') + ' ' + String((c.row && c.row.title) || '');
215
216
  if (c.kind === 'update') return 'Message';
@@ -219,6 +220,9 @@ export function callKindOf(r) {
219
220
  if (c.state === 'blocked') return 'Blocked';
220
221
  return 'Your call';
221
222
  }
223
+ /** The PM's calls of a ranked list (rankMove's rows, then its Can wait), in its order, each with its kind: the ONE source Good morning and
224
+ * Home's top read (home-your-move-waiting: one list, two views). */
225
+ export const callsIn = (rank) => (rank ? [...(rank.rows || []), ...(rank.wait || [])] : []).map((r) => ({ r, k: callKindOf(r) })).filter((x) => x.k).map(({ r, k }) => ({ ...r, callKind: k }));
222
226
  /** At most this many of the PM's calls show; the rest fold under one line ("N more of your calls"). */
223
227
  export const MOVE_CAP = 5;
224
228
  const SINCE_MS = 24 * 3600e3;
@@ -245,8 +249,8 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
245
249
  // wait"), each with its kind and why; the rest of W3's list is Claude's to do. With no ranked list, the calls Your day holds.
246
250
  const all = Y.rank ? [...Y.rank.rows, ...(Y.rank.wait || [])] : (Y.calls || []).map((x) => ({ key: 'call:' + x.id, kind: 'call', call: x, title: x.name, sub: '', age: '' }));
247
251
  const callWhy = (x) => (c && x.id === c.id && call && call.why) || (x.pick ? 'I’d ' + x.pick.charAt(0).toLowerCase() + x.pick.slice(1).replace(/\.?$/, '.') + ' It’s your call.' : x.when ? 'Goes out ' + x.when + '.' : x.sub || x.hint || '');
248
- const mine = all.map((r) => ({ r, k: callKindOf(r) })).filter((x) => x.k)
249
- .map(({ r, k }) => ({ ...r, callKind: k, sub: r.kind === 'call' ? callWhy(r.call) : r.sub, goal: tagOf(o.tags, r.ws, r.ini), late: r.days != null && r.days > 0 }));
252
+ const mine = (Y.rank ? callsIn(Y.rank) : all.map((r) => ({ ...r, callKind: callKindOf(r) })).filter((r) => r.callKind))
253
+ .map((r) => ({ ...r, sub: r.kind === 'call' ? callWhy(r.call) : r.sub, goal: tagOf(o.tags, r.ws, r.ini), late: r.days != null && r.days > 0 }));
250
254
  const move = mine.slice(0, MOVE_CAP), more = mine.length - move.length;
251
255
  // Claude did (AwA): what Claude finished by itself, newest first, each with its reason and Undo; a run that stopped is one amber line
252
256
  const R = Y.rank || {}, recent = (x) => { const t = Date.parse(x.at || ''); return Number.isFinite(t) && now - t <= SINCE_MS; };
@@ -47,7 +47,9 @@ import * as L from './home-list.js';
47
47
  import * as TD from './home-today.js';
48
48
  import * as GW from './grill-words.js'; // Home's one line when Claude grilled something by itself (canvas FcPhone, Home)
49
49
  import * as YD from './home-day.js';
50
- import * as GM from './good-morning.js'; // Good morning is one page: the quarter, the reading column and the time rail (nyt-ui GM2)
50
+ import * as GM from './good-morning.js';
51
+ import * as TOP from './home-top.js'; // the top of Home: Your move and Waiting on others (home-your-move-waiting, board HmA2)
52
+ import { rankMove } from './move-rank.js'; // Good morning is one page: the quarter, the reading column and the time rail (nyt-ui GM2)
51
53
  import * as MSG from './ms-suggest.js'; // Your move's ✓ on a program's milestone changes confirms them all (workspace grill W3)
52
54
  import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2)
53
55
  import * as OKL from './okr-list.js'; // the product page's Goals line (batch 16 item 6, GsProduct)
@@ -229,6 +231,11 @@ async function load() {
229
231
  loadMoment();
230
232
  readImpact();
231
233
  loadGrillNews();
234
+ // the top of Home (A′): the ranked list's own reads and Waiting on others, after the first draw so they never hold the list up
235
+ document.body.dataset.hmTop = '0';
236
+ // the top of Home is off until a new design is agreed (Wawan 2026-11-17: the list stays navigation). GET /api/waiting is not read, so no
237
+ // nudge is drafted in the background.
238
+ readMove().catch(() => {}).then(() => { document.body.dataset.hmTop = '1'; });
232
239
  // the boards of the other products Home reads, each its own closed group: read after the list is drawn, so a slow one never holds it up
233
240
  const others = await Promise.all(otherProducts(D).map((a) => getRetry('/api/board-premium?ws=' + encodeURIComponent(a.ws), 4).then((r) => (r && r.ok && r.model ? { ws: a.ws, name: a.name, model: r.model } : null))));
234
241
  const got = others.filter(Boolean);
@@ -358,11 +365,14 @@ function homeListHtml() {
358
365
  const R = L.reviewModel(S.D, NOW());
359
366
  // a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
360
367
  const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1);
368
+ // the top of Home (A′, HmA2): Your move from the same ranked list Good morning reads (rankMove + callKindOf), then Waiting on others
369
+ const T = null; // the top of Home (A′, HmA2) is off: the list is navigation only (Wawan 2026-11-17); topOf(M) draws it again
370
+ S.topHtml = T ? TOP.topHtml(T) : ''; // drawn into its own node (drawTopNode), so a late read changes the top, never the rows under it
361
371
  const sel = S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null);
362
372
  S.lo = { sel, ses: S.ses, restOpen: (k) => S.rest.has(k), pin: S.pin, phone: false }; // the folded rail's card draws Home's rows with these
363
373
  return TD.listHtml(M, todayModel(), {
364
374
  sel, selHead: S.head, ses: S.ses, pOpen, here: isPhone() ? null : TD.groupOfOpen(M, sel) || S.head, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
365
- pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? revealLeft(S.reveal) + RECROW.html() + (S.drift ? DRIFT.rowHtml(S.drift.c, { esc, sel: S.sel === 'drift' }) : '') : '', // chief-of-staff C3: the Mentions and Your impact cards are gone; their asks land in Your move
375
+ pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? revealLeft(S.reveal) + RECROW.html() + (S.drift ? DRIFT.rowHtml(S.drift.c, { esc, sel: S.sel === 'drift' }) : '') + (T ? '<i data-hm-topslot hidden></i>' : '') : '', held: T ? T.held : null, // chief-of-staff C3: the Mentions and Your impact cards are gone; their asks land in Your move
366
376
  last: S.ready ? '' : LS.last(LAST_KEY), keep: S.ready && S.filter === 'today' && !S.ini ? (b) => LS.keepLast(LAST_KEY, b) : null,
367
377
  imFace: IM.faceHtml(S.im, { joy: S.imJoy }), grill: S.ready ? grillNews() : null,
368
378
  });
@@ -373,6 +383,33 @@ function homeListHtml() {
373
383
  * minutes (the event 'cz:news-for-you') and again when Your day opens; a row opens the item in the Viewer, "N more" the whole list, ✓✓
374
384
  * marks all seen. An item leaves once it is opened or marked seen. */
375
385
  function dayHtml() { return ''; }
386
+ /** The top of Home's model: the ranked list (S.topRank, kept for the presses) and GET /api/waiting (S.wait). */
387
+ function topOf(M) {
388
+ S.topRank = rankMove({ ...rankIn(), calls: YD.callsOf(M.move), now: NOW() });
389
+ const products = ((M && M.products) || []).filter((p) => p.model).map((p) => ({ name: p.name, rows: ((p.model.initiatives || {}).list || {}).rows || p.model.rows || [] }));
390
+ return TOP.topModel({ rank: S.topRank, waiting: S.wait, products, all: !!S.topAll, now: NOW() });
391
+ }
392
+ /** GET /api/waiting (lib/waiting-on.js): Waiting on others, its exit lines and the meeting actions nobody owns. Read after the list is drawn. */
393
+ async function readWaiting() {
394
+ const r = await pmGet('/api/waiting').catch(() => null);
395
+ if (!r || !r.ok) return;
396
+ const same = JSON.stringify(r.rows) === JSON.stringify((S.wait && S.wait.rows) || null) && JSON.stringify(r.closed) === JSON.stringify((S.wait && S.wait.closed) || null) && JSON.stringify(r.gaps) === JSON.stringify((S.wait && S.wait.gaps) || null);
397
+ S.wait = r;
398
+ if (!same) { drawList(); redrawLater(); }
399
+ }
400
+ /** A press on Waiting on others: ↗ opens the drafted nudge in the Viewer (Send, Edit, Not now live there), else the row's own source. */
401
+ function waitPress(b) {
402
+ if (b.dataset.hmNudge) {
403
+ const e = (S.outbox || []).find((x) => x.id === b.dataset.hmNudge);
404
+ if (!e) { toast('The nudge is being read again. Try once more.'); readMove(); return; }
405
+ VW.drill(); import('./outbox-view.js').then((O) => O.openDraft(e, { pmPost, toast, toastUndo, reload: () => readMove().then(() => readWaiting()) }));
406
+ return;
407
+ }
408
+ const w = ((S.wait && S.wait.rows) || []).find((x) => x.key === b.dataset.hmWait); if (!w) return;
409
+ if (w.note) { openMeeting({ note: w.note }); return; }
410
+ if (w.link) { window.open(w.link, '_blank', 'noopener'); return; }
411
+ toast('Its source opens from ' + (w.where || 'its record') + '.');
412
+ }
376
413
  /** Your move's ranked list (workspace grill W3, pm/move-rank.js): the products Home reads with their Board rows, the programs, and each
377
414
  * product's GET /api/your-move answer (overdue verdicts, the first key result with no reading). */
378
415
  function rankIn() {
@@ -386,7 +423,7 @@ function rankIn() {
386
423
  if (S.impact && S.impact.c && !S.impact.c.looked) extra.push({ key: 'impact', go: 'impact', title: 'Your impact: ' + S.impact.c.label + ' is ready to check', sub: 'A thank-you and what really moved, from your records.' });
387
424
  const lp = LPV.chipOf(); if (lp) extra.push({ key: 'loose', go: 'loose', title: 'Not in an initiative: ' + lp.n + (lp.n === 1 ? ' row' : ' rows') + ' to tidy', sub: 'PMOS proposes where each one belongs.' });
388
425
  for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: 'Lab: ' + l.n + (l.n === 1 ? ' finding fits' : ' findings fit') + ' no initiative', sub: l.say || 'Keep one to start an initiative, or let it go.' });
389
- return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], extra };
426
+ return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
390
427
  }
391
428
  /** Each product's GET /api/your-move, read when Your day opens (never on Home's first draw: page speed). */
392
429
  async function readMove() {
@@ -412,7 +449,7 @@ async function readMove() {
412
449
  const lab = labs.filter(Boolean);
413
450
  const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []);
414
451
  S.move = next; S.outbox = outbox; S.lab = lab;
415
- if (!same) redrawLater();
452
+ if (!same) { redrawLater(); drawList(); }
416
453
  // a demotion notice is said once: drawn now, then marked seen so the next read leaves it out
417
454
  for (const [ws, m] of Object.entries(next)) for (const n of m.notices || []) pmPost('/api/autonomy/seen', { ws: ws || undefined, job: n.job, product: n.product, until: n.until }).catch(() => {});
418
455
  }
@@ -425,7 +462,7 @@ function redrawLater() {
425
462
  const mo = new MutationObserver(() => { if (!body.querySelector(PASSING)) { mo.disconnect(); redrawDay(); } });
426
463
  mo.observe(body, { childList: true, subtree: true });
427
464
  }
428
- const moveRow = (key) => { const Y = S.Y && S.Y.rank; return Y ? Y.rows.concat(Y.wait || [], Y.older || []).find((r) => r.key === key) || null : null; };
465
+ const moveRow = (key) => { for (const Y of [S.Y && S.Y.rank, S.topRank]) { const r = Y ? Y.rows.concat(Y.wait || [], Y.older || []).find((x) => x.key === key) : null; if (r) return r; } return null; };
429
466
  const insightsHref = (ws) => '/premium-intelligence.html' + (ws ? '?ws=' + encodeURIComponent(ws) : '');
430
467
  /** The ✦ of one initiative of any product Home reads, over its page (pm/ini-props.js). */
431
468
  async function openProps(ws, board, id) {
@@ -457,6 +494,7 @@ async function movePress(b) {
457
494
  { pmGet, pmPost, toast, toastUndo, reload: () => load().then(() => readMove()), full: () => openProps(r.ws, r.board, r.ini) })); return; }
458
495
  if (r.kind === 'meeting') { if (prog) { VW.drill(); goProgram(prog.id); } else if (r.props[0]) { VW.drill(); openProps(r.props[0].ws, r.props[0].board, r.props[0].ini); } return; }
459
496
  if (r.kind === 'call') { select(r.call.id); return; }
497
+ if (r.kind === 'owner') { if (r.gap && r.gap.note) openMeeting({ note: r.gap.note }); return; } // an agreed action nobody owns: its note
460
498
  VW.drill(); openProps(r.ws, r.board, r.ini); return;
461
499
  }
462
500
  b.disabled = true;
@@ -829,6 +867,17 @@ function cardHtml(id, o = {}) {
829
867
  + `<div class="hm-acts"><button type="button" class="hm-cta${primary ? '' : ' alt'}" data-hm-cta>${esc(cta)}</button>`
830
868
  + `<button type="button" class="hm-ov" data-hm-ov aria-label="Overview of ${esc(title)} with PMOS" title="Overview with PMOS">${avHtml(CLAUDE, 24)}</button></div></div></section>`;
831
869
  }
870
+ /** The top of Home lives in one node of its own (TOPEL) that the list's slot holds. GET /api/your-move and GET /api/waiting answer after
871
+ * the list is drawn: they change this node only, so the rows under it are never drawn again under a press, a hold or a drag. */
872
+ const TOPEL = document.createElement('div');
873
+ TOPEL.className = 'hy-wrap';
874
+ function drawTopNode(sc) {
875
+ const h = S.topHtml || '';
876
+ if (TOPEL.__h !== h) { TOPEL.__h = h; TOPEL.innerHTML = h; }
877
+ const slot = sc.querySelector('[data-hm-topslot]');
878
+ if (slot && h) slot.replaceWith(TOPEL); else if (slot) slot.remove();
879
+ if (!h && TOPEL.parentNode) TOPEL.remove();
880
+ }
832
881
  function drawList() {
833
882
  const el = $('#hmList');
834
883
  // the list column: the groups scroll; the foot is empty since the Elsewhere card went (HbC: the list never leaves)
@@ -841,6 +890,7 @@ function drawList() {
841
890
  sc.querySelectorAll('.hm-load i[data-f]').forEach((i) => i.style.setProperty('--bd-f', i.dataset.f)); // the day's load: run-time geometry
842
891
  const c2 = sc.querySelector('#hmCap'); if (c2 && capV) { c2.value = capV; } if (c2 && capF) c2.focus(); // a task being typed survives a redraw
843
892
  }
893
+ drawTopNode(sc);
844
894
  const dh = dayHtml();
845
895
  if (dy.__h !== dh) { dy.__h = dh; dy.innerHTML = dh; dy.querySelectorAll('.hm-load i[data-f]').forEach((i) => i.style.setProperty('--bd-f', i.dataset.f)); }
846
896
  document.body.classList.toggle('hm-dayon', !!dh);
@@ -2086,6 +2136,13 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
2086
2136
  const b = e.target.closest('button'); if (!b) return;
2087
2137
  const d = b.dataset;
2088
2138
  if ('hmRcx' in d) { railCard(null, { back: true }); return; } // × on the folded rail's card
2139
+ // the top of Home (home-your-move-waiting): a Your move row presses as it does on Good morning; Waiting on others opens its nudge or source
2140
+ if (b.closest('.hy')) {
2141
+ if (/^mv-/.test(d.yd || '')) { movePress(b); return; }
2142
+ if (d.yd === 'done-undo') { doneUndo(b); return; }
2143
+ if ('hmTopall' in d) { S.topAll = !S.topAll; drawList(); const f = $('#hmList [data-hm-topall]'); if (f) f.focus(); return; }
2144
+ if (d.hmNudge || d.hmWait) { waitPress(b); return; }
2145
+ }
2089
2146
  // a pick in the rail's card: the card closes, the rail stays folded and the Viewer as wide (FlA4After)
2090
2147
  if (S.rc && b.closest('.hv-rc') && (d.hmSel || d.hmProg || d.hmProdopen || d.hmSesnew)) { S.rc = null; S.ses = null; VW.keepWide(); }
2091
2148
  if (d.hmSes) { sesPill(d.hmSes === S.ses ? null : d.hmSes); return; } // an initiative's pill: what sits in it, under it (a sheet on a phone)
@@ -168,13 +168,16 @@ export function dayModel(M, D, R, now = Date.now(), o = {}) {
168
168
  if (!run && h < 17 && t.length) offer = { kind: 'prep', text: 'I haven’t prepared today yet.', sub: 'Shall I prep your meetings and draft what I can?' };
169
169
  return {
170
170
  mood, face: run && run.working && mood === 'calm' ? 'working' : mood, line, sub, chips, misses, offer, calls, drafts, wait, done, thanks, fail, failLead, calm, ask: o.ask || null,
171
- rank: o.rank ? rankMove({ ...o.rank, calls, now }) : null,
171
+ rank: o.rank ? rankMove({ ...o.rank, calls: callsOf(move), now }) : null,
172
172
  news: newsOf(o.news), digests: digestsOf(D), tomorrow: tomorrowOf(D, now),
173
173
  next: next ? { meeting: next, now: next.state === 'now', time: hm(next.start), title: next.title || 'A meeting' } : null,
174
174
  week: { sub: un || 'Weekly review' },
175
175
  };
176
176
  }
177
177
 
178
+ /** The rows of Home's list that are the PM's calls for the ranked list: the calls, and the weekly update (a message to people: it goes out
179
+ * only when the PM sends it). Good morning and Home's top both rank these (home-your-move-waiting: one source). */
180
+ export const callsOf = (move) => (move || []).filter((r) => r && (r.call || r.kind === 'update'));
178
181
  /* Claude's face is Adler's M face (it replaced the yellow mood circle): the day's mood read as his */
179
182
  export const ADLER = { glad: 'handled', calm: 'handled', delighted: 'celebrating', concerned: 'honest', working: 'thinking' };
180
183
  export const faceHtml = (mood) => `<span class="yd-face ad ${esc(mood)}">${adler(ADLER[mood] || 'handled', 48, { label: 'PMOS is ' + mood })}</span>`;
@@ -224,7 +224,7 @@ function openNeeds(D) {
224
224
  return needsOf(D).filter((x) => !x.ini || x.needSession || !shut.has(x.ini));
225
225
  }
226
226
  const sameName = (a, b) => String(a || '').toLowerCase() === String(b || '').toLowerCase();
227
- /** o: { filter ('today' | 'kept' | 'done'), now }. The products are the ticked ones (productsOf). */
227
+ /** o: { filter ('today' | 'mine' | 'kept' | 'done'), now }. The products are the ticked ones (productsOf). */
228
228
  export function homeList(D, o = {}) {
229
229
  const now = o.now || D.now || Date.now();
230
230
  const needs = openNeeds(D);
@@ -236,6 +236,7 @@ export function homeList(D, o = {}) {
236
236
  const tabRows = (k) => { const t = tab(k); return t ? t.groups.flatMap((g) => g.rows || []) : []; };
237
237
  // Kept and Done only (testing fixes: no Today or Waiting chip; the list is Today unless one of these two is on, and pressing it again goes back)
238
238
  const filters = [
239
+ { key: 'mine', label: 'Mine' }, // home-your-move-waiting: only the rows that wait on you (the existing Show menu, no new switch)
239
240
  { key: 'kept', label: 'Kept', n: (tab('kept') || {}).n || 0 },
240
241
  { key: 'done', label: 'Done' },
241
242
  ];
@@ -293,6 +294,7 @@ export function homeList(D, o = {}) {
293
294
  }
294
295
  const move = moveOf(groups, needs);
295
296
  const yours = move.length;
297
+ if (o.filter === 'mine') list = { title: 'Waiting on you', rows: move.map((r) => ({ ...r, hint: r.sub || r.hint || '' })), empty: 'Nothing waits on you.' };
296
298
  const nIni = groups.filter((g) => g.kind === 'product' || g.kind === 'program').reduce((n, g) => n + g.count, 0);
297
299
  return { yours, move, greet: greeting(yours, now), word: greetWord(now), products, primary, filters, filter: o.filter || 'today', groups, list, untouched,
298
300
  counts: { products: products.length, initiatives: nIni } };
@@ -182,7 +182,9 @@ function productHtml(g, o) {
182
182
  * them (the list); the folded rail's card shows the same rows without it. */
183
183
  function productBody(g, o, po) {
184
184
  const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
185
- const flat = g.flat.slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
185
+ // say it once (home-your-move-waiting): the weekly update leaves the list while Your move at the top of Home holds it
186
+ const held = o.held && o.held.update ? (r) => r.kind === 'update' : () => false;
187
+ const flat = g.flat.filter((r) => !held(r)).slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
186
188
  const QUIET = 3;
187
189
  const restAll = o.restOpen(g.key);
188
190
  // the open initiative always shows, wherever the PM's order puts it (batch 14 item 8)
@@ -225,7 +227,8 @@ function programBody(g, o, po) {
225
227
  const many = g.subs.length > 1;
226
228
  const body = g.subs.map((x) => { const inis = x.inis.map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join(''); return `${many ? `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>` : ''}${po ? `<div class="po-list" data-po-list="${esc(g.program.id)}">${inis}</div>` : inis}`; }).join('');
227
229
  // the program's milestone changes that wait on the PM lead its card (batch 14 item 4: they were only in Your day, which a desktop no longer has)
228
- const msr = g.msRow ? `<div class="hm-r hv-r${o.sel === g.msRow.id ? ' sel' : ''}" data-id="${esc(g.msRow.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(g.msRow.id)}" aria-label="${esc(g.msRow.hint)}. Waits on you. Open the program"><span class="hv-mk"><span class="hv-d" aria-hidden="true"></span></span><span class="hm-rt"><b>${esc(g.msRow.hint)}</b></span></button></div>` : '';
230
+ // say it once (home-your-move-waiting): the milestone changes leave the card while Your move at the top of Home holds them
231
+ const msr = g.msRow && !(o.held && o.held.programs && o.held.programs.has(g.program.id)) ? `<div class="hm-r hv-r${o.sel === g.msRow.id ? ' sel' : ''}" data-id="${esc(g.msRow.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(g.msRow.id)}" aria-label="${esc(g.msRow.hint)}. Waits on you. Open the program"><span class="hv-mk"><span class="hv-d" aria-hidden="true"></span></span><span class="hm-rt"><b>${esc(g.msRow.hint)}</b></span></button></div>` : '';
229
232
  return msr + (body || `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`);
230
233
  }
231
234
  /** Which group holds what is open (o.sel: a row id, or 'i:<initiative>'): the folded rail marks that group's tile (batch 18 item 14, FlA4After).
@@ -331,7 +334,7 @@ export function listHtml(M, T, o) {
331
334
  const head = `<div class="hm-hd hv-bar">${own ? o.imFace : ''}<button type="button" class="hv-hi" ${o.ready ? 'data-hm-day' : 'aria-disabled="true"'} aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}${nw}. Open your day">${face}<b>${esc(M.word || 'Today')}</b>${o.ready ? '' : LS.ringHtml()}${svg(P.chevD, 18)}</button><span class="hv-acts">`
332
335
  // the product chip, always (it is also the way to add one): the ticked products' tiles, or All (canvas XhpA2States)
333
336
  + (o.pick ? chipHtml(o.pick, { id: 'hmPick', attrs: 'data-hm-pick', label: 'Products on Home', tones: o.tones }) : '')
334
- + (o.phone ? '' : `<button type="button" class="ut-ib hv-ib${flt ? ' on' : ''}" data-hm-flt aria-haspopup="menu" aria-label="Show: Today, Kept or Done${flt ? '. Now ' + esc(flt.label) : ''}" title="Show: Today, Kept or Done">${svg(P.filter, 18)}</button>`)
337
+ + (o.phone ? '' : `<button type="button" class="ut-ib hv-ib${flt ? ' on' : ''}" data-hm-flt aria-haspopup="menu" aria-label="Show: Today, Mine, Kept or Done${flt ? '. Now ' + esc(flt.label) : ''}" title="Show: Today, Mine, Kept or Done">${svg(P.filter, 18)}</button>`)
335
338
  + SO.btnHtml('ut-ib hv-ib' + (SO.layout().sort !== 'mine' ? ' on' : ''))
336
339
  + `<button type="button" class="ut-ib hv-ib" data-hm-new aria-haspopup="menu" aria-label="New" title="New">${svg(P.plus, 20)}</button>`
337
340
  // fold the list to the rail (batch 18 item 15, TbT1Split): the rail's list button brings it back; a phone has no rail
@@ -0,0 +1,102 @@
1
+ /* pm/home-top.js — the top of Home: Your move and Waiting on others, above today's list (initiative home-your-move-waiting, batch 30; design
2
+ * A′, board HmA2 on the main canvas, agreed by Wawan 17 Nov 2026). Pure: Node imports it (home-top.test.js).
3
+ *
4
+ * topModel(o) → T what the top says. o: { rank (rankMove's answer, the same one Good morning reads), waiting (GET /api/waiting),
5
+ * products: [{ name, rows }] (the Board rows Home reads, for the last line), all (the fold is open), now }
6
+ * topHtml(T) → markup the .hy section, or '' when there is nothing to say (zero is silence)
7
+ * heldOf(T) → { update, programs: Set } what Your move holds, so the list below leaves those rows out (say it once)
8
+ *
9
+ * YOUR MOVE. callsIn(rank) (pm/good-morning.js): the calls of the six always-yours kinds, in rankMove's order. Each row's meta line starts with
10
+ * its kind word (Message, Move the team reads, Your call, Blocked, Verdict, New request, Merge, Delete or spend). At most CAP (5) show; the fold
11
+ * line names what it hides and whose call it is ("1 more · your call: Commerce workaround needs an owner"), never a bare count.
12
+ * WAITING ON OTHERS. GET /api/waiting rows: each has a real who. A drafted nudge is one line, "Nudge drafted · goes as a Jira comment only when
13
+ * you send it from the Viewer", and one ↗; no ✓ or ✕ here, because a message to people always waits for the PM (D106 class C, D107).
14
+ * THE TWO QUIET LINES. What PMOS did since yesterday, with Undo, and the rows that left Waiting on others ("Faye replied on MSD-4388"); then one
15
+ * plain line on the rest: "Everything else is on track · 8 initiatives in 3 products" only when it is true, else what the statuses say. */
16
+ import { callsIn, MOVE_CAP } from './good-morning.js';
17
+
18
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
20
+ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
21
+ const svg = (d, w = 14, 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>`;
22
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', OPEN = 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6', CHECK = 'M5 12.5l4.5 4.5L19 7.5';
23
+ const PERSON = 'M12 12a4 4 0 1 0 0-8a4 4 0 1 0 0 8zM4 20a8 8 0 0 1 16 0', CHEV = 'M10 7l5 5-5 5', CHEVD = 'M7 10l5 5 5-5';
24
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
25
+ const dm = (iso) => { const t = Date.parse(iso || ''); if (!Number.isFinite(t)) return ''; const d = new Date(t); return d.getDate() + ' ' + MON[d.getMonth()]; };
26
+ const DAY = 864e5;
27
+ const SOURCE_WORD = { jira: 'Jira assignee', note: 'owns it from', message: 'no reply to your message' };
28
+ const OPEN_STATUS = new Set(['on track', 'at risk', 'late', 'no signal']);
29
+
30
+ /** A call's why, said as Good morning says it: PMOS's pick, when it goes out, else its own sub. */
31
+ const callWhy = (c) => (c.pick ? 'I’d ' + c.pick.charAt(0).toLowerCase() + c.pick.slice(1).replace(/\.?$/, '.') + ' It’s your call.' : c.when ? 'Goes out ' + c.when + '.' : c.sub || c.hint || '');
32
+ const lowerKind = (k) => (k === 'Your call' ? 'your call' : k.charAt(0).toLowerCase() + k.slice(1));
33
+
34
+ /** The last line: on track only when every open initiative reads on track; else what the statuses say (honest state). '' with nothing open. */
35
+ export function restLine(products) {
36
+ const P = (products || []).filter((p) => p && (p.rows || []).some((r) => r && OPEN_STATUS.has(r.status)));
37
+ const rows = P.flatMap((p) => p.rows.filter((r) => r && OPEN_STATUS.has(r.status)));
38
+ if (!rows.length) return '';
39
+ const where = plural(rows.length, 'initiative', 'initiatives') + ' in ' + plural(P.length, 'product', 'products');
40
+ const n = (s) => rows.filter((r) => r.status === s).length;
41
+ if (n('on track') === rows.length) return 'Everything else is on track · ' + where;
42
+ const parts = [['late', 'late'], ['at risk', 'at risk'], ['no signal', 'no signal yet'], ['on track', 'on track']].filter(([s]) => n(s)).map(([s, w]) => n(s) + ' ' + w);
43
+ return where + ' · ' + parts.join(', ');
44
+ }
45
+
46
+ export function topModel(o = {}) {
47
+ const now = o.now || Date.now();
48
+ const R = o.rank || null, W = o.waiting && o.waiting.ok ? o.waiting : null;
49
+ const mine = callsIn(R).map((r) => ({ ...r, sub: r.kind === 'call' && r.call ? callWhy(r.call) : r.sub }));
50
+ const cap = o.all ? mine.length : MOVE_CAP;
51
+ const move = mine.slice(0, cap), hidden = mine.slice(cap);
52
+ const fold = hidden.length ? { n: hidden.length, text: hidden.length + ' more · ' + lowerKind(hidden[0].callKind) + ': ' + clip(hidden[0].title, 80) + (hidden.length > 1 ? ' and ' + plural(hidden.length - 1, 'other', 'others') : '') }
53
+ : o.all && mine.length > MOVE_CAP ? { n: 0, text: 'Show fewer', less: true } : null;
54
+ const waiting = W ? (W.rows || []).filter((r) => r && r.who).map((r) => {
55
+ const src = r.source === 'jira' ? 'Jira assignee · no update since ' + dm(r.since) : r.source === 'note' ? 'owns it from ' + (r.where || 'a meeting note') + ' · since ' + dm(r.since) : 'no reply since ' + dm(r.since);
56
+ const N = r.nudge;
57
+ const nudge = N && !N.sent && !N.snoozed ? 'Nudge drafted · goes as a ' + N.word + ' only when you send it from the Viewer' : N && N.sent ? 'Nudge sent · no reply seen yet' : '';
58
+ return { key: r.key, title: r.title, who: r.who, meta: [src, r.age].filter(Boolean).join(' · '), nudge, nudgeId: N && !N.sent ? N.id : '', link: r.link || '', note: r.note || '', ws: r.ws || '', ini: r.ini || '' };
59
+ }) : [];
60
+ // what PMOS did since yesterday (class A and B, each with Undo, lib/done-feed.js / GET /api/autonomy), said as one line with the newest Undo
61
+ const did = ((R && R.done) || []).filter((d) => { const t = Date.parse(d.at || ''); return Number.isFinite(t) && now - t <= DAY; });
62
+ const d0 = did[0] || null;
63
+ const done = d0 ? { text: 'PMOS did ' + (did.length === 1 ? 'this' : did.length + ' things') + ' since yesterday: ' + (d0.name ? d0.name + ': ' : '') + (d0.said || 'done') + (did.length > 1 ? ', and more on Good morning.' : '.'), d: d0 } : null;
64
+ const closed = W ? (W.closed || []).slice(0, 3).map((c) => c.why).filter(Boolean) : [];
65
+ return { move, fold, n: mine.length, waiting, done, closed, rest: restLine(o.products), held: heldOf({ mine }) };
66
+ }
67
+
68
+ /** What Your move holds that the list below also draws: the weekly update and a program's milestone changes (say it once). */
69
+ export function heldOf(T) {
70
+ const L = (T && (T.mine || T.move)) || [];
71
+ return { update: L.some((r) => r.kind === 'call' && r.call && r.call.kind === 'update'), programs: new Set(L.filter((r) => r.kind === 'meeting' && r.ms && r.program).map((r) => r.program)) };
72
+ }
73
+
74
+ const icon = (yd, key, label, d, cls = '') => `<button type="button"${cls ? ` class="${cls}"` : ''} data-yd="${yd}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}">${svg(d, 14, cls === 'ok' ? 2.2 : 1.8)}</button>`;
75
+ function moveRowHtml(r) {
76
+ const yes = r.yes ? icon('mv-yes', r.key, r.yes + ': ' + r.title, CHECK, 'ok') : '';
77
+ const meta = [r.sub, r.age].filter(Boolean).map(esc).join(' · ');
78
+ return `<div class="hy-r" data-key="${esc(r.key)}"><span class="st">${svg(SPARK, 15)}</span><div class="tx"><b>${esc(r.title)}</b><small><i class="k">${esc(r.callKind)}</i>${meta ? ' · ' + meta : ''}</small></div>`
79
+ + `<div class="ac">${icon('mv-open', r.key, (r.alt || 'Open it') + ': ' + r.title, OPEN)}${yes}</div></div>`;
80
+ }
81
+ function waitRowHtml(w) {
82
+ const go = w.nudgeId ? `data-hm-nudge="${esc(w.nudgeId)}"` : `data-hm-wait="${esc(w.key)}"`;
83
+ const label = w.nudgeId ? 'Look at the nudge: ' + w.title : 'Open: ' + w.title;
84
+ return `<div class="hy-r" data-key="${esc(w.key)}"><span class="st w">${svg(PERSON, 13)}</span><div class="tx"><b>${esc(w.title)}</b><small><i class="k">${esc(w.who)}</i> · ${esc(w.meta)}</small>`
85
+ + (w.nudge ? `<small><i>${svg(SPARK, 13)}</i> ${esc(w.nudge)}</small>` : '') + `</div><div class="ac"><button type="button" ${go} aria-label="${esc(label)}" title="${esc(label)}">${svg(OPEN, 14)}</button></div></div>`;
86
+ }
87
+ export function topHtml(T) {
88
+ if (!T) return '';
89
+ let h = '';
90
+ if (T.move.length) {
91
+ h += `<div class="hy-h"><span>Your move</span><span class="sp"></span><span class="n">${T.n}</span></div>${T.move.map(moveRowHtml).join('')}`;
92
+ if (T.fold) h += `<button type="button" class="hy-q" data-hm-topall aria-expanded="${!!T.fold.less}"><span>${esc(T.fold.text)}</span><span class="sp"></span>${svg(T.fold.less ? CHEVD : CHEV, 14)}</button>`;
93
+ }
94
+ if (T.waiting.length) h += `<div class="hy-h"><span>Waiting on others</span><span class="sp"></span><span class="n">${T.waiting.length}</span></div>${T.waiting.map(waitRowHtml).join('')}`;
95
+ if (T.done) {
96
+ const d = T.done.d;
97
+ h += `<div class="hy-dn"><span>${esc(T.done.text)}</span><span class="sp"></span><button type="button" class="hy-lk" data-yd="done-undo" data-ref="${esc(d.ref)}" data-via="${esc(d.via || 'proposals')}" data-ws="${esc(d.ws || '')}" data-board="${esc(d.board || '')}">Undo</button></div>`;
98
+ }
99
+ for (const c of T.closed) h += `<div class="hy-dn"><span>${esc(c)}</span></div>`;
100
+ if (h && T.rest) h += `<div class="hy-dn"><span>${esc(T.rest)}</span></div>`;
101
+ return h ? `<section class="hy" aria-label="Your move and waiting on others">${h}</section>` : '';
102
+ }
@@ -568,6 +568,8 @@ export function kanbanHtml(v, o, isOpen) {
568
568
 
569
569
  /* ── the popovers: the task card's own status segment and date picker, opened right under the press ── */
570
570
  let POP = null;
571
+ /** The press the picker hangs from moved (or left the page) since it opened. */
572
+ const moved = (P) => { if (!P.anchor || !P.anchor.isConnected || !P.at) return true; const r = P.anchor.getBoundingClientRect(); return Math.abs(r.left - P.at[0]) > 1 || Math.abs(r.top - P.at[1]) > 1; };
571
573
  export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
572
574
  /** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
573
575
  export function openPop(anchor, html, onPress, o = {}) {
@@ -583,7 +585,8 @@ export function openPop(anchor, html, onPress, o = {}) {
583
585
  el.style.setProperty('--tl-x', left + 'px'); el.style.setProperty('--tl-y', (below ? r.bottom + 6 : Math.max(8, r.top - 6 - h)) + 'px');
584
586
  }
585
587
  anchor.setAttribute('aria-expanded', 'true');
586
- POP = { el, anchor, onPress, scrim };
588
+ const ar = anchor.getBoundingClientRect();
589
+ POP = { el, anchor, onPress, scrim, at: [ar.left, ar.top] };
587
590
  const f = el.querySelector('[aria-checked="true"], [aria-pressed="true"], button'); if (f) f.focus({ preventScroll: true });
588
591
  return el;
589
592
  }
@@ -600,7 +603,8 @@ if (typeof document !== 'undefined' && document.head) {
600
603
  document.addEventListener('keydown', (e) => { if (POP && e.key === 'Escape') { e.stopPropagation(); const a = POP.anchor; closePop(); if (a && a.isConnected) a.focus(); } }, true);
601
604
  addEventListener('resize', () => { if (POP && !POP.scrim) closePop(); });
602
605
  // the view sheet stays through a scroll: its own presses redraw Tasks, and a Timeline settles its scroll as it draws
603
- document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target) && !POP.el.querySelector('.ivs')) closePop(); }, true);
606
+ // a scroll closes the picker only when it moves the press it hangs from (a scroll of the page behind the Viewer does not)
607
+ document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target) && !POP.el.querySelector('.ivs') && moved(POP)) closePop(); }, true);
604
608
  }
605
609
  /** The five icons (To do, In progress, Done, Won't do | Archive), only the current one named: the task card's segment. */
606
610
  /** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
@@ -20,6 +20,7 @@
20
20
  * 2.5 mention a conversation that waits on the PM's reply (GET /api/mentions waiting; Home's Mentions card is gone): one row each,
21
21
  * Claude's gist or the real latest message, the source, "reply drafted" when there is a draft; the press opens it
22
22
  * 4.5 outbox a draft Claude put in the outbox (GET /api/outbox, queued or blocked): it waits for the PM to send it
23
+ * 5.5 owner an action a meeting agreed that nobody owns (o.gaps, GET /api/waiting gaps): the PM's call, "… needs an owner"
23
24
  * 5.6 extra what a page hands in (o.extra): Your impact's weekly check, Claude's clean-up of "Not in an initiative"
24
25
  * Lab results are ✦ on their initiative (lib/idle-lab.js files them as proposals), so they ride in that initiative's row (rank 6).
25
26
  * AT MOST 5 SHOW (CAP). The rest are "Can wait", in the same order (Claude's rank), never gone. A rank 6 row is one press for the whole
@@ -33,7 +34,7 @@
33
34
  *
34
35
  * o: { products: [{ ws, name, board, rows }] (Board rows: r.props from lib/proposals.js viewOf, r.track, r.status),
35
36
  * programs: GET /api/programs' programs, move: GET /api/your-move answers by ws ({ [ws]: { verdicts, kr, expired } }), calls: homeList's call
36
- * rows, mentions: GET /api/mentions waiting, outbox: GET /api/outbox entries, now }
37
+ * rows, mentions: GET /api/mentions waiting, outbox: GET /api/outbox entries, gaps: GET /api/waiting gaps, now }
37
38
  * → { rows (at most CAP), wait (Can wait, ranked), older: [] (kept for old callers), expired: [{ ini, title, why, at, name }],
38
39
  * done: [{ ref, via: 'autonomy' | 'proposals', ini, board, ws, at, said, name }] (C2: what Claude finished by itself, with Undo),
39
40
  * notices: [{ job, product, until, text?, ws }] (a job demoted to propose, said once), failed: [{ run, ini, at, why, ws, name }] (agent-run
@@ -186,9 +187,10 @@ export function rankMove(o = {}) {
186
187
  title: name + ': ' + clip(said, 100), sub: [src + (m.where ? ' · ' + m.where : ''), m.reply || m.draft ? 'reply drafted' : ''].filter(Boolean).join(' · '),
187
188
  alt: 'Open the conversation' });
188
189
  }
189
- // 4.5 the drafts Claude put in the outbox: they leave PMOS only when the PM sends them (C6)
190
+ // 4.5 the drafts Claude put in the outbox: they leave PMOS only when the PM sends them (C6). A nudge (e.about: a Waiting on others row,
191
+ // home-your-move-waiting) counts only under Waiting on others, never as a Message here
190
192
  for (const e of o.outbox || []) {
191
- if (!e || !e.id || (e.state !== 'queued' && e.state !== 'blocked')) continue;
193
+ if (!e || !e.id || e.about || (e.state !== 'queued' && e.state !== 'blocked')) continue;
192
194
  const ch = String(e.channel || 'message'), to = e.recipient ? ' to ' + e.recipient : '';
193
195
  add({ key: 'ob:' + e.id, rank: 4.5, kind: 'outbox', outbox: e, tag: 'Outbox', at: tsOf(e.created_at || e.at),
194
196
  title: clip(e.subject || String(e.body || '').split('\n')[0] || 'A draft', 100), sub: 'Drafted' + (ch ? ' for ' + ch.charAt(0).toUpperCase() + ch.slice(1) : '') + to + (e.state === 'blocked' ? ' · a claim needs a look' : ' · waits for you to send'),
@@ -197,6 +199,13 @@ export function rankMove(o = {}) {
197
199
  // 5.6 the other asks a page hands in (o.extra): Your impact's weekly check, Claude's clean-up of "Not in an initiative". Their cards and
198
200
  // chips on Home are gone (the UI grill's delete list); this is where they land. { key, title, sub, go, alt }
199
201
  for (const x of o.extra || []) if (x && x.key && x.title) add({ rank: 5.6, kind: 'extra', tag: '', at: null, age: '', alt: 'Open', ...x, key: 'ex:' + x.key });
202
+ // 5.5 an action agreed in a meeting that nobody owns (GET /api/waiting gaps, home-your-move-waiting): it waits on no one, so it is the
203
+ // PM's call, "… needs an owner"; the press opens the note
204
+ for (const g of o.gaps || []) {
205
+ if (!g || !g.key || !g.title) continue;
206
+ add({ key: 'gp:' + g.key, rank: 5.5, kind: 'owner', gap: g, tag: '', at: tsOf(g.since), title: clip(g.title, 100) + ' needs an owner',
207
+ sub: 'Agreed in ' + (g.where || 'a meeting') + (g.since ? ' on ' + dm(g.since, now) : '') + ', nobody owns it', alt: 'Open the note' });
208
+ }
200
209
  // the calls only the PM can make that are not ✦ (Claude's milestone changes are rank 3 now: said once)
201
210
  for (const c of (o.calls || []).filter((x) => x && x.kind !== 'msreview')) add({ key: 'call:' + c.id, rank: 5.5, kind: 'call', call: c, title: c.name, sub: '', at: null, age: '' });
202
211
  rows.sort((a, b) => a.rank - b.rank || (a.at == null) - (b.at == null) || (a.at || 0) - (b.at || 0) || a.key.localeCompare(b.key));
@@ -4,11 +4,17 @@
4
4
  * openDraft(entry, H) the Viewer: who it is for, where it goes, the words. Copy puts the words on the clipboard so the PM sends them from
5
5
  * their own tool (no channel is connected: POST /api/outbox/confirm sends nothing yet), ✕ discards the draft with
6
6
  * Undo (POST /api/outbox/discard { id } and { id, undo: true }). A draft whose claim failed the trust rules says so.
7
+ * A NUDGE (e.about: a Waiting on others row, home-your-move-waiting) has Send, Edit and Not now instead. Its channel is named ("Goes as a
8
+ * Jira comment to MSD-4388"). Send is POST /api/outbox/confirm: with no sender registered nothing leaves and the Viewer says "No channel
9
+ * connected: copy it", with Copy. Edit saves new words (POST /api/outbox/edit, a new hash). Not now is POST /api/outbox/snooze: recorded,
10
+ * and Home hides the nudge line until 09:00 the next morning. Nothing is ever sent from Home's list.
7
11
  * H: { pmPost, toast, toastUndo, reload } */
8
12
 
9
13
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
10
14
  const SVG = (d, w = 16, sw = 2) => `<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>`;
11
- const I = { mail: 'M3 5h18v14H3zM3 7l9 6 9-6', copy: 'M8 8h11v13H8zM5 16V3h11', x: 'M6 6l12 12M18 6L6 18' };
15
+ const I = { mail: 'M3 5h18v14H3zM3 7l9 6 9-6', copy: 'M8 8h11v13H8zM5 16V3h11', x: 'M6 6l12 12M18 6L6 18', send: 'M4 12l16-8-6 16-3-7z',
16
+ pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4', later: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 8v4l3 2' };
17
+ const CHANNEL = { 'jira-write': 'Jira comment', 'team-note': 'team note', 'customer-note': 'customer note', 'calendar-hold': 'calendar hold' };
12
18
  const cap = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
13
19
 
14
20
  export function draftHtml(e) {
@@ -17,8 +23,55 @@ export function draftHtml(e) {
17
23
  return `<div class="ob-d"><p class="yd-exp">${esc(where ? 'Drafted for ' + where + '. ' : '')}It waits here until you send it.</p>${refused}`
18
24
  + (e.subject ? `<h3>${esc(e.subject)}</h3>` : '') + `<pre class="ob-body">${esc(e.body || '')}</pre></div>`;
19
25
  }
26
+ /** A nudge in the Viewer: where it goes, the words (or the edit box), and what happened on the last Send. st: { edit, noChannel } */
27
+ export function nudgeHtml(e, st = {}) {
28
+ const where = 'Goes as a ' + (CHANNEL[e.channel] || 'message') + (e.recipient ? ' to ' + e.recipient : '') + ', only when you send it.';
29
+ const nc = st.noChannel ? `<p class="yd-exp ob-nc">No channel connected: copy it. <button type="button" class="ut-btn sm soft" data-ob="copy">${SVG(I.copy, 14)} Copy</button></p>` : '';
30
+ const refused = e.claims && e.claims.ok === false && (e.claims.refused || []).length ? `<p class="yd-exp">A claim in it needs a look: ${esc((e.claims.refused || []).join('; '))}</p>` : '';
31
+ const words = st.edit ? `<label class="vh" for="obEdit">The nudge's words</label><textarea id="obEdit" class="ob-edit" rows="5">${esc(e.body || '')}</textarea><p class="ut-acts"><button type="button" class="ut-btn sm pri" data-ob="save">Save</button><button type="button" class="ut-btn sm ghost" data-ob="cancel">Cancel</button></p>`
32
+ : `<pre class="ob-body">${esc(e.body || '')}</pre>`;
33
+ return `<div class="ob-d"><p class="yd-exp">PMOS drafted this nudge. ${esc(where)}</p>${nc}${refused}${words}</div>`;
34
+ }
35
+ function openNudge(e, H, VW) {
36
+ const st = { edit: false, noChannel: false };
37
+ let body = null;
38
+ const draw = () => { if (body) body.innerHTML = nudgeHtml(e, st); if (st.edit && body) { const t = body.querySelector('#obEdit'); if (t) t.focus(); } };
39
+ const copy = async () => { try { await navigator.clipboard.writeText(e.body || ''); H.toast('Copied. Paste it where you send it.'); } catch { H.toast('It could not be copied. Select the words and copy them.'); } };
40
+ VW.open({ id: 'ob:' + e.id, kind: 'Nudge', title: e.subject || 'A nudge to send', icon: I.mail,
41
+ presses: [{ act: 'later', label: 'Not now', icon: I.later }, { act: 'edit', label: 'Edit', icon: I.pen }, { act: 'send', label: 'Send', icon: I.send, solid: true }],
42
+ onPress: async (act) => {
43
+ if (act === 'edit') { st.edit = true; draw(); return; }
44
+ if (act === 'later') {
45
+ const r = await H.pmPost('/api/outbox/snooze', { id: e.id }).catch(() => null);
46
+ if (!r || r.ok === false) { H.toast((r && r.error) || 'It could not be put off. Nothing changed.'); return; }
47
+ VW.back(); H.toast('Not now. The nudge comes back tomorrow at 09:00.'); if (H.reload) H.reload(); return;
48
+ }
49
+ if (act === 'send') {
50
+ const r = await H.pmPost('/api/outbox/confirm', { id: e.id, hash: e.hash }).catch(() => null);
51
+ if (r && r.ok) { VW.back(); H.toast('Sent.'); if (H.reload) H.reload(); return; }
52
+ if (r && r.reason === 'no channel connected') { st.noChannel = true; draw(); return; }
53
+ H.toast((r && (r.reason || r.error)) || 'It could not be sent. Nothing left PMOS.');
54
+ }
55
+ },
56
+ render: (b) => {
57
+ body = b; draw();
58
+ b.onclick = async (ev) => {
59
+ const x = ev.target.closest('[data-ob]'); if (!x) return;
60
+ if (x.dataset.ob === 'copy') { copy(); return; }
61
+ if (x.dataset.ob === 'cancel') { st.edit = false; draw(); return; }
62
+ if (x.dataset.ob === 'save') {
63
+ const t = b.querySelector('#obEdit'), words = t ? t.value : '';
64
+ if (!words.trim()) { H.toast('The nudge needs some words.'); return; }
65
+ const r = await H.pmPost('/api/outbox/edit', { id: e.id, body: words }).catch(() => null);
66
+ if (!r || r.ok === false) { H.toast((r && r.error) || 'It could not be saved. Nothing changed.'); return; }
67
+ Object.assign(e, r.entry || { body: words }); st.edit = false; st.noChannel = false; draw(); H.toast('Saved.'); if (H.reload) H.reload();
68
+ }
69
+ };
70
+ } });
71
+ }
20
72
  export function openDraft(e, H) {
21
73
  const VW = window.czViewer; if (!VW || !e || !e.id) return;
74
+ if (e.about) { openNudge(e, H, VW); return; }
22
75
  VW.open({ id: 'ob:' + e.id, kind: 'Outbox', title: e.subject || 'A draft to send', icon: I.mail,
23
76
  presses: [{ act: 'discard', label: 'Discard the draft', icon: I.x }, { act: 'copy', label: 'Copy to send it yourself', icon: I.copy, solid: true }],
24
77
  onPress: async (act) => {