create-pmos 0.415.0 → 0.417.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 (79) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +3 -3
  8. package/workspace/briefing-premium-board-test.js +72 -43
  9. package/workspace/briefing-premium-doc-edit-test.js +2 -2
  10. package/workspace/briefing-premium-initiative-test.js +19 -22
  11. package/workspace/briefing-premium-insights-test.js +28 -17
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/core-docs-workflow-test.js +1 -1
  14. package/workspace/guide/workflows.md +4 -3
  15. package/workspace/ini-workflow-test.js +11 -11
  16. package/workspace/lib/board-premium.js +7 -2
  17. package/workspace/lib/board-trail.js +6 -1
  18. package/workspace/lib/engine/boards.js +8 -2
  19. package/workspace/lib/initiative-chat.js +4 -3
  20. package/workspace/lib/initiative-premium.js +5 -3
  21. package/workspace/lib/insights-premium.js +9 -1
  22. package/workspace/lib/pmos-verbs.js +1 -1
  23. package/workspace/lib/route-modules.js +1 -0
  24. package/workspace/lib/routes-boards.js +73 -6
  25. package/workspace/lib/routes-live.js +53 -0
  26. package/workspace/lib/task-cli.js +88 -24
  27. package/workspace/lib/task-items.js +3 -1
  28. package/workspace/lib/workflow-cli.js +10 -4
  29. package/workspace/milestone-suggest-test.js +2 -1
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/premium-board-actions-test.js +12 -8
  33. package/workspace/premium-chat-report-tab-test.js +13 -5
  34. package/workspace/premium-core-doc-issue-test.js +1 -1
  35. package/workspace/premium-report-read-test.js +66 -51
  36. package/workspace/premium-vw-backlog-test.js +3 -3
  37. package/workspace/premium-vw-doc-test.js +3 -3
  38. package/workspace/premium-vw-item-test.js +4 -4
  39. package/workspace/premium-vw-jira-test.js +14 -13
  40. package/workspace/premium-vw-slides-test.js +7 -5
  41. package/workspace/program-panel-test.js +1 -1
  42. package/workspace/public/pm/bd-ini-panel.js +68 -230
  43. package/workspace/public/pm/cozy-insights.css +15 -0
  44. package/workspace/public/pm/cozy-live-pill.css +48 -0
  45. package/workspace/public/pm/cozy-live-pill.js +141 -0
  46. package/workspace/public/pm/cozy-viewer.js +4 -3
  47. package/workspace/public/pm/cozy-vw-rp.css +48 -0
  48. package/workspace/public/pm/home-app.js +45 -8
  49. package/workspace/public/pm/home-chat.js +5 -2
  50. package/workspace/public/pm/home-ini.js +57 -22
  51. package/workspace/public/pm/home-task.js +16 -5
  52. package/workspace/public/pm/ini-view-model.js +277 -0
  53. package/workspace/public/pm/ini-view.css +122 -0
  54. package/workspace/public/pm/ini-view.js +180 -0
  55. package/workspace/public/pm/live-model.js +104 -0
  56. package/workspace/public/pm/ov-view.css +44 -0
  57. package/workspace/public/pm/premium-board.js +15 -16
  58. package/workspace/public/pm/premium-insights.js +61 -35
  59. package/workspace/public/pm/premium-report-read.js +74 -50
  60. package/workspace/public/pm/premium-report-tab.js +36 -15
  61. package/workspace/public/pm/premium-shell.js +1 -1
  62. package/workspace/public/pm/premium-vw-item-model.js +6 -3
  63. package/workspace/public/pm/premium-vw-item.js +25 -6
  64. package/workspace/public/pm/premium-vw-jira.js +17 -15
  65. package/workspace/public/pm/rp-parts.js +75 -12
  66. package/workspace/public/pm/task-card.css +24 -49
  67. package/workspace/public/pm/task-card.js +90 -64
  68. package/workspace/public/pm/tk-view.css +21 -0
  69. package/workspace/public/pm/tk-view.js +216 -0
  70. package/workspace/public/pm/wf-page.js +2 -0
  71. package/workspace/server.js +24 -1
  72. package/workspace/stage-card-test.js +49 -41
  73. package/workspace/task-card-test.js +83 -38
  74. package/workspace/test-files.json +3 -1
  75. package/workspace/test-lists/bd-ini-panel.json +3 -3
  76. package/workspace/tk-tasks-test.js +3 -3
  77. package/workspace/public/pm/bd-ini-model.js +0 -81
  78. package/workspace/public/pm/cozy-rec-pill.css +0 -12
  79. package/workspace/public/pm/cozy-rec-pill.js +0 -46
@@ -0,0 +1,141 @@
1
+ /* pm/cozy-live-pill.js — the Live pill beside the floating menu on every page (batch 6 item 2; canvas XrrABoard, XrrAHome, XrrAPhone,
2
+ * XrrAPhoneClosed, XrrAGrill). It replaces the recording pill (cozy-rec-pill.js): a recording is now its first row.
3
+ *
4
+ * Closed, it is one quiet pill with one mark per live item, in the list's order: a blue dot asks you, a ring is running, amber stopped,
5
+ * a check finished and not read yet; a recording leads with its red dot and clock (grey and still while paused). No counts and no words:
6
+ * its name says them (live-model.js pillLabel). A press, or Ctrl J (⌘J) on any page, opens one short list of the 5 or fewer things the
7
+ * PM touched last, newest first (a popover over the menu button on a desktop, a sheet on a phone). A row opens that chat on Home; on
8
+ * Home itself it opens in place (opts.go). While the list is open the rows keep their places: only a mark changes, with one info ripple.
9
+ * ↑ ↓ move, Enter opens, Esc closes, 1 to 5 open a row. Nothing live: no pill (zero is silence). On a phone it hides with the menu
10
+ * button while the keyboard is up.
11
+ *
12
+ * mountLivePill(doc = document, opts) once per page, after mountNav: the pill lives inside #czNav, so it hides whenever the menu hides
13
+ * opts.go(item) → true the page opens the item itself (Home: the session's chat, the meeting); else the row's link is followed
14
+ * opts.open() → id the session open on this page now: its row is tinted
15
+ * Reads GET /api/live every 10 s while the page is shown, and on the cz:live event (Home sends it after the PM opens or answers a
16
+ * session); the recording comes from pm/rec-state.js. Nothing is written. */
17
+ import { onRecording } from './rec-state.js';
18
+ import { liveItems, keepOrder, pillLabel, rowLabel, clock, elapsed } from './live-model.js';
19
+
20
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
21
+ const SHEET = '/pm/cozy-live-pill.css';
22
+ const CHECK = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
23
+ const PHONE = '(max-width: 760px)';
24
+ const mac = () => { try { return /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || ''); } catch { return false; } };
25
+ const markHtml = (m, once) => (m === 'done' ? `<i class="lv-m done${once ? ' once' : ''}">${CHECK}</i>` : `<i class="lv-m ${m}${once ? ' once' : ''}"></i>`);
26
+
27
+ export function mountLivePill(doc = document, opts = {}) {
28
+ if (doc.getElementById('czLive')) return;
29
+ if (!doc.querySelector(`link[href="${SHEET}"]`)) { const l = doc.createElement('link'); l.rel = 'stylesheet'; l.href = SHEET; doc.head.appendChild(l); }
30
+ const L = { sessions: [], titles: {}, rec: null, open: false, shown: [], marks: new Map(), tick: null, tries: 0 };
31
+ let pill = null, tray = null, scrim = null;
32
+ const phone = () => typeof matchMedia === 'function' && matchMedia(PHONE).matches;
33
+ const place = () => {
34
+ const nav = doc.getElementById('czNav');
35
+ if (!nav) { if (L.tries++ < 50) setTimeout(place, 100); return false; }
36
+ pill = doc.createElement('button'); pill.type = 'button'; pill.id = 'czLive'; pill.className = 'cz-live'; pill.hidden = true;
37
+ pill.setAttribute('aria-expanded', 'false'); pill.setAttribute('aria-controls', 'czLiveList');
38
+ scrim = doc.createElement('div'); scrim.className = 'lv-scrim'; scrim.hidden = true;
39
+ tray = doc.createElement('div'); tray.id = 'czLiveList'; tray.className = 'lv-tray'; tray.hidden = true;
40
+ tray.setAttribute('role', 'dialog'); tray.setAttribute('aria-label', 'What you work on now');
41
+ nav.append(scrim, tray, pill);
42
+ pill.addEventListener('click', () => set(!L.open));
43
+ scrim.addEventListener('click', () => set(false));
44
+ tray.addEventListener('click', (e) => { const a = e.target.closest('a[data-lv]'); if (a) go(a, e); });
45
+ tray.addEventListener('keydown', keys);
46
+ draw();
47
+ return true;
48
+ };
49
+ const items = () => liveItems(L.sessions, { rec: L.rec, titles: L.titles, open: opts.open ? opts.open() : null });
50
+ function go(a, e) {
51
+ const x = L.shown.find((i) => i.id === a.dataset.lv);
52
+ if (x && opts.go && !(e && (e.metaKey || e.ctrlKey || e.shiftKey)) && opts.go(x)) { if (e) e.preventDefault(); set(false); return; }
53
+ set(false); // the link is followed
54
+ }
55
+ function rowsHtml(list) {
56
+ return list.map((x, i) => {
57
+ const was = L.marks.get(x.id), once = L.open && was && was !== x.mark;
58
+ return `<a class="lv-row${x.open ? ' cur' : ''}" href="${esc(x.href)}" data-lv="${esc(x.id)}" aria-label="${esc(rowLabel(x))}" aria-keyshortcuts="${i + 1}">`
59
+ + `<span class="lv-mk">${x.kind === 'rec' ? `<i class="lv-m rec${x.paused ? ' paused' : ''}"></i>` : markHtml(x.mark, once)}</span>`
60
+ + `<span class="lv-t">${esc(x.name)}<small>${esc(x.sub)}</small></span>`
61
+ + `<span class="lv-tm${x.kind === 'rec' && !x.paused ? ' rec' : x.mark === 'stop' ? ' stop' : ''}">${esc(x.time)}</span></a>`;
62
+ }).join('');
63
+ }
64
+ function pillHtml(list) {
65
+ const r = list.find((x) => x.kind === 'rec'), rest = list.filter((x) => x.kind !== 'rec');
66
+ return (r ? `<span class="lv-g"><i class="lv-m rec${r.paused ? ' paused' : ''}"></i><span class="lv-tm${r.paused ? '' : ' rec'}">${esc(r.time)}</span></span>${rest.length ? '<span class="lv-sp"></span>' : ''}` : '')
67
+ + (rest.length ? `<span class="lv-ms">${rest.map((x) => markHtml(x.mark, false)).join('')}</span>` : '');
68
+ }
69
+ function draw() {
70
+ if (!pill) return;
71
+ const now = items();
72
+ if (!now.length && !L.open) { pill.hidden = true; tray.hidden = true; scrim.hidden = true; return; }
73
+ const list = L.open ? keepOrder(L.shown, now) : now;
74
+ if (L.open && !list.length) { set(false); return; }
75
+ pill.hidden = !now.length && !L.open;
76
+ pill.classList.toggle('recp', now.some((x) => x.kind === 'rec' && !x.paused));
77
+ pill.setAttribute('aria-label', pillLabel(now, { mac: mac() }));
78
+ pill.title = 'Now ' + (mac() ? '⌘J' : 'Ctrl J');
79
+ pill.innerHTML = pillHtml(now);
80
+ if (L.open) {
81
+ const f = doc.activeElement && tray.contains(doc.activeElement) ? doc.activeElement.dataset.lv : null;
82
+ tray.innerHTML = rowsHtml(list);
83
+ if (f) { const a = [...tray.querySelectorAll('a[data-lv]')].find((n) => n.dataset.lv === f); if (a) a.focus(); }
84
+ L.shown = list;
85
+ }
86
+ L.marks = new Map(list.map((x) => [x.id, x.mark]));
87
+ tickRec(now);
88
+ }
89
+ function set(open) {
90
+ if (!pill) return;
91
+ if (open && !items().length) open = false;
92
+ L.open = open;
93
+ pill.setAttribute('aria-expanded', String(open)); pill.classList.toggle('open', open);
94
+ tray.classList.toggle('sheet', open && phone());
95
+ tray.hidden = !open; scrim.hidden = !(open && phone());
96
+ if (open) { L.shown = items(); L.marks = new Map(L.shown.map((x) => [x.id, x.mark])); tray.innerHTML = rowsHtml(L.shown); const a = tray.querySelector('a'); if (a) a.focus(); read(); }
97
+ else { L.shown = []; if (tray.contains(doc.activeElement)) pill.focus(); }
98
+ draw();
99
+ }
100
+ function keys(e) {
101
+ const rows = [...tray.querySelectorAll('a[data-lv]')], i = rows.indexOf(doc.activeElement);
102
+ const n = rows.length, down = e.key === 'ArrowDown';
103
+ if ((down || e.key === 'ArrowUp') && n) { e.preventDefault(); rows[i < 0 ? (down ? 0 : n - 1) : (i + (down ? 1 : n - 1)) % n].focus(); }
104
+ else if (/^[1-5]$/.test(e.key) && !e.ctrlKey && !e.metaKey && !e.altKey) { const a = rows[Number(e.key) - 1]; if (a) { e.preventDefault(); a.click(); } }
105
+ }
106
+ // the meeting clock ticks once a second while a recording runs; nothing else moves
107
+ function tickRec(list) {
108
+ const run = list.some((x) => x.kind === 'rec' && !x.paused);
109
+ if (run && !L.tick) L.tick = setInterval(() => { if (!doc.hidden) { const t = clock(elapsed(L.rec)); pill.querySelectorAll('.lv-g .lv-tm').forEach((n) => { n.textContent = t; }); const r = tray.querySelector('[data-lv^="rec:"] .lv-tm'); if (r) r.textContent = t; } }, 1000);
110
+ else if (!run && L.tick) { clearInterval(L.tick); L.tick = null; }
111
+ }
112
+ async function read() {
113
+ if (doc.hidden) return;
114
+ try {
115
+ const r = await fetch('/api/live', { credentials: 'same-origin' });
116
+ const j = r.ok ? await r.json() : null;
117
+ if (j && j.ok) { L.sessions = j.sessions || []; L.titles = j.titles || {}; draw(); }
118
+ } catch { /* the server is away: the pill keeps what it last read */ }
119
+ }
120
+ // Ctrl J (⌘J) opens and closes it from any page; Esc closes it. A terminal keeps its keys.
121
+ doc.addEventListener('keydown', (e) => {
122
+ if (e.key === 'Escape' && L.open) { e.preventDefault(); e.stopPropagation(); set(false); return; }
123
+ if (!((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === 'j' || e.key === 'J'))) return;
124
+ const t = e.target; if (t && t.closest && t.closest('.xterm')) return;
125
+ if (!pill || (pill.hidden && !L.open)) return;
126
+ e.preventDefault(); e.stopImmediatePropagation(); set(!L.open);
127
+ }, true);
128
+ doc.addEventListener('click', (e) => { if (L.open && e.target.isConnected && pill && !pill.contains(e.target) && !tray.contains(e.target)) set(false); });
129
+ // a phone: the pill hides with the menu button while the keyboard is up, so it never covers the chat box
130
+ const vv = typeof window !== 'undefined' ? window.visualViewport : null;
131
+ if (vv) {
132
+ const kb = () => { const a = doc.activeElement, typing = !!(a && a.matches && a.matches('input, textarea, [contenteditable="true"], [contenteditable=""]')); doc.body.classList.toggle('cz-kb', phone() && typing && window.innerHeight - vv.height > 150); };
133
+ vv.addEventListener('resize', kb); doc.addEventListener('focusin', kb); doc.addEventListener('focusout', () => setTimeout(kb, 50));
134
+ }
135
+ place();
136
+ onRecording((s) => { L.rec = s; draw(); });
137
+ read();
138
+ setInterval(read, 10000);
139
+ doc.addEventListener('visibilitychange', () => { if (!doc.hidden) read(); });
140
+ doc.addEventListener('cz:live', () => read());
141
+ }
@@ -19,7 +19,8 @@
19
19
  * icon a key of ICONS below or an SVG path "M…"
20
20
  * url the item's own address: "Open in a new tab" goes under ⋯ (full: true names it "Open in full")
21
21
  * more [{ label, on(moreButton), note?, danger?, icon?, disabled? } | { sep: true }], or a function that returns it: the ⋯ menu; on() gets the ⋯ button as an anchor, in the xvMore order (change it, look back, stop or remove last)
22
- * discuss true, { href }, or fn(): the quiet "Discuss in chat" icon before ⋯. Never drawn on Home, where the chat is already beside it.
22
+ * discuss true, { href }, or fn(): the quiet "Discuss in chat" icon before ⋯. Not drawn on Home, where the chat is already beside it,
23
+ * unless discussHome: an initiative's page (the one view) starts a new session about it there.
23
24
  * rename { save(title, { jira }) → Promise<{ ok, title?, error? }>, max?, value?, jira?: { label, key } }: the title is the rename press
24
25
  * (value: the name the field starts from when the title shows more, as a program's "title · goal")
25
26
  * (canvas RnATask, RnAIni, RnAProg, RnAPhone). A tap turns it into one field with a check: Enter or the check saves, Esc
@@ -116,7 +117,7 @@ export function headHtml(it) {
116
117
  const o = it || {};
117
118
  const phone = !!o.phone;
118
119
  const kind = o.kind && !sameAs(o.kind, o.title) ? `<p class="cz-vw-kind">${esc(o.kind)}</p>` : '';
119
- const disc = o.discuss && !o.home ? ib('discuss', 'Discuss in chat', P.chat) : '';
120
+ const disc = o.discuss && (!o.home || o.discussHome) ? ib('discuss', 'Discuss in chat', P.chat) : '';
120
121
  const more = typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
121
122
  const add = o.add && o.add.label && !phone ? ib('add', o.add.label, P.add) : '';
122
123
  const own = (o.presses || []).filter((x) => x && x.act && x.label).map((x) => x.solid
@@ -452,7 +453,7 @@ export function open(it) {
452
453
  V.drill = false;
453
454
  const sameKind = V.cur && kindKey(V.cur.kind) === kindKey(o.kind);
454
455
  leave();
455
- V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
456
+ V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, discussHome: !!o.discussHome, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
456
457
  el.setAttribute('aria-label', 'Viewer: ' + (o.kind || o.title || 'item'));
457
458
  redraw();
458
459
  const m = el.querySelector('.cz-vw-menu'); if (m) m.remove();
@@ -165,3 +165,51 @@
165
165
  .rp-sec { height: 40px; padding: 0 14px !important; border-radius: 999px; background: var(--cz-card) !important; font-size: 13.5px; font-weight: 700; color: var(--cz-ink2); }
166
166
  .rp-back { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
167
167
  .rp-back b { font-size: 15px; font-weight: 800; }
168
+
169
+ /* ── the one report Viewer (canvas OvReport): the summary with its icon primary and meta chips, the bar, the deck, the folds.
170
+ * A cycle (premium-report-read.js) and a new report from the chat (premium-report-tab.js) draw the same parts (rp-parts.js rpSumHtml, rpBarHtml). ── */
171
+ .rp-sum .czs-line { min-height: 32px; }
172
+ .rp-sum .rp-ln { min-width: 0; }
173
+ .rp-sum .czs-r { font-weight: 500; font-size: 12.5px; }
174
+ .rp-pri { flex: none; width: 32px; height: 32px; margin: -2px -4px -2px 4px; border: 0; border-radius: 999px; display: grid; place-items: center; cursor: pointer; background: var(--cz-blue); color: var(--cz-onsolid); }
175
+ .rp-sum .czs-line:not(:has(.czs-r)) .rp-pri { margin-left: auto; }
176
+ .rp-pri:hover { filter: brightness(1.08); }
177
+ .rp-pri:disabled { opacity: .5; cursor: default; }
178
+ .rp-pri:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
179
+ .rp-sum .czs-p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--cz-ink); }
180
+ .rp-mcs { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
181
+ .rp-mc { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px var(--cz-sans); color: var(--cz-ink2); background: none; border: 0; padding: 4px 6px; margin: 0 -6px; border-radius: 8px; }
182
+ .rp-mc svg { color: var(--cz-ink3); }
183
+ button.rp-mc { cursor: pointer; }
184
+ button.rp-mc:hover, button.rp-mc[aria-expanded="true"] { background: var(--cz-well); color: var(--cz-ink); }
185
+ .rp-bar { display: flex; align-items: center; gap: 4px; }
186
+ .rp-seg { flex: 1; min-width: 0; display: flex; padding: 3px; border-radius: 999px; background: var(--cz-well); }
187
+ .rp-seg button { flex: 1; min-width: 0; height: 30px; text-align: center; border: 0; border-radius: 999px; background: none; font: 600 12.5px var(--cz-sans); color: var(--cz-ink2); cursor: pointer; white-space: nowrap; padding: 0 8px; }
188
+ .rp-seg button[aria-pressed="true"] { background: var(--cz-card); color: var(--cz-ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
189
+ .rp-tls { display: flex; flex: none; }
190
+ .rp-tl.rp-tl { width: 36px; height: 36px; border: 0; padding: 0; border-top: 0; border-radius: 10px; display: grid; place-items: center; background: none; color: var(--cz-ink2); cursor: pointer; }
191
+ .rp-tl:hover, .rp-tl[aria-expanded="true"] { background: var(--cz-well); color: var(--cz-ink); }
192
+ .rp-nav { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: -4px; }
193
+ .rp-nav > .vz-ib { width: 28px; height: 28px; border-radius: 999px; }
194
+ .rp-a .rp-nav .rp-count { font-size: 12.5px; color: var(--cz-ink2); min-width: 84px; }
195
+ .rp-a .rp-thumbs.rp-thumbs { overflow: visible; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: -4px; }
196
+ .rp-a .rp-th.rp-th { border-radius: 8px; }
197
+ .rp-a .czs-secs { margin: 0; }
198
+ .rp-cys { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
199
+ .rp-cy { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin: 0 -10px; border: 0; background: none; border-radius: 10px; text-align: left; font: inherit; color: var(--cz-ink); }
200
+ button.rp-cy { cursor: pointer; }
201
+ button.rp-cy:hover { background: var(--cz-well); }
202
+ .rp-cy > span { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
203
+ .rp-cy b { font-size: 13.5px; font-weight: 700; }
204
+ .rp-cy small { font-size: 12.5px; color: var(--cz-ink3); }
205
+ .rp-cy svg { color: var(--cz-ink3); }
206
+ .rp-ol { margin: 0 0 4px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }
207
+ @media (max-width: 760px) {
208
+ .rp-a .rp-thumbs.rp-thumbs, .vz-dk .vz-dkt { display: none; }
209
+ .rp-seg button { padding: 0 4px; }
210
+ .rp-tl.rp-tl { width: 34px; }
211
+ .rp-nav > .vz-ib { width: 44px; height: 44px; }
212
+ }
213
+ .vz-dk .czs-secs { margin: 0; }
214
+ .vz-dkp { border-radius: 16px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
215
+ .vz-dkp h2 { margin: 0; font-size: 20px; font-weight: 800; }
@@ -15,6 +15,7 @@
15
15
  * The models are in home-data.js and home-list.js (pure). This file reads the routes, draws, and wires the presses. Every write is the PM's
16
16
  * press (pmPost). Nothing here opens the old dialog or links to the console. */
17
17
  import { mountNav } from './cozy-nav.js';
18
+ import { mountLivePill } from './cozy-live-pill.js';
18
19
  import * as VW from './cozy-viewer.js';
19
20
  import { pmGet, pmPost, pmHeaders } from './http.js';
20
21
  import * as H from './home-data.js';
@@ -24,6 +25,8 @@ import { headModel, STEPS } from './premium-initiative-head.js';
24
25
  import * as SC from './home-stage-card.js'; // the initiative's stage card D
25
26
  import * as WFM from './ini-wf-model.js'; // D99: the workflow an initiative runs (kind line, usual days)
26
27
  import { wfIcon, wfOf } from './wf-model.js';
28
+ import { iniView } from './ini-view-model.js'; // the one initiative view (batch 6 item 1): the same model the Board's panel draws
29
+ import { programOf } from './program-model.js';
27
30
  import { startAgent } from './page-agent.js';
28
31
  import { mdHtml } from './chat-md.js';
29
32
  import { mountPhoneCard } from './home-phone-card.js';
@@ -288,6 +291,23 @@ function filterMenu(b) {
288
291
  }
289
292
 
290
293
  /* ── the initiative card ── */
294
+ /** The one view's model for an initiative (ini-view-model.js): Home's board row with its trail, the board's steps and day, its usual days,
295
+ * the Needs-you row that waits on the PM and its program. Null when the initiative is not on a board Home reads. */
296
+ function iniViewOf(id) {
297
+ const row = iniRowOf(id) || imRowOf(id); if (!row) return null;
298
+ const B = S.D.board || {}, t = S.D.trail && S.D.trail.items && S.D.trail.items[id];
299
+ const need = H.needsOf(S.D).find((r) => r.ini === id);
300
+ const p = programOf(S.D.programs || [], row.ws || (B.board || {}).ws || '', id);
301
+ return iniView({ ...row, trail: t || row.trail || null }, { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
302
+ ask: need ? { title: need.name } : null, program: p ? { id: p.id, title: p.title } : null });
303
+ }
304
+ /** An initiative no board Home reads holds (its own read only, GET /api/initiative-premium): the row the one view needs, from that read. */
305
+ function imRowOf(id) {
306
+ const M = S.IM && S.IMid === id ? S.IM : null; if (!M) return null;
307
+ const stage = (M.head && M.head.stage) || '', k = STEPS.findIndex((x) => x.label === stage);
308
+ return { id, key: 'board:' + id, title: M.title || id, lane: M.lane || null, track: { k, key: k >= 0 ? STEPS[k].key : null, label: stage },
309
+ tasks: ((M.tasks && M.tasks.rows) || []).filter((x) => x.pmos && x.uid).map((x) => ({ uid: x.uid, title: x.title, status: x.state || 'To do', end: x.end || '', owner: x.owner || '' })) };
310
+ }
291
311
  function iniRowOf(id) { return H.boardRows(S.D).find((r) => r.id === id) || (otherIni(id) || {}).row || null; }
292
312
  /** An initiative of another product Home reads (D.others): its row, and the workspace and board it is read from. Null for the board's own. */
293
313
  function otherIni(id) {
@@ -442,12 +462,18 @@ const SN = mountSesName({ esc, pmPost, toast, toastUndo: (m, u) => toastUndo(m,
442
462
  changed: () => { drawTop(); chat.refresh(); drawList(); } });
443
463
 
444
464
  /* ── the chat ── */
465
+ // a chat Home opened by itself on load (the first Needs-you row) is not the PM touching it: a touch counts after the PM's first press or
466
+ // key, or when the address named the session (the Live pill on another page, a link)
467
+ const ACTED = { on: !!(P.get('session') || P.get('open')) };
468
+ for (const ev of ['pointerdown', 'keydown']) addEventListener(ev, () => { ACTED.on = true; }, { capture: true, once: true });
445
469
  const chat = mountChat($('#hmChat'), {
446
470
  esc, toast, pmGet, pmPost, pressHeaders: () => { const h = pmHeaders(); delete h['Content-Type']; return h; },
447
471
  roles: () => (S.D.desk && S.D.desk.roles) || [],
448
472
  seen: (key) => (S.D.desk && S.D.desk.seen && S.D.desk.seen[key]) || null,
449
473
  markSeen: (key) => { pmPost('/api/home-desk/seen', { key }).then((r) => { if (r && r.ok && S.D.desk) S.D.desk.seen = { ...S.D.desk.seen, [key]: r.seen }; }); },
450
474
  session: (id) => S.D.sessions.find((s) => s.id === id) || null,
475
+ // the Live pill: the PM opened, typed in or answered this session now (its row moves to the top of the pill's list)
476
+ touch: (sid) => { if (sid && ACTED.on) pmPost('/api/session/touch', { id: sid }).then(() => document.dispatchEvent(new CustomEvent('cz:live'))).catch(() => {}); },
451
477
  queued: (sid) => (sid && S.D.desk && S.D.desk.queued && S.D.desk.queued[sid]) || [],
452
478
  queue: (sid, text) => pmPost('/api/home-desk/queue', { session: sid, text }).then((r) => { if (r && r.ok && S.D.desk) { const q = { ...(S.D.desk.queued || {}) }; q[sid] = (q[sid] || []).concat({ text, at: r.at }); S.D.desk.queued = q; chat.refresh(); } }),
453
479
  unqueue: (sid, at) => { pmPost('/api/home-desk/queue-drop', { session: sid, at }); if (S.D.desk && S.D.desk.queued && S.D.desk.queued[sid]) S.D.desk.queued[sid] = S.D.desk.queued[sid].filter((x) => x.at !== at); },
@@ -703,13 +729,13 @@ function select(id, o = {}) {
703
729
  drawList();
704
730
  syncUrl();
705
731
  }
706
- /** A session opened beside an initiative's page in the Viewer: the page follows the session's own initiative, and a loose session closes
707
- * it, so the Viewer never shows the initiative of the session before (Wawan, 2026-10-25). Other Viewer items stay as they are. */
732
+ /** A session opened from the list takes the Viewer with it (Wawan, 2026-10-25, asked twice): whatever the Viewer shows (another
733
+ * initiative's page, a Documents or Tasks view, a task or a file drilled into, another row's item), it changes to the page of the session's
734
+ * own initiative, and a loose session closes it. Only the page of that same initiative stays as it is. A closed Viewer stays closed. */
708
735
  function followViewer(s) {
709
- if (isPhone()) return;
710
- const c = VW.current(); if (!c || !/^ov:/.test(String(c.id))) return;
711
- const ini = H.iniOfSession(s);
712
- if (c.id === 'ov:' + ini) return;
736
+ if (isPhone() || !VW.isOpen()) return;
737
+ const c = VW.current(), ini = H.iniOfSession(s);
738
+ if (ini && c && c.id === 'ov:' + ini && c.kind === kindOf(ini)) return;
713
739
  if (!ini || !iniRowOf(ini)) { VW.close(); return; }
714
740
  if (S.ini !== ini) { S.ini = ini; S.IM = null; S.IMid = null; S.doneOpen = false; S.stepsMore = false; }
715
741
  iniPage();
@@ -1428,7 +1454,7 @@ function cta() {
1428
1454
  /* ── start ── */
1429
1455
  mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni: (id, pre) => iniRenameOf(id, pre), renameTask: (t) => taskRenameOf(t), load: () => load(), loadIni: () => loadIni(), openFile: (f) => openFile(f), iniTitle: (id) => iniTitle(id), drawList: () => drawList(), wait: MORE.WAIT,
1430
1456
  // the initiative's page (HbCDesk): its card, its header and its ⋯
1431
- cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), talk: () => talk(),
1457
+ cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), talk: () => talk(), view: (id) => iniViewOf(id), head: (id) => (S.H = headOf(id)), goProgram: (id) => goProgram(id),
1432
1458
  foldCard: () => { S.cardFold = !S.cardFold; store.set('pmos.home.cardfold', S.cardFold ? '1' : null); } });
1433
1459
  /* The program panel in Home's Viewer (HbCProg): Home's board model and programs; an initiative of it opens here, with ← back to the program.
1434
1460
  * Read on the first program press, never at start: the panel's modules load premium-shell.js, whose start reads ?session= for the old dialog. */
@@ -1438,6 +1464,17 @@ PO.mount({ programs: () => S.D.programs || [], stateOf: (p) => (((S.M && S.M.gro
1438
1464
  saved: (p) => { const L2 = S.D.programs || [], i = L2.findIndex((x) => x.id === p.id); if (i >= 0) L2[i] = { ...L2[i], ...p }; drawList(); },
1439
1465
  say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)), openIni: (id) => goIni(id) });
1440
1466
  mountNav('home', document, { more: () => moreMenu, settings: () => MORE.openSettings(), here: () => { if (VW.isOpen()) VW.close(); goHome(); } });
1467
+ // the Live pill (batch 6 item 2): on Home a row opens in place, the session's chat (with its Viewer page) or the meeting; the open one is tinted
1468
+ mountLivePill(document, {
1469
+ open: () => (S.cur && S.cur.ses) || null,
1470
+ go: (x) => {
1471
+ if (x.kind === 'rec') { const id = /[?&]meeting=([^&]+)/.exec(x.href || ''); if (!id) return false; openMeeting({ note: decodeURIComponent(id[1]) }); return true; }
1472
+ const s = x.sid && S.D.sessions.find((y) => y.id === x.sid); if (!s) return false;
1473
+ if (VW.isOpen() && isPhone()) VW.close();
1474
+ S.sel = 's:' + s.id; S.phoneChat = isPhone(); openTarget(sessionTarget(s)); followViewer(s); drawList(); syncUrl();
1475
+ return true;
1476
+ },
1477
+ });
1441
1478
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m) }); drawList();
1442
1479
  drawList(); drawTop();
1443
1480
  { // a conversation the address names opens at once, before the lists are read, so nothing typed or attached lands in the Home chat
@@ -1473,7 +1510,7 @@ load().then(() => {
1473
1510
  const r = allRows().find((x) => x.key === open || (/^pt:/.test(open) && x.id === open));
1474
1511
  if (r) select(r.id); else if (KEY.test(open)) openTarget({ ...homeTarget(), key: open, title: open });
1475
1512
  }
1476
- else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
1513
+ else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); followViewer(s); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
1477
1514
  else if (/^program:[A-Za-z0-9][A-Za-z0-9._-]{0,100}$/.test(ask)) openTarget(programTarget(ask.slice(8))); // Ask in Home from the program panel
1478
1515
  else if (about && /^init:/.test(about) && iniRowOf(P.get('vid') || about.slice(5))) { const id = iniRowOf(P.get('vid')) ? P.get('vid') : about.slice(5); goIni(id).then(() => { if (P.get('vk') && S.ini === id && !isPhone()) iniOverview(); }); }
1479
1516
  // the Board's program panel Discuss in chat names board:program:<id>: the program's own conversation, the one its tasks open (bug 2026-10-24)
@@ -18,7 +18,7 @@
18
18
  * target: { key?, sid?, title, scope: { text, icon, loose }, role: { name, initial }, intro?: { role, text, at, pills: [{ label, primary, go }] },
19
19
  * ini?, rich, also?: { text, go } }
20
20
  * host: { esc, toast, pmGet, pmPost, roles(), seen(key), markSeen(key), onScope(btn), onLink(btn), onTo(btn), workItem(text, target),
21
- * viewerClosed(), reopenViewer(), head(target) } */
21
+ * viewerClosed(), reopenViewer(), head(target), touch(sid) (the PM opened, typed in or answered that session: the Live pill) } */
22
22
  import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
23
23
  import { streamOf, roleOf, tintOf, hm } from './home-data.js';
24
24
  import { splitGoal, shownUser, goalBlockHtml, goalViewHtml, goalNow, slashMatches, loadSlash } from './goal-chat.js';
@@ -84,6 +84,7 @@ export function mountChat(el, host) {
84
84
  } else if (t.sid) conv = await host.pmGet('/api/sessions/conversation?id=' + encodeURIComponent(t.sid)).catch(() => null);
85
85
  if (my !== C.seq || C.t !== t) return;
86
86
  C.th = th && th.ok ? th : null; C.conv = conv && conv.ok ? conv : null;
87
+ if (host.touch && sid() && C.touched !== sid()) { C.touched = sid(); host.touch(C.touched); } // the Live pill: the PM opened it now
87
88
  C.sess = host.session ? host.session(t.sid || (C.th && C.th.session)) : null;
88
89
  draw();
89
90
  clearTimeout(C.timer);
@@ -397,6 +398,7 @@ export function mountChat(el, host) {
397
398
  C.sending = false;
398
399
  if (!r || r.ok !== true) { host.toast((r && r.error) || 'The message was not sent.'); return false; }
399
400
  const s = sid() || r.session;
401
+ if (host.touch) host.touch(s);
400
402
  if (was && s && host.queue) host.queue(s, text);
401
403
  C.files.forEach((f) => { if (f.url) URL.revokeObjectURL(f.url); }); C.files = []; C.jump = true;
402
404
  if (t.onSent) t.onSent(r);
@@ -408,6 +410,7 @@ export function mountChat(el, host) {
408
410
  const r = t.key && !t.sid ? await host.pmPost('/api/briefing-premium/press' + (t.ws ? '?ws=' + encodeURIComponent(t.ws) : ''), { key: t.key, press: k }).catch(() => null)
409
411
  : await host.pmPost('/api/session/keys', { id: sid(), press: k }).catch(() => null);
410
412
  if (!r || !r.ok) host.toast((r && r.error) || 'The key did not reach the session.');
413
+ else if (host.touch) host.touch(sid() || r.session);
411
414
  setTimeout(read, 500);
412
415
  }
413
416
  async function upload(files) {
@@ -583,7 +586,7 @@ export function mountChat(el, host) {
583
586
  if (notesM) notesM.then((M) => setTimeout(() => M.syncNotes(), 0)); // the Notes open in the Viewer belonged to the conversation before
584
587
  const same = C.t && t && C.t.key === t.key && C.t.sid === t.sid;
585
588
  C.t = t;
586
- if (!same) { C.addOpen = false; C.th = null; C.conv = null; C.show = 12; C.open = new Set(); C.files = []; C.marked = null; C.picked = {}; C.plOpen = false; C.plAll = false; C.seenAt = t.key ? host.seen(t.key) : null; put(log, introHtml(t.intro)); put(pl, ''); pl.hidden = true; C.jump = true; peek(null); }
589
+ if (!same) { C.addOpen = false; C.th = null; C.conv = null; C.show = 12; C.open = new Set(); C.files = []; C.marked = null; C.touched = null; C.picked = {}; C.plOpen = false; C.plAll = false; C.seenAt = t.key ? host.seen(t.key) : null; put(log, introHtml(t.intro)); put(pl, ''); pl.hidden = true; C.jump = true; peek(null); }
587
590
  draw(); read();
588
591
  },
589
592
  refresh() { if (C.t) draw(); },
@@ -4,8 +4,9 @@
4
4
  * mountIni(ctx) once, from home-app.js. ctx: { S, VW, pmGet, pmPost, toast, load, openFile, iniTitle, drawList, wait }
5
5
  * iniList(sc) after each draw of the list column: reads the layout record and moves the stage by itself when it may. The list column
6
6
  * never changes for an initiative (canvas HbC): the initiative is a page of the Viewer.
7
- * iniPage() the initiative's page in the Viewer (canvas HbCDesk): the stage card with Move to <next>, three tasks and the documents that
8
- * need a look. "Show N more" and "Show all N" drill into Tasks and Documents, with ← back to the page. true when it opened.
7
+ * iniPage() the initiative's page in the Viewer: the ONE view the Board's panel draws too (ini-view.js; batch 6 items 1 and 3):
8
+ * summary, stage card with the dates line, Tasks as the WBS, Documents and Linked. The next stage opens the move sheet;
9
+ * Documents drills into the documents view, with ← back to the page. true when it opened.
9
10
  * iniOverview(v, o) the initiative in the Viewer: Tasks (the default), Documents or Stage; o.back keeps the page behind it. true when it opened.
10
11
  *
11
12
  * The stage move (stage card D, canvas XscD and XscDDesk; it replaced InStage's switch, Move to <next> and Back on the card): the card's last
@@ -28,6 +29,7 @@ import * as MD from './home-ini-model.js';
28
29
  import * as TKM from './tk-model.js';
29
30
  import * as WF from './ini-wf.js';
30
31
  import * as SC from './home-stage-card.js';
32
+ import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
31
33
  import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D: the card's last node and the move sheet's words // D99: the initiative's own workflow (Change picker, switch, Won't do, Archive)
32
34
 
33
35
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -215,7 +217,7 @@ function nextSheetHtml(id, M, mv) {
215
217
  }
216
218
  function popNext(anchor, id, M) {
217
219
  const mv = mvOf(id, M);
218
- const reopen = () => { const a = document.querySelector('#czViewer [data-hi-next]') || anchor; return a; };
220
+ const reopen = () => { const a = document.querySelector('#czViewer [data-iv-next]') || anchor; return a; };
219
221
  openPop(anchor, 'next', nextSheetHtml(id, M, mv), async (b, el) => {
220
222
  const d = b.dataset, mv2 = mvOf(id, curM() || M);
221
223
  if ('hiAuto' in d) {
@@ -252,26 +254,57 @@ export function iniList(sc) {
252
254
  if (X.view === 'page') redrawView(); // a new read of the initiative shows on its page
253
255
  }
254
256
 
255
- /* ── the initiative's page in the Viewer (canvas HbCDesk, HbCNew, HbCPhone) ── */
257
+ /* ── the initiative's page in the Viewer: the ONE view (batch 6 items 1 and 3; canvas OvIniA, OvViewers) ──
258
+ * The Board's panel draws the same model (ini-view-model.js) with the same renderer (ini-view.js): the summary card, the stage card with
259
+ * the dates line, Tasks as the WBS, Documents and Linked as folds. Home keeps its own presses: the next stage opens the move sheet, a task
260
+ * drills into the task editor, Documents drills into the documents view. */
261
+ let ADDING = null; // the initiative whose inline Add a task is open
256
262
  function pageHtml(id, M) {
257
- const L = Lof(id), rows = MD.taskRows(M, L), T = MD.listTasks(rows);
258
- // stage card D: the card's last node is the next stage (or Move to ◆ Deliver), from the move model of the card's own head
259
- const card = X.ctx.cardHtml(id, { page: true, tail: (h) => SC.tailOf(h, MD.moveModel(h, wfM(id, M), wfL(id, L), Date.now())) });
260
- const trow = (t) => `<div class="hm-r hi-r">`
261
- + (t.canCheck ? `<button type="button" class="hi-chk" data-hi-chk="${esc(t.key)}" aria-pressed="false" aria-label="Mark ${esc(t.title)} done"></button>` : '<span class="hi-chk off" aria-hidden="true"></span>')
262
- + `<button type="button" class="hm-rm" data-hi-task="${esc(t.key)}"><span class="hm-rt"><b>${esc(t.title)}</b><em class="${t.late ? 'late' : 'q'}">${esc([t.owner || (t.jira ? 'Jira' : ''), t.due].filter(Boolean).join(' · ') || t.state)}</em></span></button></div>`;
263
- const more = T.all - T.top.length;
264
- const tasks = `<section class="hi-pg" aria-label="Tasks"><div class="hi-pgh"><b>Tasks</b>${T.open ? `<span class="hi-n">${T.open}</span>` : ''}<button type="button" class="hm-gadd" data-hi-addtask aria-label="Add a task to ${esc(X.ctx.iniTitle(id))}" title="Add a task">${SVG(I.plus, 14, 2.2)}</button></div>`
265
- + (rows.length ? T.top.map(trow).join('') + (more > 0 ? `<button type="button" class="hi-pgm" data-hi-open="tasks">Show ${more} more${SVG(I.right, 14, 2)}</button>` : '')
266
- : `<div class="hi-pge"><p>No tasks yet</p><button type="button" class="hi-btn sm" data-hi-addtask>${SVG(I.plus, 14)}Add a task</button></div>`)
267
- + '</section>';
268
- const docs = MD.docRows(M), look = docs.filter((d) => d.look);
269
- const drow = (d) => `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-doc="${esc(d.key)}"><i class="hm-dot hi-risk" aria-hidden="true"></i><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>${esc(d.title)}</b><em class="risk">${esc(MD.docPill(d)[0] + (d.when ? ' · ' + d.when : ''))}</em></span></button></div>`;
270
- const dsec = docs.length ? `<section class="hi-pg" aria-label="Documents"><div class="hi-pgh"><b>Documents</b><span class="hi-n">${docs.length}</span></div>`
271
- + look.map(drow).join('') + `<button type="button" class="hi-pgm" data-hi-open="docs">Show all ${docs.length}${SVG(I.right, 14, 2)}</button></section>` : '';
263
+ X.ctx.head(id); // the stage head the move sheet and the primary read (S.H)
264
+ const v = X.ctx.view(id);
265
+ if (!v) return `<div class="hi-v hi-page" data-hi-v="page"><p class="hi-small" role="status">The initiative could not be read.</p></div>`;
266
+ const docs = MD.docRows(M);
272
267
  // a phone: the page is a sheet over the list, and the chat is one press away (HbCPhone)
273
268
  const talk = isPhone() ? `<button type="button" class="hi-talk" data-hi-talk>Message Claude about ${esc(X.ctx.iniTitle(id))}</button>` : '';
274
- return `<div class="hi-v hi-page" data-hi-v="page">${WF.endedHtml(rowOf(id))}${card}${tasks}${dsec}${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
269
+ return `<div class="hi-v hi-page" data-hi-v="page">${WF.endedHtml(rowOf(id))}`
270
+ + viewHtml(v, { add: true, adding: ADDING === id, next: !!v.stage.next, openTask: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
271
+ + `${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
272
+ }
273
+ /** The one view's presses on Home's page. */
274
+ function wirePage(b, id) {
275
+ const C = X.ctx, say = (m) => C.toast(m);
276
+ wireView(b, {
277
+ redraw: () => redrawView(),
278
+ check: async (uid, btn) => {
279
+ const M = curM(); if (!M) return;
280
+ const done = btn.getAttribute('aria-pressed') === 'true';
281
+ const r = await C.pmPost('/api/boards/tasks/state', { ...bw(M), task: uid, state: done ? 'To do' : 'Done' });
282
+ if (!r || r.ok === false) { say((r && r.error) || 'Nothing was changed.'); return; }
283
+ await C.load(); redrawView();
284
+ },
285
+ openTask: (uid) => {
286
+ const M = curM(); if (!M) return;
287
+ const row = (M.tasks.rows || []).find((x) => x.uid === uid || x.key === uid || x.key === 'task:' + uid);
288
+ if (row) { C.VW.drill(); openTask(id, M, row.key); } else iniOverview('tasks', { back: true });
289
+ },
290
+ add: () => { ADDING = id; redrawView(); const f = BODY && BODY.querySelector('#ivAddTask'); if (f) f.focus(); },
291
+ addCancel: () => { ADDING = null; redrawView(); },
292
+ addTask: async (title, inp) => {
293
+ const M = curM(); if (!M) return;
294
+ inp.disabled = true;
295
+ const r = await C.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title });
296
+ inp.disabled = false;
297
+ if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
298
+ say('Task added.'); await C.load(); redrawView();
299
+ const n = BODY && BODY.querySelector('#ivAddTask'); if (n) { n.value = ''; n.focus(); }
300
+ },
301
+ next: (btn) => { const M = curM(); if (M) popNext(btn, id, M); },
302
+ primary: (act) => { if (act === 'ask' || act === 'commit' || act === 'page') C.cta(); else if (act && act.startsWith('doc:')) iniOverview('docs', { back: true }); else C.cta(); },
303
+ program: (pid) => { if (C.goProgram) C.goProgram(pid); },
304
+ doc: (path) => { C.VW.drill(); C.openFile({ path, name: path.split('/').pop() }); },
305
+ docs: () => iniOverview('docs', { back: true }),
306
+ wf: (btn) => WF.openPicker(btn, wfUi(), id),
307
+ });
275
308
  }
276
309
  /** ⋯ of the page (HbCMore): change it, look at it elsewhere, then stop it, red and last. */
277
310
  function pageMore(id) {
@@ -279,6 +312,8 @@ function pageMore(id) {
279
312
  const mv = mvOf(id, M), out = [], row = rowOf(id), self = !!(M.acts && M.acts.self);
280
313
  // D99 (WfAWontDo): Change workflow and Rename first; the PMOS-self board keeps its derived ladder, so it has no workflow to change
281
314
  if (!self && !row.ended) out.push({ label: 'Change workflow', note: (row.wf || {}).name || 'Product feature', on: (b) => WF.openPicker(b || moreBtn(), wfUi(), id) });
315
+ // the one view lists the tasks as the WBS; grouping them by epic, owner or your own groups, and sending them to Jira, is the Tasks view
316
+ out.push({ label: 'All tasks', note: 'Group, send to Jira', on: () => iniOverview('tasks', { back: true }) });
282
317
  if (X.ctx.renameIni) out.push({ label: 'Rename', on: () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } });
283
318
  if (!mv.why) out.push({ label: 'Moves on by itself', note: mv.auto ? 'On' : 'Off', on: () => (ownWf(row) ? autoPress(id, M, !mv.auto) : press(id, M, { kind: 'auto', on: !mv.auto })) });
284
319
  if (mv.canBack) out.push({ label: 'Move back a stage', note: mv.prev, on: (b) => popBack(b || document.querySelector('#czViewer [data-cz-vw="more"]'), id, M, mv) });
@@ -309,8 +344,8 @@ export function iniPage() {
309
344
  let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
310
345
  if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
311
346
  BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', more: () => pageMore(id), rename,
312
- add: { label: 'New session', on: () => X.ctx.newIn(id) },
313
- render: (b) => { X.view = 'page'; BODY = b; draw(b); wire(b, id); } });
347
+ discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
348
+ render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); } });
314
349
  WF.pmosNotice(wfUi(), id); // WfTriage: "Set to Tender from the BRD · Undo", once
315
350
  if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; redrawView(); }); }
316
351
  return true;
@@ -2,11 +2,11 @@
2
2
  * XetX1Rest … XetX1Phone).
3
3
  *
4
4
  * A PMOS task of an initiative (GET /api/boards/items, src "pmos") opens here from the list and edits in place: the check box in the header
5
- * is the quick Done, the title is the rename press, and the card under it (task-card.js, the one editor every page uses) changes the status,
6
- * the dates, the owner, the group, the notes and the initiative. Every write is the board's own route and is the PM's press; each says so
5
+ * is the quick Done, the title is the rename press, and the view under it (task-card.js, the one task Viewer every page uses) changes the
6
+ * status, the dates, the owner and the notes, and its move icon the section, the group or the initiative. Every write is the board's own route and is the PM's press; each says so
7
7
  * in a toast with Undo, and a refusal shows the route's reason and changes nothing. Talk it through in chat is under ⋯ (the chat is beside
8
8
  * the Viewer on Home). The PM's own items (a note, a mention made into a task) open in My work's item view (home-work.js). */
9
- import { taskOf, checkOf, mountCard, boardSaver, cardStyle } from './task-card.js';
9
+ import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf } from './task-card.js';
10
10
 
11
11
  /** h: { VW, pmPost, toast, toastUndo?, now, ws, board, iniTitle(id), openIni(id), askInChat(task), onChange(), rename?(task),
12
12
  * owners?() → [names], inis?() → [{ id, title }] } */
@@ -17,9 +17,9 @@ export function openTask(task, h) {
17
17
  const t = taskOf(raw, { iniTitle: h.iniTitle(raw.ini), board });
18
18
  const id = 'task:' + raw.uid;
19
19
  const save = boardSaver({ ws, board, t, post: (p, b) => h.pmPost(p, b) });
20
- let card = null, layout = null;
20
+ let card = null, layout = null, sections = null;
21
21
  const changed = () => {
22
- raw.status = t.status; raw.end = t.due; raw.start = t.start; raw.owner = t.owner; raw.notes = t.notes; raw.ini = t.ini; // the list reads the same row
22
+ raw.status = t.status; raw.end = t.due; raw.start = t.start; raw.owner = t.owner; raw.notes = t.notes; raw.ini = t.ini; raw.section = t.section; // the list reads the same row
23
23
  if (h.VW.setCheck) h.VW.setCheck(id, checkOf(t));
24
24
  clearTimeout(changed.t); changed.t = setTimeout(() => { if (h.onChange) h.onChange(); }, 400);
25
25
  };
@@ -37,11 +37,22 @@ export function openTask(task, h) {
37
37
  owners: () => (h.owners ? h.owners() : []),
38
38
  inis: () => (h.inis ? h.inis() : []),
39
39
  groups: () => (layout ? layout.names || [] : null),
40
+ sections: () => sections,
40
41
  });
41
42
  },
42
43
  });
43
44
  // the PM's groups of the initiative, and which one holds this task (initiative-layout); the group chip shows once they are read
44
45
  if (t.ini) fetch('/api/initiative-layout?initiative=' + encodeURIComponent(t.ini) + (ws ? '&ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })
45
46
  .then((r) => r.json()).then((L) => { if (!L || !L.ok || !card || !body || !body.isConnected) return; layout = L; t.group = (L.of || {})[t.key] || ''; card.draw(); }).catch(() => {});
47
+ // where it sits: the initiative's stages (the sections the move icon offers), the task's section and its breakdown item
48
+ if (t.ini && board) fetch('/api/boards/items?board=' + encodeURIComponent(board) + (ws ? '&ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })
49
+ .then((r) => r.json()).then(async (I) => {
50
+ if (!I || !I.ok || !card || !body || !body.isConnected) return;
51
+ const ini = (I.initiatives || []).find((x) => x.id === t.ini);
52
+ sections = ini && Array.isArray(ini.stages) && ini.stages.length ? ini.stages : null;
53
+ const row = (I.items || []).find((x) => x.uid === raw.uid) || raw;
54
+ const P = await placeOf(row, sections || [], (I.items || []).filter((x) => x.ini === t.ini && x.src !== 'jira'));
55
+ t.section = P.section; t.wbs = P.wbs; card.draw();
56
+ }).catch(() => {});
46
57
  return body;
47
58
  }