create-pmos 0.417.0 → 0.419.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 (38) 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/state/discoveries.md +1 -1
  6. package/workspace/board-programs-test.js +82 -1
  7. package/workspace/briefing-premium-board-test.js +23 -21
  8. package/workspace/changelog.json +24 -0
  9. package/workspace/guide/briefing-premium.md +2 -2
  10. package/workspace/guide/workflows.md +1 -0
  11. package/workspace/lib/board-cli.js +1 -1
  12. package/workspace/lib/coredoc-cli.js +2 -0
  13. package/workspace/lib/engine/boards.js +7 -2
  14. package/workspace/lib/initiative-chat.js +3 -1
  15. package/workspace/lib/initiative-premium.js +2 -1
  16. package/workspace/lib/routes-boards.js +55 -7
  17. package/workspace/lib/task-cli.js +27 -3
  18. package/workspace/lib/task-items.js +5 -1
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/public/pm/bd-acts.js +3 -2
  22. package/workspace/public/pm/bd-scroll.js +164 -0
  23. package/workspace/public/pm/bd-span.js +156 -190
  24. package/workspace/public/pm/bd-stages.js +3 -25
  25. package/workspace/public/pm/cozy-board.css +93 -72
  26. package/workspace/public/pm/home-app.js +2 -0
  27. package/workspace/public/pm/home-data.js +17 -4
  28. package/workspace/public/pm/home-ini-model.js +5 -1
  29. package/workspace/public/pm/home-ini.js +4 -2
  30. package/workspace/public/pm/home-list.js +3 -3
  31. package/workspace/public/pm/home-task.js +4 -1
  32. package/workspace/public/pm/ini-view-model.js +4 -2
  33. package/workspace/public/pm/premium-board.js +48 -37
  34. package/workspace/public/pm/premium-vw-item.js +5 -2
  35. package/workspace/public/pm/task-card.js +12 -0
  36. package/workspace/public/premium-board.html +3 -2
  37. package/workspace/server.js +3 -0
  38. package/workspace/task-card-test.js +7 -0
@@ -4,13 +4,14 @@
4
4
  * Initiatives and Documents tabs and the chips (Jira read time, sprint and release, new asks, late, at risk, blocked, idle, This sprint).
5
5
  * · the stage track (default): each initiative is a row across the six stages and two milestones (◆), with the parts or tickets counted
6
6
  * toward the output that finishes its current step. Monitor and Evaluate rows fold under the table after the first of each.
7
- * · List and By stage (pm/bd-views.js; BdList, BdByStage) and the timeline (pm/bd-span.js): Sprint, Quarter, Half, Year, 2 yr and 5 yr.
7
+ * · List and By stage (pm/bd-views.js; BdList, BdByStage) and the timeline (pm/bd-span.js, scrolled by pm/bd-scroll.js): Sprint, Quarter, Half,
8
+ * Year, 2 yr and 5 yr, the same rows on every span from Quarter on (feedback batch 7, timeline spans C).
8
9
  * · a row opens the initiative panel and a ticket opens the Jira ticket panel, in the side panel (a bottom sheet on a phone).
9
10
  * · the Board has no chat: "Ask about this" sends the question to Home (/premium.html?ask=<initiative>&q=<question>).
10
11
  * The uncovered features (initiative premium-uncovered-features: BdList, BdByStage, BdDocs, BdSpans, BdAsks, BdNew, BdGrill, BdActions, BdFilter,
11
12
  * BdSprint, BdPanel, BdPhone, BdHead) are drawn by pm/bd-views.js (the views and Documents), pm/bd-asks.js (new asks, New initiative and its first
12
13
  * questions), pm/bd-acts.js (the row actions, Find, Filter, the sprint and release, the trends, the document panel) and pm/bd-pop.js (popovers).
13
- * A phone has List, By stage and the stage track; the timeline needs a wider screen (BdPhone).
14
+ * A phone has List, By stage, the stage track and the timeline (BdPhone, TsCPhone), with one span picker beside the product picker.
14
15
  * After the model, GET /api/board-trail (lib/board-trail.js) adds what the model does not carry: days in the step and the usual days, the
15
16
  * skipped steps and why, the parts of the output, what waits on you, tickets drafted in PMOS, PRD drift, links, dependencies and themes.
16
17
  * Workflows (D99, workflows-per-initiative: WfABoard WfABoardOne WfATrack WfAElse WfAPhone; pm/bd-wf.js): every initiative is on one workflow. The
@@ -20,8 +21,9 @@ import { pmPost } from './http.js';
20
21
  import { $, $$, esc, store, crumbHtml, wireCrumb, chatAbout, setPageGaps } from './premium-shell.js';
21
22
  import { mountNav } from './cozy-nav.js';
22
23
  import { mountLivePill } from './cozy-live-pill.js';
23
- import { stepsHelpHtml, rulesHelpHtml } from './bd-stages.js';
24
- import { timelineHtml, legendHtml, SPANS, GROUPS, md } from './bd-span.js';
24
+ import { stepsHelpHtml } from './bd-stages.js';
25
+ import { timelineHtml, legendHtml, SPANS, md } from './bd-span.js';
26
+ import * as TL from './bd-scroll.js';
25
27
  import * as Acts from './bd-acts.js';
26
28
  import * as V from './bd-views.js';
27
29
  import * as WF from './bd-wf.js';
@@ -37,12 +39,11 @@ import { statusOf as ivStatus } from './ini-view-model.js';
37
39
  import { initiativeRename } from './rename-press.js';
38
40
  import { setSay } from './cozy-xv.js';
39
41
 
40
- const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUP_KEY = 'pmos.board.group', GROUPING_KEY = 'pmos.board.grouping';
42
+ const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
41
43
  let M = null; // the model
42
44
  let TR = null; // the trail (GET /api/board-trail): { usual, themes, items: { [id]: item } }
43
- let group = GROUPS.some(([k]) => k === store.get(GROUP_KEY)) ? store.get(GROUP_KEY) : 'theme';
44
45
  let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? store.get(VIEW_KEY) : 'track';
45
- let pview = ['list', 'stages', 'track'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
46
+ let pview = ['list', 'stages', 'track', 'time'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
46
47
  let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
47
48
  let tab = 'ini';
48
49
  let readTimer = null;
@@ -66,7 +67,7 @@ const I = {
66
67
  ext: 'M14 4h6v6M20 4l-9 9M10 6H5v13h13v-5', refresh: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7', cal: 'M4 6h16v14H4zM4 10h16M9 3v4M15 3v4', jira: 'M12 3l9 9-9 9-9-9z',
67
68
  flag: 'M5 21V4M5 4h11l-2 4 2 4H5', note: 'M4 5h16v11h-9l-5 4v-4H4z', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
68
69
  doc: 'M6 3h9l4 4v14H6zM14 3v5h5', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1', chev: 'M7 10l5 5 5-5', chevUp: 'M7 14l5-5 5 5',
69
- move: 'M4 12h12M12 6l6 6-6 6M20 5v14', hold: 'M9 5v14M15 5v14', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4', group: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z',
70
+ move: 'M4 12h12M12 6l6 6-6 6M20 5v14', hold: 'M9 5v14M15 5v14', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4',
70
71
  track: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z', time: 'M4 6h9M8 12h11M6 18h7',
71
72
  };
72
73
  const plural = (n, a, b) => (n === 1 ? a : b);
@@ -148,19 +149,17 @@ function drawHead() {
148
149
  setPageGaps(((M.header && M.header.missing) || []).length);
149
150
  }
150
151
  const CHIP_F = [['late', 'late', 'm-warn', (n) => n + ' late'], ['risk', 'risk', 'm-warn', (n) => n + ' at risk'], ['blocked', 'red', 'm-crit', (n) => n + ' blocked'], ['idle', 'q', '', (n) => n + ' idle 30+ days']];
151
- const longSpan = () => view === 'time' && (span === 'year' || span === 'y5');
152
+ /** The sprint filter (the "Sprint N only" chip and Filter's Sprint group) shows on the Sprint span only among the timeline's spans (TsSprintFilter);
153
+ * the stage track keeps its chip. */
154
+ const curView = () => (PHONE.matches ? pview : view);
155
+ const sprintFilterOn = () => curView() !== 'time' || span === 'sprint';
152
156
  function drawChips() {
153
157
  const J = M.jira || {}, C = M.chips || {}, sp = J.sprint, rel = J.release, phone = PHONE.matches;
154
158
  const jira = J.readAt ? (phone ? 'Jira ' + ago(J.readAt, true) : 'Jira · read ' + ago(J.readAt)) : phone ? 'Jira not read' : 'Jira · not read';
155
159
  const sprint = [sp ? sp.name : null, rel ? rel.name + ' ships ' + rel.at.replace(/^(\d+) (\w+)$/, '$2 $1') : null].filter(Boolean).join(' · ') || 'No sprint on record';
156
160
  const asks = C.asks == null ? 'New asks · not read' : null;
157
161
  const flt = (keys) => CHIP_F.filter(([k]) => keys.includes(k)).map(([k, tone, mo, word]) => (C[k] ? `<button type="button" class="bd-chip gh${F.chips.has(k) ? ' on' : ''}" data-f="${k}" aria-pressed="${F.chips.has(k)}"><i class="cz-dot ${tone} ${mo}"></i>${esc(word(C[k]))}</button>` : '')).join('');
158
- const thisSprint = sp && (view === 'track' || phone) ? `<button type="button" class="bd-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}" title="${F.chips.has('sprint') ? 'Shows only the initiatives with work in ' + esc(sp.name) + '. Press to show all.' : 'Press to show only the initiatives with work in ' + esc(sp.name) + '.'}">${esc(sp.name)} only</button>` : ''; // it named no sprint and read like a heading (testing fixes)
159
- if (longSpan()) {
160
- const gn = (GROUPS.find(([k]) => k === group) || GROUPS[0])[1];
161
- $('#bdChipset').innerHTML = `<span class="bd-grpw"><button type="button" class="bd-chip" id="chGroup" aria-haspopup="menu" aria-expanded="false">${SV(I.group)}<span>Group:</span><b>${esc(gn)}</b></button><span class="bd-grpm" id="grpMenu" role="menu" hidden>${GROUPS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === group}" data-grp="${k}">${esc(n)}</button>`).join('')}</span></span><span class="bd-sp"></span>${flt(['late', 'risk', 'blocked'])}`;
162
- return;
163
- }
162
+ const thisSprint = sp && (view === 'track' || view === 'time' || phone) && sprintFilterOn() ? `<button type="button" class="bd-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}" title="${F.chips.has('sprint') ? 'Shows only the initiatives with work in ' + esc(sp.name) + '. Press to show all.' : 'Press to show only the initiatives with work in ' + esc(sp.name) + '.'}">${esc(sp.name)} only</button>` : ''; // it named no sprint and read like a heading (testing fixes)
164
163
  // All products (PgBoard): one Jira chip with the oldest read of any product, and every product's new asks; the sprint stays per product
165
164
  const jiraChip = `<button type="button" class="bd-chip" id="chJira" title="${ALL ? 'Read Jira again for every product' : 'Read Jira again'}">${SV(I.refresh)}<span>${esc(jira)}</span></button>`;
166
165
  const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
@@ -170,7 +169,7 @@ function drawChips() {
170
169
  return;
171
170
  }
172
171
  // the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn
173
- const lgd = view === 'time' && span === 'quarter' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible())) : '';
172
+ const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible())) : '';
174
173
  $('#bdChipset').innerHTML = jiraChip
175
174
  + (ALL ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
176
175
  + askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
@@ -184,13 +183,10 @@ $('#bdChipset').addEventListener('click', (e) => {
184
183
  if (k !== 'sprint' && !F.chips.has(k)) { Acts.open.trend(k, f); return; }
185
184
  if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); drawChips(); drawInit(); return;
186
185
  }
187
- const g = e.target.closest('[data-grp]');
188
- if (g) { group = g.dataset.grp; store.set(GROUP_KEY, group); drawChips(); drawInit(); const c = $('#chGroup'); if (c) c.focus(); return; }
189
186
  const b = e.target.closest('button'); if (!b) return;
190
187
  if (b.id === 'chJira') refreshJira(b);
191
188
  else if (b.id === 'chSprint') Acts.open.sprint(b);
192
189
  else if (b.id === 'chAsks') Acts.open.asks(b);
193
- else if (b.id === 'chGroup') { const m = $('#grpMenu'), o = m.hidden; m.hidden = !o; b.setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
194
190
  else if (b.id === 'chDocs') setTab('docs');
195
191
  });
196
192
  /** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
@@ -206,7 +202,7 @@ async function refreshJira(btn) {
206
202
  if (ok) setTimeout(load, 4000);
207
203
  }
208
204
 
209
- /* ── the popovers: what finishes each step, and the timeline's spans ───────────────────────────────────────────────────── */
205
+ /* ── the popover: what finishes each step ───────────────────────────────────────────────────── */
210
206
  let popBtn = null;
211
207
  function closePops(back) { $$('.bd-pop').forEach((p) => { p.hidden = true; }); if (popBtn && back) popBtn.focus(); popBtn = null; }
212
208
  function togglePop(id, btn) {
@@ -217,11 +213,9 @@ function togglePop(id, btn) {
217
213
  const f = p.querySelector('button'); if (f) f.focus({ preventScroll: true });
218
214
  }
219
215
  $('#popSteps').innerHTML = stepsHelpHtml();
220
- $('#popRules').innerHTML = rulesHelpHtml();
221
216
  document.addEventListener('click', (e) => {
222
217
  if (e.target.closest('[data-pop-close]')) { closePops(true); return; }
223
- if (!e.target.closest('.bd-pop, [data-steps], [data-rules]')) closePops();
224
- if (!e.target.closest('.bd-grpw')) { const m = $('#grpMenu'); if (m && !m.hidden) { m.hidden = true; $('#chGroup').setAttribute('aria-expanded', 'false'); } }
218
+ if (!e.target.closest('.bd-pop, [data-steps]')) closePops();
225
219
  });
226
220
 
227
221
  /* ── the rows on screen: the chip filters ─────────────────────────────────────────────────────────────────────────── */
@@ -244,11 +238,11 @@ function visible() {
244
238
  if (F.chips.has('risk') && r.status !== 'at risk') return false;
245
239
  if (F.chips.has('blocked') && !t.blocked) return false;
246
240
  if (F.chips.has('idle') && t.idle == null) return false;
247
- if (F.chips.has('sprint') && sp && (view === 'track' || PHONE.matches) && !inSprint(r, sp)) return false;
241
+ if (F.chips.has('sprint') && sp && (view === 'track' || view === 'time' || PHONE.matches) && sprintFilterOn() && !inSprint(r, sp)) return false;
248
242
  if (F.q && !String(r.title || '').toLowerCase().includes(F.q.toLowerCase())) return false;
249
243
  if (F.owners.size && !F.owners.has(r.owner || 'No owner')) return false;
250
244
  if (F.cats.size && !F.cats.has(WF.catOfRow(r))) return false;
251
- if (F.sprints.size && !(t.tickets || []).some((k) => F.sprints.has(k.sprint || 'Backlog'))) return false;
245
+ if (F.sprints.size && sprintFilterOn() && !(t.tickets || []).some((k) => F.sprints.has(k.sprint || 'Backlog'))) return false;
252
246
  return true;
253
247
  });
254
248
  }
@@ -385,16 +379,16 @@ function drawTrack(L) {
385
379
  return `<div class="bt" role="table" aria-label="Initiatives by stage">${head}${rows}<div class="bt-tf">${tf2}<span class="bt-srt">Sorted by stage</span></div>${PHONE.matches ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-steps aria-haspopup="dialog">What finishes each step</button><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : ''}</div>`; // the phone has no step heads: a plain entry to the steps help
386
380
  }
387
381
 
388
- /* ── the timeline (AgBoardTimeline, AgBoardTlYear, AgBoardTl5y, AgBoardTimelinePhone) ───────────────────────────────────────── */
382
+ /* ── the timeline (AgBoardTimeline; TsCOpen, TsCDesk, TsAllSpans, TsCPhone) ───────────────────────────────────────── */
389
383
  function drawTime(L) {
390
- const S = M.steps || [];
384
+ const S = M.steps || [], phone = PHONE.matches, bw = $('#ibBody').clientWidth || innerWidth;
391
385
  const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
392
- foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, hiddenCount: (S[6] ? S[6].count : 0) + (S[7] ? S[7].count : 0), themes: (TR && TR.themes) || [], group, avatar: (n) => V.avatar(n, 'sm'),
386
+ foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, phone, trackPx: bw - 2 - (phone ? 0 : matchMedia('(max-width: 980px)').matches ? 180 : 250), avatar: (n) => V.avatar(n, 'sm'),
393
387
  askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
394
388
  return T.html;
395
389
  }
396
- /** A phone's view switch (BdPhone): List and By stage, and the stage track; the timeline needs a wider screen. */
397
- const phoneSeg = (v) => `<div class="bd-phseg"><div class="bd-seg" role="group" aria-label="View">${[['list', 'List'], ['stages', 'By stage'], ['track', 'Track']].map(([k, n]) => `<button type="button" data-pv="${k}" aria-pressed="${v === k}">${n}</button>`).join('')}</div><span class="bd-amut">Timeline needs a wider screen.</span></div>`;
390
+ /** A phone's view switch (BdPhone): List, By stage, the stage track and the timeline (TsCPhone: it scrolls sideways like the desktop's). */
391
+ const phoneSeg = (v) => `<div class="bd-phseg"><div class="bd-seg" role="group" aria-label="View">${[['list', 'List'], ['stages', 'By stage'], ['track', 'Track'], ['time', 'Timeline']].map(([k, n]) => `<button type="button" data-pv="${k}" aria-pressed="${v === k}">${n}</button>`).join('')}</div></div>`;
398
392
  function drawInit() {
399
393
  $('#nIni').textContent = String(M.initiatives.open || M.initiatives.list.rows.length);
400
394
  const phone = PHONE.matches, L = visible(), v = phone ? pview : view;
@@ -405,12 +399,15 @@ function drawInit() {
405
399
  const phx = phone && v !== 'track' ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : '';
406
400
  // the workflow chips (WfABoard, WfATrack, WfAPhone): By stage and the track on a desktop, every view on a phone; the List filters in Filter
407
401
  const W = wfState(), wfc = phone || v === 'stages' || v === 'track' ? WF.chipsHtml(W.list, W.cur, { phone }) : '';
402
+ if (v === 'time') TL.hold(); else TL.forget();
408
403
  body.innerHTML = (phone ? phoneSeg(v) : '') + wfc + html + phx;
404
+ if (v === 'time') TL.mount(body);
409
405
  $('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
410
406
  $$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
411
407
  $('#bdView').innerHTML = SV(v === 'time' ? I.time : I.track); $('#bdView').setAttribute('aria-label', 'Change view. Now: ' + (v === 'time' ? 'Timeline' : 'Stage track'));
412
408
  $('#bdSpans').hidden = v !== 'time' || phone;
413
409
  $$('#bdSpans [data-sp]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.sp === span)));
410
+ drawSpanPick(phone && v === 'time');
414
411
  document.body.dataset.bdView = v;
415
412
  drawGrouping();
416
413
  }
@@ -435,13 +432,29 @@ document.addEventListener('click', (e) => { if (!e.target.closest('#bdGrpw')) {
435
432
  $('#bdGrpw').addEventListener('keydown', (e) => { if (e.key === 'Escape') { const m = $('#bdGrpMenu'); if (m && !m.hidden) { e.stopPropagation(); m.hidden = true; $('#bdGroup').setAttribute('aria-expanded', 'false'); $('#bdGroup').focus(); } } });
436
433
  function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else { view = v; store.set(VIEW_KEY, view); } closePanel(); drawChips(); drawInit(); }
437
434
  $('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
438
- $('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : 'list') : view === 'time' ? 'track' : 'time'); });
435
+ $('#bdView').addEventListener('click', () => { if (M) setView(PHONE.matches ? (pview === 'list' ? 'stages' : pview === 'stages' ? 'track' : pview === 'track' ? 'time' : 'list') : view === 'time' ? 'track' : 'time'); });
439
436
  $('#bdShowing').addEventListener('click', (e) => {
440
437
  if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
441
438
  const u = e.target.closest('[data-unf]'); if (!u) return;
442
439
  if (u.dataset.unf === 'q') F.q = ''; else if (u.dataset.unf === 'wf') WF.setPick(''); else F[u.dataset.unf].clear(); drawChips(); drawInit();
443
440
  });
444
- $('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; span = b.dataset.sp; store.set(SPAN_KEY, span); drawChips(); drawInit(); });
441
+ function setSpan(s) { span = s; store.set(SPAN_KEY, span); drawChips(); drawInit(); }
442
+ $('#bdSpans').addEventListener('click', (e) => { const b = e.target.closest('[data-sp]'); if (!b || !M) return; setSpan(b.dataset.sp); });
443
+ /** A phone's span picker (TsCPhone, TsCPhoneSpan): the six span buttons become one picker beside the product picker, and the span row goes. */
444
+ function drawSpanPick(on) {
445
+ const w = $('#bdSpanPick'); document.body.classList.toggle('bd-spick', on);
446
+ w.hidden = !on; if (!on) { w.innerHTML = ''; return; }
447
+ const open = !!$('#bdSpanMenu') && !$('#bdSpanMenu').hidden, name = (SPANS.find(([k]) => k === span) || SPANS[1])[1];
448
+ w.innerHTML = `<button type="button" class="bd-chip bd-spk" id="bdSpanBtn" aria-haspopup="menu" aria-expanded="${open}" aria-label="Span: ${esc(name)}. Change the span">${esc(name)}${SV(I.chev)}</button>`
449
+ + `<span class="bd-grpm" id="bdSpanMenu" role="menu"${open ? '' : ' hidden'}>${SPANS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === span}" data-spick="${k}">${esc(n)}</button>`).join('')}</span>`;
450
+ }
451
+ const closeSpanPick = () => { const m = $('#bdSpanMenu'); if (m && !m.hidden) { m.hidden = true; $('#bdSpanBtn').setAttribute('aria-expanded', 'false'); return true; } return false; };
452
+ $('#bdSpanPick').addEventListener('click', (e) => {
453
+ const k = e.target.closest('[data-spick]'); if (k) { closeSpanPick(); setSpan(k.dataset.spick); const b = $('#bdSpanBtn'); if (b) b.focus(); return; }
454
+ if (e.target.closest('#bdSpanBtn')) { const m = $('#bdSpanMenu'), o = m.hidden; m.hidden = !o; $('#bdSpanBtn').setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
455
+ });
456
+ $('#bdSpanPick').addEventListener('keydown', (e) => { if (e.key === 'Escape' && closeSpanPick()) { e.stopPropagation(); $('#bdSpanBtn').focus(); } });
457
+ document.addEventListener('click', (e) => { if (!e.target.closest('#bdSpanPick')) closeSpanPick(); });
445
458
  $('#ibBody').addEventListener('click', (e) => {
446
459
  if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
447
460
  const gf = e.target.closest('[data-fold]'); if (gf) { const k = gf.dataset.fold; PG.fold(k); drawInit(); const b = $$('#ibBody [data-fold]').find((x) => x.dataset.fold === k); if (b) b.focus(); return; }
@@ -457,10 +470,7 @@ $('#ibBody').addEventListener('click', (e) => {
457
470
  if (e.target.closest('[data-backlog]')) return; // pm/bd-acts.js opens the backlog
458
471
  const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
459
472
  const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
460
- const ru = e.target.closest('[data-rules]'); if (ru) { togglePop('popRules', ru); return; }
461
- const go = e.target.closest('[data-span-go]'); if (go) { span = go.dataset.spanGo; store.set(SPAN_KEY, span); drawChips(); drawInit(); return; }
462
473
  const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
463
- const th = e.target.closest('[data-tgtheme]'); if (th) { span = 'year'; store.set(SPAN_KEY, span); drawChips(); drawInit(); return; }
464
474
  if (e.target.closest('[data-act]')) return; // pm/bd-acts.js handles its own presses
465
475
  const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
466
476
  const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
@@ -794,14 +804,15 @@ async function addTask(r, title) {
794
804
  }
795
805
  const viewDoc = (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); };
796
806
  const anchors = async (ws, board) => { try { const r = await (await fetch('/api/boards/anchors?ws=' + encodeURIComponent(ws || M.board.ws || '') + '&board=' + encodeURIComponent(board || M.board.id || ''), { credentials: 'same-origin' })).json(); return r && r.ok ? r.anchors || [] : []; } catch { return []; } };
797
- const openIniAny = (r) => openIni(r, $('#bdBell'), 'track');
807
+ // Find and the other jumps: on the timeline the row's bar scrolls into view and the row tints for a moment (TsCEdges 4)
808
+ const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#bdBell'), 'track'); };
798
809
  V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
799
810
  groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
800
811
  memberIcon: (id) => PG.memberIcon(PGS, id), product: () => (M.board.product || M.board.name || ''), programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), tileHtml: PG.tileHtml, progTile: PG.progTile });
801
812
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
802
813
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
803
814
  openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
804
- grouping: () => ({ on: groupingOn(), byProduct }), setGrouping });
815
+ grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn });
805
816
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
806
817
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
807
818
  acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
@@ -5,9 +5,9 @@
5
5
  * requirement read from the PRD
6
6
  * Both read GET /api/initiative-premium, the route the initiative page reads; the HTML comes from premium-vw-item-model.js. The route answers
7
7
  * 'reading' while the board derives, and the tab asks again. Inside a tab a task opens its own tab and the initiative link opens the initiative's. */
8
- import { vwOpen, vwStyle } from './premium-viewer.js';
8
+ import { vwOpen, vwStyle, vwClose } from './premium-viewer.js';
9
9
  import { esc, iniId, taskId, stateOf, readingHtml, errorHtml, iniHtml, taskHtml, findTask, cardTask } from './premium-vw-item-model.js';
10
- import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf } from './task-card.js';
10
+ import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf, deleteEntry } from './task-card.js';
11
11
  import { pmPost } from './http.js';
12
12
  import { setCheck } from './cozy-viewer.js';
13
13
 
@@ -50,6 +50,8 @@ export function openWorkItem(o) {
50
50
  rename: o.rename || null, // the Viewer's rename option, from the page that knows how to write it (rename-press.js)
51
51
  check: editable ? { state: 'todo', label: 'Mark done' } : null, // the quick Done (canvas XetX1Rest); it follows the task once read
52
52
  onPress: (act) => { if (act === 'check' && card && cardT && !cardT.jira) card.setStatus(cardT.status === 'Done' ? 'To do' : 'Done'); },
53
+ // ⋯ Delete for a task added by mistake (batch 7 item 5), once the task is read
54
+ more: () => { const del = cardT && deleteEntry({ ws: cardT._ws, board: cardT._board, t: cardT, post: (p, b) => pmPost(p, b), toast: toastUndo, done: () => { cache.clear(); vwClose(vid); } }); return del ? [del] : []; },
53
55
  render(el) {
54
56
  el.innerHTML = readingHtml(isTask ? 'the task' : 'the initiative');
55
57
  read(ctx).then((s) => {
@@ -76,6 +78,7 @@ export function openWorkItem(o) {
76
78
  function mountTask(el, m, row) {
77
79
  const ws = ctx.ws || (m.board && m.board.ws) || '', board = ctx.board || (m.board && m.board.id) || '';
78
80
  const t = cardT = cardTask(m, row);
81
+ t._ws = ws; t._board = board; // for ⋯ Delete
79
82
  const lists = { inis: null, owners: null, groups: null, sections: null };
80
83
  const host = document.createElement('article'); host.className = 'paper doc vwi vwi-tk'; el.innerHTML = ''; el.append(host);
81
84
  if (t.jira) {
@@ -272,6 +272,18 @@ export function mountCard(el, t, h) {
272
272
  }
273
273
 
274
274
  /** The page's toast with Undo, in the shape Home draws (home-app.js toastUndo): #toast with one .undo press, kept 8 seconds. */
275
+ /** The ⋯ menu's Delete for a task added by mistake (batch 7 item 5), or null for a Jira ticket or a breakdown item (Won't do withdraws
276
+ * those). o: { ws, board, t, post(path, body), toast(msg, undo), done() — the Viewer closes and the list re-reads }. Undo restores it. */
277
+ export function deleteEntry(o) {
278
+ const { ws, board, t, post } = o;
279
+ if (!t || t.jira || !/^task-/.test(String(t.uid || ''))) return null;
280
+ return { label: 'Delete', danger: true, on: async () => {
281
+ const r = await post('/api/boards/tasks/delete', { ws, board, task: t.uid });
282
+ if (!r || !r.ok) { o.toast((r && r.error) || 'The task was not deleted.'); return; }
283
+ if (o.done) o.done();
284
+ o.toast('Deleted · ' + t.title + '.', async () => { const u = await post('/api/boards/tasks/restore', { ws, board, task: t.uid }); if (u && u.ok && o.done) o.done(); return u; });
285
+ } };
286
+ }
275
287
  export function toastUndo(msg, undo) {
276
288
  const el = typeof document !== 'undefined' && document.getElementById('toast'); if (!el) return;
277
289
  el.innerHTML = esc(msg) + (undo ? ' <button class="undo" type="button">Undo</button>' : ''); el.classList.add('on'); el.classList.toggle('act', !!undo);
@@ -23,6 +23,8 @@
23
23
  the picker, "Board", Find, Filter, one view button and New initiative (BdPhone). -->
24
24
  <div class="bd-hd">
25
25
  <div id="crumbHost" class="bd-pickw"></div>
26
+ <!-- a phone's span picker on the timeline (TsCPhone, TsCPhoneSpan): the span buttons become one picker beside the product picker -->
27
+ <span class="bd-grpw2 bd-spw" id="bdSpanPick" hidden></span>
26
28
  <span class="bd-title" aria-hidden="true">Board</span>
27
29
  <div class="bd-tools">
28
30
  <div class="bd-seg bd-views" id="ibTabs" role="group" aria-label="View">
@@ -64,9 +66,8 @@
64
66
  <div id="docBody"></div>
65
67
  </section>
66
68
 
67
- <!-- the two help frames: what finishes each step (the step heads open it) and the timeline's spans (the timeline's first head opens it) -->
69
+ <!-- the help frame: what finishes each step (the step heads open it) -->
68
70
  <div class="bd-pop bd-pop-xw" id="popSteps" role="dialog" aria-labelledby="hSteps" hidden></div>
69
- <div class="bd-pop bd-pop-xw" id="popRules" role="dialog" aria-labelledby="hRules" hidden></div>
70
71
 
71
72
  <!-- the initiative panel and the Jira ticket panel (a bottom sheet on a phone) -->
72
73
  <div class="bd-toast" id="bdToast" role="status" hidden></div>
@@ -3107,6 +3107,8 @@ function restorePersisted(opts = {}) {
3107
3107
  } else {
3108
3108
  s.state = 'exited';
3109
3109
  s.note = meta.note || 'restored after server restart — scrollback preserved; ↻ respawn to start a new process';
3110
+ // a chat that was live when PMOS stopped was ended by the restart, not the PM: its row stays on Home and resumes (batch 7 item 1)
3111
+ if (meta.state !== 'exited' && /^chat:/.test(String(meta.origin || ''))) s.autoEnded = true;
3110
3112
  // A record from before exitedAt existed: its last write is when it last changed, the closest truthful clock.
3111
3113
  if (!s.exitedAt) { try { s.exitedAt = new Date(fs.statSync(path.join(SESS_DIR, f)).mtimeMs).toISOString(); } catch {} }
3112
3114
  }
@@ -3427,6 +3429,7 @@ function sessionList() {
3427
3429
  cwd: path.relative(s.root, s.cwd) || '.', note: s.note || '', origin: s.origin || null,
3428
3430
  automatic: sessionOrigin.isAutomatic(s.origin), // the workspace started it, not the PM: the dock hides these by default
3429
3431
  auto_delete: s.autoDelete || null,
3432
+ auto_ended: !!s.autoEnded, // PMOS ended it (idle, or room for a newer chat), not the PM: a chat's row stays on Home and resumes (batch 7)
3430
3433
  headless: s.headless || null, // workspace-headless-jobs: a background run with no terminal ('notes' or 'skill')
3431
3434
  outcome: s.outcome || null, // background-run-outcome: how a finished background run ended (lib/headless.js outcomeOf)
3432
3435
  plan_item: s.plan_item || null, // Hand to agent: the breakdown item this session is bound to (pm-os-absorb Run 1)
@@ -114,6 +114,13 @@ async function pure() {
114
114
  const jr = C.taskOf({ key: 'task:ONB-12', uid: 'ONB-12', pmos: false, ref: 'ONB-12', state: 'In progress', src: 'Jira (read-only)', readAt: 'x' }, { ini: 'a' });
115
115
  const it = C.taskOf({ uid: 't9', src: 'pmos', status: 'Done', end: '2026-10-01', ini: 'b' });
116
116
  ok('P8 one shape from the initiative model and from the board\'s items', row.status === 'To do' && row.due === '2026-10-27' && row.key === 'task:t1' && !row.jira && jr.jira.key === 'ONB-12' && it.key === 'task:t9' && it.due === '2026-10-01' && it.ini === 'b');
117
+ // P10 (batch 7 item 5): ⋯ Delete for a PMOS task only; it takes the delete route, closes, and its Undo restores
118
+ const dc = []; let closed = 0, undo = null;
119
+ const del = C.deleteEntry({ ws: 'w1', board: 'b1', t, post: async (p, b) => { dc.push([p, b]); return { ok: true }; }, toast: (m, u) => { undo = u; }, done: () => { closed++; } });
120
+ await del.on(); await undo();
121
+ ok('P10 Delete: red, the delete route, the Viewer closes, Undo restores; none for a Jira ticket or a breakdown item', del.label === 'Delete' && del.danger === true
122
+ && dc.map((c) => c[0]).join() === '/api/boards/tasks/delete,/api/boards/tasks/restore' && dc[0][1].task === 'task-1' && closed === 2
123
+ && C.deleteEntry({ t: { ...t, jira: { key: 'CIAM-214' } }, post }) === null && C.deleteEntry({ t: { ...t, uid: 'fx-bare.abcdefghij' }, post }) === null, JSON.stringify(dc));
117
124
  }
118
125
 
119
126
  (async () => {