create-pmos 0.826.0 → 0.828.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 (55) hide show
  1. package/package.json +121 -55
  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/bin/pmos.js +19 -9
  7. package/workspace/changelog.json +120 -16
  8. package/workspace/guide/cli.md +42 -0
  9. package/workspace/lib/arch-warns.js +121 -0
  10. package/workspace/lib/board-cli.js +5 -1
  11. package/workspace/lib/code-map-cli.js +11 -3
  12. package/workspace/lib/features.json +3 -0
  13. package/workspace/lib/five-action-cap.js +84 -0
  14. package/workspace/lib/goals-cli.js +5 -0
  15. package/workspace/lib/people-cli.js +43 -2
  16. package/workspace/lib/pmos-verbs.js +10 -1
  17. package/workspace/lib/portfolio-cli.js +64 -0
  18. package/workspace/lib/portfolio.js +168 -0
  19. package/workspace/lib/review-reasons.js +357 -0
  20. package/workspace/lib/route-modules.js +3 -0
  21. package/workspace/lib/routes-arch-warns.js +39 -0
  22. package/workspace/lib/routes-onboard.js +18 -3
  23. package/workspace/lib/routes-portfolio.js +50 -0
  24. package/workspace/lib/routes-stakeholders.js +42 -0
  25. package/workspace/lib/routes-strategy-card.js +29 -1
  26. package/workspace/lib/routes-use-log.js +6 -1
  27. package/workspace/lib/stakeholder-map.js +232 -0
  28. package/workspace/lib/starter-goals.js +244 -0
  29. package/workspace/lib/voice-cli.js +7 -0
  30. package/workspace/package-lock.json +2 -2
  31. package/workspace/package.json +1 -1
  32. package/workspace/premium-vw-jira-test.js +6 -2
  33. package/workspace/public/pm/bd-principles.js +12 -1
  34. package/workspace/public/pm/cozy-onboard.css +4 -0
  35. package/workspace/public/pm/cozy-onboard.js +17 -1
  36. package/workspace/public/pm/cozy-pick.css +1 -0
  37. package/workspace/public/pm/cozy-pop-work.js +37 -2
  38. package/workspace/public/pm/cozy-today-app.js +48 -1
  39. package/workspace/public/pm/cozy-today-view.js +12 -4
  40. package/workspace/public/pm/five-action-cap.js +104 -0
  41. package/workspace/public/pm/pop-work-model.js +6 -0
  42. package/workspace/public/pm/portfolio.js +67 -0
  43. package/workspace/public/pm/product-switcher.js +7 -1
  44. package/workspace/public/pm/review-reasons.js +75 -0
  45. package/workspace/public/pm/stakeholder-map.js +125 -0
  46. package/workspace/public/pm/starter-goals.js +35 -0
  47. package/workspace/public/premium-portfolio.html +48 -0
  48. package/workspace/server.js +1 -1
  49. package/workspace/stage-card-tasks-test.js +11 -5
  50. package/workspace/test-lists/arch-warns.json +9 -0
  51. package/workspace/test-lists/five-action-cap.json +9 -0
  52. package/workspace/test-lists/portfolio.json +9 -0
  53. package/workspace/test-lists/review-reasons.json +9 -0
  54. package/workspace/test-lists/stakeholder-map.json +9 -0
  55. package/workspace/test-lists/starter-goals.json +9 -0
@@ -0,0 +1,104 @@
1
+ /* pm/five-action-cap.js — Work and Today get the work popup's five-action limit (five-action-cap, idea A529; board BoardHomeCapDS, agreed
2
+ * 2026-11-25). PURE: lists and strings, no DOM and no reads. The popup's own cap is pm/pop-cap.js; this module carries the same rule to
3
+ * the other places that change most.
4
+ *
5
+ * ONE RULE a page header shows five actions at most (HEAD_MAX); a card or row shows three at most on hover (ROW_MAX): two actions and ⋯.
6
+ * The rest go under ⋯, whose first group, Change, holds every change action not shown. Set the date and Stage are never
7
+ * dropped from both places (the A498 lesson, #1821). A new action replaces one or goes under ⋯.
8
+ * WHICH ONES the ones used most in the last 30 days (the local use log, `<place>-<action>` presses), worked out at most once a week;
9
+ * before 30 days of use, the place's defaults (Today row: Done, Put off a day).
10
+ *
11
+ * PLACES { 'today-row': { max, slots, acts, def, change, keep, label }, 'work-head': … }
12
+ * pick(place, counts, span) → the ids shown: the most used in 30 days, else the defaults
13
+ * due(saved, place, now) → true when the shown ids are worked out again (none saved, unknown ids, or a week old)
14
+ * todayRow(avail, shown) → { shown: [ids], more: [{ group, items: [ids] }] } for one Today row. avail: the actions this row has,
15
+ * job first ('open' for Reply, Decide or Send). A job keeps its place first; the slots left take the shown ids.
16
+ * lost(full, shown, more) → the ids of full that are neither shown nor under ⋯ (the guard: always [])
17
+ * countRowButtons(html) → the buttons of a row's hover set (<span class="acts …">)
18
+ * countHeadActions(html) → the actions of a page header: its buttons and chips, not the path, not ⋯
19
+ * moreButton(key, label) → the row's ⋯ (icon only, aria-label)
20
+ * menuHtml(key, groups, words) → the ⋯ menu (pm-menu): its groups and items, each a button with its words
21
+ * The UI says PMOS, never Claude. Every icon button carries aria-label. */
22
+ export const HEAD_MAX = 5;
23
+ export const ROW_MAX = 3; // two actions and ⋯
24
+ export const SPAN_DAYS = 30;
25
+ // The use log keeps 30 days and prunes once a day (lib/use-log.js), so a full log's oldest line is 29 to 30 whole days old: 29 counts as full.
26
+ export const FULL_DAYS = SPAN_DAYS - 1;
27
+ export const WEEK = 7 * 864e5;
28
+
29
+ /** The places. acts: every action the place can show; def: the shown ones before 30 days of use; change: the change actions (they go in the
30
+ * Change group of ⋯ when not shown); keep: never dropped from both shown and ⋯. */
31
+ export const PLACES = Object.freeze({
32
+ 'today-row': Object.freeze({ max: ROW_MAX, slots: 2, acts: ['done', 'tomorrow', 'date'], def: ['done', 'tomorrow'], change: ['date', 'tomorrow', 'done'], keep: ['date'], label: 'Today row' }),
33
+ 'work-head': Object.freeze({ max: HEAD_MAX, slots: 5, acts: ['view', 'ask', 'find', 'filter', 'new'], def: ['view', 'ask', 'find', 'filter', 'new'], change: [], keep: [], label: 'Work header' }),
34
+ });
35
+ /** The words of each Today row action, as the row says them. */
36
+ export const WORDS = Object.freeze({ done: 'Done', tomorrow: 'Put off a day', date: 'Set a date', open: 'Open' });
37
+
38
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
39
+
40
+ /** The shown ids of a place. counts: { 'today-row-done': 3, … } or { done: 3 }; span: the whole days the use log covers. */
41
+ export function pick(place, counts, span) {
42
+ const P = PLACES[place]; if (!P) return [];
43
+ if (!(Number(span) >= FULL_DAYS) || !counts) return [...P.def];
44
+ const n = (k) => Number(counts[place + '-' + k] != null ? counts[place + '-' + k] : counts[k]) || 0;
45
+ const used = P.acts.filter((k) => n(k) > 0).sort((a, b) => n(b) - n(a) || P.acts.indexOf(a) - P.acts.indexOf(b));
46
+ const out = used.slice(0, P.slots);
47
+ for (const k of P.def) if (out.length < P.slots && !out.includes(k)) out.push(k);
48
+ for (const k of P.acts) if (out.length < P.slots && !out.includes(k)) out.push(k);
49
+ return out;
50
+ }
51
+ /** Work the shown ids out again? None saved, a list that is not the place's size of known ids, or saved a week or more ago. */
52
+ export function due(saved, place, now = Date.now()) {
53
+ const P = PLACES[place];
54
+ if (!P || !saved || !Array.isArray(saved.ids) || saved.ids.length !== P.slots || !saved.ids.every((k) => P.acts.includes(k))) return true;
55
+ const at = Date.parse(saved.at || '');
56
+ return !(at > 0) || now - at >= WEEK;
57
+ }
58
+
59
+ /** One Today row. avail: the actions it has, in its own order (a job act 'open' first when it has one). shown: pick('today-row', …).
60
+ * Up to three actions: all show, as before, unless the row has more than ROW_MAX; then two show and ⋯ holds the rest. With the default
61
+ * pick a plain row (Done, Put off a day, Set a date) shows Done, Put off a day and ⋯, as the board draws it. */
62
+ export function todayRow(avail, shown = PLACES['today-row'].def) {
63
+ const P = PLACES['today-row'], A = (avail || []).filter(Boolean);
64
+ const job = A[0] && !P.acts.includes(A[0]) ? A[0] : null;
65
+ const rest = A.filter((k) => k !== job);
66
+ if (A.length <= 2) return { shown: A, more: [] }; // nothing to fold: zero is silence
67
+ const out = job ? [job] : [];
68
+ for (const k of shown || []) if (out.length < P.slots && rest.includes(k) && !out.includes(k)) out.push(k);
69
+ for (const k of rest) if (out.length < P.slots && !out.includes(k)) out.push(k);
70
+ const left = rest.filter((k) => !out.includes(k));
71
+ const change = P.change.filter((k) => left.includes(k));
72
+ const other = left.filter((k) => !change.includes(k));
73
+ return { shown: out, more: [{ group: 'Change', items: change }, { group: 'More', items: other }].filter((g) => g.items.length) };
74
+ }
75
+ /** The guard: the ids of full that are neither shown nor under ⋯. */
76
+ export function lost(full, shown, more) {
77
+ const both = new Set([...(shown || []), ...(more || []).flatMap((g) => g.items)]);
78
+ return (full || []).filter((k) => !both.has(k));
79
+ }
80
+
81
+ /** The buttons of a row's hover set: the <span class="acts …"> of a ListRow. */
82
+ export function countRowButtons(html) {
83
+ const m = /<span class="acts[^"]*">([\s\S]*?)<\/span>(?=<\/div>|$)/.exec(String(html || ''));
84
+ return m ? (m[1].match(/<button\b/g) || []).length : 0;
85
+ }
86
+ /** The actions of a page header: its buttons (an icon button or a chip), not the path (the product picker moves you), not ⋯ (moreBtn, More)
87
+ * and not a button inside a menu the header opens. */
88
+ export function countHeadActions(html) {
89
+ let s = String(html || '').replace(/<nav\b[\s\S]*?<\/nav>/g, '');
90
+ s = s.replace(/<span[^>]*role="group"[^>]*>[\s\S]*?<\/span>/g, '');
91
+ return (s.match(/<button\b(?![^>]*\b(id="moreBtn"|aria-label="More")\b)[^>]*>/g) || []).length;
92
+ }
93
+
94
+ const svg = (d) => `<svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
95
+ export const MORE_ICON = 'M6 12h.01M12 12h.01M18 12h.01';
96
+ /** The row's ⋯: icon only, with its words for a screen reader. */
97
+ export function moreButton(key, label) {
98
+ return `<button type="button" class="td-ib pm-btn" data-td="cap-more" data-key="${esc(key)}" aria-haspopup="menu" aria-expanded="false" aria-label="${esc('More: ' + label)}" title="More">${svg(MORE_ICON)}</button>`;
99
+ }
100
+ /** The ⋯ menu (pm-menu): a label per group, then each action as a menu item that runs the row's own act (data-td). */
101
+ export function menuHtml(key, groups, words = WORDS) {
102
+ return `<div class="pm-menu td-capm" role="menu" aria-label="More actions">${(groups || []).map((g) => `<p class="pm-meta td-capg">${esc(g.group)}</p>`
103
+ + g.items.map((k) => `<button type="button" role="menuitem" class="pm-btn ghost" data-td="${esc(k)}" data-key="${esc(key)}"${k === 'date' ? ' aria-haspopup="dialog"' : ''}>${esc(words[k] || k)}</button>`).join('')).join('')}</div>`;
104
+ }
@@ -533,6 +533,12 @@ export function derivedOf(r, v, o, bd, arts) {
533
533
  why: 'The gate to the next stage needs ' + what + ', and ' + (miss.length === 1 ? 'it is' : 'they are') + ' not written.',
534
534
  ask: 'Draft ' + what + ' for ' + title + (n ? ' from its ' + plural(n, 'document', 'documents') : '') + ', for me to read.' + docSave(o.id || v.id || v.key || r.id) });
535
535
  }
536
+ // the initiative names a part of the code the code map calls risky (arch-warns, A54): one ✦ with that reason in the map's own words and
537
+ // one step, the test task. ✕ hides it for this initiative only (the dropped set). o.arch is GET /api/arch-warns, null when there is
538
+ // nothing to say; what is risky is never decided here.
539
+ const aw = o.arch || null;
540
+ if (live && aw && aw.part && aw.say) top.push({ id: 'd:arch:' + (o.id || v.id || v.key || r.id || '') + ':' + aw.part, derived: true,
541
+ say: aw.say, why: aw.note || '', direct: { act: 'test-task', title: aw.task || ('Add tests for ' + aw.part) } });
536
542
  // a document PMOS drafted waits to be issued (issue-from-chat): one ✦ per draft, ✓ issues it with Undo, ✎ opens it to read or edit, ✕ hides it.
537
543
  // Before, a draft the chat saved had no Issue anywhere on this page, and the chat sent the PM to a card that did not exist.
538
544
  for (const d of o.docs || []) {
@@ -0,0 +1,67 @@
1
+ /* pm/portfolio.js — the Portfolio page (initiative portfolio, bet A56, board BatchPlanDS panel 7; done test planning/done-tests/portfolio.md).
2
+ *
3
+ * One Table block: Product, Bets, Odds, Spend, Outcome, one row per product (GET /api/product-portfolio, lib/portfolio.js). An empty cell is a number
4
+ * PMOS does not know yet (zero is silence). Under the table, at most one ✦ line: PMOS's recommendation with its reason, then two icon buttons,
5
+ * Keep and Not now (POST /api/product-portfolio/decide), each with Undo in the toast. A press on a row (or Enter on it) shows that product alone and
6
+ * opens it in Work. Nothing here edits a product. With fewer than two products the page says so in one line and shows nothing else.
7
+ *
8
+ * pageHtml(v, o) PURE. The page body for the read v ({ show, rows, rec }); o.name(ws, fallback) gives the shown product name */
9
+ import { pmGet, pmPost } from './http.js';
10
+ import { mountNav } from './cozy-nav.js';
11
+ import { savePick } from './cozy-pick.js';
12
+ import { productName, whenNames } from './scope-chip.js';
13
+
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
+ const svg = (d, n = 18) => `<svg class="pm-ic" viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
16
+ const I = { keep: 'M5 12.5l4.5 4.5L19 7.5', later: 'M12 7v5l3 2M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
17
+ const money = (n) => (n == null ? '' : '$' + (n >= 1000 ? (Math.round(n / 100) / 10) + 'k' : n >= 10 ? Math.round(n) : n.toFixed(2)));
18
+
19
+ export function pageHtml(v, o = {}) {
20
+ const name = o.name || ((ws, f) => f);
21
+ if (!v || !v.show) return '<p class="pm-meta">The Portfolio compares two or more products. This workspace has one.</p>';
22
+ const rows = v.rows.map((r) => {
23
+ const nm = name(r.ws, r.name);
24
+ return `<tr data-pf-row="${esc(r.ws)}" tabindex="0" aria-label="Open ${esc(nm)} in Work"><td>${esc(nm)}</td><td class="n">${r.bets || ''}</td>`
25
+ + `<td class="n">${r.odds == null ? '' : r.odds + ' %'}</td><td class="n">${esc(money(r.spend))}</td><td>${esc(r.outcome || '')}</td></tr>`;
26
+ }).join('');
27
+ const table = `<table class="pm-table" aria-label="Products"><thead><tr><th>Product</th><th class="n">Bets</th><th class="n">Odds</th><th class="n" title="Agent runs, last 30 days">Spend</th><th>Outcome</th></tr></thead><tbody>${rows}</tbody></table>`;
28
+ const rec = v.rec ? `<div class="pm-said" data-pf-rec="${esc(v.rec.key)}"><span class="pf-mark" aria-hidden="true">✦</span><span>${esc(v.rec.text)}: ${esc(v.rec.why)}</span><span class="sp"></span>`
29
+ + `<button type="button" class="pm-btn" data-pf-keep aria-label="Keep" title="Keep">${svg(I.keep)}</button>`
30
+ + `<button type="button" class="pm-btn" data-pf-later aria-label="Not now" title="Not now">${svg(I.later)}</button></div>` : '';
31
+ return `<section class="pm-block" aria-label="Portfolio">${table}${rec}</section>`;
32
+ }
33
+
34
+ const $ = (id) => document.getElementById(id);
35
+ let V = null;
36
+ function toast(text, undo) {
37
+ const el = $('pfToast'); if (!el) return;
38
+ const w = document.createElement('span'); w.textContent = text;
39
+ el.replaceChildren(w);
40
+ if (undo) { const b = document.createElement('button'); b.type = 'button'; b.className = 'pm-btn'; b.setAttribute('aria-label', 'Undo'); b.title = 'Undo'; b.innerHTML = svg(I.undo, 16); b.onclick = () => { el.classList.remove('on'); undo(); }; el.append(b); }
41
+ el.classList.add('on'); clearTimeout(toast.t); toast.t = setTimeout(() => el.classList.remove('on'), undo ? 10000 : 4200);
42
+ }
43
+ function draw() { const b = $('pfBody'); if (b) b.innerHTML = pageHtml(V, { name: productName }); }
44
+ async function load() {
45
+ const r = await pmGet('/api/product-portfolio');
46
+ if (!(r && r.ok)) { const b = $('pfBody'); if (b) b.innerHTML = '<p class="pm-meta">The products could not be read. Open the page again in a minute.</p>'; return; }
47
+ V = r; draw();
48
+ }
49
+ async function answer(kind) {
50
+ const key = V && V.rec && V.rec.key; if (!key) return;
51
+ const r = await pmPost('/api/product-portfolio/decide', { key, kind });
52
+ if (!(r && r.ok)) { toast((r && r.error) || 'Not saved.'); return; }
53
+ await load();
54
+ toast(kind === 'keep' ? 'Kept.' : 'Not now: hidden for 7 days.', async () => { await pmPost('/api/product-portfolio/decide', { key, kind: 'undo' }); await load(); });
55
+ }
56
+ async function open(ws) { const r = await savePick([ws]); if (r && r.ok === false) { toast(r.error); return; } location.href = '/premium-board.html'; }
57
+
58
+ if (typeof document !== 'undefined' && document.getElementById('pfBody')) {
59
+ mountNav('portfolio', document, {});
60
+ document.addEventListener('click', (e) => {
61
+ const t = e.target.closest('[data-pf-keep],[data-pf-later],[data-pf-row]'); if (!t) return;
62
+ if (t.hasAttribute('data-pf-keep')) answer('keep'); else if (t.hasAttribute('data-pf-later')) answer('not-now'); else open(t.getAttribute('data-pf-row'));
63
+ });
64
+ document.addEventListener('keydown', (e) => { const t = e.target.closest && e.target.closest('[data-pf-row]'); if (t && e.key === 'Enter') open(t.getAttribute('data-pf-row')); });
65
+ load();
66
+ try { whenNames().then(draw).catch(() => {}); } catch { /* names come with the page */ }
67
+ }
@@ -7,6 +7,9 @@
7
7
  * pressOf(P, ws) PURE. The pick a press saves: that product alone, or every product when it is already shown alone
8
8
  * press(P, ws) saves pressOf with savePick, so every page follows (pp:changed) → savePick's answer
9
9
  *
10
+ * The row ends with one icon link to the Portfolio (initiative portfolio, bet A56): every product side by side. Like the row, it shows only
11
+ * with two or more products.
12
+ *
10
13
  * Each tile is a button with data-psw, so the local use log (pm/use-log.js, A466) counts the presses: the outcome check reads them with
11
14
  * node workspace/lib/product-dots.js count. Tiles, letters and tints are the product chip's own (cozy-pick.js). */
12
15
  import { pmGet } from './http.js';
@@ -21,6 +24,9 @@ export async function readDots() { const r = await pmGet('/api/briefing-premium/
21
24
  /** The one product shown alone, or null when two or more are shown. */
22
25
  const aloneOf = (P) => { const on = P.products.filter((p) => p.on); return on.length === 1 ? on[0].ws : null; };
23
26
 
27
+ const PORTFOLIO = '<a class="psw-b psw-pf" data-psw-pf href="/premium-portfolio.html" aria-label="Portfolio: every product side by side" title="Portfolio">'
28
+ + '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M4 20V11M10 20V5M16 20v-6M21 20H3"/></svg></a>';
29
+
24
30
  export function switcherHtml(P, o = {}) {
25
31
  if (!P || !Array.isArray(P.products) || P.products.length < 2) return '';
26
32
  const T = o.tones || tonesOf(P.products), alone = aloneOf(P);
@@ -30,7 +36,7 @@ export function switcherHtml(P, o = {}) {
30
36
  return `<button type="button" class="psw-b" data-psw="${esc(p.ws)}" aria-pressed="${p.ws === alone}" aria-label="${esc(words)}" title="${esc(words)}">`
31
37
  + `<i class="ppk-t t${T[p.ws] || 0}" aria-hidden="true">${esc(codeOf(p))}</i>${n > 0 ? '<i class="psw-dot" aria-hidden="true"></i>' : ''}</button>`;
32
38
  }).join('');
33
- return `<div class="psw${o.cls ? ' ' + esc(o.cls) : ''}" role="group" aria-label="Switch product">${tiles}</div>`;
39
+ return `<div class="psw${o.cls ? ' ' + esc(o.cls) : ''}" role="group" aria-label="Switch product">${tiles}${PORTFOLIO}</div>`;
34
40
  }
35
41
 
36
42
  export function pressOf(P, ws) {
@@ -0,0 +1,75 @@
1
+ /* pm/review-reasons.js — Customer voice on Work: survey comments and app-store reviews grouped by reason, not by score (idea A427,
2
+ * initiative review-reasons; board BatchMoreADS panel 28). It sits under the principles on a Board that shows one product.
3
+ *
4
+ * mount(host, { ws, single, say }) → draws the block into `host`; a Board that shows several products at once shows none
5
+ *
6
+ * Built only from Komorebi parts: a Detail block (pm-block, its head), pm-table for the reasons, pm-said for the one ✦, pm-meta for the
7
+ * score line, pm-badge alert for a growing complaint, icon-only pm-btn with a label. No inline style (conformance R28-1). It reads GET /api/voice and writes POST /api/voice/file and /api/voice/undo
8
+ * (lib/routes-strategy-card.js over lib/review-reasons.js, the ledger `pmos voice` writes too) and nothing else.
9
+ * · Rows sort by growth over 30 days; the chevron on a row opens its comments.
10
+ * · One ✦ for the fastest-growing complaint; accepting it files a triage item and the Board's toast offers Undo.
11
+ * · The score stays as one line under the reasons. Comments with no reason yet: one quiet count.
12
+ * · No comments: no block (zero is silence).
13
+ * Each ✦ press notes voiceFile and each Undo voiceUndo in the local use log (the bet's kill line). */
14
+ import { pmGet, pmPost } from './http.js';
15
+ import { noteUse } from './use-log.js';
16
+
17
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
18
+ const SV = (d, cls = 'pm-ic') => `<svg class="${cls}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
19
+ const I = { voice: 'M4 5h16v11H9l-5 4z', chev: 'M7 10l5 5 5-5', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3' };
20
+ const btn = (name, value, icon, label, kind = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" name="${name}" value="${esc(value)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
21
+ const when = (iso) => { const d = new Date(iso); return Number.isNaN(d.getTime()) ? '' : d.toISOString().slice(0, 10); };
22
+ const scoreOf = (c) => (c.score == null ? '' : `${c.score} of ${c.scale}`);
23
+
24
+ /** The block's markup. state = { rows, unsorted, score, suggest, open }. Pure, so the test reads it. '' when there is nothing to show. */
25
+ export function blockHtml(state) {
26
+ const rows = Array.isArray(state && state.rows) ? state.rows : [];
27
+ const unsorted = (state && state.unsorted) || 0;
28
+ if (!rows.length && !unsorted) return '';
29
+ const open = new Set((state && state.open) || []);
30
+ const growthCell = (r) => (/^up|^new$/.test(r.growth) && r.complaint ? `<span class="pm-badge alert">${esc(r.growth)}</span>` : esc(r.growth));
31
+ const row = (r) => {
32
+ const isOpen = open.has(r.reason);
33
+ const filed = r.filed ? ` <span class="pm-badge" title="Filed as a triage item">filed</span>` : '';
34
+ const main = `<tr data-voice-row="${esc(r.reason)}"><td>${esc(r.reason)}${filed}</td><td>${r.n}</td><td>${growthCell(r)}</td>`
35
+ + `<td>${btn('voiceOpen', r.reason, I.chev, (isOpen ? 'Close the comments of ' : 'Open the comments of ') + r.reason, 'ghost')}</td></tr>`;
36
+ if (!isOpen) return main;
37
+ const list = (r.comments || []).map((c) => `<div class="pm-li" role="listitem"><span class="txt"><span class="t">${esc(c.text)}</span>`
38
+ + `<span class="w">${esc([c.source, scoreOf(c), when(c.at)].filter(Boolean).join(' · '))}</span></span></div>`).join('');
39
+ return main + `<tr data-voice-comments="${esc(r.reason)}"><td colspan="4"><div role="list">${list}</div></td></tr>`;
40
+ };
41
+ const table = rows.length ? `<table class="pm-table"><thead><tr><th>Reason</th><th>Comments</th><th>30 days</th><th><span class="vh">Open</span></th></tr></thead><tbody>${rows.map(row).join('')}</tbody></table>` : '';
42
+ const s = state && state.suggest;
43
+ const said = s ? `<p class="pm-said">${SV(I.spark, 'pm-ic pm-star')}<span>${esc(s.line)}</span>${btn('voiceFile', s.reason, I.spark, 'Make it a work item: PMOS files it in triage', 'primary')}</p>` : '';
44
+ const foot = [state && state.score, unsorted ? `${unsorted} ${unsorted === 1 ? 'comment has' : 'comments have'} no reason yet` : ''].filter(Boolean).join(' · ');
45
+ return `<section class="pm-block" aria-label="Customer voice"><div class="head">${SV(I.voice)}<h3 class="pm-h-sm">Customer voice</h3><span class="sp"></span></div>`
46
+ + table + said + (foot ? `<p class="pm-meta">${esc(foot)}</p>` : '') + '</section>';
47
+ }
48
+
49
+ /** Draw the block into `host` and wire its presses. */
50
+ export async function mount(host, opts = {}) {
51
+ if (!host) return;
52
+ const { ws = null, single = true, say = null } = opts;
53
+ if (!single) { host.hidden = true; host.innerHTML = ''; return; }
54
+ const r = await pmGet('/api/voice' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
55
+ if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves the Board as it was
56
+ const state = { ...r, open: host._voiceOpen || [] };
57
+ const html = blockHtml(state);
58
+ host.hidden = !html; host.innerHTML = html;
59
+ host.onclick = async (e) => {
60
+ const b = e.target.closest('button[name="voiceOpen"], button[name="voiceFile"]'); if (!b) return;
61
+ if (b.name === 'voiceOpen') {
62
+ const set = new Set(host._voiceOpen || []); if (set.has(b.value)) set.delete(b.value); else set.add(b.value);
63
+ host._voiceOpen = [...set]; host.innerHTML = blockHtml({ ...r, open: host._voiceOpen }); return;
64
+ }
65
+ noteUse('voiceFile');
66
+ b.disabled = true;
67
+ const res = await pmPost('/api/voice/file', { ws, reason: b.value }).catch(() => null);
68
+ if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not filed.'); return; }
69
+ if (say) say('Filed in triage.', async () => { noteUse('voiceUndo'); await pmPost('/api/voice/undo', { ws, capture: res.capture }).catch(() => null); mount(host, opts); });
70
+ mount(host, opts);
71
+ };
72
+ }
73
+
74
+ /** Draw the block again after a read of the Board. */
75
+ export const refresh = (host, opts) => mount(host, opts);
@@ -0,0 +1,125 @@
1
+ /* pm/stakeholder-map.js — the People block of an initiative on Work: who decides, who must agree, who needs to know, and when each last heard
2
+ * from you (initiative stakeholder-map, job #1896, idea A371; board BatchPeopleDS panel 9, agreed 2026-11-25).
3
+ *
4
+ * blockHtml(map, ui) → the block's markup ('' when there is no name: zero is silence). Pure, so the test reads it.
5
+ * map: GET /api/stakeholders; ui: { open: the id whose ✦ draft update is open }
6
+ * blockFor(ini, ws, redraw) → the block for the popup drawn now: reads GET /api/stakeholders once per initiative, then draws from memory
7
+ * press(e, body, { say }) → the popup's click listener hands each press here first: keep, drop, group, ✦, copy, I sent it
8
+ *
9
+ * Built only from the system parts on the board: pm-block, pm-li, pm-said, pm-btn and the state glyphs (pm/state-glyph.js). Every button
10
+ * is icon-only with an aria-label. A row is a draft until kept: ✓ keeps it in its group, ✕ takes it off, the group button moves it to the
11
+ * next group. A row with no news for 3 weeks has the late glyph and a ✦: it opens the draft update to copy. PMOS NEVER SENDS IT: "I sent it"
12
+ * only records the date (POST act told). Each write offers Undo in the toast. The UI says PMOS, never Claude. */
13
+ import { pmGet, pmPost } from './http.js';
14
+ import { noteUse } from './use-log.js';
15
+ import { stateGlyph } from './state-glyph.js';
16
+ import { undoToast } from './hi-pop.js';
17
+
18
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
19
+ const SV = (d, w = 16) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
20
+ const I = {
21
+ spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18',
22
+ group: 'M7 7h10M7 12h10M7 17h6M17 15l2 2-2 2', copy: 'M9 9h10v10H9zM5 15V5h10', sent: 'M4 12l16-8-6 16-3-7z',
23
+ };
24
+ export const NEXT_GROUP = Object.freeze({ decides: 'agree', agree: 'know', know: 'decides' });
25
+ export const GROUP_WORD = Object.freeze({ decides: 'decides', agree: 'must agree', know: 'needs to know' });
26
+
27
+ /** "last heard 3 days ago" · "last heard today" · "no update on record". */
28
+ export function heardText(days) {
29
+ if (days == null) return 'no update on record';
30
+ if (days === 0) return 'last heard today';
31
+ return `last heard ${days} ${days === 1 ? 'day' : 'days'} ago`;
32
+ }
33
+ const btn = (attrs, label, icon, kind = '') => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" ${attrs} aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
34
+
35
+ export function blockHtml(map, ui = {}) {
36
+ const rows = Array.isArray(map && map.rows) ? map.rows : [];
37
+ if (!rows.length) return '';
38
+ const ini = String((map && map.ini) || '');
39
+ const row = (r) => {
40
+ const g = r.stale ? stateGlyph('late', { why: `No news in ${r.days} days` }) : stateGlyph('on', { progress: 0, why: r.days == null ? 'No update on record yet' : 'Heard from in the last 3 weeks' });
41
+ const sub = [heardText(r.days), r.kept ? '' : 'draft: ' + r.why].filter(Boolean).join(' · ');
42
+ const id = esc(r.id), nm = esc(r.name);
43
+ const acts = `<span class="acts">${btn(`data-sm-act="group" data-sm-id="${id}" data-sm-group="${esc(NEXT_GROUP[r.group] || 'know')}"`, `Move ${r.name} to ${GROUP_WORD[NEXT_GROUP[r.group]] || 'needs to know'}`, I.group)}`
44
+ + (r.kept ? '' : btn(`data-sm-act="drop" data-sm-id="${id}"`, `Take ${r.name} off`, I.x, 'outline') + btn(`data-sm-act="keep" data-sm-id="${id}" data-sm-group="${esc(r.group)}"`, `Keep ${r.name}`, I.ok, 'primary')) + '</span>';
45
+ const star = r.update ? btn(`data-sm-act="read" data-sm-id="${id}" aria-expanded="${ui.open === r.id}"`, `Read the draft update for ${r.name}`, I.spark) : '';
46
+ const li = `<div class="pm-li${r.stale ? ' sm-stale' : ''}${r.kept ? '' : ' sm-draft'}" role="listitem" data-sm-row="${id}" data-sm-name="${nm}">${g}`
47
+ + `<span class="txt"><span class="t">${nm} · ${esc(GROUP_WORD[r.group] || r.groupWord || '')}</span><span class="w">${esc(sub)}</span></span>${acts}${star}</div>`;
48
+ const upd = r.update && ui.open === r.id
49
+ ? `<div class="pm-said sm-upd" role="group" aria-label="PMOS drafted this update; you send it">${SV(I.spark, 14)}<p>${esc(r.update)}</p>`
50
+ + `<span class="sm-upd-b">${btn(`data-sm-act="copy" data-sm-id="${id}"`, 'Copy the update', I.copy, 'outline')}${btn(`data-sm-act="told" data-sm-id="${id}"`, 'I sent it', I.sent, 'primary')}</span></div>`
51
+ : '';
52
+ return li + upd;
53
+ };
54
+ return `<section class="pm-block sm-block" aria-label="People" data-sm-ini="${esc(ini)}"><div class="head"><h3 class="pm-h-sm sm-h">People</h3><span class="pm-meta">${rows.length}</span></div>`
55
+ + `<div role="list">${rows.map(row).join('')}</div></section>`;
56
+ }
57
+
58
+ /* ── the popup ── */
59
+ const MAPS = new Map(); // ws|ini → map | null while reading | false when there is none
60
+ const UI = { open: '' };
61
+ const kOf = (ini, ws) => (ws || '') + '|' + ini;
62
+ let CSS_DONE = false;
63
+ function css() {
64
+ if (CSS_DONE || typeof document === 'undefined' || !document.head) return;
65
+ CSS_DONE = true;
66
+ const s = document.createElement('style');
67
+ s.textContent = '.sm-block .sm-h{flex:1}.sm-block .pm-li.sm-stale{background:var(--well)}.sm-block .pm-li.sm-draft .t{font-weight:500}.sm-block .sm-upd{max-width:none;margin:0 8px 8px 44px;align-items:flex-start}'
68
+ + '.sm-block .sm-upd p{flex:1;margin:0}.sm-block .sm-upd-b{display:flex;gap:4px}';
69
+ document.head.appendChild(s);
70
+ }
71
+ function load(ini, ws, redraw, again = false) {
72
+ const k = kOf(ini, ws);
73
+ if (!again) MAPS.set(k, null);
74
+ pmGet('/api/stakeholders?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
75
+ .then((x) => { MAPS.set(k, x && x.ok ? x : false); if (x && x.ok && ((x.rows || []).length || again) && redraw) redraw(); })
76
+ .catch(() => MAPS.set(k, false));
77
+ }
78
+ let lastRedraw = null, lastWs = '';
79
+ export function blockFor(ini, ws, redraw) {
80
+ if (!ini) return '';
81
+ lastRedraw = redraw; lastWs = ws || '';
82
+ const k = kOf(ini, ws);
83
+ if (!MAPS.has(k)) load(ini, ws, redraw);
84
+ const m = MAPS.get(k);
85
+ if (!m) return '';
86
+ css();
87
+ return blockHtml(m, UI);
88
+ }
89
+ if (typeof document !== 'undefined' && document.addEventListener) document.addEventListener('cz:chat-turn', () => { MAPS.clear(); if (lastRedraw) lastRedraw(); });
90
+
91
+ async function write(ini, ws, body) {
92
+ const r = await pmPost('/api/stakeholders', { ws: ws || null, ini, ...body }).catch(() => null);
93
+ load(ini, ws, lastRedraw, true);
94
+ return r;
95
+ }
96
+ /** One press inside the popup body: the popup's own click listener (pm/cozy-pop-work.js) hands every press here first; true when it was
97
+ * the People block's, so the popup leaves it alone. */
98
+ export function press(e, body, { say } = {}) {
99
+ const b = e.target.closest && e.target.closest('[data-sm-act]');
100
+ if (!b || !body || !body.contains(b)) return false;
101
+ const sec = b.closest('[data-sm-ini]');
102
+ if (!sec) return false;
103
+ e.stopImmediatePropagation(); // the popup's own press handler (registered after this one) leaves it alone
104
+ act(b, sec, say);
105
+ return true;
106
+ }
107
+ async function act(b, sec, say) {
108
+ const ini = sec.dataset.smIni, ws = lastWs, id = b.dataset.smId, what = b.dataset.smAct;
109
+ const m = MAPS.get(kOf(ini, ws)), row = m && (m.rows || []).find((r) => r.id === id);
110
+ if (!row) return;
111
+ const tell = (text, undoIt) => { if (undoIt) undoToast(text, undoIt); else if (say) say(text); };
112
+ if (what === 'read') { UI.open = UI.open === id ? '' : id; noteUse('stakeholderUpdate'); if (lastRedraw) lastRedraw(); return; }
113
+ if (what === 'copy') {
114
+ try { await navigator.clipboard.writeText(row.update || ''); tell('Copied. Send it from your mail or chat.'); } catch { tell('Select the text and copy it.'); }
115
+ return;
116
+ }
117
+ const kind = what === 'group' ? 'keep' : what;
118
+ noteUse('stakeholder' + kind[0].toUpperCase() + kind.slice(1));
119
+ b.disabled = true;
120
+ const r = await write(ini, ws, { person: id, name: row.name, act: kind, ...(kind === 'keep' ? { group: b.dataset.smGroup } : {}) });
121
+ if (!r || !r.ok) { b.disabled = false; tell((r && r.error) || 'Not saved.'); return; }
122
+ if (kind === 'told') UI.open = '';
123
+ const word = { keep: `${row.name} kept · ${GROUP_WORD[b.dataset.smGroup] || ''}`, drop: `${row.name} taken off`, told: `Marked: ${row.name} heard from you today` }[kind];
124
+ tell(word, () => { write(ini, ws, { person: id, name: row.name, act: 'undo' }); });
125
+ }
@@ -0,0 +1,35 @@
1
+ /* pm/starter-goals.js — the Starter goals block under the fundamentals card after setup (initiative starter-goals, job #1916, idea A84;
2
+ * board BatchMoreBDS panel 32, agreed 2026-11-25).
3
+ *
4
+ * starterBlock(starter, { busy }) PURE → the block's HTML, or '' when no draft is open (zero is silence)
5
+ *
6
+ * Built from the system parts only: the ✦ line (pm-said), pm-block list, pm-li rows with the "No signal" state glyph (a draft reads nothing
7
+ * yet), and icon-only Keep (✓) and Drop (✕) buttons with an aria-label. Each row names its source: "from: <label>". The rows come from
8
+ * lib/starter-goals.js view() through GET /api/onboard/state; a press posts { act, n } to /api/onboard/starter (cozy-onboard.js), which
9
+ * answers with the Undo toast. Text from the product's files is escaped. */
10
+ import { stateGlyph } from './state-glyph.js';
11
+
12
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
13
+ const STAR = '<svg class="pm-ic pm-star" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z"/></svg>';
14
+ const KEEP = '<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
15
+ const DROP = '<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>';
16
+
17
+ /** What the drafts came from, said once: "From your product's README and 30 tickets, 3 starter goals, as drafts." PURE. */
18
+ export function starterSaid(rows) {
19
+ const refs = [...new Set(rows.map((r) => (r.source && r.source.ref) || ''))].filter(Boolean);
20
+ const n = rows.length;
21
+ return `From your product's own ${refs.length ? refs.join(', ').replace(/, ([^,]*)$/, ' and $1') : 'files'}: ${n} starter ${n === 1 ? 'goal' : 'goals'}, as drafts. A draft counts nowhere until you keep it.`;
22
+ }
23
+
24
+ export function starterBlock(starter, { busy = false } = {}) {
25
+ const rows = ((starter && starter.rows) || []).filter((r) => r && r.text && r.source && r.source.label); // a draft without a source is never shown
26
+ if (!rows.length) return '';
27
+ const dis = busy ? ' disabled' : '';
28
+ const li = rows.map((r) => `<div class="pm-li" data-sg-row="${esc(r.n)}">${stateGlyph('none', { why: 'a draft reads nothing yet' })}`
29
+ + `<span class="txt"><span class="t">${esc(r.text)}</span><span class="w">from: ${esc(r.source.label)}</span></span>`
30
+ + `<span class="acts sg-acts"><button type="button" class="pm-btn" data-sg="keep" data-n="${esc(r.n)}" aria-label="Keep" title="Keep"${dis}>${KEEP}</button>`
31
+ + `<button type="button" class="pm-btn" data-sg="drop" data-n="${esc(r.n)}" aria-label="Drop" title="Drop"${dis}>${DROP}</button></span></div>`).join('');
32
+ return `<p class="pm-said sg-said">${STAR}<span>${esc(starterSaid(rows))}</span></p>`
33
+ + `<section class="pm-block list sg-block" aria-label="Starter goals"><div class="head"><h3 class="pm-h-sm">Starter goals</h3><span class="sp"></span><span class="pm-meta">${rows.length}</span></div>`
34
+ + `<div class="rows">${li}</div></section>`;
35
+ }
@@ -0,0 +1,48 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <script src="/api/view-prefs/boot.js"></script>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
8
+ <title>PMOS · Portfolio</title>
9
+ <!-- Portfolio (initiative portfolio, bet A56, board BatchPlanDS panel 7): every product side by side for a head of product. One Table block:
10
+ one row per product with its bets, odds, spend and outcome so far, then at most one ✦ recommendation with Keep and Not now. A row opens the
11
+ product in Work; nothing here edits a product. Reached from the product tiles of Today and Work, which show only with two or more products.
12
+ The page code is pm/portfolio.js; the rows come from GET /api/product-portfolio (lib/portfolio.js). -->
13
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
14
+ <link rel="stylesheet" href="/pm/brand.css" />
15
+ <link rel="stylesheet" href="/pm/charts.css" />
16
+ <link rel="stylesheet" href="/pm/komorebi.css" />
17
+ <link rel="stylesheet" href="/pm/cozy.css" />
18
+ <link rel="stylesheet" href="/pm/ds-bridge.css" />
19
+ <style>
20
+ .pf-page { gap: var(--space-16); }
21
+ .pf-page > * { width: 100%; }
22
+ .pf-page .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
23
+ .pf-top { display: flex; align-items: center; gap: var(--space-12); min-height: 32px; }
24
+ .pf-page .pm-block { max-width: 760px; }
25
+ .pf-page .pm-table { width: 100%; border-collapse: collapse; }
26
+ .pf-page .pm-table th { text-align: left; font-weight: 600; }
27
+ .pf-page .pm-table td.n, .pf-page .pm-table th.n { font-variant-numeric: tabular-nums; }
28
+ .pf-page tr[data-pf-row] { cursor: pointer; }
29
+ .pf-page tr[data-pf-row]:focus-visible td { background: var(--well); outline: none; }
30
+ .pf-page .pm-said { align-items: center; max-width: none; }
31
+ .pf-page .pm-said .sp { flex: 1; }
32
+ .pf-page .pf-mark { color: var(--blue); }
33
+ .pf-page .pf-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: auto; display: none; align-items: center; gap: 8px; background: var(--ink); color: var(--card); border-radius: var(--radius-md); padding: 6px 8px 6px 14px; }
34
+ .pf-page .pf-toast.on { display: flex; }
35
+ .pf-page .pf-toast .pm-btn { color: var(--card); }
36
+ </style>
37
+ </head>
38
+ <body class="cz">
39
+ <main class="cz-panel stage pf-page pm-ds" id="stage">
40
+ <h1 class="vh">Portfolio</h1>
41
+ <div class="pf-top"><nav class="pm-path" aria-label="Path"><b>Portfolio</b></nav></div>
42
+ <div id="pfBody"><p class="pm-meta">Reading your products.</p></div>
43
+ <div class="pf-toast" id="pfToast" role="status" aria-live="polite"></div>
44
+ </main>
45
+ <noscript>This page needs JavaScript.</noscript>
46
+ <script type="module" src="/pm/portfolio.js"></script>
47
+ </body>
48
+ </html>
@@ -7421,7 +7421,7 @@ async function handleRequest(req, res) {
7421
7421
  res.writeHead(302, { Location: '/today.html?onboard=1', 'Cache-Control': 'no-store' });
7422
7422
  return res.end();
7423
7423
  }
7424
- const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html', '/premium-buddy': 'premium-buddy.html', '/premium-buddy.html': 'premium-buddy.html' };
7424
+ const PAGES = { '/premium-routine': 'premium-routine.html', '/premium-routine.html': 'premium-routine.html', '/': 'today.html', '/index.html': 'today.html', '/today': 'today.html', '/today.html': 'today.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-events': 'premium-events.html', '/premium-events.html': 'premium-events.html', '/premium-library': 'premium-library.html', '/premium-library.html': 'premium-library.html', '/premium-goals': 'premium-goals.html', '/premium-goals.html': 'premium-goals.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html', '/premium-buddy': 'premium-buddy.html', '/premium-buddy.html': 'premium-buddy.html', '/premium-portfolio': 'premium-portfolio.html', '/premium-portfolio.html': 'premium-portfolio.html' };
7425
7425
  const page = capture ? 'capture.html' : Object.prototype.hasOwnProperty.call(PAGES, p) ? PAGES[p] : null;
7426
7426
  if (page) {
7427
7427
  // pm-os-absorb Run 2 (R25, X11): the per-launch nonce goes into the base meta line, nowhere else. no-store, so a
@@ -233,8 +233,9 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
233
233
  ok('S6 Move to a stage lists the workflow\'s stages, the task\'s own checked', sl && sl.includes('Build*') && sl.includes('Deliver') && sl[sl.length - 1] === 'Not in a stage', JSON.stringify(sl));
234
234
  await p.click('.tkc.ivq [data-ive-to="deliver"]');
235
235
  const mv = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.section === 'deliver' ? x : null; });
236
- const t6 = await until(async () => { const t = await toast(p); return /Moved to Deliver/.test(t) ? t : null; }, 4000);
237
- const inD = await until(async () => ((await rowsOf(p, 'deliver')).includes('task-b1') ? true : null), 4000);
236
+ // 10 s, not 4: with three browser suites at once on 4 cores the toast and the moved row came after 4 s (2026-11-25). The toast stays 9 s.
237
+ const t6 = await until(async () => { const t = await toast(p); return /Moved to Deliver/.test(t) ? t : null; }, 10000);
238
+ const inD = await until(async () => ((await rowsOf(p, 'deliver')).includes('task-b1') ? true : null), 10000);
238
239
  ok('S6 a stage picked there moves the task (section), "Moved to Deliver" with Undo, and it shows under Deliver', mv && /Undo/.test(t6 || '') && inD, JSON.stringify({ mv, t6 }));
239
240
  await undo(p);
240
241
  const mu = await until(() => { const x = lastPost(A, '/api/boards/tasks/edit'); return x && x.body.section === 'build' ? x : null; });
@@ -273,10 +274,11 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
273
274
  const ad = await until(() => lastPost(A, '/api/boards/tasks/add'));
274
275
  ok('S8 Enter adds the task into that stage (section build)', ad && ad.body.title === 'Release note for app teams' && ad.body.section === 'build', JSON.stringify(ad));
275
276
  const t8 = await until(async () => { const t = await toast(p); return /Added to Build/.test(t) ? t : null; }, 4000);
276
- const k8 = await until(() => p.evaluate(() => { const i = document.querySelector('#czViewer .iv-addin input'); return i && i.value === '' && document.activeElement === i ? true : null; }), 4000);
277
- ok('S8 the toast says "Added to Build" with Undo; the field stays open, empty and focused', /Undo/.test(t8 || '') && k8, JSON.stringify({ t8, k8 }));
278
277
  await shot(p, 'S8-add-390');
278
+ // Undo first: the toast holds it for 9 s (hi-pop.js undoToast), and on a busy runner the waits before it ran past that (2026-11-25).
279
279
  const u8 = await undo(p);
280
+ const k8 = await until(() => p.evaluate(() => { const i = document.querySelector('#czViewer .iv-addin input'); return i && i.value === '' && document.activeElement === i ? true : null; }), 10000);
281
+ ok('S8 the toast says "Added to Build" with Undo; the field stays open, empty and focused', /Undo/.test(t8 || '') && k8, JSON.stringify({ t8, k8 }));
280
282
  const du = await until(() => lastPost(A, '/api/boards/tasks/delete'));
281
283
  ok('S8 Undo takes the new task out', du && /^task-n/.test(du.body.task || ''), JSON.stringify({ u8, du, last: A.posts.slice(-3) }));
282
284
  await p.keyboard.press('Escape');
@@ -285,7 +287,8 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
285
287
  /* S9 a Jira row */
286
288
  await p.click('#czViewer [data-iv-edit="task-b2"]');
287
289
  const j9 = await until(() => p.evaluate(() => { const r = document.querySelector('#czViewer .iv-ed[data-iv-open="task-b2"]'); if (!r) return null; return { field: !!r.querySelector('input'), st: !!r.querySelector('.iv-edst'), line: (r.querySelector('.iv-edj') || {}).textContent, dates: r.querySelectorAll('.iv-edd').length }; }));
288
- ok('S9 a Jira row in place: the title and status read-only, "In Progress in Jira · read 4 min ago", start and due editable', j9 && !j9.field && !j9.st && j9.line === 'In Progress in Jira · read 4 min ago' && j9.dates === 2, JSON.stringify(j9));
290
+ // The browser clock starts at DAY and runs, so a slow run reads the 4-minute-old read as 5 min or more (2026-11-25).
291
+ ok('S9 a Jira row in place: the title and status read-only, "In Progress in Jira · read 4 min ago", start and due editable', j9 && !j9.field && !j9.st && /^In Progress in Jira · read [4-9] min ago$/.test(j9.line || '') && j9.dates === 2, JSON.stringify(j9));
289
292
  await shot(p, 'S9-jira-390');
290
293
  await p.click('#czViewer .iv-ed [data-f="due"]');
291
294
  await until(() => p.evaluate(() => !!document.querySelector('.tkc.ivq .tkc-dp')));
@@ -418,6 +421,9 @@ const TICKETS = [{ key: 'IDPF-3387', title: 'Refactor the AppAuthService', statu
418
421
  {
419
422
  const P = await open({ where: 'board', w: 1440, h: 900, pop: true }), q = P.page;
420
423
  await until(() => q.evaluate(() => !!document.querySelector('.cz-pop:not([hidden]) [data-pw-date="task-b4"]')), 20000);
424
+ // The popup gives its card the focus one task after it opens (cozy-popup.js show). The row can be drawn before that, and a press in
425
+ // between saw the card take the focus back from the calendar's day (main 0d34250, 1 of 2 local runs). Press once the card holds it.
426
+ await until(() => q.evaluate(() => { const c = document.querySelector('.cz-pop:not([hidden]) .cz-pop-card'); return !!c && c.contains(document.activeElement); }), 10000);
421
427
  await q.evaluate(() => document.querySelector('.cz-pop:not([hidden]) [data-pw-date="task-b4"]').click());
422
428
  const o14 = await until(() => q.evaluate(() => { const r = document.querySelector('.pw-rp .rp'); return r ? { ends: [...r.querySelectorAll('[data-rp-end]')].map((e) => e.dataset.rpEnd + (e.classList.contains('on') ? '*' : '')).join(), seg: !!document.querySelector('.pw-seg'), clear: !!r.querySelector('[data-rp-clear]'), focus: (document.activeElement || {}).dataset ? document.activeElement.dataset.rpDay || '' : '' } : null; }).then((x) => (x && x.focus ? x : null)), 3000) || await q.evaluate(() => ({ ends: [...document.querySelectorAll('.pw-rp [data-rp-end]')].map((e) => e.dataset.rpEnd + (e.classList.contains('on') ? '*' : '')).join(), focus: (document.activeElement || {}).outerHTML ? document.activeElement.outerHTML.slice(0, 120) : '' }));
423
429
  ok('S14 the work popup: a row\'s date press opens the one calendar under Task or Milestone, Start on, the focus on a day, No date at the foot', o14 && o14.ends === 'start*,due' && o14.seg && o14.clear && /^2026-10-\d\d$/.test(o14.focus), JSON.stringify(o14));
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Architecture warnings when work touches risky code (initiative arch-warns, done test A1-A8, N1-N3): the reading over the stored code map, GET /api/arch-warns, the popup's one ✦ with its test-task step, and pmos code warns. No browser, model or network.",
3
+ "modules": [
4
+ "arch-warns.test.js"
5
+ ],
6
+ "seconds": {
7
+ "arch-warns.test.js": 2
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Work and Today get the popup's five-action limit (five-action-cap, idea A529, done test planning/done-tests/five-action-cap.md F1-F7, N1, N2): the pure rule, the Today row drawn as a string, the count guard on Work's header, the use-log fold, the route and pmos board actions. No server, network or browser.",
3
+ "modules": [
4
+ "five-action-cap.test.js"
5
+ ],
6
+ "seconds": {
7
+ "five-action-cap.test.js": 2
8
+ }
9
+ }