create-pmos 0.411.0 → 0.413.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 (113) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/pmos-log.sh +6 -3
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/board-programs-test.js +2 -2
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-insights-test.js +2 -2
  10. package/workspace/briefing-premium-test.js +3 -3
  11. package/workspace/changelog.json +24 -0
  12. package/workspace/core-docs-workflow-test.js +144 -0
  13. package/workspace/guide/board.md +1 -1
  14. package/workspace/guide/breakdown.md +6 -13
  15. package/workspace/guide/index.md +1 -1
  16. package/workspace/guide/initiative-driver.md +1 -1
  17. package/workspace/guide/initiatives-screen.md +1 -1
  18. package/workspace/guide/pm-only-acts.md +23 -24
  19. package/workspace/guide/today.md +1 -1
  20. package/workspace/guide/workflows.md +8 -1
  21. package/workspace/lib/board-premium.js +7 -2
  22. package/workspace/lib/briefing-premium-agent.js +16 -4
  23. package/workspace/lib/briefing-premium-writes.js +5 -4
  24. package/workspace/lib/core-docs.js +79 -14
  25. package/workspace/lib/coredoc-cli.js +1 -1
  26. package/workspace/lib/driver-cli.js +2 -1
  27. package/workspace/lib/driver-decide.js +3 -2
  28. package/workspace/lib/driver.js +2 -1
  29. package/workspace/lib/engine/boards.js +20 -12
  30. package/workspace/lib/grant-mint.js +3 -2
  31. package/workspace/lib/initiative-chat.js +49 -0
  32. package/workspace/lib/initiative-cli.js +9 -9
  33. package/workspace/lib/initiative-premium.js +17 -7
  34. package/workspace/lib/issues.js +5 -4
  35. package/workspace/lib/item-cli.js +7 -2
  36. package/workspace/lib/people-store.js +1 -1
  37. package/workspace/lib/people.js +3 -1
  38. package/workspace/lib/placements.js +13 -15
  39. package/workspace/lib/plan-items.js +18 -49
  40. package/workspace/lib/pm-guard.js +18 -5
  41. package/workspace/lib/pm-lines-needs.js +9 -5
  42. package/workspace/lib/pmos-verbs.js +1 -1
  43. package/workspace/lib/program-chat.js +1 -1
  44. package/workspace/lib/programs.js +21 -5
  45. package/workspace/lib/report-cli.js +2 -2
  46. package/workspace/lib/routes-board-metric-targets.js +0 -1
  47. package/workspace/lib/routes-boards.js +75 -13
  48. package/workspace/lib/routes-briefing-premium.js +20 -6
  49. package/workspace/lib/routes-core-docs.js +3 -2
  50. package/workspace/lib/routes-custom-docs.js +0 -1
  51. package/workspace/lib/routes-driver.js +0 -1
  52. package/workspace/lib/routes-home-desk.js +1 -1
  53. package/workspace/lib/routes-home-review.js +1 -1
  54. package/workspace/lib/routes-initiative-layout.js +1 -1
  55. package/workspace/lib/routes-insights-records.js +0 -1
  56. package/workspace/lib/routes-meeting-material.js +0 -1
  57. package/workspace/lib/routes-onboarding.js +3 -1
  58. package/workspace/lib/routes-orchestrator.js +0 -1
  59. package/workspace/lib/routes-premium-charts.js +0 -1
  60. package/workspace/lib/routes-premium-dashboards.js +0 -1
  61. package/workspace/lib/routes-programs.js +13 -2
  62. package/workspace/lib/routes-records.js +1 -1
  63. package/workspace/lib/routes-report-design.js +7 -3
  64. package/workspace/lib/routes-report-setups.js +0 -1
  65. package/workspace/lib/routes-report-structure.js +0 -1
  66. package/workspace/lib/routes-runs.js +2 -5
  67. package/workspace/lib/routes-scan.js +0 -1
  68. package/workspace/lib/routes-sources.js +1 -1
  69. package/workspace/lib/run-answers.js +14 -5
  70. package/workspace/lib/scan-cli.js +2 -1
  71. package/workspace/lib/scan.js +2 -1
  72. package/workspace/lib/vendor/scripts/onboarding/proposals.js +7 -3
  73. package/workspace/lib/workflow-chat.js +1 -0
  74. package/workspace/lib/workflow-cli.js +91 -6
  75. package/workspace/package-lock.json +2 -2
  76. package/workspace/package.json +1 -1
  77. package/workspace/premium-chat-line-test.js +9 -0
  78. package/workspace/premium-core-doc-issue-test.js +1 -1
  79. package/workspace/premium-viewer-share-test.js +5 -2
  80. package/workspace/premium-vw-item-test.js +3 -3
  81. package/workspace/premium-vw-jira-test.js +2 -1
  82. package/workspace/program-order-test.js +180 -0
  83. package/workspace/public/pm/bd-prog.js +3 -3
  84. package/workspace/public/pm/cozy-viewer.js +8 -3
  85. package/workspace/public/pm/goal-chat.js +1 -1
  86. package/workspace/public/pm/home-app.js +22 -8
  87. package/workspace/public/pm/home-chat.js +6 -1
  88. package/workspace/public/pm/home-ini-model.js +42 -29
  89. package/workspace/public/pm/home-ini.css +1 -0
  90. package/workspace/public/pm/home-ini.js +26 -34
  91. package/workspace/public/pm/home-list.js +2 -1
  92. package/workspace/public/pm/home-stage-card.js +3 -1
  93. package/workspace/public/pm/home-task.js +41 -65
  94. package/workspace/public/pm/home-today.js +7 -5
  95. package/workspace/public/pm/premium-board.js +12 -6
  96. package/workspace/public/pm/premium-initiative-head.js +21 -11
  97. package/workspace/public/pm/premium-viewer.js +1 -0
  98. package/workspace/public/pm/premium-vw-item-model.js +13 -7
  99. package/workspace/public/pm/premium-vw-item.js +49 -5
  100. package/workspace/public/pm/prog-order.css +47 -0
  101. package/workspace/public/pm/prog-order.js +188 -0
  102. package/workspace/public/pm/program-model.js +75 -0
  103. package/workspace/public/pm/task-card.css +108 -0
  104. package/workspace/public/pm/task-card.js +271 -0
  105. package/workspace/replaced-tests.json +101 -0
  106. package/workspace/server.js +8 -9
  107. package/workspace/skills/workflow-setup.skill +14 -5
  108. package/workspace/stage-card-test.js +11 -0
  109. package/workspace/task-card-test.js +248 -0
  110. package/workspace/test-lists/core-documents-backend.json +15 -3
  111. package/workspace/test-lists/program-order.json +6 -0
  112. package/workspace/test-lists/task-card.json +6 -0
  113. package/workspace/test-lists/workflow-stage.json +5 -0
@@ -29,6 +29,8 @@
29
29
  * back true: keep the item shown now, so ← comes back to it. Without back, opening an item forgets what was behind it.
30
30
  * keep true: this item takes the place of the one shown now, and what was behind that one stays behind this one (a view switch)
31
31
  * add { label, on(button) }: a quiet + before ⋯ (Home's "New session" on an initiative, canvas HbC). Not drawn on a phone.
32
+ * check { state: 'todo'|'prog'|'done'|'wont'|'arch', label, title?, disabled? }: a task's check box in the tile's place (canvas XetX1Rest);
33
+ * a press runs onPress('check', button). setCheck(id, check) changes it while the item is shown.
32
34
  * sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
33
35
  * presses [{ act, label, icon, text?, solid? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
34
36
  * charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary.
@@ -122,7 +124,8 @@ export function headHtml(it) {
122
124
  : `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 18)}</button>`).join('');
123
125
  const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
124
126
  return (o.canBack || phone ? ib('back', o.canBack ? 'Back' : 'Close the viewer', P.back) : '')
125
- + `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`
127
+ + (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
128
+ : `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
126
129
  + (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : esc(o.title || '')}</h3>${sub}</div>`)
127
130
  + disc + own + add + more
128
131
  + (phone ? '' : ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
@@ -426,6 +429,8 @@ async function saveRename() {
426
429
  }
427
430
  /** The item's own presses change while it is shown (the charter's Save shows only after a change). */
428
431
  export function setPresses(id, list) { if (V.cur && V.cur.id === String(id)) { V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
432
+ /** A task's check box changes while it is shown (a status move from the card, canvas XetX1Done). */
433
+ export function setCheck(id, check) { if (V.cur && V.cur.id === String(id)) { V.cur.check = check || null; if (V.cur.args) V.cur.args = { ...V.cur.args, check: check || null }; if (!V.cur.renaming) redraw(); } }
429
434
  /** The caller's own rename landed elsewhere (Undo, or a reload): the header shows the name. */
430
435
  export function retitle(id, title) { if (V.cur && V.cur.id === String(id) && title) { V.cur.title = title; if (V.cur.args) V.cur.args = { ...V.cur.args, title }; if (!V.cur.renaming) redraw(); emit(); } }
431
436
 
@@ -445,7 +450,7 @@ export function open(it) {
445
450
  V.drill = false;
446
451
  const sameKind = V.cur && kindKey(V.cur.kind) === kindKey(o.kind);
447
452
  leave();
448
- 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 || '', presses: o.presses || null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
453
+ 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 };
449
454
  el.setAttribute('aria-label', 'Viewer: ' + (o.kind || o.title || 'item'));
450
455
  redraw();
451
456
  const m = el.querySelector('.cz-vw-menu'); if (m) m.remove();
@@ -500,4 +505,4 @@ if (typeof window !== 'undefined' && typeof window.addEventListener === 'functio
500
505
  e.preventDefault(); e.stopImmediatePropagation(); guarded(close);
501
506
  }, true);
502
507
  }
503
- if (typeof window !== 'undefined') window.czViewer = { open, close, back, drill, setPresses, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, ICONS };
508
+ if (typeof window !== 'undefined') window.czViewer = { open, close, back, drill, setPresses, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, ICONS };
@@ -59,7 +59,7 @@ export function shownUser(text) {
59
59
  if (t.includes(MARK.cancel)) return 'Cancel the goal';
60
60
  const g = t.indexOf(MARK.grill + ' The PM set a goal: ');
61
61
  if (g >= 0) return '/goal ' + t.slice(g + (MARK.grill + ' The PM set a goal: ').length).split('\n')[0];
62
- if (t.startsWith(OPENING) || t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]') || t.startsWith('[PMOS workflow]')) { const s = pmSays(t); if (s != null) return s; } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap; lib/workflow-chat.js wrap
62
+ if (t.startsWith(OPENING) || t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]') || t.startsWith('[PMOS workflow]') || t.startsWith('[PMOS initiative]')) { const s = pmSays(t); if (s != null) return s; } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap; lib/workflow-chat.js wrap
63
63
  return t;
64
64
  }
65
65
 
@@ -36,6 +36,7 @@ import { mountIni, iniList, iniOverview, iniPage } from './home-ini.js'; // th
36
36
  import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
37
37
  import { mountRecRow, clockOf as recClock } from './home-rec-row.js';
38
38
  import { mountSesName } from './home-ses-name.js'; // session names A: tap the session's name to rename it (canvas XmsNames)
39
+ import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
39
40
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
40
41
 
41
42
  const $ = (s, r = document) => r.querySelector(s);
@@ -689,7 +690,7 @@ function select(id, o = {}) {
689
690
  if (isPhone() && (r.kind === 'update' || (r.kind === 'need' && r.row) || r.kind === 'session' || r.needSession)) S.phoneChat = true;
690
691
  if (r.kind === 'update') { openTarget(updateTarget()); if (!o.keepViewer) openUpdateViewer(); }
691
692
  else if (r.kind === 'need' && r.row) { openTarget(needTarget(r)); if (!o.keepViewer) openNeedViewer(r); }
692
- else if (r.kind === 'session' || r.needSession) { const s = S.D.sessions.find((x) => x.id === r.sid); if (s) { openTarget(sessionTarget(s)); if (isMetricsSession(s) && !o.keepViewer && !isPhone()) openMetricsViewer(); } }
693
+ else if (r.kind === 'session' || r.needSession) { const s = S.D.sessions.find((x) => x.id === r.sid); if (s) { openTarget(sessionTarget(s)); followViewer(s); if (isMetricsSession(s) && !o.keepViewer && !isPhone()) openMetricsViewer(); } }
693
694
  else if (r.kind === 'ptask') { S.phoneChat = isPhone(); openTarget(programTarget(r.program, r)); }
694
695
  else if (r.kind === 'task') { openBoardTask(r.task); }
695
696
  else if (r.kind === 'item') { import('./home-work.js').then((M) => M.openWorkItem(r.key)); }
@@ -701,6 +702,17 @@ function select(id, o = {}) {
701
702
  drawList();
702
703
  syncUrl();
703
704
  }
705
+ /** A session opened beside an initiative's page in the Viewer: the page follows the session's own initiative, and a loose session closes
706
+ * it, so the Viewer never shows the initiative of the session before (Wawan, 2026-10-25). Other Viewer items stay as they are. */
707
+ function followViewer(s) {
708
+ if (isPhone()) return;
709
+ const c = VW.current(); if (!c || !/^ov:/.test(String(c.id))) return;
710
+ const ini = H.iniOfSession(s);
711
+ if (c.id === 'ov:' + ini) return;
712
+ if (!ini || !iniRowOf(ini)) { VW.close(); return; }
713
+ if (S.ini !== ini) { S.ini = ini; S.IM = null; S.IMid = null; S.doneOpen = false; S.stepsMore = false; }
714
+ iniPage();
715
+ }
704
716
  /** An initiative's name in the list (or 'product'): it is selected, the chat is its own and its page opens in the Viewer (HbCDesk). The list
705
717
  * stays as it is. o.page false: the chat alone, the Viewer as it is. */
706
718
  async function goIni(id, o = {}) {
@@ -771,16 +783,16 @@ const HTTPS = /^https:\/\//;
771
783
  function openBoardTask(t) {
772
784
  if (!t) return;
773
785
  import('./home-task.js').then((M) => M.openTask(t, {
774
- VW, pmPost, toast, now: NOW, ws: t.ws || boardWs(), board: t.board || boardId(), iniTitle,
775
- docs: (id) => (S.IMid === id && S.IM ? (S.IM.docs.rows || []).filter((d) => d.path && !d.tech).map((d) => ({ title: d.title, path: d.path })) : []),
776
- openIni: (id) => goIni(id), openDoc: (d) => openFile({ path: d.path, name: d.title }),
786
+ VW, pmPost, toast, toastUndo, now: NOW, ws: t.ws || boardWs(), board: t.board || boardId(), iniTitle,
787
+ owners: () => [...new Set(((S.D.items && S.D.items.items) || []).map((x) => x && x.src === 'pmos' && x.owner).filter(Boolean))], // the task card's owner list
788
+ inis: () => H.boardRows(S.D).filter((r) => r && !r.archived).map((r) => ({ id: r.id, title: r.title })),
789
+ openIni: (id) => goIni(id),
777
790
  askInChat: (task) => {
778
791
  S.phoneChat = isPhone();
779
792
  openTarget({ ...iniTarget(task.ini), placeholder: 'Ask about ' + task.title });
780
793
  setTimeout(() => { const ta = $('#hmIn'); if (ta) { ta.value = 'About the task "' + task.title + '": '; ta.dispatchEvent(new Event('input', { bubbles: true })); ta.focus(); } }, 0);
781
794
  drawList();
782
795
  },
783
- openRecord: (task) => import('./premium-vw-item.js').then((V) => V.openWorkItem({ kind: 'task', ini: task.ini, key: 'task:' + task.uid, title: task.title, ws: boardWs(), board: boardId() })).catch(() => toast('The record could not open.')),
784
796
  onChange: () => load(),
785
797
  rename: taskRenameOf,
786
798
  }));
@@ -999,7 +1011,7 @@ function openOverview() {
999
1011
  const life = M.acts && M.acts.life ? `<button type="button" class="hx-b" data-ov-life="active">Resume</button>`
1000
1012
  : ask ? `<label class="hv-why"><span>${ask === 'on-hold' ? 'Put on hold' : 'Cancel'}: why? It goes on the record.</span><input id="ovWhy" autocomplete="off"></label><button type="button" class="hx-b pri" data-ov-life-go>Record</button><button type="button" class="hx-b" data-ov-life-no>Not now</button>`
1001
1013
  : `<button type="button" class="hx-b" data-ov-life="on-hold">Put on hold</button><button type="button" class="hx-b" data-ov-life="cancelled">Cancel</button>`;
1002
- const tasks = (M.tasks.rows || []).slice(0, 40).map((t) => `<div class="hx-row" data-ov-tkrow="${esc(t.key)}"><span class="hx-t"><b>${esc(t.title)}</b><em>${esc([t.src, t.state, t.owner].filter(Boolean).join(' · '))}</em></span><button type="button" class="hx-b" data-ov-tk="${esc(t.key)}" aria-label="Open ${esc(t.title)}">Open</button>${t.pmos && t.uid ? `<select data-ov-task="${esc(t.uid)}" aria-label="Status of ${esc(t.title)}">${['To do', 'In progress', 'In review', 'Done'].map((s) => `<option${t.state === s ? ' selected' : ''}>${s}</option>`).join('')}</select>` : ''}</div>`).join('') || `<p class="hx-n">${esc(M.tasks.note || 'No task.')}</p>`;
1014
+ const tasks = (M.tasks.rows || []).slice(0, 40).map((t) => `<div class="hx-row" data-ov-tkrow="${esc(t.key)}"><span class="hx-t"><b>${esc(t.title)}</b><em>${esc([t.src, t.state, t.owner].filter(Boolean).join(' · '))}</em></span><button type="button" class="hx-b" data-ov-tk="${esc(t.key)}" aria-label="Open ${esc(t.title)}">Open</button>${t.pmos && t.uid ? `<select data-ov-task="${esc(t.uid)}" aria-label="Status of ${esc(t.title)}">${['To do', 'In progress', 'Done', "Won't do", 'Archived'].map((s) => `<option${t.state === s ? ' selected' : ''}>${s}</option>`).join('')}</select>` : ''}</div>`).join('') || `<p class="hx-n">${esc(M.tasks.note || 'No task.')}</p>`;
1003
1015
  const docs = (M.docs.rows || []).filter((d) => !d.tech).map((d) => `<div class="hx-row" data-ov-doc="${esc(d.key)}"><span class="hx-t"><b>${esc(d.title)}</b><em>${esc([d.state, d.by, d.when || (d.added ? 'added ' + d.added : '')].filter(Boolean).join(' · '))}</em>${d.link ? `<small>${esc(d.link.kind + ': ' + d.link.url)}</small>` : ''}</span>${d.path && d.st === 'draft' && d.slot ? `<button type="button" class="hx-b" data-ov-dread="${esc(d.key)}">Read</button>` : d.path ? `<button type="button" class="hx-b" data-ov-open="${esc(d.path)}" data-ov-name="${esc(d.title)}">Open</button>` : ''}${d.act && d.act.kind === 'draft' && !d.running ? `<button type="button" class="hx-b pri" data-ov-draft="${esc(d.key)}">Draft it</button>` : d.running ? '<em class="hx-n">Drafting</em>' : ''}</div>`).join('');
1004
1016
  b.innerHTML = MORE.WAIT + `<div class="hv-acts"><button type="button" class="hx-b" data-ov-record>Open the full record</button>${M.board && M.board.id ? '<button type="button" class="hx-b" data-ov-sprint>Sprint</button>' : ''}</div><section class="hx-sec"><h4>Stage</h4>${move}<div class="hv-acts">${life}</div></section>`
1005
1017
  + `<section class="hx-sec"><h4>Tasks</h4>${tasks}<div class="hx-add"><input id="ovTask" placeholder="Add a task" aria-label="Add a task"><button type="button" class="hx-b pri" data-ov-add>Add</button></div></section>`
@@ -1024,7 +1036,6 @@ function openOverview() {
1024
1036
  if ('ovSprint' in t.dataset) { (await import('./premium-vw-jira.js')).openSprint(o); return; }
1025
1037
  if ('ovRecord' in t.dataset) { (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...o }); return; }
1026
1038
  const row = (M.tasks.rows || []).find((x) => x.key === t.dataset.ovTk); if (!row) return;
1027
- if (!row.pmos && row.ref) { (await import('./premium-vw-jira.js')).openTicket({ ...o, initiative: id, ref: row.ref }); return; }
1028
1039
  (await import('./premium-vw-item.js')).openWorkItem({ kind: 'task', ini: id, key: row.key, title: row.title, ...o });
1029
1040
  return;
1030
1041
  }
@@ -1294,7 +1305,7 @@ function moreMenu(anchor) {
1294
1305
  function searchGo(d) {
1295
1306
  if (d.ini) goIni(d.ini);
1296
1307
  else if (d.doc) openFile({ path: d.doc, name: d.doc.split('/').pop() });
1297
- else if (d.ses) { const s = S.D.sessions.find((x) => x.id === d.ses); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); drawList(); } }
1308
+ else if (d.ses) { const s = S.D.sessions.find((x) => x.id === d.ses); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); followViewer(s); drawList(); } }
1298
1309
  else if (d.link) location.href = d.link;
1299
1310
  }
1300
1311
 
@@ -1420,6 +1431,9 @@ mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni:
1420
1431
  * 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. */
1421
1432
  let progPanel = null;
1422
1433
  const programPanel = () => progPanel || (progPanel = import('./bd-prog-panel.js').then((PP) => { PP.mount({ M: () => S.D.board, programs: () => S.D.programs || [], openIni: (id) => goIni(id), close: () => {}, reload: () => load(), say: (m) => toast(m), drill: true }); return PP; }));
1434
+ PO.mount({ programs: () => S.D.programs || [], stateOf: (p) => (((S.M && S.M.groups) || []).find((g) => g.kind === 'program' && g.program.id === p.id) || {}).st || null,
1435
+ saved: (p) => { const L2 = S.D.programs || [], i = L2.findIndex((x) => x.id === p.id); if (i >= 0) L2[i] = { ...L2[i], ...p }; drawList(); },
1436
+ say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)), openIni: (id) => goIni(id) });
1423
1437
  mountNav('home', document, { more: () => moreMenu, settings: () => MORE.openSettings(), here: () => { if (VW.isOpen()) VW.close(); goHome(); } });
1424
1438
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m) }); drawList();
1425
1439
  drawList(); drawTop();
@@ -212,7 +212,12 @@ export function mountChat(el, host) {
212
212
  const at = Date.parse((goal && goal.at) || '');
213
213
  let k = -1;
214
214
  items.forEach((it, i) => { if (it.at && Number.isFinite(at) && Date.parse(it.at) <= at && (goal.state !== 'done' || it.t === 'agent')) k = i; });
215
- if (k < 0) { parts.push(dividerHtml(d)); return; }
215
+ if (k < 0) {
216
+ // it finished before every message shown here (an older run, or before the shown window): the divider leads, never trails the newest
217
+ const after = Number.isFinite(at) && items.some((it) => Date.parse(it.at || '') > at);
218
+ if (after) parts.unshift(dividerHtml(d)); else parts.push(dividerHtml(d));
219
+ return;
220
+ }
216
221
  if (goal.state === 'done') parts[k] = dividerHtml(d) + parts[k]; else parts[k] += dividerHtml(d);
217
222
  }
218
223
  /* ── the progress line (XcbOptions B) ── */
@@ -81,23 +81,30 @@ function dueOf(end, done, now) {
81
81
  return { text: d.getDate() + ' ' + MON[d.getMonth()], late: false };
82
82
  }
83
83
  const initials = (name) => { const w = String(name || '').trim().split(/\s+/).filter(Boolean); return !w.length ? '' : w.length > 1 ? (w[0][0] + w[1][0]).toUpperCase() : w[0].slice(0, 2).replace(/^./, (c) => c.toUpperCase()); };
84
- export function taskRows(M, L, now = Date.now()) {
85
- const lay = L || { stage: {}, of: {} };
86
- return (((M || {}).tasks || {}).rows || []).map((t) => {
87
- const done = t.state === 'Done';
84
+ /** A task's state is its only stage (Wawan, 2026-10-25): To do, In progress, Done, Won't do, Archived. An old or Jira 'In review' reads as In progress. */
85
+ export const TASK_STATES = ['To do', 'In progress', 'Done', "Won't do", 'Archived'];
86
+ const stateOf = (s) => (s === 'In review' ? 'In progress' : s);
87
+ /** The initiative's tasks. An Archived task is left out unless o.archived (like an archived initiative). A task carries no workflow stage: the
88
+ * layout's old per-task stage stays stored and is not read. */
89
+ export function taskRows(M, L, now = Date.now(), o = {}) {
90
+ const lay = L || { of: {} };
91
+ return (((M || {}).tasks || {}).rows || []).filter((t) => o.archived || t.state !== 'Archived').map((t) => {
92
+ const state = stateOf(t.state);
93
+ const done = state === 'Done', closed = done || state === "Won't do" || state === 'Archived';
88
94
  const jira = /^Jira/.test(t.src || ''), req = /^req:/.test(t.key || '');
89
- const stage = (lay.stage || {})[t.key] || (jira || req ? 'Build' : '');
90
- const due = dueOf(t.end, done, now);
91
- return { key: t.key, uid: t.uid || '', ref: t.ref || '', pmos: !!t.pmos, jira, req, title: t.title, state: t.state || (req ? '' : 'To do'), done, stage, stageSet: !!(lay.stage || {})[t.key],
95
+ const due = dueOf(t.end, closed, now);
96
+ return { key: t.key, uid: t.uid || '', ref: t.ref || '', pmos: !!t.pmos, jira, req, title: t.title, state: state || (req ? '' : 'To do'), done, closed, wontdo: state === "Won't do",
92
97
  owner: t.owner || '', av: initials(t.owner), due: due.text, late: due.late, end: t.end || '', group: (lay.of || {})[t.key] || '', src: t.src || '', blocked: !!t.blocked, canCheck: !!(t.pmos && t.uid) };
93
98
  });
94
99
  }
95
- export const BY_LABEL = { stage: 'Stage', epic: 'Epic', mine: 'Your groups', owner: 'Owner', status: 'Status', none: 'No groups' }; // epic: tk-model.js ticketGroups
96
- const STATUS = ['To do', 'In progress', 'In review', 'Done'];
97
- const order = (rows) => rows.filter((r) => !r.done).concat(rows.filter((r) => r.done));
98
- export function taskGroups(rows, L, by, stages) {
99
- const lay = L || { names: [] }, b = BY_LABEL[by] ? by : 'stage';
100
- const g = (key, title, list, o = {}) => ({ key, title, rows: order(list), open: list.filter((r) => !r.done).length, ...o });
100
+ // a task hangs under no workflow stage (Wawan, 2026-10-25), so there is no "by stage"; a layout that saved 'stage' reads as Your groups
101
+ export const BY_LABEL = { epic: 'Epic', mine: 'Your groups', owner: 'Owner', status: 'Status', none: 'No groups' }; // epic: tk-model.js ticketGroups
102
+ const STATUS = TASK_STATES;
103
+ const shut = (r) => (r.closed != null ? r.closed : r.done);
104
+ const order = (rows) => rows.filter((r) => !shut(r)).concat(rows.filter((r) => shut(r)));
105
+ export function taskGroups(rows, L, by) {
106
+ const lay = L || { names: [] }, b = BY_LABEL[by] ? by : 'mine';
107
+ const g = (key, title, list, o = {}) => ({ key, title, rows: order(list), open: list.filter((r) => !shut(r)).length, ...o });
101
108
  if (b === 'none') return [g('all', null, rows)];
102
109
  if (b === 'mine') {
103
110
  const out = (lay.names || []).map((n) => g('g:' + n, n, rows.filter((r) => r.group === n), { mine: true }));
@@ -113,14 +120,10 @@ export function taskGroups(rows, L, by, stages) {
113
120
  const keys = STATUS.concat([...new Set(rows.map((r) => r.state || 'No status').filter((s) => !STATUS.includes(s)))]);
114
121
  return keys.map((s) => g('s:' + s, s, rows.filter((r) => (r.state || 'No status') === s))).filter((x) => x.rows.length);
115
122
  }
116
- const st = (stages && stages.length ? stages : STEPS.map((s) => s.label));
117
- const out = st.map((s) => g('t:' + s, s, rows.filter((r) => r.stage === s))).filter((x) => x.rows.length);
118
- const none = rows.filter((r) => !r.stage || !st.includes(r.stage));
119
- if (none.length) out.push(g('t:', 'No stage', none));
120
- return out;
123
+ return [g('all', null, rows)];
121
124
  }
122
125
  export function listTasks(rows) {
123
- const open = rows.filter((r) => !r.done && !r.req);
126
+ const open = rows.filter((r) => !shut(r) && !r.req);
124
127
  const top = open.slice().sort((a, b) => (a.end || '9999').localeCompare(b.end || '9999')).slice(0, 3);
125
128
  const jira = rows.filter((r) => r.jira).length, reqs = rows.filter((r) => r.req).length;
126
129
  return { top, open: open.length, all: rows.length, sub: [plural(rows.length, 'task', 'tasks'), jira ? jira + ' from Jira' : '', reqs ? plural(reqs, 'PRD requirement', 'PRD requirements') : ''].filter(Boolean).join(' · ') };
@@ -131,21 +134,28 @@ const KIND = { record: 'Record', problem: 'Spec', research: 'Research', rice: 'P
131
134
  const CHIP = { Record: 'Specs', Spec: 'Specs', PRD: 'Specs', Rubric: 'Specs', BRD: 'Specs', Research: 'Research', Design: 'Design', 'Plan doc': 'Plans', Review: 'Reports', Report: 'Reports', Notes: 'Notes', Slides: 'Slides', Linked: 'Linked', Added: 'Added' };
132
135
  const LOOK = new Set(['draft', 'stale', 'due']);
133
136
  const PILL = { draft: ['Draft', ''], ok: ['Up to date', 'ok'], live: ['Live', 'ok'], stale: ['Stale', 'w'], due: ['Due', 'w'], linked: ['Linked', ''] };
134
- export function docRows(M) {
137
+ /** The groups documents fall in and the current one: an initiative on a library workflow (D99) groups under its own stages
138
+ * (M.docs.phases, M.docs.cur); Product feature under PHASES, from the stage. */
139
+ export function docPhases(M) {
135
140
  const D = (M || {}).docs || {};
141
+ if (Array.isArray(D.phases) && D.phases.length) return { phases: D.phases, cur: D.cur || D.phases[0] };
142
+ return { phases: PHASES, cur: phaseOf(M && M.acts && M.acts.stage) };
143
+ }
144
+ export function docRows(M) {
145
+ const D = (M || {}).docs || {}, { phases } = docPhases(M);
136
146
  return (D.rows || []).filter((d) => !d.tech).map((d) => {
137
147
  const custom = !!d.custom || /^custom:/.test(d.key || '');
138
148
  const kind = custom ? (d.link ? (/Slides/.test(d.link.kind || '') ? 'Slides' : 'Linked') : 'Added') : KIND[d.key] || 'Document';
139
- const phase = PHASES.includes(d.cat) ? d.cat : null;
149
+ const phase = phases.includes(d.cat) ? d.cat : null;
140
150
  return { key: d.key, title: d.title, kind, chip: CHIP[kind] || 'Other', core: !custom, phase, st: d.st || 'missing', state: d.state || '', by: d.by || '', when: d.when || (d.added ? 'added ' + d.added : ''), path: d.path || null,
141
- slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st), what: d.what || '' };
151
+ slot: d.slot || '', act: d.act || null, running: !!d.running, link: d.link || null, look: LOOK.has(d.st), what: d.what || '', ...(d.other ? { other: true } : {}) };
142
152
  });
143
153
  }
144
154
  /** The pill a document row shows: its state, Skipped (an earlier stage did without it), Not started. */
145
- export function docPill(d, curPhase) {
155
+ export function docPill(d, curPhase, phases = PHASES) {
146
156
  if (d.running) return ['Drafting', ''];
147
157
  if (d.st === 'missing') {
148
- const pi = PHASES.indexOf(d.phase), ci = PHASES.indexOf(curPhase);
158
+ const pi = phases.indexOf(d.phase), ci = phases.indexOf(curPhase);
149
159
  return pi >= 0 && ci >= 0 && pi < ci ? ['Skipped', 'dash'] : ['Not started', 'dash'];
150
160
  }
151
161
  return PILL[d.st] || [d.state || d.st, ''];
@@ -169,19 +179,22 @@ export function docGroups(rows, stage, o = {}) {
169
179
  const ks = [...new Set(list.map((d) => d.chip))];
170
180
  return ks.map((k) => ({ key: 'k:' + k, title: k, rows: list.filter((d) => d.chip === k) }));
171
181
  }
172
- const cur = phaseOf(stage), ci = PHASES.indexOf(cur);
182
+ const P = Array.isArray(o.phases) && o.phases.length ? o.phases : PHASES;
183
+ const cur = o.cur !== undefined ? o.cur : phaseOf(stage), ci = P.indexOf(cur);
173
184
  const out = [];
174
185
  const take = (key, title, rs, more) => { if (rs.length) out.push({ key, title, rows: rs, ...more }); };
175
186
  if (ci < 0) {
176
- for (const p of PHASES) take('p:' + p, p, list.filter((d) => d.phase === p));
187
+ for (const p of P) take('p:' + p, p, list.filter((d) => d.phase === p));
177
188
  } else {
178
189
  take('p:' + cur, cur + ' · now', list.filter((d) => d.phase === cur), { now: true });
179
- for (let i = ci - 1; i >= 0; i--) take('p:' + PHASES[i], PHASES[i], list.filter((d) => d.phase === PHASES[i]), { fold: 2 });
180
- const later = list.filter((d) => PHASES.indexOf(d.phase) > ci);
190
+ for (let i = ci - 1; i >= 0; i--) take('p:' + P[i], P[i], list.filter((d) => d.phase === P[i]), { fold: 2 });
191
+ const later = list.filter((d) => P.indexOf(d.phase) > ci);
181
192
  take('p:later-made', 'Ahead', later.filter((d) => d.st !== 'missing'));
182
193
  take('p:later', 'Later', later.filter((d) => d.st === 'missing'), { later: true });
183
194
  }
184
- take('p:none', 'Added', list.filter((d) => !d.phase));
195
+ // documents written under the fixed set before a workflow change stay reachable (D99)
196
+ take('p:other', 'Other documents', list.filter((d) => !d.phase && d.other), { fold: 2 });
197
+ take('p:none', 'Added', list.filter((d) => !d.phase && !d.other));
185
198
  return out;
186
199
  }
187
200
  export function listDocs(rows) {
@@ -225,6 +225,7 @@ button.hi-pill { cursor: pointer; }
225
225
  .hm-sct { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--cz-ink3); font-weight: 600; white-space: nowrap; }
226
226
  .hm-sct.over { color: var(--cz-risk); }
227
227
  .hm-bars.hm-scbars { margin: 10px 0 8px; }
228
+ .hm-bars.hm-scbars i { position: relative; } .hm-bars.hm-scbars i::after { content: ""; position: absolute; inset: -6px 0; } /* a taller hover target for the stage name */
228
229
  .hm-bars.hm-scbars i.skip { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--cz-ink3) 40%, transparent) 0 4px, transparent 4px 7px); }
229
230
  .hm-scl { border-top: 1px solid var(--cz-hair); padding-top: 8px; margin-top: 2px; }
230
231
  .hm-scwhy { margin: 0; padding: 4px 0 2px 34px; font-size: 12.5px; color: var(--cz-ink3); }
@@ -50,10 +50,10 @@ async function readL(id, M, force) {
50
50
  X.reading.add(id);
51
51
  const r = await X.ctx.pmGet('/api/initiative-layout?initiative=' + encodeURIComponent(id) + (wsOf(M) ? '&ws=' + encodeURIComponent(wsOf(M)) : ''));
52
52
  X.reading.delete(id);
53
- X.L.set(id, r && r.ok ? { ...r, read: true } : { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false });
53
+ X.L.set(id, r && r.ok ? { ...r, read: true } : { auto: true, held: [], by: 'mine', names: [], of: {}, stage: {}, sets: [], read: false });
54
54
  X.ctx.drawList(); redrawView();
55
55
  }
56
- const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'stage', names: [], of: {}, stage: {}, sets: [], read: false };
56
+ const Lof = (id) => X.L.get(id) || { auto: true, held: [], by: 'mine', names: [], of: {}, stage: {}, sets: [], read: false };
57
57
  /* ── the drafted Jira tickets (T1) ── */
58
58
  async function readT(id, M, force) {
59
59
  if (!force && (X.T.has(id) || X.tReading.has(id))) return;
@@ -65,7 +65,7 @@ async function readT(id, M, force) {
65
65
  }
66
66
  const Tof = (id) => X.T.get(id) || null;
67
67
  /** The grouping: the PM's choice; until the PM chooses, Epic once tickets are drafted. */
68
- const byOf = (L, T) => (L.picked ? L.by : T && T.ok && T.drafted ? 'epic' : L.by) || 'stage';
68
+ const byOf = (L, T) => { const b = (L.picked ? L.by : T && T.ok && T.drafted ? 'epic' : L.by) || 'mine'; return MD.BY_LABEL[b] ? b : 'mine'; }; // an old 'stage' reads as Your groups
69
69
  async function press(id, M, body) {
70
70
  const r = await X.ctx.pmPost('/api/initiative-layout', { ws: wsOf(M), initiative: id, ...body });
71
71
  if (r && r.ok) { X.L.set(id, { ...r, read: true }); X.ctx.drawList(); redrawView(); return true; }
@@ -321,12 +321,12 @@ const KIND = { tasks: 'Tasks', docs: 'Documents', stage: 'Stage' };
321
321
  const ICON = { tasks: 'list', docs: 'doc', stage: 'goal' };
322
322
  let BODY = null;
323
323
  function segHtml(v) { return `<div class="cz-seg hi-seg" role="group" aria-label="Show">${Object.entries(KIND).map(([k, l]) => `<button type="button" data-hi-view="${k}" aria-pressed="${k === v}">${l}</button>`).join('')}</div>`; }
324
- function taskRowHtml(t, mine, stages) {
325
- const pill = t.stage ? `<button type="button" class="hi-pill" data-hi-tstage="${esc(t.key)}" aria-label="Stage: ${esc(t.stage)}. Change">${esc(t.stage)}</button>` : `<button type="button" class="hi-pill dash" data-hi-tstage="${esc(t.key)}">Set stage</button>`;
326
- return `<div class="hi-trow${t.done ? ' done' : ''}" data-ov-tkrow="${esc(t.key)}"${mine ? ` draggable="true" data-hi-drag="${esc(t.key)}"` : ''}>`
324
+ function taskRowHtml(t, mine) {
325
+ // a task's only stage is its state (Wawan, 2026-10-25): the checkbox, and the five states under ⋯; Won't do sits struck with the done ones
326
+ return `<div class="hi-trow${t.closed ? ' done' : ''}${t.wontdo ? ' wontdo' : ''}" data-ov-tkrow="${esc(t.key)}"${mine ? ` draggable="true" data-hi-drag="${esc(t.key)}"` : ''}>`
327
327
  + (t.canCheck ? `<button type="button" class="hi-chk${t.done ? ' on' : ''}" data-hi-chk="${esc(t.key)}" aria-pressed="${t.done}" aria-label="${t.done ? 'Reopen' : 'Mark done'}: ${esc(t.title)}">${t.done ? SVG(I.check, 12, 3) : ''}</button>` : `<span class="hi-chk off${t.done ? ' on' : ''}" aria-hidden="true" title="${t.jira ? 'Jira keeps its state' : 'A PRD requirement has no state'}">${t.done ? SVG(I.check, 12, 3) : ''}</span>`)
328
328
  + `<button type="button" class="hi-tt" data-ov-tk="${esc(t.key)}" aria-label="Open ${esc(t.title)}">${esc(t.title)}${t.jira && t.ref ? ` <em>${esc(t.ref)}</em>` : ''}</button>`
329
- + pill + (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
329
+ + (t.av ? `<span class="hi-av" title="${esc(t.owner)}">${esc(t.av)}</span>` : '') + `<span class="hi-due${t.late ? ' late' : ''}">${esc(t.due || (t.req ? 'PRD' : t.state === 'In progress' ? 'running' : ''))}</span>`
330
330
  + `<button type="button" class="hi-ib sm" data-hi-tmore="${esc(t.key)}" aria-haspopup="menu" aria-label="More for ${esc(t.title)}">${SVG(I.more, 14, 3)}</button></div>`;
331
331
  }
332
332
  /* ── the epic groups (T1) and shell A's summary card (XvATasks) ── */
@@ -361,49 +361,49 @@ function epicGroupsHtml(id, M, T) {
361
361
  function summaryHtml(id, M, rows, T, by) {
362
362
  const VW = X.ctx.VW;
363
363
  if (isPhone() || !VW.czSummary) return '';
364
- const open = rows.filter((r) => !r.done && !r.req).length;
364
+ const open = rows.filter((r) => !r.closed && !r.req).length;
365
365
  const meta = [open ? open + ' open' : '', 'grouped by ' + MD.BY_LABEL[by].toLowerCase()].filter(Boolean).join(' · ');
366
366
  const G = T && T.ok ? TKM.ticketGroups(T) : [];
367
367
  const send = G.reduce((a, g) => a + g.send, 0);
368
368
  if (T && T.ok && T.pushing) return VW.czSummary({ line: 'Sending to Jira', tone: 'live', text: 'Claude is creating the tickets with your Atlassian connection. Each task shows its Jira key when it is done.', meta });
369
369
  if (send) return VW.czSummary({ line: plural(send, 'ticket is', 'tickets are') + ' drafted, not in Jira', tone: 'you', text: 'Each PRD story is a task with its Jira ticket drafted. Nothing reaches Jira until you send it.', meta, primary: { label: 'Send to Jira', act: 'tk-sendall' } });
370
370
  const week = Date.now() + 7 * 864e5;
371
- const due = rows.filter((r) => !r.done && !r.req && r.end && Date.parse(r.end) <= week).sort((a, b) => a.end.localeCompare(b.end));
371
+ const due = rows.filter((r) => !r.closed && !r.req && r.end && Date.parse(r.end) <= week).sort((a, b) => a.end.localeCompare(b.end));
372
372
  if (!due.length) return VW.czSummary({ meta });
373
373
  const words = due.slice(0, 2).map((r) => r.title + (r.due ? ' ' + (/^(today|tomorrow|yesterday)$/.test(r.due) ? r.due : 'by ' + r.due) : ''));
374
374
  return VW.czSummary({ line: plural(due.length, 'is', 'are') + ' due this week', tone: due.some((r) => r.late) ? 'warn' : 'you', text: words.join(', and ') + '.', meta,
375
375
  primary: { label: 'Open ' + (due[0].title.length > 36 ? due[0].title.slice(0, 35) + '…' : due[0].title), act: 'tk-openfirst' } });
376
376
  }
377
377
  function tasksView(id, M) {
378
- const L = Lof(id), T = Tof(id), by = byOf(L, T), rows = MD.taskRows(M, L), stages = (M.acts && M.acts.stages) || [];
378
+ const L = Lof(id), T = Tof(id), by = byOf(L, T), rows = MD.taskRows(M, L);
379
379
  if (!T) readT(id, M);
380
380
  const mine = by === 'mine';
381
- const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : by === 'stage' ? M.acts.stage || '' : '';
381
+ const target = mine ? (L.names.includes(X.addTo) ? X.addTo : L.names[0] || '') : '';
382
382
  let groups;
383
383
  if (by === 'epic') {
384
384
  // the PM's own tasks: the PRD stories are tasks of their epics once drafted, and a Jira row of a pushed ticket is that task
385
385
  const keys = new Set(((T && T.ok && T.tickets) || []).map((t) => t.key).filter(Boolean));
386
386
  const own = rows.filter((r) => !(T && T.ok && T.drafted && r.req) && !(r.jira && keys.has(r.ref)));
387
- const k2 = 'ep:' + id + ':mine', open2 = foldOpen(k2, false), n2 = own.filter((r) => !r.done).length;
387
+ const k2 = 'ep:' + id + ':mine', open2 = foldOpen(k2, false), n2 = own.filter((r) => !r.closed).length;
388
388
  groups = epicGroupsHtml(id, M, T)
389
- + `<section class="tk-g hi-tg" aria-label="Your tasks">${headHtml(k2, 'Your tasks', n2 || own.length, open2)}${open2 ? own.map((t) => taskRowHtml(t, false, stages)).join('') || '<p class="hi-empty">No task of yours yet. Add one below.</p>' : ''}</section>`;
389
+ + `<section class="tk-g hi-tg" aria-label="Your tasks">${headHtml(k2, 'Your tasks', n2 || own.length, open2)}${open2 ? own.map((t) => taskRowHtml(t, false)).join('') || '<p class="hi-empty">No task of yours yet. Add one below.</p>' : ''}</section>`;
390
390
  } else {
391
- const G = MD.taskGroups(rows, L, by, stages);
391
+ const G = MD.taskGroups(rows, L, by);
392
392
  groups = rows.length ? G.map((g) => {
393
393
  const shut = X.shut.has('vt:' + g.key);
394
394
  const head = g.title == null ? '' : `<div class="hi-gh"><button type="button" class="hi-ghb" data-hi-vfold="${esc(g.key)}" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 14, 2)}<b>${esc(g.title)}</b><span>${g.open} open</span></button>`
395
395
  + (g.mine ? `<button type="button" class="hi-ib sm" data-hi-gmore="${esc(g.title)}" aria-haspopup="menu" aria-label="More for ${esc(g.title)}">${SVG(I.more, 14, 3)}</button>` : '') + '</div>';
396
- return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine, stages)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
396
+ return `<section class="hi-tg" data-hi-drop="${esc(g.mine ? g.title : g.loose ? '' : '')}"${mine ? ' data-hi-dz' : ''} aria-label="${esc(g.title || 'Tasks')}">${head}${shut ? '' : g.rows.map((t) => taskRowHtml(t, mine)).join('') || '<p class="hi-empty">Drag a task here.</p>'}</section>`;
397
397
  }).join('') : `<p class="hi-empty">${esc((M.tasks && M.tasks.note) || 'No task yet.')} Add one below.</p>`;
398
398
  }
399
399
  return summaryHtml(id, M, rows, T, by) + groups
400
400
  + (mine ? `<button type="button" class="hi-btn sm ghost hi-self" data-hi-newgroup>${SVG(I.plus, 14)}New group</button>` : '')
401
401
  + `<div class="hi-add"><label for="ovTask" class="hi-vh">Add a task</label><input id="ovTask" maxlength="200" autocomplete="off" placeholder="Add a task${target ? ' to ' + esc(target) : ''}" data-hi-target="${esc(target)}"><button type="button" class="hi-ib sm" data-ov-add aria-label="Add the task">${SVG(I.next, 14)}</button></div>`;
402
402
  }
403
- function docRowHtml(d, cur, later) {
403
+ function docRowHtml(d, cur, later, phases) {
404
404
  const draft = d.act && d.act.kind === 'draft' && !d.running && !d.path && d.st !== 'stale';
405
405
  if (later) return `<div class="czs-it hi-drow later" data-ov-doc="${esc(d.key)}"><span class="ut-tki dash" aria-hidden="true">${SVG(I.doc, 15)}</span><span class="w">${esc(d.title)}<span>comes in ${esc(d.phase)}</span></span>${draft ? `<button type="button" class="hi-btn sm ghost" data-ov-draft="${esc(d.key)}">Draft it now</button>` : ''}</div>`;
406
- const [pt] = MD.docPill(d, cur);
406
+ const [pt] = MD.docPill(d, cur, phases);
407
407
  // a document with no file yet is never a dead press: it says what happens to it (data-ov-none), and offers the draft when PMOS can write it
408
408
  const open = d.path && d.st === 'draft' && d.slot ? `data-ov-dread="${esc(d.key)}"` : d.path ? `data-ov-open="${esc(d.path)}" data-ov-name="${esc(d.title)}"` : `data-ov-none="${esc(d.key)}"`;
409
409
  const meta = [d.when, d.by, d.link ? d.link.kind : '', d.look || !d.path ? pt : ''].filter(Boolean).join(' · ') || d.what;
@@ -414,17 +414,17 @@ function docRowHtml(d, cur, later) {
414
414
  /** Documents in shell A (canvas XvADocs): the summary says what needs a look and holds the one primary (draft the first missing document,
415
415
  * else open the first that needs a look); the groups fold below it. Group by, Show and Add a document are under ⋯. */
416
416
  function docsView(id, M) {
417
- const rows = MD.docRows(M), cur = MD.phaseOf(M.acts && M.acts.stage);
417
+ const rows = MD.docRows(M), { phases, cur } = MD.docPhases(M);
418
418
  if (!rows.length) return '<div class="hi-v hi-v2" data-hi-v="docs">' + VW().czSummary({ text: M.docs && M.docs.missing ? 'The core documents could not be read.' : 'This initiative has no core document yet.', primary: { label: 'Add a document', act: 'adddoc' } }) + '</div>';
419
- const G = MD.docGroups(rows, M.acts && M.acts.stage, X.doc);
419
+ const G = MD.docGroups(rows, M.acts && M.acts.stage, { ...X.doc, phases, cur });
420
420
  const look = rows.filter((d) => d.look), miss = rows.filter((d) => !d.path && d.act && d.act.kind === 'draft' && !d.running);
421
- const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
421
+ const said = look.slice(0, 2).map((d) => d.title + ' ' + String(MD.docPill(d, cur, phases)[0] || '').toLowerCase()).concat(miss.filter((d) => !d.look).slice(0, 1).map((d) => 'The ' + d.title + ' is not written yet'));
422
422
  const first = miss[0] || null, open = !first && look.find((d) => d.path);
423
423
  const pri = first ? { label: 'Draft the ' + first.title, act: 'draft:' + first.key } : open ? { label: 'Open ' + open.title, act: 'open:' + open.key } : null;
424
424
  const sum = VW().czSummary({ line: look.length ? look.length + (look.length === 1 ? ' needs a look' : ' need a look') : '', tone: look.length ? 'warn' : '',
425
425
  text: said.length ? said.map((x) => x.replace(/^./, (c) => c.toUpperCase())).join('. ') + '.' : 'Every document is in place for ' + (cur || 'this stage') + '.',
426
426
  meta: rows.length + (rows.length === 1 ? ' document' : ' documents') + ' · filter and sort are under More', extra: M.docs && M.docs.cap ? `<p class="czs-meta" data-ov-dsum>${esc(M.docs.cap)}</p>` : '', primary: pri });
427
- const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later)).join('') })), { key: 'docs' });
427
+ const secs = VW().czSections(G.map((g, i) => ({ id: 'd:' + (g.key || i), title: g.title || 'Documents', count: g.rows.length, open: i === 0, html: g.rows.map((d) => docRowHtml(d, cur, g.later, phases)).join('') })), { key: 'docs' });
428
428
  return '<div class="hi-v hi-v2" data-hi-v="docs">' + sum + (secs || '<p class="hi-empty">No document matches.</p>') + '</div>';
429
429
  }
430
430
  function stageView(id, M, ask) {
@@ -474,10 +474,9 @@ function moreOf(id, view) {
474
474
  function groupMenu(t, id, M) {
475
475
  const L = Lof(id), T = Tof(id), by = byOf(L, T);
476
476
  const same = (n) => n.join('|').toLowerCase() === L.names.join('|').toLowerCase();
477
- const st = (M.acts && M.acts.stages) || [], at = Math.max(0, st.indexOf(M.acts.stage));
478
477
  const G = T && T.ok ? TKM.ticketGroups(T) : [];
479
- menu(t, [{ head: 'Group by' }, ...['epic', 'stage', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k],
480
- sub: k === 'stage' ? st.slice(at, at + 3).join(', ') : k === 'mine' && L.names.length ? L.names.join(', ') : k === 'epic' && G.length ? G.map((g) => g.name).slice(0, 2).join(', ') : '',
478
+ menu(t, [{ head: 'Group by' }, ...['epic', 'mine', 'owner', 'status', 'none'].map((k) => ({ label: MD.BY_LABEL[k],
479
+ sub: k === 'mine' && L.names.length ? L.names.join(', ') : k === 'epic' && G.length ? G.map((g) => g.name).slice(0, 2).join(', ') : '',
481
480
  radio: true, on: by === k, go: () => press(id, M, { kind: 'by', by: k }) })),
482
481
  { hr: true }, { head: 'Saved group sets' },
483
482
  ...(L.sets || []).map((s) => ({ label: s.names.join(' · '), sub: same(s.names) ? 'this one' : s.name !== s.names.join(' · ') ? s.name : '', go: async () => { if (await press(id, M, { kind: 'groups', names: s.names })) press(id, M, { kind: 'by', by: 'mine' }); } })),
@@ -549,8 +548,6 @@ function wire(body, id) {
549
548
  const key = r.item ? 'task:' + (r.item.uid || r.item.key) : '';
550
549
  if (key && /^task:[A-Za-z0-9]/.test(key)) {
551
550
  if (L.by === 'mine' && target) await press(id, M, { kind: 'place', task: key, group: target });
552
- const stg = L.by === 'stage' || !L.by ? (M.acts.stage || '') : M.acts.stage || '';
553
- if (stg) await press(id, M, { kind: 'stage', task: key, stage: stg });
554
551
  }
555
552
  inp.value = '';
556
553
  await after(r, 'Task added.');
@@ -567,7 +564,7 @@ function wire(body, id) {
567
564
  // PRD to Jira (T1 to T3)
568
565
  if (d.czsAct === 'tk-sendall') { sendSheet(id, M); return; }
569
566
  if (d.czsAct === 'tk-openfirst') {
570
- const wk = Date.now() + 7 * 864e5, r = MD.taskRows(M, Lof(id)).filter((x) => !x.done && !x.req && x.end && Date.parse(x.end) <= wk).sort((a, b) => a.end.localeCompare(b.end))[0];
567
+ const wk = Date.now() + 7 * 864e5, r = MD.taskRows(M, Lof(id)).filter((x) => !x.closed && !x.req && x.end && Date.parse(x.end) <= wk).sort((a, b) => a.end.localeCompare(b.end))[0];
571
568
  if (r) openTask(id, M, r.key); return;
572
569
  }
573
570
  if (d.tkGfold) { X.fold.set(d.tkGfold, t.getAttribute('aria-expanded') !== 'true'); redrawView(); return; }
@@ -592,16 +589,11 @@ function wire(body, id) {
592
589
  if ('hiFocusadd' in d) { const n = body.querySelector('#ovTask'); if (n) n.focus(); return; }
593
590
  if ('ovAdd' in d) { addTask(); return; }
594
591
  if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: row.done ? 'To do' : 'Done' }), row.done ? 'Reopened.' : 'Done.'); return; }
595
- if (d.hiTstage) {
596
- const key = d.hiTstage, stages = (M.acts && M.acts.stages) || [];
597
- menu(t, [{ head: 'Stage of this task' }, ...stages.map((s) => ({ label: s, radio: true, on: (Lof(id).stage || {})[key] === s, go: () => press(id, M, { kind: 'stage', task: key, stage: s }) })), { label: 'No stage', go: () => press(id, M, { kind: 'stage', task: key, stage: '' }) }], 'Stage of this task');
598
- return;
599
- }
600
592
  if (d.hiTmore) {
601
593
  const key = d.hiTmore, row = MD.taskRows(M, Lof(id)).find((x) => x.key === key); if (!row) return;
602
594
  const L = Lof(id);
603
595
  const items = [{ label: 'Open', go: () => openTask(id, M, key) }];
604
- if (row.canCheck) { items.push({ head: 'Status' }); for (const s of ['To do', 'In progress', 'In review', 'Done']) items.push({ label: s, radio: true, on: row.state === s, go: async () => after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: s }), 'Status changed.') }); }
596
+ if (row.canCheck) { items.push({ head: 'Status' }); for (const s of MD.TASK_STATES) items.push({ label: s, radio: true, on: row.state === s, go: async () => after(await X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: s }), 'Status changed.') }); }
605
597
  if (L.names.length) { items.push({ head: 'Group' }); for (const g of L.names) items.push({ label: g, radio: true, on: row.group === g, go: () => press(id, M, { kind: 'place', task: key, group: g }) }); items.push({ label: 'Not in a group', go: () => press(id, M, { kind: 'place', task: key, group: '' }) }); }
606
598
  menu(t, items, 'More for ' + row.title);
607
599
  return;
@@ -658,7 +650,7 @@ function wire(body, id) {
658
650
  async function openTask(id, M, key) {
659
651
  const row = (M.tasks.rows || []).find((x) => x.key === key); if (!row) return;
660
652
  const o = bw(M);
661
- if (!row.pmos && row.ref && /^Jira/.test(row.src || '')) { (await import('./premium-vw-jira.js')).openTicket({ ...o, initiative: id, ref: row.ref }); return; }
653
+ // a Jira ticket opens in the one task editor too (canvas XetX1Jira): Jira's fields read-only, the PM's notes editable; its key opens the full ticket
662
654
  const rename = row.pmos && row.uid && X.ctx.renameTask ? X.ctx.renameTask({ uid: row.uid, title: row.title, ws: o.ws, board: o.board }) : null;
663
655
  (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'task', ini: id, key: row.key, title: row.title, ...o, rename });
664
656
  }
@@ -129,7 +129,8 @@ const closedOf = (n, turnN) => [n ? plural(n, 'initiative', 'initiatives') : '',
129
129
  const isMe = (D, who) => { const me = String((D.today && D.today.me) || '').toLowerCase(), w = String(who || '').toLowerCase(); return !w || /^(pm|you)(:|$)/.test(w) || (!!me && (w === me || w.startsWith(me + ' '))); };
130
130
  /** One group per program, placed above the products: with one product picked, only a program that has an initiative or an open task in it, or whose home it is. The grouping is
131
131
  * groupRows (program-model.js), the one Board and Kanban use: a program's initiatives leave their product's group, so each initiative shows
132
- * once, and sit under one sub-heading per product, in the order the products first appear. The program's own open tasks come first.
132
+ * once, and sit under one sub-heading per product, in the program's order (option A, agreed 2026-10-25: groupRows sorts them by p.order, A to
133
+ * Z when the PM never ordered it; a row that is your turn keeps its dot and no longer jumps up). The program's own open tasks come first.
133
134
  * With one product picked, only that product's initiatives and tasks show. D.programs is GET /api/programs' programs. */
134
135
  export function programGroups(D, groups, products, o, now) {
135
136
  const rowsOf = (ws) => { const p = products.find((x) => x.ws === ws); return p ? { name: p.name, rows: (p.model && p.model.initiatives && p.model.initiatives.list && p.model.initiatives.list.rows) || (p.primary ? boardRows(D) : []) } : null; };
@@ -81,7 +81,9 @@ export function nextReason(h) {
81
81
  export function stageCardHtml(h, o = {}) {
82
82
  const R = o.rows || stepRows(h, o);
83
83
  const clock = clockText(h.clock);
84
- const bars = `<div class="hm-bars hm-scbars" aria-hidden="true">${(h.steps || []).map((s) => `<i class="${esc(s.cls)}"></i>`).join('')}</div>`;
84
+ // every bar names its stage on hover (Wawan, 2026-10-25); the list stays hidden from a screen reader, the header says the stage
85
+ const SAY = { done: ' · done', now: ' · now', skip: ' · skipped' };
86
+ const bars = `<div class="hm-bars hm-scbars" aria-hidden="true">${(h.steps || []).map((s) => `<i class="${esc(s.cls)}" title="${esc((s.label || '') + (SAY[s.cls] || ''))}"></i>`).join('')}</div>`;
85
87
  const fold = R.done.length ? { n: R.done.length, names: o.doneOpen ? '' : R.done.map((x) => x.label).join(', '), open: !!o.doneOpen, attr: 'data-hm-done' } : null;
86
88
  const steps = (o.doneOpen ? R.done : []).concat(R.shown);
87
89
  const list = stepsHtml(steps, { label: h.checkTitle, cls: 'hm-scl', fold, more: R.more > 0 ? { n: R.more, attr: 'data-hm-more' } : null, tail: o.tail || '' });