create-pmos 0.433.0 → 0.435.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 (89) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-insights-test.js +63 -58
  7. package/workspace/changelog.json +24 -0
  8. package/workspace/fixtures/ready-reports.js +145 -0
  9. package/workspace/guide/index.md +2 -0
  10. package/workspace/guide/metric-drafts.md +21 -1
  11. package/workspace/guide/ready-made-dashboards.md +62 -0
  12. package/workspace/guide/your-impact.md +58 -0
  13. package/workspace/impact-screens-test.js +149 -0
  14. package/workspace/intel-report-ui-test.js +1 -1
  15. package/workspace/intelligence-gaps-ui-test.js +13 -9
  16. package/workspace/lib/board-premium.js +1 -1
  17. package/workspace/lib/engine/outbox.js +1 -1
  18. package/workspace/lib/engine/records/index.js +11 -3
  19. package/workspace/lib/goal-status.js +199 -0
  20. package/workspace/lib/goal-watch.js +71 -0
  21. package/workspace/lib/headless.js +24 -2
  22. package/workspace/lib/impact-cli.js +72 -0
  23. package/workspace/lib/impact-runs.js +114 -0
  24. package/workspace/lib/impact.js +195 -0
  25. package/workspace/lib/insights-premium.js +43 -4
  26. package/workspace/lib/intel-report.js +36 -5
  27. package/workspace/lib/metric-draft-runs.js +33 -10
  28. package/workspace/lib/metric-drafts.js +118 -15
  29. package/workspace/lib/metric-read-runs.js +132 -0
  30. package/workspace/lib/metric-reads.js +129 -0
  31. package/workspace/lib/metrics-cli.js +100 -5
  32. package/workspace/lib/pmos-verbs.js +4 -1
  33. package/workspace/lib/ready-reports.js +616 -0
  34. package/workspace/lib/report-dashboards.js +5 -0
  35. package/workspace/lib/report-setups.js +16 -7
  36. package/workspace/lib/route-modules.js +4 -0
  37. package/workspace/lib/routes-board-premium.js +5 -0
  38. package/workspace/lib/routes-boards.js +1 -1
  39. package/workspace/lib/routes-goal-status.js +111 -0
  40. package/workspace/lib/routes-impact-views.js +58 -0
  41. package/workspace/lib/routes-impact.js +91 -0
  42. package/workspace/lib/routes-insights-premium.js +20 -0
  43. package/workspace/lib/routes-metric-drafts.js +55 -4
  44. package/workspace/lib/routes-ready-reports.js +455 -0
  45. package/workspace/lib/routes-records.js +2 -0
  46. package/workspace/lib/routes-report-setups.js +4 -3
  47. package/workspace/lib/settings-store.js +3 -0
  48. package/workspace/okr-goals-ui-test.js +175 -0
  49. package/workspace/package-lock.json +2 -2
  50. package/workspace/package.json +1 -1
  51. package/workspace/program-charter-test.js +11 -7
  52. package/workspace/program-panel-test.js +1 -1
  53. package/workspace/public/pm/bd-ini-panel.js +33 -8
  54. package/workspace/public/pm/bd-prog-panel.js +58 -10
  55. package/workspace/public/pm/cozy-adler.css +5 -0
  56. package/workspace/public/pm/cozy-adler.js +17 -9
  57. package/workspace/public/pm/cozy-insights.css +84 -0
  58. package/workspace/public/pm/cozy-settings.js +11 -1
  59. package/workspace/public/pm/cozy-viewer.js +2 -2
  60. package/workspace/public/pm/cozy-vw-rp.css +13 -0
  61. package/workspace/public/pm/dash-view.css +111 -0
  62. package/workspace/public/pm/dash-view.js +261 -0
  63. package/workspace/public/pm/home-app.js +87 -8
  64. package/workspace/public/pm/home-data.js +3 -2
  65. package/workspace/public/pm/home-impact.css +16 -0
  66. package/workspace/public/pm/home-impact.js +72 -0
  67. package/workspace/public/pm/home-ini.js +19 -1
  68. package/workspace/public/pm/home-today.js +4 -2
  69. package/workspace/public/pm/impact.css +37 -0
  70. package/workspace/public/pm/impact.js +201 -0
  71. package/workspace/public/pm/okr-list.js +249 -0
  72. package/workspace/public/pm/premium-insights.js +232 -240
  73. package/workspace/public/pm/premium-report-read.js +36 -5
  74. package/workspace/public/pm/premium-vw-mtg.js +4 -1
  75. package/workspace/public/pm/ready-lib.css +29 -0
  76. package/workspace/public/pm/ready-lib.js +62 -0
  77. package/workspace/public/premium-intelligence.html +3 -2
  78. package/workspace/public/premium.html +1 -0
  79. package/workspace/ready-dash-ui-test.js +227 -0
  80. package/workspace/server.js +58 -2
  81. package/workspace/skills/impact-detect.skill +46 -0
  82. package/workspace/skills/metric-read.skill +32 -0
  83. package/workspace/test-lists/batch17-ready-reports.json +9 -0
  84. package/workspace/test-lists/goal-watch.json +9 -0
  85. package/workspace/test-lists/impact-screens.json +5 -0
  86. package/workspace/test-lists/impact-ui.json +9 -0
  87. package/workspace/test-lists/impact.json +9 -0
  88. package/workspace/test-lists/okr-goals-ui.json +5 -0
  89. package/workspace/test-lists/ready-reports-ui.json +6 -0
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* okr-goals-ui-test.js — "Claude runs the OKRs" on the Intelligence page (feedback batch 16 item 6, build 6-B; frames GsM1–M5, GsViewer, GsMore,
4
+ * GsMetrics, GsMetricsTree, GsNotify). Serves the real page from the real server; GET /api/insights-premium answers the model lib/insights-premium.js
5
+ * builds from its fixture, with the fields lib/goal-status.js adds (reading, recipe, who, notify, was, history, defn, okr) set on some goals, and
6
+ * GET /api/metric-drafts answers drafts that sit under their goal. The write routes are stubbed here so each press can be read back.
7
+ * L the list: the ✦ line, the North Star, Key results, Health budgets, in that order; a row is a dot, the outcome, its reading and age, and the
8
+ * owner, with no sparkline and no initiative status; a goal with no reading has a hollow dot
9
+ * D a draft sits under the row it repairs with ✕ / ✎ / ✓; ✓✓ in the ✦ line keeps them all; ✓ posts the row; the ✦ line never says "no insight"
10
+ * R a broken limit turns the ✦ line red (the one time) and pulses that row's dot
11
+ * V the goal Viewer: the reading against its line, the chart, why, and the folds How I read it, What it counts, History
12
+ * N the Viewer's ⋯: Notify me, Only in Intelligence (✦ my pick, on), Quiet; a press posts /api/goals/notify
13
+ * M ⋯ › Metrics: one list, goals first then "watch"; one switch shows the tree
14
+ * P on a phone: no sideways scroll, the same list. PMOS_SHOTS=<dir> also saves screenshots. */
15
+ const path = require('path');
16
+ const fs = require('fs');
17
+ const { spawn } = require('child_process');
18
+ const { findBrowser } = require('./lib/find-browser');
19
+ const T = require('./test-run').configure({ name: 'okr-goals-ui' });
20
+ const IP = require('./lib/insights-premium.js');
21
+ const F = require('./fixtures/insights-premium-facts.js');
22
+
23
+ const BASE = T.BASE;
24
+ const SHOTS = process.env.PMOS_SHOTS || '';
25
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
26
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
27
+ const results = [];
28
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 700) : ''}`); };
29
+ let srv = null; let browser = null;
30
+ const finish = async (code) => {
31
+ if (browser) await browser.close().catch(() => {});
32
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
33
+ T.killTmux();
34
+ const bad = results.filter((x) => !x.cond).length;
35
+ console.log(`\n${results.length - bad}/${results.length} okr-goals-ui assertions passed`);
36
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
37
+ };
38
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
39
+
40
+ /* the model with lib/goal-status.js's fields on it (the agreed JSON, 6-A): a North Star, readings with their dot and age, an owner, a recipe */
41
+ const BUDGETS = [{ id: 'docs', covers: 'documentation upkeep', cap: 0.2 }];
42
+ function model(o = {}) {
43
+ const M = IP.build(F.facts({ pinned: 'all', budgets: BUDGETS }));
44
+ const g = (id) => M.goals.find((x) => x.id === id);
45
+ g('krm-up').role = 'north-star';
46
+ Object.assign(g('krm-up'), { reading: { dot: 'on', at: '2026-10-15', ageDays: 3, stale: false, txt: '99.6% · up 0.4 since 1 Sep', line: '' }, who: null });
47
+ Object.assign(g('krm-act'), { reading: { dot: 'behind', at: '2026-10-15', ageDays: 3, stale: false, txt: '+8 of +30 points', line: 'its line says +18', why: 'SSO for partners ships 23 Oct; activation catches up about 3 weeks after.' },
48
+ recipe: { connector: 'Amplitude', query: 'partners active ÷ partners signed', cadence: 'weekly', last: { at: '2026-10-15', ok: true } }, who: { name: 'Raka Putra', initials: 'RP', from: 'jira' }, notify: 'intel',
49
+ was: 'Partner onboarding revamp', history: [{ at: '2026-10-01', text: 'Rewritten as an outcome' }, { at: '2026-10-02', text: 'You kept it' }], defn: 'Partners with one API call in their first 14 days, of all partners signed that month.' });
50
+ Object.assign(g('krm-ttfc'), { who: { name: 'Dewi', initials: 'D', from: 'jira' } });
51
+ M.metrics = [{ id: 'krm-up', title: 'Partner uptime', role: 'north-star', dot: 'on', meta: 'North Star · Datadog · Mon' },
52
+ { id: 'krm-act', title: 'Partner activation', role: 'input', parent: 'krm-up', dot: 'behind', meta: 'KR · Amplitude · Mon' },
53
+ { id: 'krm-ttfc', title: 'Time to first call', role: 'kr', dot: 'behind', meta: 'KR · typed in' },
54
+ { id: 'w-rating', title: 'App store rating', role: 'watch', meta: 'App Store Connect · Mon' }];
55
+ if (o.crit) { M.okr = { line: { head: 'Partner uptime fell under its floor at 14:02.', sub: 'It started with the gateway release. I drafted a rollback ticket for Sari.', tone: 'crit', keepAll: 0 }, alert: { rid: 'krm-up', title: 'Partner uptime', at: '2026-10-18T14:02:00Z', txt: '98.1%' } }; g('krm-up').reading.dot = 'broken'; }
56
+ return M;
57
+ }
58
+ const DRAFTS = (rows) => ({ ok: true, scope: 'product', id: 'w1', title: 'pmos', run: { state: 'ready', step: 4, reads: [] }, head: '', sub: '', src: '', rows });
59
+ const ROWS = [
60
+ { id: 'd-out', kind: 'outcome', goal: 'krm-ttfc', text: 'New partners make their first call within 3 days', why: 'Time to first call was a project; this is what it is for', old: 'Time to first call', act: 'Keep', state: 'open' },
61
+ { id: 'd-chase', kind: 'chase', goal: 'krm-act', text: 'Ask Raka if SSO for partners still ships 23 Oct', why: 'Thanks for the work on it. The goal catches up about 3 weeks after it ships', act: 'Send', state: 'open' },
62
+ { id: 'd-kr', kind: 'metric', group: 'Key results', name: 'Partners on the new SDK', nowTxt: '41%', targetTxt: '80% by Dec 31', why: 'From the SDK PRD', source: 'Amplitude', state: 'open' },
63
+ ];
64
+
65
+ (async () => {
66
+ const exe = process.env.PMOS_CHROME || findBrowser();
67
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
68
+ let chromium;
69
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
70
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
71
+ await T.waitForServer(BASE);
72
+ browser = await chromium.launch({ executablePath: exe });
73
+ if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
74
+ const shot = async (p, name, el) => { if (!SHOTS) return; await sleep(450); if (el) { const h = await p.$(el); if (h) await h.screenshot({ path: path.join(SHOTS, name + '.png') }); } else await p.screenshot({ path: path.join(SHOTS, name + '.png'), fullPage: true }); };
75
+
76
+ const open = async ({ w = 1440, h = 900, m = model(), rows = ROWS, theme = 'light' } = {}) => {
77
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
78
+ const page = await ctx.newPage();
79
+ const errors = [], posts = [];
80
+ page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
81
+ await page.route('**/api/insights-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, model: m }) }));
82
+ await page.route('**/api/board-metrics-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: { tiles: [] } }) }));
83
+ await page.route('**/api/briefing-premium/products', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, all: false, chosen: true, products: [{ ws: m.board.ws, name: m.board.name, primary: true, on: true }] }) }));
84
+ await page.route('**/api/metric-drafts?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(DRAFTS(rows)) }));
85
+ for (const k of ['keep', 'keep-all', 'drop', 'edit', 'undo', 'start']) await page.route('**/api/metric-drafts/' + k, (r) => { posts.push({ path: '/api/metric-drafts/' + k, body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify(k === 'keep' ? { ok: true, rid: 'r1' } : { ok: true, kept: 3 }) }); });
86
+ await page.route('**/api/goals/notify', (r) => { posts.push({ path: '/api/goals/notify', body: JSON.parse(r.request().postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
87
+ await page.goto(BASE + '/premium-intelligence.html?theme=' + theme);
88
+ await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .okr-row').length > 0), 20000);
89
+ await until(() => page.evaluate(() => !!document.querySelector('#goalTbl .okr-dr')), 6000);
90
+ return { ctx, page, errors, posts };
91
+ };
92
+ const txt = (p, s) => p.evaluate((x) => { const e = document.querySelector(x); return e ? e.textContent.replace(/\s+/g, ' ').trim() : ''; }, s);
93
+
94
+ /* L · the list */
95
+ const R = await open(), p = R.page;
96
+ const order = await p.evaluate(() => [...document.querySelectorAll('#insHero, #nsRow .okr-h, #goalTbl .okr-h')].filter((e) => e.offsetParent !== null).map((e) => e.id === 'insHero' ? '✦' : e.textContent));
97
+ ok('L1 top to bottom: the ✦ line, North Star, Key results, Health budgets', order.join('|') === '✦|North Star|Key results|Health budgets', order.join('|'));
98
+ const rows = await p.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => ({ id: r.dataset.goal, dot: (r.querySelector('.okr-main .cz-dot') || {}).className || '', meta: r.querySelector('.okr-main .note').textContent, av: !!r.querySelector('.okr-main .okr-av'), svg: !!r.querySelector('.okr-main svg'), pill: !!r.querySelector('.okr-main .cz-pill') })));
99
+ const act = rows.find((r) => r.id === 'krm-act') || {}, churn = rows.find((r) => r.id === 'krm-churn') || {};
100
+ ok('L2 a row is the dot, the outcome, its reading and the owner: no chart and no initiative status', rows.length >= 4 && rows.every((r) => r.av && !r.svg && !r.pill), JSON.stringify(rows));
101
+ ok('L3 the reading the status function sent is the row\'s line, behind is amber', act.meta === '+8 of +30 points · its line says +18' && /risk/.test(act.dot), JSON.stringify(act));
102
+ ok('L4 a goal with no reading has a hollow dot and says so', /hollow/.test(churn.dot) && /No reading yet/.test(churn.meta), JSON.stringify(churn));
103
+ ok('L5 the owner avatar shows the initials; no owner is the dashed circle', await p.evaluate(() => document.querySelector('[data-goal="krm-act"] .okr-av').textContent === 'RP' && !!document.querySelector('[data-goal="krm-churn"] .okr-av.none')));
104
+ ok('L6 the North Star is a row in its own card, read and dated', /99\.6% · up 0\.4 since 1 Sep/.test(await txt(p, '#nsRow [data-goal="krm-up"]')));
105
+ await shot(p, 'okr-desktop-light');
106
+
107
+ /* D · drafts */
108
+ const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-goal="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-goal="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
109
+ acts: [...document.querySelectorAll('[data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
110
+ ok('D1 each draft sits under the row it repairs; a drafted key result is a hollow row of its own', under.chase && under.out && under.kr, JSON.stringify(under));
111
+ ok('D2 a draft has ✕ / ✎ / ✓, and ✓ says its act (Send)', under.acts.join('|') === 'Not now|Edit|Send', under.acts.join('|'));
112
+ ok('D3 an outcome draft says what it was', under.old === 'Was “Time to first call”', under.old);
113
+ const line = await p.evaluate(() => ({ t: document.querySelector('#brief').textContent + ' ' + document.querySelector('#insWhy').textContent, all: !!document.querySelector('#insAct [data-okl="keep-all"]') }));
114
+ ok('D4 the ✦ line says what Claude drafted, with ✓✓ to keep them all, and never "no insight"', /I drafted 3 (changes|fixes)/.test(line.t) && line.all && !/no insight/i.test(line.t), JSON.stringify(line));
115
+ await p.click('[data-draft="d-chase"] [data-okd="keep"]');
116
+ ok('D5 ✓ posts that draft\'s row', await until(() => R.posts.some((x) => x.path === '/api/metric-drafts/keep' && x.body.row === 'd-chase')));
117
+ await p.click('#insAct [data-okl="keep-all"]');
118
+ ok('D6 ✓✓ posts keep-all for the product', await until(() => R.posts.some((x) => x.path === '/api/metric-drafts/keep-all' && x.body.scope === 'product')));
119
+ await p.click('[data-draft="d-out"] [data-okd="edit"]');
120
+ const ed = await until(() => p.evaluate(() => { const i = document.querySelector('[data-dred="d-out"] [data-drf="name"]'); return i ? i.value : null; }), 3000);
121
+ ok('D7 ✎ turns the draft into its words in place', ed === 'New partners make their first call within 3 days', ed);
122
+ await p.fill('[data-dred="d-out"] [data-drf="name"]', 'New partners call us within 3 days');
123
+ await p.click('[data-dred="d-out"] [data-okd="save"]');
124
+ ok('D8 ✓ on the edit posts what was typed (a fix row posts its text, lib/metric-drafts.js editOf)', await until(() => R.posts.some((x) => x.path === '/api/metric-drafts/edit' && x.body.row === 'd-out' && x.body.text === 'New partners call us within 3 days' && x.body.name === undefined)));
125
+
126
+ /* V · the goal Viewer */
127
+ await p.click('#goalTbl [data-goal="krm-act"] .okr-main');
128
+ const v = await until(() => p.evaluate(() => { const V = document.querySelector('#czViewer'); if (!V || V.hidden) return null; return { title: (V.querySelector('.cz-vw-title') || {}).textContent || '', head: (V.querySelector('.okr-vh') || {}).textContent || '', chart: !!V.querySelector('.ins-gbig svg'), why: (V.querySelector('.okr-why') || {}).textContent || '', folds: [...V.querySelectorAll('.czs-row b')].map((b) => b.textContent) }; }), 5000);
129
+ ok('V1 the Viewer opens on the goal with its reading against its line and the owner', v && /Partner activation/.test(v.title) && /\+8 of \+30 points/.test(v.head) && /its line says \+18/.test(v.head) && /RP/.test(v.head), JSON.stringify(v));
130
+ ok('V2 then the chart and why it moved', v && v.chart && /catches up about 3 weeks/.test(v.why), JSON.stringify(v));
131
+ ok('V3 then three folds: How I read it, What it counts, History', v && v.folds.slice(0, 3).join('|') === 'How I read it|What it counts|History', v && v.folds.join('|'));
132
+ await p.click('#czViewer [data-czs-fold="read"]'); await sleep(120);
133
+ ok('V4 How I read it says the source, what is read and how often', /Amplitude/.test(await txt(p, '#czViewer [data-czs-id="read"]')) && /partners active ÷ partners signed/.test(await txt(p, '#czViewer [data-czs-id="read"]')) && /Weekly/.test(await txt(p, '#czViewer [data-czs-id="read"]')));
134
+ await shot(p, 'okr-viewer-desktop');
135
+
136
+ /* N · notify */
137
+ await p.click('#czViewer [data-cz-vw="more"]'); await sleep(120);
138
+ const mi = await p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()).slice(0, 3));
139
+ ok('N1 ⋯ offers Notify me, Only in Intelligence (my pick, on) and Quiet', /^Notify me/.test(mi[0] || '') && /^Only in Intelligence.*my pick · on/.test(mi[1] || '') && /^Quiet/.test(mi[2] || ''), mi.join(' | '));
140
+ await shot(p, 'okr-notify');
141
+ await p.click('.cz-vw-menu [role="menuitem"]:first-child');
142
+ ok('N2 Notify me posts the choice for that goal', await until(() => R.posts.some((x) => x.path === '/api/goals/notify' && x.body.id === 'krm-act' && x.body.notify === 'push')));
143
+ await p.evaluate(() => window.czViewer && window.czViewer.close()); await sleep(200);
144
+
145
+ /* M · ⋯ › Metrics */
146
+ await p.click('#moreB'); await sleep(80);
147
+ ok('M1 ⋯ holds Reports and dashboards, Metrics, Delivery trends, Sources and Export', (await p.evaluate(() => [...document.querySelectorAll('#moreMenu [data-more]')].map((b) => b.dataset.more).join())).startsWith('library,metrics,trends,sources,export'));
148
+ await p.click('#moreMenu [data-more="metrics"]');
149
+ const ml = await until(() => p.evaluate(() => { const V = document.querySelector('#czViewer'); if (!V || V.hidden || !V.querySelector('.okr-met')) return null; return { heads: [...V.querySelectorAll('.okr-sh')].map((e) => e.textContent), watch: [...V.querySelectorAll('.okr-mrow')].filter((r) => r.querySelector('.okr-tag')).map((r) => r.querySelector('b').textContent + ':' + (r.querySelector('.cz-dot').className.includes('hollow') ? 'no status' : 'status')) }; }), 4000);
150
+ ok('M2 Metrics is one list: goals first, then the watched ones with no status', ml && ml.heads.join('|') === 'On a goal|Watched, no goal' && ml.watch.join() === 'App store rating:no status', JSON.stringify(ml));
151
+ await shot(p, 'okr-metrics-list');
152
+ await p.click('#czViewer [data-mv2="tree"]'); await sleep(120);
153
+ const tr = await p.evaluate(() => ({ ns: (document.querySelector('#czViewer .okr-node.ns b') || {}).textContent || '', inputs: [...document.querySelectorAll('#czViewer .okr-tree .okr-tr1 .okr-node b')].map((b) => b.textContent) }));
154
+ ok('M3 one switch shows the same list as a tree: the North Star and its inputs', tr.ns === 'Partner uptime' && tr.inputs.includes('Partner activation'), JSON.stringify(tr));
155
+ await shot(p, 'okr-metrics-tree');
156
+ ok('M4 no script error on the page', !R.errors.length, R.errors.join(' | '));
157
+ await R.ctx.close();
158
+
159
+ /* R · a broken limit */
160
+ const C = await open({ m: model({ crit: true }), rows: [] });
161
+ const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow [data-goal="krm-up"] .cz-dot.m-crit') }));
162
+ ok('R1 a broken limit is the one time the ✦ line turns red, and its dot pulses', cr.crit && /fell under its floor/.test(cr.t) && cr.pulse, JSON.stringify(cr));
163
+ await shot(C.page, 'okr-crit', '#stage');
164
+ await C.ctx.close();
165
+
166
+ /* P · a phone */
167
+ for (const theme of ['light', 'dark']) {
168
+ const Q = await open({ w: 390, h: 844, theme });
169
+ const ph = await Q.page.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, rows: document.querySelectorAll('#goalTbl .okr-row').length, shown: getComputedStyle(document.querySelector('#goalTbl')).display !== 'none' }));
170
+ ok('P1 on a phone (' + theme + ') the same list shows with no sideways scroll', !ph.over && ph.rows >= 4 && ph.shown, JSON.stringify(ph));
171
+ await shot(Q.page, 'okr-phone-' + theme);
172
+ await Q.ctx.close();
173
+ }
174
+ finish();
175
+ })();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.433.0",
3
+ "version": "0.435.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.433.0",
9
+ "version": "0.435.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.433.0",
3
+ "version": "0.435.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -70,11 +70,15 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
70
70
  const setVal = (p, sel, v) => p.evaluate(([s, x]) => { const i = document.querySelector(s); i.value = x; i.dispatchEvent(new Event('input', { bubbles: true })); }, [sel, v]);
71
71
  const rowsOf = (p) => p.evaluate(() => [...document.querySelectorAll('#czViewer .pc-ln[data-m]')].map((r) => ({ id: r.dataset.m, name: r.querySelector('[data-f="name"]').value, day: r.querySelector('.pc-fd span').textContent, when: (r.querySelector('.pc-wch span:not(.sq):not(.bx)') || r.querySelector('.pc-via, .pc-mini') || {}).textContent || '', draft: r.classList.contains('sug') })));
72
72
 
73
+ // into the charter by the Milestones pencil: the section is opened first when it is folded
74
+ const toCharter = async (p) => { await p.evaluate(() => { const b = document.querySelector('#czViewer [data-czs-fold="ms"]'); if (b && b.getAttribute('aria-expanded') !== 'true') b.click(); }); await p.click('#czViewer [data-czs-id="ms"] [data-pp="edit"]'); };
75
+
73
76
  /* ── desktop: the ways in, the fields, Save ── */
74
77
  const D = await open();
75
78
  const p = D.page;
76
79
  const ph = await head(p);
77
- ok('W the program\'s header holds the charter icon beside Discuss, and ⋯ no longer repeats it', ph.tools.includes('Open the charter') && ph.tools.indexOf('Open the charter') === ph.tools.indexOf('Discuss in chat') + 1, JSON.stringify(ph.tools));
80
+ // batch 17 PbH1Header: the Dashboard toggle took the charter icon's place; the charter is reached from the Milestones pencil and Documents
81
+ ok('W the program\'s header holds no charter icon (the Dashboard toggle has its place)', !ph.tools.includes('Open the charter'), JSON.stringify(ph.tools));
78
82
  await p.click('#czViewer [data-cz-vw="more"]');
79
83
  ok('W ⋯ holds no "Open the charter"', !(await p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu button')].some((b) => /charter/i.test(b.textContent)))));
80
84
  await p.keyboard.press('Escape');
@@ -111,8 +115,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
111
115
  await p.click('#czViewer [data-pc="discard"]');
112
116
  ok('L Discard goes back to the program and writes nothing', await until(() => p.evaluate(() => /^Viewer: Program/.test(document.querySelector('#czViewer').getAttribute('aria-label')))) && !D.posts.some((x) => x.path === '/api/programs/save'));
113
117
 
114
- // S: the charter icon in the header; a change saved resends every field and keeps the ids
115
- await p.click('#czViewer [data-cz-vw-p="charter"]');
118
+ // S: the Milestones pencil (the header's charter icon gave its place to the Dashboard toggle, batch 17); a change saved resends every field and keeps the ids
119
+ await toCharter(p);
116
120
  await charterShown(p);
117
121
  await setVal(p, '#czViewer .pc-dt[data-f="date"][data-m="pilot-live"]', '2026-11-25');
118
122
  await p.click('#czViewer [data-pc="del"][data-m="support-ready"]');
@@ -154,7 +158,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
154
158
  await p.click('#czViewer [data-cz-vw="back"]');
155
159
  await until(() => p.evaluate(() => !!document.querySelector('#czViewer .pc-ask')));
156
160
  await p.click('#czViewer [data-pc="discard"]');
157
- await p.click('#czViewer [data-cz-vw-p="charter"]');
161
+ await toCharter(p);
158
162
  await charterShown(p);
159
163
  await p.click('#czViewer button.pc-ln.dn');
160
164
  const dn = await p.evaluate(() => [...document.querySelectorAll('#czViewer .pc-ln.dn2')].map((r) => r.querySelector('[data-f="name"]').value + ':' + ((r.querySelector('.pc-mini, .pc-via') || {}).textContent || '')));
@@ -203,7 +207,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
203
207
  /* ── an initiative that left the program ── */
204
208
  const gone = F.programs().map((x, i) => (i === 0 ? { ...x, milestones: x.milestones.map((m) => (m.id === 'pilot-users' ? { ...m, waits: ['partner-sso'] } : m)) } : x));
205
209
  const G = await open({ programs: gone });
206
- await G.page.click('#czViewer [data-cz-vw-p="charter"]');
210
+ await toCharter(G.page);
207
211
  await charterShown(G.page);
208
212
  const gw = await G.page.evaluate(() => ({ warn: (document.querySelector('#czViewer .pc-lnw:has([data-m="pilot-users"]) .pc-warn') || {}).textContent || '', amber: !!document.querySelector('#czViewer .pc-wch.gone[data-m="pilot-users"]') }));
209
213
  await setVal(G.page, '#czViewer [data-f="goal"]', 'x');
@@ -212,7 +216,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
212
216
 
213
217
  /* ── phone ── */
214
218
  const S = await open({ w: 390, h: 844 });
215
- await S.page.click('#czViewer [data-cz-vw-p="charter"]');
219
+ await toCharter(S.page);
216
220
  await charterShown(S.page);
217
221
  await setVal(S.page, '#czViewer [data-f="goal"]', 'One sign-in for every product on CIAM');
218
222
  await S.page.click('#czViewer [data-pc="pick"][data-m="pilot-live"]');
@@ -229,7 +233,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
229
233
  if (prog) await prog.click();
230
234
  const hp = await until(() => M.page.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden || !v.querySelector('.pp-vw .czs-sum')) return null; return { tile: getComputedStyle(v.querySelector('.cz-vw-tile')).backgroundColor, prog: getComputedStyle(document.body).getPropertyValue('--pp-prog').trim() }; }));
231
235
  ok('M on Home the program heading opens the program panel with its own purple (cozy-panel.css is on Home)', !!hp && !!hp.prog && !/rgba\(0, 0, 0, 0\)|transparent/.test(hp.tile), JSON.stringify(hp));
232
- if (hp) { await M.page.click('#czViewer [data-cz-vw-p="charter"]'); }
236
+ if (hp) await toCharter(M.page);
233
237
  ok('M the charter opens from the panel on Home too', !!hp && !!(await charterShown(M.page)));
234
238
  ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
235
239
  await M.ctx.close();
@@ -71,7 +71,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
71
71
  await sleep(1500); // the other product's board and the program reads land after the program opened: none of them opens it again
72
72
  ok('P ?program=<id> sends bd:program once: one path opens the program', await p.evaluate(() => window.__bdp) === 1, String(await p.evaluate(() => window.__bdp)));
73
73
  const hd = await p.evaluate(() => { const v = document.querySelector('#czViewer'); const r = v.getBoundingClientRect(); return { t: v.querySelector('.cz-vw-title').textContent, kind: (v.querySelector('.cz-vw-kind') || {}).textContent, meta: (v.querySelector('.czs-meta') || {}).textContent, tools: [...v.querySelectorAll('.cz-vw-head [data-cz-vw], [data-cz-vw]')].filter((b) => b.closest('#czViewer') && !b.classList.contains('cz-vw-grip')).map((b) => b.getAttribute('aria-label')), input: v.querySelectorAll('.cz-vw-body input, .cz-vw-body textarea').length, tabs: v.querySelectorAll('.pp-tab, [role="tab"]').length, w: Math.round(r.width), right: Math.round(innerWidth - r.right), sel: !!document.querySelector('#ibBody [data-prow="project-ascent"].sel') }; });
74
- ok('P the shell\'s header names it once ("title · goal"), with Discuss in chat, the charter icon, ⋯, Open wide and Close; the summary says the owner and the span; there is no chat box and no tab', hd.t === 'Project Ascent · CIAM migration' && hd.kind === 'Program' && hd.meta === 'Wawan · Sep 2026 to Jun 2028' && [...new Set(hd.tools)].join('|') === 'Discuss in chat|Open the charter|More|Open wide|Close the viewer' && hd.input === 0 && hd.tabs === 0, JSON.stringify(hd));
74
+ ok('P the shell\'s header names it once ("title · goal"), with Discuss in chat, the Dashboard toggle once the dashboard reads (it took the charter icon\'s place, batch 17 PbH1Header; the charter stays in ⋯ and on the Milestones pencil), ⋯, Open wide and Close; the summary says the owner and the span; there is no chat box and no tab', hd.t === 'Project Ascent · CIAM migration' && hd.kind === 'Program' && hd.meta === 'Wawan · Sep 2026 to Jun 2028' && /^Discuss in chat\|(Show the dashboard\|)?More\|Open wide\|Close the viewer$/.test([...new Set(hd.tools)].join('|')) && hd.input === 0 && hd.tabs === 0, JSON.stringify(hd));
75
75
  ok('V the program floats at 560 px over the page\'s right edge, and its band row on the Board is selected', hd.w === 560 && hd.right < 40 && hd.sel, JSON.stringify(hd));
76
76
  const sm = await p.evaluate(() => ({ line: (document.querySelector('#czViewer .czs-line') || {}).textContent, pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent || '' }));
77
77
  ok('P the summary line is the next milestone (Waits on you counts itself in its row, said once); no primary while every task has a level', /^Next: Pilot live/.test(sm.line) && sm.pri === '', JSON.stringify(sm));
@@ -17,9 +17,11 @@
17
17
  * refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
18
18
  *
19
19
  * What has no place on the view is under ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5; seven entries since batch 16
20
- * item 5c), the same words and order as Home's initiative page, with Delete last (5d). The rest sits on the thing it changes: the stage chip's
21
- * picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js); Change workflow, Won't do and Archive are Home's
22
- * (ini-wf.js). Discuss in chat takes the question to Home. */
20
+ * item 5c), the same words and order as Home's initiative page, with Delete last (5d). One header icon switches the view to its Dashboard and
21
+ * back (pm/dash-view.js, PbH1Header): the PM's last choice per initiative wins; a Board row is a press to act, so Work opens first until then.
22
+ * The rest sits on the thing it changes: the stage chip's picker moves the stage with the row menu's own presses (moreAct(r, k, btn), bd-acts.js);
23
+ * Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
24
+ import * as IM from './impact.js'; // Your impact (batch 16 item 7): who made a delivered milestone happen
23
25
  import * as VW from './cozy-viewer.js';
24
26
  import { esc } from './premium-shell.js';
25
27
  import { lr, copyText } from './cozy-xv.js';
@@ -28,6 +30,7 @@ import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11
28
30
  import { viewHtml, wireView } from './ini-view.js';
29
31
  import * as TV from './tk-view.js';
30
32
  import { pmGet, pmPost } from './http.js';
33
+ import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1, canvas PbH1Header, PbA1, PbS1, PbS2, PbG2, PbG9)
31
34
  import * as MD from './home-ini-model.js'; // the stage move's rules, as Home reads them (Moves on by itself, Move back a stage)
32
35
  import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
33
36
  import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
@@ -165,12 +168,25 @@ function stageChip(btn, r) {
165
168
  archive: id && !self && !a.archived ? () => WF.archive(wfUi(), id) : null,
166
169
  });
167
170
  }
171
+ const DASH = new Map(); // the row's key → its Dashboard host (pm/dash-view.js dashHost)
172
+ function dashFor(r) {
173
+ if (!r || !r.id) return null;
174
+ if (!DASH.has(r.key)) {
175
+ const M = O.M() || {}, B = M.board || {}, vid = vidOf(r);
176
+ DASH.set(r.key, DB.dashHost({ page: 'initiative:' + r.id, scope: 'initiative:' + r.id, ws: r.ws || B.ws || '', board: r.boardId || B.id || '', vid, VW,
177
+ redraw: () => refresh(true), toast: (t) => (O.toast ? O.toast(t) : null),
178
+ openReport: async (row) => { if (!row.path) return; VW.drill(); (await import('./premium-report-read.js')).openReportView(row.path, { ws: r.ws || B.ws || '', name: row.name, cuts: true }); } }));
179
+ }
180
+ return DASH.get(r.key);
181
+ }
168
182
  function iniBody(r) {
183
+ const h = dashFor(r);
184
+ if (h && h.shows()) return h.html(() => '');
169
185
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10);
170
186
  const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
171
187
  // what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
172
188
  return viewHtml(viewOf(r), { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold, tail: VW.czSections(boardSections(r), { key: 'board' }),
173
- wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
189
+ wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira }) + madeHtml(r);
174
190
  }
175
191
  /** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
176
192
  function wire(body, key) {
@@ -231,10 +247,12 @@ export function openIni(r, from, o = {}) {
231
247
  adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
232
248
  // a row with no record id has no chat of its own: its question goes to the board's chat
233
249
  readLay(r); // Moves on by itself shows once the layout record is read
250
+ { const h = dashFor(r); if (h) h.read(o.via || 'act'); } // a Board row is a press to act (PbH1Header); a link to read passes via 'read'
234
251
  // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
235
252
  VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', id: vidOf(r),
236
253
  discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
237
- render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
254
+ presses: dashFor(r) ? dashFor(r).presses() : null, onPress: (a) => { const h = dashFor(O.rowOf(r.key) || r); if (a === 'dash' && h) h.toggle(); },
255
+ render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
238
256
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
239
257
  }
240
258
 
@@ -261,10 +279,10 @@ export function openTicket(r, k, from) {
261
279
  }
262
280
 
263
281
  /** The shown item drawn again from the new read, in place. A row that left the Board closes it. */
264
- export function refresh() {
282
+ export function refresh(force) {
265
283
  if (!cur || !VW.isOpen()) return;
266
284
  const r = O.rowOf(cur.key); if (!r || !r.track) { close(); return; }
267
- const b = VW.body(); if (!b || (document.activeElement && b.contains(document.activeElement))) return;
285
+ const b = VW.body(); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
268
286
  if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
269
287
  const top = b.scrollTop;
270
288
  b.innerHTML = iniBody(r);
@@ -272,4 +290,11 @@ export function refresh() {
272
290
  }
273
291
  export function close() { if (cur) { cur = null; VW.close(); } }
274
292
  export const shown = () => (cur ? cur.key : null);
275
- export function mount(o) { O = o; ensurePopCss(); }
293
+ /** Your impact, Phase 3 (batch 16 item 7, GmA2Board): under a milestone delivered in the last 30 days, the people who made it happen, from
294
+ * the row's own tickets, unranked, each with its ticket to open. Private: no thank-you press, no send, and the ◆ on the timeline stays plain. */
295
+ const madeHtml = (r) => IM.madeHtml(IM.madeOf(r, (O.M() && O.M().today) || new Date().toISOString().slice(0, 10)));
296
+ export function mount(o) {
297
+ O = o; ensurePopCss();
298
+ IM.readWeek().then(() => refresh()).catch(() => {});
299
+ window.addEventListener('pmos:impact', () => { setTimeout(() => IM.readWeek().then(() => refresh()).catch(() => {}), 0); }); // the switch: the section follows at once
300
+ }
@@ -10,10 +10,14 @@
10
10
  * that event through pm/bd-prog.js openProgram, the one path that opens it.
11
11
  *
12
12
  * What it shows, each part only when a record holds something for it:
13
- * · the shell's header: the program icon, "title · goal" once, Discuss in chat (the question goes to Home), the charter, ⋯ and Close. ⋯
13
+ * · the shell's header: the program icon, "title · goal" once, Discuss in chat (the question goes to Home), the Dashboard toggle, ⋯ and Close. ⋯
14
14
  * holds, in the shell's order: add an initiative, move one in, copy link, copy as text, and archive (red, last, with a confirmation)
15
- * · the charter (pm/program-charter.js, canvas MsB*): the one editor of the program's fields and milestones. Ways in: its icon in the
16
- * header, the pencil on the Milestones row, and "Add the first milestone" where the track would be
15
+ * · the charter (pm/program-charter.js, canvas MsB*): the one editor of the program's fields and milestones. Ways in: the pencil on the
16
+ * Milestones row (and on the Dashboard's Milestones block), and "Add the first milestone" where the track would be. Its header icon gave
17
+ * its place to the Dashboard toggle (batch 17 item 1, PbH1Header: two icons left the title 66 px at 390 px)
18
+ * · the Dashboard (pm/dash-view.js, GET /api/ready-reports/dashboard scope program:<id>): one toggle icon, a gauge from Work and a list from
19
+ * the Dashboard. The PM's last choice per program wins; with none, the Dashboard opens when they came to read (?view=dashboard: a
20
+ * report, Intelligence, a notification) and Work when they came to act (a Board row). No toggle until the dashboard is read
17
21
  * · Claude's milestone suggestions (pm/ms-suggest.js, canvas XmsgB): with no milestone yet, they take the place of "Add the first milestone";
18
22
  * later changes lead Waits on you. ✓ keeps one (the charter is written at once), the pencil opens the charter with it filled in, ✕ drops it
19
23
  * · the summary card: the next milestone, else what waits on you; the owner and the span; one primary, "Review the suggested homes", only
@@ -38,6 +42,7 @@ import { programRename } from './rename-press.js';
38
42
  import { openCharter as charterForm, renamed as charterRenamed } from './program-charter.js';
39
43
  import * as MSG from './ms-suggest.js';
40
44
  import * as MD from './metric-drafts.js'; // the goal Claude drafts when the charter has none (batch 15 item 1, canvas Iq9Program)
45
+ import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1, canvas PbH1Header, PbA2, PbA7, PbG3, PbG7, PbG10)
41
46
 
42
47
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
43
48
  const I = {
@@ -56,6 +61,7 @@ let O = null; // mount's options
56
61
  let cur = null; // { id, from } the program shown and the element it was opened from
57
62
  let period = null; // the year half the goals show (null: the current one)
58
63
  let adding = false; // the add-a-task line of "On the program" is open
64
+ const DASH = new Map(); // program id → { view: 'dash' | 'work', d: the dashboard | null, read: bool, open: Set of folds }
59
65
  const fold = new Set((() => { try { return JSON.parse(store.get(FOLD_KEY) || '[]'); } catch { return []; } })());
60
66
  const keepFold = () => store.set(FOLD_KEY, JSON.stringify([...fold].slice(-200)));
61
67
  const AWAY = new Map(); // the boards of the other products: ws → { name, board, rows } | 'reading'
@@ -370,7 +376,7 @@ function draw(keepFocus) {
370
376
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
371
377
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
372
378
  const top = b.scrollTop;
373
- b.innerHTML = bodyHtml(p);
379
+ b.innerHTML = viewHtml(p);
374
380
  b.scrollTop = top;
375
381
  const again = sel && b.querySelector(sel); if (again) again.focus();
376
382
  }
@@ -407,10 +413,35 @@ function textOf(p) {
407
413
  return lines.join('\n');
408
414
  }
409
415
  const titleOf = (p) => p.title + (p.goal ? ' · ' + p.goal : '');
410
- function openPanel(id, from) {
416
+ /* ── the Dashboard view (batch 17 item 1) ── */
417
+ const dashOf = (id) => { if (!DASH.has(id)) DASH.set(id, { view: 'work', d: null, read: false, open: new Set() }); return DASH.get(id); };
418
+ const showsDash = (id) => { const x = dashOf(id); return x.view === 'dash' && !!x.d; };
419
+ /** The body: the Dashboard when it is chosen and read, else the work. */
420
+ function viewHtml(p) {
421
+ if (!showsDash(p.id)) return bodyHtml(p);
422
+ const x = dashOf(p.id), talk = O && O.talk && O.talk() ? `<button type="button" class="hi-talk" data-pp="talk">Message Claude about ${esc(p.title)}</button>` : '';
423
+ return DB.dashHtml(x.d, { open: x.open, mdHtml: MD.progHtml(p, p.home || board().ws || ''), talk });
424
+ }
425
+ const dashPresses = (id) => { const x = dashOf(id); return x.d ? [DB.togglePress(x.view)] : []; };
426
+ /** Reads the program's dashboard (again); the toggle shows once it is read. via: 'read' | 'act', how the PM arrived. */
427
+ async function readDash(p, via) {
428
+ const x = dashOf(p.id);
429
+ const d = await DB.readDash(p.home || board().ws || '', 'program:' + p.id, via);
430
+ if (!d) { x.d = null; if (x.view === 'dash') x.view = 'work'; } else { const first = !x.read; x.d = d; if (first) x.view = DB.viewOf('program:' + p.id, d.opens); }
431
+ x.read = true;
432
+ if (cur && cur.id === p.id && shownHere()) { VW.setPresses('program:' + p.id, dashPresses(p.id)); draw(true); }
433
+ }
434
+ function toggleDash(p) {
435
+ const x = dashOf(p.id); if (!x.d) return;
436
+ x.view = x.view === 'dash' ? 'work' : 'dash'; DB.keepView('program:' + p.id, x.view);
437
+ VW.setPresses('program:' + p.id, dashPresses(p.id)); draw();
438
+ const t = document.querySelector('#czViewer [data-cz-vw-p="dash"]'); if (t) t.focus();
439
+ }
440
+ function openPanel(id, from, via) {
411
441
  if (!O || !O.M() || !progOf(id)) return false;
412
442
  const p = progOf(id);
413
443
  adding = false; period = null; O._perOpen = false;
444
+ readDash(p, via || '');
414
445
  // tap the title to rename (canvas RnAProg): the field holds the name only; the goal stays as it is
415
446
  const rename = programRename({ pmPost, program: p, onSaved: async (o) => {
416
447
  await O.reload(); VW.retitle('program:' + id, titleOf(progOf(id) || { ...p, title: o.title }));
@@ -420,14 +451,22 @@ function openPanel(id, from) {
420
451
  rename.value = p.title;
421
452
  VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program:' + id,
422
453
  discuss: true, more: moreOf(p), rename,
423
- // the charter's icon beside Discuss (canvas MsB0Entry): the one way to its fields, so ⋯ no longer repeats it
424
- presses: [{ act: 'charter', label: 'Open the charter', icon: 'doc' }], onPress: (a) => { const q = progOf(id); if (a === 'charter' && q) openCharter(q); },
454
+ // one Dashboard toggle in the charter's old place (PbH1Header); the charter keeps the Milestones pencil and "Add the first milestone"
455
+ presses: dashPresses(id), onPress: (a) => { const q = progOf(id); if (a === 'dash' && q) toggleDash(q); },
425
456
  render: (body) => {
426
457
  { const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
427
458
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
428
459
  body.classList.add('pp-vw');
429
- const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = bodyHtml(q); }
430
- body.onclick = (e) => { const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
460
+ const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = viewHtml(q); }
461
+ if (!body.dataset.dbWired) { // the Dashboard's own presses, once per body (pm/dash-view.js)
462
+ body.dataset.dbWired = '1';
463
+ DB.wireDash(body, { d: () => cur && dashOf(cur.id).d, get open() { return cur ? dashOf(cur.id).open : new Set(); }, ws: (progOf(id) || {}).home || board().ws || '', board: board().id || '',
464
+ toast: (t) => O.say(t), redraw: () => draw(true), reload: async () => { const q2 = cur && progOf(cur.id); if (q2) await readDash(q2); },
465
+ milestones: () => { const q2 = cur && progOf(cur.id); if (q2) openCharter(q2, 'milestones'); },
466
+ openReport: (r) => openReport(r, (progOf(id) || {}).home || board().ws || ''),
467
+ editNeeds: (n) => { if (n && n.ini) { if (O.drill) VW.drill(); else VW.close(); O.openIni(n.ini); } } });
468
+ }
469
+ body.onclick = (e) => { if (cur && showsDash(cur.id) && e.target.closest('[data-db]')) return; const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
431
470
  body.onsubmit = submit;
432
471
  document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
433
472
  },
@@ -511,7 +550,8 @@ export function mount(o) {
511
550
  O = o;
512
551
  document.addEventListener('click', popPress);
513
552
  // a program row of the Board, and ?program=<id> once the Board has unfolded and scrolled to it, send bd:program (pm/bd-prog.js openProgram)
514
- document.addEventListener('bd:program', (e) => { const d = e.detail || {}; if (d.id) openPanel(String(d.id), d.from || document.activeElement); });
553
+ // came to read (a report, Intelligence, a notification: ?view=dashboard) or to act (a Board row): which view opens first (PbH1Header)
554
+ document.addEventListener('bd:program', (e) => { const d = e.detail || {}; if (d.id) openPanel(String(d.id), d.from || document.activeElement, d.via || (new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act')); });
515
555
  // the period menu is a layer inside the panel: Escape closes it first, then the shell closes the panel
516
556
  window.addEventListener('keydown', (e) => {
517
557
  if (e.key !== 'Escape' || !cur || !O._perOpen) return;
@@ -525,3 +565,11 @@ export function mount(o) {
525
565
  if (cur && shownHere()) document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === cur.id));
526
566
  }).observe(body, { childList: true });
527
567
  }
568
+
569
+ /** A report row of the Dashboard opens in the one report Viewer (pm/premium-report-read.js), with its Sponsors and Team cuts; ← comes back. */
570
+ async function openReport(r, ws) {
571
+ if (!r || !r.path) return;
572
+ VW.drill();
573
+ const m = await import('./premium-report-read.js');
574
+ m.openReportView(r.path, { ws, name: r.name, cuts: true });
575
+ }
@@ -80,3 +80,8 @@ html.ad-still .env-leaf { opacity: 0; }
80
80
  .env-leaf { opacity: 0; }
81
81
  }
82
82
  svg.ad-svg.am { stroke: none; }
83
+ /* Your impact (batch 16 item 7, GmA1Home): the newest leaf on the sprout grows once, on a real event; still under reduced motion and Still */
84
+ .ad-svg .ad-gw { animation: adGw 1.4s ease-out 1 both; transform-box: fill-box; transform-origin: right bottom; }
85
+ @keyframes adGw { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
86
+ @media (prefers-reduced-motion: reduce) { .ad-svg .ad-gw { animation: none; } }
87
+ html.ad-still .ad-svg .ad-gw { animation: none; }
@@ -39,13 +39,20 @@ function defs(p) {
39
39
  + rg('h', 78, 166, 100, [[0, 'h0'], [0.55, 'h1'], [1, 'h2']]) + rg('l', 96, 4, 44, [[0, 'l0'], [1, 'l1']])
40
40
  + `<filter id="${p}b" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="3.5"/></filter></defs>`;
41
41
  }
42
- function sprout(m, p) {
42
+ /* Your impact (batch 16 item 7, GmA1Home, GmA2Board): the leaves on the sprout are the ONLY leaf in PMOS. grow is the word GET /api/impact/week
43
+ * gives (rest, bud, leaf, full): the stem grows taller and carries more leaves. No number is drawn or said. o.growNew plays one grow on the
44
+ * newest leaf (a real event, once). */
45
+ const GROW = { rest: { top: 22, side: [] }, bud: { top: 16, side: [[24, 'l']] }, leaf: { top: 8, side: [[14, 'l']] }, full: { top: -20, side: [[14, 'l'], [0, 'r'], [-14, 'l']] } };
46
+ export const GROWS = Object.freeze(Object.keys(GROW));
47
+ function sprout(m, p, grow, growNew) {
43
48
  const rot = { calm: 0, joy: -8, think: 10, ask: -4, worry: 30, rest: 16 }[m];
44
- let l1 = 'M100 22 C 88 6, 70 8, 66 18 C 74 26, 90 28, 100 22Z', l2 = 'M100 22 C 112 4, 132 6, 136 16 C 128 26, 110 28, 100 22Z';
49
+ const g = m === 'worry' ? GROW.rest : GROW[grow] || GROW.rest, T = g.top;
50
+ let l1 = `M100 ${T} C 88 ${T - 16}, 70 ${T - 14}, 66 ${T - 4} C 74 ${T + 4}, 90 ${T + 6}, 100 ${T}Z`, l2 = `M100 ${T} C 112 ${T - 18}, 132 ${T - 16}, 136 ${T - 6} C 128 ${T + 4}, 110 ${T + 6}, 100 ${T}Z`;
45
51
  if (m === 'worry') { l1 = 'M100 22 C 90 12, 74 14, 70 24 C 80 30, 94 30, 100 22Z'; l2 = 'M100 22 C 106 30, 118 40, 130 38 C 130 28, 116 18, 100 22Z'; }
46
- const leaf = (d) => `<path d="${d}" fill="url(#${p}l)" stroke="${L_LEAF}" stroke-width="2" stroke-linejoin="round"/>`;
47
- return `<g class="ad-sp"><g transform="rotate(${rot} 100 36)"><path d="M100 38 L100 22" fill="none" stroke="${L_LEAF}" stroke-width="4" stroke-linecap="round"/>${leaf(l1)}${leaf(l2)}`
48
- + `<path d="M100 22 C 92 18, 82 17, 74 18" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/><path d="M100 22 C 110 17, 120 15, 128 16" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/></g></g>`;
52
+ const leaf = (d, c = '') => `<path d="${d}" fill="url(#${p}l)" stroke="${L_LEAF}" stroke-width="2" stroke-linejoin="round"${c ? ` class="${c}"` : ''}/>`;
53
+ const side = ([y, s], i, all) => leaf(s === 'l' ? `M100 ${y} C 90 ${y - 12}, 76 ${y - 10}, 74 ${y - 4} C 82 ${y + 2}, 92 ${y + 2}, 100 ${y}Z` : `M100 ${y} C 110 ${y - 12}, 124 ${y - 10}, 126 ${y - 4} C 118 ${y + 2}, 108 ${y + 2}, 100 ${y}Z`, growNew && i === all.length - 1 ? 'ad-gw' : '');
54
+ return `<g class="ad-sp"><g transform="rotate(${rot} 100 36)"><path d="M100 38 L100 ${T}" fill="none" stroke="${L_LEAF}" stroke-width="4" stroke-linecap="round"/>${g.side.map(side).join('')}${leaf(l1)}${leaf(l2)}`
55
+ + `<path d="M100 ${T} C 92 ${T - 4}, 82 17, 74 18" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/><path d="M100 ${T} C 110 ${T - 5}, 120 15, 128 16" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/></g></g>`;
49
56
  }
50
57
  const mirror = (d) => { let x = true; return d.replace(/[MCZ]|-?\d+\.?\d*/g, (t) => { if (/[MCZ]/.test(t)) { x = true; return t; } const v = Number(t); const o = x ? String(200 - v) : String(v); x = !x; return ' ' + o; }); };
51
58
  function ears(m, p) {
@@ -77,8 +84,8 @@ function face(m, p) {
77
84
  else s += `<path d="M100 113 L100 118 M100 118 Q94 124 88 119 M100 118 Q106 124 112 119" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>`;
78
85
  return s;
79
86
  }
80
- function head(m, p, prop) {
81
- let h = sprout(m, p) + ears(m, p);
87
+ function head(m, p, prop, grow, growNew) {
88
+ let h = sprout(m, p, grow, growNew) + ears(m, p);
82
89
  h += `<path d="M28 98 C 28 54, 60 32, 100 32 C 140 32, 172 54, 172 98 C 172 138, 140 156, 100 156 C 60 156, 28 138, 28 98Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/>`;
83
90
  h += `<ellipse cx="74" cy="56" rx="30" ry="14" class="${F('white')}" opacity=".35" filter="url(#${p}b)"/><path d="M40 120 C 50 150, 150 150, 160 120 C 150 160, 50 160, 40 120Z" class="${F('shade')}" opacity=".12" filter="url(#${p}b)"/>`;
84
91
  h += `<path d="M36 108 C 44 92, 70 92, 100 102 C 130 92, 156 92, 164 108 C 162 140, 136 154, 100 154 C 64 154, 38 140, 36 108Z" fill="url(#${p}c)"/>`;
@@ -171,7 +178,8 @@ const dot = (mood, px, o) => `<span class="ad-dot m-${mood}" style="--ad-px:${px
171
178
 
172
179
  /**
173
180
  * Adler. mood: one of MOODS (anything else is handled). size: 's' | 'm' | 'l' or a number of px (the face's side; the figure's height).
174
- * o: { label: false (beside words that carry the meaning) | 'text', prop: 'headphones' | 'magnifier', cls, id (a fixed prefix) }. Off → the mood dot;
181
+ * o: { label: false (beside words that carry the meaning) | 'text', prop: 'headphones' | 'magnifier', cls, id (a fixed prefix), grow: one of GROWS (Your
182
+ * impact's leaves on the sprout, the face only), growNew: true plays one grow on the newest leaf }. Off → the mood dot;
175
183
  * Face only → an L figure is drawn as the M face. → HTML string
176
184
  */
177
185
  export function adler(mood, size = 'm', o = {}) {
@@ -186,7 +194,7 @@ export function adler(mood, size = 'm', o = {}) {
186
194
  // redraw that diffs the markup does not replace the node and replay its entrance (premium-viewer-flicker F1)
187
195
  const p = o.id ? 'ad' + o.id : nextId(), cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
188
196
  const extra = o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '';
189
- if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop)}</svg>`;
197
+ if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop, o.grow, o.growNew)}</svg>`;
190
198
  const w = Math.round(px * 200 / 252);
191
199
  return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop)}</g></svg>`;
192
200
  }