create-pmos 0.478.0 → 0.479.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 (32) hide show
  1. package/package.json +13 -14
  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-initiative-test.js +1 -1
  7. package/workspace/changelog.json +12 -0
  8. package/workspace/guide/home.md +2 -1
  9. package/workspace/guide/programs.md +15 -5
  10. package/workspace/lib/board-pack-route.js +10 -1
  11. package/workspace/lib/board-pack.js +31 -2
  12. package/workspace/lib/briefing-premium-products.js +5 -2
  13. package/workspace/lib/briefing-premium.js +5 -3
  14. package/workspace/lib/ready-reports.js +31 -6
  15. package/workspace/metric-drafts-ui-test.js +2 -1
  16. package/workspace/milestone-suggest-test.js +12 -6
  17. package/workspace/package-lock.json +2 -2
  18. package/workspace/package.json +1 -1
  19. package/workspace/program-charter-test.js +5 -5
  20. package/workspace/program-panel-test.js +28 -25
  21. package/workspace/public/pm/bd-prog-panel.js +84 -60
  22. package/workspace/public/pm/chat-md.js +5 -2
  23. package/workspace/public/pm/cozy-home.css +3 -0
  24. package/workspace/public/pm/dash-view.js +9 -5
  25. package/workspace/public/pm/goal-chat.js +3 -1
  26. package/workspace/public/pm/home-app.js +53 -21
  27. package/workspace/public/pm/home-chat.js +2 -2
  28. package/workspace/public/pm/premium.css +1 -0
  29. package/workspace/public/pm/prog-page.css +76 -0
  30. package/workspace/public/pm/prog-page.js +112 -0
  31. package/workspace/public/pm/readonly.js +8 -1
  32. package/workspace/ready-dash-ui-test.js +53 -73
@@ -4,6 +4,8 @@
4
4
  * into the Viewer's shell A by the second kit (initiative viewer-shell-a, V9; canvas XvABoard). Serves the real page from the real server;
5
5
  * GET /api/board-premium answers each product of Project Ascent (fixtures/program-ascent.js through fixtures/board-premium-facts.js
6
6
  * programFacts), GET /api/programs its programs, and the program writes are captured, not written.
7
+ * Batch 21 item 2 made the panel ONE page (pm/prog-page.js): the ✦ line, the goal card with the track, then the tabs Tasks, Initiatives
8
+ * (open first), Reports, Documents; these checks read that page.
7
9
  * P open on ?program=, the shell's header, no chat box · G goals per half, each KR's name and whether it is met · M the track and the
8
10
  * Milestones row · W waits on you, in Home · T the initiatives per product, another product read from its board · K every task by level,
9
11
  * and the sort card after Turn into a program · F folds kept · O the Board's program row opens it, an initiative opens the Board's
@@ -60,8 +62,9 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
60
62
  await page.goto(BASE + '/premium-board.html' + qs);
61
63
  return { page, ctx: c, errors, posts };
62
64
  };
63
- const shown = (p) => until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && /^Viewer: Program/.test(v.getAttribute('aria-label') || '') && !!v.querySelector('.pp-vw .czs-sum'); }));
65
+ const shown = (p) => until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && /^Viewer: Program/.test(v.getAttribute('aria-label') || '') && !!v.querySelector('.pp-vw .pv'); }));
64
66
  const fold = (p, id) => p.click(`#czViewer [data-czs-fold="${id}"]`);
67
+ const tab = (p, k) => p.click(`#czViewer [data-pv="tab"][data-k="${k}"]`); // batch 21 item 2: the one page's tabs
65
68
  const isOpen = (p, id) => p.evaluate((k) => { const b = document.querySelector(`#czViewer [data-czs-fold="${k}"]`); return !!b && b.getAttribute('aria-expanded') === 'true'; }, id);
66
69
 
67
70
  /* ── desktop ── */
@@ -70,11 +73,11 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
70
73
  ok('P ?program=<id> opens the program in the Viewer once the board and the programs are read', await shown(p));
71
74
  await sleep(1500); // the other product's board and the program reads land after the program opened: none of them opens it again
72
75
  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
- 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 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), ⋯, ⧉ Arrange (in place of Open wide, panels on Board and Intelligence) 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\|Arrange\|Close the viewer$/.test([...new Set(hd.tools)].join('|')) && hd.input === 0 && hd.tabs === 0, JSON.stringify(hd));
76
+ 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, 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('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), w: Math.round(r.width), right: Math.round(innerWidth - r.right), sel: !!document.querySelector('#ibBody [data-prow="project-ascent"].sel') }; });
77
+ ok('P the shell\'s header names it once ("title · goal"), with Discuss in chat, ⋯, ⧉ Arrange and Close, and no Work | Dashboard toggle (batch 21 item 2: one page); no chat box; the tabs Tasks, Initiatives (open first), Reports, Documents', hd.t === 'Project Ascent · CIAM migration' && hd.kind === 'Program' && [...new Set(hd.tools)].join('|') === 'Discuss in chat|More|Arrange|Close the viewer' && hd.input === 0 && hd.tabs.join() === 'tasks,initiatives*,reports,documents', JSON.stringify(hd));
75
78
  ok('V the program opens beside the page, at the right edge, no wider than leaves the Board its 880 px (506 at 1440), and its band row on the Board is selected', hd.w === 506 && hd.right < 40 && hd.sel && await p.evaluate(() => !document.querySelector('#czViewer.cz-vw-float') && !!document.querySelector('.cz-pn-div')), JSON.stringify(hd));
76
- const sm = await p.evaluate(() => ({ line: (document.querySelector('#czViewer .czs-line') || {}).textContent, pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent || '' }));
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));
79
+ const sm = await p.evaluate(() => ({ line: (document.querySelector('#czViewer .pv-line') || {}).textContent || '', pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent || '' }));
80
+ ok('P the ✦ line leads with the next milestone and says what waits on you once; no sort primary while every task has a level', /Next: Pilot live/.test(sm.line) && /One thing waits on you/.test(sm.line) && sm.pri === '', JSON.stringify(sm));
78
81
  const g = await p.evaluate(() => ({ per: document.querySelector('#czViewer .pp-per').textContent.trim(), krs: [...document.querySelectorAll('#czViewer .pp-goal .pp-kr:not(.ghost) b')].map((b) => b.textContent) }));
79
82
  ok('G the goals are the KRs its initiatives anchor to, once each, for the current half', g.per === 'H2 2026' && g.krs.slice().sort().join() === 'KR 1.2,KR 2.1,KR 2.3', JSON.stringify(g));
80
83
  const gn = await until(() => p.evaluate(() => { const c = [...document.querySelectorAll('#czViewer .pp-goal .pp-kr:not(.ghost)')].map((k) => ({ kr: k.querySelector('b').textContent, text: k.textContent, dot: k.querySelector('.pp-gd') ? (k.querySelector('.pp-gd.off') ? 'off' : 'ok') : '', label: k.getAttribute('aria-label') || '' })); return c.length && c.every((x) => x.dot) ? c : null; }));
@@ -83,40 +86,40 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
83
86
  && /KR 2\.1Sign-in success 99\.5%$/.test(kr('KR 2.1').text) && /Retire legacy IdP$/.test(kr('KR 2.3').text) && /Microsite conversion \+8%$/.test(kr('KR 1.2').text)
84
87
  && kr('KR 1.2').dot === 'ok' && /, met$/.test(kr('KR 1.2').label) && kr('KR 2.1').dot === 'ok' && /on course$/.test(kr('KR 2.1').label) && kr('KR 2.3').dot === 'off' && /behind$/.test(kr('KR 2.3').label), JSON.stringify(gn));
85
88
  const mt = await p.evaluate(() => { const t = document.querySelector('#czViewer .pp-mt'); return { caps: [...t.querySelectorAll('.pp-cap')].map((c) => c.textContent.trim()), ms: [...t.querySelectorAll('.pp-m b')].map((b) => b.textContent), next: (t.querySelector('.pp-dm.n') || {}).parentElement && t.querySelector('.pp-dm.n').parentElement.querySelector('b').textContent, rd: (t.querySelector('.pp-rd') || {}).getAttribute && t.querySelector('.pp-rd').getAttribute('aria-label') }; });
86
- ok('M the track shows 3 milestones between a done cluster and an "N more" cluster; the next one is marked and counts its initiatives', mt.caps.join('|') === '1 done|4 more' && mt.ms.join('|') === 'Charter approved|Pilot live|Pilot users invited' && mt.next === 'Pilot live' && mt.rd === '0 of 2 initiatives ready', JSON.stringify(mt));
87
- const rows = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#czViewer .czs-row')].map((b) => b.querySelector('b').textContent + ':' + ((b.querySelector('.czs-n') || {}).textContent || '')); return r.length >= 7 ? r : null; }));
88
- ok('P the tabs are folding rows: Waits on you, On the program, On its initiatives, On their epics, Initiatives, Milestones, Documents, each with its count', !!rows && /^Waits on you:1\|On the program:2\|On its initiatives:\d+\|On their epics:\d+\|Initiatives:3\|Milestones:8\|Documents:\d+$/.test(rows.join('|')), JSON.stringify(rows));
89
+ ok('M the goal card\'s track shows 3 milestones between a done cluster and an "N more" cluster; the next one is marked and counts its initiatives', mt.caps.join('|') === '1 done|4 more' && mt.ms.join('|') === 'Charter approved|Pilot live|Pilot users invited' && mt.next === 'Pilot live' && mt.rd === '0 of 2 initiatives ready', JSON.stringify(mt));
90
+ const tn = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-pv="tab"]')].map((t) => t.dataset.k + ':' + ((t.querySelector('.pv-n') || {}).textContent || '')));
91
+ ok('P each tab counts what it holds, and zero is silence: Tasks 7, Initiatives 3, Reports, Documents', tn.join('|') === 'tasks:7|initiatives:3|reports:|documents:1', JSON.stringify(tn));
89
92
  await p.click('#czViewer .pp-cap:not(.dn)');
90
- const ml = await until(() => p.evaluate(() => { const l = document.querySelector('#czViewer [data-czs-id="ms"] .pp-ml'); return l && !l.closest('[hidden]') ? { groups: [...l.querySelectorAll('.pp-mg')].map((x) => x.textContent.trim()), check: [...l.querySelectorAll('.pp-mr')].filter((x) => /A program check/.test(x.textContent)).map((x) => x.querySelector('b').textContent) } : null; }));
91
- ok('M "N more" opens the Milestones row: Done, Next and Later, and a milestone with no initiative is a program check', !!ml && ml.groups.join('|') === 'Done · 2|Next · 1|Later · 5' && ml.check.join() === 'Support ready,Program review', JSON.stringify(ml));
93
+ const ml = await until(() => p.evaluate(() => { const l = document.querySelector('#czViewer .pv-gc .pp-ml'); return l ? { groups: [...l.querySelectorAll('.pp-mg')].map((x) => x.textContent.trim()), check: [...l.querySelectorAll('.pp-mr')].filter((x) => /A program check/.test(x.textContent)).map((x) => x.querySelector('b').textContent) } : null; }));
94
+ ok('M "N more" opens every milestone in the goal card: Done, Next and Later, and a milestone with no initiative is a program check', !!ml && ml.groups.join('|') === 'Done · 2|Next · 1|Later · 5' && ml.check.join() === 'Support ready,Program review', JSON.stringify(ml));
92
95
  await p.click('#czViewer .pp-mr button.pp-dm[data-ms="support-ready"]');
93
96
  const ck = await until(() => D.posts.find((x) => x.path === '/api/programs/check'));
94
97
  ok('X a program check\'s diamond marks it done (POST /api/programs/check)', !!ck && ck.body.program === 'project-ascent' && ck.body.milestone === 'support-ready' && ck.body.done === true, JSON.stringify(ck));
95
- const nr = await p.evaluate(() => [...document.querySelectorAll('#czViewer .pp-needs .pp-nr')].map((a) => ({ t: a.querySelector('b').textContent, href: a.getAttribute('href'), box: !!a.querySelector('.pp-ck'), sub: a.querySelector('.t span').textContent })));
96
- ok('W waits on you lists your program task as a check box, and it opens in Home at that item; Dara\'s task is not yours', nr.length === 1 && nr[0].t === 'Sign the CIAM vendor order form' && nr[0].box && /^\/premium\.html\?/.test(nr[0].href) && /item=pt%3Aproject-ascent%3Apt-vendor-form/.test(nr[0].href) && /^On the program · /.test(nr[0].sub), JSON.stringify(nr));
97
- const tr = await until(() => p.evaluate(() => { const t = document.querySelector('#czViewer [data-czs-id="tree"] .pp-tree[role="tree"]'); if (!t || /reading its board|not read/.test(t.textContent)) return null; return { rows: [...t.querySelectorAll('.pp-nd.ini .x, .pp-nd.prd2')].map((x) => (x.classList.contains('prd2') ? x.lastChild.textContent : x.textContent).trim()), here: [...t.querySelectorAll('button.pp-open')].map((b) => b.textContent), away: [...t.querySelectorAll('a.pp-open')].map((a) => a.getAttribute('href')) }; }));
98
- ok('T Initiatives lists each product with its initiatives; the other product\'s initiative is read from its own board and links there', !!tr && tr.rows[0] === 'IDPF' && tr.rows.indexOf('Microsites') > tr.rows.indexOf('IDPF') && tr.rows.includes('Microsite sign-in on CIAM') && tr.here.length === 2 && tr.away.length === 1 && /ws=microsites&focus=microsite-signin/.test(tr.away[0]), JSON.stringify(tr));
99
- const tk = await until(() => p.evaluate(() => { const one = (k) => { const s = document.querySelector(`#czViewer [data-czs-id="${k}"]`); return s ? { n: (s.querySelector('.czs-n') || {}).textContent || '', rows: [...s.querySelectorAll('a.pp-tk')].map((a) => ({ t: a.querySelector('.x').textContent, href: a.getAttribute('href') })) } : null; };
98
+ const tr = await until(() => p.evaluate(() => { const t = document.querySelector('#czViewer #pvp .pp-tree[role="tree"]'); if (!t || /reading its board|not read/.test(t.textContent)) return null; return { rows: [...t.querySelectorAll('.pp-nd.ini .x, .pp-nd.prd2')].map((x) => (x.classList.contains('prd2') ? x.lastChild.textContent : x.textContent).trim()), here: [...t.querySelectorAll('button.pp-open')].map((b) => b.textContent), away: [...t.querySelectorAll('a.pp-open')].map((a) => a.getAttribute('href')) }; }));
99
+ ok('T the Initiatives tab lists each product with its initiatives; the other product\'s initiative is read from its own board and links there', !!tr && tr.rows[0] === 'IDPF' && tr.rows.indexOf('Microsites') > tr.rows.indexOf('IDPF') && tr.rows.includes('Microsite sign-in on CIAM') && tr.here.length === 2 && tr.away.length === 1 && /ws=microsites&focus=microsite-signin/.test(tr.away[0]), JSON.stringify(tr));
100
+ await tab(p, 'tasks');
101
+ const nr = await until(() => p.evaluate(() => { const L = [...document.querySelectorAll('#czViewer .pp-needs .pp-nr')]; return L.length ? L.map((a) => ({ t: a.querySelector('b').textContent, href: a.getAttribute('href'), box: !!a.querySelector('.pp-ck'), sub: a.querySelector('.t span').textContent })) : null; }), 4000) || [];
102
+ ok('W the Tasks tab leads with what waits on you: your program task as a check box, opening in Home at that item; Dara\'s task is not yours', nr.length === 1 && nr[0].t === 'Sign the CIAM vendor order form' && nr[0].box && /^\/premium\.html\?/.test(nr[0].href) && /item=pt%3Aproject-ascent%3Apt-vendor-form/.test(nr[0].href) && /^On the program · /.test(nr[0].sub), JSON.stringify(nr));
103
+ const tk = await until(() => p.evaluate(() => { const one = (k) => { const s = document.querySelector(`#czViewer [data-czs-id="${k}"]`); return s ? { n: (s.querySelector('.czs-n') || {}).textContent || '' } : null; };
100
104
  const i = one('itasks'), e = one('etasks'); return i && e ? { i, e, sort: !!(document.querySelector('#czViewer .czs-pri') || {}).textContent } : null; }));
101
- if (tk) { await fold(p, 'itasks'); await fold(p, 'etasks'); }
105
+ if (tk) { if (!(await isOpen(p, 'itasks'))) await fold(p, 'itasks'); if (!(await isOpen(p, 'etasks'))) await fold(p, 'etasks'); }
102
106
  const tk2 = await p.evaluate(() => [...document.querySelectorAll('#czViewer [data-czs-id="itasks"] a.pp-tk, #czViewer [data-czs-id="etasks"] a.pp-tk')].map((a) => ({ t: a.querySelector('.x').textContent, href: a.getAttribute('href') })));
103
- ok('K every open task of its initiatives has a row by level, On its initiatives and On their epics (with On the program, 7); an initiative\'s task opens in Home; no sort primary without Turn into a program', !!tk && +tk.i.n + +tk.e.n === 5
107
+ ok('K every open task of its initiatives has a row by level, On its initiatives and On their epics; an initiative\'s task opens in Home; no sort primary without Turn into a program', !!tk && +tk.i.n + +tk.e.n === 5
104
108
  && tk2.length === 5 && tk2.some((x) => x.t === 'Pick the sign-in widget') && !tk2.some((x) => /Not in the program|Read the Descope docs/.test(x.t)) && /^\/premium\.html\?ws=idpf&ini=legacy-idp-sunset$/.test((tk2.find((x) => x.t === 'Draft the cutover plan') || {}).href) && !tk.sort, JSON.stringify({ tk, tk2 }));
105
- await fold(p, 'itasks'); await fold(p, 'etasks');
106
- await fold(p, 'tree');
107
- ok('F a row folds', await until(() => p.evaluate(() => document.querySelector('#czViewer [data-czs-fold="tree"]').getAttribute('aria-expanded') === 'false')));
109
+ await fold(p, 'etasks');
110
+ ok('F a row folds', await until(async () => !(await isOpen(p, 'etasks'))));
108
111
  await p.click('#czViewer [data-cz-vw="close"]');
109
112
  ok('P Close closes the Viewer', await until(() => p.evaluate(() => document.querySelector('#czViewer').hidden)));
110
113
  ok('P Close takes the program out of the address (batch 14 item 7: the address follows the Viewer)', !new URL(p.url()).searchParams.get('program'), p.url());
111
114
  await p.goto(BASE + '/premium-board.html?ws=idpf&program=project-ascent'); // the program's own link again
112
115
  await shown(p);
113
- ok('F the folds are kept after a reload', await until(async () => !(await isOpen(p, 'tree')) && await isOpen(p, 'ms')));
114
- await fold(p, 'tasks');
116
+ ok('F the last tab and the folds are kept after a reload', await until(async () => (await p.evaluate(() => { const t = document.querySelector('#czViewer [data-pv="tab"][aria-selected="true"]'); return t && t.dataset.k === 'tasks'; })) && !(await isOpen(p, 'etasks')) && await isOpen(p, 'itasks')));
117
+ if (!(await isOpen(p, 'tasks'))) await fold(p, 'tasks');
115
118
  await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-pp="done"][data-key="pt-vendor-form"]')));
116
119
  await p.click('#czViewer [data-pp="done"][data-key="pt-vendor-form"]');
117
120
  const dn = await until(() => D.posts.find((x) => x.path === '/api/programs/task-done'));
118
121
  ok('X a program task\'s check box marks it done (POST /api/programs/task-done)', !!dn && dn.body.key === 'pt-vendor-form' && dn.body.done === true && dn.body.program === 'project-ascent', JSON.stringify(dn));
119
- await fold(p, 'tree');
122
+ await tab(p, 'initiatives');
120
123
  await until(() => p.evaluate(() => !!document.querySelector('#czViewer button.pp-open[data-ini="descope-parity"]')));
121
124
  await p.click('#czViewer button.pp-open[data-ini="descope-parity"]');
122
125
  const ip = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden || !/Initiative/.test(v.getAttribute('aria-label') || '')) return null; return { t: v.querySelector('.cz-vw-title').textContent, peek: !document.querySelector('#peek'), stg: +((/^Stage \d+ of (\d+)/.exec(((v.querySelector('.iv-tel') || { getAttribute: () => '' }).getAttribute('aria-label')) || '') || [])[1] || 0) }; }));
@@ -137,8 +140,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
137
140
  /* ── Turn into a program: the sort card counts the tasks of the initiative it came from that have no level, and sorting starts in Home ── */
138
141
  const U = await open({ programs: F.programs().map((x) => ({ ...x, from: 'legacy-idp-sunset' })) });
139
142
  await shown(U.page);
140
- const so = await until(() => U.page.evaluate(() => { const c = document.querySelector('#czViewer a.czs-pri'); return c ? { t: (document.querySelector('#czViewer .czs-p') || {}).textContent || '', label: c.textContent, href: c.getAttribute('href') } : null; }));
141
- ok('K after Turn into a program the summary counts the tasks from before the split (not the one already on an epic), and its primary opens the sorting in Home', !!so && /^2 tasks from before the split have no level yet\./.test(so.t) && so.label === 'Review the suggested homes' && /^\/premium\.html\?ws=idpf&ask=program%3Aproject-ascent&q=/.test(so.href), JSON.stringify(so));
143
+ const so = await until(() => U.page.evaluate(() => { const c = document.querySelector('#czViewer .pv a.czs-pri'); return c ? { t: (c.closest('.pv-card').querySelector('.czs-p') || {}).textContent || '', label: c.textContent, href: c.getAttribute('href') } : null; }));
144
+ ok('K after Turn into a program a card on the page counts the tasks from before the split (not the one already on an epic), and its primary opens the sorting in Home', !!so && /^2 tasks from before the split have no level yet\./.test(so.t) && so.label === 'Review the suggested homes' && /^\/premium\.html\?ws=idpf&ask=program%3Aproject-ascent&q=/.test(so.href), JSON.stringify(so));
142
145
  ok('0 no page error after Turn into a program', U.errors.length === 0, U.errors.join(' | '));
143
146
  await U.ctx.close();
144
147
 
@@ -9,25 +9,21 @@
9
9
  * The panel opens on document `bd:program` { id, from? }. A program row of the Board ([data-prog]) and ?program=<id> (Home links there) send
10
10
  * that event through pm/bd-prog.js openProgram, the one path that opens it.
11
11
  *
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 Dashboard toggle, ⋯ and Close. ⋯
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: 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
21
- * · Claude's milestone suggestions (pm/ms-suggest.js, canvas XmsgB): with no milestone yet, they take the place of "Add the first milestone";
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
23
- * · the summary card: the next milestone, else what waits on you; the owner and the span; one primary, "Review the suggested homes", only
24
- * after Turn into a program while tasks of the initiative it came from have no level yet; Claude sorts them in Home
25
- * · the goals: the KRs its initiatives anchor to, for one year half with a period picker; the earlier halves fold into one chip
26
- * · the milestone track: 3 milestones, the earlier done ones in a done cluster and the later ones in "N more"; both open Milestones
27
- * · the folding rows (were tabs): Waits on you · On the program (its tasks, Done folded) · On its initiatives and On their epics (every
28
- * open task, by level; each opens in Home) · Initiatives (per product, with their first tasks, what waits on you and their epics) · Milestones (Done, Next, Later; a program check's diamond marks it) · Documents (the charter, the PRDs, …)
29
- * · first, the goal Claude drafted (pm/metric-drafts.js, canvas Iq9Program): the dashed "✦ Proposed goal" card, and once kept its Goal
30
- * row with Undo; nothing when nothing is drafted (GET /api/metric-drafts, scope program)
12
+ * What it shows: ONE page (feedback batch 21 item 2, canvas RdProgL–RdProgP; pm/prog-page.js lays it out). It replaced the batch 17 Work |
13
+ * Dashboard pair, so the header has no toggle. Each part draws only when a record holds something for it:
14
+ * · the shell's header: the program icon, "title · goal" once, Discuss in chat (the question goes to Home), ⋯ and Close. ⋯ holds, in the
15
+ * shell's order: add an initiative, move one in, add a task, copy link, copy as text, and archive (red, last, with a confirmation)
16
+ * · the ✦ line: the next milestone in bold, then how many things wait on you; on a teammate's shared copy, who shared it and when (RdProgO)
17
+ * · the goal card: the goals of GET /api/ready-reports/dashboard (scope program:<id>) by their SHORT title (lib/ready-reports.js shortTitle)
18
+ * with the KR chip and Forecast's range bar; with none, the goal Claude drafted (pm/metric-drafts.js, the dashed "✦ Proposed goal"), else
19
+ * the KRs its initiatives anchor to. The milestones sit inside it, once: the track (3, with done and "N more" clusters that open every
20
+ * milestone in the card), Claude's first suggestions (pm/ms-suggest.js) or "Add the first milestone"
21
+ * · one folded row "N proposals wait on you": Claude's milestone changes and its other proposals. The owner only; never on a shared copy
22
+ * · four tabs, Initiatives first (Wawan 2026-11-01): Tasks (amber dot when one is late: late first, then Where the work sits: On the program,
23
+ * On its initiatives, On their epics) · Initiatives (per product, each with its first tasks, what waits on you and its epics) · Reports (the
24
+ * ready-made reports, blue dot when one is ready) · Documents (the charter, the PRDs, …). The viewer's last tab per program is kept in this browser
25
+ * · the charter (pm/program-charter.js, canvas MsB*): the one editor of the program's fields and milestones; ways in are the Milestones pencil
26
+ * and "Add the first milestone"
31
27
  * An initiative in another product is read from that product's board (GET /api/board-premium?ws=). Per product the panel also reads, once per
32
28
  * page load: its KRs' names (GET /api/boards/anchors, the OKR files), whether each KR is met (GET /api/insights-premium, the goals Insights
33
29
  * shows) and its PMOS tasks (GET /api/boards/items). A part whose read failed is left out, never guessed. Every fold is kept in this browser. */
@@ -42,7 +38,8 @@ import { programRename } from './rename-press.js';
42
38
  import { openCharter as charterForm, renamed as charterRenamed } from './program-charter.js';
43
39
  import * as MSG from './ms-suggest.js';
44
40
  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
+ import * as DB from './dash-view.js'; // the page model's parts: the reports and the proposals (batch 17 item 1)
42
+ import * as PV from './prog-page.js'; // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
46
43
 
47
44
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
48
45
  const I = {
@@ -61,7 +58,7 @@ let O = null; // mount's options
61
58
  let cur = null; // { id, from } the program shown and the element it was opened from
62
59
  let period = null; // the year half the goals show (null: the current one)
63
60
  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 }
61
+ const DASH = new Map(); // program id → { d: the page model | null, read: bool, open: Set of folds }
65
62
  const fold = new Set((() => { try { return JSON.parse(store.get(FOLD_KEY) || '[]'); } catch { return []; } })());
66
63
  const keepFold = () => store.set(FOLD_KEY, JSON.stringify([...fold].slice(-200)));
67
64
  const AWAY = new Map(); // the boards of the other products: ws → { name, board, rows } | 'reading'
@@ -193,7 +190,9 @@ function trackHtml(st, p) {
193
190
  const f = T.shown.length && lastDone === T.shown.length - 1 ? lastDone + 0.5 : lastDone >= 0 ? lastDone + 1 : T.done.length ? 0 : -1;
194
191
  const cl = (L, done) => (L.length ? `<button type="button" class="pp-cap${done ? ' dn' : ''}" data-pp="ms" aria-label="${L.length} ${done ? 'earlier ' + plural(L.length, 'milestone', 'milestones') + ', done' : 'later ' + plural(L.length, 'milestone', 'milestones')}. Show all milestones"><span class="st3" aria-hidden="true">${L.slice(0, 3).map(() => '<i></i>').join('')}</span>${L.length} ${done ? 'done' : 'more'}</button>` : '<span></span>');
195
192
  const one = (m) => `<div class="pp-m${m.late || m.risk ? ' late' : ''}" title="${esc(waitsLine(m))}${m.check ? '' : ' reaching ' + (m.reach || 'its ◆ stage')}${m.risk ? '. At risk: ' + esc(m.risk) : ''}"><span class="pp-dm${m.done ? ' d' : st.next && m.id === st.next.id ? ' n' : ''}" aria-hidden="true"></span><b>${esc(m.name)}</b><span class="pp-md">${esc(m.day)}${m.done ? '' : rdHtml(m)}</span></div>`;
196
- return `<div class="pp-sec"><p class="lbl">Program milestones</p><div class="pp-mt" style="--pp-n:${n};--pp-f:${f}"${f < 0 ? ' data-nofill' : ''}>${cl(T.done, true)}${T.shown.map(one).join('')}${cl(T.more, false)}</div></div>`;
193
+ // the pencil into the charter, at Milestones (kept from the Milestones row when the page became one page)
194
+ const pen = RO ? '' : `<button type="button" class="cz-vw-ib pp-pen" data-pp="edit" aria-label="Edit the milestones in the charter" title="Edit in the charter">${SV(I.pen, 15)}</button>`;
195
+ return `<div class="pp-sec"><div class="pp-lh"><p class="lbl">Program milestones</p>${pen}</div><div class="pp-mt" style="--pp-n:${n};--pp-f:${f}"${f < 0 ? ' data-nofill' : ''}>${cl(T.done, true)}${T.shown.map(one).join('')}${cl(T.more, false)}</div></div>`;
197
196
  }
198
197
  /** What waits on you in the program: your open program tasks, then each initiative's next action that is yours. Each opens in Home. */
199
198
  function needs(p, st) {
@@ -337,24 +336,64 @@ function needsList(p, st) {
337
336
  const L = needs(p, st);
338
337
  return L.map((x) => `<a class="pp-nr" href="${esc(x.href)}" aria-label="${x.task ? 'Task' : 'Waits on you'}: ${esc(x.title)}. Opens in Home"><span class="mk2">${x.task ? `<span class="pp-ck${x.late ? ' late' : ''}"></span>` : '<span class="pp-dt"></span>'}</span><span class="t"><b>${esc(x.title)}</b><span>${esc(x.sub)}</span></span><span class="go">${SV(I.out, 14)}</span></a>`).join('');
339
338
  }
340
- function bodyHtml(p) {
341
- const st = programState(p, rowsOf), N = needs(p, st), D = docsOf(st), T = iniTasks(st), C = changesOf(p, st);
342
- facts(p, st);
339
+ /* ── the one page (batch 21 item 2, RdProgL–RdProgP): the top, then four tabs; it replaced the Work | Dashboard pair ── */
340
+ const RO = typeof window !== 'undefined' && !!window.PMOS_READONLY; // a teammate's read-only copy (pm/readonly-boot.js): no proposals, no presses that write
341
+ const dayOfPack = (iso) => { const d = dayOf(iso); return d ? d.getDate() + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][d.getMonth()] : ''; };
342
+ /** The ✦ line: the next step in bold, then what waits on the owner; on a shared copy, who shared it and when (RdProgO). */
343
+ function lineOf(p, st, n, d) {
344
+ const s = summaryOf(p, st), lead = s.line ? s.line.replace(' · ', ', ') + '.' : d && d.handled && d.handled.lead ? d.handled.lead : '';
345
+ if (RO) { const k = window.PMOS_READONLY || {}; return { lead, rest: [k.by ? 'Shared by ' + k.by + (k.at ? ', a snapshot from ' + dayOfPack(k.at) : '') + '.' : '', k.ends ? 'Ends ' + dayOfPack(k.ends) + '.' : ''].filter(Boolean).join(' ') }; }
346
+ const rest = n ? (n === 1 ? 'One thing waits on you. It is one press.' : n + ' things wait on you. Each is one press.') : d && d.handled ? [s.line ? d.handled.lead : '', d.handled.rest].filter(Boolean).join(' ') : '';
347
+ return { lead, rest, warn: s.tone === 'warn' || !!(d && d.handled && d.handled.tone === 'warn' && !s.line) };
348
+ }
349
+ const LATE_SHOWN = 3; // Tasks: the late ones first, 3 shown (RdProgM)
350
+ function tasksTab(p, st, N, T) {
343
351
  const L = T.filter((t) => t.level === 'initiative'), E = T.filter((t) => t.level === 'epic');
352
+ const late = st.openTasks.filter((t) => { const d = daysTo(t.due); return d != null && d < 0; }).map((t) => ({ prog: true, t }))
353
+ .concat(T.filter((t) => { const d = daysTo(t.due); return d != null && d < 0; }).map((t) => ({ prog: false, t })));
354
+ const more = late.length - LATE_SHOWN;
355
+ const lateCard = late.length ? `<section class="pv-card" aria-label="Late"><div class="pv-ch"><h4>Late first</h4><small>${more > 0 ? LATE_SHOWN + ' shown · ' + more + ' more below' : ''}</small></div>`
356
+ + `<div class="pp-tree" role="tree" aria-label="Late tasks">${late.slice(0, LATE_SHOWN).map((x) => (x.prog ? taskRow(p, x.t) : iniTaskRow(p, x.t, x.t.level === 'epic' ? [x.t.epic, x.t.ini.title].filter(Boolean).join(' · ') : x.t.ini.title))).join('')}</div></section>` : '';
357
+ const yours = !RO && N.length ? `<section class="pv-card" aria-label="Waits on you"><div class="pv-ch"><h4>Waits on you</h4></div><div class="pp-needs" role="group" aria-label="Waits on you">${needsList(p, st)}</div></section>` : '';
344
358
  const rows = [
345
- N.length || C.length ? { id: 'needs', title: 'Waits on you', count: N.length + C.length, open: true, render: () => `<div class="pp-needs" role="group" aria-label="Waits on you">${MSG.rowsHtml(p, C)}${needsList(p, st)}</div>` } : null,
346
359
  { id: 'tasks', title: 'On the program', count: st.openTasks.length, open: adding, render: () => tasksHtml(p, st) },
347
- // every open task of its initiatives, by level (PgProgram "Tasks"): on the initiative itself, then on their epics
348
360
  L.length ? { id: 'itasks', title: 'On its initiatives', count: L.length, render: () => levelHtml(p, L, 'Tasks on its initiatives') } : null,
349
361
  E.length ? { id: 'etasks', title: 'On their epics', count: E.length, render: () => levelHtml(p, E, 'Tasks on their epics') } : null,
350
- st.inis.length || st.missing.length ? { id: 'tree', title: 'Initiatives', count: st.inis.length + st.missing.length, open: true, render: () => treeHtml(p, st) } : null,
351
- st.milestones.length ? { id: 'ms', title: 'Milestones', count: st.milestones.length, render: () => msHtml(st),
352
- tail: `<button type="button" class="cz-vw-ib" data-pp="edit" aria-label="Edit the milestones in the charter" title="Edit in the charter">${SV(I.pen, 15)}</button>` } : null,
353
- { id: 'docs', title: 'Documents', count: D.length + 1, render: () => docsHtml(p, st) },
354
362
  ];
355
- // Home on a phone (O.talk gives a function): the program's own chat is not beside the panel, so the panel ends with the way to it
356
- const talk = O && O.talk && O.talk() ? `<button type="button" class="hi-talk" data-pp="talk">Message Claude about ${esc(p.title)}</button>` : '';
357
- return MD.progHtml(p, p.home || board().ws || '') + VW.czSummary(summaryOf(p, st)) + goalsHtml(st) + trackHtml(st, p) + VW.czSections(rows, { key: 'program' }) + talk;
363
+ return yours + lateCard + `<section class="pv-card" aria-label="Where the work sits"><div class="pv-ch"><h4>Where the work sits</h4></div>${VW.czSections(rows, { key: 'program' })}</section>`;
364
+ }
365
+ function reportsTab(d, x) {
366
+ const R = d ? DB.reportsHtml(d, { open: x.open }) : '';
367
+ if (!R) return `<section class="pv-card" aria-label="Reports"><div class="pv-ch"><h4>Reports</h4></div><p class="pv-none">${d ? 'Claude writes these for you. One shows here when it is due.' : 'The reports could not be read.'}</p></section>`;
368
+ return `<div class="db" data-level="program">${RO ? '' : DB.trustHtml(d)}${R}</div>`;
369
+ }
370
+ /** The program's one page. Each part draws only when a record holds something for it. */
371
+ function viewHtml(p) {
372
+ const st = programState(p, rowsOf), x = dashOf(p.id), d = x.d;
373
+ if (!RO) facts(p, st);
374
+ const N = RO ? [] : needs(p, st), C = RO ? [] : changesOf(p, st), D = docsOf(st), T = iniTasks(st);
375
+ // the proposals that wait on the owner: Claude's milestone changes, then its other proposals on the program (GET /api/proposals through the page)
376
+ const dn = RO || !d ? 0 : d.needsN || (d.needs ? 1 : 0), n = C.length + dn;
377
+ const first = C.length ? MSG.words(p, C[0]).title : d && d.needs ? d.needs.q : '';
378
+ const props = n ? { n, sub: first + (n > 1 ? ' and ' + (n - 1) + ' more' : ''), html: MSG.rowsHtml(p, C) + (dn && d.needs ? DB.needsHtml(d) : '') } : null;
379
+ // the goal card: the dashboard's goals with their short titles, else the goal Claude drafted, else the KRs its initiatives anchor to; the milestones inside
380
+ const G = (d && d.goals) || [], mk = 'msall:' + p.id;
381
+ const inner = trackHtml(st, p) + (st.milestones.length && fold.has(mk) ? msHtml(st) : '');
382
+ const goal = PV.goalCard({ goals: G, proposed: G.length ? '' : MD.progHtml(p, p.home || board().ws || '') || goalsHtml(st), inner, shared: RO, open: x.open });
383
+ const late = st.openTasks.concat(T).some((t) => { const dd = daysTo(t.due); return dd != null && dd < 0; });
384
+ const reps = ((d && d.reports) || []).filter((r) => r.kind !== 'heads-up');
385
+ const tabs = [
386
+ { id: 'tasks', label: 'Tasks', n: st.openTasks.length + T.length, sig: late ? 'late' : '', html: () => tasksTab(p, st, N, T) },
387
+ { id: 'initiatives', label: 'Initiatives', n: st.inis.length + st.missing.length, html: () => treeHtml(p, st) || '<p class="pv-none">No initiative in it yet. Move one in from its own menu.</p>' },
388
+ { id: 'reports', label: 'Reports', n: reps.length, sig: reps.some((r) => r.state === 'drafted') ? 'ready' : '', html: () => reportsTab(d, x) },
389
+ { id: 'documents', label: 'Documents', n: D.length + 1, html: () => docsHtml(p, st) },
390
+ ];
391
+ // Home on a phone (O.talk gives a function): the program's own chat is not beside the panel, so the page ends with the way to it
392
+ const talk = !RO && O && O.talk && O.talk() ? `<button type="button" class="hi-talk" data-pp="talk">Message Claude about ${esc(p.title)}</button>` : '';
393
+ // after Turn into a program: the tasks from before the split that have no level yet, and the way to Claude's suggested homes (kept from the summary card)
394
+ const s = RO ? null : summaryOf(p, st);
395
+ const sort = s && s.primary ? `<section class="pv-card" aria-label="Tasks with no level"><p class="czs-p">${esc(s.text)}</p><a class="czs-pri" href="${esc(s.primary.href)}">${esc(s.primary.label)}</a></section>` : '';
396
+ return PV.pageHtml({ page: 'program:' + p.id, line: lineOf(p, st, N.length + n, d), goal, cards: sort, props, tabs, shared: RO, tail: talk });
358
397
  }
359
398
  /** The ◆ dates this page reads for the program's initiatives (a Jira slip moves one too). A change from what the server last heard asks Claude
360
399
  * to review once (POST /api/programs/facts); each reading is sent once per page load. */
@@ -413,29 +452,13 @@ function textOf(p) {
413
452
  return lines.join('\n');
414
453
  }
415
454
  const titleOf = (p) => p.title + (p.goal ? ' · ' + p.goal : '');
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. */
455
+ /* ── the dashboard model the page reads (GET /api/ready-reports/dashboard scope program:<id>): goals, reports, proposals ── */
456
+ const dashOf = (id) => { if (!DASH.has(id)) DASH.set(id, { d: null, read: false, open: new Set() }); return DASH.get(id); };
457
+ /** Reads the program's page model (again) and draws the page when it lands. via: 'read' | 'act', how the PM arrived. */
427
458
  async function readDash(p, via) {
428
459
  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();
460
+ x.d = await DB.readDash(p.home || board().ws || '', 'program:' + p.id, via); x.read = true;
461
+ if (cur && cur.id === p.id && shownHere()) draw(true);
439
462
  }
440
463
  function openPanel(id, from, via) {
441
464
  if (!O || !O.M() || !progOf(id)) return false;
@@ -451,14 +474,13 @@ function openPanel(id, from, via) {
451
474
  rename.value = p.title;
452
475
  VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program:' + id,
453
476
  discuss: true, more: moreOf(p), rename,
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); },
456
477
  render: (body) => {
457
478
  { 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 ←
458
479
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
459
480
  body.classList.add('pp-vw');
460
481
  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)
482
+ PV.wirePage(body, { redraw: () => draw(true) }); // the tabs and the proposals fold (pm/prog-page.js)
483
+ if (!body.dataset.dbWired) { // the reports' and the goals' presses, once per body (pm/dash-view.js)
462
484
  body.dataset.dbWired = '1';
463
485
  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
486
  toast: (t) => O.say(t), redraw: () => draw(true), reload: async () => { const q2 = cur && progOf(cur.id); if (q2) await readDash(q2); },
@@ -466,7 +488,7 @@ function openPanel(id, from, via) {
466
488
  openReport: (r) => openReport(r, (progOf(id) || {}).home || board().ws || ''),
467
489
  editNeeds: (n) => { if (n && n.ini) { if (O.drill) VW.drill(); else VW.close(); O.openIni(n.ini); } } });
468
490
  }
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); };
491
+ body.onclick = (e) => { if (e.target.closest('[data-db], [data-pv]')) 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); };
470
492
  body.onsubmit = submit;
471
493
  document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
472
494
  },
@@ -488,7 +510,9 @@ async function press(b) {
488
510
  const a = b.dataset.pp, p = cur && progOf(cur.id); if (!p) return;
489
511
  if (a === 'talk') { const t = O.talk && O.talk(); if (t) t(); return; }
490
512
  if (a === 'fold') setFold(b.dataset.fold);
491
- else if (a === 'ms' || a === 'itasks') showRow(a);
513
+ else if (a === 'ms') setFold('msall:' + p.id); // the track's clusters open every milestone inside the goal card: drawn once (RdProgL)
514
+ else if (a === 'itasks') { PV.keepTab('program:' + p.id, 'tasks'); showRow(a); }
515
+ else if (RO && /^(add|done|check|edit|first|charter)$/.test(a)) O.say('This is a read-only copy.');
492
516
  else if (a === 'period') { O._perOpen = !O._perOpen; draw(true); }
493
517
  else if (a === 'per' || a === 'early') { period = b.dataset.per; O._perOpen = false; draw(); const pb = VW.body() && VW.body().querySelector('[data-pp="period"]'); if (pb) pb.focus(); }
494
518
  else if (a === 'ini') { const id = b.dataset.ini, from = document.querySelector(`#ibBody [data-prog="${CSS.escape(p.id)}"]`); if (O.drill) VW.drill(); else VW.close(); O.openIni(id, from); }
@@ -120,8 +120,11 @@ export const mdHtml = (text) => `<div class="md">${blocks(esc(String(text == nul
120
120
 
121
121
  /** The PM's turn without Claude Code's paste wrapper tags; the pasted words stay. */
122
122
  export const cleanUser = (text) => String(text == null ? '' : text).replace(/<\/?pasted_content\b[^>]*>/gi, '').replace(/\n{3,}/g, '\n\n').trim();
123
- /** The PM's turn as bubble HTML: escaped, line breaks kept. */
124
- export const userHtml = (text) => esc(cleanUser(text)).replace(/\n/g, '<br>');
123
+ /* A line that makes the PM's turn markdown: a heading, a list item, a fence, a quote, a table row, **bold** or `code`. */
124
+ const MD_RE = /^\s*(#{1,6}\s|[-*+]\s|\d+[.)]\s|```|~~~|>|\|.*\|)|\*\*[^*\n]+\*\*|`[^`\n]+`/m;
125
+ /** The PM's turn as bubble HTML. Pasted markdown shows formatted, as Claude's answers do (batch 21 item 1); plain words stay escaped with
126
+ * their line breaks kept. */
127
+ export const userHtml = (text) => { const t = cleanUser(text); return MD_RE.test(t) ? mdHtml(t) : esc(t).replace(/\n/g, '<br>'); };
125
128
 
126
129
  /** A tool's short name: `mcp__claude_ai_Slack__slack_read_thread` and `claude_ai_Slack/slack_read_thread` both read `slack_read_thread`. */
127
130
  export const toolName = (n) => String(n || '').split(/__|\//).filter(Boolean).pop() || String(n || '');
@@ -214,6 +214,9 @@ body.cz-home { min-height: 100vh; overflow: hidden; }
214
214
  .hm-a { display: flex; gap: 10px; align-items: flex-start; }
215
215
  .hm-ab { flex: 1; min-width: 0; font-size: var(--fs-3); line-height: 1.55; color: var(--cz-ink); }
216
216
  .hm-ab .md p { margin: 0 0 6px; }
217
+ .hm-bub .md, .hm-qb .md { max-width: none; color: inherit; line-height: 1.5; }
218
+ .hm-bub .md p, .hm-qb .md p { margin: 0 0 6px; }
219
+ .hm-bub .md pre, .hm-qb .md pre { background: rgba(255,255,255,.6); }
217
220
  .hm-who { margin: 0; font-size: var(--fs-2); font-weight: 700; color: var(--cz-ink); line-height: 1.55; }
218
221
  .hm-who span { font-weight: 400; color: var(--cz-ink3); }
219
222
  .hm-who .hm-say { font-size: var(--fs-3); color: var(--cz-ink); }
@@ -1,4 +1,6 @@
1
- /* pm/dash-view.js — the ready-made Dashboard view of a program, a product or an initiative (batch 17 item 1, design A+; canvas In development,
1
+ /* pm/dash-view.js — the ready-made Dashboard view of an initiative, and the parts the one program and product page reuses (batch 21 item 2,
2
+ * pm/prog-page.js: the program and the product have no toggle any more; reportsHtml and trustHtml draw its Reports tab) — first built as the
3
+ * Dashboard view of a program, a product or an initiative (batch 17 item 1, design A+; canvas In development,
2
4
  * band "Ready-made dashboards and reports": PbH1Header, PbA1–PbA3, PbA5, PbA7, PbS1, PbS2, PbG2, PbG3, PbG6–PbG10).
3
5
  *
4
6
  * The program panel (bd-prog-panel.js), the initiative view (bd-ini-panel.js on the Board, home-ini.js on Home) and the product page (home-app.js)
@@ -51,7 +53,9 @@ export const togglePress = (v) => ({ act: 'dash', label: v === 'dash' ? 'Show th
51
53
 
52
54
  /** GET /api/ready-reports/dashboard. null when the route is missing or refused, so the host never draws a toggle to nothing. */
53
55
  export async function readDash(ws, scope, from) {
54
- const u = '/api/ready-reports/dashboard?' + new URLSearchParams(Object.entries({ ws: ws || '', scope, from: from || '' }).filter(([, v]) => v)).toString();
56
+ // a shared copy (pm/readonly-boot.js) holds the page keyed by ws and scope only (lib/board-pack.js teammateDash): it asks without `from`
57
+ const ro = typeof window !== 'undefined' && !!window.PMOS_READONLY;
58
+ const u = '/api/ready-reports/dashboard?' + new URLSearchParams(Object.entries({ ws: ws || '', scope, from: ro ? '' : from || '' }).filter(([, v]) => v)).toString();
55
59
  try { const r = await fetch(u, { credentials: 'same-origin' }); if (r.status !== 200) return null; const j = await r.json(); return j && j.ok !== false && (j.dashboard || j.scope) ? (j.dashboard || j) : null; } catch { return null; }
56
60
  }
57
61
 
@@ -141,7 +145,7 @@ function stageHtml(d, o = {}) {
141
145
  }
142
146
  const guardHtml = (d) => ((d.guardrails || []).length ? sec('Guardrails', `<div class="db-card db-list">${d.guardrails.map((g) => `<div class="db-row">${dot(g.dot)}<span class="db-rt"><b>${esc(g.title)}</b>${g.sub ? `<small>${esc(g.sub)}</small>` : ''}</span>${who(g.owner)}</div>`).join('')}</div>`) : '');
143
147
  /** Needs you: one decision with Claude's pick (PbA1): ✕ drops it, ✎ opens it to change, ✓ keeps the pick. */
144
- function needsHtml(d) {
148
+ export function needsHtml(d) {
145
149
  const n = d.needs; if (!n || !n.q) return '';
146
150
  return sec('Needs you', `<div class="db-card db-need"><div class="db-nq">${SV(I.flag, 16)}<span class="db-rt"><b>${esc(n.q)}</b>${n.sub ? `<small>${esc(n.sub)}</small>` : ''}${n.pick ? `<span class="db-pick">✦ My pick: ${esc(n.pick)}</span>` : ''}</span></div>`
147
151
  + `<div class="db-acts">${ib('needs', 'Not now', I.x, { k: 'drop', off: !n.drop })}${ib('needs-edit', 'Change it first', I.pen)}${ib('needs', 'Keep my pick' + (n.pick ? ': ' + n.pick : ''), I.chk, { solid: true, k: 'keep', off: !n.keep })}</div></div>`);
@@ -167,7 +171,7 @@ function headsUpHtml(r) {
167
171
  + `<div class="db-chips">${r.audience ? `<span class="db-chip">${SV(I.people, 14)}${esc(r.audience)}</span>` : ''}${r.channel ? `<span class="db-chip">${SV(I.send, 14)}${esc(r.channel)}</span>` : ''}</div>`
168
172
  + `<div class="db-acts">${ib('hold', 'Not now', I.x, { k: rid(r) + '|skip' })}${r.path ? ib('report', 'Change it first', I.pen, { k: rid(r) }) : ''}${ib('send', 'Send the heads-up', I.send, { solid: true, k: rid(r) })}</div></div>`);
169
173
  }
170
- function reportsHtml(d, o) {
174
+ export function reportsHtml(d, o) {
171
175
  const L = (d.reports || []).filter((r) => r.kind !== 'heads-up');
172
176
  const hu = (d.reports || []).filter((r) => r.kind === 'heads-up' && r.state !== 'sent').map(headsUpHtml).join('');
173
177
  if (!L.length) return hu;
@@ -178,7 +182,7 @@ function reportsHtml(d, o) {
178
182
  return hu + sec(d.level === 'product' ? 'This week' : 'Reports', `<div class="db-card db-reps">${lead.map(repRow).join('')}${more}</div>`);
179
183
  }
180
184
  /** Send by itself (PbG6): calm weeks go by themselves by default (Wawan 2026-10-28); the card shows only where the PM had turned it off. */
181
- function trustHtml(d) {
185
+ export function trustHtml(d) {
182
186
  const t = d.trust; if (!t) return '';
183
187
  return `<div class="db-card db-trust"><div class="db-top"><span class="db-rt"><b>Send by itself</b><small>Only weeks where everything is on its line</small></span></div>`
184
188
  + `<div class="db-acts">${ib('trust', 'Not now', I.x, { k: 'off' })}${ib('trust', 'Send it by itself in calm weeks', I.chk, { solid: true, k: 'on' })}</div></div>`;
@@ -49,7 +49,9 @@ function pmSays(t) { let at = -1, m; SAYS_RE.lastIndex = 0; while ((m = SAYS_RE.
49
49
  /** The PM's turn as the PM typed it (G7): `/goal Ship X` for the grilling prompt, a short line for Start and Cancel, and only the PM's
50
50
  * words for the opening message that carries the row's context. Anything else is shown unchanged. */
51
51
  export function shownUser(text) {
52
- const t = String(text == null ? '' : text);
52
+ // a long or multi-line message reaches Claude Code as a paste, so the session records it inside <pasted_content> tags; take them off
53
+ // first, or the PMOS rule shows as the PM's turn (batch 21 item 1: the report rule filled the bubble)
54
+ const t = String(text == null ? '' : text).replace(/<\/?pasted_content\b[^>]*>/gi, '').trim();
53
55
  if (t.includes(MARK.start)) return 'Start the goal';
54
56
  if (t.startsWith(MARK.method)) { const m = /Use the (.+?) method/.exec(t); return 'Ask with ' + (m ? m[1] : 'another method'); }
55
57
  if (t.startsWith(MARK.plan)) return 'Changed the plan';