create-pmos 0.480.0 → 0.481.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.
- package/package.json +13 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -3
- package/workspace/briefing-premium-insights-test.js +6 -6
- package/workspace/briefing-premium-metrics-test.js +5 -84
- package/workspace/briefing-premium-sources-test.js +6 -1
- package/workspace/changelog.json +12 -0
- package/workspace/guide/briefing-premium.md +9 -3
- package/workspace/guide/programs.md +4 -2
- package/workspace/lib/board-pack.js +1 -1
- package/workspace/lib/goal-chat.js +3 -0
- package/workspace/lib/metric-drafts.js +37 -6
- package/workspace/lib/ready-reports.js +6 -4
- package/workspace/lib/report-chat.js +1 -0
- package/workspace/lib/routes-metric-drafts.js +2 -1
- package/workspace/lib/routes-ready-reports.js +6 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-html-viewer-test.js +2 -0
- package/workspace/public/pm/bd-acts.js +2 -20
- package/workspace/public/pm/bd-prog-panel.js +1 -2
- package/workspace/public/pm/cozy-board.css +0 -11
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-insights.css +31 -0
- package/workspace/public/pm/cozy-vw-rp.css +5 -0
- package/workspace/public/pm/dash-view.css +19 -0
- package/workspace/public/pm/dash-view.js +49 -11
- package/workspace/public/pm/goal-chat.js +10 -3
- package/workspace/public/pm/home-app.js +31 -89
- package/workspace/public/pm/home-chat.js +19 -4
- package/workspace/public/pm/home-goal.js +1 -1
- package/workspace/public/pm/home-line.js +16 -1
- package/workspace/public/pm/home-list.js +1 -1
- package/workspace/public/pm/premium-board.js +2 -2
- package/workspace/public/pm/premium-insights.js +64 -11
- package/workspace/public/pm/premium-report-read.js +34 -4
- package/workspace/public/pm/premium-report-tab.js +57 -6
- package/workspace/public/pm/premium-vw-file.js +4 -0
- package/workspace/public/pm/prog-page.css +1 -1
- package/workspace/public/pm/prog-page.js +6 -3
- package/workspace/public/pm/report-chat.js +8 -2
- package/workspace/public/pm/trends-review.js +55 -0
- package/workspace/ready-dash-ui-test.js +1 -3
- package/workspace/test-files.json +1 -0
|
@@ -319,25 +319,7 @@ function openAddDoc(from) {
|
|
|
319
319
|
const f = $('#czViewer form[data-form="adddoc"]'); if (f) f.kind.onchange = () => { f.url.disabled = f.kind.value === 'In PMOS'; };
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
/* ── Metrics
|
|
323
|
-
/** Metrics: the board's measures (GET /api/board-metrics-premium), each with its value, its week, its change, its target where Insights set
|
|
324
|
-
* one, and a fold with its definition and its values by week. Targets and longer ranges live on Insights. Asks again while some are derived. */
|
|
325
|
-
async function openMetrics(from, again) {
|
|
326
|
-
if (!again) panel('Metrics', '<p class="bd-amut" id="metW">Reading the metrics…</p>', from, { eye: 'Board' });
|
|
327
|
-
let r = null;
|
|
328
|
-
try { r = await (await fetch('/api/board-metrics-premium?ws=' + encodeURIComponent(M().board.ws || ''), { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
329
|
-
const w = $('#metW'); if (!w) return;
|
|
330
|
-
if (!r || !r.ok || !r.model) { w.textContent = 'The metrics could not be read, so none is shown.' + (r && r.error ? ' The reason: ' + r.error + '.' : ''); return; }
|
|
331
|
-
const m = r.model, ws = encodeURIComponent(M().board.ws || '');
|
|
332
|
-
const tile = (t) => {
|
|
333
|
-
const weeks = (t.wk || []).map((k, i) => `<span>${esc(k)}</span><b>${t.ser && t.ser[i] != null ? esc(String(t.ser[i])) : 'Not kept yet'}</b>`).join('');
|
|
334
|
-
return `<details class="bd-met${t.look || t.kind === 'warn' || t.kind === 'bad' ? ' look' : ''}" data-met="${esc(t.key)}"><summary><span>${esc(t.label)}</span><b>${esc(t.absent || t.value || '')}</b><small>${esc(t.absent ? t.why || '' : t.text || '')}</small>`
|
|
335
|
-
+ `${t.change && !t.absent ? `<small>${esc(t.change.txt)}</small>` : ''}${t.chip ? `<em class="bd-mchip${t.ok ? ' ok' : ''}">${esc(t.chip)}${t.targetTxt ? ' · ' + esc(t.targetTxt) : ''}</em>` : t.look ? '<em class="bd-mchip">Needs a look</em>' : ''}</summary>`
|
|
336
|
-
+ `<p class="bd-amut">${esc(t.def || '')}</p>${weeks ? `<div class="bd-kv">${weeks}</div>` : ''}</details>`;
|
|
337
|
-
};
|
|
338
|
-
w.outerHTML = `<div id="metW"><p class="bd-amut">${esc(m.header || '')}${m.lead ? ' · ' + esc(m.lead) : ''}</p><div class="bd-mets">${(m.tiles || []).map(tile).join('')}</div><p class="bd-amut">${esc(m.note || '')} <a class="bd-alink" href="/premium-intelligence.html?ws=${ws}">Targets and longer ranges are on Intelligence</a>.</p></div>`;
|
|
339
|
-
if (m.pending) setTimeout(() => { if ($('#metW')) openMetrics(null, true); }, 3000);
|
|
340
|
-
}
|
|
322
|
+
/* ── Notifications (the Board's Metrics moved to Intelligence › Delivery trends, batch 22 item 4) ── */
|
|
341
323
|
function openBell(from) {
|
|
342
324
|
const rows = (M().rows || []).filter((r) => r.track && r.track.you), na = (M().chips || {}).asks;
|
|
343
325
|
const list = rows.map((r) => `<button type="button" class="bd-mi" data-act="ini" data-id="${esc(r.key)}"><i class="cz-dot you m-info"></i><span class="tx"><span>${esc(r.title)}</span><span class="bd-amut">${esc(r.track.you)}</span></span></button>`).join('');
|
|
@@ -388,7 +370,7 @@ async function setBack(r, input) {
|
|
|
388
370
|
await done(res, 'On hold · ' + r.title + ' · back ' + md(day(v)), async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? r.title + ' is back as it was.' : errOf(u)); await A.load(); });
|
|
389
371
|
}
|
|
390
372
|
|
|
391
|
-
export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint,
|
|
373
|
+
export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
|
|
392
374
|
export const closeDoc = () => { docOpen = null; };
|
|
393
375
|
|
|
394
376
|
/* ── the presses ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -480,8 +480,7 @@ function openPanel(id, from, via) {
|
|
|
480
480
|
body.classList.add('pp-vw');
|
|
481
481
|
const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = viewHtml(q); }
|
|
482
482
|
PV.wirePage(body, { redraw: () => draw(true) }); // the tabs and the proposals fold (pm/prog-page.js)
|
|
483
|
-
|
|
484
|
-
body.dataset.dbWired = '1';
|
|
483
|
+
{ // the reports' and the goals' presses (pm/dash-view.js: listeners once per body, this page's h each time)
|
|
485
484
|
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 || '',
|
|
486
485
|
toast: (t) => O.say(t), redraw: () => draw(true), reload: async () => { const q2 = cur && progOf(cur.id); if (q2) await readDash(q2); },
|
|
487
486
|
milestones: () => { const q2 = cur && progOf(cur.id); if (q2) openCharter(q2, 'milestones'); },
|
|
@@ -663,17 +663,6 @@ span.tg-end { left: var(--tl-x); cursor: default; } /* a shared board's milest
|
|
|
663
663
|
.bd-ask small { font-size: var(--fs-2); color: var(--cz-ink3); }
|
|
664
664
|
.bd-kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: var(--fs-3); }
|
|
665
665
|
.bd-kv span { color: var(--cz-ink3); }
|
|
666
|
-
.bd-mets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
|
|
667
|
-
.bd-met { border-radius: 14px; background: var(--cz-well); border: 1px solid transparent; }
|
|
668
|
-
.bd-met.look { border-color: var(--cz-late); }
|
|
669
|
-
.bd-met summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-height: 44px; }
|
|
670
|
-
.bd-met summary::-webkit-details-marker { display: none; }
|
|
671
|
-
.bd-met summary:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 14px; }
|
|
672
|
-
.bd-met[open] { grid-column: 1 / -1; }
|
|
673
|
-
.bd-met > .bd-amut, .bd-met > .bd-kv { padding: 0 12px 10px; }
|
|
674
|
-
.bd-met span, .bd-met small { font-size: var(--fs-2); color: var(--cz-ink3); } .bd-met b { font-size: var(--fs-4); }
|
|
675
|
-
.bd-mchip { font-style: normal; font-size: var(--fs-1); font-weight: 800; color: var(--cz-late); }
|
|
676
|
-
.bd-mchip.ok { color: var(--cz-ok); }
|
|
677
666
|
.bd-rows { display: flex; flex-direction: column; border: 1px solid var(--cz-hair); border-radius: 18px; overflow: hidden; }
|
|
678
667
|
.bd-lr { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) 110px 170px 110px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--cz-hair); font-size: var(--fs-3); cursor: pointer; }
|
|
679
668
|
.bd-lr:first-child { border-top: 0; }
|
|
@@ -523,6 +523,11 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
|
|
|
523
523
|
:is(.hm-chat, .vwgoal) .gchips { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
|
|
524
524
|
:is(.hm-chat, .vwgoal) .gchip { min-height: 44px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-size: var(--fs-2); font-weight: 600; text-align: left; cursor: pointer; }
|
|
525
525
|
:is(.hm-chat, .vwgoal) .gchip.rec { border-color: var(--cz-blue); background: var(--cz-bluebg); }
|
|
526
|
+
:is(.hm-chat, .vwgoal) .gchip:active:not(:disabled) { transform: scale(.98); }
|
|
527
|
+
:is(.hm-chat, .vwgoal) .gchip.on { border-color: var(--cz-blue); background: var(--cz-blue); color: var(--cz-card); }
|
|
528
|
+
:is(.hm-chat, .vwgoal) .gchip.on small { color: inherit; }
|
|
529
|
+
:is(.hm-chat, .vwgoal) .gchip:disabled { cursor: default; }
|
|
530
|
+
:is(.hm-chat, .vwgoal) .gchip:disabled:not(.on) { opacity: .6; }
|
|
526
531
|
:is(.hm-chat, .vwgoal) .gchip small { display: block; font-size: var(--fs-1); font-weight: 800; color: var(--cz-blueink); }
|
|
527
532
|
:is(.hm-chat, .vwgoal) .gchip small.warn { color: var(--cz-late); }
|
|
528
533
|
:is(.hm-chat, .vwgoal) .gplan { margin-top: 6px; padding: 10px 12px 12px; border-radius: 16px; border: 1px solid var(--cz-hair); background: linear-gradient(180deg, var(--cz-bluebg) 0%, var(--cz-card) 60%); box-shadow: var(--cz-vlift); }
|
|
@@ -899,3 +899,34 @@ textarea.ins-dri { height: auto; padding: 6px 8px; font-weight: 500; resize: ver
|
|
|
899
899
|
.fc-k.band { width: 14px; height: 10px; border-radius: 3px; background: var(--cz-blue); opacity: .22; }
|
|
900
900
|
.fc-base { display: flex; align-items: center; gap: 8px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--cz-hair); background: var(--cz-card); padding: 8px 10px 8px 16px; margin-top: 10px; }
|
|
901
901
|
.fc-base b { flex: 1; font-size: var(--fs-3); font-weight: 800; line-height: 1.4; }
|
|
902
|
+
|
|
903
|
+
/* Delivery trends carries the metrics review (batch 22 item 4, canvas MxA–MxC): the ✦ month line, "Up N vs last week" on a tile, What moved it,
|
|
904
|
+
* Goals that moved, and a tile's weeks in the Viewer */
|
|
905
|
+
.ins-trstrip { margin: 0 0 16px; padding: 12px 8px 12px 16px; background: var(--cz-bluebg, var(--cz-well)); }
|
|
906
|
+
.ins-trstrip .t { white-space: normal; font-weight: 800; color: var(--cz-ink); font-size: var(--fs-4); }
|
|
907
|
+
.ins-tile .mv { font-size: var(--fs-2); font-weight: 700; color: var(--cz-blueink); }
|
|
908
|
+
.ins-mvd { margin-top: 22px; }
|
|
909
|
+
.ins-mvd .ins-h3 { margin: 0 0 8px; font-size: var(--fs-2); font-weight: 800; color: var(--cz-ink3); }
|
|
910
|
+
.ins-mcard { border: 1px solid var(--cz-hair); border-radius: 18px; padding: 4px 16px; background: var(--cz-card); }
|
|
911
|
+
.ins-mrow { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 0; border-bottom: 1px solid var(--cz-hair); font-size: var(--fs-3); cursor: pointer; }
|
|
912
|
+
.ins-mrow:last-child { border-bottom: 0; }
|
|
913
|
+
.ins-mrow:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 8px; }
|
|
914
|
+
.ins-mrow .note { margin: 0; flex: 1; min-width: 0; }
|
|
915
|
+
.ins-mrow b { font-weight: 800; white-space: nowrap; }
|
|
916
|
+
.ins-mvd .ins-tbl { border: 1px solid var(--cz-hair); border-radius: 18px; overflow: hidden; }
|
|
917
|
+
.ins-sayv { margin: 0; font-weight: 700; font-size: var(--fs-4); }
|
|
918
|
+
.ins-bars { display: flex; gap: 8px; align-items: flex-end; height: 150px; margin: 10px 0 4px; }
|
|
919
|
+
.ins-bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; font-size: var(--fs-1); color: var(--cz-ink3); min-width: 0; }
|
|
920
|
+
.ins-bars i { display: block; width: 100%; border-radius: 6px; background: var(--cz-hair2, var(--cz-hair)); }
|
|
921
|
+
.ins-bars i.now { background: var(--cz-blue); }
|
|
922
|
+
.ins-bars i.blank { height: 6px; background: none; border: 1.5px dashed var(--cz-ink3); }
|
|
923
|
+
.ins-bars span { min-height: 1em; }
|
|
924
|
+
.ins-from { border-top: 1px solid var(--cz-hair); padding-top: 10px; }
|
|
925
|
+
body.ins-trv #goalTbl { display: block; } /* the narrow form hides the goal table; the trends view is not that table */
|
|
926
|
+
.ins-mg-cmp { display: none; }
|
|
927
|
+
@media (max-width: 720px) { .ins-mg-full { display: none; } .ins-mg-cmp { display: block; } .ins-mrow .note { display: none; } }
|
|
928
|
+
.ins-sayc { background: var(--cz-well); border-radius: 16px; padding: 12px 14px; }
|
|
929
|
+
body.ins-trv #pGoals .ins-trstrip { display: flex; } /* the narrow form hides the goals' ✦ strip; this one is the month line */
|
|
930
|
+
.ins-mrow b { margin-left: auto; }
|
|
931
|
+
.ins-mrow .cz-pill { margin-left: auto; }
|
|
932
|
+
.ins-trstrip .t { display: block; -webkit-line-clamp: unset; overflow: visible; }
|
|
@@ -226,3 +226,8 @@ button.rp-cy:hover { background: var(--cz-well); }
|
|
|
226
226
|
.vz-cb { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--cz-ink3); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
|
|
227
227
|
.vz-cutl li.on .vz-cb { background: var(--cz-blue); border-color: var(--cz-blue); color: var(--cz-onsolid); }
|
|
228
228
|
.vz-cb svg { fill: none; stroke: currentColor; stroke-width: 3; }
|
|
229
|
+
/* Claude is still working on this report (batch 22 item 13): a calm pulsing dot before the words */
|
|
230
|
+
.rp-wait { display: flex; gap: 8px; align-items: baseline; }
|
|
231
|
+
.rp-wait::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-blue); animation: rp-wait 1.6s ease-in-out infinite; }
|
|
232
|
+
@keyframes rp-wait { 50% { opacity: .3; } }
|
|
233
|
+
@media (prefers-reduced-motion: reduce) { .rp-wait::before { animation: none; } }
|
|
@@ -109,3 +109,22 @@ button.db-row, button.db-rep, .db-sum, .db-fold { cursor: pointer; }
|
|
|
109
109
|
}
|
|
110
110
|
@media (prefers-reduced-motion: no-preference) { .db-hd, .db-b { animation: db-in .24s ease-out both; } }
|
|
111
111
|
@keyframes db-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
|
|
112
|
+
|
|
113
|
+
/* "Goals I would change" in the product page's proposals row (batch 22 item 5, canvas RdKrKeep) */
|
|
114
|
+
.db-kr { display: flex; flex-direction: column; gap: 0; border: 1px dashed color-mix(in srgb, var(--cz-blueink) 45%, transparent); background: var(--cz-bluebg); }
|
|
115
|
+
.db-krr { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--cz-hair); }
|
|
116
|
+
.db-krr:first-child { border-top: 0; padding-top: 0; }
|
|
117
|
+
.db-krr .db-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
118
|
+
.db-krw { font-size: var(--fs-2); color: var(--cz-ink3); text-decoration-color: color-mix(in srgb, var(--cz-ink) 30%, transparent); }
|
|
119
|
+
.db-krn { font-size: var(--fs-5); font-weight: 800; line-height: 1.3; }
|
|
120
|
+
.db-krt { color: var(--cz-blueink); }
|
|
121
|
+
.db-kre { display: flex; gap: 8px; }
|
|
122
|
+
.db-kri { flex: 1; min-width: 0; font: inherit; font-size: var(--fs-4); padding: 6px 10px; border: 1px solid var(--cz-hair); border-radius: 10px; background: var(--cz-card); color: var(--cz-ink); }
|
|
123
|
+
.db-kri.n { flex: none; width: 5.5em; }
|
|
124
|
+
.db-krs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-2); color: var(--cz-ink2, var(--cz-ink3)); }
|
|
125
|
+
.db-krs > svg { color: var(--cz-dot-ok); }
|
|
126
|
+
.db-krp { border-radius: 999px; padding: 1px 8px; background: var(--cz-well); font-weight: 800; }
|
|
127
|
+
.db-krq, .db-krf small { margin: 0; font-size: var(--fs-2); color: var(--cz-ink3); }
|
|
128
|
+
.db-krq { border-top: 1px solid var(--cz-hair); padding-top: 10px; }
|
|
129
|
+
.db-krf { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--cz-hair); padding-top: 10px; }
|
|
130
|
+
.db-krf small { flex: 1; }
|
|
@@ -59,12 +59,17 @@ export async function readDash(ws, scope, from) {
|
|
|
59
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; }
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** The goals Claude would reword (batch 22 item 5, canvas RdKrKeep): GET /api/metric-drafts, product scope → { items, quiet } or null. */
|
|
63
|
+
export async function readKr(ws) {
|
|
64
|
+
try { const r = await fetch('/api/metric-drafts?' + new URLSearchParams({ scope: 'product', ...(ws ? { ws, id: ws } : {}) }).toString(), { credentials: 'same-origin' }); if (r.status !== 200) return null; const j = await r.json(); return j && j.ok && j.krProposals ? j.krProposals : null; } catch { return null; }
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
/* ── the parts ── */
|
|
63
68
|
const DOT = { ahead: 'ok', on: 'ok', ok: 'ok', done: 'ok', behind: 'risk', risk: 'risk', late: 'late', off: 'late', none: 'q', first: 'q', q: 'q' };
|
|
64
69
|
const dot = (d, label) => `<span class="db-dot ${DOT[d] || 'q'}"${label ? ` role="img" aria-label="${esc(label)}"` : ' aria-hidden="true"'}></span>`;
|
|
65
70
|
const who = (o) => { const n = String((o && (o.name || o)) || '').trim(); if (!n) return ''; const w = n.split(/\s+/); return `<span class="db-who" title="${esc(n)}" aria-label="${esc('Owner ' + n)}">${esc((w.length > 1 ? w[0][0] + w[1][0] : n[0]).toUpperCase())}</span>`; };
|
|
66
71
|
const tag = (p) => (p && p.tag ? `<span class="db-tag" title="${esc(p.name || p.tag)}">${esc(p.tag)}</span>` : '');
|
|
67
|
-
const ib = (act, label, icon, o = {}) => `<button type="button" class="db-ib${o.solid ? ' solid' : ''}" data-db="${esc(act)}"${o.k ? ` data-k="${esc(o.k)}"` : ''} aria-label="${esc(label)}" title="${esc(label)}"${o.off ? ' disabled' : ''}>${SV(icon, 17, o.solid ? 2.2 : 1.8)}</button>`;
|
|
72
|
+
const ib = (act, label, icon, o = {}) => `<button type="button" class="db-ib${o.solid ? ' solid' : ''}" data-db="${esc(act)}"${o.k ? ` data-k="${esc(o.k)}"` : ''}${o.i != null ? ` data-i="${esc(o.i)}"` : ''} aria-label="${esc(label)}" title="${esc(label)}"${o.off ? ' disabled' : ''}>${SV(icon, 17, o.solid ? 2.2 : 1.8)}</button>`;
|
|
68
73
|
const sec = (title, inner, cls = '', tail = '') => `<section class="db-b${cls ? ' ' + cls : ''}" aria-label="${esc(title)}">${tail ? `<div class="db-hr"><h4 class="db-h">${esc(title)}</h4>${tail}</div>` : `<h4 class="db-h">${esc(title)}</h4>`}${inner}</section>`;
|
|
69
74
|
const STATE_DOT = { ahead: 'ahead', on: 'on', behind: 'behind', late: 'late' };
|
|
70
75
|
|
|
@@ -79,8 +84,8 @@ function handledHtml(h) {
|
|
|
79
84
|
* summary row of dots (PbA3). With no goal yet, the goal Claude drafted (pm/metric-drafts.js) under a hollow "No goal yet". */
|
|
80
85
|
function goalsHtml(d, o) {
|
|
81
86
|
const G = d.goals || [];
|
|
82
|
-
// the product page keeps its way into
|
|
83
|
-
const mx = d.level === 'product' && o.metrics ? `<button type="button" class="db-ib" data-db="metrics" aria-label="Open
|
|
87
|
+
// the product page keeps its way into Intelligence › Delivery trends (o.metrics): one icon at the Goals block's head
|
|
88
|
+
const mx = d.level === 'product' && o.metrics ? `<button type="button" class="db-ib" data-db="metrics" aria-label="Open Delivery trends" title="Delivery trends">${SV(I.chart, 18)}</button>` : '';
|
|
84
89
|
if (!G.length && mx) return `<section class="db-b" aria-label="Goals"><div class="db-card"><div class="db-gh"><span class="db-rt"><b>Goals</b><small>No goal yet</small></span>${mx}</div>${d.drafts && d.drafts.goal && o.mdHtml ? o.mdHtml : ''}</div></section>`;
|
|
85
90
|
if (!G.length) return d.drafts && d.drafts.goal && o.mdHtml ? sec('Goal', `<div class="db-card"><p class="db-none">${dot('none')}No goal yet</p>${o.mdHtml}</div>`) : '';
|
|
86
91
|
const row = (g) => `<button type="button" class="db-row" data-db="goal" data-k="${esc(g.id)}"${g.ws || (g.product && g.product.ws) ? ` data-ws="${esc(g.ws || g.product.ws)}"` : ''}>${dot(g.dot, g.dot === 'none' ? 'No reading yet' : g.dot === 'behind' ? 'Behind its line' : g.dot === 'ahead' ? 'Ahead of its line' : 'On its line')}`
|
|
@@ -144,11 +149,30 @@ function stageHtml(d, o = {}) {
|
|
|
144
149
|
return '';
|
|
145
150
|
}
|
|
146
151
|
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>`) : '');
|
|
147
|
-
/**
|
|
152
|
+
/** The open proposals: every one the model sent (needsList), not only the first (batch 22 item 3: "5 proposals" opened to 1). */
|
|
153
|
+
export const needsOf = (d) => (d && Array.isArray(d.needsList) && d.needsList.length ? d.needsList : d && d.needs ? [d.needs] : []).filter((n) => n && n.q);
|
|
154
|
+
/** Needs you: one card per decision with Claude's pick (PbA1): ✕ drops it, ✎ opens it to change, ✓ keeps the pick. */
|
|
148
155
|
export function needsHtml(d) {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
156
|
+
const L = needsOf(d); if (!L.length) return '';
|
|
157
|
+
const pickOf = (n) => (typeof n.pick === 'string' ? n.pick.replace(/^✦\s*My pick:\s*/, '') : ''); // an older server sent the prefix
|
|
158
|
+
return sec('Needs you', L.map((n, i) => { const pk = pickOf(n);
|
|
159
|
+
return `<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>` : ''}${pk ? `<span class="db-pick">✦ My pick: ${esc(pk)}</span>` : ''}</span></div>`
|
|
160
|
+
+ `<div class="db-acts">${ib('needs', 'Not now', I.x, { k: 'drop', i, off: !n.drop })}${ib('needs-edit', 'Change it first', I.pen, { i })}${ib('needs', 'Keep my pick' + (pk ? ': ' + pk : ''), I.chk, { solid: true, k: 'keep', i, off: !n.keep })}</div></div>`; }).join(''));
|
|
161
|
+
}
|
|
162
|
+
/** "Goals I would change": the old wording struck through, the new one, one reason and the test read with its source and number; ✎ ✕ per goal and one ✓.
|
|
163
|
+
* Only goals whose test read returned a number are in K.items (lib/metric-drafts.js krProposalsOf); one Claude cannot read is one quiet line. */
|
|
164
|
+
const KRE = new Set(); // row ids open for an edit
|
|
165
|
+
export const krOf = (K) => ((K && K.items) || []).filter((r) => r && r.id);
|
|
166
|
+
export function krHtml(K) {
|
|
167
|
+
const L = krOf(K); if (!L.length) return '';
|
|
168
|
+
const row = (r) => { const ed = KRE.has(r.id), at = /T(\d\d:\d\d)/.exec(r.at || '');
|
|
169
|
+
const head = ed ? `<span class="db-kre"><input type="text" class="db-kri" data-kr="name" value="${esc(r.name)}" aria-label="New wording"><input type="text" inputmode="decimal" class="db-kri n" data-kr="target" value="${esc(r.target != null ? r.target : '')}" aria-label="Target"></span>`
|
|
170
|
+
: `<span class="db-krn">${esc(r.name)}${r.targetTxt ? ` <span class="db-krt">${esc(r.targetTxt)}</span>` : ''}</span>`;
|
|
171
|
+
return `<div class="db-krr" data-kr-row="${esc(r.id)}"><div class="db-rt"><s class="db-krw">${esc([r.goal, r.old].filter(Boolean).join(' · '))}</s>${head}${r.why ? `<small>${esc(r.why)}</small>` : ''}`
|
|
172
|
+
+ `<span class="db-krs">${SV(I.chk, 13, 2.4)}<span>${esc([r.source, r.how].filter(Boolean).join(' · '))}</span><span class="db-krp">${esc(r.nowTxt)} now</span>${at ? `<small>tested ${esc(at[1])}</small>` : ''}</span></div>`
|
|
173
|
+
+ `<div class="db-acts">${ib('kr', ed ? 'Save the change' : 'Edit the wording or the target', ed ? I.chk : I.pen, { k: ed ? 'save' : 'edit' }).replace('<button ', `<button data-row="${esc(r.id)}" `)}${ib('kr', 'Not this one', I.x, { k: 'drop' }).replace('<button ', `<button data-row="${esc(r.id)}" `)}</div></div>`; };
|
|
174
|
+
const q = ((K && K.quiet) || []).map((x) => `<p class="db-krq">${esc(x.line)}</p>`).join('');
|
|
175
|
+
return sec('Goals I would change', `<div class="db-card db-kr">${L.map(row).join('')}${q}<div class="db-krf"><small>${L.some((r) => r.target != null && r.target === r.now) ? 'The limits are today\'s counts, so "no worse than now". Change them with the pencil.' : 'Change the wording or the target with the pencil.'}</small>${ib('kr', 'Keep the goals left in this list', I.chk, { solid: true, k: 'keep' })}</div></div>`);
|
|
152
176
|
}
|
|
153
177
|
/* ── Reports ── */
|
|
154
178
|
const KIND_ICON = { weekly: I.rep, checkpoint: I.dia, 'did-it-work': I.chk, 'heads-up': I.warn, frozen: I.lock, metrics: I.chart };
|
|
@@ -200,8 +224,11 @@ export function dashHtml(d, o = {}) {
|
|
|
200
224
|
/* ── the presses ── */
|
|
201
225
|
const post = (u, b) => Promise.resolve(pmPost(u, b)).catch(() => null);
|
|
202
226
|
/** Wires one body. The host keeps h.d() the dashboard on screen, h.open the folds (a Set), and redraws through h.redraw(). */
|
|
203
|
-
export function wireDash(body,
|
|
227
|
+
export function wireDash(body, h0) {
|
|
228
|
+
// once per body, with the latest page's h (the Viewer keeps one body for every item; batch 22 item 6)
|
|
229
|
+
body._dbH = h0; if (body._dbOn) return; body._dbOn = true;
|
|
204
230
|
body.addEventListener('click', async (e) => {
|
|
231
|
+
const h = body._dbH;
|
|
205
232
|
const b = e.target.closest('[data-db]'); if (!b || b.disabled || !body.contains(b)) return;
|
|
206
233
|
const d = h.d && h.d(); if (!d) return;
|
|
207
234
|
const a = b.dataset.db, k = b.dataset.k || '', base = { ws: h.ws || undefined, scope: d.scope };
|
|
@@ -211,13 +238,25 @@ export function wireDash(body, h) {
|
|
|
211
238
|
if (a === 'goal') { if (h.goal) h.goal(k, b); else location.assign('/premium-intelligence.html?' + new URLSearchParams({ ...(b.dataset.ws || h.ws ? { ws: b.dataset.ws || h.ws } : {}), goal: k }).toString()); return; }
|
|
212
239
|
if (a === 'milestones') { if (h.milestones) h.milestones(); return; }
|
|
213
240
|
if (a === 'metrics') { if (h.metrics) h.metrics(); return; }
|
|
214
|
-
if (a === '
|
|
241
|
+
if (a === 'kr') { // batch 22 item 5: the presses of "Goals I would change"
|
|
242
|
+
const K = h.kr && h.kr(); if (!K) return; const rid = b.dataset.row || '', w = { ws: h.ws || undefined, scope: 'product', id: h.ws || undefined };
|
|
243
|
+
const again = async () => { if (h.reloadKr) await h.reloadKr(); h.redraw(); };
|
|
244
|
+
if (k === 'edit') { KRE.add(rid); h.redraw(); const i = body.querySelector(`[data-kr-row="${rid}"] [data-kr="name"]`); if (i) i.focus(); return; }
|
|
245
|
+
b.disabled = true;
|
|
246
|
+
if (k === 'save') { const el = (n) => body.querySelector(`[data-kr-row="${rid}"] [data-kr="${n}"]`), r = await post('/api/metric-drafts/edit', { ...w, row: rid, name: el('name') && el('name').value, target: el('target') && el('target').value });
|
|
247
|
+
if (!r || r.ok === false) { b.disabled = false; h.toast((r && r.error) || 'Not saved. The server did not say why.'); return; } KRE.delete(rid); await again(); return; }
|
|
248
|
+
if (k === 'drop') { const r = await post('/api/metric-drafts/drop', { ...w, row: rid }); if (!r || r.ok === false) { b.disabled = false; h.toast((r && r.error) || 'Nothing was changed. The server did not say why.'); return; } KRE.delete(rid); h.toast('Not this one. The goal stays as it is.'); await again(); return; }
|
|
249
|
+
if (k === 'keep') { let n = 0, bad = ''; for (const r of krOf(K)) { const x = await post('/api/metric-drafts/keep', { ...w, row: r.id }); if (x && x.ok !== false) n++; else bad = (x && x.error) || 'The server did not say why.'; }
|
|
250
|
+
h.toast(bad ? (n ? 'Kept ' + n + '. One was not kept: ' + bad : bad) : 'Kept. Each goal keeps its KR id.'); if (h.reload) await h.reload(); await again(); return; }
|
|
251
|
+
}
|
|
252
|
+
const need = () => needsOf(d)[+b.dataset.i || 0] || d.needs;
|
|
253
|
+
if (a === 'needs-edit') { if (h.editNeeds) h.editNeeds(need(), b); return; }
|
|
215
254
|
if (a === 'promise-edit') { if (h.editPromise) h.editPromise(d.drafts && d.drafts.promise, b); return; }
|
|
216
255
|
const row = (id) => (d.reports || []).find((r) => rid(r) === id);
|
|
217
256
|
if (a === 'report') { const r = row(k); if (r && h.openReport) h.openReport(r, d); return; }
|
|
218
257
|
b.disabled = true;
|
|
219
258
|
if (a === 'needs') {
|
|
220
|
-
const n =
|
|
259
|
+
const n = need() || {}, w = { ws: h.ws || undefined, board: h.board || undefined, initiative: n.ini || undefined };
|
|
221
260
|
if (k === 'keep') return done(await post('/api/proposals/keep', { ...w, ids: (n.keep && n.keep.ids) || [] }), 'Kept your pick.');
|
|
222
261
|
return done(await post('/api/proposals/drop', { ...w, sig: n.drop && n.drop.sig }), 'Not now. It stays in Claude proposes.');
|
|
223
262
|
}
|
|
@@ -261,7 +300,6 @@ export function dashHost(o) {
|
|
|
261
300
|
}
|
|
262
301
|
const html = (work) => (shows() ? dashHtml(x.d, { open: x.open, mdHtml: o.mdHtml ? o.mdHtml() : '' }) : work());
|
|
263
302
|
function wire(body) {
|
|
264
|
-
if (body.dataset.dbWired === o.page) return; body.dataset.dbWired = o.page;
|
|
265
303
|
// ✎ on Needs you: the work shows (this once, not kept as the PM's choice) and Claude proposes opens on the decision (pm/ini-props.js)
|
|
266
304
|
const editNeeds = o.editNeeds || (() => { x.view = 'work'; sync(); setTimeout(() => { const c = document.querySelector('#czViewer [data-cz-vw="chip"]'); if (c) c.click(); }, 0); });
|
|
267
305
|
wireDash(body, { d: () => { const c = o.VW.current && o.VW.current(); return shows() && c && c.id === o.vid ? x.d : null; }, open: x.open, get ws() { return W(); }, get board() { return B(); }, toast: o.toast, redraw: o.redraw, reload: () => read(), openReport: o.openReport, editNeeds });
|
|
@@ -60,7 +60,13 @@ export function shownUser(text) {
|
|
|
60
60
|
const r = /\[PMOS \/goal round (\d+)\]/.exec(t); if (r) return 'Keep going: round ' + r[1];
|
|
61
61
|
if (t.includes(MARK.cancel)) return 'Cancel the goal';
|
|
62
62
|
const g = t.indexOf(MARK.grill + ' The PM set a goal: ');
|
|
63
|
-
if (g >= 0)
|
|
63
|
+
if (g >= 0) {
|
|
64
|
+
// the goal ends at the line break before the rule; a live session turns line breaks into spaces (pmSays above), so it also ends where
|
|
65
|
+
// the rule begins (batch 22 item 9: the whole /goal rule filled the bubble). The files line stays, for the chips (premium-attach.js).
|
|
66
|
+
const rest = t.slice(g + (MARK.grill + ' The PM set a goal: ').length), end = rest.search(/\n|\s+Agree this goal with the PM before any work\./);
|
|
67
|
+
const head = (end >= 0 ? rest.slice(0, end) : rest).trim(), fi = head.lastIndexOf('[Attached files, read each one: ');
|
|
68
|
+
return '/goal ' + (fi > 0 ? head.slice(0, fi).trim() + '\n' + head.slice(fi) : head);
|
|
69
|
+
}
|
|
64
70
|
if (t.startsWith(OPENING) || t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]') || t.startsWith('[PMOS workflow]') || t.startsWith('[PMOS initiative]')) { const s = pmSays(t); if (s != null) return s; } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap; lib/workflow-chat.js wrap
|
|
65
71
|
return t;
|
|
66
72
|
}
|
|
@@ -140,12 +146,13 @@ export function goalCard(d, state) {
|
|
|
140
146
|
|
|
141
147
|
/** The block under Claude's words. live: this is the newest message, Claude is waiting and the goal is still being grilled, so it can be
|
|
142
148
|
* pressed. menu: the method menu is open. edit: the plan as it was when the PM pressed Change (the editor shows in place of the card). */
|
|
143
|
-
export function goalBlockHtml(block, { live = false, state = 'grilling', menu = false, edit = null } = {}) {
|
|
149
|
+
export function goalBlockHtml(block, { live = false, state = 'grilling', menu = false, edit = null, said = '' } = {}) {
|
|
144
150
|
if (!block) return '';
|
|
145
151
|
const d = block.draft && typeof block.draft === 'object' ? block.draft : {};
|
|
146
152
|
if (block.step === 'question') {
|
|
147
153
|
const opts = (Array.isArray(block.options) ? block.options : []).filter((o) => o && o.label).slice(0, 4);
|
|
148
|
-
|
|
154
|
+
// said: the answer the PM pressed, until Claude's next turn arrives: it stays pressed and the others wait (batch 22 item 10)
|
|
155
|
+
const chips = live ? `<div class="gchips"${said ? ' aria-busy="true"' : ''}>${opts.map((o) => { const on = !!said && said === o.label; return `<button type="button" class="gchip${o.recommended ? ' rec' : ''}${on ? ' on' : ''}" data-chat-say="${esc(o.label)}"${said ? ` aria-pressed="${on}" disabled` : ''}>${esc(o.label)}${o.recommended && !on ? '<small>recommended</small>' : ''}${on ? '<small>Sent</small>' : ''}</button>`; }).join('')}</div>` : '';
|
|
149
156
|
return `<div class="gq">${methodHtml(block, { live: live && state === 'grilling', open: menu })}${dotsHtml(pointsOf(block))}<p class="tt"><b>${esc(block.question || '')}</b></p>${chips}</div>`;
|
|
150
157
|
}
|
|
151
158
|
if (block.step === 'ready') {
|
|
@@ -913,7 +913,6 @@ function openProductPage() {
|
|
|
913
913
|
b.onclick = (e) => {
|
|
914
914
|
const t = e.target.closest('[data-hp]'); if (!t) return;
|
|
915
915
|
if (t.dataset.hp === 'update') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); }
|
|
916
|
-
else if (t.dataset.hp === 'metrics') { VW.drill(); openMetrics(); }
|
|
917
916
|
else if (t.dataset.hp === 'talk') talk();
|
|
918
917
|
else if (t.dataset.hp === 'ini') goIni(t.dataset.k);
|
|
919
918
|
else if (t.dataset.hp === 'prog') goProgram(t.dataset.k);
|
|
@@ -936,24 +935,35 @@ function productPageHtml(x, ws, vid, name, g) {
|
|
|
936
935
|
const P = ((S.M && S.M.groups) || []).filter((y) => y.kind === 'program' && (own || ((y.program && y.program.members) || []).some((m) => m && m.ws === ws)));
|
|
937
936
|
const progs = P.length ? `<section class="pv-card" aria-label="Programs"><div class="pv-ch"><h4>Programs</h4><small>${P.length}</small></div>${P.map((y) => row(`data-hp="prog" data-k="${esc(y.program.id)}"`, '', y.name, y.st && y.st.next ? 'Next: ' + y.st.next.name + (y.st.next.day ? ', ' + y.st.next.day : '') : y.closedLine || '')).join('')}</section>` : '';
|
|
938
937
|
const budgets = B.length ? `<section class="pv-card" aria-label="Health budgets"><div class="pv-ch"><h4>Health budgets</h4></div>${B.map((y) => PV.goalRow(y)).join('')}</section>` : '';
|
|
939
|
-
|
|
938
|
+
// the goals Claude would reword join the folded proposals row (batch 22 item 5); the owner's own page only
|
|
939
|
+
const nk = DB.krOf(x.kr).length, nn = d && (d.needsN || d.needs) ? d.needsN || 1 : 0;
|
|
940
|
+
const props = nn || nk ? { n: nn + nk, sub: nn ? d.needs.q + (nn + nk > 1 ? ' and ' + (nn + nk - 1) + ' more' : '') : nk === 1 ? 'Reword ' + (x.kr.items[0].goal || 'a goal') : nk + ' goals would read better reworded',
|
|
941
|
+
html: (d ? DB.needsHtml(d) : '') + DB.krHtml(x.kr) } : null;
|
|
940
942
|
// the initiatives and their tasks, as Home's list holds them; the launch range from the page model when it has one (Ships next)
|
|
941
|
-
const
|
|
943
|
+
const own0 = g ? (g.inis || []).concat(g.rest || []) : [];
|
|
944
|
+
// this product's initiatives that sit in a program: Home lists them once, under the program, and took them out of g; the product page still
|
|
945
|
+
// counts and lists them, one card per program (batch 22 item 1)
|
|
946
|
+
const mine = (sp) => (ws && sp.ws ? sp.ws === ws : sp.name === name);
|
|
947
|
+
const inProg = ((S.M && S.M.groups) || []).filter((y) => y.kind === 'program').map((y) => ({ y, inis: (y.subs || []).filter(mine).flatMap((sp) => sp.inis || []) })).filter((x) => x.inis.length);
|
|
948
|
+
const inis = own0.concat(...inProg.map((x) => x.inis));
|
|
942
949
|
const ships = new Map((((d && d.stage && d.stage.kind === 'ships-next') ? d.stage.items.concat((d.stage.more && d.stage.more.items) || []) : [])).map((y) => [y.id, y]));
|
|
943
950
|
const T = inis.flatMap((i) => (i.tasks || []).map((t) => ({ ...t, of: i.name })));
|
|
944
951
|
const late = T.filter((t) => t.late);
|
|
945
|
-
const
|
|
946
|
-
return row(`data-hp="ini" data-k="${esc(i.ini)}"`, `<span class="db-dot ${sh && /behind|risk/.test(sh.dot) ? 'risk' : sh && sh.dot === 'on' ? 'ok' : 'q'}" aria-hidden="true"></span>`, i.name, [when ? 'Ships ' + when : '', i.right].filter(Boolean).join(' · '), i.stage ? `<span class="pv-pill">${esc(i.stage)}</span>` : ''); }
|
|
952
|
+
const iniRow = (i) => { const sh = ships.get(i.ini); const when = sh ? (sh.lo && sh.hi && sh.lo !== sh.hi ? sh.lo + ' to ' + sh.hi : sh.when) : '';
|
|
953
|
+
return row(`data-hp="ini" data-k="${esc(i.ini)}"`, `<span class="db-dot ${sh && /behind|risk/.test(sh.dot) ? 'risk' : sh && sh.dot === 'on' ? 'ok' : 'q'}" aria-hidden="true"></span>`, i.name, [when ? 'Ships ' + when : '', i.right].filter(Boolean).join(' · '), i.stage ? `<span class="pv-pill">${esc(i.stage)}</span>` : ''); };
|
|
954
|
+
const nIni = (n) => (n === 1 ? '1 initiative' : n + ' initiatives');
|
|
955
|
+
const iniCards = (own0.length ? `<section class="pv-card" aria-label="Initiatives"><div class="pv-ch"><h4>${esc(name)}</h4><small>${nIni(own0.length)}</small></div>${own0.map(iniRow).join('')}</section>` : '')
|
|
956
|
+
+ inProg.map((x) => `<section class="pv-card" aria-label="${esc(x.y.name)}"><div class="pv-ch"><h4>${SVG(TD.P.layers, 15)}${esc(x.y.name)}</h4><small>${nIni(x.inis.length)}</small></div>${x.inis.map(iniRow).join('')}</section>`).join('');
|
|
947
957
|
const tRow = (t) => row(`data-hp="ini" data-k="${esc(t.ini)}"`, '', t.name, t.of, t.late && t.due ? `<span class="pv-late">${esc(lateDays(t.due) + ' days late')}</span>` : '');
|
|
948
958
|
const U = own ? H.weeklyUpdate(S.D, S.D.now) : null, sent = U && (U.sent || []).some((y) => y.week === U.week.iso);
|
|
949
959
|
const R = d ? DB.reportsHtml(d, { open: x.open }) : '';
|
|
950
|
-
const extra = own ?
|
|
951
|
-
: `<a class="pv-row" href="${esc(ownHome)}" target="_blank" rel="noopener"><span class="pv-rt"><b>Weekly update
|
|
960
|
+
const extra = own ? (R ? '' : row('data-hp="update"', '', 'Weekly update', sent ? 'Sent this week' : 'Ready to send'))
|
|
961
|
+
: `<a class="pv-row" href="${esc(ownHome)}" target="_blank" rel="noopener"><span class="pv-rt"><b>Weekly update</b><small>In ${esc(name)}'s own Home, in a new tab</small></span></a>`;
|
|
952
962
|
const reps = ((d && d.reports) || []).filter((r) => r.kind !== 'heads-up');
|
|
953
963
|
const tabs = [
|
|
954
964
|
{ id: 'tasks', label: 'Tasks', n: T.length, sig: late.length ? 'late' : '', html: () => (T.length ? (late.length ? `<section class="pv-card" aria-label="Late"><div class="pv-ch"><h4>Late first</h4><small>${late.length > 3 ? '3 shown · ' + (late.length - 3) + ' more below' : ''}</small></div>${late.slice(0, 3).map(tRow).join('')}</section>` : '')
|
|
955
965
|
+ `<section class="pv-card" aria-label="Open tasks"><div class="pv-ch"><h4>Open tasks</h4><small>${T.length}</small></div>${T.filter((t) => !late.slice(0, 3).includes(t)).map(tRow).join('')}</section>` : '<p class="pv-none">No open task on its initiatives.</p>') },
|
|
956
|
-
{ id: 'initiatives', label: 'Initiatives', n: inis.length, html: () => (inis.length ?
|
|
966
|
+
{ id: 'initiatives', label: 'Initiatives', n: inis.length, html: () => (inis.length ? iniCards : '<p class="pv-none">Nothing is open. A new initiative shows here.</p>') },
|
|
957
967
|
{ id: 'reports', label: 'Reports', n: reps.length, sig: reps.some((r) => r.state === 'drafted') ? 'ready' : '', html: () => `<div class="db" data-level="product">${d ? DB.trustHtml(d) : ''}${R}</div><section class="pv-card" aria-label="More reports">${extra}</section>` },
|
|
958
968
|
{ id: 'documents', label: 'Documents', html: () => '<p class="pv-none">Each initiative keeps its PRD, rubric and release notes on its own page. Open one from Initiatives.</p>' },
|
|
959
969
|
];
|
|
@@ -962,18 +972,17 @@ function productPageHtml(x, ws, vid, name, g) {
|
|
|
962
972
|
tail: isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '' });
|
|
963
973
|
}
|
|
964
974
|
function productDash(b, ws, vid, name, g) {
|
|
965
|
-
const x = PDASH.get(ws) || { d: null, open: new Set() }; PDASH.set(ws, x);
|
|
975
|
+
const x = PDASH.get(ws) || { d: null, kr: null, open: new Set() }; PDASH.set(ws, x);
|
|
966
976
|
const paint = () => {
|
|
967
977
|
const c = VW.current(); if (!b.isConnected || !c || c.id !== vid) return;
|
|
968
978
|
b.innerHTML = productPageHtml(x, ws, vid, name, g);
|
|
969
979
|
if (!(x.d && (x.d.goals || []).some((y) => !y.budget))) fillGoals(b, ws); // no goal in the page model yet: the goals line of /api/goal-status
|
|
970
980
|
};
|
|
971
981
|
PV.wirePage(b, { redraw: paint });
|
|
972
|
-
|
|
973
|
-
b.
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
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(); },
|
|
982
|
+
{
|
|
983
|
+
DB.wireDash(b, { d: () => x.d, open: x.open, ws, toast, redraw: paint, kr: () => x.kr, reloadKr: async () => { x.kr = await DB.readKr(ws); },
|
|
984
|
+
// the chart icon at the Goals block's head: Intelligence › Delivery trends, of this product
|
|
985
|
+
metrics: () => openMetrics(ws), reload: async () => { const d = await DB.readDash(ws, 'product', 'read'); if (d) x.d = d; paint(); },
|
|
977
986
|
openReport: async (row) => {
|
|
978
987
|
// Home's own weekly update (desk: true, 1-A) opens its update flow, not a document
|
|
979
988
|
if (row.desk) { if (vid === 'product') { VW.drill(); openTarget(updateTarget()); openUpdateViewer(); } else window.open('/premium.html?ws=' + encodeURIComponent(ws) + '&ini=product', '_blank', 'noopener'); return; }
|
|
@@ -981,6 +990,7 @@ function productDash(b, ws, vid, name, g) {
|
|
|
981
990
|
}
|
|
982
991
|
paint();
|
|
983
992
|
DB.readDash(ws, 'product', 'read').then((d) => { if (d) { x.d = d; paint(); } });
|
|
993
|
+
DB.readKr(ws).then((k) => { x.kr = k; if (DB.krOf(k).length) paint(); });
|
|
984
994
|
}
|
|
985
995
|
/** A phone: the page's "Message Claude about …" closes the sheet and opens the chat full screen; its ← goes back to the list (HbCPhone). */
|
|
986
996
|
function talk() { S.phoneChat = true; VW.close(); drawList(); chat.focus(); }
|
|
@@ -1068,13 +1078,13 @@ function select(id, o = {}) {
|
|
|
1068
1078
|
if (isPhone() && (r.kind === 'update' || (r.kind === 'need' && r.row) || r.kind === 'session' || r.needSession)) S.phoneChat = true;
|
|
1069
1079
|
if (r.kind === 'update') { openTarget(updateTarget()); if (!o.keepViewer) openUpdateViewer(); }
|
|
1070
1080
|
else if (r.kind === 'need' && r.row) { openTarget(needTarget(r)); if (!o.keepViewer) openNeedViewer(r); }
|
|
1071
|
-
else if (r.kind === 'session' || r.needSession) { const s = S.D.sessions.find((x) => x.id === r.sid); if (s) { openTarget(sessionTarget(s)); followViewer(s);
|
|
1081
|
+
else if (r.kind === 'session' || r.needSession) { const s = S.D.sessions.find((x) => x.id === r.sid); if (s) { openTarget(sessionTarget(s)); followViewer(s); } }
|
|
1072
1082
|
else if (r.kind === 'ptask') { S.phoneChat = isPhone(); openTarget(programTarget(r.program, r)); }
|
|
1073
1083
|
else if (r.kind === 'task') { openBoardTask(r.task); }
|
|
1074
1084
|
else if (r.kind === 'item') { import('./home-work.js').then((M) => M.openWorkItem(r.key)); }
|
|
1075
1085
|
else if (r.kind === 'finished') { openFinished(r.finished); }
|
|
1076
1086
|
else if (r.kind === 'meeting') { openMeeting(r.meeting); }
|
|
1077
|
-
else if (r.kind === 'routine') { if (isMetrics(r.schedule)) openMetrics(
|
|
1087
|
+
else if (r.kind === 'routine') { if (isMetrics(r.schedule)) openMetrics(); else openRoutine(r.schedule); }
|
|
1078
1088
|
else if (r.kind === 'file') { openFile(r.file); }
|
|
1079
1089
|
else if (r.kind === 'person') { openPerson(r.person); }
|
|
1080
1090
|
drawList();
|
|
@@ -1518,79 +1528,11 @@ async function openFile(f) {
|
|
|
1518
1528
|
const personCtx = () => { const id = S.ini; return { VW, pmPost, toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)), ws: deskWs(), ini: id, iniTitle: iniTitle(id), saved: () => load(), back: () => VW.back() }; };
|
|
1519
1529
|
function openPerson(p) { SV.openPersonVw(p, { ...personCtx(), back: null }); }
|
|
1520
1530
|
function addPerson() { SV.openPersonForm(personCtx()); }
|
|
1521
|
-
/* ── the metrics review (
|
|
1522
|
-
* (the
|
|
1523
|
-
* corrections from its run log, merges from its trunk, blocked from its workflow state); a measure that is not read says so. ── */
|
|
1524
|
-
const STRAT = { key: 'strategy', name: 'Strategist', initial: 'St' };
|
|
1525
|
-
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
1531
|
+
/* ── the metrics review is Intelligence › Delivery trends (batch 22 item 4): the month in one ✦ line, the six tiles, what moved it and the goals
|
|
1532
|
+
* that moved. Every old door (the routine, ?view=metrics, the product page's chart icon) opens that view; nothing here keeps a second page. ── */
|
|
1526
1533
|
const isMetrics = (s) => /metric/i.test(String((s && [s.task, s.skill, s.name, s.label].filter(Boolean).join(' ')) || ''));
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1529
|
-
async function metricsModel() {
|
|
1530
|
-
if (MET && MET.model && Date.now() - MET.at < 60000) return MET.model;
|
|
1531
|
-
const b = (S.D.board && S.D.board.board) || {};
|
|
1532
|
-
const r = await getRetry('/api/board-metrics-premium?weeks=8' + (b.ws ? '&ws=' + encodeURIComponent(b.ws) : wsQ('&')), 6);
|
|
1533
|
-
MET = { at: Date.now(), model: r && r.ok && r.model ? r.model : null, error: r && !r.ok ? r.error || 'the metrics were not read' : '' };
|
|
1534
|
-
return MET.model;
|
|
1535
|
-
}
|
|
1536
|
-
/** The review from the metrics model: { tiles, bars, moved, line }. Pure over the model and the product card. */
|
|
1537
|
-
function metricsView(m) {
|
|
1538
|
-
const T = (k) => ((m && m.tiles) || []).find((t) => t.key === k) || null;
|
|
1539
|
-
const two = (v) => (v == null ? null : (v / 100).toFixed(2)); // per 100 runs → per agent run, as the mockup reads it
|
|
1540
|
-
const cor = T('corrections'), mer = T('merges'), blk = T('blocked');
|
|
1541
|
-
const ser = cor && !cor.absent ? cor.ser : [];
|
|
1542
|
-
const idx = ser.map((v, i) => (v != null ? i : -1)).filter((i) => i >= 0);
|
|
1543
|
-
const cur = idx.length ? ser[idx[idx.length - 1]] : null, prev = idx.length > 1 ? ser[idx[idx.length - 2]] : null;
|
|
1544
|
-
const tile = (t, label, value, note) => (!t ? null : t.absent ? { label, value: '–', note: t.absent } : { label, value, note });
|
|
1545
|
-
const tiles = [
|
|
1546
|
-
tile(cor, 'Correction rate', two(cur), prev != null ? 'Was ' + two(prev) + ' the week before' : cor && cor.text),
|
|
1547
|
-
tile(mer, 'Merged a week', mer && mer.value, mer && (mer.change ? mer.change.txt : mer.text)),
|
|
1548
|
-
tile(blk, 'Blocked', blk && blk.value, blk && blk.text),
|
|
1549
|
-
].filter(Boolean);
|
|
1550
|
-
const last6 = ser.slice(-6), wk = (cor && cor.wk ? cor.wk : []).slice(-6);
|
|
1551
|
-
const mx = Math.max(0, ...last6.filter((v) => v != null)) || 1;
|
|
1552
|
-
const bars = last6.map((v, i) => ({ v: v == null ? '–' : two(v), h: v == null ? 0 : Math.max(4, Math.round(v / mx * 100)), w: 'W' + (i + 1), week: wk[i] || '', now: i === last6.length - 1 }));
|
|
1553
|
-
const moved = ((m && m.tiles) || []).filter((t) => !t.absent && t.change && t.change.txt !== 'No change').map((t) => [t.label + (t.text ? ' · ' + t.text : ''), t.change.txt]);
|
|
1554
|
-
for (const x of H.productCard(S.D, S.D.now).items.filter((i) => i.kind === 'risk')) moved.push([x.label, 'At risk']);
|
|
1555
|
-
const month = MONTHS[new Date(S.D.now).getMonth()];
|
|
1556
|
-
const line = cur == null ? month + ': no week has enough agent runs to count a correction rate yet.'
|
|
1557
|
-
: month + ' in one line: the correction rate ' + (prev == null ? 'is ' + two(cur) + ' per agent run' : prev === cur ? 'held at ' + two(cur) + ' per agent run' : (cur < prev ? 'fell' : 'rose') + ' from ' + two(prev) + ' to ' + two(cur) + ' per agent run' + (cur < prev ? ', the direction you want' : ', the wrong direction')) + '.'
|
|
1558
|
-
+ (moved.length ? ' ' + moved.length + (moved.length === 1 ? ' thing' : ' things') + ' moved this month.' : '');
|
|
1559
|
-
return { tiles, bars, moved, line, month, empty: !m };
|
|
1560
|
-
}
|
|
1561
|
-
function openMetricsViewer() {
|
|
1562
|
-
const draw = (b) => {
|
|
1563
|
-
const m = MET && MET.model, V = metricsView(m);
|
|
1564
|
-
if (!m) { b.innerHTML = `<div class="hv"><p class="hx-n" role="status">${MET && MET.error ? 'The metrics were not read: ' + esc(MET.error) + '.' : 'Reading the metrics.'}</p></div>`; return; }
|
|
1565
|
-
// shell A (canvas XvAMetrics): the summary card leads with the correction rate and the month in one line; the weekly bars follow;
|
|
1566
|
-
// the other tiles and what moved it are rows below. There is no primary: nothing here writes (honest state).
|
|
1567
|
-
const [first, ...rest] = V.tiles;
|
|
1568
|
-
const fell = /fell/.test(V.line), rose = /rose/.test(V.line);
|
|
1569
|
-
b.innerHTML = VW.czSummary({ line: first ? first.label + ' ' + first.value : '', tone: rose ? 'warn' : fell ? 'ok' : '', text: V.line, meta: (m && m.note) || '' })
|
|
1570
|
-
+ (V.bars.length ? `<figure class="hm-fig"><figcaption>Correction rate per agent run, by week (lower is better)</figcaption><div class="hm-chart" role="img" aria-label="${esc('Correction rate by week: ' + V.bars.map((x) => x.w + ' ' + x.v).join(', '))}">${V.bars.map((x) => `<div title="${esc(x.week ? 'Week to ' + x.week : x.w)}"><span>${esc(x.v)}</span><i class="${x.now ? 'now' : ''}" data-h="${x.h}"></i></div>`).join('')}</div><div class="hm-chx" aria-hidden="true">${V.bars.map((x) => `<span>${x.w}</span>`).join('')}</div></figure>` : '')
|
|
1571
|
-
+ VW.czSections([{ id: 'moved', title: 'What moved it', count: V.moved.length, open: true,
|
|
1572
|
-
html: `<table class="hm-moved"><thead><tr><th scope="col">What moved it</th><th scope="col">Effect</th></tr></thead><tbody>${V.moved.map(([n, e]) => `<tr><td>${esc(n)}</td><td>${esc(e)}</td></tr>`).join('') || '<tr><td colspan="2">Nothing moved since the week before.</td></tr>'}</tbody></table>` }]
|
|
1573
|
-
.concat(rest.map((t, i) => ({ id: 't' + i, title: t.label, count: t.value, html: t.note ? `<p>${esc(t.note)}</p>` : '' }))), { key: 'metrics' }); // the first tile's note (was N the week before) is already in the line: said once
|
|
1574
|
-
b.querySelectorAll('.hm-chart i[data-h]').forEach((i) => i.style.setProperty('--bd-h', i.dataset.h + 'px')); // each bar's height: run-time geometry
|
|
1575
|
-
};
|
|
1576
|
-
const body = VW.open({ id: 'metrics', kind: 'Metrics review', title: H.productName(S.D) + ' · ' + MONTHS[new Date(S.D.now).getMonth()], icon: I.chart, url: selfUrl({ ini: 'product', view: 'metrics' }), render: draw });
|
|
1577
|
-
if (!(MET && MET.model)) metricsModel().then(() => { if (VW.current() && VW.current().id === 'metrics' && body.isConnected) draw(body); });
|
|
1578
|
-
}
|
|
1579
|
-
function metricsTarget() {
|
|
1580
|
-
const V = metricsView(MET && MET.model);
|
|
1581
|
-
return { key: 'chat:metrics-review', ini: 'product', ws: WS || undefined, title: 'Metrics review', sub: 'Strategist · ' + V.month, scope: scopeOf('product'), rich: rich(), role: STRAT, to: null,
|
|
1582
|
-
intro: { role: STRAT, text: MET ? V.line : 'Reading the metrics of ' + H.productName(S.D) + '.', pills: [{ label: 'Open the review', primary: true, go: () => openMetricsViewer() }, { label: 'Discuss', go: () => chat.focus() }] },
|
|
1583
|
-
context: 'The metrics review of ' + H.productName(S.D) + ': ' + V.tiles.map((t) => t.label + ' ' + t.value + (t.note ? ' (' + t.note + ')' : '')).join('; ') + '. What moved: ' + (V.moved.map((x) => x.join(' ')).join('; ') || 'nothing') + '.',
|
|
1584
|
-
placeholder: 'Ask Strategist about the metrics', also: null };
|
|
1585
|
-
}
|
|
1586
|
-
async function openMetrics(o = {}) {
|
|
1587
|
-
const id = S.sel;
|
|
1588
|
-
openTarget(metricsTarget());
|
|
1589
|
-
if (!o.keepViewer && !isPhone()) openMetricsViewer();
|
|
1590
|
-
await metricsModel();
|
|
1591
|
-
if (S.sel !== id) return;
|
|
1592
|
-
openTarget(metricsTarget());
|
|
1593
|
-
}
|
|
1534
|
+
const trendsHref = (ws) => '/premium-intelligence.html?' + (ws ? 'ws=' + encodeURIComponent(ws) + '&' : '') + 'view=trends';
|
|
1535
|
+
function openMetrics(ws) { location.assign(trendsHref(ws || boardWs() || deskWs() || '')); }
|
|
1594
1536
|
function openRoutine(s) { SV.openRoutineVw(s, { VW, now: S.D && S.D.now }); }
|
|
1595
1537
|
|
|
1596
1538
|
/* the agent's terminal, read only, in the Viewer (term-view.js) */
|
|
@@ -2014,7 +1956,7 @@ load().then(() => {
|
|
|
2014
1956
|
// the Board's program panel Discuss in chat names board:program:<id>: the program's own conversation, the one its tasks open (bug 2026-10-24)
|
|
2015
1957
|
else if (about && /^board:program:[A-Za-z0-9][A-Za-z0-9._-]{0,100}$/.test(about)) openTarget(programTarget(about.slice(14)));
|
|
2016
1958
|
else if (about) { openTarget({ ...homeTarget(), key: about, title: (P.get('label') || '').slice(0, 80) || about }); discussed(about, P.get('vid'), P.get('label')); }
|
|
2017
|
-
else if (
|
|
1959
|
+
else if (P.get('view') === 'metrics') openMetrics(P.get('ws') || ''); // ?view=metrics: an old link lands on Intelligence › Delivery trends
|
|
2018
1960
|
else if (S.ini) goIni(S.ini);
|
|
2019
1961
|
else if (!isPhone() && !blockOpen && !say && !VW.isOpen()) { const first = H.needsOf(S.D)[0]; if (first) select(first.id); } // a card the PM opened while Home was reading stays
|
|
2020
1962
|
if (blockOpen) {
|