create-pmos 0.536.0 → 0.538.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 (103) hide show
  1. package/package.json +81 -33
  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/board-columns-test.js +11 -10
  8. package/workspace/board-programs-test.js +27 -24
  9. package/workspace/board-publish-ui-test.js +19 -15
  10. package/workspace/board-shared-ui-test.js +16 -13
  11. package/workspace/board-workflows-test.js +26 -32
  12. package/workspace/briefing-premium-board-test.js +70 -50
  13. package/workspace/briefing-premium-insights-test.js +24 -31
  14. package/workspace/briefing-premium-metrics-test.js +2 -2
  15. package/workspace/calm-timeline-test.js +1 -1
  16. package/workspace/changelog.json +80 -0
  17. package/workspace/ev-everywhere-test.js +4 -5
  18. package/workspace/fixtures/board-premium-facts.js +1 -1
  19. package/workspace/fixtures/board-workflows-facts.js +7 -1
  20. package/workspace/fixtures/initiative-premium-facts.js +1 -1
  21. package/workspace/fixtures/insights-premium-facts.js +6 -6
  22. package/workspace/fixtures/program-ascent.js +1 -1
  23. package/workspace/guide/adler.md +2 -2
  24. package/workspace/guide/agent-capabilities.md +38 -6
  25. package/workspace/guide/board.md +20 -2
  26. package/workspace/guide/claude-proposes.md +1 -1
  27. package/workspace/guide/home.md +2 -2
  28. package/workspace/guide/index.md +3 -3
  29. package/workspace/guide/intelligence-okr-goals.md +18 -7
  30. package/workspace/guide/lifecycle.md +2 -2
  31. package/workspace/guide/programs.md +2 -2
  32. package/workspace/guide/reports-needs-you.md +5 -5
  33. package/workspace/guide/settings.md +14 -11
  34. package/workspace/guide/workflows.md +3 -3
  35. package/workspace/guide/your-impact.md +1 -1
  36. package/workspace/lib/agent-team.js +262 -0
  37. package/workspace/lib/ai-cli.js +36 -4
  38. package/workspace/lib/bg-queue.js +9 -4
  39. package/workspace/lib/board-premium.js +6 -3
  40. package/workspace/lib/goal-source.js +77 -0
  41. package/workspace/lib/grill-runs.js +6 -3
  42. package/workspace/lib/headless.js +36 -4
  43. package/workspace/lib/idle-lab-engine.js +7 -6
  44. package/workspace/lib/initiative-premium.js +6 -3
  45. package/workspace/lib/insights-premium.js +1 -1
  46. package/workspace/lib/job-graph.js +191 -0
  47. package/workspace/lib/okr-goals.js +3 -0
  48. package/workspace/lib/orchestrator-keeprate.js +108 -7
  49. package/workspace/lib/pmos-verbs.js +3 -0
  50. package/workspace/lib/proposal-runs.js +8 -5
  51. package/workspace/lib/proposals.js +32 -2
  52. package/workspace/lib/report-slots.js +14 -10
  53. package/workspace/lib/routes-boards.js +2 -2
  54. package/workspace/lib/routes-insights-premium.js +11 -4
  55. package/workspace/lib/routes-premium-dashboards.js +20 -6
  56. package/workspace/lib/routes-proposals.js +10 -5
  57. package/workspace/lib/routes-your-move.js +6 -7
  58. package/workspace/lib/status-proof.js +45 -0
  59. package/workspace/lib/status-signal.js +4 -2
  60. package/workspace/lib/task-links.js +3 -1
  61. package/workspace/lib/team-cli.js +164 -0
  62. package/workspace/lib/team-runs.js +244 -0
  63. package/workspace/lib/verify-runs.js +112 -0
  64. package/workspace/okr-goals-ui-test.js +10 -13
  65. package/workspace/package-lock.json +2 -2
  66. package/workspace/package.json +1 -1
  67. package/workspace/premium-vw-backlog-test.js +2 -2
  68. package/workspace/premium-vw-jira-test.js +2 -2
  69. package/workspace/public/pm/bd-acts.js +30 -45
  70. package/workspace/public/pm/bd-ini-panel.js +38 -27
  71. package/workspace/public/pm/bd-publish.js +1 -1
  72. package/workspace/public/pm/bd-span.js +2 -1
  73. package/workspace/public/pm/bd-views.js +7 -5
  74. package/workspace/public/pm/bd-wf.js +5 -28
  75. package/workspace/public/pm/c3-ini-ui.js +9 -7
  76. package/workspace/public/pm/cozy-board.css +75 -31
  77. package/workspace/public/pm/cozy-insights.css +18 -0
  78. package/workspace/public/pm/cozy-nav.js +2 -2
  79. package/workspace/public/pm/cozy-search.js +29 -7
  80. package/workspace/public/pm/cozy-settings.js +39 -20
  81. package/workspace/public/pm/home-data.js +3 -1
  82. package/workspace/public/pm/home-ini-model.js +15 -1
  83. package/workspace/public/pm/home-ini.js +9 -3
  84. package/workspace/public/pm/ini-tail.js +61 -0
  85. package/workspace/public/pm/ini-view-model.js +10 -7
  86. package/workspace/public/pm/premium-board.js +119 -119
  87. package/workspace/public/pm/premium-insights.js +95 -112
  88. package/workspace/public/pm/premium-report-intel.js +3 -2
  89. package/workspace/public/pm/readonly.js +4 -3
  90. package/workspace/public/pm/stage-chip.js +2 -1
  91. package/workspace/public/pm/status-proof.js +43 -0
  92. package/workspace/public/premium-board.html +14 -35
  93. package/workspace/public/premium-intelligence.html +7 -9
  94. package/workspace/server.js +35 -1
  95. package/workspace/sort-order-test.js +10 -8
  96. package/workspace/test-files.json +4 -2
  97. package/workspace/test-lists/agent-team.json +9 -0
  98. package/workspace/test-lists/job-graph.json +11 -0
  99. package/workspace/test-lists/status-proof.json +5 -0
  100. package/workspace/workflows-setup-test.js +3 -2
  101. package/workspace/public/premium-chat.html +0 -14
  102. package/workspace/public/premium-initiative.html +0 -15
  103. package/workspace/public/premium-work.html +0 -14
@@ -162,8 +162,8 @@ function openGone(from, seg) {
162
162
  }
163
163
 
164
164
  /* ── Find and Filter (BdFilter) ────────────────────────────────────────────────────────────────────────────────── */
165
- let findQ = '', findAt = 0;
166
- const mark = (t, q) => { if (!q) return esc(t); const i = t.toLowerCase().indexOf(q.toLowerCase()); return i < 0 ? esc(t) : esc(t.slice(0, i)) + '<mark>' + esc(t.slice(i, i + q.length)) + '</mark>' + esc(t.slice(i + q.length)); };
165
+ /* Find (UI grill U2: one search). The Board's own find box is gone: Find and ⌘K open Search (pm/cozy-search.js) with this scope, so the Board's
166
+ * initiatives and its Jira work-items come first and the rest of Search after them. */
167
167
  function findHits(q) {
168
168
  const s = q.trim().toLowerCase(); if (!s) return { ini: [], tk: [] };
169
169
  const rows = M().initiatives.list.rows;
@@ -171,42 +171,42 @@ function findHits(q) {
171
171
  const tk = rows.flatMap((r) => ((r.track && r.track.tickets) || []).map((k) => ({ k, r }))).filter(({ k }) => k.key.toLowerCase().includes(s) || String(k.title).toLowerCase().includes(s)).slice(0, 6);
172
172
  return { ini, tk };
173
173
  }
174
- function findList() {
175
- const h = findHits(findQ), all = [...h.ini.map((r) => ({ r })), ...h.tk];
176
- findAt = Math.max(0, Math.min(findAt, all.length - 1));
177
- let i = -1;
178
- const ini = h.ini.map((r) => { i++; const s = V.statusLine(r); return `<button type="button" class="bd-mi${i === findAt ? ' hl' : ''}" data-findini="${esc(r.key)}"><i class="cz-dot ${s.tone}"></i><span class="tx"><span>${mark(r.title, findQ)}</span><span class="bd-amut">${esc([stageName(r) || r.stage, s.text].filter(Boolean).join(' · '))}</span></span>${i === findAt ? '<span class="k">Enter</span>' : ''}</button>`; }).join('');
179
- const tk = h.tk.map(({ k, r }) => { i++; return `<button type="button" class="bd-mi${i === findAt ? ' hl' : ''}" data-findtk="${esc(k.key)}" data-ini="${esc(r.key)}"><span class="bd-pill">${mark(k.key, findQ)}</span><span class="tx"><span>${mark(k.title, findQ)}</span><span class="bd-amut">${esc([k.blocked ? 'Blocked' : k.status, k.assignee].filter(Boolean).join(' · '))}</span></span>${i === findAt ? '<span class="k">Enter</span>' : ''}</button>`; }).join('');
180
- return (ini ? '<p class="bd-mlbl">Initiatives</p>' + ini : '') + (tk ? '<p class="bd-mlbl">Work-items in Jira</p>' + tk : '') + (findQ.trim() && !ini && !tk ? `<p class="bd-amut bd-mnote">Nothing on this Board matches “${esc(findQ.trim())}”.</p>` : '');
174
+ /** Search's scope on the Board: { name, hits(q) } (pm/cozy-search.js openSearch). An initiative opens on the Board, a work-item its ticket panel. */
175
+ export function findScope() {
176
+ return { name: 'this Board', hits: (q) => {
177
+ if (!M()) return [];
178
+ const h = findHits(q);
179
+ return [
180
+ { label: 'On this Board · Initiatives', rows: h.ini.map((r) => { const s = V.statusLine(r); return { id: r.id || r.key, icon: 'flag', title: r.title, sub: [stageName(r) || r.stage, s.text].filter(Boolean).join(' · '), tag: 'Board', open: () => { const x = A.rowOf(r.key); if (x) A.openIni(x); } }; }) },
181
+ { label: 'On this Board · Work-items in Jira', rows: h.tk.map(({ k, r }) => ({ icon: 'jira', title: k.key + ' · ' + k.title, sub: [k.blocked ? 'Blocked' : k.status, k.assignee, r.title].filter(Boolean).join(' · '), tag: 'Jira', open: () => A.openTicket(r.key, k.key) })) },
182
+ ];
183
+ } };
181
184
  }
182
- function openFind(from) {
183
- findQ = ''; findAt = 0;
184
- Pop.open(`<div class="bd-finp">${SV(I.find)}<input id="bdQ" type="search" maxlength="80" placeholder="Find an initiative or work-item" aria-label="Find an initiative or work-item" autocomplete="off"><span class="bd-kbd">Esc</span></div><div id="bdQr" class="bd-fres">${findList()}</div><p class="bd-amut bd-mnote">Find stays in the Board. Search in the menu looks everywhere.</p>`, from, { label: 'Find', width: 460, cls: 'bd-find', focus: '#bdQ' });
185
- }
186
- function pickFind() {
187
- const b = $$('#bdQr .bd-mi')[findAt]; if (b) b.click();
188
- }
189
- /** The Filter's groups: owner, workflow and category (WfAElse: Kind became Workflow), sprint (from the Jira reading, and the backlog; on the
190
- * timeline only on the Sprint span, TsSprintFilter).
191
- * The workflow is one choice, the same one the chip row picks (pm/bd-wf.js); it shows only with more than one workflow on the board. */
185
+ function openFind() { import('./cozy-search.js').then((S) => S.openSearch({ scope: findScope() })); }
186
+ /** The Filter's groups: owner and category, sprint (from the Jira reading, and the backlog; on the timeline only on the Sprint span,
187
+ * TsSprintFilter). No workflow group: batch 28 item 3 (canvas BhA) took workflow picking off the Board. */
192
188
  function filterHtml() {
193
189
  const rows = M().initiatives.list.rows, F = A.F;
194
190
  const owners = [...new Set(rows.map((r) => r.owner || 'No owner'))].sort((a, b) => (a === 'No owner') - (b === 'No owner') || a.localeCompare(b));
195
- const W = A.wf ? A.wf() : { list: [], cur: null };
196
191
  const cats = WF.CATS.map(([k]) => k).filter((k) => rows.some((r) => !r.ended && WF.catOfRow(r) === k));
197
192
  const sprints = (M().jira && M().jira.sprints) || [];
198
193
  const chip = (k, v, label) => `<button type="button" class="bd-chip${F[k].has(v) ? ' on' : ''}" data-flt="${k}" data-v="${esc(v)}" aria-pressed="${F[k].has(v)}">${label || esc(v)}</button>`;
199
- // the grouping (PgBoard, PgBoardProduct): programs first by default, so the toolbar shows nothing; By product shows its chip there
194
+ // the grouping (PgBoard, PgBoardProduct): programs first by default; a desktop has its own Group button, a phone has it here
200
195
  const G = A.grouping ? A.grouping() : null;
201
196
  const grp = G && G.on ? `<p class="bd-mlbl">Group</p><div class="bd-fg" role="radiogroup" aria-label="Group">${[['program', 'Programs first'], ['product', 'By product']].map(([k, n]) => `<button type="button" class="bd-chip${(k === 'product') === G.byProduct ? ' on' : ''}" role="radio" aria-checked="${(k === 'product') === G.byProduct}" data-fgrp="${k}">${n}</button>`).join('')}</div>` : '';
202
- return grp + `<p class="bd-mlbl">Owner</p><div class="bd-fg">${owners.map((o) => chip('owners', o, (o === 'No owner' ? '' : V.avatar(o, 'xs')) + esc(o))).join('')}</div>`
203
- + (W.list.length > 1 ? `<p class="bd-mlbl">Workflow</p><div class="bd-fg" role="radiogroup" aria-label="Workflow">${W.list.map((w) => { const on = WF.narrowed(W.list) && W.cur.id === w.id; return `<button type="button" class="bd-chip${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-fwf="${esc(w.id)}">${WF.wfIcon(w, 16)}${esc(w.name)}</button>`; }).join('')}</div>` : '')
197
+ // a phone's tune sheet (batch 28 item 3, canvas BhA): Group, Sort, the filters, then the Jira read. A desktop has Group and Sort as buttons
198
+ const T = A.tune ? A.tune() : null;
199
+ const so = A.sprintOnly ? A.sprintOnly() : null;
200
+ const spChips = (so ? `<button type="button" class="bd-chip${so.on ? ' on' : ''}" data-fsonly aria-pressed="${so.on}">${esc(so.name)} only</button>` : '')
201
+ + (sprints.length && (!A.sprintFilter || A.sprintFilter()) ? sprints.map((s) => chip('sprints', s.name, esc(s.name + (s.now ? ' · now' : '')))).join('') + chip('sprints', 'Backlog') : '');
202
+ return (T ? grp + T.top : '') + `<p class="bd-mlbl">Owner</p><div class="bd-fg">${owners.map((o) => chip('owners', o, (o === 'No owner' ? '' : V.avatar(o, 'xs')) + esc(o))).join('')}</div>`
204
203
  + (cats.length ? `<p class="bd-mlbl">Category</p><div class="bd-fg">${cats.map((k) => chip('cats', k, esc(WF.catLabel(k)))).join('')}</div>` : '')
205
204
  + (A.timeline && A.timeline() ? Pins.filterGroup() : '') // which milestones the timeline draws (batch 13 item 4, XcalmA5Milestones)
206
- + (sprints.length && (!A.sprintFilter || A.sprintFilter()) ? `<p class="bd-mlbl">Sprint</p><div class="bd-fg">${sprints.map((s) => chip('sprints', s.name, esc(s.name + (s.now ? ' · now' : '')))).join('')}${chip('sprints', 'Backlog')}</div>` : '')
205
+ + (spChips ? `<p class="bd-mlbl">Sprint</p><div class="bd-fg">${spChips}</div>` : '')
206
+ + (T ? T.bottom : '')
207
207
  + `<div class="bd-arow bd-ffoot"><button type="button" class="bd-btn sm ghost" data-fclear>Clear</button><span class="bd-amut bd-push">Applies as you pick</span></div>`;
208
208
  }
209
- function openFilter(from) { Pop.open(filterHtml(), from, { label: 'Filter', width: 340, align: 'right', cls: 'bd-filter' }); }
209
+ function openFilter(from) { const T = A.tune ? A.tune() : null; Pop.open(filterHtml(), from, { label: T ? 'Group, sort and filter' : 'Filter', width: 340, align: 'right', cls: 'bd-filter' + (T ? ' bd-tune' : '') }); }
210
210
 
211
211
  /* ── Sprints, releases and the backlog (BdSprint) ──────────────────────────────────────────────────────────────── */
212
212
  function sprintHtml() {
@@ -320,14 +320,6 @@ function openAddDoc(from) {
320
320
  const f = $('#czViewer form[data-form="adddoc"]'); if (f) f.kind.onchange = () => { f.url.disabled = f.kind.value === 'In PMOS'; };
321
321
  }
322
322
 
323
- /* ── Notifications (the Board's Metrics moved to Intelligence › Delivery trends, batch 22 item 4) ── */
324
- function openBell(from) {
325
- const rows = (M().rows || []).filter((r) => r.track && r.track.you), na = (M().chips || {}).asks;
326
- const list = rows.map((r) => `<button type="button" class="bd-mi" data-act="ini" data-id="${esc(r.key)}"><i class="cz-dot you m-info"></i><span class="tx"><span>${esc(r.title)}</span><span class="bd-amut">${esc(r.track.you)}</span></span></button>`).join('');
327
- const asks = na ? `<button type="button" class="bd-mi" data-act="asks"><i class="cz-dot you"></i><span class="tx"><span>${na} new ${na === 1 ? 'ask' : 'asks'}</span><span class="bd-amut">Waiting for triage</span></span></button>` : '';
328
- Pop.open(`<p class="bd-mlbl">On this Board</p>${list || asks ? list + asks : '<p class="bd-amut bd-mnote">Nothing on this board waits on you, and no new ask waits for triage.</p>'}`, from, { label: 'Notifications', width: 340, align: 'right', cls: 'bd-bell' });
329
- }
330
-
331
323
  /** The Next cell's arrow (pm/bd-next.js): Move to the next stage, as the ⋯ menu's Move to does, with its Undo. */
332
324
  export function moveNext(r, btn) { const a = r.acts || {}, cur = (a.stages || []).indexOf(a.stage); if (cur >= 0 && a.stages[cur + 1]) runRow(r, 'mv:' + (cur + 1), btn); }
333
325
  /* ── a hold on the timeline (feedback batch 9 item 8, XtiA2Hold): the ⏸ press ─────────────────────────────────────────────── */
@@ -371,28 +363,21 @@ async function setBack(r, input) {
371
363
  await done(res, 'On hold · ' + r.title + ' · back ' + md(day(v)), async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? r.title + ' is back as it was.' : errOf(u)); await A.load(); });
372
364
  }
373
365
 
374
- export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
366
+ export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), trend: openTrend, release: openRelease, doc: openDocPanel };
375
367
  export const closeDoc = () => { docOpen = null; };
376
368
 
377
369
  /* ── the presses ─────────────────────────────────────────────────────────────────────────────────────────────── */
378
370
  document.addEventListener('change', (e) => { const f = e.target.closest && e.target.closest('[data-holdback]'); if (!f || !A || !M()) return; const r = A.rowOf(f.dataset.holdback); if (r) setBack(r, f); });
379
- document.addEventListener('input', (e) => { if (e.target.id === 'bdQ') { findQ = e.target.value; findAt = 0; const r = $('#bdQr'); if (r) r.innerHTML = findList(); } });
380
- document.addEventListener('keydown', (e) => {
381
- if (e.target.id !== 'bdQ') return;
382
- const n = $$('#bdQr .bd-mi').length;
383
- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); findAt = n ? (findAt + (e.key === 'ArrowDown' ? 1 : n - 1)) % n : 0; $('#bdQr').innerHTML = findList(); }
384
- else if (e.key === 'Enter') { e.preventDefault(); pickFind(); }
385
- });
386
371
  document.addEventListener('click', async (e) => {
387
372
  if (!A || !M()) return;
388
373
  const t = e.target;
389
- const fi = t.closest('[data-findini]'); if (fi) { const r = A.rowOf(fi.dataset.findini); Pop.close(false); if (r) A.openIni(r); return; }
390
- const ft = t.closest('[data-findtk]'); if (ft) { Pop.close(false); A.openTicket(ft.dataset.ini, ft.dataset.findtk); return; }
391
374
  const fl = t.closest('[data-flt]'); if (fl && Pop.isOpen() && Pop.el().contains(fl)) { const S = A.F[fl.dataset.flt], v = fl.dataset.v; if (S.has(v)) S.delete(v); else S.add(v); Pop.redraw(filterHtml()); A.redraw(); return; }
392
375
  const fg = t.closest('[data-fgrp]'); if (fg && Pop.isOpen() && Pop.el().contains(fg)) { A.setGrouping(fg.dataset.fgrp === 'product'); Pop.redraw(filterHtml()); return; }
393
- const fw = t.closest('[data-fwf]'); if (fw && Pop.isOpen() && Pop.el().contains(fw)) { WF.setPick(fw.getAttribute('aria-checked') === 'true' ? '' : fw.dataset.fwf); Pop.redraw(filterHtml()); A.redraw(); return; }
376
+ if (t.closest('[data-fsonly]') && Pop.isOpen() && Pop.el().contains(t)) { A.toggleSprintOnly(); Pop.redraw(filterHtml()); A.redraw(); return; }
377
+ const sk = t.closest('[data-so-pick]'); if (sk && Pop.isOpen() && Pop.el().contains(sk)) { await A.sortPick(sk.dataset.soPick); if (Pop.isOpen()) Pop.redraw(filterHtml()); const b = Pop.isOpen() && Pop.el().querySelector(`[data-so-pick="${sk.dataset.soPick}"]`); if (b) b.focus(); return; }
378
+ if (t.closest('[data-jread]') && Pop.isOpen() && Pop.el().contains(t)) { Pop.close(false); A.refreshJira(); return; }
394
379
  const mm = t.closest('[data-msmode]'); if (mm && Pop.isOpen() && Pop.el().contains(mm)) { Pins.pickMode(mm); Pop.redraw(filterHtml()); A.redraw(); const b = Pop.el().querySelector(`[data-msmode="${mm.dataset.msmode}"]`); if (b) b.focus(); return; }
395
- if (t.closest('[data-fclear]')) { A.F.owners.clear(); A.F.cats.clear(); A.F.sprints.clear(); WF.setPick(''); Pins.pickMode({ dataset: { msmode: 'pinned' } }); Pop.redraw(filterHtml()); A.redraw(); return; }
380
+ if (t.closest('[data-fclear]')) { A.F.owners.clear(); A.F.cats.clear(); A.F.sprints.clear(); Pins.pickMode({ dataset: { msmode: 'pinned' } }); Pop.redraw(filterHtml()); A.redraw(); return; }
396
381
  const sp = t.closest('[data-sprint]'); if (sp) { const S = A.F.sprints, v = sp.dataset.sprint; if (S.has(v)) S.delete(v); else { S.clear(); S.add(v); } Pop.close(false); A.say(S.has(v) ? 'Showing the initiatives with work in ' + v + '.' : 'Showing every sprint.'); A.redraw(); return; }
397
382
  const rl = t.closest('[data-rel]'); if (rl) { Pop.close(false); openRelease(+rl.dataset.rel, $('#chSprint')); return; }
398
383
  if (t.closest('[data-backlog]')) { Pop.close(false); openRelease(-1, $('#chSprint'), 'backlog'); return; }
@@ -21,12 +21,13 @@
21
21
  * back (pm/dash-view.js, PbH1Header): the PM's last choice per initiative wins; a Board row is a press to act, so Work opens first until then.
22
22
  * The rest sits on the thing it changes: the stage chip's picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js);
23
23
  * Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
24
- import * as IM from './impact.js'; // Your impact (batch 16 item 7): who made a delivered milestone happen
24
+ import * as TL from './ini-tail.js'; // the parts under Linked, Home's page draws them too (UI grill U1): drafted tickets, the PRD drift, Your impact
25
25
  import * as VW from './cozy-viewer.js';
26
26
  import * as SV from './small-vw.js'; // the one stakeholder form, Home's too (batch 18 item 2-C)
27
27
  import { esc } from './premium-shell.js';
28
- import { lr, copyText } from './cozy-xv.js';
28
+ import { copyText } from './cozy-xv.js';
29
29
  import { iniView } from './ini-view-model.js';
30
+ import { gateOf } from './premium-initiative-head.js'; // the gate chips (PRD, draft, reviewed), as Home's page reads them (UI grill U1)
30
31
  import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11 item 8): Live or the draft the PM shows, with the plan line
31
32
  import { viewHtml, wireView } from './ini-view.js';
32
33
  import * as TV from './tk-view.js';
@@ -44,30 +45,37 @@ let adding = null; // the key of the initiative whose inline Add a task is open
44
45
  let addTo = ''; // the stage a task added there finishes (the Board's Next cell: "Add what finishes <stage>")
45
46
  let addDates = null; // the start and due a task added there takes (a gap's + on the timeline, batch 11 item 13)
46
47
  const TI = (r) => (r && r.trail) || null;
47
- const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
48
+ const jiraAt = () => TL.jiraAgo(((O.M() && O.M().jira) || {}).readAt);
48
49
 
49
50
  /* ── the initiative: the one view ── */
50
51
  /** The view's model for a row: the same function Home's page calls, with what only the Board's model holds (its eight steps, its day). */
51
52
  export function viewOf(r) {
52
53
  const M = O.M() || {}, p = O.programOf ? O.programOf(r) : null, u = O.usual ? O.usual(r.track || {}) : null;
53
- return iniView(rowFor(r), { steps: M.steps || [], today: M.today, usual: u, grill: r.id ? O.grill(r.id) : null, program: p ? { id: p.id, title: p.title } : null, jiraAt: jiraAt(), jiraReadAt: ((M.jira || {}).readAt) || '' });
54
+ const pg = (r.id && PAGE.get(r.id)) || {};
55
+ return iniView(rowFor(r), { steps: M.steps || [], today: M.today, usual: u, grill: r.id ? O.grill(r.id) : null, program: p ? { id: p.id, title: p.title } : null, jiraAt: jiraAt(), jiraReadAt: ((M.jira || {}).readAt) || '',
56
+ gate: pg.gate || null, people: pg.people || [] });
54
57
  }
55
- function draftedHtml(d, g) {
56
- return d.slice(0, 8).map((x) => lr({ mk: x.waiting ? 'you' : '', title: (x.id ? `<em>${esc(x.id)}</em> ` : '') + esc(x.summary || ''), sub: 'not in Jira' })).join('')
57
- + (d.length > 8 ? lr({ title: esc(d.length - 8 + ' more drafted') }) : '')
58
- + `<p class="xv-q">They go to Jira only through your Commit${g.open === false && g.why ? '. The Commit is closed: ' + esc(g.why) : ''}.</p>`;
58
+ /* ── what Home's page reads beside the board row (UI grill U1: one initiative view): the gate chips and the core documents from the
59
+ * initiative's own read (GET /api/initiative-premium, Home's loadIni), the stakeholders from GET /api/home-desk. Read when the view opens. ── */
60
+ const PAGE = new Map(); // initiative id → { gate, docs, people } | null while reading
61
+ async function readPage(r, force) {
62
+ if (!r || !r.id || (!force && PAGE.has(r.id))) return;
63
+ if (!PAGE.has(r.id)) PAGE.set(r.id, null);
64
+ const w = where(r), q = (k, v) => (v ? '&' + k + '=' + encodeURIComponent(v) : '');
65
+ const [x, d] = await Promise.all([pmGet('/api/initiative-premium?id=' + encodeURIComponent(r.id) + q('ws', w.ws) + q('board', w.board)).catch(() => null),
66
+ pmGet('/api/home-desk' + (w.ws ? '?ws=' + encodeURIComponent(w.ws) : '')).catch(() => null)]);
67
+ const m = x && x.ok && x.model;
68
+ const was = JSON.stringify(PAGE.get(r.id) || { gate: null, docs: [], people: [] });
69
+ const now = { gate: m && !ownWf(r) ? gateOf(m.gateSteps || m.checks) : null, docs: m ? MD.docRows(m) : [], people: (d && d.ok && d.stakeholders && d.stakeholders[r.id]) || [] };
70
+ PAGE.set(r.id, now);
71
+ if (JSON.stringify(now) !== was) refresh(); // only when the read changed what shows, and never under the PM's hand (refresh skips a focused body)
59
72
  }
60
- const driftQ = (keys) => 'What changed in the PRD after ' + keys.join(', ') + ' ' + (keys.length === 1 ? 'was' : 'were') + ' pushed?';
61
- const driftHtml = (keys) => `<p>${esc(keys.join(', '))} ${keys.length === 1 ? 'was' : 'were'} pushed from an older PRD. Review ${keys.length === 1 ? 'it' : 'them'} before the next push.</p>`
62
- + `<div><button type="button" class="xv-mini" data-xb="drift" data-q="${esc(driftQ(keys))}">Discuss the change in chat</button></div>`;
63
- /** What only the Board reads under the view: tickets drafted in PMOS and pushed tickets that differ from the PRD. */
64
- function boardSections(r) {
65
- const it = TI(r), S = [];
66
- const d = ((it && it.drafted) || []).filter((x) => !x.key);
67
- if (d.length) S.push({ id: 'drafted', title: 'Drafted in PMOS', count: d.length, render: () => draftedHtml(d, (it && it.gate) || {}) });
68
- const dr = (it && it.drift) || [];
69
- if (dr.length) S.push({ id: 'drift', title: 'Jira differs from the PRD', count: dr.length, render: () => driftHtml(dr) });
70
- return S;
73
+ /** Documents, as a drill-in of the view (Home's page opens its Documents view): each core document with its state; a press opens it. */
74
+ function openDocs(r) {
75
+ const L = ((PAGE.get(r.id) || {}).docs) || [];
76
+ const rows = L.map((d) => `<button type="button" class="czs-it"${d.path ? ` data-doc="${esc(d.path)}"` : ' disabled'} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="w">${esc(d.title)}<span>${esc([d.when, d.by, MD.docPill(d)[0]].filter(Boolean).join(' · '))}</span></span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`).join('');
77
+ VW.drill();
78
+ VW.open({ kind: 'Documents', title: r.title, icon: 'doc', back: true, id: 'docs:' + vidOf(r), html: `<div class="hi-v">${rows || '<p class="hi-small">No document is on record yet.</p>'}</div>` });
71
79
  }
72
80
  /* ── ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as Home's initiative page ── */
73
81
  const LAY = new Map(); // the initiative's layout record (GET /api/initiative-layout): its own Moves on by itself, read when the panel opens
@@ -178,8 +186,11 @@ function iniBody(r) {
178
186
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
179
187
  const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
180
188
  // what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
181
- return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold, tail: VW.czSections(boardSections(r), { key: 'board' }),
182
- wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira }) + madeHtml(r);
189
+ // the same parts and presses as Home's page (UI grill U1): the next stage is a press, Core documents a fold, the tail under Linked
190
+ const v = viewOf(r), docs = ((r.id && PAGE.get(r.id)) || {}).docs || [];
191
+ return viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
192
+ next: !!(r.id && v.stage.next && O.moreAct && !self), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
193
+ wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
183
194
  }
184
195
  /** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
185
196
  function wire(body, key) {
@@ -219,6 +230,9 @@ function wire(body, key) {
219
230
  stagePick: (b) => { const r = O.rowOf(key); if (r) stageChip(b, r); },
220
231
  planDates: () => { const r = O.rowOf(key); if (r) location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)); },
221
232
  jira: () => O.refreshJira(),
233
+ // the next stage on the stage card (Home's page has it too): the Board's own move forward, Undo in the toast (bd-acts.js moreAct)
234
+ next: (b) => { const r = O.rowOf(key), n = r && viewOf(r).stage.next; if (r && n && O.moreAct) O.moreAct(r, 'fwd:' + n.name, b); },
235
+ docs: () => { const r = O.rowOf(key); if (r) openDocs(r); },
222
236
  // Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
223
237
  sm: (act, b) => { const r = O.rowOf(key); if (r && O.smPress) O.smPress(r, act, b); },
224
238
  openIni: (id) => { if (O.openIniId) O.openIniId(id); },
@@ -241,6 +255,7 @@ export function openIni(r, from, o = {}) {
241
255
  adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
242
256
  // a row with no record id has no chat of its own: its question goes to the board's chat
243
257
  readLay(r); // Moves on by itself shows once the layout record is read
258
+ readPage(r, true); // the gate chips, Core documents and the stakeholders, as Home's page shows them
244
259
  { const h = dashFor(r); if (h) h.read(o.via || 'act'); } // a Board row is a press to act (PbH1Header); a link to read passes via 'read'
245
260
  // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
246
261
  VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r),
@@ -268,7 +283,7 @@ export function openTicket(r, k, from) {
268
283
  readAt: (M.jira && M.jira.readAt) || '', back, blockerTitle, askHref: (q) => O.askHref(r, q),
269
284
  refresh: M.jira ? () => O.refreshJira() : null,
270
285
  openIni: () => openIni(O.rowOf(r.key) || r),
271
- extra: () => (((it && it.drift) || []).includes(k.key) ? [{ id: 'tdrift', title: 'The PRD changed after the push', count: 1, open: true, render: () => driftHtml([k.key]) }] : []),
286
+ extra: () => (((it && it.drift) || []).includes(k.key) ? [{ id: 'tdrift', title: 'The PRD changed after the push', count: 1, open: true, render: () => TL.driftHtml([k.key]) }] : []),
272
287
  onHide: () => { if (cur && cur.tk === k.key) { cur = null; O.onHide(); } } });
273
288
  }
274
289
 
@@ -284,11 +299,7 @@ export function refresh(force) {
284
299
  }
285
300
  export function close() { if (cur) { cur = null; VW.close(); } }
286
301
  export const shown = () => (cur ? cur.key : null);
287
- /** Your impact, Phase 3 (batch 16 item 7, GmA2Board): under a milestone delivered in the last 30 days, the people who made it happen, from
288
- * the row's own tickets, unranked, each with its ticket to open. Private: no thank-you press, no send, and the ◆ on the timeline stays plain. */
289
- const madeHtml = (r) => IM.madeHtml(IM.madeOf(r, (O.M() && O.M().today) || new Date().toISOString().slice(0, 10)));
290
302
  export function mount(o) {
291
303
  O = o; ensurePopCss();
292
- IM.readWeek().then(() => refresh()).catch(() => {});
293
- window.addEventListener('pmos:impact', () => { setTimeout(() => IM.readWeek().then(() => refresh()).catch(() => {}), 0); }); // the switch: the section follows at once
304
+ TL.readImpact(() => refresh()); // Your impact under a delivered milestone (pm/ini-tail.js); the switch makes it follow at once
294
305
  }
@@ -158,7 +158,7 @@ export function open(btn, ctx) {
158
158
  if (b.dataset.bpDays) { S.days = Number(b.dataset.bpDays); return draw(`[data-bp-days="${S.days}"]`); }
159
159
  if (b.dataset.bpAdd) { S.sel.add(keyOf('initiative', b.dataset.bpAdd)); S.iniOpen = false; return draw('[data-bp="ini"]'); }
160
160
  const act = b.dataset.bp;
161
- if (act === 'shared') { close(false); const t = document.getElementById('chShared'); const tab = t && t.offsetParent ? t : document.getElementById('tabShared'); if (tab) tab.click(); return; }
161
+ if (act === 'shared') { close(false); const t = document.querySelector('#bdViewMenu [data-vshared]'); if (t && t.getAttribute('aria-pressed') !== 'true') t.click(); return; } // Shared with me, in the View chip (UI grill U2)
162
162
  if (act === 'changehost') { S.host = null; S.hostIn = ''; S.err = ''; return draw('#bpHost'); }
163
163
  if (act === 'savehost') {
164
164
  const v = ((m.querySelector('#bpHost') || {}).value || '').trim(); S.hostIn = v; S.err = '';
@@ -48,6 +48,7 @@ import { mergeClose } from './program-model.js';
48
48
  import { stagesOfRow } from './bd-wf.js';
49
49
  import { shownMs, endStage } from './bd-pins.js';
50
50
  import { stageName } from './stage-chip.js'; // W1: the one stage
51
+ import { provenStatus } from './status-proof.js'; // T3: a status renders only with its source and read time
51
52
 
52
53
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
53
54
  const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
@@ -119,7 +120,7 @@ export function fcRange(r) {
119
120
  const hi = day(F.high || F.low), lo = day(F.low);
120
121
  return tone && hi && hi > e ? { tone, low: lo || hi, high: hi } : null;
121
122
  }
122
- const toneOf = (r, now) => (r.late || anyMsLate(r, now) ? 'late' : r.status === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : r.status === 'on track' ? 'ok' : 'q');
123
+ const toneOf = (r, now) => { const ps = provenStatus(r); return r.late || anyMsLate(r, now) ? 'late' : ps === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : ps === 'on track' ? 'ok' : 'q'; }; // T3: a proven status only
123
124
  /** A row's dot (batch 13 item 4): only off track. 'late' | 'risk' | 'q' (on hold) | null. */
124
125
  export const offTone = (r, now) => { const t = toneOf(r, now); return t === 'late' || t === 'risk' ? t : r.status === 'on hold' ? 'q' : null; };
125
126
  const dotHtml = (r, now) => { const t = offTone(r, now); return t ? `<i class="cz-dot ${t}${t === 'q' ? '' : ' m-warn'}" aria-hidden="true"></i>` : ''; };
@@ -13,6 +13,7 @@ import { esc } from './premium-shell.js';
13
13
  import * as WF from './bd-wf.js';
14
14
  import { nextHtml } from './bd-next.js';
15
15
  import { stageName, stageChip } from './stage-chip.js'; // W1: the one stage
16
+ import { provenStatus, NO_SIGNAL } from './status-proof.js'; // T3: a status renders only with its source and read time
16
17
 
17
18
  let A = null; // the page: { M(), statusOf(r), usual(t), trail(r), docMeta(path, ws), sel(), groups(L), folded(key), laneHead(g), subTile(name), memberIcon(id), programOf(r), programs(),
18
19
  // wf() → { list, cur, ended } the workflows on the board, the picked one (null for All) and the rows that ended (pm/bd-wf.js) }
@@ -176,7 +177,7 @@ function phoneStages(L, C) {
176
177
  const n = at(L).length;
177
178
  if (!n) { empty.push(c.label); return ''; }
178
179
  const body = lanes.map((ln) => { const rs = at(ln.rows); return rs.length ? (G ? ln.label : '') + rs.map((r) => card(r, false)).join('') : ''; }).join('');
179
- return `<section class="bd-scol" aria-label="${esc(c.label)}"${dropAt(c, cur)}><h3>${msI(c.ms)}${esc(c.label)}<span>${c.count}</span></h3>${body}</section>`;
180
+ return `<section class="bd-scol" aria-label="${esc(c.label)}"${dropAt(c, cur)}><h3>${msI(c.ms)}${esc(c.label)}${c.count ? `<span>${c.count}</span>` : ''}</h3>${body}</section>`;
180
181
  }).join('');
181
182
  const tail = empty.length ? `<p class="bd-sempty">Nothing on screen in ${esc(empty.length > 1 ? empty.slice(0, -1).join(', ') + ' or ' + empty[empty.length - 1] : empty[0])}.</p>` : '';
182
183
  return `<div class="bd-scols ph">${secs}${tail}</div>${phoneEnded(C)}`;
@@ -191,7 +192,7 @@ export function morePcat(k) { pmore.add(k); }
191
192
  const CHEV_R = 'M10 7l5 5-5 5', CHEV_D = 'M7 10l5 5 5-5';
192
193
  function phoneSec(k, label, count, rs, o = {}) {
193
194
  const open = pcatOpen(k), all = pmore.has(k) || rs.length <= 6, shown = all ? rs : rs.slice(0, 5);
194
- const head = `<button type="button" class="bd-ghd bd-pcat${o.end ? ' end' : ''}" data-pcat="${esc(k)}" aria-expanded="${open}">${SV(open ? CHEV_D : CHEV_R)}${esc(label)}<span class="n">${count}</span></button>`;
195
+ const head = `<button type="button" class="bd-ghd bd-pcat${o.end ? ' end' : ''}" data-pcat="${esc(k)}" aria-expanded="${open}">${SV(open ? CHEV_D : CHEV_R)}${esc(label)}${count ? `<span class="n">${count}</span>` : ''}</button>`;
195
196
  if (!open) return head;
196
197
  return head + shown.map((r) => phoneRow(r)).join('') + (all ? '' : `<button type="button" class="dlink bd-pmore" data-pmore="${esc(k)}">${rs.length - 5} more</button>`);
197
198
  }
@@ -247,8 +248,8 @@ export function stagesHtml(L, o = {}) {
247
248
  }
248
249
  const span = Math.max(2, bodyEnd);
249
250
  const heads = C.map((c, j) => (shut[j]
250
- ? `<button type="button" class="bd-kstrip${c.end ? ' end' : ''}" data-colfold="${esc(c.key)}" style="grid-column:${j + 1};grid-row:1 / span ${span - 1}" aria-expanded="false" aria-label="Show ${esc(c.label)}, ${c.count}"><b>${c.count}</b><span>${msI(c.ms)}${esc(c.label)}</span></button>`
251
- : `<button type="button" class="bd-kh" data-colfold="${esc(c.key)}" style="grid-column:${j + 1}" aria-expanded="true" aria-label="${esc(c.label)}, ${c.count}. Fold the column"><span class="l">${msI(c.ms)}${esc(c.label)}</span><span class="n">${c.count}</span>${SV('M7 10l5 5 5-5')}</button>`)).join('');
251
+ ? `<button type="button" class="bd-kstrip${c.end ? ' end' : ''}" data-colfold="${esc(c.key)}" style="grid-column:${j + 1};grid-row:1 / span ${span - 1}" aria-expanded="false" aria-label="Show ${esc(c.label)}${c.count ? ', ' + c.count : ''}">${c.count ? `<b>${c.count}</b>` : ''}<span>${msI(c.ms)}${esc(c.label)}</span></button>`
252
+ : `<button type="button" class="bd-kh" data-colfold="${esc(c.key)}" style="grid-column:${j + 1}" aria-expanded="true" aria-label="${esc(c.label)}${c.count ? ', ' + c.count : ''}. Fold the column"><span class="l">${msI(c.ms)}${esc(c.label)}</span>${c.count ? `<span class="n">${c.count}</span>` : ''}${SV('M7 10l5 5 5-5')}</button>`)).join('');
252
253
  const cols = C.map((c, j) => (shut[j] ? '40px' : c.wide ? 'minmax(0,3.2fr)' : 'minmax(0,1fr)')).join(' ');
253
254
  const foot = `<div class="bd-foot bd-sfoot"><span>Any column folds to a strip and stays folded. Empty ones start folded.</span>${drag ? '<span>Drag a card to move its stage</span>' : ''}</div>`;
254
255
  return `<div class="bd-kb${G ? ' lanes' : ''}${mixed ? ' cats' : ''}" style="grid-template-columns:${cols}">${heads}${body}</div>${foot}`;
@@ -264,7 +265,8 @@ function phoneRow(r) {
264
265
  export function phoneListHtml(L) {
265
266
  const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
266
267
  // workspace grill W2: a row with nothing read is not on track; it is listed under No signal
267
- const none = left.filter((r) => r.status === 'no signal'), rest = left.filter((r) => !none.includes(r));
268
+ const none = left.filter((r) => provenStatus(r) === NO_SIGNAL), // T3: nothing proven is No signal, never On track
269
+ rest = left.filter((r) => !none.includes(r));
268
270
  const grp = (name, rs) => (rs.length ? `<div class="bd-ghd">${esc(name)}<span class="n">${rs.length}</span></div>${rs.map(phoneRow).join('')}` : '');
269
271
  if (!L.length) return '<p class="bt-empty">No initiative matches the chips or the filter.</p>';
270
272
  return `<div class="bd-plist">${grp('Your turn', you)}${grp('At risk or late', bad)}${grp('On track', rest)}${grp('No signal', none)}</div>`;
@@ -2,12 +2,11 @@
2
2
  * Every initiative is on one workflow: a numbered list of stages, each in a category (To do, In progress, Done); Won't do and Archived are in
3
3
  * every workflow. The rows carry `wf`, `wfStage`, `wfStages` and `ended` (common.md, "Row fields"); a row without them is on Product feature,
4
4
  * whose stages are the eight lifecycle steps (Triage is To do, Evaluate is Done, the rest are In progress).
5
- * · the chip row: All, then one chip per workflow on the board with its count. A picked workflow is remembered (pmos.board.wf). With one
6
- * workflow on the board there is nothing to pick, so no chip row is drawn and the Board shows that workflow's stages (zero is silence).
7
- * · picked(): the workflow whose own stages the Board draws, or null for All (the Board then draws the three categories).
5
+ * · no workflow is picked on the Board (batch 28 item 3, canvas BhA: the workflow chips and the Filter's Workflow group are gone, on a phone
6
+ * and a desktop). With one workflow on the board the Board shows that workflow's stages; with more it draws the three categories.
7
+ * · picked(): the workflow whose own stages the Board draws: the only one on the board, else null (All).
8
8
  * · the stage lists come from GET /api/workflows (the definitions), else from a row's own `wfStages`, else Product feature's.
9
9
  * Pure markup and state; the page (premium-board.js) and the views (bd-views.js) draw with it. */
10
- import { esc, store } from './premium-shell.js';
11
10
  import { CATS, ENDS, wfIcon, catLabel, PRODUCT_FEATURE_ID } from './wf-model.js';
12
11
 
13
12
  export { CATS, ENDS, wfIcon, catLabel };
@@ -17,9 +16,6 @@ export const PF_STAGES = [['triage', 'Triage', 'todo'], ['discover', 'Discover',
17
16
  ['build', 'Build', 'doing'], ['deliver', 'Deliver', 'doing', true], ['monitor', 'Monitor', 'doing'], ['evaluate', 'Evaluate', 'done', true]]
18
17
  .map(([key, name, cat, ms]) => ({ key, name, cat, milestone: !!ms }));
19
18
  export const CAT_ORDER = { todo: 0, doing: 1, done: 2, wontdo: 3, archived: 4 };
20
- const PICK_KEY = 'pmos.board.wf';
21
- /** Where a workflow is edited: the Workflows page (workstream C, WfAModel), opened at that workflow. */
22
- export const editHref = (wf) => '/premium-workflows.html?wf=' + encodeURIComponent(wf.id);
23
19
 
24
20
  export const isPF = (wf) => !wf || !wf.id || wf.id === PRODUCT_FEATURE_ID;
25
21
  /** The workflow a row is on: its own, else Product feature. */
@@ -66,27 +62,8 @@ export function stagesOfWf(wf, rows) {
66
62
  if (r) return r.wfStages.map((s) => ({ key: s.key, name: s.name, cat: s.cat, milestone: !!s.milestone }));
67
63
  return PF_STAGES.slice();
68
64
  }
69
- /** The picked workflow: the one the PM pressed, or the only one on the board; null is All (more than one, none picked). */
70
- export function picked(list) {
71
- const v = store.get(PICK_KEY);
72
- const w = v && v !== 'all' ? list.find((x) => x.id === v) : null;
73
- return w || (list.length === 1 ? list[0] : null);
74
- }
75
- /** The PM pressed a chip (or the Filter's Workflow group): an id, or '' for All. */
76
- export function setPick(id) { store.set(PICK_KEY, id || 'all'); }
77
- /** Did the PM narrow the rows to one workflow? (The only workflow on a board narrows nothing.) */
78
- export const narrowed = (list) => list.length > 1 && !!picked(list);
79
-
80
- const PEN = 'M4 20h4L19 9l-4-4L4 16zM14 6l4 4';
81
- /** The chip row (WfABoard, WfABoardOne, WfATrack, WfAPhone): All, then each workflow as its icon and count; the picked one also names
82
- * itself, and an edit icon opens it on the Workflows page. Nothing is drawn with one workflow on the board. */
83
- export function chipsHtml(list, cur, o = {}) {
84
- if (list.length < 2) return '';
85
- const chip = (w) => { const on = !!cur && cur.id === w.id;
86
- return `<button type="button" class="bd-chip bd-wfc${on ? ' on' : ''}" data-wfpick="${esc(w.id)}" aria-pressed="${on}" aria-label="${esc(w.name)} only, ${w.count}">${wfIcon(w, 16)}${on ? esc(w.name) + ' · ' : ''}${w.count}</button>`; };
87
- const edit = cur && !o.phone ? `<a class="bd-ib sm bd-wfedit" href="${esc(editHref(cur))}" aria-label="Edit the ${esc(cur.name)} workflow" title="Edit the ${esc(cur.name)} workflow"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="${PEN}"/></svg></a>` : '';
88
- return `<div class="bd-wfchips" role="group" aria-label="Workflow"><button type="button" class="bd-chip${cur ? '' : ' on'}" data-wfpick="" aria-pressed="${!cur}">All</button>${list.map(chip).join('')}${edit}</div>`;
89
- }
65
+ /** The workflow the Board draws the stages of: the only one on the board; null is All (more than one). */
66
+ export const picked = (list) => (list.length === 1 ? list[0] : null);
90
67
 
91
68
  /** The rows that ended (Won't do, Archived): a row whose record says so, and the board's cancelled (Won't do) and archived rows. */
92
69
  export function endedRows(M) {
@@ -1,5 +1,5 @@
1
1
  /* pm/c3-ini-ui.js — the console3 builders the Initiatives page draws with (mockup v5, src/pages/34-initiatives.js: nr, crumbs, lh,
2
- * segTabs, cols, UI.sect, UI.kv, UI.empty, statusChip, healthSt, ownerChip, stageChip, stepsMini, progChip, hbr). Every tab module of
2
+ * segTabs, cols, UI.sect, UI.kv, UI.empty, statusChip, ownerChip, stageChip, stepsMini, progChip, hbr). Every tab module of
3
3
  * the page (c3-initiatives.js and the c3-ib-*.js / c3-ii-tabs.js files) imports them from here, so the markup is the mockup's
4
4
  * everywhere: `.calwrap > .calbar`, `.lh`, `.seg`, `.brief.sbb > .bcols > .bcol`, `.card.sect > .sh2`, `ul.list > li.nrow`, `.chips2`,
5
5
  * `.chip2`, `.st`, `.tag`, `.pill`, `.chgl`, `.hbs > .hbr`, `.fold`.
@@ -17,13 +17,14 @@
17
17
  * after + xp, acts); an `xp` (a node or an array) makes the row expand in place (c3-expand.js)
18
18
  * list(rows) · empty(text) · emptyLi(text) · crumbs(parts, right) · lh(ic, title, sub, right) · segTabs(items, cur, onPick, label)
19
19
  * cols(left, right) · hbs(rows) · hbr(label, value, frac, tone) · kv(pairs) · chgl(items) · chgli(ic, text, tag, tone)
20
- * chip(...kids) · tag(...kids) · st(tone, ic, text) · note(...kids) · lbl(text) · sw(cat) · stageChip(name, cat) · statusChip(s)
21
- * healthSt(h) · ownerChip(o) · stepsMini(workflow, stage, label) · progChip(p, tone) · miniBar(p, tone) · dateChip(a, b, late)
20
+ * chip(...kids) · tag(...kids) · st(tone, ic, text) · note(...kids) · lbl(text) · sw(cat) · stageChip(name, cat) · statusChip(row)
21
+ * ownerChip(o) · stepsMini(workflow, stage, label) · progChip(p, tone) · miniBar(p, tone) · dateChip(a, b, late)
22
22
  * openMenu(anchor, { label, items: [{ label, kids, onPick, disabled, current, attrs } | { group }] }) a popover menu, closed by
23
23
  * Escape, a press outside or a pick; arrow keys move between its items
24
24
  * day(iso) '12 Oct' · dayLong(iso) 'Mon 12 Oct 2026' · ago(iso, today) · daysBetween(a, b) · plural(n, one, many) · trunc(s, n)
25
25
  */
26
26
  import { el, frag } from './dom.js';
27
+ import { provenStatus, fromLine } from './status-proof.js'; // T3: a status renders only with its source and read time
27
28
  import { button, ensureComponentsCss } from './primitives.js';
28
29
  import { c3ic } from './c3-base.js';
29
30
  import { makeXp, attachExpand } from './c3-expand.js';
@@ -133,10 +134,11 @@ export function ago(iso, today) {
133
134
  export { MON };
134
135
 
135
136
  /* ── chips ── */
136
- export const statusChip = (s) => (s === 'at risk' ? st('warn', 'alert', 'At risk') : s === 'late' ? st('bad', 'clock', 'Late') : s === 'done' ? st('ok', 'check', 'Done')
137
- : s === 'on hold' ? st('', 'moon', 'On hold') : s === 'cancelled' ? el('span', { class: 'tag' }, icon('x', 'sm'), 'Cancelled') : chip('On track'));
138
- export const HEALTH = { ok: 'On track', warn: 'Needs attention', bad: 'Off track' };
139
- export const healthSt = (h) => (h === 'ok' ? st('ok', 'check', 'On track') : h === 'warn' ? st('warn', 'alert', 'Needs attention') : h === 'bad' ? st('bad', 'alert', 'Off track') : chip('No health yet'));
137
+ /** T3 (status-proof.js): a status chip renders only with the source and read time behind it; anything it cannot prove is No signal, grey.
138
+ * (Before, an unknown status fell through to On track, and a health "ok", which only means no rule complained, read On track too.) */
139
+ export const statusChip = (r) => { const s = provenStatus(r || {}); const c = s === 'at risk' ? st('warn', 'alert', 'At risk') : s === 'late' ? st('bad', 'clock', 'Late') : s === 'done' ? st('ok', 'check', 'Done')
140
+ : s === 'on hold' ? st('', 'moon', 'On hold') : s === 'cancelled' ? el('span', { class: 'tag' }, icon('x', 'sm'), 'Cancelled') : s === 'on track' ? st('ok', 'check', 'On track') : chip('No signal');
141
+ const from = fromLine(r && r.signal); if (from && c && c.setAttribute) c.setAttribute('title', from); return c; };
140
142
  export const ownerText = (o) => (o ? o : el('span', { class: 'dim' }, 'No owner'));
141
143
  export const ownerChip = (o) => chip(icon('user', 'sm'), ownerText(o));
142
144
  export const stageChip = (name, cat) => chip(sw(cat), name || 'No stage');