create-pmos 0.828.0 → 0.830.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/package.json +237 -35
  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-deliveries-test.js +2 -2
  7. package/workspace/briefing-premium-board-test.js +1 -1
  8. package/workspace/briefing-premium-insights-test.js +1 -1
  9. package/workspace/changelog.json +236 -8
  10. package/workspace/guide/agent-capabilities.md +1 -1
  11. package/workspace/guide/backlog.md +12 -1
  12. package/workspace/guide/cli.md +46 -1
  13. package/workspace/guide/home.md +2 -1
  14. package/workspace/guide/layout.md +1 -0
  15. package/workspace/guide/settings-and-switches.md +1 -0
  16. package/workspace/lib/board-premium.js +1 -0
  17. package/workspace/lib/code-map.js +8 -2
  18. package/workspace/lib/critical-needs.js +162 -0
  19. package/workspace/lib/deps-cli.js +102 -0
  20. package/workspace/lib/engine/boards.js +13 -2
  21. package/workspace/lib/factory-floor.js +16 -8
  22. package/workspace/lib/features.json +17 -13
  23. package/workspace/lib/needs-providers.js +1 -0
  24. package/workspace/lib/page-one-answer.js +86 -0
  25. package/workspace/lib/pages-cli.js +6 -2
  26. package/workspace/lib/people-cli.js +9 -1
  27. package/workspace/lib/people-prep.js +140 -0
  28. package/workspace/lib/pmos-verbs.js +10 -0
  29. package/workspace/lib/print-cli.js +49 -0
  30. package/workspace/lib/print-pdf.js +96 -0
  31. package/workspace/lib/prototype-cli.js +86 -0
  32. package/workspace/lib/report-cli.js +12 -2
  33. package/workspace/lib/report-readers.js +5 -3
  34. package/workspace/lib/review-pack.js +348 -0
  35. package/workspace/lib/review-reasons.js +121 -9
  36. package/workspace/lib/route-modules.js +5 -0
  37. package/workspace/lib/routes-boards.js +25 -2
  38. package/workspace/lib/routes-report-design.js +3 -1
  39. package/workspace/lib/routes-review-pack.js +42 -0
  40. package/workspace/lib/routes-roadmap-ops.js +53 -1
  41. package/workspace/lib/routes-sim-users.js +66 -0
  42. package/workspace/lib/routes-skill-map.js +39 -0
  43. package/workspace/lib/routes-strategy-card.js +13 -6
  44. package/workspace/lib/routes-team-waits.js +24 -0
  45. package/workspace/lib/sim-users.js +329 -0
  46. package/workspace/lib/skill-map.js +199 -0
  47. package/workspace/lib/task-store.js +1 -1
  48. package/workspace/lib/team-cli.js +20 -1
  49. package/workspace/lib/team-waits.js +167 -0
  50. package/workspace/lib/tradeoff-cards.js +258 -0
  51. package/workspace/lib/tradeoff-cli.js +83 -0
  52. package/workspace/package-lock.json +2 -2
  53. package/workspace/package.json +1 -1
  54. package/workspace/public/pm/action-keys.js +1 -0
  55. package/workspace/public/pm/ask-here-ctx.js +25 -1
  56. package/workspace/public/pm/ask-here.css +7 -0
  57. package/workspace/public/pm/ask-here.js +15 -2
  58. package/workspace/public/pm/bd-backlog.css +61 -0
  59. package/workspace/public/pm/bd-backlog.js +99 -7
  60. package/workspace/public/pm/bd-work.js +12 -1
  61. package/workspace/public/pm/code-map.js +15 -4
  62. package/workspace/public/pm/cozy-board.css +5 -1
  63. package/workspace/public/pm/cozy-library.css +5 -0
  64. package/workspace/public/pm/cozy-pop-work.js +4 -1
  65. package/workspace/public/pm/cozy-proto.css +5 -0
  66. package/workspace/public/pm/cozy-proto.js +11 -3
  67. package/workspace/public/pm/cozy-search.js +2 -2
  68. package/workspace/public/pm/cozy-today-app.js +5 -2
  69. package/workspace/public/pm/day-time.js +8 -0
  70. package/workspace/public/pm/factory.js +199 -0
  71. package/workspace/public/pm/home-ini.js +3 -2
  72. package/workspace/public/pm/ini-links.js +2 -1
  73. package/workspace/public/pm/ini-tasks.js +5 -2
  74. package/workspace/public/pm/ini-view-model.js +14 -6
  75. package/workspace/public/pm/ini-view.js +12 -2
  76. package/workspace/public/pm/library-model.js +1 -1
  77. package/workspace/public/pm/page-one-answer.css +18 -0
  78. package/workspace/public/pm/page-one-answer.js +134 -0
  79. package/workspace/public/pm/pop-cap.js +5 -3
  80. package/workspace/public/pm/pop-work-model.js +8 -6
  81. package/workspace/public/pm/portfolio.js +1 -1
  82. package/workspace/public/pm/premium-board.js +23 -6
  83. package/workspace/public/pm/premium-library.js +27 -3
  84. package/workspace/public/pm/premium-report-read.js +11 -2
  85. package/workspace/public/pm/print-pdf.js +191 -0
  86. package/workspace/public/pm/range-pick.css +12 -0
  87. package/workspace/public/pm/range-pick.js +30 -6
  88. package/workspace/public/pm/review-pack.js +47 -0
  89. package/workspace/public/pm/review-reasons.js +19 -5
  90. package/workspace/public/pm/sim-users.js +34 -0
  91. package/workspace/public/pm/skill-map.js +57 -0
  92. package/workspace/public/pm/sort-order.js +3 -0
  93. package/workspace/public/pm/task-card.js +10 -7
  94. package/workspace/public/pm/team-waits.js +56 -0
  95. package/workspace/public/pm/tradeoff-cards.css +27 -0
  96. package/workspace/public/pm/tradeoff-cards.js +183 -0
  97. package/workspace/public/premium-board.html +3 -0
  98. package/workspace/public/today.html +1 -0
  99. package/workspace/run-tests.js +9 -1
  100. package/workspace/test-lists/critical-needs.json +9 -0
  101. package/workspace/test-lists/factory-page-ui.json +9 -0
  102. package/workspace/test-lists/page-one-answer.json +9 -0
  103. package/workspace/test-lists/people-prep.json +9 -0
  104. package/workspace/test-lists/print-pdf.json +9 -0
  105. package/workspace/test-lists/review-pack.json +9 -0
  106. package/workspace/test-lists/sim-users.json +9 -0
  107. package/workspace/test-lists/skill-map.json +9 -0
  108. package/workspace/test-lists/surface-ask-card.json +9 -0
  109. package/workspace/test-lists/task-time-optional.json +9 -0
  110. package/workspace/test-lists/team-waits.json +9 -0
  111. package/workspace/test-lists/tradeoff-cards.json +9 -0
  112. package/workspace/test-lists/voice-files.json +9 -0
  113. package/workspace/test-timings.json +25 -0
@@ -7,6 +7,8 @@
7
7
  * (field → record → section → page), ⤢ moves the talk into the one full chat (page-chat.js openAbout), × or Esc closes.
8
8
  * the record its card catalog row, live (chat-cards.js, GET /api/card-rows) with the catalog's own buttons; a pressed due date of a task
9
9
  * or a milestone brings the catalog's "Move the date" picker. Every press is one pmos command with Undo (action-run.js).
10
+ * can do what PMOS can do for that kind of record (initiative surface-ask-card): the features whose lib/features.json row names the kind
11
+ * in `ask` (GET /api/features, read once); one press asks the feature's command about this record in the chat. None: no line.
10
12
  * ✦ lines three questions for that kind of thing and field; one press asks it.
11
13
  * the chat the one chat of the page (page-chat.js box(): the same element and conversation the popup shows), opened on the record's own
12
14
  * conversation (itemTarget: pop:<kind>:<id>, its first message carries what was pressed); answers come back with live cards.
@@ -23,6 +25,7 @@ import { noteUse } from './use-log.js';
23
25
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
24
26
  const P = (d) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
25
27
  const I = { up: 'M12 19V5M6 11l6-6 6 6', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', x: 'M6 6l12 12M18 6L6 18', star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
28
+ let FEATS = null; // GET /api/features' rows, read once per page (the Ask card's "What PMOS can do" line)
26
29
  const S = { card: null, ctx: null, el: null, ring: null, ws: '', chat: null, chatEl: null, home: null, CU: null, row: undefined, today: '', key: 0, off: null };
27
30
  const toast = (m) => { const t = document.getElementById('toast'); if (!t) return; t.textContent = m; t.classList.add('on'); setTimeout(() => t.classList.remove('on'), 4200); };
28
31
 
@@ -100,13 +103,21 @@ function draw() {
100
103
  + `<button type="button" class="ah-icb" data-ah="up" aria-label="Ask about the bigger part instead" title="Ask about the bigger part instead"${top ? ' disabled' : ''}>${P(I.up)}</button>`
101
104
  + `<button type="button" class="ah-icb" data-ah="full" aria-label="Open in the full chat" title="Open in the full chat">${P(I.expand)}</button>`
102
105
  + `<button type="button" class="ah-icb" data-ah="x" aria-label="Close" title="Close">${P(I.x)}</button></div>`
103
- + '<div class="ah-bd"><div class="ah-rec" id="ahRec"></div>'
106
+ + '<div class="ah-bd"><div class="ah-rec" id="ahRec"></div><div id="ahDo"></div>'
104
107
  + `<div class="ah-sug" id="ahSug">${C.questionsOf(ctx).map((q) => `<button type="button" data-ah-q="${esc(q)}">${P(I.star)}${esc(q)}</button>`).join('')}</div></div>`
105
108
  + '<div class="ah-chat quiet" id="ahChat"></div>';
106
109
  ring();
107
110
  drawRecord();
111
+ drawActions();
108
112
  mountChat();
109
113
  }
114
+ /** What PMOS can do for the pressed record; the features are read once, and the line fills in when they arrive. */
115
+ function drawActions() {
116
+ const box = S.card && S.card.querySelector('#ahDo'); if (!box) return;
117
+ if (FEATS) { box.innerHTML = C.actionsHtml(C.actionsOf(S.ctx, FEATS)); return; }
118
+ const k = S.key;
119
+ pmGet('/api/features').then((r) => { FEATS = r && r.ok && Array.isArray(r.features) ? r.features : []; if (k === S.key) drawActions(); }).catch(() => { FEATS = []; });
120
+ }
110
121
  function ring() {
111
122
  if (S.ring) S.ring.classList.remove('ah-ring');
112
123
  S.ring = null;
@@ -152,6 +163,7 @@ function ask(q) {
152
163
  const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
153
164
  holder.classList.remove('quiet');
154
165
  const sug = S.card.querySelector('#ahSug'); if (sug) sug.hidden = true;
166
+ const can = S.card.querySelector('#ahDo'); if (can) can.hidden = true;
155
167
  const ta = holder.querySelector('textarea'), form = holder.querySelector('form.hm-box');
156
168
  if (!ta || !form) return;
157
169
  ta.value = q; ta.dispatchEvent(new Event('input', { bubbles: true }));
@@ -184,7 +196,8 @@ function wireCard() {
184
196
  if (a === 'x') { close(); return; }
185
197
  if (a === 'full') { full(); return; }
186
198
  if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
187
- const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); }
199
+ const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); return; }
200
+ const d = b.getAttribute('data-ah-do'); if (d) { noteUse('ask-here-do'); ask(d); }
188
201
  });
189
202
  card.addEventListener('input', (e) => { if (e.target && e.target.matches('textarea')) card.querySelector('#ahChat').classList.remove('quiet'); });
190
203
  const esc = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); close(); } };
@@ -278,3 +278,64 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
278
278
  .pm-ds .ln-c-fin { color: var(--ink); line-height: 1.4; }
279
279
  .pm-ds .ln-t .pm-badge.ln-ok { background: var(--leaf-tint); color: var(--leaf); }
280
280
  .pm-ds .ln-t .pm-badge.ln-late { background: none; box-shadow: inset 0 0 0 1px var(--alert); color: var(--alert); }
281
+
282
+ /* ── Work › Factory (factory-page-ui; boards FxFloor and FxStation on the main canvas) ── pm/factory.js draws it. Komorebi tokens only.
283
+ * Every class starts with ff- (the page) or fx- (the station popup). Zero is silence: a quiet station is grey and has no numbers. */
284
+ .pm-ds .ff { display: flex; flex-direction: column; gap: var(--space-16); padding: var(--space-16) 0; }
285
+ .pm-ds .ff-andon { display: flex; gap: var(--space-12); align-items: flex-start; margin: 0; padding: var(--space-12) var(--space-16); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); color: var(--ink); font-size: var(--fs-row); line-height: 1.45; }
286
+ .pm-ds .ff-andon small { display: block; color: var(--muted); font-size: var(--fs-meta); }
287
+ .pm-ds .ff-andon .bd-lamp { flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--leaf); }
288
+ .pm-ds .ff-andon.alert { background: var(--alert-tint); border-color: var(--alert); }
289
+ .pm-ds .ff-andon.alert .bd-lamp { background: var(--alert); }
290
+ .pm-ds .ff-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr) 14px) minmax(0, 1fr); align-items: stretch; }
291
+ .pm-ds .ff-arr { align-self: center; text-align: center; color: var(--muted); font-size: var(--fs-row); }
292
+ .pm-ds :is(.ff-st, .ff-side) { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--space-12); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }
293
+ .pm-ds :is(.ff-st, .ff-side).con { box-shadow: inset 3px 0 0 var(--alert); }
294
+ .pm-ds :is(.ff-st, .ff-side).quiet { background: var(--well); color: var(--muted); }
295
+ .pm-ds :is(.ff-st, .ff-side) header { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: var(--fs-row); }
296
+ .pm-ds :is(.ff-st, .ff-side).quiet header { color: var(--muted); }
297
+ .pm-ds :is(.ff-st, .ff-side) header b { flex: 1; min-width: 0; font-weight: var(--fw-strong); }
298
+ .pm-ds .ff-ic svg, .pm-ds .ff-open svg, .pm-ds .ff-undo svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
299
+ .pm-ds .ff-open, .pm-ds .ff-undo { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-md); color: var(--muted); cursor: pointer; }
300
+ .pm-ds .ff-open:hover, .pm-ds .ff-undo:hover { background: var(--well); color: var(--ink); }
301
+ .pm-ds .ff-open:focus-visible, .pm-ds .ff-undo:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
302
+ .pm-ds .ff-you.con .ff-go { background: var(--blue); color: var(--on-blue); }
303
+ .pm-ds .ff-does { margin: 0; color: var(--muted); font-size: var(--fs-meta); line-height: 1.4; }
304
+ .pm-ds .ff-kv { display: flex; justify-content: space-between; gap: var(--space-8); font-size: var(--fs-meta); color: var(--muted); }
305
+ .pm-ds .ff-kv b { color: var(--ink); font-weight: var(--fw-strong); font-variant-numeric: tabular-nums; }
306
+ .pm-ds .ff-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-12); }
307
+ .pm-ds .ff-line { margin: 0; color: var(--ink); font-size: var(--fs-row); line-height: 1.45; }
308
+ .pm-ds .ff-side.quiet .ff-line { color: var(--muted); }
309
+ .pm-ds .ff-goals { padding: var(--space-12) var(--space-16); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }
310
+ .pm-ds .ff-goals h3 { margin: 0 0 var(--space-8); font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--ink); }
311
+ .pm-ds .ff-goals h3 small { margin-left: 6px; font-weight: var(--fw-regular); color: var(--muted); font-size: var(--fs-meta); }
312
+ .pm-ds .ff-goals ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
313
+ .pm-ds .ff-goal { display: grid; grid-template-columns: minmax(0, 2fr) auto minmax(0, 3fr); gap: var(--space-12); align-items: center; font-size: var(--fs-row); color: var(--ink); }
314
+ .pm-ds .ff-gn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
315
+ .pm-ds .ff-gc { color: var(--muted); font-size: var(--fs-meta); white-space: nowrap; }
316
+ .pm-ds .ff-seg { display: flex; height: 10px; gap: 2px; border-radius: var(--radius-pill); overflow: hidden; }
317
+ .pm-ds .ff-seg i { display: block; flex: 1 1 0; min-width: 2px; }
318
+ .pm-ds .ff-legend i { display: block; }
319
+ .pm-ds .ff-legend { display: flex; flex-wrap: wrap; gap: var(--space-12); margin: var(--space-12) 0 0; color: var(--muted); font-size: var(--fs-meta); }
320
+ .pm-ds .ff-legend span { display: inline-flex; align-items: center; gap: 4px; }
321
+ .pm-ds .ff-legend i { width: 10px; height: 10px; border-radius: 2px; }
322
+ .pm-ds .ff-note { margin: var(--space-8) 0 0; color: var(--muted); font-size: var(--fs-meta); }
323
+ /* the stage colours: the system's own hues, in workflow order */
324
+ .pm-ds .ff .c0 { background: var(--muted); } .pm-ds .ff .c1 { background: var(--blue); } .pm-ds .ff .c2 { background: color-mix(in oklab, var(--blue) 55%, var(--leaf)); }
325
+ .pm-ds .ff .c3 { background: var(--leaf); } .pm-ds .ff .c4 { background: color-mix(in oklab, var(--leaf) 50%, var(--alert)); } .pm-ds .ff .c5 { background: var(--alert); }
326
+ @media (max-width: 1100px) { .pm-ds .ff-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-12); } .pm-ds .ff-arr { display: none; } }
327
+ @media (max-width: 760px) { .pm-ds .ff-flow, .pm-ds .ff-sides { grid-template-columns: minmax(0, 1fr); } .pm-ds .ff-goal { grid-template-columns: minmax(0, 1fr) auto; } .pm-ds .ff-seg { grid-column: 1 / -1; } }
328
+ /* the station popup (one panel, the system's sheet) */
329
+ .fx-sheet { display: flex; flex-direction: column; gap: 16px; }
330
+ .fx-sheet .fx-sec h4 { display: flex; gap: 6px; margin: 0 0 6px; font-size: var(--fs-row); font-weight: var(--fw-strong); }
331
+ .fx-sheet .fx-sec h4 span { color: var(--muted); font-weight: var(--fw-regular); }
332
+ .fx-sheet ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
333
+ .fx-sheet li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-row); }
334
+ .fx-sheet li b { font-weight: var(--fw-strong); overflow-wrap: anywhere; }
335
+ .fx-sheet li span { grid-column: 1; color: var(--muted); font-size: var(--fs-meta); }
336
+ .fx-sheet li .ff-undo { grid-column: 2; grid-row: 1 / span 2; }
337
+ .fx-sheet .ff-undo svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
338
+ .fx-sheet .fx-more, .fx-sheet p { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-meta); }
339
+ .fx-sheet .fx-fold summary { cursor: pointer; padding: 6px 0; font-size: var(--fs-meta); color: var(--muted); }
340
+ .fx-sheet .ff-undo { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-md); cursor: pointer; }
341
+ .fx-sheet .ff-undo:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@@ -21,7 +21,10 @@ import * as WS from './work-select.js'; // the bulk move with one Undo, shared
21
21
  import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
22
22
  import * as LE from './live-edit.js'; // a task's status or days show at once in the list, before it is read again; a failed save is put back
23
23
  import { noteUse } from './use-log.js'; // the sprint draft's presses, counted on this computer only (sprint-draft-capacity)
24
- import * as LV from './line-view.js';
24
+ import { pmGet } from './http.js'; // Work › Factory and Work › Dependencies read through the page's own GET helper
25
+ import * as TWV from './team-waits.js'; // team-waits (A364): Work › Dependencies, the waits on other teams (GET /api/team-waits)
26
+ import * as LV from './line-view.js'; // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
27
+ import * as FV from './factory.js'; // Work › Factory (factory-page-ui): the stations and the work they make, from GET /api/factory
25
28
  import * as LB from './list-balance.js'; // the balance meter under the Backlog header (bet A448, board BalanceDS) // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
26
29
  import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
27
30
 
@@ -68,14 +71,20 @@ export function tabOf() {
68
71
  if (q === 'backlog') return 'bk';
69
72
  if (q === 'sprint') return 'sp';
70
73
  if (q === 'line') return 'ln';
74
+ if (q === 'factory') return 'fx';
75
+ if (q === 'deps') return 'dp';
71
76
  if (q === 'initiatives') return 'ini';
72
77
  const v = (get(KEY, {}) || {})[scopeKey()];
73
- return v === 'bk' || v === 'sp' || v === 'ln' ? v : 'ini';
78
+ return v === 'bk' || v === 'sp' || v === 'ln' || v === 'fx' || v === 'dp' ? v : 'ini';
74
79
  }
75
80
  /** Is a task tab (Backlog or This sprint) the view now? */
76
81
  export const on = () => tabOf() === 'bk' || tabOf() === 'sp';
77
82
  /** Is the Line tab the view now? (quiet-rows slice B) */
78
83
  export const lineOn = () => tabOf() === 'ln';
84
+ /** Is the Factory tab the view now? (factory-page-ui) */
85
+ export const factoryOn = () => tabOf() === 'fx';
86
+ /** Is the Dependencies tab the view now? (team-waits) */
87
+ export const depsOn = () => tabOf() === 'dp';
79
88
  function setOn(v) {
80
89
  v = v === true ? 'bk' : v === false ? 'ini' : v;
81
90
  const m = get(KEY, {}) || {}; m[scopeKey()] = v; put(KEY, m);
@@ -125,7 +134,9 @@ export async function load() {
125
134
  /** Work's three tab names: a desk says "This sprint" and no count; a phone says "Backlog 14" and "Sprint" (PhoneWorkDS, job 1540).
126
135
  * Zero is silence: no count when the Backlog is empty or not read yet. */
127
136
  // the Line (quiet-rows-line) is a five-column table for a desk; a phone keeps its three tabs (Today's dashed line is desk-only too)
128
- export const tabNames = (phone, n) => [['ini', 'Initiatives'], ...(phone ? [] : [['ln', 'Line']]), ['bk', 'Backlog' + (phone && n > 0 ? ` <span class="bk-swn">${Number(n)}</span>` : '')], ['sp', phone ? 'Sprint' : 'This sprint']];
137
+ // the Factory (factory-page-ui) sits beside Line, a desk's too: its tiles are a row of five
138
+ // Dependencies (team-waits) is a desk tab as well: a phone keeps its three
139
+ export const tabNames = (phone, n) => [['ini', 'Initiatives'], ...(phone ? [] : [['ln', 'Line'], ['fx', 'Factory']]), ['bk', 'Backlog' + (phone && n > 0 ? ` <span class="bk-swn">${Number(n)}</span>` : '')], ['sp', phone ? 'Sprint' : 'This sprint'], ...(phone ? [] : [['dp', 'Dependencies']])];
129
140
  const phoneNow = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
130
141
  function drawSwitch() {
131
142
  if (!sw) return;
@@ -136,13 +147,15 @@ function drawSwitch() {
136
147
  sw.innerHTML = tabNames(ph, ph && DATA ? backlogOf().length : 0).map(([k, n]) => tb(k, n)).join('');
137
148
  }
138
149
  function apply() {
139
- const bk = on(), ln = lineOn();
150
+ const bk = on(), ln = lineOn(), fx = factoryOn(), dp = depsOn();
140
151
  if (tabOf() === 'sp') CHIPS.add('sprint');
141
152
  document.body.classList.toggle('sp-on', tabOf() === 'sp');
142
- document.body.classList.toggle('bk-on', bk || ln);
143
- if (host) host.hidden = !(bk || ln);
153
+ document.body.classList.toggle('bk-on', bk || ln || fx || dp);
154
+ if (host) host.hidden = !(bk || ln || fx || dp);
144
155
  drawSwitch();
145
156
  if (ln) { closeAll(); drawLine(); return; }
157
+ if (fx) { closeAll(); drawFactory(); return; }
158
+ if (dp) { closeAll(); drawDeps(); return; }
146
159
  if (bk) { if (!DATA || scopeKey() !== lastScope) { lastScope = scopeKey(); host.innerHTML = '<p class="bk-wait">Reading the tasks…</p>'; load(); } else draw(); }
147
160
  else closeAll();
148
161
  }
@@ -179,6 +192,85 @@ function linePress(e) {
179
192
  return false;
180
193
  }
181
194
 
195
+ /* ── the Factory tab (factory-page-ui, boards FxFloor and FxStation) ── the saved snapshot per product, from GET /api/factory ── */
196
+ const FX = { got: null, key: '', used: false, undone: new Set(), sheet: null, at: 0 };
197
+ async function readFactory() {
198
+ const ws = [...new Set(A.scope().map((s) => s.ws || ''))];
199
+ const got = await Promise.all(ws.map((w) => Promise.resolve(pmGet('/api/factory' + (w ? '?ws=' + encodeURIComponent(w) : ''))).catch(() => null)));
200
+ return got.filter((r) => r && r.ok).flatMap((r) => r.products || []);
201
+ }
202
+ const fxModel = () => FV.floorModel(FX.got || []);
203
+ function drawFactory() {
204
+ if (!host) return;
205
+ const k = scopeKey();
206
+ if (!FX.used) { FX.used = true; noteUse('factoryOpen'); console.info('[factory-page] factory tab opened'); }
207
+ // the snapshot changes only after a Driver run: a read a minute old is still the newest
208
+ if (!FX.got || FX.key !== k || Date.now() - FX.at > 60000) {
209
+ const first = !FX.got || FX.key !== k;
210
+ FX.key = k; FX.at = Date.now();
211
+ if (first) host.innerHTML = '<p class="bk-wait">Reading the factory…</p>';
212
+ readFactory().then((g) => { FX.got = g; if (factoryOn()) drawFactory(); });
213
+ if (first) return;
214
+ }
215
+ const goals = A && A.work ? FV.goalsModel(A.work()) : null;
216
+ host.innerHTML = FV.floorHtml(fxModel(), { goals });
217
+ }
218
+ function openStation(key) {
219
+ const st = key === 'check' ? fxModel().check : fxModel().stations.find((s) => s.key === key);
220
+ if (!st) return;
221
+ const body = document.createElement('div');
222
+ const fill = () => { body.innerHTML = FV.stationHtml(st, { undone: FX.undone }); };
223
+ fill();
224
+ body.addEventListener('click', async (e) => {
225
+ const b = e.target.closest('[data-fx-undo]'); if (!b || b.disabled) return;
226
+ b.disabled = true;
227
+ const r = await AP().post('/api/autonomy/undo', { ws: b.dataset.fxWs || undefined, ref: b.dataset.fxUndo }).catch(() => null);
228
+ if (r && r.ok) { FX.undone.add((b.dataset.fxWs || '') + '|' + b.dataset.fxUndo); fill(); if (AP().say) AP().say('Undone.'); }
229
+ else { b.disabled = false; if (AP().say) AP().say((r && r.error) || 'The change could not be undone. Try again in a moment.'); }
230
+ });
231
+ import('./primitives.js').then((P) => {
232
+ if (FX.sheet && FX.sheet.open) FX.sheet.close(); // one item, one panel (panel rule)
233
+ FX.sheet = P.sheet({ title: FV.NAMES[key], sub: FV.DOES[key], body: [body], attrs: { 'data-fx-sheet': key } });
234
+ });
235
+ }
236
+ /** A press in the Factory tab: a station's open button. true when it was one. */
237
+ function factoryPress(e) {
238
+ if (!factoryOn()) return false;
239
+ const b = e.target.closest('[data-fx-st]');
240
+ if (b) { openStation(b.dataset.fxSt); return true; }
241
+ return !!e.target.closest('.ff');
242
+ }
243
+ /* ── the Dependencies tab (team-waits, board BatchCodeDS panel 14) ── the pick's waits on other teams, from GET /api/team-waits ── */
244
+ const DP = { got: null, key: '', used: false, rows: [] };
245
+ async function readDeps() {
246
+ const ws = [...new Set(A.scope().map((s) => s.ws || ''))];
247
+ const got = await Promise.all(ws.map((w) => pmGet('/api/team-waits' + (w ? '?ws=' + encodeURIComponent(w) : '')).catch(() => null)));
248
+ return got.filter((r) => r && r.ok).map((r) => ({ ws: r.ws, today: r.today, waits: (r.waits || []).map((x) => ({ ...x, ws: r.ws })) }));
249
+ }
250
+ function drawDeps() {
251
+ if (!host) return;
252
+ const k = scopeKey();
253
+ if (!DP.used) { DP.used = true; noteUse('team-waits'); console.info('[team-waits] dependencies tab opened'); } // the health number: one open per page load
254
+ if (!DP.got || DP.key !== k) {
255
+ DP.key = k; host.innerHTML = '<p class="bk-wait">Reading what your work waits on…</p>';
256
+ readDeps().then((g) => { DP.got = g; if (depsOn()) drawDeps(); });
257
+ return;
258
+ }
259
+ const today = (DP.got[0] || {}).today || '';
260
+ const waits = DP.got.flatMap((g) => g.waits).sort((a, b) => String(a.since).localeCompare(String(b.since)));
261
+ DP.rows = TWV.rowsOf(waits, { today });
262
+ host.innerHTML = TWV.waitsHtml(DP.rows) || '<p class="bk-wait">Nothing waits on another team.</p>';
263
+ }
264
+ /** A press in the Dependencies tab: Chase opens a draft in the PM's own mail app. PMOS sends nothing. true when it was one. */
265
+ function depsPress(e) {
266
+ if (!depsOn()) return false;
267
+ const b = e.target.closest('[data-tw-chase]');
268
+ if (!b) return false;
269
+ const r = DP.rows[Number(b.dataset.twChase)];
270
+ if (r) location.href = TWV.chaseDraft(r.chase).mailto;
271
+ return true;
272
+ }
273
+
182
274
  /* ── the list ─────────────────────────────────────────────────────────────────────────────────────────────────── */
183
275
  const partB = () => true;
184
276
  function draw() {
@@ -793,7 +885,7 @@ export function sync(api) {
793
885
  sw.addEventListener('click', (e) => { const b = e.target.closest('[data-bksw]'); if (b) setOn(b.dataset.bksw); });
794
886
  host = document.createElement('div'); host.id = 'bkBody'; host.className = 'bk-host'; host.hidden = true;
795
887
  ib.insertAdjacentElement('afterend', host);
796
- host.addEventListener('click', (e) => { if (linePress(e)) return; press(e); });
888
+ host.addEventListener('click', (e) => { if (linePress(e) || factoryPress(e) || depsPress(e)) return; press(e); });
797
889
  host.addEventListener('change', (e) => { if (e.target.closest('[data-bkck]')) press(e); });
798
890
  host.addEventListener('keydown', (e) => { const c = e.target.closest('[data-bkcap]'); if (c && e.key === 'Enter') { e.preventDefault(); capture(c); } });
799
891
  dragWire();
@@ -18,6 +18,7 @@
18
18
  import { stageOfRow, stagesOfRow, wfOf, catOfRow, posOf } from './bd-wf.js';
19
19
  import { stageName as oneStageName } from './stage-chip.js';
20
20
  import { stateGlyph } from './state-glyph.js';
21
+ import * as PR from './print-pdf.js'; // Print or PDF (job #1911, A379)
21
22
 
22
23
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
23
24
  const SV = (d, n) => `<svg viewBox="0 0 24 24"${n ? ` width="${n}" height="${n}"` : ''} aria-hidden="true"><path d="${d}"/></svg>`;
@@ -339,7 +340,7 @@ export function ticksOf(W) {
339
340
  }
340
341
 
341
342
  /* ── markup ──────────────────────────────────────────────────────────────────────────────────────────────────── */
342
- const I = { 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',
343
+ 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',
343
344
  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' };
344
345
 
345
346
  function cellHtml(r, k, o) {
@@ -415,6 +416,7 @@ export function listHtml(rows, o = {}) {
415
416
  const nav = (k, label, d) => `<button type="button" class="pm-btn" data-wknav="${k}" aria-label="${label}" title="${label}">${SV(d, 16)}</button>`;
416
417
  const head = `<div class="head"><h2 class="pm-h">Initiatives</h2><span class="sp"></span>`
417
418
  + (tl ? `<div class="pm-tabs" role="tablist" aria-label="Scale of the timeline">${scale}</div>${nav('back', 'Earlier', I.back)}${nav('today', 'Go to today', I.today)}${nav('on', 'Later', I.on)}` : '')
419
+ + `<button type="button" class="pm-btn" data-wkprint aria-label="Print or PDF" title="Print or PDF">${SV(I.print, 16)}</button>` // job #1911 (A379): the roadmap list in the one print layout
418
420
  + `<button type="button" class="pm-btn" data-wkmenu aria-haspopup="dialog" aria-label="Choose columns, sort and filter" title="Choose columns, sort and filter">${SV(I.tune, 16)}${filterCount() ? `<i class="wk-fc" aria-hidden="true">${filterCount()}</i>` : ''}</button></div>`;
419
421
  const ncol = 1 + keys.length + (tl ? 1 : 0);
420
422
  let h = `<section class="pm-block wk-blk" aria-label="Initiatives">${head}${o.above || ''}${showingHtml(every.length - rows.length)}`
@@ -499,6 +501,13 @@ export function menuHtml(o = {}) {
499
501
  + `<div class="wk-ft"><span>PMOS remembers this</span>${differs ? '<button type="button" class="wk-rs" data-wkreset>Reset</button>' : ''}</div></div>`;
500
502
  }
501
503
 
504
+ /** Print or PDF on Work's list (job #1911, A379): the list as shown, in the one print layout (pm/print-pdf.js). */
505
+ function printList(btn) {
506
+ const sec = btn && btn.closest ? btn.closest('.wk-blk') : null;
507
+ let ws = ''; try { ws = new URLSearchParams(location.search).get('ws') || ''; } catch { ws = ''; }
508
+ if (sec) PR.printPage(sec, { title: 'Roadmap', ws });
509
+ }
510
+
502
511
  /** What a press in the list or the menu means, or null when it is not Work's own. → { kind, ... } */
503
512
  export function pressOf(t) {
504
513
  const q = (s) => t.closest && t.closest(s);
@@ -513,6 +522,7 @@ export function pressOf(t) {
513
522
  if ((b = q('[data-wkspick]'))) return { kind: 'span', span: b.dataset.wkspick };
514
523
  if (q('[data-wkspan]')) return { kind: 'spanmenu' };
515
524
  if ((b = q('[data-wknav]'))) return { kind: 'nav', dir: b.dataset.wknav };
525
+ if (q('[data-wkprint]')) return { kind: 'print', el: q('[data-wkprint]') };
516
526
  if (q('[data-wkmenu]')) return { kind: 'menu', el: q('[data-wkmenu]') };
517
527
  if ((b = q('[data-wktl]'))) return { kind: 'timeline', on: b.dataset.wktl === 'on' };
518
528
  if ((b = q('[data-wkstage]'))) return { kind: 'stage', key: b.dataset.wkstage, el: b };
@@ -543,6 +553,7 @@ export function apply(p) {
543
553
  else if (p.kind === 'closed') SHUT = !SHUT;
544
554
  else if (p.kind === 'card') CARD = CARD === p.key ? null : p.key;
545
555
  else if (p.kind === 'nav') { if (p.dir === 'today') toToday(); else step(p.dir === 'back' ? -1 : 1, LAST ? LAST.rows : []); }
556
+ else if (p.kind === 'print') { printList(p.el); return false; }
546
557
  else if (p.kind === 'menu') return false;
547
558
  else if (p.kind === 'inside') return false;
548
559
  else return false;
@@ -4,6 +4,7 @@
4
4
  * mount(host, { ws, single }) → draws the map into `host`; a Work page that shows several products at once shows none
5
5
  * mapHtml(map) → the markup (pure, so the test reads it); '' when there is nothing to show
6
6
  *
7
+ * Closed by default: one line ("Code · 6 parts · 1 tinted") until the PM opens it.
7
8
  * Built from the board's parts: a pm-block with its head, the part boxes of panel 13 (card ground, small radius, a 1px line; cozy-board.css .bd-cm-) in a grid,
8
9
  * and a pm-meta foot. Each box: the part's name, what it is (the PM's own words from `pmos code describe` when given), how it is tested and
9
10
  * who changed it last. A risky part (no tests, or many recent fixes) is tinted with the alert colour and says why; the rest are plain.
@@ -34,12 +35,21 @@ export function boxHtml(p) {
34
35
  return `<div class="bd-cm-part" role="listitem"${risk} title="${esc(p.dir || p.name)}"><b>${esc(p.name)}</b>${lines}</div>`;
35
36
  }
36
37
 
37
- export function mapHtml(map) {
38
+ /** The one line the closed card shows: how many parts, and how many are tinted. */
39
+ export function sumOf(map) {
40
+ const n = map.parts.length + (map.more || 0);
41
+ const r = map.parts.filter((p) => p.risky).length;
42
+ return `${n} part${n === 1 ? '' : 's'}${r ? ` · ${r} tinted` : ''}`;
43
+ }
44
+
45
+ /** Closed by default (the PM, 2026-11-25: "should be hidden by default"): a <details> whose summary is the head and one line. */
46
+ export function mapHtml(map, { open = false } = {}) {
38
47
  if (!map || !Array.isArray(map.parts) || !map.parts.length) return '';
39
48
  const more = map.more ? `<span class="pm-meta">and ${map.more} smaller part${map.more === 1 ? '' : 's'}</span>` : '';
40
- return `<section class="pm-block bd-cm" aria-label="Code"><div class="head">${SV(CODE)}<h3 class="pm-h-sm">Code</h3></div>`
49
+ return `<details class="pm-block bd-cm" aria-label="Code"${open ? ' open' : ''}><summary class="head">${SV(CODE)}<h3 class="pm-h-sm">Code</h3><span class="pm-meta bd-cm-sum">${esc(sumOf(map))}</span></summary>`
50
+ + '<p class="pm-meta bd-cm-say">The main parts of this product\'s code, read from its repository: what each is, how it is tested, who changed it last. Tinted: no tests, or mostly fixes lately.</p>'
41
51
  + `<div role="list" class="bd-cm-grid">${map.parts.map(boxHtml).join('')}</div>`
42
- + `<div class="pm-row bd-cm-foot">${more}<span class="pm-meta">Read from the repo on ${esc(dayOf(map.at))}</span></div></section>`;
52
+ + `<div class="pm-row bd-cm-foot">${more}<span class="pm-meta">Read from the repo on ${esc(dayOf(map.at))}</span></div></details>`;
43
53
  }
44
54
 
45
55
  /** Draw the map into `host`. While PMOS draws it for the first time, read again now and then (at most ~2 minutes). */
@@ -51,7 +61,8 @@ export async function mount(host, opts = {}) {
51
61
  let r = null;
52
62
  try { r = await (await fetch('/api/code-map' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
53
63
  if (!r || !r.ok) { host.hidden = true; return; } // an extra: a failed read leaves Work as it was
54
- const html = mapHtml(r.map);
64
+ const was = host.querySelector && host.querySelector('details.bd-cm');
65
+ const html = mapHtml(r.map, { open: !!(was && was.open) }); // a redraw keeps the card as the PM left it
55
66
  host.hidden = !html;
56
67
  if (host.innerHTML !== html) host.innerHTML = html;
57
68
  const tries = Number(host.dataset.polls || 0);
@@ -1628,10 +1628,14 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1628
1628
  .bd-bc .s.ln { color: var(--cz-ink2); }
1629
1629
  .bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
1630
1630
  /* the product's code map (pm/code-map.js, idea A176, board BatchCodeDS panel 13): one box per main part; a risky part takes the alert tint */
1631
- .bd-cm .head h3 { flex: 1; }
1632
1631
  .bd-cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-8); }
1633
1632
  .bd-cm-part { min-width: 0; background: var(--card); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); padding: 6px 8px; font: var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--cz-sans); }
1634
1633
  .bd-cm-part[data-risky] { background: color-mix(in srgb, var(--alert) 12%, var(--card)); }
1635
1634
  .bd-cm-part b { display: block; font-weight: var(--fw-strong); }
1636
1635
  .bd-cm-l { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1637
1636
  .bd-cm-foot { gap: var(--space-8); margin-top: var(--space-8); }
1637
+ .bd-cm-say { margin: var(--space-8) 0; }
1638
+ .bd-cm > summary { cursor: pointer; list-style: none; }
1639
+ .bd-cm > summary::-webkit-details-marker { display: none; }
1640
+ .bd-cm > summary h3 { flex: 0 1 auto; }
1641
+ .bd-cm > summary .bd-cm-sum { flex: 1; }
@@ -108,3 +108,8 @@
108
108
  .lb-menu, .lb-cwr .lb-menu { position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 80vh; border-radius: var(--radius-panel) var(--radius-panel) 0 0; padding: 18px var(--space-12) 28px; }
109
109
  }
110
110
  .lb .lb-more { margin: var(--space-4) 0 0 var(--space-4); }
111
+ /* the monthly review pack in the preview (initiative review-pack) */
112
+ .rp-pack { gap: var(--space-8); }
113
+ .rp-pack .rp-head { font-size: var(--fs-meta); }
114
+ .rp-pack .rp-lines { margin: 0; padding-left: var(--space-16); font-size: var(--fs-row); line-height: var(--lh-body); }
115
+ .rp-pack + .pm-said { margin: 0; }
@@ -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 PR from './print-pdf.js'; // Print or PDF under ⋯ (job #1911, A379)
40
41
  import * as SMAP from './stakeholder-map.js'; // the People block: who decides, must agree, needs to know (stakeholder-map, A371)
41
42
  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)
42
43
 
@@ -1227,7 +1228,8 @@ function dateMenu(btn, uid, c, h, x) {
1227
1228
  // "end of sprint" typed in a field (bet A488): the task's own sprint, else the active one, from the board's open sprints (the Sprint menu's read)
1228
1229
  let sprintEnd = '';
1229
1230
  sprintsOf(c, h, x).then((L) => { const C = IF.sprintChoices(L, c.W.today), cur = C.find((q) => row.sprint && q.name === String(row.sprint)) || C.find((q) => q.state === 'active'); sprintEnd = cur ? cur.end : ''; }).catch(() => {});
1230
- mountRange(el.querySelector('.pw-rp'), { ...R, sprintEnd: () => sprintEnd, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } }).focus();
1231
+ // the optional time (task-time-optional): offered for a PMOS task, never a Jira ticket's
1232
+ mountRange(el.querySelector('.pw-rp'), { ...R, time: !row.jira, start_time: row.start_time || '', due_time: row.due_time || '', sprintEnd: () => sprintEnd, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } }).focus();
1231
1233
  }
1232
1234
  function rowMenu(btn, uid, c, h, body) {
1233
1235
  const row = c.W.rows.find((x) => x.uid === uid) || {};
@@ -1380,6 +1382,7 @@ function capItems(body, hh) {
1380
1382
  if (act === 'big') return big(c, x, h);
1381
1383
  if (act === 'src') return srcMenu(a, c, x, h);
1382
1384
  if (act === 'parts') { if (hh && hh.allParts) hh.allParts(); }
1385
+ if (act === 'print') return PR.printPage(body.querySelector('.pw'), { title: (c.v && c.v.title) || (c.r && (c.r.title || c.r.name)) || '', ws: atOf(h, x).ws }); // job #1911: Print or PDF
1383
1386
  };
1384
1387
  const out = [];
1385
1388
  for (const g of G) { out.push({ head: g.group }); for (const it of g.items) out.push({ label: it.label, icon: it.icon, on: (a) => { run(it.act, a); } }); }
@@ -75,6 +75,11 @@
75
75
  .pc-bar2 { display: block; height: 4px; border-radius: 2px; background: var(--cz-well); overflow: hidden; }
76
76
  .pc-bar2 i { display: block; height: 100%; background: var(--cz-blue); transition: width .4s ease; }
77
77
  .pc-fixed { margin: 0 0 var(--space-8); font-size: var(--fs-meta); color: var(--cz-ink2); }
78
+ /* Findings (initiative sim-users, pm/sim-users.js): the system's pm-block list; a finding is a press that shows its screen */
79
+ .pc-finds { margin: 0 0 var(--space-8); }
80
+ .pc-finds .pm-li { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
81
+ .pc-finds .pm-li:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
82
+ .pc-finds .pm-li .t { white-space: normal; }
78
83
  .pc-lost { display: block; color: var(--cz-ink2); padding: var(--space-8) 10px; border-radius: 8px; background: var(--cz-well); margin-bottom: var(--space-8); }
79
84
  @keyframes pcPulse { 50% { opacity: 1; } }
80
85
  @media (prefers-reduced-motion: reduce) { .pc-making i { animation: none; opacity: .7; } }
@@ -16,6 +16,7 @@
16
16
  * on the prototype, a branch plays its scenario); the page copy, in its side panel (copy.json, edited in place: the prototype changes as the PM types and
17
17
  * the edit is kept with the version, POST /api/lab/edit); who does what (lanes.json as a swimlane with arrows: a step shows its screen).
18
18
  * A card the version changed says Updated (compare.updated).
19
+ * Findings (initiative sim-users): above the design, where the simulated users got stuck (pm/sim-users.js); a finding shows its screen.
19
20
  * Three ways (a round with several versions): a tray; a press previews one; ✓ keeps it, ✕ closes the round.
20
21
  * Play: the prototype full size through a scenario of flow.json; a tap where the user would tap moves on, a miss shows the hotspots.
21
22
  * The chat (pm/home-chat.js) hears 'pmos:point', 'pmos:from' and 'pmos:say' (window events, detail.ini names the initiative); it says
@@ -27,6 +28,7 @@
27
28
  * openVersion({ ws, board?, ini, n }) shows version n of the initiative's newest round (the chat's Version n tag)
28
29
  * flowLayout(flow) · lanesLayout(lanes) PURE: where the SVG puts each node and arrow (exported for the source check) */
29
30
  import { pmGet, pmPost, pmHeaders } from './http.js';
31
+ import { findingsHtml, notePress, loadFindings } from './sim-users.js'; // Findings: simulated users walked it first (initiative sim-users)
30
32
 
31
33
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
32
34
  const SVG = (d, w = 16, sw = 2) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
@@ -163,7 +165,7 @@ export function lanesLayout(lanes) {
163
165
  * presses, closed by default; one shows at a time, in the inspector's place. The device switch is only for Play. */
164
166
  const V = { body: null, box: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
165
167
  sel: null, looks: null, screen: '', frameUrl: '', ready: null, edits: { copy: {}, vars: {}, styles: {} }, pend: null, saveT: null, draft: null, drawing: false, strokes: 0,
166
- play: null, sig: '', side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
168
+ play: null, sig: '', finds: {}, side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
167
169
  const ARROW = '<marker id="pcArr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker>';
168
170
  const frameUrl = (c) => (c && c.url ? c.url + '&rt=1' : '');
169
171
  const toFrame = (m, f) => { const fr = f || (V.body && V.body.querySelector('.pc-frame iframe')); if (fr && fr.contentWindow) fr.contentWindow.postMessage({ pmos: 1, ...m }, '*'); };
@@ -238,7 +240,7 @@ function protoCard(c, v, making) {
238
240
  const sug = suggestion(c);
239
241
  const draw = V.mode === 'draw' ? `<canvas class="pc-ink" aria-label="Sketch over the prototype"></canvas><span class="pc-inkacts">${ib('data-pc-ink="attach"', 'Attach the sketch to your next message', I.attach, 'blue')}${ib('data-pc-ink="clear"', 'Clear the sketch', I.x)}</span>` : '';
240
242
  const lost = c.notMade ? `<p class="pc-making pc-lost">Version ${c.round} was not made: ${esc(c.notMade)}.${c.fallbackN ? ` This is version ${c.fallbackN}.` : ''} Ask in the chat for it in smaller steps, one screen or format at a time.</p>` : '';
241
- return { pre: lost + (making ? progressHtml(c) : checksHtml(c)), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
243
+ return { pre: lost + (making ? progressHtml(c) : checksHtml(c) + findingsHtml(V.finds[v.file])), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
242
244
  }
243
245
  /** The notes beside the design (notes.json): what the run wants the PM to know, kept off the screens (Wawan 2026-11-18). Only the notes for
244
246
  * the screen shown and the ones for the whole prototype; none at all is silence. A note on a layer flashes it on the design. */
@@ -376,11 +378,16 @@ export function draw(body, c, o = {}) {
376
378
  // a new version: its own edits, nothing pointed at
377
379
  if (prevFile !== v.file) { const e = (v.data && v.data.edits) || {}; V.edits = { copy: { ...(e.copy || {}) }, vars: { ...(e.vars || {}) }, styles: { ...(e.styles || {}) } }; V.sel = null; V.looks = null; V.ready = null; }
378
380
  V.c = c; V.v = v;
381
+ // Findings (initiative sim-users): read once per version, then drawn above the design; the canvas never waits on it
382
+ if (v.file && !(v.file in V.finds)) {
383
+ V.finds[v.file] = null;
384
+ loadFindings({ ws: (V.at || {}).ws, ini: c.ini, file: v.file }).then((f) => { if (!f) return; V.finds[v.file] = f; if (V.v && V.v.file === v.file && V.body) { V.sig = ''; draw(V.body, V.c); } });
385
+ }
379
386
  let root = body.querySelector(':scope > .pc');
380
387
  if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
381
388
  V.body = body;
382
389
  // keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
383
- const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, V.wide, !!V.draft, (c.history || []).length, c.state]);
390
+ const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, !!V.finds[v.file], (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, V.wide, !!V.draft, (c.history || []).length, c.state]);
384
391
  const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input,select');
385
392
  if (sig === V.sig && root.firstChild) return;
386
393
  if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
@@ -492,6 +499,7 @@ function wire(root) {
492
499
  if ('pcPlay' in d) { const sc = ((V.v.data || {}).flow || {}).scenarios || []; startPlay(sc.length ? sc[0].id : '', 0, true); return; }
493
500
  if (d.pcFrom) { fire('pmos:from', { ini: V.c.ini, n: Number(d.pcFrom) }); say('The next change you send continues from version ' + d.pcFrom + '.'); return; }
494
501
  if (d.pcNote) { toFrame({ t: 'hint', els: [d.pcNote] }); return; }
502
+ if ('pcFind' in d) notePress();
495
503
  if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); V.sig = ''; draw(V.body, V.c); return; }
496
504
  if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
497
505
  if ('pcStop' in d) { pmPost('/api/lab/stop', { ws: (V.at || {}).ws, run: d.pcStop }).then((r) => { if (!r || !r.ok) say((r && r.error) || 'It did not stop.'); }).catch(() => say('It did not stop.')); return; }
@@ -40,7 +40,7 @@ function mount() {
40
40
  const d = document.createElement('div');
41
41
  d.innerHTML = '<div class="ev-sp-scrim" id="evSpScrim" hidden></div>'
42
42
  + '<div class="ev-sp" id="evSearch" role="dialog" aria-modal="true" aria-label="Search" hidden>'
43
- + `<div class="ev-sp-in">${svg(ICON.search, 20)}<label for="evQ" class="ev-vh">Search PMOS</label><input id="evQ" type="text" autocomplete="off" spellcheck="false" placeholder="Search initiatives, documents, slides, reports, artifacts and meetings" role="combobox" aria-expanded="true" aria-controls="evRes" aria-autocomplete="list"><span class="ev-kbd">Esc</span><button type="button" class="ev-ib x" data-ev="close" aria-label="Close search">${svg(ICON.close, 18)}</button></div>`
43
+ + `<div class="ev-sp-in">${svg(ICON.search, 20)}<label for="evQ" class="ev-vh">Search or ask PMOS</label><input id="evQ" type="text" autocomplete="off" spellcheck="false" placeholder="Search or ask: initiatives, documents, reports, meetings…" role="combobox" aria-expanded="true" aria-controls="evRes" aria-autocomplete="list"><span class="ev-kbd">Esc</span><button type="button" class="ev-ib x" data-ev="close" aria-label="Close search">${svg(ICON.close, 18)}</button></div>`
44
44
  + '<div class="ev-sp-chips" id="evChips" role="group" aria-label="Kind"></div>'
45
45
  + '<div class="ev-sp-list" id="evRes" role="listbox" aria-label="Results"></div>'
46
46
  + `<div class="ev-sp-ft"><span><span class="ev-kbd" role="img" aria-label="Arrow up">${svg(ARROW.up, 12)}</span> <span class="ev-kbd" role="img" aria-label="Arrow down">${svg(ARROW.down, 12)}</span> move</span><span><span class="ev-kbd" role="img" aria-label="Enter">${svg(ARROW.enter, 12)}</span> open</span><span class="ev-r">Searches your work. Opens in the Viewer when it can.</span></div>`
@@ -74,7 +74,7 @@ export function openSearch(o = {}) {
74
74
  if (o.q != null) S.q = String(o.q);
75
75
  el.hidden = false; document.getElementById('evSpScrim').hidden = false; el.setAttribute('data-esc-layer', '');
76
76
  const q = el.querySelector('#evQ'); q.value = S.q; q.focus(); q.select();
77
- q.placeholder = S.scope ? 'Search ' + S.scope.name + ', then everywhere' : 'Search initiatives, documents, slides, reports, artifacts and meetings';
77
+ q.placeholder = S.scope ? 'Search or ask: ' + S.scope.name + ', then everywhere' : 'Search or ask: initiatives, documents, reports, meetings…';
78
78
  if (!S.boards) getj('/api/boards/backlog?limit=200' + wsQ('&')).then((b) => { S.boards = b && b.ok && Array.isArray(b.rows) ? b : { rows: [] }; draw(); });
79
79
  if (!S.sessions) getj('/api/sessions').then((s) => { S.sessions = s && Array.isArray(s.sessions) ? s.sessions.filter((x) => !x.automatic && x.shown !== 'exited') : []; draw(); });
80
80
  run();
@@ -22,6 +22,7 @@ import { wireSwipe } from './cozy-phone-swipe.js';
22
22
  let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
23
23
  import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
24
24
  import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
25
+ import * as PA from './page-one-answer.js'; // page-one-answer (A308): the one sentence that opens Today; Your move is its list
25
26
  import * as CAP from './five-action-cap.js'; // five-action-cap (A529): a row shows two actions and ⋯; which two comes from the use log, once a week
26
27
  import * as TO from './today-order.js'; // today-order (A310, board BatchMoreBDS panel 30): the same blocks in the day's order, and the pin
27
28
  import * as NL from './cozy-name-links.js'; // name-links (A536): names in a line you typed link to the person, meeting or document, with a small card
@@ -347,7 +348,7 @@ export function mountToday(ctx) {
347
348
  if (phone()) {
348
349
  // PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
349
350
  if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
350
- const html = TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
351
+ const html = PA.answerHtml(PA.todayAnswer(L), { list: false, page: 'today' }) + TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
351
352
  if (html === X.html && el.firstChild) return;
352
353
  X.html = html; el.classList.add('tdp');
353
354
  document.body.classList.toggle('tdp-sheeton', !!X.sheet);
@@ -361,7 +362,9 @@ export function mountToday(ctx) {
361
362
  if (html === X.html && el.firstChild) return;
362
363
  X.html = html;
363
364
  const st = el.parentNode ? el.parentNode.scrollTop : 0;
364
- el.innerHTML = TP.headHtml(TM.headModel(ctx.now())) + html;
365
+ // page-one-answer (A308): the head, then the one sentence; Your move under it is what needs you, the rest folds below it
366
+ el.innerHTML = TP.headHtml(TM.headModel(ctx.now())) + PA.answerHtml(PA.todayAnswer(L), { list: false, page: 'today' }) + html;
367
+ if (X.read) PA.reportCalls('today', ctx.pmPost, el);
365
368
  if (el.parentNode) el.parentNode.scrollTop = st;
366
369
  const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
367
370
  }
@@ -0,0 +1,8 @@
1
+ /* pm/day-time.js — a task's optional time of day on its start and due (Wawan 2026-11-25: "Optionally can add time"). A time is "HH:MM",
2
+ * 24-hour, kept beside the day (start_time, due_time on the item; a task-time line on the ledger), never inside it: a day stays YYYY-MM-DD,
3
+ * so every page that reads a day reads it as before, and a task with no time looks exactly as it did.
4
+ *
5
+ * isTime(v) true for "00:00" to "23:59"
6
+ * withTime(text, t) a day's words with the time after them ("26 Nov 2026 09:30"), or the words alone with no time or no day */
7
+ export const isTime = (v) => /^([01]\d|2[0-3]):[0-5]\d$/.test(String(v || ''));
8
+ export const withTime = (text, t) => (text && isTime(t) ? text + ' ' + t : text || '');