create-pmos 0.831.0 → 0.833.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 (59) hide show
  1. package/package.json +140 -41
  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/changelog.json +139 -21
  7. package/workspace/guide/backlog.md +2 -1
  8. package/workspace/guide/cli.md +19 -0
  9. package/workspace/guide/initiatives-and-next-steps.md +2 -0
  10. package/workspace/guide/layout.md +4 -1
  11. package/workspace/guide/positioning.md +1 -1
  12. package/workspace/guide/programs.md +2 -1
  13. package/workspace/lib/events-place.js +11 -4
  14. package/workspace/lib/features.json +3 -1
  15. package/workspace/lib/layouts-cli.js +6 -0
  16. package/workspace/lib/line.js +7 -1
  17. package/workspace/lib/list-balance.js +18 -3
  18. package/workspace/lib/pmos-verbs.js +6 -0
  19. package/workspace/lib/route-modules.js +2 -0
  20. package/workspace/lib/routes-events-place.js +19 -1
  21. package/workspace/lib/routes-screen-layouts.js +56 -0
  22. package/workspace/lib/routes-strategy-card.js +6 -2
  23. package/workspace/lib/routes-switches.js +35 -0
  24. package/workspace/lib/switch-owners.js +152 -0
  25. package/workspace/lib/switches-cli.js +85 -0
  26. package/workspace/lib/three-layouts.js +214 -0
  27. package/workspace/lib/work-kr.js +77 -0
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/public/pm/bd-backlog.css +11 -0
  31. package/workspace/public/pm/bd-goal.js +33 -0
  32. package/workspace/public/pm/bd-ini-panel.js +15 -5
  33. package/workspace/public/pm/bd-pop-ds.css +16 -0
  34. package/workspace/public/pm/bd-positioning.js +6 -4
  35. package/workspace/public/pm/bd-prog-panel.js +16 -5
  36. package/workspace/public/pm/bd-strategy.js +15 -3
  37. package/workspace/public/pm/bd-work-ds.css +6 -0
  38. package/workspace/public/pm/bd-work.js +34 -8
  39. package/workspace/public/pm/cozy-events-view.js +8 -4
  40. package/workspace/public/pm/cozy-pop-work.js +8 -3
  41. package/workspace/public/pm/cozy-today-app.js +28 -1
  42. package/workspace/public/pm/cozy-today-model.js +13 -5
  43. package/workspace/public/pm/cozy-today-view.js +10 -1
  44. package/workspace/public/pm/line-view.js +13 -1
  45. package/workspace/public/pm/list-balance.js +16 -2
  46. package/workspace/public/pm/ms-strip.js +137 -0
  47. package/workspace/public/pm/page-chat.css +19 -0
  48. package/workspace/public/pm/page-chat.js +2 -0
  49. package/workspace/public/pm/premium-board.js +7 -1
  50. package/workspace/public/pm/side-fold.js +94 -0
  51. package/workspace/public/pm/switch-owners.js +70 -0
  52. package/workspace/public/pm/three-layouts.js +66 -0
  53. package/workspace/public/premium-board.html +2 -0
  54. package/workspace/stage-card-tasks-test.js +1 -0
  55. package/workspace/test-lists/ms-strip.json +9 -0
  56. package/workspace/test-lists/side-fold.json +9 -0
  57. package/workspace/test-lists/switch-owners.json +9 -0
  58. package/workspace/test-lists/three-layouts.json +9 -0
  59. package/workspace/test-lists/work-kr.json +9 -0
@@ -13,6 +13,8 @@
13
13
  * · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
14
14
  * · Once all five are written, the Positioning part (pm/bd-positioning.js, idea A328) sits under the lines: positioning and key
15
15
  * messages drafted from them, each citing its line, kept or edited by the PM.
16
+ * · The OKR period beside the title and a Serves row under the head: the objectives and key results of the product's OKR file
17
+ * (tb-work-kr, board TbWork). No OKR file, no period and no row. Positioning names the same period.
16
18
  * The controls carry ids (bdStratEdit, bdStratSave, bdStratFits) so the local use log counts their use (the bet's kill line). */
17
19
  import { pmPost } from './http.js';
18
20
  import * as POS from './bd-positioning.js';
@@ -29,6 +31,16 @@ const HINT = { for: 'The people this product serves', problem: 'What they strugg
29
31
  export const fitsLine = (n) => n + (n === 1 ? " doesn't fit" : " don't fit");
30
32
  const isEmpty = (c) => !c || FIELDS.every((k) => !String(c[k] || '').trim());
31
33
 
34
+ /** tb-work-kr (board TbWork): the OKR period the strategy is for, "H2 2026 · Jul–Dec · ends 31 Dec · 5 weeks left", beside the title, and the
35
+ * Serves row: each objective of the OKR file with its key results. Both come from GET /api/strategy-card (lib/work-kr.js); none, nothing. */
36
+ export const periodText = (state) => (state && state.period && state.period.text) || '';
37
+ export function servesHtml(state) {
38
+ const S = (state && Array.isArray(state.serves) ? state.serves : []).filter((o) => o && (o.krs || []).length);
39
+ if (!S.length) return '';
40
+ const obj = (o) => `<li class="bd-serves-o"><span class="t">${esc(o.token)}${o.title ? ' · ' + esc(o.title) : ''}</span><span class="bd-serves-k">${o.krs.map((k) => `<span class="pm-chip" title="${esc(k.token + (k.title ? ' · ' + k.title : ''))}">${esc(k.token)}${k.title ? ' ' + esc(k.title) : ''}</span>`).join('')}</span></li>`;
41
+ return `<div class="bd-serves" aria-label="Serves"><p class="pm-meta">Serves</p><ul role="list">${S.map(obj).join('')}</ul></div>`;
42
+ }
43
+
32
44
  /** The card's markup. state = { card, complete, notes, editing, open }. Pure, so the test reads it. */
33
45
  export function cardHtml(state) {
34
46
  const { card, notes, editing, open } = state;
@@ -51,7 +63,7 @@ export function cardHtml(state) {
51
63
  + (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
52
64
  : '';
53
65
  const pos = state.complete ? '<div id="bdPos" hidden></div>' : '';
54
- return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', undo + btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
66
+ return `<section class="pm-block" aria-label="Strategy">${head('Strategy', periodText(state), undo + btn('bdStratEdit', I.pen, 'Edit the strategy'))}${servesHtml(state)}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
55
67
  }
56
68
 
57
69
  /** Draw the card again after a read of the Board, unless the PM is writing in it. */
@@ -70,7 +82,7 @@ export async function mount(host, opts = {}) {
70
82
  const q = (ws ? '?ws=' + encodeURIComponent(ws) : '?') + (board ? (ws ? '&' : '') + 'board=' + encodeURIComponent(board) : '');
71
83
  let r = null; try { r = await (await fetch('/api/strategy-card' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
72
84
  if (!r || !r.ok) { host.hidden = true; return; } // the card is an extra: a failed read leaves the Board as it was
73
- const S = { card: r.card, complete: r.complete, notes: r.notes, sources: r.sources || {}, drafting: !!r.drafting, editing: false, open: host.dataset.open === '1' };
85
+ const S = { card: r.card, complete: r.complete, notes: r.notes, sources: r.sources || {}, drafting: !!r.drafting, editing: false, open: host.dataset.open === '1', period: r.period || null, serves: r.serves || [] };
74
86
  // while PMOS drafts, read again now and then until the lines land (at most ~5 minutes)
75
87
  clearTimeout(host._stratPoll);
76
88
  const tries = Number(host.dataset.polls || 0);
@@ -79,7 +91,7 @@ export async function mount(host, opts = {}) {
79
91
  const draw = () => {
80
92
  host.hidden = false; host.innerHTML = cardHtml(S);
81
93
  if (S.editing) { const f = host.querySelector('[data-strat]'); if (f) f.focus(); }
82
- else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say });
94
+ else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say, period: S.period });
83
95
  };
84
96
  const save = async () => {
85
97
  const fields = {}; host.querySelectorAll('[data-strat]').forEach((el) => { fields[el.dataset.strat] = el.value; });
@@ -38,11 +38,17 @@ table.pm-table.wk col.c-ms { width: 150px; }
38
38
  table.pm-table.wk col.c-date { width: 176px; }
39
39
  table.pm-table.wk col.c-status, table.pm-table.wk col.c-wf { width: 120px; }
40
40
  table.pm-table.wk col.c-program, table.pm-table.wk col.c-goal { width: 160px; }
41
+ table.pm-table.wk col.c-tasks { width: 104px; }
42
+ table.pm-table.wk col.c-owner { width: 120px; }
43
+ table.pm-table.wk col.c-epic { width: 140px; }
41
44
  table.pm-table.wk:not(.has-x) col.c-title { width: auto; }
42
45
  @media (max-width: 1280px) { table.pm-table.wk col.c-title { width: 200px; } table.pm-table.wk col.c-ms { width: 130px; } table.pm-table.wk col.c-date { width: 150px; } table.pm-table.wk col.c-stage { width: 96px; } }
43
46
  table.pm-table.wk th, table.pm-table.wk td { height: 40px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
44
47
  table.pm-table.wk td.n { font-weight: var(--fw-strong); color: var(--ink); }
45
48
  table.pm-table.wk td.n .wk-sg { margin-right: 8px; } /* the state glyph before the title (state-glyphs) */
49
+ /* grouped by goal, the key result a row serves sits under its name (TbInitiatives); the title wraps there instead of being cut */
50
+ table.pm-table.wk td.n.sv { height: auto; padding-top: 6px; padding-bottom: 6px; white-space: normal; line-height: 1.3; }
51
+ table.pm-table.wk td.n .wk-sv { display: block; font-size: var(--fs-meta); font-weight: var(--fw-regular); color: var(--muted); }
46
52
  table.pm-table.wk tr.wk-i { cursor: pointer; }
47
53
  table.pm-table.wk tr.wk-i:focus-visible { outline: none; box-shadow: inset var(--glow); }
48
54
  table.pm-table.wk tr.wk-i.sel td { background: var(--blue-tint); }
@@ -1,7 +1,8 @@
1
1
  /* pm/bd-work.js — Work, one view (slice 4 of the six-place navigation, initiative work-one-view; boards 4, 5 and 24 on Exploring 2).
2
2
  * One list of initiatives with the timeline on its right. No List / By stage / Track / Timeline tabs.
3
- * · Columns, in one order: Initiative, Product, Stage, Next milestone, Date. Status, Program, Goal and Workflow can be shown. Initiative
4
- * always shows. One text size, one row height; only the initiative name is bold.
3
+ * · Columns, in one order: Initiative, Product, Stage, Tasks done, Date, Owner, Jira epic (board TbInitiatives). Next milestone, Status,
4
+ * Program, Goal, Workflow and Raised by can be shown. Initiative always shows. Grouped by goal, the groups are the objectives (o.goalGroups)
5
+ * and each row says the key result it serves under its name (o.serves). One text size, one row height; only the initiative name is bold.
5
6
  * · Next milestone is the real milestone name; with none the cell is empty (never "Plan end", never a stage name), and Date is the plan end.
6
7
  * · Only a late or at-risk date has colour: "4 Nov · 14 days late", "27 Nov · at risk". A closed initiative is never late.
7
8
  * · The bar is the Board's own (Wawan, 2026-11-19, round 2; pm/bd-span.js rowBar, given by the page): done, now in blue, planned, every
@@ -27,11 +28,15 @@ const DAY = 864e5;
27
28
 
28
29
  /* ── the columns ─────────────────────────────────────────────────────────────────────────────────────────────── */
29
30
  /** Every column but Initiative, in its usual order, with its width in px. on: shown by default. */
31
+ // the usual ones are the board's (TbInitiatives, Exploring 3 page balanced): Stage, Tasks done, Date, Owner, Jira epic; Product with two products
30
32
  export const COLS = [
31
33
  { k: 'product', n: 'Product', w: 112, on: true },
32
34
  { k: 'stage', n: 'Stage', w: 160, on: true },
33
- { k: 'ms', n: 'Next milestone', w: 160, on: true },
35
+ { k: 'tasks', n: 'Tasks done', w: 104, on: true },
34
36
  { k: 'date', n: 'Date', w: 152, on: true },
37
+ { k: 'owner', n: 'Owner', w: 120, on: true },
38
+ { k: 'epic', n: 'Jira epic', w: 140, on: true },
39
+ { k: 'ms', n: 'Next milestone', w: 160, on: false },
35
40
  { k: 'status', n: 'Status', w: 104, on: false },
36
41
  { k: 'program', n: 'Program', w: 150, on: false },
37
42
  { k: 'goal', n: 'Goal', w: 170, on: false },
@@ -43,7 +48,7 @@ export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stag
43
48
  // the scale tabs (WorkDS, 2026-11-20): Week, Month, Quarter, Year and Full; the number is the window's length in days (Full fits the rows)
44
49
  export const SPANS = [['week', 'Week', 42], ['month', 'Month', 152], ['quarter', 'Quarter', 456], ['year', 'Year', 1096], ['full', 'Full', 0]];
45
50
  const OLD_SPAN = { half: 'quarter', y2: 'year', y5: 'year' }; // a view kept before the scale tabs
46
- export const KEY = 'pmos.work.view.3'; // .3 (WorkDS, 2026-11-20): every kept view starts again from the usual one, on Month
51
+ export const KEY = 'pmos.work.view.4'; // .4 (TbInitiatives, 2026-11-25): every kept view starts again from the board's columns; .3 (WorkDS) was Month
47
52
 
48
53
  /** The usual view: grouped by goal, the timeline on, the default columns in their order, Month (WorkDS). */
49
54
  export const usual = () => ({ group: 'goal', tl: true, span: 'month', cols: COLS.map((c) => ({ k: c.k, on: c.on })), sorts: [] });
@@ -209,7 +214,7 @@ export function addSort(k) {
209
214
  return write({ ...read(), sorts: S });
210
215
  }
211
216
  export const dropSort = (k) => write({ ...read(), sorts: read().sorts.filter((x) => x.k !== k) });
212
- export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['origin', 'Raised by']];
217
+ export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['tasks', 'Tasks done'], ['date', 'Date'], ['owner', 'Owner'], ['epic', 'Jira epic'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['origin', 'Raised by']];
213
218
  const str = (v) => String(v || '~');
214
219
  /** Stage order: the row's own workflow's place, else (no workflow on record) the lifecycle's order by name, so Discover comes before Build. */
215
220
  const LIFE = ['triage', 'discover', 'discovery', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate', 'completed', 'closed'];
@@ -225,6 +230,9 @@ const SORTS = {
225
230
  program: (a, b, o) => str(o.programOf && o.programOf(a)).localeCompare(str(o.programOf && o.programOf(b))),
226
231
  goal: (a, b, o) => str(o.goalOf && o.goalOf(a)).localeCompare(str(o.goalOf && o.goalOf(b))),
227
232
  wf: (a, b) => String(wfOf(a).name).localeCompare(String(wfOf(b).name)),
233
+ tasks: (a, b) => { const x = tasksOf(a), y = tasksOf(b); return (x.n ? x.done / x.n : -1) - (y.n ? y.done / y.n : -1); },
234
+ owner: (a, b) => str(a.owner).localeCompare(str(b.owner)),
235
+ epic: (a, b) => str(epicOf(a)).localeCompare(str(epicOf(b))),
228
236
  origin: (a, b) => originPos(originGroup(a) || '~') - originPos(originGroup(b) || '~') || str(originText(a)).localeCompare(str(originText(b))),
229
237
  };
230
238
  const sortRows = (rows, o) => {
@@ -343,6 +351,15 @@ export function ticksOf(W) {
343
351
  const I = { print: 'M7 9V4h10v5M7 17H5a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-2M7 14h10v6H7z', hide: 'M13 6l6 6-6 6M6 6l6 6-6 6', show: 'M11 6l-6 6 6 6M18 6l-6 6 6 6', chev: 'M7 10l5 5 5-5', sort: 'M12 5v14M6 13l6 6 6-6', x: 'M6 6l12 12M18 6L6 18',
344
352
  back: 'M15 6l-6 6 6 6', on: 'M10 8l4 4-4 4', today: 'M12 3v18M7 8l-4 4 4 4M17 8l4 4-4 4', tune: 'M4 7h10M18 7h2M4 17h4M12 17h8M14 5v4M8 15v4' };
345
353
 
354
+ /** A row's own tasks: how many, and how many are done (status done, or closed). Never another row's. PURE. */
355
+ export function tasksOf(r) {
356
+ const T = Array.isArray(r && r.tasks) ? r.tasks.filter(Boolean) : [];
357
+ return { n: T.length, done: T.filter((x) => /^done$/i.test(String(x.status || '')) || !!x.closed).length };
358
+ }
359
+ /** The row's Jira epic: the first epic key it holds, '' when none. */
360
+ export const epicOf = (r) => String(((r && r.epics) || [])[0] || '');
361
+ const tasksText = (r) => { const t = tasksOf(r); return t.n ? t.done + ' of ' + t.n : ''; };
362
+
346
363
  function cellHtml(r, k, o) {
347
364
  if (k === 'product') return `<td>${esc(o.product(r))}</td>`;
348
365
  if (k === 'stage') { const s = stageText(r); return `<td class="wk-stc">${o.canMove && o.canMove(r) ? `<button type="button" class="wk-st" data-wkstage="${esc(r.key)}" aria-haspopup="menu" aria-label="Stage: ${esc(s || 'none')}. Change the stage" title="Change the stage">${esc(s)}</button>` : esc(s)}</td>`; }
@@ -355,6 +372,10 @@ function cellHtml(r, k, o) {
355
372
  if (k === 'goal') return `<td>${esc((o.goalOf && o.goalOf(r)) || '')}</td>`;
356
373
  if (k === 'wf') return `<td>${esc(wfOf(r).name)}</td>`;
357
374
  if (k === 'origin') return `<td>${esc(originText(r))}</td>`; // none: an empty cell (zero is silence)
375
+ // the board's columns: no tasks is an empty cell; no owner and no epic say so, muted, as they are what needs someone
376
+ if (k === 'tasks') return `<td>${esc(tasksText(r))}</td>`;
377
+ if (k === 'owner') return `<td>${r.owner ? esc(r.owner) : '<span class="pm-meta">no one</span>'}</td>`;
378
+ if (k === 'epic') return `<td>${epicOf(r) ? esc(epicOf(r)) : '<span class="pm-meta">no epic</span>'}</td>`;
358
379
  return '<td></td>';
359
380
  }
360
381
  const words = (r, keys, o) => keys.map((k) => {
@@ -367,6 +388,9 @@ const words = (r, keys, o) => keys.map((k) => {
367
388
  if (k === 'goal') return (o.goalOf && o.goalOf(r)) || '';
368
389
  if (k === 'wf') return wfOf(r).name;
369
390
  if (k === 'origin') return originText(r) ? 'raised by ' + originText(r) : '';
391
+ if (k === 'tasks') return tasksText(r) ? tasksText(r) + ' tasks done' : '';
392
+ if (k === 'owner') return r.owner ? 'owner ' + r.owner : 'no owner';
393
+ if (k === 'epic') return epicOf(r) ? 'epic ' + epicOf(r) : 'no epic';
370
394
  return '';
371
395
  }).filter(Boolean).join(', ');
372
396
 
@@ -397,7 +421,7 @@ export function cardHtml(r, W, now = new Date()) {
397
421
  export const isClosed = (r) => !!(r.closed || ['done', 'wontdo', 'archived'].includes(catOfRow(r)));
398
422
  let CARD = null, SHUT = true, COLS_OPEN = false, LAST = null, LASTW = null; // the row whose stage card is open; the closed ones folded; the menu's Columns open; the rows last drawn
399
423
 
400
- /** The whole list. rows: the initiatives on screen. o: { now, many, sel, canMove(r), product(r), programOf(r), goalOf(r), goalGroups(rows),
424
+ /** The whole list. rows: the initiatives on screen. o: { now, many, sel, canMove(r), product(r), programOf(r), goalOf(r), goalGroups(rows), serves(r),
401
425
  * bar(r, W): the Board's own bar for a row (else the plain one) } → html. The closed ones fold into one line at the end. */
402
426
  export function listHtml(rows, o = {}) {
403
427
  const v = read(), now = o.now || new Date(), keys = colsShown(v, o), tl = v.tl !== false;
@@ -422,8 +446,10 @@ export function listHtml(rows, o = {}) {
422
446
  let h = `<section class="pm-block wk-blk" aria-label="Initiatives">${head}${o.above || ''}${showingHtml(every.length - rows.length)}`
423
447
  + `<div class="wk-tw"><table class="pm-table wk${tl ? ' has-x' : ''}" aria-label="Initiatives"><colgroup><col class="c-title">${keys.map((k) => `<col class="c-${k}">`).join('')}${tl ? '<col class="c-x">' : ''}</colgroup>`
424
448
  + `<thead><tr>${sortHd('title', 'Initiative')}${keys.map((k) => sortHd(k, byK[k].n)).join('')}${tlHead}</tr></thead><tbody>`;
425
- const row = (r) => `<tr class="wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
426
- + `<td class="n">${((g) => stateGlyph(g.state, { why: g.why, progress: g.progress, cls: 'wk-sg' }))(rowState(r, now))}${esc(r.title)}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
449
+ // grouped by goal, each row says which key result it serves, under its name (TbInitiatives); grouped otherwise it says nothing
450
+ const sv = (r) => (v.group === 'goal' && o.serves ? o.serves(r) || '' : '');
451
+ const row = (r) => `<tr class="wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (sv(r) ? ', ' + sv(r) : '') + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
452
+ + `<td class="n${sv(r) ? ' sv' : ''}">${((g) => stateGlyph(g.state, { why: g.why, progress: g.progress, cls: 'wk-sg' }))(rowState(r, now))}${esc(r.title)}${sv(r) ? `<small class="wk-sv">${esc(sv(r))}</small>` : ''}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
427
453
  + (tl ? `<td class="wk-x" data-wkbar="${esc(r.key)}"><div class="wk-bw pm-gt">${grid}${o.bar ? o.bar(r, W) : barHtml(r, W, { now })}</div>${CARD === r.key ? cardHtml(r, W, now) : ''}</td>` : '') + '</tr>';
428
454
  const all = o.order ? o.order(rows) : rows, base = all.filter((r) => !isClosed(r)), shut = all.filter(isClosed), G = groupsOf(base, v.group, oo);
429
455
  const gline = (inner) => `<tr class="wk-g"><td colspan="${ncol}"><div class="pm-group">${inner}</div></td></tr>`;
@@ -4,6 +4,7 @@
4
4
  * Main + side. Every group is a system block, and this file writes only the system's part classes (pm-block, pm-li, pm-sug, pm-ev,
5
5
  * pm-badge, pm-fold, pm-cal, pm-leg, pm-tabs, pm-btn); the evp-* names beside them are hooks for the page code and the placement sheet.
6
6
  * groupsOf(items, { show, day }) → { late, today, coming, later } the items the page shows, by group; show = the types on; day = one day
7
+ * (past: the meetings of a picked day before today, with Open notes)
7
8
  * listHtml(model, o) the main column: Late (a List block: one Suggestion "PMOS has a fix for all N late dates" with ✓ ✕, then
8
9
  * each row with PMOS's fix as its grey line, a late Badge and ✓ ✕; the newest LATE_SHOWN, then one fold),
9
10
  * Today (todayHtml), Coming up (a List block; a Suggestion under a date only where it is at risk; the later
@@ -73,13 +74,15 @@ export function groupsOf(items, o = {}) {
73
74
  const day = o.day || null;
74
75
  const list = visible(items, o).filter((x) => !day || x.date === day);
75
76
  const g = (k) => list.filter((x) => x.group === k);
76
- return { late: g('late'), today: g('today'), coming: g('coming'), later: g('later') };
77
+ // past: the meetings of a day before today. They are not late, so only a picked day shows them (and the calendar marks their days)
78
+ return { late: g('late'), today: g('today'), coming: g('coming'), later: g('later'), past: day ? g('past') : [] };
77
79
  }
78
80
 
79
81
  /** The day column: the date, or the time today. How late a date is goes on its Badge, not here. */
80
82
  function dayCell(x, today) {
81
83
  if (x.group === 'today' && x.time) return { b: x.time, s: x.until ? 'to ' + x.until : '' };
82
84
  if (x.group === 'today') return { b: 'Today', s: '' };
85
+ if (x.group === 'past') return { b: x.time || 'All day', s: x.until ? 'to ' + x.until : '' };
83
86
  const n = between(today, x.date);
84
87
  if (x.group === 'late') return { b: shortDay(x.date, today), s: '' };
85
88
  return { b: shortDay(x.date, today), s: x.time ? weekday(x.date) + ' ' + x.time : 'in ' + n + ' ' + plural(n, 'day', 'days') };
@@ -212,7 +215,7 @@ export function hiddenHtml(items, o = {}) {
212
215
  const typesCut = TYPES.some((t) => !on.has(t));
213
216
  const scoped = !!(o.scopeOk && o.scopeWords);
214
217
  if (!typesCut && !scoped) return '';
215
- const all = (items || []).filter((x) => x.group !== 'later' || x.kind === 'milestone');
218
+ const all = (items || []).filter((x) => (x.group !== 'later' || x.kind === 'milestone') && x.group !== 'past');
216
219
  const shown = visible(all, o).length, hidden = all.length - shown;
217
220
  if (!hidden) return '';
218
221
  const and = (L) => (L.length > 1 ? L.slice(0, -1).join(', ') + ' and ' + L[L.length - 1] : L[0] || 'nothing');
@@ -261,7 +264,8 @@ export function listHtml(model, o = {}) {
261
264
  }
262
265
  const coming = G.coming.length ? groupHtml('coming', 'Coming up', G.coming, ro, '', o.day ? '' : later, 0, o.day ? null : comingBody(G.coming, ro))
263
266
  : !o.day && later ? `<section class="evp-g evp-coming pm-block list" aria-label="Coming up"><div class="head"><h2 class="pm-h">Coming up</h2><span class="sp"></span></div>${later}</section>` : '';
264
- const body = groupHtml('late', 'Late', lateRows, ro, all, lateTail, G.late.length) + todayHtml(G.today, { ...ro, now: o.now }) + coming + (o.day ? later : '');
267
+ const past = G.past.length ? groupHtml('past', G.past.every((x) => typeOf(x) === 'focus') ? 'Focus time' : 'Meetings', G.past, ro, '', '', G.past.length, null, `<span class="pm-meta">${esc(weekday(o.day) + ' ' + shortDay(o.day, today))}</span>`) : '';
268
+ const body = past + groupHtml('late', 'Late', lateRows, ro, all, lateTail, G.late.length) + todayHtml(G.today, { ...ro, now: o.now }) + coming + (o.day ? later : '');
265
269
  if (body) return body;
266
270
  if (o.day) return `<p class="evp-quiet pm-meta">Nothing has a date on ${esc(weekday(o.day) + ' ' + shortDay(o.day, today))}.</p>`;
267
271
  return '<p class="evp-quiet pm-meta">Nothing is late, and nothing has a date in the next 30 days.</p>';
@@ -314,7 +318,7 @@ export function showHtml(show, o = {}) {
314
318
  /** How many dates of each type the page lists (Late, Today, Coming up and the far milestones), under the chip. */
315
319
  export function countsOf(items, o = {}) {
316
320
  const c = {};
317
- for (const x of items || []) { if (x.group === 'later' && x.kind !== 'milestone') continue; if (o.scopeOk && !o.scopeOk(x)) continue; c[typeOf(x)] = (c[typeOf(x)] || 0) + 1; }
321
+ for (const x of items || []) { if ((x.group === 'later' && x.kind !== 'milestone') || x.group === 'past') continue; if (o.scopeOk && !o.scopeOk(x)) continue; c[typeOf(x)] = (c[typeOf(x)] || 0) + 1; }
318
322
  return c;
319
323
  }
320
324
 
@@ -37,6 +37,7 @@ import * as IF from './inline-fields.js'; // a task's sprint and priority, set
37
37
  import * as SD from './star-draft.js'; // a ✦ draft runs as a PMOS background job and lands on its line (star-buttons-act-directly A7)
38
38
  import * as CAP from './pop-cap.js'; // five actions at most: Ask PMOS and the toolbar's four, the rest under ⋯ (popup-cap, idea A498)
39
39
  import { noteUse } from './use-log.js';
40
+ import * as TLY from './three-layouts.js'; // three layouts for a new screen, pick one (initiative three-layouts, A317)
40
41
  import * as PR from './print-pdf.js'; // Print or PDF under ⋯ (job #1911, A379)
41
42
  import * as SMAP from './stakeholder-map.js'; // the People block: who decides, must agree, needs to know (stakeholder-map, A371)
42
43
  import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
@@ -105,7 +106,7 @@ export const resetItems = () => { ITEMS.clear(); CRIT.clear(); };
105
106
  /* A chat turn may have written what the popup shows (initiative chat-saves-to-cards, Wawan 2026-11-23: the chat saved the case and the card
106
107
  * kept saying no line is written): the popup's reads of one initiative (the case's artefacts, the Library's rows, the done test's criteria)
107
108
  * were kept for the page's life, so they are read again after every chat turn, and when the page comes back into view. */
108
- function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); if (artRedraw) artRedraw(); }
109
+ function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); TLY.forget(); if (artRedraw) artRedraw(); }
109
110
  if (typeof document !== 'undefined' && document.addEventListener) {
110
111
  document.addEventListener('cz:chat-turn', () => rereadAll());
111
112
  document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') rereadAll(); });
@@ -492,9 +493,11 @@ function dsHtml(r, v, o, W, S, C, mode) {
492
493
  const crit = S.sel.size || dropped().has('crit:' + id) ? '' : critSugHtml(CRIT.get(id));
493
494
  // Overview (Wawan, 2026-11-23): Where it stands, The case and its facts in one block across the top; folded or open is the person's choice
494
495
  // one column (artefacts-in-more-menu, Wawan 2026-11-23): the Stages and the breakdown take the full width; the artefacts are in ⋯ (moreItems)
496
+ // a new screen's three layouts under the stages (three-layouts, A317): zero is silence, so an initiative that adds no screen shows nothing
497
+ const lay = TLY.html(TLY.seen(id));
495
498
  // the People block under the Overview (stakeholder-map, BatchPeopleDS panel 9): drawn from memory, read once per initiative; no name, no block
496
499
  const ppl = SMAP.blockFor(id, o.ws, () => { if (artRedraw) artRedraw(); });
497
- return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${crit}${wbs}</div></div>`;
500
+ return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${lay}${crit}${wbs}</div></div>`;
498
501
  }
499
502
 
500
503
  /** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
@@ -905,7 +908,7 @@ export function wire(body, h0, x0) {
905
908
  // the Viewer reuses its body for the next item: the presses read the item shown now from the body, so one set of listeners serves all
906
909
  body.__pwh = ED.writes(h0); body.__pwx = x0;
907
910
  { const o = x0 && x0.o ? x0.o() || {} : {}; ASK_AT = o.id ? { id: String(o.id), ws: o.ws || '' } : null; }
908
- { const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
911
+ { const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (!RO && !phone()) TLY.read((x0.o() || {}).ws, c.id, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
909
912
  const q = OPEN_ON_DRAW;
910
913
  if (c && q && q.id === String(c.id) && Date.now() - q.at < 15000) { OPEN_ON_DRAW = null; setTimeout(() => { const c2 = cur(); if (c2) openSmall(q.uid, c2, body.__pwh, body.__pwx, body); }, 0); } }
911
914
  if (body.__pw) return;
@@ -987,6 +990,8 @@ export function wire(body, h0, x0) {
987
990
  if ('pwTickNo' in d) { const u = S.tickAsk; S.tickAsk = ''; redraw(); if (u && h.status) await h.status(u, 'Done'); return; }
988
991
  if (d.pwSub) { const u = d.pwSub, open = b.getAttribute('aria-expanded') === 'true'; S.subOpen.delete(u); S.subShut.delete(u); (open ? S.subShut : S.subOpen).add(u); redraw(); return; }
989
992
  if ('pwEpicFix' in d) { b.disabled = true; await epicFix(c, h, x); return; }
993
+ if (d.tlPick) { b.disabled = true; const at = atOf(h, x); await TLY.pick(at.ws, c.id, d.tlPick, { toast: h.toast, undoToast, redraw }); return; }
994
+ if ('tlUndo' in d) { b.disabled = true; const at = atOf(h, x); await TLY.undo(at.ws, c.id, { toast: h.toast, redraw }); return; }
990
995
  if ('pwCritOk' in d) { b.disabled = true; await critFix(c, h, x); return; }
991
996
  if ('pwCritDrop' in d) { const dd = dropped(); dd.add('crit:' + c.id); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
992
997
  if ('pwEpicDrop' in d) { const dd = dropped(); dd.add('epic:' + c.id); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
@@ -47,6 +47,7 @@ export function mountToday(ctx) {
47
47
  readReports();
48
48
  readQuestions();
49
49
  readSignoffs();
50
+ readSwitches();
50
51
  readLine();
51
52
  readDigest();
52
53
  readSync();
@@ -182,6 +183,29 @@ export function mountToday(ctx) {
182
183
  X.soSeen = next; X.signoffs = rows; X.signoffSuggest = suggest;
183
184
  draw();
184
185
  }
186
+ /* switch-owners (A263, LINE.md Rule 12): each product's switch turns that wait on the PM (GET /api/switches), one Your move row each. A
187
+ * product that does not answer is left out; with nothing waiting there is no row (zero is silence). */
188
+ async function readSwitches() {
189
+ const P = ((ctx.S.M && ctx.S.M.products) || []).filter((p) => p && p.model);
190
+ const L = [...new Set((P.length ? P.map((p) => p.ws || ctx.boardWs() || '') : [ctx.boardWs() || '']))];
191
+ const got = await Promise.all(L.map((ws) => ctx.pmGet('/api/switches' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
192
+ const rows = [];
193
+ got.forEach((r, i) => { if (!r || !r.ok) return; for (const w of r.switches || []) if (w && w.waiting) rows.push({ ...w, ws: L[i] }); });
194
+ const next = JSON.stringify(rows);
195
+ if (next === (X.swSeen || '[]')) return;
196
+ X.swSeen = next; X.switches = rows;
197
+ draw();
198
+ }
199
+ /** ✓ "I turned it in the product" or ✕ "keep it as it is" on a switch row: the PM's own press, the one way its recorded state changes. */
200
+ async function switchPress(r, yes) {
201
+ const w = r.ref || {};
202
+ const res = await ctx.pmPost('/api/switches', { ws: w.ws || null, act: yes ? 'confirm' : 'cancel', id: w.id }).catch(() => null);
203
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It did not go through. Nothing changed.');
204
+ const n = res.row || w;
205
+ ctx.toast(yes ? `${n.name} is ${n.on ? 'on' : 'off'} for ${n.customer}.` : `${n.name} stays ${n.on ? 'on' : 'off'} for ${n.customer}.`);
206
+ await readSwitches();
207
+ return after(true);
208
+ }
185
209
  /** ✓ on a sign-off row: recorded with its source; when it was the stage's last missing item the stage moves in the same press. One Undo. */
186
210
  async function signoffRecord(r) {
187
211
  const s = r.ref || {};
@@ -314,6 +338,7 @@ export function mountToday(ctx) {
314
338
  const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
315
339
  own: X.log.entries, marks: X.log.marks, lab, questions: X.questions || [], titleOf: ctx.titleOf, productOf, now, fixed: X.log.fixed || {},
316
340
  signoffs: X.signoffs || [], signoffSuggest: X.signoffSuggest || [],
341
+ switches: X.switches || [],
317
342
  // your-move (A468): an initiative's ship date is its board end date; a line with no default on work that ships soon blocks it
318
343
  shipOf: (id) => { const r = byId.get('i:' + id); return (r && r.board && r.board.end) || ''; } });
319
344
  if (L.move.length !== X.ymN) { X.ymN = L.move.length; console.info('[your-move] rows=' + L.move.length + ' shown=' + L.first.length + (L.move[0] ? ' first-tier=' + L.move[0].tier : '')); }
@@ -463,6 +488,7 @@ export function mountToday(ctx) {
463
488
  if (r.src === 'item') { if (r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini); return; } pop(r); import('./home-work.js').then((M) => M.openWorkItem(ref.key)).catch(() => {}); return; }
464
489
  if (r.src === 'question') { openQuestion(ref); return; }
465
490
  if (r.src === 'signoff') { if (ref.ini && ctx.hasIni(ref.ini)) ctx.goIni(ref.ini); return; }
491
+ if (r.src === 'switch') { location.href = '/premium-board.html' + (ref.ws ? '?ws=' + encodeURIComponent(ref.ws) : ''); return; } // the Switches block on Work
466
492
  if (r.src === 'signoff-by') { if (ref.ini && ctx.hasIni(ref.ini)) ctx.goIni(ref.ini); return; }
467
493
  if (r.src === 'draft') { pop(r); ctx.openFinished(ref.fin); return; }
468
494
  if (r.src === 'review') { pop(r); ctx.openReviewVw(); return; }
@@ -765,7 +791,7 @@ export function mountToday(ctx) {
765
791
  }
766
792
  if (act === 'open' && key === 'digest') { openDigest(); return; }
767
793
  const r = rowOf(key); if (!r) return;
768
- if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow' || /^(so|sb)-/.test(act))) noteUse('ym-act'); // your-move's health number
794
+ if (r.tier != null && (act === 'open' || act === 'done' || act === 'tomorrow' || /^(so|sb|sw)-/.test(act))) noteUse('ym-act'); // your-move's health number
769
795
  if (act === 'q-remind') { remindQuestion(r.ref); return; }
770
796
  if (act === 'open') { open(r); return; }
771
797
  if (act === 'so-open') { signoffOpen(r); return; }
@@ -783,6 +809,7 @@ export function mountToday(ctx) {
783
809
  else if (act === 'plain') await plain(r);
784
810
  else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
785
811
  else if (act === 'so-record') await signoffRecord(r);
812
+ else if (act === 'sw-yes' || act === 'sw-no') await switchPress(r, act === 'sw-yes');
786
813
  else if (act === 'so-ask') await signoffAsk(r);
787
814
  else if (act === 'sb-keep' || act === 'sb-change') await signoffSuggest(r, act === 'sb-keep');
788
815
  else if (act === 'lk-yes' || act === 'lk-no') await looks(r, act === 'lk-yes');
@@ -143,7 +143,7 @@ function typeOf(r) {
143
143
  const ref = r.ref || {};
144
144
  if (r.bullet === 'note' || r.src === 'note') return 'Note';
145
145
  if (r.src === 'draft') return 'Report';
146
- if (r.src === 'lab' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by') return 'Decision';
146
+ if (r.src === 'lab' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch') return 'Decision';
147
147
  if (r.src !== 'ask') return 'Task';
148
148
  switch (ref.kind) {
149
149
  case 'mention': return 'Ask';
@@ -161,7 +161,8 @@ function typeOf(r) {
161
161
  * questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name,
162
162
  * shipOf(ini) → its ship date 'YYYY-MM-DD' or '' (Your move: a line with no default on work that ships soon blocks it), now,
163
163
  * fixed: GET /api/today-log fixed ({ [ws]: keys }, quiet-rows: the line rows Your move shows today per product),
164
- * signoffs: GET /api/stage-signoffs rows, each with its ws; signoffSuggest: its suggest list (factory-signoffs-reach-you) }
164
+ * signoffs: GET /api/stage-signoffs rows, each with its ws; signoffSuggest: its suggest list (factory-signoffs-reach-you);
165
+ * switches: GET /api/switches rows with a waiting turn, each with its ws (switch-owners) }
165
166
  * quiet-rows: the drafts in the outbox are one row, Today's batch (pm/quiet-rows.js batchRow); Your move keeps at most 3 line rows a day per
166
167
  * product (capLine), the rest wait under Later (`held`), and `toFix` is what the page writes once to the day ledger.
167
168
  * A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
@@ -272,6 +273,13 @@ export function logModel(o = {}) {
272
273
  put({ key: g.key, src: 'signoff-by', bullet: 'task', title: 'Sign-offs for ' + (g.stageName || g.stage) + ': ' + items.join(', '), ini: null, ws: g.ws || '', work: '', job: 'Decide',
273
274
  carried: 0, late: false, when: '', reason: 'PMOS suggests ' + (items.length === 1 ? 'it is' : 'they are') + ' a person’s yes, by ' + [...new Set(Object.values(g.by))].join(', '), age: 0, ref: g });
274
275
  }
276
+ // switch-owners (A263, LINE.md Rule 12): a switch turn that waits on the PM is one Decide row, ✓ "I turned it" or ✕ "keep it". PMOS turns nothing
277
+ for (const w of o.switches || []) {
278
+ if (!w || !w.id || !w.waiting) continue;
279
+ const at = String(w.waiting.at || '').slice(0, 10);
280
+ put({ key: 'switch:' + (w.ws || '') + ':' + w.id, src: 'switch', bullet: 'task', title: 'Turn ' + w.name + ' ' + w.waiting.to + ' for ' + w.customer, ini: null, ws: w.ws || '', work: '', job: 'Decide',
281
+ carried: 0, late: false, when: '', reason: 'Waits for you: PMOS turns nothing', age: at ? Math.max(0, between(at, today) || 0) : 0, ref: w });
282
+ }
275
283
  oneLine(out);
276
284
  // a row done today whose source has let it go keeps its × from what it said when it was done
277
285
  for (const [k, m] of Object.entries(marks)) {
@@ -448,10 +456,10 @@ export function costOf(r, today, shipOf = () => '') {
448
456
  if (r.type === 'Ask' && !(r.who && r.who.length)) return null; // nobody waits on the answer
449
457
  if (r.src === 'batch') return [2, r.left == null ? QR.LAPSE_DAYS : r.left, r.why]; // quiet-rows: Today's batch, a send today, soonest lapse first
450
458
  const ref = r.ref || {}, c = ref.call || null, ld = lateDays(r, today);
451
- const waits = r.src === 'ask' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
459
+ const waits = r.src === 'ask' || r.src === 'question' || r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
452
460
  if (!waits) return null;
453
461
  if (r.src === 'own' && r.first) return [0, 0, 'You marked it first'];
454
- const age = r.src === 'question' || r.src === 'signoff' ? r.age || 0 : r.carried || 0;
462
+ const age = r.src === 'question' || r.src === 'signoff' || r.src === 'switch' ? r.age || 0 : r.carried || 0;
455
463
  const ship = r.ini ? String(shipOf(r.ini) || '') : '', sd = ship ? between(today, ship) : null;
456
464
  const dflt = r.src === 'question' && r.hasDefault && r.due ? r.due : '';
457
465
  if (sd != null && sd >= 0 && sd <= SHIP_SOON && !dflt) return [1, sd, shipWhy(ship, today) + (r.src === 'question' ? '; no safe default' : '')];
@@ -461,7 +469,7 @@ export function costOf(r, today, shipOf = () => '') {
461
469
  if (r.type === 'Ask' && r.carried >= 1) return [3, -r.carried, names(r.who) + ' ' + (r.who.length > 1 ? 'wait' : 'waits') + ' on you ' + plural(r.carried, 'day', 'days')];
462
470
  if (c && c.kind === 'session' && (c.state === 'blocked' || c.state === 'needs')) return [3, 0, 'A session waits on you; its work stops until you answer'];
463
471
  if (r.src === 'question') return [4, -age, r.reason || 'Waits on you ' + plural(age, 'day', 'days')];
464
- if (r.src === 'signoff' || r.src === 'signoff-by') return [4, -age, r.reason || 'Waits on you'];
472
+ if (r.src === 'signoff' || r.src === 'signoff-by' || r.src === 'switch') return [4, -age, r.reason || 'Waits on you'];
465
473
  const w = whyOf(r, today);
466
474
  return [4, -age, w && !/^Waits on you$/.test(w) ? w : age ? 'Waits on you ' + plural(age, 'day', 'days') : 'Waits on you'];
467
475
  }
@@ -84,6 +84,12 @@ export function signoffActs(r) {
84
84
  return ib('so-ask', 'Ask in the tracker: ' + (s.draft || t), I.send, r.key);
85
85
  }
86
86
 
87
+ /** switch-owners (A263): ✓ records that the PM turned the switch in the product; ✕ keeps it as it is. PMOS turns nothing itself. */
88
+ export function switchActs(r) {
89
+ const w = r.ref || {}, to = (w.waiting || {}).to || '';
90
+ return ib('sw-yes', 'I turned ' + w.name + ' ' + to + ' for ' + w.customer, I.yes, r.key) + ib('sw-no', 'Keep ' + w.name + ' ' + (w.on ? 'on' : 'off') + ' for ' + w.customer, I.no, r.key);
91
+ }
92
+
87
93
  /** name-links (A536): the words of a line you typed, with the names that resolve to one record as links (r.ref.links: GET /api/name-links);
88
94
  * any other row's words, escaped. The words never change. */
89
95
  export function ownWords(r) { return r && r.src === 'own' && r.ref && r.ref.links ? linkedHtml(r.title, r.ref.links, esc) : esc(r && r.title); }
@@ -96,6 +102,7 @@ export function rowHtml(r, o = {}) {
96
102
  if (!r.done && r.src !== 'note') {
97
103
  if (r.src === 'question') acts = ib('open', 'Answer: ' + t, I.decide, r.key); // the register's line: it is answered where it opens, not marked done here
98
104
  else if (r.src === 'signoff' || r.src === 'signoff-by') acts = signoffActs(r);
105
+ else if (r.src === 'switch') acts = switchActs(r);
99
106
  else if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
100
107
  else {
101
108
  const j = JOB_ACT[r.job];
@@ -184,12 +191,13 @@ export function overviewHtml(O) {
184
191
  * work, the kind, the age), the ✦ line that says why it is in that place, and two icon Buttons: one action for its kind, and Put off a day. */
185
192
  export const YM_SHOW = 5;
186
193
  const KIND_WORD = { Ask: 'reply', Decision: 'a decision', Check: 'a check', Milestone: 'a date change', Task: 'task', Report: 'a draft to send' };
187
- const ageOf = (r) => Math.max(0, r.src === 'question' || r.src === 'signoff' ? r.age || 0 : r.carried || 0);
194
+ const ageOf = (r) => Math.max(0, r.src === 'question' || r.src === 'signoff' || r.src === 'switch' ? r.age || 0 : r.carried || 0);
188
195
  /** The one action of a Your move row: an answer, a reply, a decision or a send opens the item; a thing to do is Done. */
189
196
  function moveAct(r) {
190
197
  const t = r.title;
191
198
  if (r.src === 'question') return ib('open', 'Answer: ' + t, I.decide, r.key);
192
199
  if (r.src === 'signoff' || r.src === 'signoff-by') return signoffActs(r);
200
+ if (r.src === 'switch') return switchActs(r);
193
201
  const j = JOB_ACT[r.job];
194
202
  if (j) return ib('open', j[1] + ': ' + t, j[2], r.key);
195
203
  if (r.members) return ib('open', 'Show them: ' + t, I.more, r.key, ` aria-expanded="false"`);
@@ -343,6 +351,7 @@ export function swipeActs(r) {
343
351
  if (r.looks) return { right: 'lk-yes', left: 'lk-no' };
344
352
  if (r.members && r.drafts) return { right: 'same-yes', left: 'same-no' };
345
353
  // a Your move row (your-move): right does its action, so a reply, an answer, a decision or a send opens the item; left puts it off a day
354
+ if (r.src === 'switch') return { right: '', left: 'tomorrow' }; // a turn is recorded by a press, never by a swipe
346
355
  if (r.src === 'signoff-by') return { right: 'sb-keep', left: 'tomorrow' };
347
356
  if (r.src === 'signoff') { const a = (r.ref || {}).action; return { right: a === 'record' ? 'so-record' : a === 'open' ? 'so-open' : 'so-ask', left: 'tomorrow' }; }
348
357
  if (r.tier != null && (r.src === 'question' || JOB_ACT[r.job] || r.members)) return { right: 'open', left: 'tomorrow' };
@@ -6,6 +6,8 @@
6
6
  * dashModel(lines) → { n, stuck, text } | null Today's dashed line under Your move ("9 more move in the line by themselves · 1 stuck")
7
7
  * dashHtml(D) → the dashed line, a link to /premium-board.html?work=line
8
8
  *
9
+ * krChip(r) → "Serves KR1.1" under a row's name when its parent_kr names a key result of the OKR file (tb-work-kr), else ''
10
+ *
9
11
  * rows: lib/line.js lineOf rows (GET /api/line), each with its product (ws). you: Set of '<ws>|<initiative>' that have a Your move row (a question
10
12
  * to the PM, a check due). A row in Your move is marked "waits on you" here and not repeated on Today. Waiting (capacity, on hold, another initiative) is never
11
13
  * stuck and reads "waiting"; a moving row past its stage's expected days reads "over time". "Can't tell" never moves an item and never raises a row. The UI says PMOS. Text from records goes through esc(). */
@@ -77,6 +79,16 @@ export function lineModel(rows, o = {}) {
77
79
  const groups = workflows.flatMap((w) => w.groups);
78
80
  return { workflows, groups, counts, tab, live: all.length };
79
81
  }
82
+ /** The key result a row serves (tb-work-kr, board TbWork): "Serves KR1.1" under the name, its words in the title; it opens the product's goals
83
+ * on Intelligence. A row with no key result (r.kr from lib/line.js, set only when its parent_kr names one in the OKR file) draws nothing. */
84
+ export const KR_HREF = '/premium-intelligence.html';
85
+ export function krChip(r) {
86
+ const k = r && r.kr;
87
+ if (!k || !k.token) return '';
88
+ const words = [k.token + (k.title ? ' · ' + k.title : ''), k.objective && k.objective.token ? k.objective.token + (k.objective.title ? ' · ' + k.objective.title : '') : ''].filter(Boolean).join(' — ');
89
+ const href = KR_HREF + (r.ws ? '?ws=' + encodeURIComponent(r.ws) : '');
90
+ return `<a class="ln-kr pm-chip" href="${esc(href)}" data-line-kr="${esc(k.token)}" title="${esc(words)}">Serves ${esc(k.token)}</a>`;
91
+ }
80
92
  /** The Line block: one Komorebi table (pm-table). M: lineModel(). o: { name: the product's name, say: a line above the table } */
81
93
  export function lineHtml(M, o = {}) {
82
94
  if (!M || !M.live) return `<section class="pm-block ln" aria-label="The line"><p class="pm-meta">No initiative is on a workflow yet, so the line is empty.</p></section>`;
@@ -85,7 +97,7 @@ export function lineHtml(M, o = {}) {
85
97
  const many = (M.workflows || []).length > 1;
86
98
  const row = (r) => {
87
99
  const d = daysOf(r), [word, cls] = STATE[r.state];
88
- return `<tr class="ln-r ln-${r.state}"><th scope="row" class="ln-c-ini"><button type="button" class="ln-name" data-line-ini="${esc(r.id)}" data-line-ws="${esc(r.ws || '')}">${esc(r.title || r.id)}</button></th>`
100
+ return `<tr class="ln-r ln-${r.state}"><th scope="row" class="ln-c-ini"><button type="button" class="ln-name" data-line-ini="${esc(r.id)}" data-line-ws="${esc(r.ws || '')}">${esc(r.title || r.id)}</button>${krChip(r)}</th>`
89
101
  + `<td class="ln-c-days${d.over && (r.state === 'late' || r.state === 'stuck') ? ' ln-over' : ''}">${d.text ? `<span class="ln-d">${esc(d.text)}</span>` : ''}${d.sub ? `<span class="ln-sub">${esc(d.sub)}</span>` : ''}</td>`
90
102
  + `<td class="ln-c-fin">${esc(toFinish(r))}</td>`
91
103
  + `<td class="ln-c-st"><span class="pm-badge${cls ? ' ' + cls : ''}" title="${esc(r.why || '')}">${esc(word)}</span></td></tr>`;
@@ -30,10 +30,24 @@ function wordKind(w) {
30
30
  return '';
31
31
  }
32
32
 
33
- /** The item's kind from its own fields (kind, lane, type, issuetype), never from its title. */
33
+ /** The kind a workflow's name (or id) names: "Simple feature" → feature, "Bug triage" → fix; '' when it names none. */
34
+ export function workflowKind(wf) {
35
+ if (!wf || typeof wf !== 'object') return '';
36
+ for (const src of [wf.name, wf.id]) {
37
+ const w = norm(String(src == null ? '' : src).replace(/[-]+/g, ' ')).split(' ').filter(Boolean);
38
+ for (let i = 0; i < w.length; i++) { const k = wordKind(w[i] + ' ' + (w[i + 1] || '')) || wordKind(w[i]); if (k) return k; }
39
+ }
40
+ return '';
41
+ }
42
+
43
+ /** The item's kind from its own fields, never from its title. An initiative on a workflow (a row with `wf`): the kind its workflow
44
+ * names, else its lane; a legacy `type:` decides nothing there, since the workflow sets the kind (kind-follows-workflow, #1731).
45
+ * Any other item: kind, lane, type (a Jira issue type). */
34
46
  export function kindOf(item) {
35
47
  if (!item || typeof item !== 'object') return 'other';
36
- for (const f of ['kind', 'lane', 'type', 'issuetype']) {
48
+ const onWf = item.wf && typeof item.wf === 'object';
49
+ if (onWf) { const k = workflowKind(item.wf); if (k) return k; }
50
+ for (const f of onWf ? ['lane'] : ['kind', 'lane', 'type', 'issuetype']) {
37
51
  const v = valOf(item[f]);
38
52
  const k = wordKind(v && typeof v === 'object' ? v.name : v);
39
53
  if (k) return k;