create-pmos 0.735.0 → 0.737.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 +57 -33
  2. package/payload/AGENTS.md +1 -0
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/planning/evals/eval-calibration.md +1 -1
  5. package/payload/planning/okrs/health-budgets.md +1 -1
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/changelog.json +56 -0
  8. package/workspace/guide/cli.md +9 -0
  9. package/workspace/guide/home.md +1 -0
  10. package/workspace/guide/initiatives-and-next-steps.md +1 -1
  11. package/workspace/guide/layout.md +13 -3
  12. package/workspace/guide/positioning.md +5 -3
  13. package/workspace/lib/pmos-verbs.js +3 -0
  14. package/workspace/lib/positioning-cli.js +91 -0
  15. package/workspace/lib/use-log.js +26 -4
  16. package/workspace/package-lock.json +2 -2
  17. package/workspace/package.json +1 -1
  18. package/workspace/public/pm/action-keys.js +1 -1
  19. package/workspace/public/pm/bd-ini-panel.js +3 -2
  20. package/workspace/public/pm/bd-pop-ds.css +18 -0
  21. package/workspace/public/pm/bd-pop-ds.js +33 -3
  22. package/workspace/public/pm/bd-views.js +9 -1
  23. package/workspace/public/pm/cozy-board.css +7 -0
  24. package/workspace/public/pm/cozy-day-pick.css +0 -1
  25. package/workspace/public/pm/cozy-ev.css +9 -0
  26. package/workspace/public/pm/cozy-nav.js +2 -0
  27. package/workspace/public/pm/cozy-pop-work.js +16 -13
  28. package/workspace/public/pm/cozy-today-app.js +37 -3
  29. package/workspace/public/pm/cozy-today-model.js +12 -4
  30. package/workspace/public/pm/cozy-today-page.css +7 -0
  31. package/workspace/public/pm/cozy-today-view.js +15 -9
  32. package/workspace/public/pm/cozy-viewer.js +17 -2
  33. package/workspace/public/pm/focus-mode.js +161 -0
  34. package/workspace/public/pm/home-chat.js +4 -2
  35. package/workspace/public/pm/ini-tasks.js +8 -18
  36. package/workspace/public/pm/open-questions-view.js +96 -0
  37. package/workspace/public/pm/range-pick.css +50 -0
  38. package/workspace/public/pm/range-pick.js +155 -0
  39. package/workspace/public/pm/task-card.css +2 -19
  40. package/workspace/public/pm/task-card.js +16 -36
  41. package/workspace/stage-card-tasks-test.js +11 -11
  42. package/workspace/task-card-test.js +17 -10
  43. package/workspace/task-views-test.js +7 -5
  44. package/workspace/test-lists/chat-open-keeps-back.json +9 -0
  45. package/workspace/test-lists/focus-mode.json +9 -0
  46. package/workspace/test-lists/open-questions-view.json +9 -0
  47. package/workspace/test-lists/range-pick.json +5 -0
@@ -9,6 +9,7 @@
9
9
  * listHtml(rows, W, o) → the Work breakdown's List: one capture Input, one group per stage with tasks, empty stages folded into one line
10
10
  * wbsHead(view) → the Work breakdown's head: its name and the List / Gantt tabs
11
11
  * caseHtml(W, o) → The case: its lines (each editable), the facts; no line written: one Suggestion to draft them all
12
+ * overviewHtml(W, r, o) → Overview: Where it stands, The case and its facts in one block that folds; folded, the one-line summary
12
13
  * artsHtml(arts) → Artefacts: a List with Add in the head
13
14
  * stageKeyOf(text, st) → { key, name, title } the stage a captured line names ("… in Plan"), else the stage in progress
14
15
  *
@@ -80,7 +81,8 @@ export function sugHtml(s) {
80
81
  + `<dl>${row('Why', esc(s.why))}${row('PMOS will', will.length && !(will.length === 1 && will[0] === s.say) ? `<ul>${will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${row('Based on', esc(src), 'src')}</dl>`
81
82
  + `<div class="ans">${ans}</div></div>`;
82
83
  }
83
- export function standsHtml(W, r, o = {}) {
84
+ /** The three parts of Where it stands: the summary, the Next line, the first Suggestion (none when read-only) and "n more". */
85
+ function standsParts(W, r, o = {}) {
84
86
  const say = (W.summary && W.summary.text) || '';
85
87
  const nx = nextOf(r, W);
86
88
  const next = nx.length ? `<p class="pm-row pwd-next"><span class="pm-meta">Next</span>${nx.map((x) => {
@@ -91,6 +93,10 @@ export function standsHtml(W, r, o = {}) {
91
93
  }).join('')}</p>` : '';
92
94
  const s = (W.suggests || [])[0], more = Math.max(0, (W.suggests || []).length - 1) + (W.more || 0);
93
95
  const sug = o.ro ? '' : sugHtml(s) + (more ? `<p class="pwd-moresug"><button type="button" class="pw-lk" data-pw-props>${esc(plural(more, 'more suggestion', 'more suggestions'))}</button></p>` : '');
96
+ return { say, next, sug, n: o.ro ? 0 : (s && s.say ? 1 : 0) + more };
97
+ }
98
+ export function standsHtml(W, r, o = {}) {
99
+ const { say, next, sug } = standsParts(W, r, o);
94
100
  if (!say && !next && !sug) return '';
95
101
  return `<section class="pm-block pwd-blk pwd-stands" aria-label="Where it stands"><h2 class="pm-h-sm pm-row">${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}Where it stands</h2>`
96
102
  + (say ? `<p class="pwd-say">${esc(say)}</p>` : '') + next + sug + '</section>';
@@ -240,7 +246,7 @@ export function sourceItems(c, f = 'all') {
240
246
  /* ── the side column ── */
241
247
  /** The case: the lines PMOS read from the records, each a press that edits it in place; a line not written offers a PMOS draft. No line
242
248
  * written: one Suggestion drafts them all (✓ sends the asks to Ask PMOS), ✕ says not now, the pencil starts the first line yourself. */
243
- export function caseHtml(W, o = {}) {
249
+ function caseParts(W, o = {}) {
244
250
  const ov = W.overview || { lines: [] }, dr = o.dropped || new Set(), oid = o.oid || '';
245
251
  const L = ov.lines || [], none = L.length && L.every((x) => !x.text);
246
252
  const sid = (x) => 'ov:' + oid + ':' + x.id;
@@ -263,7 +269,31 @@ export function caseHtml(W, o = {}) {
263
269
  }).join('');
264
270
  const F = (W.facts || []).filter((f) => f && f.k !== 'Stage' && !/^no signal$/i.test(String(f.v || '').trim()));
265
271
  const facts = F.length ? `<dl class="pwd-facts">${F.map((f) => `<dt>${esc(f.k)}</dt><dd>${f.act && !f.read && !o.ro ? `<button type="button" class="pw-lk" data-pw-fact="${esc(f.act)}">${esc(f.v)}</button>` : `<span class="${f.grey ? 'grey' : ''}${f.warn && !f.note ? ' warn' : ''}">${esc(f.v)}</span>`}${f.note ? ` <span class="pm-meta${f.warn ? ' warn' : ''}">${esc(f.note)}</span>` : ''}</dd>`).join('')}</dl>` : '';
266
- return `<section class="pm-block pwd-blk pwd-case" aria-label="The case"><h2 class="pm-h-sm">The case</h2>${top}${lines}${ov.status && !W.summary ? `<p>${esc(ov.status)}</p>` : ''}${facts}</section>`;
272
+ return { top, lines, status: ov.status && !W.summary ? `<p>${esc(ov.status)}</p>` : '', facts };
273
+ }
274
+ export function caseHtml(W, o = {}) {
275
+ const c = caseParts(W, o);
276
+ return `<section class="pm-block pwd-blk pwd-case" aria-label="The case"><h2 class="pm-h-sm">The case</h2>${c.top}${c.lines}${c.status}${c.facts}</section>`;
277
+ }
278
+
279
+ /* ── Overview: Where it stands, The case and the facts in one block that folds (Wawan, 2026-11-23) ── */
280
+ /** o: { open (default true), ro, oid, dropped }. Open: the three parts side by side. Folded: the one-line Where it stands, and a press
281
+ * that opens it when PMOS has a suggestion waiting. The block's head is the fold press (data-pw-ov). Nothing to show: ''. */
282
+ export function overviewHtml(W, r, o = {}) {
283
+ const s = standsParts(W, r, o), c = caseParts(W, o), open = o.open !== false;
284
+ if (!s.say && !s.next && !s.sug && !c.top && !c.lines && !c.status && !c.facts) return '';
285
+ const head = `<h2 class="pm-h-sm"><button type="button" class="pwd-ovt" data-pw-ov aria-expanded="${open}">${SV(open ? I.down : I.right, 16)}${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}Overview</button></h2>`;
286
+ if (!open) {
287
+ const line = s.say || (W.overview && W.overview.status) || '';
288
+ const one = line ? `<p class="pwd-say pwd-ov1">${esc(line)}</p>` : s.next;
289
+ const sg = s.n ? `<button type="button" class="pw-lk" data-pw-ov>${esc(plural(s.n, 'suggestion', 'suggestions'))}</button>` : '';
290
+ return `<section class="pm-block pwd-blk pwd-ov shut" aria-label="Overview">${head}${one || sg ? `<div class="pm-row pwd-ovs">${one}${sg}</div>` : ''}</section>`;
291
+ }
292
+ const part = (cls, lbl, h) => (h ? `<div class="pwd-ovp ${cls}"><h3 class="pm-meta">${lbl}</h3>${h}</div>` : '');
293
+ const stands = part('pwd-ovw', 'Where it stands', (s.say ? `<p class="pwd-say">${esc(s.say)}</p>` : '') + s.next + s.sug);
294
+ const kase = part('pwd-ovc', 'The case', c.top + c.lines + c.status);
295
+ const facts = part('pwd-ovf', 'Details', c.facts);
296
+ return `<section class="pm-block pwd-blk pwd-ov" aria-label="Overview">${head}<div class="pwd-ovg">${stands}${kase}${facts}</div></section>`;
267
297
  }
268
298
  const iconOf = (a) => (a.link || /^link/i.test(a.kind || '') ? I.link : /slide|deck/i.test(a.kind || '') ? I.deck : /proto|design/i.test((a.kindName || '') + ' ' + (a.kind || '') + ' ' + (a.akind || '')) ? I.proto : I.doc);
269
299
  /** arts: the model's artefacts, in its order (each row's press is its index, as the popup's handler reads it). o: { ro, merge (the ✦ line) } */
@@ -50,6 +50,14 @@ export function sigHtml(r) {
50
50
  return `<details class="bd-sig"><summary data-signals aria-label="${esc(sigWords(s.n))}" title="${esc(sigWords(s.n))}">${SV(SIG_IC)}<span>${s.n}</span></summary>`
51
51
  + `<div class="bd-sigp" role="group" aria-label="${esc(sigWords(s.n))} for ${esc(r.title)}"><ul>${items}${more}</ul></div></details>`;
52
52
  }
53
+ /** The same list as a section of the item's panel (roadmap-signal-phone): on a phone the row is one button, so the tap opens the panel and
54
+ * the panel lists the signals. Zero is silence: nothing without a signal. */
55
+ export function sigListHtml(r) {
56
+ const s = r && r.signals;
57
+ if (!s || !s.n) return '';
58
+ const html = sigHtml(r), ul = html.slice(html.indexOf('<ul>'), html.lastIndexOf('</ul>') + 5);
59
+ return `<section class="bd-sigs" aria-label="${esc(sigWords(s.n))}"><h3>${esc(sigWords(s.n))}</h3>${ul}</section>`;
60
+ }
53
61
  /** One open list at a time: opening one closes the others, and a press outside closes it. */
54
62
  let sigBound = false;
55
63
  function bindSig() {
@@ -313,7 +321,7 @@ function phoneRow(r) {
313
321
  const stIc = st ? '<svg class="bd-stic" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/></svg>' : '';
314
322
  // PhIniB: the row's own line, start to end, today and the next ◇; it says the end, so the meta line does not
315
323
  const line = PL.lineHtml(r, { today, next: ahead, alert: s.tone === 'red' || s.tone === 'late' || s.tone === 'risk' });
316
- const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the panel the row opens is the tap
324
+ const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the tap opens the panel, which lists them (sigListHtml)
317
325
  const sub = [st ? stIc + esc(st) : '', line ? '' : ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
318
326
  return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s q">${sub}</span>${line}</span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
319
327
  }
@@ -1608,3 +1608,10 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1608
1608
  .bd-sigp li:first-child { border-top: 0; }
1609
1609
  .bd-sigp .bd-sign { display: block; color: var(--cz-ink2); }
1610
1610
  .bd-sigl { color: var(--cz-blueink); }
1611
+ /* the same list in the item's panel (roadmap-signal-phone; pm/bd-views.js sigListHtml): the phone's tap reaches it */
1612
+ .bd-sigs { margin: var(--space-12) 0; padding: var(--space-8) var(--space-12); border: 1px solid var(--cz-hair); border-radius: 14px; background: var(--cz-card); }
1613
+ .bd-sigs h3 { margin: 0 0 var(--space-4); font: var(--fw-strong) var(--fs-label)/var(--lh-label) var(--cz-sans); color: var(--cz-ink2); }
1614
+ .bd-sigs ul { list-style: none; margin: 0; padding: 0; }
1615
+ .bd-sigs li { padding: 6px 0; border-top: 1px solid var(--cz-hair); font-size: var(--fs-label); line-height: var(--lh-label); }
1616
+ .bd-sigs li:first-child { border-top: 0; }
1617
+ .bd-sigs .bd-sign { display: block; color: var(--cz-ink2); }
@@ -25,4 +25,3 @@
25
25
  .sw .sw-b:hover { background: var(--cz-well); }
26
26
  .sw .sw-b[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cz-blue) inset; font-weight: var(--fw-strong); }
27
27
  .sw-day:not(:empty) { margin-top: var(--space-8); }
28
- .pw-dp + .pw-dp { margin-top: var(--space-8); }
@@ -547,3 +547,12 @@
547
547
  .ev-keys.pm-ds { border: 0; border-radius: var(--radius-card); background: var(--card); color: var(--ink); box-shadow: var(--lift); padding: var(--space-24); width: fit-content; max-width: calc(100% - var(--space-32)); }
548
548
  .ev-keys.pm-ds > .pm-row { justify-content: space-between; }
549
549
  .ev-keys.pm-ds > ul { list-style: none; margin: var(--space-16) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
550
+
551
+ /* ── focus mode (pm/focus-mode.js, bet A335): f hides every part of the page except the item and its chat; f again puts it back.
552
+ * A hidden part carries data-pm-focus-off (and inert). The rail gives its width back, the popup takes the whole window, and the icon-only
553
+ * Leave focus button (pm-btn) sits at the top right, above the popup. Tokens only. ── */
554
+ html body.pm-focus [data-pm-focus-off] { display: none !important; }
555
+ body.pm-focus.cz-railon { --cz-railx: var(--space-16); }
556
+ body.pm-focus .cz-pop-card { inset: 0; border-radius: 0; }
557
+ .pm-focus-bar { position: fixed; top: var(--space-8); right: var(--space-8); z-index: 1000; }
558
+ .pm-focus-bar .pm-focus-leave { background: var(--card); color: var(--ink); box-shadow: var(--lift); }
@@ -46,6 +46,7 @@ import './draft-keep.js'; // forms-keep-drafts: every text box on every page k
46
46
  import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
47
47
  import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
48
48
  import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
49
+ import { startFocusMode } from './focus-mode.js'; // bet A335: f shows only the item under the pointer and its chat; f again puts the page back
49
50
 
50
51
  /* The six places (slice 1). A place shows once it has an href: Events, Library and Routine get theirs when their slice ships. Until then
51
52
  * Today is today.html (slice 5; Home before it), Work is the Board and Goals is premium-goals.html (slice 9; Intelligence before it); the keys stay the pages' own (home, board, insights). */
@@ -204,6 +205,7 @@ export function mountNav(here, doc = document, opts = {}) {
204
205
  mountToastFaces(doc); loadPrefs();
205
206
  startUseLog(doc);
206
207
  startActionKeys(doc);
208
+ startFocusMode(doc);
207
209
  const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
208
210
  const draw = () => {
209
211
  N.rail = railOn();
@@ -24,7 +24,8 @@ import { pmGet, pmPost } from './http.js';
24
24
  import * as VW from './cozy-viewer.js';
25
25
  import * as ED from './ini-edit.js';
26
26
  import * as SW from './cozy-status-when.js'; // When did this happen? after a status pick (round 3 point 18)
27
- import * as DP from './cozy-day-pick.js'; // the app's own day field, "15 Oct 2026"
27
+ import * as DP from './cozy-day-pick.js'; // the app's own day form, "15 Oct 2026"
28
+ import { mountRange, rangeHtml } from './range-pick.js'; // start and due on one calendar, like a flight's depart and return
28
29
  const { localToday } = DP;
29
30
  import * as AK from './artefact-kind.js';
30
31
  import * as WT from './work-tree.js'; // subtasks, the epic check and its fix (initiative work-subtasks)
@@ -359,6 +360,9 @@ export function html(r, v, o = {}) {
359
360
  * Work breakdown as List or Gantt) and the side column (The case, Artefacts), from the system's blocks (pm/bd-pop-ds.js). The Gantt view is the
360
361
  * breakdown table with its bars and tools; List and Gantt are one remembered choice ('pw-view'). */
361
362
  const VIEW = 'pw-view';
363
+ // the Overview fold: one choice for every initiative, kept under a key that follows the person (lib/prefs-sync.js, prefix 'cz-vw-fold:')
364
+ const OV = 'cz-vw-fold:initiative:overview';
365
+ const ovOpen = () => { try { return localStorage.getItem(OV) !== '0'; } catch { return true; } };
362
366
  const allOpen = (v) => { const k = new Set(((v.tasks || {}).sections || []).filter((s) => s.kind === 'stage').map((s) => s.key)); return k; };
363
367
  // the List (S given): every stage with tasks open but a finished one (Wawan, 2026-11-22), and the PM's own fold and unfold, shared with the
364
368
  // Gantt. No S (a lookup: which stage holds a task, which stage a line names): every stage open, so every task is a row
@@ -384,8 +388,9 @@ function dsHtml(r, v, o, W, S, C, mode) {
384
388
  const mg = mergeOf(W.artefacts), merge = mg ? `<div class="pw-sugs pw-amg" role="list" aria-label="PMOS suggests">${sugLine({ id: mg.id, say: mg.say, merge: mg })}</div>` : '';
385
389
  // the done test's acceptance criteria on the initiative's Jira tickets (jira-criteria-write): its ✦ above the breakdown, unless the PM said no
386
390
  const crit = S.sel.size || dropped().has('crit:' + id) ? '' : critSugHtml(CRIT.get(id));
387
- return `<div class="pw pwd">${'<div class="pwd-main">'}${PD.standsHtml(W, r)}${PD.stagesHtml(st, W)}${crit}${wbs}</div>`
388
- + `<aside class="pwd-side">${PD.caseHtml(W, { oid: id, dropped: dropped() })}${PD.artsHtml(W.artefacts, { merge })}</aside></div>`;
391
+ // Overview (Wawan, 2026-11-23): Where it stands, The case and its facts in one block across the top; folded or open is the person's choice
392
+ return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}<div class="pwd-main">${PD.stagesHtml(st, W)}${crit}${wbs}</div>`
393
+ + `<aside class="pwd-side">${PD.artsHtml(W.artefacts, { merge })}</aside></div>`;
389
394
  }
390
395
 
391
396
  /** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
@@ -651,6 +656,7 @@ export function wire(body, h0, x0) {
651
656
  const h = body.__pwh, x = body.__pwx;
652
657
  const d = b.dataset, S = c.S, W = c.W;
653
658
  if (d.pwv) { store.set(VIEW, d.pwv); redraw(); return; }
659
+ if ('pwOv' in d) { try { localStorage.setItem(OV, ovOpen() ? '0' : '1'); } catch { /* a private window */ } redraw(); return; }
654
660
  if ('pwDetails' in d) { S.details = !S.details; redraw(); return; }
655
661
  if (d.pwFold != null) { const k = d.pwFold, open = b.getAttribute('aria-expanded') === 'true'; S.open.delete(k); S.shut.delete(k); (open ? S.shut : S.open).add(k); if (k === '') looseKeep(c.id, !open); redraw(); return; }
656
662
  if ('pwFar' in d) { S.farOpen = true; redraw(); return; }
@@ -883,16 +889,13 @@ function setKind(row, on, h) { ED.milestone(h, { uid: row.uid, start: row.start,
883
889
  function dateMenu(btn, uid, c, h) {
884
890
  const row = c.W.rows.find((x) => x.uid === uid) || {};
885
891
  const seg = `<div class="pw-seg" role="radiogroup" aria-label="Task or milestone"><button type="button" role="radio" aria-checked="${!row.ms}" data-ty="task">${SVG(P.box, 13, 2)}Task</button><button type="button" role="radio" aria-checked="${!!row.ms}" data-ty="ms">${SVG(P.dia, 13, 2)}Milestone</button></div>`;
886
- // the app's own day form, "15 Oct 2026", with its small calendar (pm/cozy-day-pick.js), never the browser's month-first field
887
- const fields = row.ms ? '<div class="pw-dp" data-f="due"></div>' : '<div class="pw-dp" data-f="start"></div><div class="pw-dp" data-f="due"></div>';
888
- const el = openPop(btn, 'pw-date', seg + fields + jiraNote(row) + `<div class="hi-acts"><button type="button" class="hi-btn ghost" data-clear>No date</button></div>`, (b) => {
889
- if (b.dataset.ty) { const on = b.dataset.ty === 'ms'; closePop(); if (on !== !!row.ms) setKind(row, on, h); return; }
890
- if ('clear' in b.dataset) { closePop(); if (h.dates) h.dates(uid, row.ms ? { due: '' } : { start: '', due: '' }); }
891
- }, { label: 'Set the date', focus: '.dp-in' });
892
- const st = el.querySelector('[data-f="start"]'), due = el.querySelector('[data-f="due"]');
893
- if (st) DP.mountDay(st, { label: 'Start', value: row.start || '', onPick: (v) => { if (h.dates) h.dates(uid, { start: v }); } });
894
- DP.mountDay(due, { label: row.ms ? 'Date' : 'Due', value: row.end || row.start || '', open: !st, onPick: (v) => { closePop(); if (h.dates) h.dates(uid, { due: v }); } });
895
- (st || due).querySelector('.dp-in')?.focus();
892
+ // start and due on one calendar (pm/range-pick.js): the first tap sets the start, the second the due day; a milestone one date
893
+ const R = { start: row.ms ? '' : row.start || '', due: row.end || (row.ms ? row.start : '') || '', one: !!row.ms };
894
+ // drawn into the popup first, so it is placed at its full size; mountRange then wires the same markup
895
+ const el = openPop(btn, 'pw-date', seg + `<div class="pw-rp">${rangeHtml(R)}</div>` + jiraNote(row), (b) => {
896
+ if (b.dataset.ty) { const on = b.dataset.ty === 'ms'; closePop(); if (on !== !!row.ms) setKind(row, on, h); }
897
+ }, { label: 'Set the date', focus: '.rp-g [tabindex="0"]' });
898
+ mountRange(el.querySelector('.pw-rp'), { ...R, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } });
896
899
  }
897
900
  function rowMenu(btn, uid, c, h, body) {
898
901
  const row = c.W.rows.find((x) => x.uid === uid) || {};
@@ -37,6 +37,20 @@ export function mountToday(ctx) {
37
37
  X.read = true;
38
38
  draw();
39
39
  readReports();
40
+ readQuestions();
41
+ }
42
+ /* open-questions-today (A420, board QuestionsA): every product's register (GET /api/open-questions), one list for the Decide tab. A product
43
+ * that does not answer is left out; nothing is guessed. Read-only: taking a default and putting it off a week are slice 2. */
44
+ async function readQuestions() {
45
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
46
+ const L = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
47
+ const got = await Promise.all(L.map((ws) => ctx.pmGet('/api/open-questions' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
48
+ const lines = [];
49
+ got.forEach((r, i) => { if (r && r.ok && Array.isArray(r.lines)) for (const l of r.lines) lines.push({ ...l, ws: r.ws || L[i] }); });
50
+ console.info('[open-questions-today] products=' + L.length + ' lines=' + lines.length);
51
+ if (JSON.stringify(lines) === JSON.stringify(X.questions || [])) return;
52
+ X.questions = lines;
53
+ draw();
40
54
  }
41
55
  // the reports that go out today, at their time (GET /api/events-place; 202 while a Board is read: ask again in a moment, three times)
42
56
  async function readReports(n = 0) {
@@ -68,7 +82,7 @@ export function mountToday(ctx) {
68
82
  const R = ctx.review();
69
83
  const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
70
84
  const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
71
- own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, productOf, now });
85
+ own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now });
72
86
  const lead = L.rows.find((r) => !r.done && r.src !== 'note' && r.src !== 'own' && r.src !== 'lab');
73
87
  const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, reports: X.reports || [], focus: lead ? { key: lead.key, title: lead.title } : null, now,
74
88
  iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
@@ -94,7 +108,7 @@ export function mountToday(ctx) {
94
108
  }
95
109
  const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
96
110
  // the log filters by job (All, Reply, Do, Decide, Send) on a desk and a phone; a job whose count went to zero goes back to All
97
- if (X.job && !(L.counts || {})[X.job.toLowerCase()]) X.job = '';
111
+ if (X.job && !(L.counts || {})[X.job.toLowerCase()] && !(X.job === 'Decide' && L.questions && L.questions.others.length)) X.job = '';
98
112
  if (phone()) {
99
113
  // PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
100
114
  if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
@@ -129,7 +143,25 @@ export function mountToday(ctx) {
129
143
  const what = [n.summary ? 'summary' : '', t ? t + (t === 1 ? ' task' : ' tasks') : ''].filter(Boolean).join(' and ');
130
144
  return { id: String(n.id), title: n.initiative.title, meeting: n.title || '', ini: n.initiative.id || null, sub: [when, min ? min + ' min' : '', what].filter(Boolean).join(' · ') };
131
145
  }
132
- const rowOf = (key) => (X.model ? X.model.rows.flatMap((r) => [r, ...(r.members || [])]).find((r) => r.key === key) : null);
146
+ const rowOf = (key) => {
147
+ if (!X.model) return null;
148
+ const r = X.model.rows.flatMap((x) => [x, ...(x.members || [])]).find((x) => x.key === key);
149
+ if (r || !/^q:/.test(String(key))) return r || null;
150
+ // a row of the Decide tab's groups (open-questions-today): it is no log row, so it carries the register's line as its ref
151
+ const Q = X.model.questions || { mine: [], others: [] }, q = Q.mine.concat(Q.others).find((x) => x.key === key);
152
+ return q ? { key, src: 'question', title: q.title, ini: q.ini, ws: q.ws, ref: q } : null;
153
+ };
154
+ /** A question opens where it is answered: its initiative (its drafts, its held changes and its sign-offs live there). */
155
+ function openQuestion(q) {
156
+ if (q && q.ini && ctx.hasIni(q.ini)) { ctx.goIni(q.ini); return; }
157
+ ctx.toast('PMOS cannot open ' + ((q && q.line && q.line.title) || 'this initiative') + ' from Today. Find it in Work.');
158
+ }
159
+ /** Remind on a teammate's row: the chat gets a draft to read and send; nothing is sent from here. */
160
+ function remindQuestion(q) {
161
+ if (!q) return;
162
+ const text = 'Draft a short reminder to ' + (q.owner || 'the owner') + ' about ' + (q.line && q.line.title ? q.line.title : q.ini) + ': ' + q.title.replace(/^[^:]+:\s*/, '') + ' It has waited ' + q.age + (q.age === 1 ? ' day.' : ' days.');
163
+ import('./page-chat.js').then((PC) => PC.ask(text, { ws: q.ws || undefined, here: 'Today' })).catch(() => ctx.toast('The chat did not open. Nothing was sent.'));
164
+ }
133
165
  const snap = (r) => ({ title: r.title, work: r.work, job: r.job, type: r.type });
134
166
  async function mark1(key, act, extra) {
135
167
  const r = await ctx.pmPost('/api/today-log/mark', { key, act, day: day(), ...extra }).catch(() => null);
@@ -179,6 +211,7 @@ export function mountToday(ctx) {
179
211
  }
180
212
  if (r.src === 'move') { if (ref.kind === 'task' && r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini, { task: (ref.task && ref.task.uid) || null }); return; } pop(r); ctx.select(r.key); if (ref.kind === 'session') chatPop(); return; }
181
213
  if (r.src === 'item') { if (r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini); return; } pop(r); import('./home-work.js').then((M) => M.openWorkItem(ref.key)).catch(() => {}); return; }
214
+ if (r.src === 'question') { openQuestion(ref); return; }
182
215
  if (r.src === 'draft') { pop(r); ctx.openFinished(ref.fin); return; }
183
216
  if (r.src === 'review') { pop(r); ctx.openReviewVw(); return; }
184
217
  if (r.src === 'lab') { pop(r); ctx.openLab(ref); }
@@ -406,6 +439,7 @@ export function mountToday(ctx) {
406
439
  ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
407
440
  }
408
441
  const r = rowOf(key); if (!r) return;
442
+ if (act === 'q-remind') { remindQuestion(r.ref); return; }
409
443
  if (act === 'open') { open(r); return; }
410
444
  if (act === 'date') { chooseDate(r, b); return; }
411
445
  if (X.busy.has(key)) return;
@@ -28,6 +28,7 @@
28
28
  * more, PMOS suggests to drop it (one ✦ line under the row, ✓ ✕), unless the PM kept it in the last CARRY_DROP days.
29
29
  * FIRST ("!"). What the PM marked first, a verdict or a grill finding on shipped or late work (move-rank's ranks 1 and 2), and a send that
30
30
  * goes out today. The rest follow in the rank's order. Done rows close the table. */
31
+ import { rowsOf as questionRows, overviewSay as questionsSay } from './open-questions-view.js'; // open-questions-today (A420): the register in the Decide tab
31
32
  import { didLeft, notASentence, asWritten, askTitle, proofText } from './mention-one-model.js'; // what PMOS did on an ask, from records (round 3 point 13); the title when no sentence can be made
32
33
 
33
34
  export const CARRY_DROP = 30; // days carried before PMOS suggests to drop it
@@ -140,7 +141,7 @@ function typeOf(r) {
140
141
  const ref = r.ref || {};
141
142
  if (r.bullet === 'note' || r.src === 'note') return 'Note';
142
143
  if (r.src === 'draft') return 'Report';
143
- if (r.src === 'lab') return 'Decision';
144
+ if (r.src === 'lab' || r.src === 'question') return 'Decision';
144
145
  if (r.src !== 'ask') return 'Task';
145
146
  switch (ref.kind) {
146
147
  case 'mention': return 'Ask';
@@ -155,7 +156,7 @@ function typeOf(r) {
155
156
  /**
156
157
  * o: { rank: { rows, wait } (rankMove), move: home-list move rows, items: my-work-premium Today rows ({ key, id, title, ini, at, due?, overdue }),
157
158
  * drafts: [{ id, title, ini? }], review: { title } | null, own: today-log entries, marks: today-log marks, lab: [{ ws, board, id, title, why }],
158
- * titleOf(ini) → the initiative's name, now }
159
+ * questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name, now }
159
160
  * A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
160
161
  */
161
162
  export function logModel(o = {}) {
@@ -242,6 +243,10 @@ export function logModel(o = {}) {
242
243
  when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today), done: !!e.done, ref: e });
243
244
  }
244
245
  for (const f of o.lab || []) if (f && f.id) put({ key: 'lab:' + (f.ws || '') + ':' + f.id, src: 'lab', bullet: 'lab', title: f.title, work: '', job: 'Decide', why: f.why || '', ref: f });
246
+ // open-questions-today (A420): the register (GET /api/open-questions) is the Decide tab's two groups; a line waiting on the PM whose
247
+ // default is due today or earlier is also one Decide row in All, so the day's log names it once
248
+ const Q = questionRows(o.questions || [], today);
249
+ for (const q of Q.mine) if (q.dueToday) put({ key: q.key, src: 'question', bullet: 'task', title: q.title, ini: iniOnly(q.ini), ws: q.ws, work: q.meta, job: 'Decide', carried: 0, late: false, when: '', reason: q.under, ref: q });
245
250
  oneLine(out);
246
251
  // a row done today whose source has let it go keeps its × from what it said when it was done
247
252
  for (const [k, m] of Object.entries(marks)) {
@@ -256,7 +261,8 @@ export function logModel(o = {}) {
256
261
  sameJob(out, marks);
257
262
  const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
258
263
  const n = (j) => open.filter((r) => r.job === j).length;
259
- const counts = { decide: n('Decide'), do: n('Do'), reply: n('Reply'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
264
+ const inLog = new Set(out.filter((r) => r.src === 'question' && !r.done).map((r) => r.key));
265
+ const counts = { decide: n('Decide') + Q.mine.filter((q) => !inLog.has(q.key)).length, do: n('Do'), reply: n('Reply'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
260
266
  // one quiet line counts the log; a part that is zero is left out
261
267
  const line = [counts.decide && counts.decide + ' to decide', counts.do && counts.do + ' to do', counts.reply && counts.reply + ' to reply', counts.send && counts.send + ' to send'].filter(Boolean).join(' · ');
262
268
  const types = {}; for (const r of open) types[r.type] = (types[r.type] || 0) + 1;
@@ -266,7 +272,8 @@ export function logModel(o = {}) {
266
272
  for (const r of G.first) r.group = 'first'; for (const r of G.today) r.group = 'today'; for (const r of G.wait) r.group = 'wait';
267
273
  for (const r of done) r.group = 'today';
268
274
  const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
269
- return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old };
275
+ return { rows: G.first.concat(G.today, done, G.wait), first: G.first, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
276
+ questions: { mine: Q.mine, others: Q.others } };
270
277
  }
271
278
  /** ONE THING, ONE LINE (Wawan's live Today, 2026-11-19): the lines of one brief item or one Jira ticket (srcOf) are one line, with every key
272
279
  * behind it (a mark goes to each). The item the PM put on today stays, since Done, Later and a date write to it; it takes the ask's Work, Type
@@ -420,6 +427,7 @@ export function overviewModel(L, A = {}) {
420
427
  refs.push({ text, key: r.key });
421
428
  return text + ' (' + (ask ? plural(r.carried, 'day', 'days') : r.reason.replace(/^(Late|Due|Goes|You|A)\b/, (w) => w.toLowerCase())) + ')';
422
429
  });
430
+ const qs = questionsSay(L.questions); if (qs) parts.push(qs);
423
431
  if (top.length) parts.push('Start with ' + (top.length === 1 ? top[0] : top.slice(0, -1).join(', ') + ' and ' + top[top.length - 1]) + '.');
424
432
  const freeW = A.free ? 'You have ' + durWord(A.free) + ' free' : '';
425
433
  const nextW = A.next ? (A.nextFirst ? 'your first meeting is at ' : 'your next meeting is at ') + A.next : '';
@@ -174,3 +174,10 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
174
174
  .tdp-sh .pm-sug.x .ans { gap: var(--space-12); }
175
175
  .tdp-sh .pm-sug.x .ans .pm-btn { width: 44px; height: 44px; padding: 0; border-radius: var(--radius-pill); display: inline-grid; place-items: center; }
176
176
  }
177
+ /* open-questions-today (A420, board QuestionsA): the Decide tab's two groups; the line under a row says what PMOS does if nobody answers */
178
+ .oq-r .oq-u { display: flex; align-items: flex-start; gap: var(--space-4); }
179
+ .oq-r .oq-u .pm-ic { flex: none; margin-top: 2px; }
180
+ @media (max-width: 760px) {
181
+ .tdp-gh { padding: 18px 0 10px; font-size: var(--fs-label); font-weight: var(--fw-strong); letter-spacing: .08em; text-transform: uppercase; color: var(--cz-ink2); line-height: var(--lh-label); }
182
+ .tdp-m.oq-u.d { color: var(--cz-blueink); }
183
+ }
@@ -16,6 +16,7 @@
16
16
  * a Summary block for the meeting PMOS recorded and filed, with one Suggestion (keep it filed, or take it out).
17
17
  * Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
18
18
 
19
+ import { groupsHtml as questionGroups, phoneGroupsHtml as phoneQuestionGroups } from './open-questions-view.js'; // open-questions-today (A420)
19
20
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
20
21
  const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
21
22
  /** The system's icon (pm-ic: stroke, size and caps come from the part). */
@@ -64,7 +65,8 @@ export function rowHtml(r, o = {}) {
64
65
  const t = r.title;
65
66
  let acts = '';
66
67
  if (!r.done && r.src !== 'note') {
67
- if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
68
+ if (r.src === 'question') acts = ib('open', 'Answer: ' + t, I.decide, r.key); // the register's line: it is answered where it opens, not marked done here
69
+ else if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
68
70
  else {
69
71
  const j = JOB_ACT[r.job];
70
72
  acts = (j ? ib(j[0], j[1] + ': ' + t, j[2], r.key) : '') + ib('done', 'Done: ' + t, I.done, r.key)
@@ -111,17 +113,18 @@ export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['S
111
113
  export function logHtml(L, o = {}) {
112
114
  const c = L.counts || {}, job = o.job || '';
113
115
  const tab = (j, label, n) => `<button type="button" class="td-tab pm-tab" role="tab" data-td="job" data-key="${esc(j)}" aria-selected="${job === j}">${esc(label)} <span class="td-n">${esc(n)}</span></button>`;
114
- const shownJobs = JOBS.filter(([, k]) => c[k]);
116
+ const shownJobs = JOBS.filter(([, k]) => c[k] || (k === 'decide' && qOthers(L)));
115
117
  const tabs = shownJobs.length ? `<div class="td-tabs pm-tabs" role="tablist" aria-label="Show one job">${tab('', 'All', L.open || 0)}${shownJobs.map(([j, k]) => tab(j, j, c[k])).join('')}</div>` : '';
116
118
  const head = `<div class="head"><h2 class="pm-h">Today’s log</h2><span class="sp"></span>${tabs}</div>`;
117
119
  const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
118
120
  + `<input id="tdCap" class="pm-input" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" title="Start with o for an event, a dash for a note, ! for first" />`
119
121
  + `<span class="td-vh" id="tdCapKey">Start with o for an event, a dash for a note, ! for first</span></form>`;
120
- const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
122
+ // the Decide tab (open-questions-today, board QuestionsA): the register's two groups first; its due-today rows are in them already
123
+ const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
121
124
  const so = new Set(o.sopen || []);
122
125
  const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
123
126
  const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
124
- let body = '';
127
+ let body = job === 'Decide' ? questionGroups(L.questions) : '';
125
128
  if (first.length) body += `<div class="td-gr pm-group now">${ic(I.sun, 14)}Do first</div><div class="rows">${first.map((r, i) => one(r, i === 0)).join('')}</div>`;
126
129
  if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
127
130
  if (wait.length) {
@@ -304,14 +307,15 @@ export function phonePageHtml(L, A, O, o = {}) {
304
307
  const filed = o.filed ? `<section class="tdp-filed" aria-label="The meeting you recorded"><div><b>${esc('Recording filed under ' + o.filed.title)}</b>${o.filed.sub ? `<small>${esc(o.filed.sub)}</small>` : ''}</div>`
305
308
  + `<button type="button" class="tdp-ib pm-btn outline" data-td="filed-undo" data-key="${esc(o.filed.id)}" aria-label="${esc('Undo: take the recording out of ' + o.filed.title)}" title="Undo">${svg(PI.undo, 18, 1.8)}</button></section>` : '';
306
309
  const job = o.job || '';
307
- const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
310
+ const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job && !(job === 'Decide' && r.src === 'question')) : rows || []);
308
311
  const all = [...(L.first || []), ...(L.todayRows || [])];
312
+ const qg = job === 'Decide' ? phoneQuestionGroups(L.questions) : ''; // open-questions-today: the left phone of board QuestionsPhone
309
313
  const shown = pick(L.first).concat(pick(L.todayRows));
310
314
  const wait = pick(L.wait);
311
315
  const sg = O && O.suggest && O.suggest[0];
312
316
  const anySwipe = !!sg || shown.some((r) => swipeActs(r).right);
313
317
  // Where it stands: the cause, at most one ✦ proposal (its "why" opens the sheet), and the hint once there is something to swipe
314
- const zero = !all.length;
318
+ const zero = !all.length && !qOthers(L) && !(L.questions && L.questions.mine && L.questions.mine.length);
315
319
  const said = zero ? '' : phoneStands(L, O, A);
316
320
  const ov = zero
317
321
  ? `<p class="tdp-zero">${esc(o.quiet || 'Nothing is open for today.')}</p>`
@@ -324,12 +328,12 @@ export function phonePageHtml(L, A, O, o = {}) {
324
328
  + `<button type="button" class="tdp-rec" data-td="${N.play ? 'rec-ev' : 'rec'}" data-key="${esc(N.key)}" aria-label="${esc(N.play ? 'Record ' + N.title : 'Record a meeting')}"><i aria-hidden="true"></i>Record</button></section>`;
325
329
  // the log: its count and the job filter (All ⌄: Reply, Do, Decide, Send; a job with no line is left out), then the rows
326
330
  const c = L.counts || {};
327
- const jobs = JOBS.filter(([, k]) => c[k]);
331
+ const jobs = JOBS.filter(([, k]) => c[k] || (k === 'decide' && qOthers(L)));
328
332
  const filter = jobs.length ? `<label class="tdp-f"><span class="td-vh">Show</span><select data-td-job aria-label="Show one job"><option value=""${job ? '' : ' selected'}>All</option>`
329
333
  + jobs.map(([j, k]) => `<option value="${esc(j)}"${job === j ? ' selected' : ''}>${esc(j + ' ' + c[k])}</option>`).join('') + `</select>${svg(PI.down, 14)}</label>` : '';
330
334
  const log = zero ? '' : `<section class="tdp-log" aria-label="Today’s log"><div class="tdp-lh"><h2>Today’s log · ${esc(job ? shown.length : L.open || shown.length)}</h2>${filter}</div>`
331
- + (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
332
- : `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
335
+ + qg + (shown.length ? `<ul class="tdp-rows">${shown.map((r) => phoneRowHtml(r) + (r.members && (o.sopen || []).includes(r.key) ? r.members.map((m) => phoneRowHtml(m)).join('') : '')).join('')}</ul>`
336
+ : qg ? '' : `<p class="tdp-none">${esc('Nothing to ' + job.toLowerCase() + ' today.')}</p>`) + '</section>';
333
337
  // Can wait: one line, folded; a zero day says it as its own short section (Ph2_todayzero)
334
338
  let cw = '';
335
339
  if (wait.length) {
@@ -343,4 +347,6 @@ export function phonePageHtml(L, A, O, o = {}) {
343
347
  return `${H}${filed}${ov}${ev}${log}${cw}${phoneCapHtml(o)}${sheet}`;
344
348
  }
345
349
  const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
350
+ /** Lines that wait on someone else: they keep the Decide tab even when none waits on the PM. */
351
+ const qOthers = (L) => !!(L && L.questions && L.questions.others && L.questions.others.length);
346
352
  const plural3 = (n) => n + (n === 1 ? ' line' : ' lines');
@@ -127,7 +127,7 @@ const kindKey = (k) => String(k || 'item').trim().toLowerCase().replace(/^file
127
127
  * the listeners, the rail's card. Only the first instance (#czViewer) writes the browser history; another keeps its own ← → trail.
128
128
  * Without cozy-panels.js (Board, Intelligence) the limit stays 1 and there is one Viewer, as before. */
129
129
  import { capture as capturePlace, restore as restorePlace } from './back-place.js'; // Back restores your place (A430)
130
- const G = { chat: null, subs: [], railKey: null, rail: false, lw: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, popH: null, popNext: null };
130
+ const G = { chat: null, subs: [], railKey: null, rail: false, lw: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, popH: null, popNext: null, behindNext: null };
131
131
  const mk = (i) => ({ i, el: null, cur: null, back: null, stack: [], fwd: [], unplace: null, wide: false, w: 0, drill: false, over: false, used: 0, ph: false, via: '', pop: false });
132
132
  let V = mk(0);
133
133
  const ALL = [V];
@@ -630,6 +630,10 @@ export function open(it) {
630
630
  const twin = !o._inst && !x.pop && o.id != null ? ALL.find((y) => y !== x && !y.pop && shown(y) && y.cur.id === String(o.id)) : null;
631
631
  if (twin) { x.drill = false; x = twin; o = { ...o, keep: true, fresh: false }; }
632
632
  use(x);
633
+ // the chat opened it by itself (behind()): the item shown stays behind it, so ← comes back to it with its place (chat-open-keeps-back)
634
+ const bn = !o._inst ? G.behindNext : null; if (bn) G.behindNext = null;
635
+ if (keepsBehind(bn, V.cur, o)) o = { ...o, back: true };
636
+ else if (bn && V.cur && o.id != null && V.cur.id !== String(o.id)) { try { console.warn(LOG_BEHIND, 'item not kept behind', { id: o.id }); } catch { /* no console */ } }
633
637
  // an item with unsaved changes asks first; the open goes on when it says so (and keeps a drill-in asked for before it)
634
638
  if (!o._asked && V.cur && typeof V.cur.guard === 'function') {
635
639
  const dr = V.drill; let now = true, ran = false;
@@ -673,6 +677,17 @@ export function open(it) {
673
677
  if (isPhone()) el.focus();
674
678
  return body;
675
679
  }
680
+ /** The chat opens something by itself (an answer finished): the next open() within BEHIND_MS keeps the item shown behind it, as a
681
+ * drill-in, so the header shows ← back to it (chat-open-keeps-back). Nothing shown: the open starts a trail as before. */
682
+ export function behind() { G.behindNext = { t: Date.now() }; }
683
+ const BEHIND_MS = 8000, LOG_BEHIND = '[chat-open-back]';
684
+ /** Pure: whether a marked open keeps cur behind it. Not when nothing is shown, the mark is missing or old, the open is fresh or a step
685
+ * along the trail, or it is the same item again (that one is drawn in its place). */
686
+ export function keepsBehind(mark, cur, o = {}, now = Date.now()) {
687
+ if (!mark || now - mark.t > BEHIND_MS) return false;
688
+ if (!cur || !cur.args || o.fresh || o._nav) return false;
689
+ return !(o.id != null && cur.id === String(o.id));
690
+ }
676
691
  /** The next open() is a drill-in: the item shown now stays behind it, and ← comes back to it. Nothing open: nothing to keep. */
677
692
  export function drill() { V.drill = isOpen(); }
678
693
  /** ← : the item that was shown before this one, drawn again. With nothing behind, ← closes. */
@@ -878,4 +893,4 @@ const popShown = () => ALL.some((y) => y.pop && shown(y));
878
893
  export function popNext(pop) { G.popNext = pop ? { pop, t: Date.now() } : null; }
879
894
  /** Close the popup's Viewer (an item with unsaved changes asks first). */
880
895
  export function closePop() { const x = ALL.find((y) => y.pop && shown(y)); if (x) { use(x); guarded(close); } }
881
- if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railSync, ICONS };
896
+ if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, behind, setPresses, setChip, setCheck, isOpen, current, body, onChange, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railSync, ICONS };