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
@@ -38,6 +38,7 @@ import * as L from './home-list.js';
38
38
  import * as TD from './home-today.js';
39
39
  import * as YD from './home-day.js';
40
40
  import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2)
41
+ import * as OKL from './okr-list.js'; // the product page's Goals line (batch 16 item 6, GsProduct)
41
42
  import { canDictate, dictate } from './home-dictate.js';
42
43
  import { mountIni, iniList, iniOverview, iniPage, iniAddTask } from './home-ini.js'; // the initiative's page, its stage move, Tasks and Core documents (premium-uncovered-features, HbC)
43
44
  import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
@@ -48,7 +49,10 @@ import * as PM from './prog-move.js'; // move an initiative out of its program
48
49
  import * as CW from './ctx-wedge.js'; // how full a session's context is, and Claude's ✦ Compact (batch 13 item 8, XctxA1Desk)
49
50
  import * as SO from './sort-order.js'; // the sort button and ONE order with the Board (batch 14 item 8, canvas SoAHomePhone)
50
51
  import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
52
+ import * as IMP from './home-impact.js'; // Your impact: the weekly check in Home's own chat (batch 16 item 7, GmP1Ledger)
51
53
  import * as LPV from './loose-props.js'; // Claude's clean-up of "Not in an initiative": the ✦ on its header and the Viewer (batch 13 item 3)
54
+ import * as IM from './impact.js'; // Your impact (batch 16 item 7): Adler's sprout on the greeting, the week in the Viewer, the Friday chapter
55
+ import * as DB from './dash-view.js'; // the product page is the product's Dashboard (batch 17 item 1, canvas PbA3, PbG6, PbG8)
52
56
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
53
57
 
54
58
  const $ = (s, r = document) => r.querySelector(s);
@@ -196,6 +200,8 @@ async function load() {
196
200
  S.ready = true;
197
201
  await loadIni();
198
202
  draw();
203
+ loadImpact();
204
+ readImpact();
199
205
  // the boards of the other products Home reads, each its own closed group: read after the list is drawn, so a slow one never holds it up
200
206
  const others = await Promise.all(otherProducts(D).map((a) => getRetry('/api/board-premium?ws=' + encodeURIComponent(a.ws), 4).then((r) => (r && r.ok && r.model ? { ws: a.ws, name: a.name, model: r.model } : null))));
201
207
  const got = others.filter(Boolean);
@@ -294,7 +300,8 @@ function homeListHtml() {
294
300
  const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1);
295
301
  return TD.listHtml(M, todayModel(), {
296
302
  sel: S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null), selHead: S.head, ses: S.ses, pOpen, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
297
- pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
303
+ pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) + (S.impact ? IMP.rowHtml(S.impact.c, { esc, sel: S.sel === 'impact' }) : '') : '',
304
+ imFace: IM.faceHtml(S.im, { joy: S.imJoy }),
298
305
  });
299
306
  }
300
307
  /** Your day (XvAPhDay): "Good morning" opens it in the Viewer on a phone and a desktop alike (batch 16, Wawan: the same press must lead to
@@ -310,6 +317,26 @@ function dayParts() {
310
317
  function drawDayBody(body, P) {
311
318
  const ph = isPhone() && PHC;
312
319
  YD.drawDay(body, P, VW, ph ? (el) => { el.append(PHC.el); PHC.read(true); } : null);
320
+ // Your impact's chapter (batch 16 item 7, GmP4Chapter): on a Friday when a stage of one of these initiatives really closed this week
321
+ if (S.chap) body.insertAdjacentHTML('afterbegin', IM.chapterHtml(S.chap, { href: '/premium.html?ini=' + encodeURIComponent(S.chap.c.id) + (S.chap.c.ws ? '&ws=' + encodeURIComponent(S.chap.c.ws) : '') }));
322
+ }
323
+ /** Your impact (batch 16 item 7): the week's read gives Adler's sprout its leaves, celebrates once on a real event (a thanks says itself in
324
+ * the toast), and on a Friday finds the chapter for Your day. Nothing shows while the switch is off or the 9-of-10 gate is not passed. */
325
+ async function readImpact() {
326
+ const W = await IM.readWeek().catch(() => null);
327
+ const had = IM.shows(S.im) || !!S.chap;
328
+ S.im = W;
329
+ // nothing to show and nothing shown before: keep the rows as they are, so a click in flight still lands
330
+ if (!IM.shows(W)) { S.chap = null; if (had) drawList(); return; }
331
+ S.imJoy = !!IM.celebrate(W, { toast });
332
+ drawList();
333
+ if (S.imJoy) setTimeout(() => { S.imJoy = false; }, 1600); // the leaf grows once: the next draw is still
334
+ if (new Date(NOW()).getDay() === 5) {
335
+ const ch = await IM.readChapters().catch(() => []);
336
+ const all = H.boardRows(S.D).concat(...(S.D.others || []).map((o) => H.boardRows({ ...S.D, board: o.model })));
337
+ S.chap = IM.chapterToday(ch, (id) => ((all.find((r) => r.id === id) || {}).title || ''), NOW(), W);
338
+ redrawDay();
339
+ }
313
340
  }
314
341
  function day(on) {
315
342
  S.day = !!on;
@@ -780,18 +807,31 @@ const productRename = (ws, name, vid) => (ws ? { value: name, max: 80, save: asy
780
807
  /** The name Home shows for the board's own product: its group's name (the PM's name for the repository wins), else the board's. */
781
808
  const ownProductName = () => { const g = ((S.M && S.M.groups) || []).find((x) => x.kind === 'product' && x.primary); return (g && g.name) || H.productName(S.D); };
782
809
  const productKey = () => { const g = ((S.M && S.M.groups) || []).find((x) => x.kind === 'product' && x.primary); return g ? g.key : null; };
810
+ /** The product page's Goals (GsProduct, batch 16 item 6): one line from the goal status function (GET /api/goal-status, readings only), one dot
811
+ * per goal, that opens the Intelligence goal list. Build status leaves the goal block and stays on the Board. */
812
+ const intelHref = (ws) => '/premium-intelligence.html' + (ws ? '?ws=' + encodeURIComponent(ws) : '');
813
+ const goalsBlock = (ws) => `<section class="hi-pg" aria-label="Goals"><div class="hm-r hi-r"><a class="hm-rm" href="${esc(intelHref(ws))}" aria-label="Open goals in Intelligence"><span class="hm-tile">${SVG(I.chart, 14)}</span><span class="hm-rt"><b>Goals</b><em class="q" data-okr-line>Reading the goals</em></span><span class="okr-pld" data-okr-dots aria-hidden="true"></span></a></div></section>`;
814
+ async function fillGoals(b, ws) {
815
+ let r = null;
816
+ try { r = await pmGet('/api/goal-status' + (ws ? '?ws=' + encodeURIComponent(ws) : '')); } catch { r = null; }
817
+ const L = r && r.ok ? OKL.productLine(r) : null, line = b.querySelector('[data-okr-line]'), dots = b.querySelector('[data-okr-dots]');
818
+ if (!line) return;
819
+ line.textContent = L ? L.text : 'Open them in Intelligence';
820
+ if (dots) dots.innerHTML = L ? L.dots.map((d) => OKL.dotHtml(d)).join('') : '';
821
+ }
783
822
  /** The product's page in the Viewer (HbCProduct): Goals, the KRs and budgets with what is at risk, and This week, the weekly update and the
784
823
  * metrics review. A press opens that one; ← comes back to the page. */
785
824
  function openProductPage() {
786
825
  const name = ownProductName();
787
826
  VW.open({ id: 'product', kind: 'Product', title: name, icon: 'chart', rename: productRename(boardWs(), name, 'product'),
788
827
  render: (b) => {
789
- const C = H.productCard(S.D, S.D.now), U = H.weeklyUpdate(S.D, S.D.now), sent = (U.sent || []).some((x) => x.week === U.week.iso);
790
- const goals = C.items.map((x) => itemHtml({ kind: x.kind === 'ok' ? 'done' : 'risk', label: x.label })).join('') || '<p class="hm-none">No KR or budget is anchored on this board.</p>';
828
+ const U = H.weeklyUpdate(S.D, S.D.now), sent = (U.sent || []).some((x) => x.week === U.week.iso);
791
829
  const row = (k, icon, t, sub) => `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hp="${k}"><span class="hm-tile">${SVG(icon, 14)}</span><span class="hm-rt"><b>${esc(t)}</b><em class="q">${esc(sub)}</em></span></button></div>`;
792
- b.innerHTML = `<div class="hi-v hi-page"><section class="hi-pg" aria-label="Goals"><div class="hi-pgh"><b>Goals</b><span class="hi-n">${esc(C.of)}</span></div>${goals}</section>`
830
+ b.innerHTML = `<div class="hi-v hi-page">${goalsBlock(boardWs())}`
793
831
  + `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div>${row('update', I.doc, 'Weekly update', sent ? 'Sent this week' : 'Ready to send')}${row('metrics', I.chart, 'Metrics review', 'With Strategist')}</section>`
794
832
  + (isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '') + '</div>';
833
+ fillGoals(b, boardWs());
834
+ productDash(b, boardWs() || '', 'product', name);
795
835
  b.onclick = (e) => {
796
836
  const t = e.target.closest('[data-hp]'); if (!t) return;
797
837
  if (t.dataset.hp === 'update') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); }
@@ -800,6 +840,29 @@ function openProductPage() {
800
840
  };
801
841
  } });
802
842
  }
843
+ /** The product page as the product's Dashboard (batch 17 item 1, PbA3): the ✦ line, Goals folded to their dots, Ships next, This week's
844
+ * reports. It has no toggle: the page already is the dashboard. Until GET /api/ready-reports/dashboard answers (or when it cannot), the page
845
+ * keeps the Goals and This week it drew before. */
846
+ const PDASH = new Map(); // ws → { d, open }
847
+ function productDash(b, ws, vid, name) {
848
+ const x = PDASH.get(ws) || { d: null, open: new Set() }; PDASH.set(ws, x);
849
+ const paint = () => {
850
+ const c = VW.current(); if (!x.d || !b.isConnected || !c || c.id !== vid) return;
851
+ b.innerHTML = DB.dashHtml(x.d, { open: x.open, metrics: true, talk: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
852
+ };
853
+ if (b.dataset.dbWired !== ws) {
854
+ b.dataset.dbWired = ws;
855
+ DB.wireDash(b, { d: () => x.d, open: x.open, ws, toast, redraw: paint,
856
+ // the metrics review, as the page offered before it was the dashboard: here for the board's product, in its own Home for another
857
+ metrics: () => { if (vid === 'product') { VW.drill(); openMetrics(); } else window.open('/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product&view=metrics', '_blank', 'noopener'); }, reload: async () => { const d = await DB.readDash(ws, 'product', 'read'); if (d) x.d = d; paint(); },
858
+ openReport: async (row) => {
859
+ // Home's own weekly update (desk: true, 1-A) opens its update flow, not a document
860
+ if (row.desk) { if (vid === 'product') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); } else window.open('/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product', '_blank', 'noopener'); return; }
861
+ if (!row.path) return; VW.drill(); (await import('./premium-report-read.js')).openReportView(row.path, { ws, name: row.name, cuts: true }); } });
862
+ }
863
+ paint();
864
+ DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
865
+ }
803
866
  /** A phone: the page's "Message Claude about …" closes the sheet and opens the chat full screen; its ← goes back to the list (HbCPhone). */
804
867
  function talk() { S.phoneChat = true; VW.close(); drawList(); chat.focus(); }
805
868
  /** "Overview with Claude" on the initiative's card: the ask is typed into the chat box, for the PM to send or change. */
@@ -852,8 +915,21 @@ function programTarget(id, task) {
852
915
  }
853
916
  function homeTarget() {
854
917
  return { key: 'chat:main', ws: WS || undefined, title: 'Home', scope: { text: 'All work', icon: I.home }, rich: false, placeholder: 'Message Claude', role: CLAUDE,
855
- empty: 'Ask anything about your work. Claude reads your repositories and works in a real Claude Code session.', also: alsoOf(null) };
856
- }
918
+ empty: 'Ask anything about your work. Claude reads your repositories and works in a real Claude Code session.', also: alsoOf(null),
919
+ intro: S.impact ? S.impact.intro : undefined };
920
+ }
921
+ /* Your impact (batch 16 item 7): when a finished week has items not checked yet, Home's own chat opens on Claude's check (GmP1Ledger).
922
+ * Off in Settings, or nothing to check: no card. Read after the list is drawn, so it never holds Home up. */
923
+ async function loadImpact() {
924
+ const c = await IMP.readCheck(pmGet).catch(() => null);
925
+ const was = !!S.impact;
926
+ S.impact = c ? { c, intro: IMP.checkIntro(c, { esc, pmPost, done: () => { S.impact = null; drawList(); } }) } : null;
927
+ const cur = chat.current && chat.current();
928
+ if ((was || S.impact) && cur && cur.key === 'chat:main') { chat.open(homeTarget()); }
929
+ if (was || S.impact) drawList();
930
+ }
931
+ // the switch in Settings › General (pm/cozy-settings.js) turns the check off and on at once
932
+ window.addEventListener('pmos:impact', () => { loadImpact(); readImpact(); }); // the switch: the weekly check row and Adler's sprout follow at once
857
933
  function openTarget(t) {
858
934
  S.cur = { title: t.title, ses: t.ses || null, sub: t.sub != null && t.sub !== '' ? t.sub : t.scope && t.scope.text !== t.title ? t.scope.text : '' };
859
935
  chat.open(t); drawTop();
@@ -929,11 +1005,12 @@ function goOtherProduct(g) {
929
1005
  const own = '/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product';
930
1006
  VW.open({ id: 'product:' + ws, kind: 'Product', title: name, icon: 'chart', rename: productRename(ws, name, 'product:' + ws),
931
1007
  render: (b) => {
932
- const goals = C.items.map((x) => itemHtml({ kind: x.kind === 'ok' ? 'done' : 'risk', label: x.label })).join('') || '<p class="hm-none">No KR or budget is anchored on this board.</p>';
933
- b.innerHTML = `<div class="hi-v hi-page"><section class="hi-pg" aria-label="Goals"><div class="hi-pgh"><b>Goals</b><span class="hi-n">${esc(C.of)}</span></div>${goals}</section>`
1008
+ b.innerHTML = `<div class="hi-v hi-page">${goalsBlock(ws)}`
934
1009
  + `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div><div class="hm-r hi-r"><a class="hm-rm" href="${esc(own)}" target="_blank" rel="noopener"><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>Weekly update and metrics review</b><em class="q">In ${esc(name)}'s own Home, in a new tab</em></span></a></div></section>`
935
1010
  + (isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '') + '</div>';
1011
+ productDash(b, ws, 'product:' + ws, name);
936
1012
  // a phone has no chat beside the page: its own chat is one press away, as on the board's own product (Wawan, 2026-10-25)
1013
+ fillGoals(b, ws);
937
1014
  b.onclick = (e) => { const t = e.target.closest('[data-hp="talk"]'); if (t) talk(); };
938
1015
  } });
939
1016
  }
@@ -1553,7 +1630,9 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
1553
1630
  if (d.hmCompact) { compact(d.hmCompact); return; } // ✓ on Claude's ✦ Compact (batch 13 item 8): the pill's list stays open
1554
1631
  if (S.ses && !b.closest('.hv-spp, .hv-sps')) sesPill(null, false); // a press anywhere else in the list closes it
1555
1632
  if (d.hmSel) { if (S.ses) sesPill(null, false); if (S.day) S.day = false; select(d.hmSel); return; }
1633
+ if ('hrImpact' in d) { if (S.day) S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; } // Your impact: Home's own chat, on the weekly check
1556
1634
  if ('hrMentions' in d) { if (S.day) S.day = false; S.sel = 'mentions'; drawList(); MEN.openMentions(menCtx()); return; }
1635
+ if ('hmImpact' in d) { if (S.day) day(false); IM.openWeek(); return; }
1557
1636
  if ('hmDay' in d) { day(!S.day); return; }
1558
1637
  if ('hmDayx' in d) { day(false); return; }
1559
1638
  if ('hmFlt' in d) { filterMenu(b); return; }
@@ -5,7 +5,7 @@
5
5
  * homeLists(D) the Home list: Needs you (top 3 + "N more"), Initiatives (the product first) and Loose, each row with its kids
6
6
  * iniLayout(D, id) one initiative as a layout of Home: its card's groups (Needs you, Sessions, Stakeholders, Meetings, Routines, Files,
7
7
  * Finished sessions) and the Elsewhere line
8
- * productCard(D) the product's card: "This week", the KRs and the budget on track or at risk, Then, the next routine, the CTA
8
+ * productCard(D) the product's card (every anchor from D.board.anchorRows when sent): "This week", the KRs and the budget on track or at risk, Then, the next routine, the CTA
9
9
  * weeklyUpdate(D) the weekly update the Viewer shows and Send turns into a mail draft: On track, At risk, Needs a decision
10
10
  * streamOf(conv, o) the chat's stream: day dividers, "New since you left", "N earlier messages", messages, Worked-for folds
11
11
  * meetLineOf(P) the meeting line: the current or next meeting, +N for the rest of the day
@@ -153,7 +153,8 @@ export function productName(D) {
153
153
  }
154
154
  /** The product's KRs and budgets this week: one item per anchor, on track when none of its initiatives is late or at risk. */
155
155
  export function productCard(D, now = Date.now()) {
156
- const rows = boardRows(D).filter(OPEN);
156
+ // every open initiative's anchor when the board sends them (anchorRows, batch 17), so the count matches the product's dashboard; else the rows listed
157
+ const rows = D.board && Array.isArray(D.board.anchorRows) ? D.board.anchorRows : boardRows(D).filter(OPEN);
157
158
  const by = new Map();
158
159
  for (const r of rows) { const a = anchorOf(r); if (!by.has(a)) by.set(a, []); by.get(a).push(r); }
159
160
  const items = [...by.entries()].filter(([a]) => a !== 'No anchor').map(([a, L]) => {
@@ -0,0 +1,16 @@
1
+ /* pm/home-impact.css — the weekly check of Your impact in Home's chat (feedback batch 16 item 7, canvas GmP1Ledger). pm/home-impact.js. */
2
+ .im-card { clear: both; margin-top: 8px; padding: 4px 14px 8px; } /* under Claude's line, never beside it (the line floats on a desk) */
3
+ .im-list { list-style: none; margin: 0; padding: 0; }
4
+ .im-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--cz-hair); }
5
+ .im-row:first-child { border-top: 0; }
6
+ .im-row.im-off .im-t { color: var(--cz-ink3); text-decoration: line-through; }
7
+ .im-k { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--cz-well); color: var(--cz-ink2); }
8
+ .im-k.im-thanks { background: var(--cz-bluebg); color: var(--cz-blueink); }
9
+ .im-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
10
+ .im-t { font-size: var(--fs-4); overflow-wrap: anywhere; }
11
+ .im-src { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
12
+ .im-src:hover { text-decoration: underline; }
13
+ .im-src svg, .im-lock svg { flex: none; }
14
+ .im-foot { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
15
+ .im-lock { flex: 1; display: inline-flex; align-items: center; gap: 6px; }
16
+ @media (prefers-reduced-motion: no-preference) { .im-row { transition: opacity .2s ease; } }
@@ -0,0 +1,72 @@
1
+ /* pm/home-impact.js — the weekly check of "Your impact" in Home's chat (feedback batch 16 item 7, Phase 1; canvas In development GmP1Ledger).
2
+ * After a week ends, Claude lists that week's items and asks whether each is real: ✕ or ✓ on each row, ✓✓ for every row not checked yet.
3
+ * Only ✓ items count. Each row links to its source. No number is shown. The card is Home's own chat intro while the check is due; it goes
4
+ * when every row is checked.
5
+ *
6
+ * readCheck(pmGet) → the GET /api/impact/check body when a check is due, else null
7
+ * checkIntro(c, { esc, pmPost, done }) → the intro of Home's chat: { role, text, card: { html, press } }
8
+ * rowHtml(c, { esc, sel }) → the one row under Mentions while the check is due: a tap opens Home's chat on it (on a phone too). No count.
9
+ * Writes: POST /api/impact/verdict { id, real }, /verdict-all { week }, /undo { id } (page presses). Nothing leaves PMOS. */
10
+
11
+ const SV = (d, w = 18) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
12
+ const P = {
13
+ thanks: 'M7 7h4v4c0 3-2 5-4 5M14 7h4v4c0 3-2 5-4 5',
14
+ unblock: 'M7 11V8a5 5 0 0 1 9.6-2M5 11h14v9H5z',
15
+ used: 'M12 3l8 9-8 9-8-9z',
16
+ kr: 'M4 17l6-6 4 4 6-7M15 8h5v5',
17
+ no: 'M6 6l12 12M18 6L6 18', yes: 'M5 12l5 5 9-10', all: 'M18 6L7 17l-5-5M22 10l-7.5 7.5L13 16',
18
+ lock: 'M7 11V8a5 5 0 0 1 10 0v3M5 11h14v9H5z', open: 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6',
19
+ };
20
+ const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
21
+ const dayName = (iso) => { const t = Date.parse(iso); return Number.isFinite(t) ? DAYS[new Date(t).getDay()] : ''; };
22
+
23
+ export async function readCheck(pmGet) {
24
+ const r = await pmGet('/api/impact/check');
25
+ return r && r.ok && r.on && r.due ? r : null;
26
+ }
27
+
28
+ export function rowHtml(c, { esc, sel }) {
29
+ if (!c) return '';
30
+ return `<div class="hv-card hr-card hr-men-card"><div class="hm-r hv-r hr-men${sel ? ' sel' : ''}" data-id="impact">`
31
+ + `<button type="button" class="hm-rm" data-hr-impact${sel ? ' aria-current="true"' : ''} aria-label="Your impact: ${esc(c.label.toLowerCase())} is ready to check">`
32
+ + `<span class="hv-mk hr-at" aria-hidden="true">${SV(P.yes, 16)}</span><span class="hm-rt"><b>Your impact</b><small class="hr-sub">${esc(c.label)} is ready to check</small></span>`
33
+ + '<span class="hv-xc" aria-hidden="true"></span></button></div></div>';
34
+ }
35
+
36
+ export function checkIntro(c, { esc, pmPost, done }) {
37
+ const st = { c, msg: '' };
38
+ const left = () => st.c.items.filter((x) => x.real === null);
39
+ const row = (x) => {
40
+ const mark = x.real === null
41
+ ? `<button type="button" class="ut-ib lg" data-im-v="no" data-im-id="${esc(x.id)}" aria-label="Not real, drop it" title="Not real, drop it">${SV(P.no)}</button>`
42
+ + `<button type="button" class="ut-ib pri" data-im-v="yes" data-im-id="${esc(x.id)}" aria-label="Real, keep it" title="Real, keep it">${SV(P.yes)}</button>`
43
+ : `<button type="button" class="ut-ib lg on" data-im-undo="${esc(x.id)}" aria-pressed="true" aria-label="${x.real ? 'Kept as real. Undo' : 'Dropped. Undo'}" title="${x.real ? 'Kept as real. Undo' : 'Dropped. Undo'}">${SV(x.real ? P.yes : P.no)}</button>`;
44
+ return `<li class="im-row${x.real === false ? ' im-off' : ''}"><span class="im-k im-${esc(x.kind)}" aria-hidden="true">${SV(P[x.kind] || P.used)}</span>`
45
+ + `<span class="im-tx"><span class="im-t">${esc(x.text)}</span><a class="ut-small ut-mut im-src" href="${esc(x.source.url)}" target="_blank" rel="noopener noreferrer">${esc(x.source.label)} · ${esc(dayName(x.at))} ${SV(P.open, 12)}</a></span>${mark}</li>`;
46
+ };
47
+ const html = () => {
48
+ const open = left();
49
+ return `<div class="ut-card im-card" role="group" aria-label="Your impact, ${esc(st.c.label.toLowerCase())}">`
50
+ + `<ul class="im-list">${st.c.items.map(row).join('')}</ul>`
51
+ + `<div class="im-foot"><span class="ut-small ut-mut im-lock">${SV(P.lock, 14)} Only you see this. Nothing leaves PMOS.</span>`
52
+ + (open.length > 1 ? `<button type="button" class="ut-ib pri" data-im-all aria-label="All real, keep them all" title="All real, keep them all">${SV(P.all)}</button>` : '')
53
+ + `</div><p class="ut-small ut-mut" role="status">${esc(st.msg)}</p></div>`;
54
+ };
55
+ const press = async (b) => {
56
+ const d = b.dataset;
57
+ let r = null;
58
+ if (d.imV) r = await pmPost('/api/impact/verdict', { id: d.imId, real: d.imV === 'yes' });
59
+ else if (d.imUndo) r = await pmPost('/api/impact/undo', { id: d.imUndo });
60
+ else if ('imAll' in d) r = await pmPost('/api/impact/verdict-all', { week: st.c.week });
61
+ else return false;
62
+ if (!r || !r.ok) { st.msg = (r && r.error) || 'Not saved.'; return true; }
63
+ if (d.imV) { const x = st.c.items.find((y) => y.id === d.imId); if (x) x.real = d.imV === 'yes'; }
64
+ else if (d.imUndo) { const x = st.c.items.find((y) => y.id === d.imUndo); if (x) x.real = null; }
65
+ else for (const x of st.c.items) if (x.real === null) x.real = true;
66
+ st.msg = left().length ? '' : 'Thank you. This week is checked.';
67
+ if (!left().length && done) done();
68
+ return true;
69
+ };
70
+ const short = c.gate === 'short' ? ' Too many of these were not real, so I keep your sprout and your log hidden for now.' : '';
71
+ return { role: { key: 'claude', name: 'Claude', initial: 'C' }, text: `Here’s what I’d count as your impact ${c.label === 'Last week' ? 'last week' : c.label.replace(/^Week of/, 'the week of')}. Is each one real? I read these from your sources. I don’t post anything anywhere.${short}`, card: { html, press } };
72
+ }
@@ -32,6 +32,7 @@ import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './
32
32
  import * as SC from './home-stage-card.js';
33
33
  import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
34
34
  import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D: the card's last node and the move sheet's words // D99: the initiative's own workflow (Change picker, switch, Won't do, Archive)
35
+ import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1)
35
36
 
36
37
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
37
38
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
@@ -47,6 +48,18 @@ const X = { ctx: null, L: new Map(), reading: new Set(), tried: new Set(), view:
47
48
  const curM = () => { const S = X.ctx && X.ctx.S; return S && S.ini && S.ini !== 'product' && S.IMid === S.ini ? S.IM : null; };
48
49
  const wsOf = (M) => (M && M.board && M.board.ws) || undefined;
49
50
  const bw = (M) => ({ ws: M.board.ws, board: M.board.id });
51
+ /* ── the Dashboard view (batch 17 item 1, pm/dash-view.js; canvas PbH1Header): one header icon on the page switches Work and Dashboard ── */
52
+ const DASH = new Map(); // initiative id → its Dashboard host
53
+ function dashFor(id) {
54
+ if (!id || id === 'product' || !X.ctx) return null;
55
+ if (!DASH.has(id)) {
56
+ const wsOf = () => { const M = curM(); return (M && M.board.ws) || (rowOf(id) || {}).ws || ''; };
57
+ DASH.set(id, DB.dashHost({ page: 'initiative:' + id, scope: 'initiative:' + id, ws: wsOf, board: () => { const M = curM(); return (M && M.board.id) || (rowOf(id) || {}).boardId || ''; },
58
+ vid: 'ov:' + id, VW: X.ctx.VW, redraw: () => { if (BODY) BODY.__pg = null; redrawView(); }, toast: (t) => X.ctx.toast(t),
59
+ openReport: async (row) => { if (!row.path) return; X.ctx.VW.drill(); (await import('./premium-report-read.js')).openReportView(row.path, { ws: wsOf(), name: row.name, cuts: true }); } }));
60
+ }
61
+ return DASH.get(id);
62
+ }
50
63
  async function readL(id, M, force) {
51
64
  if (!force && (X.L.has(id) || X.reading.has(id))) return;
52
65
  X.reading.add(id);
@@ -426,9 +439,13 @@ export function iniPage() {
426
439
  const VW = X.ctx.VW;
427
440
  let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
428
441
  if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
442
+ const dh = dashFor(id);
429
443
  BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', more: () => pageMore(id), rename,
430
444
  discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
431
- render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); } });
445
+ presses: dh ? dh.presses() : null, onPress: (a) => { if (a === 'dash' && dh) dh.toggle(); },
446
+ render: (b) => { X.view = 'page'; BODY = b; ADDING = null; draw(b); wire(b, id); wirePage(b, id); if (dh) dh.wire(b); } });
447
+ // came to read (?view=dashboard: a report, Intelligence, a notification) or to act (a Home task): which view opens first
448
+ if (dh) dh.read(new URLSearchParams(location.search).get('view') === 'dashboard' ? 'read' : 'act');
432
449
  WF.pmosNotice(wfUi(), id); // WfTriage: "Set to Tender from the BRD · Undo", once
433
450
  if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; redrawView(); }); }
434
451
  return true;
@@ -497,6 +514,7 @@ function draw(b) {
497
514
  if (!M) { b.__pg = null; b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
498
515
  const v = X.view;
499
516
  if (v !== 'page') b.__pg = null;
517
+ if (v === 'page' && dashFor(id) && dashFor(id).shows()) { b.__pg = null; b.innerHTML = dashFor(id).html(() => ''); return; }
500
518
  if (v === 'page') { const h = pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
501
519
  // Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
502
520
  if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
@@ -267,12 +267,14 @@ export function todayHtml(T, o) {
267
267
  const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
268
268
  const WEEKDAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
269
269
  const MOMENT = new Set(['rec', 'soon', 'live', 'eod', 'review']);
270
- /** M is homeList(); T todayCard(); o: { sel, ses (the initiative row whose pill is open), pOpen, restOpen, pin, avHtml, ready, err, pick (GET /api/briefing-premium/products), tones, review, phone, day (Your day is open), news (how many items are new for you) } */
270
+ /** M is homeList(); T todayCard(); o: { sel, ses (the initiative row whose pill is open), pOpen, restOpen, pin, avHtml, ready, err, pick (GET /api/briefing-premium/products), tones, review, phone, day (Your day is open), news (how many items are new for you), imFace (Your impact's face press, pm/impact.js) } */
271
271
  export function listHtml(M, T, o) {
272
272
  const flt = M.filter !== 'today' ? M.filters.find((f) => f.key === M.filter) : null;
273
273
  // the blue dot after "Good morning": something is new for you, in Your day's New for you fold (feedback batch 16 item 5b, FmA4Desk)
274
274
  const nw = o.news > 0 ? '. ' + o.news + ' new for you' : '';
275
- const head = `<div class="hm-hd hv-bar"><button type="button" class="hv-hi" data-hm-day aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}${nw}. Open your day">${AD.adler(o.err ? 'honest' : 'handled', 36, { label: false, cls: 'hv-ad' })}<b>${esc(M.word || 'Today')}</b>${o.news > 0 ? '<i class="hv-nd" aria-hidden="true"></i>' : ''}${svg(P.chevD, 18)}</button>`
275
+ // Your impact (batch 16 item 7, GmA1Home): with it on, the greeting's face is its own press, Adler with the week's leaves (pm/impact.js faceHtml)
276
+ const face = o.imFace && !o.err ? '' : AD.adler(o.err ? 'honest' : 'handled', 36, { label: false, cls: 'hv-ad' });
277
+ const head = `<div class="hm-hd hv-bar">${o.imFace && !o.err ? o.imFace : ''}<button type="button" class="hv-hi" data-hm-day aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}${nw}. Open your day">${face}<b>${esc(M.word || 'Today')}</b>${o.news > 0 ? '<i class="hv-nd" aria-hidden="true"></i>' : ''}${svg(P.chevD, 18)}</button>`
276
278
  // the product chip, always (it is also the way to add one): the ticked products' tiles, or All (canvas XhpA2States)
277
279
  + (o.pick ? chipHtml(o.pick, { id: 'hmPick', attrs: 'data-hm-pick', label: 'Products on Home', tones: o.tones }) : '')
278
280
  + (o.phone ? '' : `<button type="button" class="ut-ib hv-ib${flt ? ' on' : ''}" data-hm-flt aria-haspopup="menu" aria-label="Show: Today, Kept or Done${flt ? '. Now ' + esc(flt.label) : ''}" title="Show: Today, Kept or Done">${svg(P.filter, 18)}</button>`)
@@ -0,0 +1,37 @@
1
+ /* impact.css — Your impact (feedback batch 16 item 7; pm/impact.js adds this sheet). Plain PM words on calm cards: no badge, no count, no
2
+ * leaf outside Adler's sprout. Colours are the --cz-* tokens of cozy.css, type is the var(--fs-N) scale. */
3
+ .im { display: flex; flex-direction: column; gap: 14px; font-family: var(--cz-sans); color: var(--cz-ink); }
4
+ .im-hd { display: flex; flex-direction: column; gap: 4px; }
5
+ .im-hd b { font-size: var(--fs-5); font-weight: 800; letter-spacing: -.01em; }
6
+ .im-hd span { font-size: var(--fs-4); color: var(--cz-ink2); }
7
+ .im-card { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 18px; padding: 4px 16px; }
8
+ .im-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; border-top: 1px solid var(--cz-hair); }
9
+ .im-row:first-child { border-top: 0; }
10
+ .im-tile { width: 36px; height: 36px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-well); color: var(--cz-ink2); }
11
+ .im-tile.b { background: var(--cz-bluebg); color: var(--cz-blue); }
12
+ .im-tile.g { background: var(--cz-okbg); color: var(--cz-ok); }
13
+ .im-av { width: 36px; height: 36px; border-radius: 18px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-3); background: var(--cz-well); color: var(--cz-ink); }
14
+ .im-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
15
+ .im-t { font-size: var(--fs-4); font-weight: 400; }
16
+ b.im-t { font-weight: 700; }
17
+ .im-s { font-size: var(--fs-3); color: var(--cz-ink2); }
18
+ .im-ib { width: 44px; height: 44px; border-radius: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-well); color: var(--cz-ink2); text-decoration: none; }
19
+ .im-lock { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-3); color: var(--cz-ink2); }
20
+ .im-wk { display: flex; flex-direction: column; gap: 8px; }
21
+ .im-wk.quiet { flex-direction: row; align-items: baseline; gap: 10px; padding: 4px 0; }
22
+ .im-wl { font-size: var(--fs-2); font-weight: 800; letter-spacing: .02em; color: var(--cz-ink2); flex: none; }
23
+ .im-row .im-wl { width: 64px; }
24
+ .im-wk summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; border-radius: 12px; }
25
+ .im-wk summary::-webkit-details-marker { display: none; }
26
+ .im-wk summary .im-s { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
27
+ .im-wk[open] summary svg { transform: rotate(180deg); }
28
+ .im-log { display: flex; justify-content: center; padding: 4px 0; }
29
+ .im-first, .im-mh { display: flex; align-items: center; gap: 12px; }
30
+ .im-first { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 18px; padding: 14px; }
31
+ .im-made { margin-top: 18px; }
32
+ .im-ch { margin: 12px 0; }
33
+ .im-mt { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: var(--fs-3); color: var(--cz-ink2); }
34
+ .im-face { width: 40px; height: 44px; border: 0; padding: 0; margin: 0 -4px 0 0; background: none; border-radius: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
35
+ .im-face .ad-svg.hv-ad { width: 36px; height: 36px; }
36
+ @media (hover: hover) { .im-ib:hover, .im-face:hover, .im-wk summary:hover { background: var(--cz-well2); } }
37
+ .im-ib:focus-visible, .im-face:focus-visible, .im-wk summary:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }