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.
- package/package.json +25 -25
- 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-insights-test.js +63 -58
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/ready-reports.js +145 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/metric-drafts.md +21 -1
- package/workspace/guide/ready-made-dashboards.md +62 -0
- package/workspace/guide/your-impact.md +58 -0
- package/workspace/impact-screens-test.js +149 -0
- package/workspace/intel-report-ui-test.js +1 -1
- package/workspace/intelligence-gaps-ui-test.js +13 -9
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/outbox.js +1 -1
- package/workspace/lib/engine/records/index.js +11 -3
- package/workspace/lib/goal-status.js +199 -0
- package/workspace/lib/goal-watch.js +71 -0
- package/workspace/lib/headless.js +24 -2
- package/workspace/lib/impact-cli.js +72 -0
- package/workspace/lib/impact-runs.js +114 -0
- package/workspace/lib/impact.js +195 -0
- package/workspace/lib/insights-premium.js +43 -4
- package/workspace/lib/intel-report.js +36 -5
- package/workspace/lib/metric-draft-runs.js +33 -10
- package/workspace/lib/metric-drafts.js +118 -15
- package/workspace/lib/metric-read-runs.js +132 -0
- package/workspace/lib/metric-reads.js +129 -0
- package/workspace/lib/metrics-cli.js +100 -5
- package/workspace/lib/pmos-verbs.js +4 -1
- package/workspace/lib/ready-reports.js +616 -0
- package/workspace/lib/report-dashboards.js +5 -0
- package/workspace/lib/report-setups.js +16 -7
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-premium.js +5 -0
- package/workspace/lib/routes-boards.js +1 -1
- package/workspace/lib/routes-goal-status.js +111 -0
- package/workspace/lib/routes-impact-views.js +58 -0
- package/workspace/lib/routes-impact.js +91 -0
- package/workspace/lib/routes-insights-premium.js +20 -0
- package/workspace/lib/routes-metric-drafts.js +55 -4
- package/workspace/lib/routes-ready-reports.js +455 -0
- package/workspace/lib/routes-records.js +2 -0
- package/workspace/lib/routes-report-setups.js +4 -3
- package/workspace/lib/settings-store.js +3 -0
- package/workspace/okr-goals-ui-test.js +175 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +11 -7
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +33 -8
- package/workspace/public/pm/bd-prog-panel.js +58 -10
- package/workspace/public/pm/cozy-adler.css +5 -0
- package/workspace/public/pm/cozy-adler.js +17 -9
- package/workspace/public/pm/cozy-insights.css +84 -0
- package/workspace/public/pm/cozy-settings.js +11 -1
- package/workspace/public/pm/cozy-viewer.js +2 -2
- package/workspace/public/pm/cozy-vw-rp.css +13 -0
- package/workspace/public/pm/dash-view.css +111 -0
- package/workspace/public/pm/dash-view.js +261 -0
- package/workspace/public/pm/home-app.js +87 -8
- package/workspace/public/pm/home-data.js +3 -2
- package/workspace/public/pm/home-impact.css +16 -0
- package/workspace/public/pm/home-impact.js +72 -0
- package/workspace/public/pm/home-ini.js +19 -1
- package/workspace/public/pm/home-today.js +4 -2
- package/workspace/public/pm/impact.css +37 -0
- package/workspace/public/pm/impact.js +201 -0
- package/workspace/public/pm/okr-list.js +249 -0
- package/workspace/public/pm/premium-insights.js +232 -240
- package/workspace/public/pm/premium-report-read.js +36 -5
- package/workspace/public/pm/premium-vw-mtg.js +4 -1
- package/workspace/public/pm/ready-lib.css +29 -0
- package/workspace/public/pm/ready-lib.js +62 -0
- package/workspace/public/premium-intelligence.html +3 -2
- package/workspace/public/premium.html +1 -0
- package/workspace/ready-dash-ui-test.js +227 -0
- package/workspace/server.js +58 -2
- package/workspace/skills/impact-detect.skill +46 -0
- package/workspace/skills/metric-read.skill +32 -0
- package/workspace/test-lists/batch17-ready-reports.json +9 -0
- package/workspace/test-lists/goal-watch.json +9 -0
- package/workspace/test-lists/impact-screens.json +5 -0
- package/workspace/test-lists/impact-ui.json +9 -0
- package/workspace/test-lists/impact.json +9 -0
- package/workspace/test-lists/okr-goals-ui.json +5 -0
- package/workspace/test-lists/ready-reports-ui.json +6 -0
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
* thumbnails; Undo and Redo dim when there is nothing to take back or do again. premium-vw-slides.js draws it in the card.
|
|
33
33
|
*
|
|
34
34
|
* openReport(row, hand) row = a Reports card document { cadence, slot, date, path, state, archived }; hand = { ws, name, cycles, onIssue, onChange }
|
|
35
|
-
* openReportView(ref, o) ref = a report path reports/<cadence>/<date>.md or a row; the window.czViews entry (premium-vw-open.js)
|
|
35
|
+
* openReportView(ref, o) ref = a report path reports/<cadence>/<date>.md or a row; the window.czViews entry (premium-vw-open.js).
|
|
36
|
+
* o.cuts: a ready-made report (batch 17 item 1, PbG5): Sponsors · 1 minute | Team · full over the same numbers
|
|
36
37
|
* wordsOf(md, fallback) the document as { title, sections: [{ h, lines }] } (pure)
|
|
37
38
|
* slideHtml(lines) a section's lines as html (pure) · splitRender(html) · slideCard(s, mini) · fit(root) · schedLabel(setup) (pure)
|
|
38
39
|
*
|
|
@@ -67,6 +68,7 @@ const P = {
|
|
|
67
68
|
page: '<path d="M6 3h9l4 4v14H6zM14 3v5h5"/>', print: '<path d="M7 9V4h10v5M7 17H5v-6h14v6h-2M8 14h8v6H8z"/>', hist: '<path d="M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2"/>',
|
|
68
69
|
warn: '<path d="M12 4l9 16H3zM12 10v4M12 17h.01"/>', bin: '<path d="M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13"/>', box: '<path d="M4 5h16v4H4zM5 9v10h14V9M10 13h4"/>', lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',
|
|
69
70
|
redo2: '<path d="M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7"/>', undo: '<path d="M9 14 4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3"/>', redo: '<path d="m15 14 5-5-5-5M20 9H9a5 5 0 0 0 0 10h3"/>',
|
|
71
|
+
people: '<path d="M9 11a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6 6 0 0 1 3.5 6"/>', list: '<path d="M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01"/>',
|
|
70
72
|
plus: '<path d="M12 5v14M5 12h14"/>', dl: '<path d="M12 4v11M7 10l5 5 5-5M5 20h14"/>', live: '<path d="M3 17l5-5 4 4 8-8M16 8h4v4"/>', layout: '<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 10h16M10 10v10"/>',
|
|
71
73
|
theme: '<path d="M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.6 0-1-.8-1.4-.8-2.4 0-1 .8-1.6 1.8-1.6H17a4 4 0 0 0 4-4c0-4.6-4-8.4-9-8.4z"/><circle cx="7.5" cy="11" r="1"/><circle cx="10.5" cy="7.5" r="1"/><circle cx="15" cy="7.5" r="1"/>',
|
|
72
74
|
};
|
|
@@ -345,9 +347,37 @@ function sumHtml() {
|
|
|
345
347
|
primary: { act: S.primary.r, label: S.primary.label, icon: PRI_ICON[S.primary.r] || 'back', disabled: R.busy } });
|
|
346
348
|
}
|
|
347
349
|
/** The bar (OvReport): Slides | Document | Live page, then Edit (a draft), Present, Share (when it is not the primary) and Download. */
|
|
350
|
+
/* ── the two cuts of one ready-made report (batch 17 item 1, canvas PbG5): Sponsors (1 minute) and Team (full), the same numbers. The team cut
|
|
351
|
+
* is the document as drafted; the sponsors cut is read from it (GET /api/ready-reports/cut). Under the switch, each section of the team cut,
|
|
352
|
+
* ticked when the sponsors read it too, else "Team only". The team cut is the one that is edited. */
|
|
353
|
+
function cutsHtml() {
|
|
354
|
+
const C = R.cuts; if (!C || R.edit) return '';
|
|
355
|
+
const b = (k, icon, l) => `<button type="button" data-r="cut|${k}" aria-pressed="${C.on === k}">${icon}<span>${l}</span></button>`;
|
|
356
|
+
const seg = `<div class="rp-seg vz-cuts" role="group" aria-label="Who reads it">${b('sponsors', ic('people', 15), 'Sponsors · 1 minute')}${b('team', ic('list', 15), 'Team · full')}</div>`;
|
|
357
|
+
let list = '';
|
|
358
|
+
if (C.on === 'sponsors' && C.teamW && R.W) {
|
|
359
|
+
const has = new Set(R.W.sections.map((x) => String(x.h).toLowerCase()));
|
|
360
|
+
// the lead before the first heading (wordsOf's "Summary") is the answer and its 3 points, as the design names it
|
|
361
|
+
list = `<p class="vz-lab">Sponsors read</p><ul class="vz-cutl">${C.teamW.sections.filter((x) => x.h).map((x) => { const on = has.has(String(x.h).toLowerCase()); return `<li class="${on ? 'on' : ''}"><span class="vz-cb" aria-hidden="true">${on ? ic('check', 12) : ''}</span><span><b>${esc(x.h === 'Summary' ? 'The answer and 3 points' : x.h)}</b>${on ? '' : '<small>Team only</small>'}</span></li>`; }).join('')}</ul><p class="vz-note">Same numbers in both.</p>`;
|
|
362
|
+
}
|
|
363
|
+
return `<div class="vz-cut">${seg}${C.err ? `<p class="vz-msg" role="status">${esc(C.err)}</p>` : ''}${list}</div>`;
|
|
364
|
+
}
|
|
365
|
+
async function cutTo(k) {
|
|
366
|
+
const C = R.cuts, me = R; if (!C || C.on === k) return;
|
|
367
|
+
if (k === 'team') { C.on = 'team'; if (C.team != null) { R.text = C.team; R.W = wordsOf(R.text, R.name); } return draw(); }
|
|
368
|
+
if (C.sponsors == null) {
|
|
369
|
+
const j = await Promise.resolve(pmGet('/api/ready-reports/cut?' + q({ ws: R.ws, path: R.row.path, cut: 'sponsors' }))).catch(() => null);
|
|
370
|
+
if (R !== me) return;
|
|
371
|
+
if (!j || !j.ok || typeof j.markdown !== 'string') { C.err = (j && j.error) || 'The sponsors cut could not be read. The team cut is shown.'; return draw(); }
|
|
372
|
+
C.sponsors = j.markdown;
|
|
373
|
+
}
|
|
374
|
+
C.err = ''; C.team = C.team == null ? R.text : C.team; C.teamW = wordsOf(C.team, R.name); C.on = 'sponsors';
|
|
375
|
+
R.text = C.sponsors; R.W = wordsOf(R.text, R.name); R.i = 0;
|
|
376
|
+
draw();
|
|
377
|
+
}
|
|
348
378
|
function barHtml() {
|
|
349
379
|
return rpBarHtml({ view: R.view, views: [['deck', 'Slides'], ['doc', 'Document'], ['live', 'Live page']], tools: [
|
|
350
|
-
R.issued ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
|
|
380
|
+
R.issued || (R.cuts && R.cuts.on === 'sponsors') ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
|
|
351
381
|
R.issued && !R.archived ? null : { act: 'share', label: 'Share', icon: 'share', exp: R.pop === 'share', pop: 'dialog' },
|
|
352
382
|
{ act: 'dlm', label: 'Download', icon: 'dl', exp: R.pop === 'dl' }] });
|
|
353
383
|
}
|
|
@@ -397,7 +427,7 @@ function bodyHtml() {
|
|
|
397
427
|
}
|
|
398
428
|
const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
|
|
399
429
|
: R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml();
|
|
400
|
-
return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
|
|
430
|
+
return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
|
|
401
431
|
}
|
|
402
432
|
const tipText = (i, n) => `Slide ${i + 1} of ${n}. Click an item to change it; double-click text to type.`;
|
|
403
433
|
/** The editor's slide and its undo history changed: the tip and the dimmed Undo and Redo follow it. */
|
|
@@ -472,6 +502,7 @@ export function fit(root) { root.querySelectorAll('.vz-fr').forEach((c) => { if
|
|
|
472
502
|
const say = (text, tone) => { R.msg = { text, tone }; draw(); };
|
|
473
503
|
async function act([k, v], t) {
|
|
474
504
|
if (k === 'pop') { R.pop = v || null; return draw(); }
|
|
505
|
+
if (k === 'cut') return cutTo(v);
|
|
475
506
|
if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
476
507
|
if (k === 'lv') return liveAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
477
508
|
if (k === 'dlm') { R.pop = R.pop === 'dl' ? null : 'dl'; return draw(); }
|
|
@@ -859,7 +890,7 @@ export async function openReport(row, hand = {}) {
|
|
|
859
890
|
if (R) present(false);
|
|
860
891
|
const me = R = { row, ws: hand.ws || '', id: c.cadence, name: hand.name || row.name || c.cadence || 'Report', audience: hand.audience || '', issued: row.state === 'issued', archived: !!row.archived,
|
|
861
892
|
text: '', err: '', W: null, view: 'deck', BF: null, bfRaw: null, bfMsg: '', LV: null, blank: false, i: 0, cyc: null, setup: undefined, pop: null, conf: false, checks: null, issueErr: '', busy: false, ask: '', askErr: '', edit: false, msg: null,
|
|
862
|
-
sch: schedPick(null), schErr: '', shr: null, shares: null, more: [], hand, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
|
|
893
|
+
sch: schedPick(null), schErr: '', shr: null, shares: null, more: [], hand, cuts: hand.cuts ? { on: 'team', team: null, sponsors: null, err: '' } : null, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
|
|
863
894
|
const head = me.head = () => ({ id: me.vid, kind: 'Report' + (me.audience ? ' · ' + me.audience : ''), title: me.name, icon: me.view === 'doc' ? 'doc' : 'report', full: true, url: viewUrl(row, me.ws), more: me.more,
|
|
864
895
|
render: (b) => { syncMore(); b.innerHTML = panelHtml(); wire(b); }, onClose: () => { if (R === me && !me.reopen) { present(false); R = null; } } });
|
|
865
896
|
vOpen(head());
|
|
@@ -886,7 +917,7 @@ async function watchFile(me) {
|
|
|
886
917
|
while (R === me) {
|
|
887
918
|
await new Promise((ok) => setTimeout(ok, CHECK_MS));
|
|
888
919
|
if (R !== me) return;
|
|
889
|
-
if (document.hidden || me.edit || me.busy || me.pop) continue;
|
|
920
|
+
if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors')) continue; // the sponsors cut is read from the file, not the file
|
|
890
921
|
const h = await stamp();
|
|
891
922
|
if (R !== me || !h) continue;
|
|
892
923
|
if (seen && h !== seen) { await reread(); if (R === me && !me.edit && !me.pop) draw(); }
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
* mdOf(model) → the note as Markdown, for Copy as Markdown (pure)
|
|
34
34
|
* aboutOptions(row | null, W | null, choices | null, notesText) → the What it is about choices (pure)
|
|
35
35
|
* openMeeting(ref, { ws }) → opens the card. ref: a note id, { note }, { event, date }, a calendar week row or a brief-page today row. */
|
|
36
|
+
import * as IM from './impact.js'; // Your impact's meeting moment (batch 16 item 7)
|
|
36
37
|
import { open as vOpen, current as vCur, back as vBack, czSummary, czSections } from './cozy-viewer.js';
|
|
37
38
|
import { pmGet, pmPost, pressFetch } from './http.js';
|
|
38
39
|
import { ownTab, bring, tabUrl } from './rec-tab-core.js';
|
|
@@ -395,7 +396,8 @@ function stepHtml(a, ui) {
|
|
|
395
396
|
return `<div class="vzm-step"><span class="vzm-grow">${esc(a.text)}</span><span class="vzm-mut vzm-sm">${esc(a.meta.replace('No owner · No date', 'No owner, no date'))}</span>${act}</div>`
|
|
396
397
|
+ (made ? `<div class="vzm-made" role="status">${svg('check', 14)}<span>${made.html}</span>${made.undo ? `<button type="button" class="vzm-btn vzm-ghost" data-a="madeundo" data-i="${a.i}">Undo</button>` : ''}</div>` : '');
|
|
397
398
|
}
|
|
398
|
-
const decisionsHtml = (N) => N.decisions.map((d) => `<div class="vzm-trow vzm-top"><span class="vzm-grow">${esc(d.text)}</span>${d.why ? `<span class="vzm-mut vzm-sm vzm-why">${esc(d.why)}</span>` : ''}</div>`).join('')
|
|
399
|
+
const decisionsHtml = (N) => N.decisions.map((d) => `<div class="vzm-trow vzm-top"><span class="vzm-grow">${esc(d.text)}</span>${d.why ? `<span class="vzm-mut vzm-sm vzm-why">${esc(d.why)}</span>` : ''}</div>`).join('')
|
|
400
|
+
+ IM.meetingLine(); // Your impact (batch 16 item 7, GmA4Moments): one quiet line under the decisions, only while it is on
|
|
399
401
|
/** Replay (XvAReplay): the player and "In this part" in one card; phone: the phone's Replay. The editor shows where the PM pressed. */
|
|
400
402
|
function replayCardHtml(V, ui) {
|
|
401
403
|
const part = { ...ui, edit: ui.editIn === 'part' ? ui.edit : null };
|
|
@@ -530,6 +532,7 @@ export function refOf(ref) {
|
|
|
530
532
|
|
|
531
533
|
export async function openMeeting(ref, o = {}) {
|
|
532
534
|
mtgStyle();
|
|
535
|
+
if (!IM.cached()) IM.readWeek().catch(() => {}); // the meeting moment's switch, read once a page
|
|
533
536
|
const R = refOf(ref);
|
|
534
537
|
const me = { R, ws: o.ws || new URLSearchParams(location.search).get('ws') || '', ui: { sel: new Set(), made: {} }, D: null, n: null, row: null, alive: true, timers: [], play: null };
|
|
535
538
|
if (MT) { MT.alive = false; MT.timers.forEach(clearInterval); stopPlay(MT); }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* pm/ready-lib.css — the ready-made reports in Reports and dashboards (pm/ready-lib.js; canvas PbA6Library, PbG4Overlap). Token vars only, over
|
|
2
|
+
* pm/cozy.css; every class starts with rl-. */
|
|
3
|
+
.rl { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
|
|
4
|
+
.rl-lead { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--cz-bluebg); border: 1px solid color-mix(in srgb, var(--cz-blueink) 18%, transparent); }
|
|
5
|
+
.rl-lead p { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-4); line-height: 1.45; color: var(--cz-ink2); }
|
|
6
|
+
.rl-lead b { color: var(--cz-ink); font-weight: 800; }
|
|
7
|
+
.rl-sp { flex: none; color: var(--cz-blueink); margin-top: 3px; display: inline-flex; }
|
|
8
|
+
.rl-ok { all: unset; box-sizing: border-box; cursor: pointer; flex: none; width: 44px; height: 44px; border-radius: 999px; background: var(--cz-blue); color: var(--cz-onsolid); display: inline-flex; align-items: center; justify-content: center; }
|
|
9
|
+
.rl-ok[disabled] { opacity: .45; cursor: default; }
|
|
10
|
+
.rl-h { margin: 6px 0 0; font-size: var(--fs-4); font-weight: 800; color: var(--cz-ink); }
|
|
11
|
+
.rl-h span { font-weight: 700; color: var(--cz-ink3); }
|
|
12
|
+
.rl-card { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 2px 14px; display: flex; flex-direction: column; }
|
|
13
|
+
.rl-row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 10px 0; width: 100%; }
|
|
14
|
+
.rl-card > * + * { border-top: 1px solid var(--cz-hair); }
|
|
15
|
+
.rl-fold { cursor: pointer; }
|
|
16
|
+
.rl-fold > svg { flex: none; color: var(--cz-ink3); }
|
|
17
|
+
.rl-fold[aria-expanded="true"] > svg { transform: rotate(180deg); }
|
|
18
|
+
.rl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
19
|
+
.rl-t b { font-size: var(--fs-4); font-weight: 800; }
|
|
20
|
+
.rl-t small { font-size: var(--fs-2); line-height: 1.4; color: var(--cz-ink3); }
|
|
21
|
+
.rl-pk { color: var(--cz-blueink); }
|
|
22
|
+
.rl-av { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--cz-bluebg); color: var(--cz-blueink); display: inline-flex; align-items: center; justify-content: center; }
|
|
23
|
+
.rl-sw { all: unset; box-sizing: border-box; cursor: pointer; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--cz-well2, var(--cz-hair)); position: relative; }
|
|
24
|
+
.rl-sw i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--cz-card); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s ease; }
|
|
25
|
+
.rl-sw.on { background: var(--cz-blue); }
|
|
26
|
+
.rl-sw.on i { left: 21px; }
|
|
27
|
+
.rl-sw[disabled] { opacity: .45; cursor: default; }
|
|
28
|
+
.rl-sw:focus-visible, .rl-ok:focus-visible, .rl-fold:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
29
|
+
@media (prefers-reduced-motion: reduce) { .rl-sw i { transition: none; } }
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* pm/ready-lib.js — the ready-made reports in Reports and dashboards (batch 17 item 1, design A+; canvas In development: PbA6Library, PbG4Overlap,
|
|
2
|
+
* PbG6Trust). Intelligence's ⋯ › Reports and dashboards side panel puts it at the top, before the reports the PM made ("Yours").
|
|
3
|
+
*
|
|
4
|
+
* readLib(ws) GET /api/ready-reports/library?ws → { lead, groups, yours, overlap } | null (null: the route is missing or refused, so
|
|
5
|
+
* the panel shows only what it showed before)
|
|
6
|
+
* libHtml(L, o) the ✦ card (Claude's picks: "To keep your week light I'd schedule only 3"), then one Ready-made group per scope (a
|
|
7
|
+
* program, a product, the initiatives), each report a switch; Claude's picks carry ✦. The weekly updates that are off
|
|
8
|
+
* fold into "N more". The overlap card (PbG4: one person gets at most one update a week) and its "Who gets what" list.
|
|
9
|
+
* o: { open: Set of folded groups shown }
|
|
10
|
+
* wireLib(el, h) the presses: a switch (POST /api/ready-reports/switch), ✓ on the picks card (/picks), ✓ on the overlap card (/overlap),
|
|
11
|
+
* the folds. h: { ws, toast(text), reload(), redraw(), open: Set }
|
|
12
|
+
* Nothing here sends anything: a switch only says whether Claude drafts that report at its moment. */
|
|
13
|
+
import { pmPost } from './http.js';
|
|
14
|
+
|
|
15
|
+
const CSS = new URL('./ready-lib.css', import.meta.url).href;
|
|
16
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
17
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
18
|
+
}
|
|
19
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
|
+
const SV = (d, w = 18, 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>`;
|
|
21
|
+
const I = { spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', chk: 'M5 12l5 5 9-10', down: 'M7 10l5 5 5-5', merge: 'M6 4v6a4 4 0 0 0 4 4h8M14 10l4 4-4 4',
|
|
22
|
+
people: 'M9 11a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6 6 0 0 1 3.5 6' };
|
|
23
|
+
const LEVEL = { program: 'program', product: 'product', initiative: 'initiatives' };
|
|
24
|
+
|
|
25
|
+
export async function readLib(ws) {
|
|
26
|
+
try { const r = await fetch('/api/ready-reports/library?' + new URLSearchParams(ws ? { ws } : {}).toString(), { credentials: 'same-origin' }); if (r.status !== 200) return null; const j = await r.json(); return j && j.ok !== false && Array.isArray(j.groups) ? j : null; } catch { return null; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const sw = (scope, r) => `<button type="button" class="rl-sw${r.on ? ' on' : ''}" role="switch" aria-checked="${!!r.on}" aria-label="${esc((r.on ? 'Stop drafting ' : 'Draft ') + r.name)}" data-rl="switch" data-scope="${esc(scope)}" data-kind="${esc(r.kind)}"><i></i></button>`;
|
|
30
|
+
const row = (scope, r) => `<div class="rl-row"><span class="rl-t"><b>${r.pick ? '<span class="rl-pk" aria-label="Claude\'s pick">✦</span> ' : ''}${esc(r.name)}</b>${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>${sw(scope, r)}</div>`;
|
|
31
|
+
|
|
32
|
+
/** The library's ready-made part, as html. Zero is silence: no group draws nothing. */
|
|
33
|
+
export function libHtml(L, o = {}) {
|
|
34
|
+
if (!L || !(L.groups || []).length) return '';
|
|
35
|
+
const open = o.open || new Set();
|
|
36
|
+
const lead = L.lead && L.lead.text ? `<div class="rl-lead"><span class="rl-sp">${SV(I.spark, 16)}</span><p><b>${esc(L.lead.text)}</b>${L.lead.rest ? ' ' + esc(L.lead.rest) : ''}</p>`
|
|
37
|
+
+ `<button type="button" class="rl-ok" data-rl="picks" aria-label="Keep Claude's picks" title="Keep Claude's picks">${SV(I.chk, 18, 2.4)}</button></div>` : '';
|
|
38
|
+
const ov = L.overlap && L.overlap.lead ? `<div class="rl-lead"><span class="rl-sp">${SV(I.spark, 16)}</span><p><b>${esc(L.overlap.lead)}</b>${L.overlap.rest ? ' ' + esc(L.overlap.rest) : ''}</p>`
|
|
39
|
+
+ `<button type="button" class="rl-ok" data-rl="overlap" aria-label="Send one update that carries the others" title="Send one update that carries the others">${SV(I.merge, 18, 2.2)}</button></div>`
|
|
40
|
+
+ ((L.overlap.people || []).length ? `<h4 class="rl-h">${esc(L.overlap.title || 'Who gets what')}</h4><div class="rl-card">${L.overlap.people.map((p) => `<div class="rl-row"><span class="rl-av">${SV(I.people, 16)}</span><span class="rl-t"><b>${esc(p.who)}</b>${p.sub ? `<small>${esc(p.sub)}</small>` : ''}</span></div>`).join('')}</div>` : '') : '';
|
|
41
|
+
const groups = L.groups.map((g) => {
|
|
42
|
+
const k = g.scope || g.name, more = g.more && g.more.count ? (() => { const on = open.has(k); return `<button type="button" class="rl-row rl-fold" data-rl="fold" data-k="${esc(k)}" aria-expanded="${on}"><span class="rl-t"><b>${esc(g.more.text || g.more.count + ' more weekly updates')}</b>${g.more.sub ? `<small>${esc(g.more.sub)}</small>` : ''}</span>${SV(I.down, 16)}</button>${on ? (g.more.rows || []).map((r) => row(g.scope, r)).join('') : ''}`; })() : '';
|
|
43
|
+
// the folded rows sit after the first row, as the design draws them (one ✦ pick, then "4 more weekly updates", then the other kinds)
|
|
44
|
+
const R = g.rows || [];
|
|
45
|
+
return `<h4 class="rl-h">${esc(g.name)}${g.level ? ` <span>· ${esc(LEVEL[g.level] || g.level)}</span>` : ''}</h4><div class="rl-card">${R.slice(0, 1).map((r) => row(g.scope, r)).join('')}${more}${R.slice(1).map((r) => row(g.scope, r)).join('')}</div>`;
|
|
46
|
+
}).join('');
|
|
47
|
+
return `<div class="rl">${lead}${ov}${groups}${(L.yours || []).length || o.yours ? '<h4 class="rl-h">Yours</h4>' : ''}</div>`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function wireLib(el, h) {
|
|
51
|
+
el.addEventListener('click', async (e) => {
|
|
52
|
+
const b = e.target.closest('[data-rl]'); if (!b || b.disabled || !el.contains(b)) return;
|
|
53
|
+
const a = b.dataset.rl;
|
|
54
|
+
if (a === 'fold') { const k = b.dataset.k; if (h.open.has(k)) h.open.delete(k); else h.open.add(k); h.redraw(); return; }
|
|
55
|
+
b.disabled = true;
|
|
56
|
+
const done = async (r, ok) => { if (!r || r.ok === false) { b.disabled = false; h.toast((r && r.error) || 'Nothing was changed. The server did not say why.'); return; } h.toast(ok); await h.reload(); };
|
|
57
|
+
if (a === 'switch') { const on = b.getAttribute('aria-checked') !== 'true'; return done(await Promise.resolve(pmPost('/api/ready-reports/switch', { ws: h.ws || undefined, scope: b.dataset.scope, kind: b.dataset.kind, on })).catch(() => null), on ? 'On. Claude drafts it at its moment; nothing goes out until you approve it.' : 'Off. Claude no longer drafts it.'); }
|
|
58
|
+
if (a === 'picks') return done(await Promise.resolve(pmPost('/api/ready-reports/picks', { ws: h.ws || undefined })).catch(() => null), 'Kept. Only Claude\'s picks are scheduled; the rest draft at their moment.');
|
|
59
|
+
if (a === 'overlap') return done(await Promise.resolve(pmPost('/api/ready-reports/overlap', { ws: h.ws || undefined })).catch(() => null), 'One update each. The wider one carries the others as sections.');
|
|
60
|
+
b.disabled = false;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
<span class="ins-mw ins-dk"><button type="button" class="cz-ib" id="filtB" aria-haspopup="dialog" aria-expanded="false" aria-controls="filtMenu" aria-label="Filter by status, owner or kind" title="Filter by status, owner or kind"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16l-6 8v6l-4-2v-4z"/></svg><i class="ins-fdot" id="filtDot" hidden></i></button><div class="ins-menu ins-right ins-filtp" id="filtMenu" role="dialog" aria-label="Filter" hidden></div></span>
|
|
39
39
|
<span class="ins-mw"><button type="button" class="cz-ib" id="repB" aria-haspopup="menu" aria-expanded="false" aria-controls="repMenu" aria-label="Make a report from this" title="Make a report from this"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h9l4 4v14H6zM14 3v5h5M9 18v-3M12 18v-6M15 18v-4"/></svg></button><div class="ins-menu ins-right ins-rpmenu" id="repMenu" role="menu" aria-label="Make a report from" hidden></div></span>
|
|
40
40
|
<span class="ins-mw"><button type="button" class="cz-ib solid" id="newB" aria-label="New metric or key result" title="New metric or key result"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
|
|
41
|
-
<span class="ins-mw"><button type="button" class="cz-ib" id="moreB" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More: reports and dashboards, delivery trends, sources, export" title="More: reports and dashboards, delivery trends, sources, export"><svg viewBox="0 0 24 24" aria-hidden="true" stroke-width="3"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button><div class="ins-menu ins-right" id="moreMenu" role="menu" aria-label="More" hidden>
|
|
41
|
+
<span class="ins-mw"><button type="button" class="cz-ib" id="moreB" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More: reports and dashboards, metrics, delivery trends, sources, export" title="More: reports and dashboards, metrics, delivery trends, sources, export"><svg viewBox="0 0 24 24" aria-hidden="true" stroke-width="3"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button><div class="ins-menu ins-right" id="moreMenu" role="menu" aria-label="More" hidden>
|
|
42
42
|
<button type="button" role="menuitem" data-more="library"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h9l4 4v14H6zM14 3v5h5M9 13h6M9 17h4"/></svg><span>Reports and dashboards<small id="libSub"></small></span><span class="k" id="libNew"></span></button>
|
|
43
|
+
<button type="button" role="menuitem" data-more="metrics"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h11a3 3 0 0 1 3 3v13H8a3 3 0 0 1-3-3zM5 17a3 3 0 0 1 3-3h11"/></svg><span>Metrics<small>the list, or the tree under the North Star</small></span><span class="k" id="metN"></span></button>
|
|
43
44
|
<button type="button" role="menuitem" data-more="trends"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg><span>Delivery trends<small>blocked, late, idle, scope, merged</small></span></button>
|
|
44
|
-
<button type="button" role="menuitem" data-more="sources"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4c4.4 0 8 1.3 8 3s-3.6 3-8 3-8-1.3-8-3 3.6-3 8-3zM4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7"/></svg>Sources<span class="k" id="srcAge"></span></button>
|
|
45
|
+
<button type="button" role="menuitem" data-more="sources"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4c4.4 0 8 1.3 8 3s-3.6 3-8 3-8-1.3-8-3 3.6-3 8-3zM4 7v10c0 1.7 3.6 3 8 3s8-1.3 8-3V7"/></svg><span>Sources<small>opens Settings › Connectors</small></span><span class="k" id="srcAge"></span></button>
|
|
45
46
|
<button type="button" role="menuitem" data-more="export"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11M7 10l5 5 5-5M5 20h14"/></svg>Export<span class="k">CSV</span></button>
|
|
46
47
|
<button type="button" role="menuitem" data-more="about"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 8h.01M11 12h1v5h1M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18"/></svg>About these numbers</button>
|
|
47
48
|
</div></span>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<link rel="stylesheet" href="/pm/cozy-pick.css" />
|
|
22
22
|
<link rel="stylesheet" href="/pm/cozy-home.css" />
|
|
23
23
|
<link rel="stylesheet" href="/pm/cozy-today.css" />
|
|
24
|
+
<link rel="stylesheet" href="/pm/home-impact.css" />
|
|
24
25
|
<link rel="stylesheet" href="/pm/cozy-panel.css" />
|
|
25
26
|
</head>
|
|
26
27
|
<body class="cz cz-home">
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* ready-dash-ui-test.js — the ready-made Dashboard in the program panel and the initiative view, and a ready-made report's two cuts in the one
|
|
4
|
+
* report Viewer (batch 17 item 1; canvas PbH1Header, PbA1, PbA2, PbA7, PbG2, PbG5). Serves the real Board page from the real server; Project
|
|
5
|
+
* Ascent comes from fixtures/program-ascent.js, and the /api/ready-reports routes answer fixtures/ready-reports.js, the shape the backend agreed.
|
|
6
|
+
* H the header: one toggle icon where the charter icon was (a gauge, "Show the dashboard", aria-pressed false); none before the dashboard reads
|
|
7
|
+
* D the Dashboard: ✦ line with Adler's face, Goals, Milestones, Needs you, Reports in order; the toggle shows a list, pressed; the pencil on
|
|
8
|
+
* Milestones opens the charter · W wide (1440): two columns (PbA7) · N ✓ on Needs you keeps the pick (POST /api/proposals/keep)
|
|
9
|
+
* R a report row opens the one report Viewer: Sponsors · 1 minute | Team · full; Sponsors reads the cut and lists the Team-only sections
|
|
10
|
+
* L the last choice per page: after a reload the Dashboard opens first
|
|
11
|
+
* I the initiative view on the Board has the same toggle; a held report (PbG2): Wait posts the hold
|
|
12
|
+
* M on a phone (390): the title keeps 150 px, the Dashboard fits the width, no page error · S the type scale only
|
|
13
|
+
* P the product page on Home (390 and 1440) is the product's Dashboard, with no toggle (PbA3, PbG8).
|
|
14
|
+
* PMOS_SHOTS=<dir> also saves the screenshots. */
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const { spawn } = require('child_process');
|
|
18
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
19
|
+
const T = require('./test-run').configure({ name: 'ready-dash-ui' });
|
|
20
|
+
const BP = require('./lib/board-premium.js');
|
|
21
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
22
|
+
const A = require('./fixtures/program-ascent.js');
|
|
23
|
+
const RR = require('./fixtures/ready-reports.js');
|
|
24
|
+
|
|
25
|
+
const BASE = T.BASE;
|
|
26
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
27
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
28
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
29
|
+
const results = [];
|
|
30
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 700) : ''}`); };
|
|
31
|
+
let srv = null; let browser = null;
|
|
32
|
+
const finish = async (code) => {
|
|
33
|
+
if (browser) await browser.close().catch(() => {});
|
|
34
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
35
|
+
T.killTmux();
|
|
36
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
37
|
+
console.log(`\n${results.length - bad}/${results.length} ready-dash-ui assertions passed`);
|
|
38
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
39
|
+
};
|
|
40
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
41
|
+
|
|
42
|
+
const TEAM = '# Inline login slips to early December unless passkeys move to v1.1\n\n1. Sign-in at checkout is +1.2 of +5 points.\n2. Build is 14 of 23 tickets.\n3. Cutting passkeys keeps 18 Nov.\n\n## Your decision\n\nShip 18 Nov without passkeys.\n\n## Scorecard\n\n| Goal | Now |\n|---|---|\n| Checkout | +1.2 |\n\n## Tickets and risks\n\n14 of 23 done.\n\n## Next week\'s plan\n\nCut passkeys.\n';
|
|
43
|
+
const SPONSORS = '# Inline login slips to early December unless passkeys move to v1.1\n\n1. Sign-in at checkout is +1.2 of +5 points.\n2. Build is 14 of 23 tickets.\n3. Cutting passkeys keeps 18 Nov.\n\n## Your decision\n\nShip 18 Nov without passkeys.\n\n## Scorecard\n\n| Goal | Now |\n|---|---|\n| Checkout | +1.2 |\n';
|
|
44
|
+
|
|
45
|
+
(async () => {
|
|
46
|
+
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
47
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
48
|
+
let chromium;
|
|
49
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
50
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
51
|
+
await T.waitForServer(BASE);
|
|
52
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
53
|
+
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
54
|
+
const shot = async (p, name) => { if (SHOTS) { await sleep(450); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
|
|
55
|
+
|
|
56
|
+
const open = async ({ w = 1440, h = 900, dark = false, ctx = null, dash = {} } = {}) => {
|
|
57
|
+
const c = ctx || await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
|
|
58
|
+
const page = await c.newPage();
|
|
59
|
+
const errors = [], posts = [], gets = [];
|
|
60
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
61
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) }), wsOf = (r) => new URL(r.request().url()).searchParams.get('ws') || 'idpf';
|
|
62
|
+
await page.route('**/api/board-premium*', (r) => json(r, { ok: true, state: 'ready', model: BP.build(F.programFacts(wsOf(r))), as_of: Date.now() }));
|
|
63
|
+
await page.route('**/api/programs', (r) => json(r, { ok: true, programs: F.programs() }));
|
|
64
|
+
await page.route('**/api/boards/anchors*', (r) => json(r, { ok: true, anchors: A.ANCHORS[wsOf(r)] || [] }));
|
|
65
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, model: { goals: A.GOALS[wsOf(r)] || [] } }));
|
|
66
|
+
await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: A.ITEMS[wsOf(r)] || [] }));
|
|
67
|
+
await page.route('**/api/programs/*', (r) => json(r, { ok: true }));
|
|
68
|
+
await page.route('**/api/board-trail*', (r) => json(r, { ok: false, error: 'not in this check' }, 500));
|
|
69
|
+
await page.route('**/api/metric-drafts**', (r) => json(r, { ok: true, rows: [], run: { state: 'idle', step: 0, reads: [] } }));
|
|
70
|
+
// the ready-made dashboards, per scope (the backend's GET /api/ready-reports/dashboard), and its writes
|
|
71
|
+
const D = { 'program:project-ascent': RR.program(), 'initiative:descope-parity': RR.initiative(), ...dash };
|
|
72
|
+
await page.route('**/api/ready-reports/**', (r) => {
|
|
73
|
+
const rq = r.request(), u = new URL(rq.url());
|
|
74
|
+
if (rq.method() === 'GET' && u.pathname === '/api/ready-reports/dashboard') { const s = u.searchParams.get('scope'); gets.push({ scope: s, from: u.searchParams.get('from'), ws: u.searchParams.get('ws') }); return D[s] ? json(r, D[s]) : json(r, { ok: false, error: 'no such scope' }, 404); }
|
|
75
|
+
if (rq.method() === 'GET' && u.pathname === '/api/ready-reports/cut') { gets.push({ cut: u.searchParams.get('cut'), path: u.searchParams.get('path') }); return json(r, { ok: true, cut: 'sponsors', markdown: SPONSORS }); }
|
|
76
|
+
posts.push({ path: u.pathname, body: JSON.parse(rq.postData() || '{}') });
|
|
77
|
+
return json(r, { ok: true });
|
|
78
|
+
});
|
|
79
|
+
await page.route('**/api/proposals/**', (r) => { posts.push({ path: new URL(r.request().url()).pathname, body: JSON.parse(r.request().postData() || '{}') }); return json(r, { ok: true }); });
|
|
80
|
+
// the one report Viewer's reads: the document, its cycles; the rest answer nothing to show
|
|
81
|
+
await page.route('**/api/doc?*', (r) => r.fulfill({ contentType: 'text/markdown', body: TEAM }));
|
|
82
|
+
await page.route('**/api/report-documents*', (r) => json(r, { ok: true, docs: [{ path: 'reports/one-login-sponsor/2026-10-29.md', slot: '2026-10-29', state: 'draft' }] }));
|
|
83
|
+
await page.route('**/api/doc-sheet/stamp*', (r) => json(r, { ok: true, hash: 'h1' }));
|
|
84
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&program=project-ascent');
|
|
85
|
+
await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('.pp-vw'); }), 15000);
|
|
86
|
+
return { page, ctx: c, errors, posts, gets, D };
|
|
87
|
+
};
|
|
88
|
+
const head = (p) => p.evaluate(() => {
|
|
89
|
+
const h = document.querySelector('#czViewer .cz-vw-head') || document.querySelector('#czViewer'); const t = document.querySelector('#czViewer [data-cz-vw-p="dash"]');
|
|
90
|
+
return { toggle: t ? { label: t.getAttribute('aria-label'), title: t.getAttribute('title'), pressed: t.getAttribute('aria-pressed'), text: t.textContent.trim() } : null,
|
|
91
|
+
charter: !!document.querySelector('#czViewer [data-cz-vw-p="charter"]'), title: (() => { const e = document.querySelector('#czViewer .cz-vw-t'); return e ? Math.round(e.getBoundingClientRect().width) : 0; })(),
|
|
92
|
+
presses: [...h.querySelectorAll('[data-cz-vw="press"]')].map((b) => b.getAttribute('aria-label')) };
|
|
93
|
+
});
|
|
94
|
+
const dash = (p) => p.evaluate(() => {
|
|
95
|
+
const d = document.querySelector('#czViewer .db'); if (!d) return null;
|
|
96
|
+
return { heads: [...d.querySelectorAll('.db-h')].map((x) => x.textContent), hd: (d.querySelector('.db-hd b') || {}).textContent || '', face: !!d.querySelector('.db-hd .db-face svg, .db-hd .db-face .ad-dot'),
|
|
97
|
+
cols: getComputedStyle(d.querySelector('.db-grid')).gridTemplateColumns.split(' ').filter(Boolean).length, w: d.getBoundingClientRect().width, over: d.scrollWidth > d.clientWidth + 1 };
|
|
98
|
+
});
|
|
99
|
+
const sizes = (p, sel) => p.evaluate((s) => [...new Set([...document.querySelectorAll(s + ', ' + s + ' *')].filter((e) => e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())).map((e) => getComputedStyle(e).fontSize))], sel);
|
|
100
|
+
const SCALE = new Set(['11px', '12px', '14px', '16px', '20px', '28px']);
|
|
101
|
+
|
|
102
|
+
/* ── H: the header ── */
|
|
103
|
+
const X = await open();
|
|
104
|
+
const p = X.page;
|
|
105
|
+
const h0 = await until(async () => { const h = await head(p); return h.toggle ? h : null; });
|
|
106
|
+
ok('H one toggle icon in the charter\'s place: a gauge, "Show the dashboard", not pressed, icon-only', !!h0 && !h0.charter && h0.toggle.label === 'Show the dashboard' && h0.toggle.title === 'Show the dashboard' && h0.toggle.pressed === 'false' && !h0.toggle.text, JSON.stringify(h0));
|
|
107
|
+
ok('H the dashboard is read for the program, as a press to act (a Board row)', X.gets.some((g) => g.scope === 'program:project-ascent' && g.from === 'act' && g.ws === 'idpf'), JSON.stringify(X.gets));
|
|
108
|
+
ok('H Work opens first: the panel\'s own summary shows, no Dashboard', await p.evaluate(() => !!document.querySelector('#czViewer .pp-vw .czs-sum') && !document.querySelector('#czViewer .db')));
|
|
109
|
+
|
|
110
|
+
/* ── D: the Dashboard ── */
|
|
111
|
+
await p.click('#czViewer [data-cz-vw-p="dash"]');
|
|
112
|
+
const d0 = await until(() => dash(p));
|
|
113
|
+
ok('D the blocks in order: Goals, Milestones, Needs you, Reports; no empty block', !!d0 && d0.heads.join() === 'Goals,Milestones,Needs you,Reports', JSON.stringify(d0));
|
|
114
|
+
ok('D the ✦ line leads with what Claude handled, with Adler\'s face', !!d0 && d0.hd === '3 of 4 milestones hold their dates. I drafted the sponsor update for Thursday.' && d0.face, JSON.stringify(d0));
|
|
115
|
+
const h1 = await head(p);
|
|
116
|
+
ok('D the same icon now shows the list to go back, pressed', !!h1.toggle && h1.toggle.label === 'Show the work' && h1.toggle.pressed === 'true', JSON.stringify(h1));
|
|
117
|
+
ok('D in the 560 px panel the blocks stack in one column', !!d0 && d0.cols === 1, JSON.stringify(d0));
|
|
118
|
+
const ds = await sizes(p, '#czViewer .db');
|
|
119
|
+
ok('S the Dashboard uses the type scale only', ds.length && ds.every((x) => SCALE.has(x)), ds.join());
|
|
120
|
+
await shot(p, 'PbA2Prog-desk-built');
|
|
121
|
+
|
|
122
|
+
/* ── W: wide ── */
|
|
123
|
+
await p.click('#czViewer [data-cz-vw="wide"]');
|
|
124
|
+
const dw = await until(async () => { const d = await dash(p); return d && d.cols === 2 ? d : null; }, 4000);
|
|
125
|
+
ok('W wide (PbA7): two columns, each block its own card', !!dw && dw.cols === 2, JSON.stringify(await dash(p)));
|
|
126
|
+
await shot(p, 'PbA7Desk-built');
|
|
127
|
+
await p.click('#czViewer [data-cz-vw="wide"]');
|
|
128
|
+
|
|
129
|
+
/* ── N: Needs you ✓ ── */
|
|
130
|
+
await p.click('#czViewer .db-need [data-db="needs"][data-k="keep"]');
|
|
131
|
+
const kp = await until(() => X.posts.find((x) => x.path === '/api/proposals/keep'));
|
|
132
|
+
ok('N ✓ keeps Claude\'s pick: POST /api/proposals/keep with the proposal ids and the initiative', !!kp && kp.body.ids.join() === 'p-dates-1' && kp.body.initiative === 'descope-parity' && kp.body.ws === 'idpf', JSON.stringify(kp));
|
|
133
|
+
ok('N the dashboard is read again after the press', (await until(() => X.gets.filter((g) => g.scope === 'program:project-ascent').length >= 2, 3000)));
|
|
134
|
+
|
|
135
|
+
/* ── the Milestones pencil opens the charter, ← comes back to the Dashboard ── */
|
|
136
|
+
await p.click('#czViewer .db [data-db="milestones"]');
|
|
137
|
+
ok('D the pencil on Milestones opens the charter', !!(await until(() => p.evaluate(() => window.czViewer && window.czViewer.current() && /^charter:/.test(window.czViewer.current().id)), 4000)));
|
|
138
|
+
await p.click('#czViewer [data-cz-vw="back"]');
|
|
139
|
+
ok('D ← comes back to the Dashboard', !!(await until(() => p.evaluate(() => !!document.querySelector('#czViewer .db')), 4000)));
|
|
140
|
+
|
|
141
|
+
/* ── R: a report row, and its two cuts ── */
|
|
142
|
+
await p.click('#czViewer .db [data-db="report"][data-k="r-sponsor"]');
|
|
143
|
+
const seg = await until(() => p.evaluate(() => { const s = document.querySelector('#czViewer .vz-cuts'); return s ? [...s.querySelectorAll('button')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')) : null; }), 8000);
|
|
144
|
+
ok('R the report opens in the one report Viewer with Sponsors · 1 minute | Team · full, Team first', !!seg && seg.join() === 'Sponsors · 1 minute:false,Team · full:true', JSON.stringify(seg));
|
|
145
|
+
await shot(p, 'PbA4Report-team-built');
|
|
146
|
+
await p.click('#czViewer .vz-cuts [data-r="cut|sponsors"]');
|
|
147
|
+
const cut = await until(() => p.evaluate(() => { const L = [...document.querySelectorAll('#czViewer .vz-cutl li')]; return L.length ? L.map((l) => (l.classList.contains('on') ? '✓' : '·') + l.querySelector('b').textContent + (l.querySelector('small') ? ' (' + l.querySelector('small').textContent + ')' : '')) : null; }), 5000);
|
|
148
|
+
ok('R Sponsors reads the cut (GET /api/ready-reports/cut) and ticks what sponsors read; the rest say Team only', !!cut && cut.join(' / ') === '✓The answer and 3 points / ✓Your decision / ✓Scorecard / ·Tickets and risks (Team only) / ·Next week\'s plan (Team only)', JSON.stringify(cut));
|
|
149
|
+
ok('R the cut was read for this file', X.gets.some((g) => g.cut === 'sponsors' && g.path === 'reports/one-login-sponsor/2026-10-29.md'));
|
|
150
|
+
ok('R Edit is not offered on the sponsors cut (the team cut is the one edited)', await p.evaluate(() => !document.querySelector('#czViewer [data-r="edit"]')));
|
|
151
|
+
await shot(p, 'PbG5Readers-built');
|
|
152
|
+
await p.click('#czViewer .vz-cuts [data-r="cut|team"]');
|
|
153
|
+
ok('R Team shows the full draft again', !!(await until(() => p.evaluate(() => !document.querySelector('#czViewer .vz-cutl') && document.querySelector('#czViewer [data-r="cut|team"]').getAttribute('aria-pressed') === 'true'), 3000)));
|
|
154
|
+
ok('0 no page error (desk)', X.errors.length === 0, X.errors.join(' | '));
|
|
155
|
+
await p.close();
|
|
156
|
+
|
|
157
|
+
/* ── L: the last choice per page ── */
|
|
158
|
+
const L = await open({ ctx: X.ctx });
|
|
159
|
+
const dl = await until(() => dash(L.page), 8000);
|
|
160
|
+
ok('L after a reload the Dashboard opens first: the PM\'s last choice on this program', !!dl && dl.heads[0] === 'Goals', JSON.stringify(dl));
|
|
161
|
+
|
|
162
|
+
/* ── I: the initiative view on the Board ── */
|
|
163
|
+
await L.page.click('#czViewer [data-cz-vw-p="dash"]'); // back to the work, so the tree is there
|
|
164
|
+
await until(() => L.page.evaluate(() => { const b = document.querySelector('#czViewer [data-czs-fold="tree"]'); if (b && b.getAttribute('aria-expanded') !== 'true') b.click(); return !!document.querySelector('#czViewer button.pp-open[data-ini="descope-parity"]'); }));
|
|
165
|
+
await L.page.click('#czViewer button.pp-open[data-ini="descope-parity"]');
|
|
166
|
+
const it = await until(async () => { const h = await head(L.page); return h.toggle && (await L.page.evaluate(() => !!document.querySelector('#czViewer .iv'))) ? h : null; }, 8000);
|
|
167
|
+
ok('I the initiative view carries the same toggle; Work shows first', !!it && it.toggle.label === 'Show the dashboard', JSON.stringify(it));
|
|
168
|
+
ok('I the initiative\'s dashboard is read for its scope', L.gets.some((g) => g.scope === 'initiative:descope-parity'));
|
|
169
|
+
await L.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
170
|
+
const di = await until(() => dash(L.page));
|
|
171
|
+
ok('I PbA1: Goal, Ships, Needs you, Reports', !!di && di.heads.join() === 'Goal,Ships,Needs you,Reports', JSON.stringify(di));
|
|
172
|
+
ok('I Ships: the range against the promise', await L.page.evaluate(() => /28 Nov to 5 Dec/.test(document.querySelector('#czViewer .db').textContent) && /promised 18 Nov/.test(document.querySelector('#czViewer .db').textContent)));
|
|
173
|
+
await shot(L.page, 'PbA1Ini-desk-built');
|
|
174
|
+
ok('0 no page error (initiative)', L.errors.length === 0, L.errors.join(' | '));
|
|
175
|
+
await X.ctx.close();
|
|
176
|
+
|
|
177
|
+
/* ── G: a held report (PbG2) ── */
|
|
178
|
+
const G = await open({ dash: { 'program:project-ascent': { ...RR.held(), scope: 'program:project-ascent' } } });
|
|
179
|
+
await until(async () => (await head(G.page)).toggle);
|
|
180
|
+
await G.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
181
|
+
await until(() => dash(G.page));
|
|
182
|
+
ok('G the held update: the honest ✦ line and Skip, Send with a note, Wait', await G.page.evaluate(() => !!document.querySelector('#czViewer .db-hd.warn') && document.querySelectorAll('#czViewer .db-held .db-ib').length === 3));
|
|
183
|
+
await G.page.click('#czViewer .db-held [data-k="r-weekly|wait"]');
|
|
184
|
+
const hp = await until(() => G.posts.find((x) => x.path === '/api/ready-reports/hold'));
|
|
185
|
+
ok('G Wait posts the hold (POST /api/ready-reports/hold, act wait)', !!hp && hp.body.act === 'wait' && hp.body.kind === 'weekly' && hp.body.scope === 'program:project-ascent', JSON.stringify(hp));
|
|
186
|
+
await shot(G.page, 'PbG2Stale-built');
|
|
187
|
+
ok('0 no page error (held)', G.errors.length === 0, G.errors.join(' | '));
|
|
188
|
+
await G.ctx.close();
|
|
189
|
+
|
|
190
|
+
/* ── Z: no dashboard: no toggle ── */
|
|
191
|
+
const Z = await open({ dash: { 'program:project-ascent': null } });
|
|
192
|
+
await until(() => Z.gets.some((g) => g.scope === 'program:project-ascent'), 5000); await sleep(500);
|
|
193
|
+
const hz = await head(Z.page);
|
|
194
|
+
ok('Z the dashboard cannot be read: no toggle, the work as before', !hz.toggle && !hz.charter, JSON.stringify(hz));
|
|
195
|
+
await Z.ctx.close();
|
|
196
|
+
|
|
197
|
+
/* ── M: a phone ── */
|
|
198
|
+
const M = await open({ w: 390, h: 844, dark: true });
|
|
199
|
+
const hm = await until(async () => { const h = await head(M.page); return h.toggle ? h : null; });
|
|
200
|
+
ok('M at 390 px the title keeps 150 px beside the one toggle (PbH1Header)', !!hm && hm.title >= 150, JSON.stringify(hm));
|
|
201
|
+
await M.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
202
|
+
const dm = await until(() => dash(M.page));
|
|
203
|
+
ok('M the Dashboard fits the phone: one column, no sideways scroll', !!dm && dm.cols === 1 && !dm.over && dm.w <= 390, JSON.stringify(dm));
|
|
204
|
+
ok('M every press is at least 40 px', await M.page.evaluate(() => [...document.querySelectorAll('#czViewer .db .db-ib')].every((b) => b.getBoundingClientRect().width >= 40)));
|
|
205
|
+
await shot(M.page, 'PbA2Prog-phone-dark-built');
|
|
206
|
+
ok('0 no page error (phone)', M.errors.length === 0, M.errors.join(' | '));
|
|
207
|
+
await M.ctx.close();
|
|
208
|
+
|
|
209
|
+
/* ── P: the product page on Home is the product's Dashboard (PbA3, PbG8): no toggle; Goals as dots, Ships next, This week ── */
|
|
210
|
+
for (const [w, hgt, nm] of [[390, 844, 'phone'], [1440, 900, 'desk']]) {
|
|
211
|
+
const c = await browser.newContext({ viewport: { width: w, height: hgt } });
|
|
212
|
+
const pg = await c.newPage(); const errs = [], gets = [];
|
|
213
|
+
pg.on('pageerror', (e) => errs.push(String((e && e.stack) || e)));
|
|
214
|
+
await pg.route('**/api/ready-reports/dashboard*', (r) => { const u = new URL(r.request().url()); gets.push({ scope: u.searchParams.get('scope'), from: u.searchParams.get('from') }); return r.fulfill({ contentType: 'application/json', body: JSON.stringify(RR.product()) }); });
|
|
215
|
+
await pg.goto(BASE + '/premium.html?ini=product');
|
|
216
|
+
const pd = await until(() => pg.evaluate(() => { const d = document.querySelector('#czViewer .db'); if (!d) return null; return { heads: [...d.querySelectorAll('.db-h')].map((x) => x.textContent), sum: (d.querySelector('.db-sum b') || {}).textContent || '', late: !!d.querySelector('.db-late'), over: d.scrollWidth > d.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
|
|
217
|
+
ok('P (' + nm + ') the product page is the Dashboard: Goals folded to dots, Ships next, This week with the late update; no toggle', !!pd && pd.sum === 'Goals' && pd.heads.join() === 'Ships next,This week' && pd.late && !pd.toggle && !pd.over, JSON.stringify(pd));
|
|
218
|
+
const mx = await pg.evaluate(() => { const b = document.querySelector('#czViewer .db [data-db="metrics"]'); if (!b) return null; const r = b.getBoundingClientRect(), s = document.querySelector('#czViewer .db-sum').getBoundingClientRect(); return { w: r.width, label: b.getAttribute('aria-label'), beside: Math.abs((r.top + r.height / 2) - (s.top + s.height / 2)) < 12 }; });
|
|
219
|
+
ok('P (' + nm + ') the metrics review keeps its way in: one icon at the Goals head, 40 px', !!mx && mx.label === 'Open the metrics review' && mx.w >= 40 && mx.beside, JSON.stringify(mx));
|
|
220
|
+
if (nm === 'desk') { await pg.click('#czViewer .db [data-db="metrics"]'); ok('P the icon opens the metrics review, ← back to the product', !!(await until(() => pg.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return c && c.id !== 'product' ? c.id : null; })))); }
|
|
221
|
+
ok('P (' + nm + ') read as a page to read (scope product)', gets.some((g) => g.scope === 'product' && g.from === 'read'), JSON.stringify(gets));
|
|
222
|
+
await shot(pg, 'PbA3Product-' + nm + '-built');
|
|
223
|
+
ok('0 no page error (product, ' + nm + ')', errs.length === 0, errs.join(' | '));
|
|
224
|
+
await c.close();
|
|
225
|
+
}
|
|
226
|
+
return finish();
|
|
227
|
+
})();
|
package/workspace/server.js
CHANGED
|
@@ -2661,6 +2661,8 @@ const dashboardScheduleTick = () => {
|
|
|
2661
2661
|
let setups = null; try { setups = require('./lib/routes-report-setups.js'); } catch { setups = null; }
|
|
2662
2662
|
(setups ? setups.tick(reportSetupsCtx()) : Promise.resolve())
|
|
2663
2663
|
.catch((e) => warnWriteFail('report setups tick', e))
|
|
2664
|
+
.then(() => { let rr = null; try { rr = require('./lib/routes-ready-reports.js'); } catch { return null; } return rr.tick(reportSetupsCtx()); }) // batch 17 item 1: the ready-made reports
|
|
2665
|
+
.catch((e) => warnWriteFail('ready reports tick', e))
|
|
2664
2666
|
.then(() => m.runDue({ getWs, runtimeDir: STATE }))
|
|
2665
2667
|
.catch((e) => warnWriteFail('dashboard schedule tick', e));
|
|
2666
2668
|
};
|
|
@@ -2912,6 +2914,8 @@ const metricDraftRuns = require('./lib/metric-draft-runs.js').create({
|
|
|
2912
2914
|
records: (w) => require(require('./lib/repo-script.js').repoScript('records/index.js')).list(require('./lib/records-dir.js').recordsDirFor(metricDraftCtx(), w.id), 'kr-metrics'),
|
|
2913
2915
|
programs: (w) => require('./lib/routes-programs.js').all(metricDraftCtx()).filter((p) => p.home === w.id && !p.archived),
|
|
2914
2916
|
initiatives: (w) => metricDraftInis(w).map((g) => ({ id: g.id, title: g.title || g.id })),
|
|
2917
|
+
// batch 16 item 6: the key results the OKR files declare, for the OKR review's gaps (lib/metric-draft-runs.js gapsOf)
|
|
2918
|
+
krs: (w) => { try { return require('./lib/initiative-rows.js').anchorsOf(w.root).list().filter((a) => a.kind === 'kr').map((a) => ({ value: a.value, label: a.label })); } catch { return []; } },
|
|
2915
2919
|
titleOf: (w, scope, id) => scope === 'product' ? (w.name || w.id) : scope === 'program' ? ((require('./lib/routes-programs.js').all(metricDraftCtx()).find((p) => p.id === id) || {}).title || id)
|
|
2916
2920
|
: ((metricDraftInis(w).find((g) => g.id === id) || {}).title || id),
|
|
2917
2921
|
facts: (w, scope, id) => {
|
|
@@ -2935,6 +2939,58 @@ const metricDraftRuns = require('./lib/metric-draft-runs.js').create({
|
|
|
2935
2939
|
warn: (what, e) => warnWriteFail(what, e),
|
|
2936
2940
|
});
|
|
2937
2941
|
const metricDraftTick = () => { try { metricDraftRuns.tick({}); } catch (e) { warnWriteFail('metric draft tick', e); } };
|
|
2942
|
+
// batch 16 item 7 (Your impact, canvas GmP1Ledger): once a day Claude reads what people and systems did in reaction to the PM's work
|
|
2943
|
+
// (lib/impact-runs.js). Its only write is `pmos impact add` into the PM's own ledger in the runtime folder; the PM checks each item in Home's
|
|
2944
|
+
// chat. Off with Settings › General › Your impact (impact.on) or PMOS_IMPACT=off. Nothing is sent.
|
|
2945
|
+
const impactRuns = require('./lib/impact-runs.js').create({
|
|
2946
|
+
runtime: () => STATE,
|
|
2947
|
+
on: () => require('./lib/settings-store.js').get(STATE, 'impact.on') !== false,
|
|
2948
|
+
homeWs: () => homeWorkspace(),
|
|
2949
|
+
facts: () => {
|
|
2950
|
+
const out = [];
|
|
2951
|
+
try { const names = require('./lib/routes-mentions.js').myNames(STATE, (homeWorkspace() || {}).root); if (names.length) out.push('The PM is called: ' + names.join(', ')); } catch { /* no name known */ }
|
|
2952
|
+
for (const w of workspaces.values()) out.push('Product: ' + (w.name || w.id) + ' · ' + w.root);
|
|
2953
|
+
out.push('Stored reads: run `pmos source status`, then `pmos source show <source>` for slack, mail, jira, calendar and wispr');
|
|
2954
|
+
return out;
|
|
2955
|
+
},
|
|
2956
|
+
open: (now) => require('./lib/driver-run.js').dayCheckOpen(proSettings(), now, (n, q) => proactiveLib.inQuietHours(n, q)),
|
|
2957
|
+
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2958
|
+
env: process.env,
|
|
2959
|
+
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
2960
|
+
spawn: (spec) => orchSpawn.spawn({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
|
|
2961
|
+
spawnNow: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
|
|
2962
|
+
stop: (s) => { if (s && s.child) stopHeadless(s); },
|
|
2963
|
+
warn: (what, e) => warnWriteFail(what, e),
|
|
2964
|
+
});
|
|
2965
|
+
const impactTick = () => { try { impactRuns.tick({}); } catch (e) { warnWriteFail('impact tick', e); } };
|
|
2966
|
+
// batch 16 item 6 ("Claude runs the OKRs"): Claude reads each goal with its recipe (lib/metric-read-runs.js) when its cadence comes round, files the
|
|
2967
|
+
// value with its source and time, says honestly what it could not read and drafts the fix. A broken limit opens one alert: a bell line only when
|
|
2968
|
+
// the goal's notify is push. At most 2 runs at once, one per product. PMOS_METRIC_READ=off.
|
|
2969
|
+
const krMetricsOf = (w) => require(require('./lib/repo-script.js').repoScript('records/index.js')).list(require('./lib/records-dir.js').recordsDirFor(metricDraftCtx(), w.id), 'kr-metrics');
|
|
2970
|
+
const goalAlertTell = (w, rec, reading) => tellNeed(w.id, 'goal-alert-' + rec.rid + '-' + reading.at, String(rec.metric || rec.rid), String(rec.metric || rec.rid) + ' broke its limit: ' + reading.txt + ' against its ' + reading.line + ' on ' + reading.at + '. The rollback ticket is drafted on Intelligence.');
|
|
2971
|
+
const metricReadRuns = require('./lib/metric-read-runs.js').create({
|
|
2972
|
+
workspaces: () => [...workspaces.values()],
|
|
2973
|
+
isLead: (w) => isPlanNeedsTree(w),
|
|
2974
|
+
stateDirFor: (w) => stateDirFor(w),
|
|
2975
|
+
recordsDir: (w) => require('./lib/records-dir.js').recordsDirFor(metricDraftCtx(), w.id),
|
|
2976
|
+
records: (w) => krMetricsOf(w).filter((r) => r.retired !== true),
|
|
2977
|
+
draftsFile: (w) => { const d = stateDirFor(w); return d ? require('./lib/metric-drafts.js').ledgerFile(d) : ''; },
|
|
2978
|
+
testItems: (w, rids) => {
|
|
2979
|
+
const d = stateDirFor(w); if (!d) return [];
|
|
2980
|
+
const MDx = require('./lib/metric-drafts.js'), S = MDx.read(d).scopes.get(MDx.keyOf('product', w.id));
|
|
2981
|
+
return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.text, unit: (r.metric && r.metric.unit) || '', recipe: r.recipe }));
|
|
2982
|
+
},
|
|
2983
|
+
afterRead: (w, rids, now) => require('./lib/routes-goal-status.js').afterRead({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, tellGoalAlert: goalAlertTell }, w, rids, now),
|
|
2984
|
+
open: (now) => require('./lib/driver-run.js').dayCheckOpen(proSettings(), now, (n, q) => proactiveLib.inQuietHours(n, q)),
|
|
2985
|
+
headlessOff: () => headlessLib.switchedOff(process.env),
|
|
2986
|
+
env: process.env,
|
|
2987
|
+
promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
|
|
2988
|
+
spawn: (spec) => orchSpawn.spawn({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
|
|
2989
|
+
spawnNow: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
|
|
2990
|
+
stop: (s) => { if (s && s.child) stopHeadless(s); },
|
|
2991
|
+
warn: (what, e) => warnWriteFail(what, e),
|
|
2992
|
+
});
|
|
2993
|
+
const metricReadTick = () => { try { metricReadRuns.tick({}); } catch (e) { warnWriteFail('metric read tick', e); } };
|
|
2938
2994
|
// core-documents: every 30 minutes inside the working hours, ONE headless run per due core document of the portfolio and of each board
|
|
2939
2995
|
// (at most 3 at once, once per document per day, never one the PM writes). The run writes a draft with `pmos coredoc write`; nothing is sent.
|
|
2940
2996
|
// PMOS_CORE_DOCS_NOW (a local date-time) fixes its clock for the suites.
|
|
@@ -3033,7 +3089,7 @@ const gated = (id, fn) => () => { let g = { ok: true }; try { g = refreshRun.job
|
|
|
3033
3089
|
// data-refresh-settings: the seed schedules move to Settings › Data refresh (refreshRun.settings(), once) BEFORE checkDueSchedules reads
|
|
3034
3090
|
// schedules.json, so a schedule that is moving never fires once more from the old list on the first tick after an upgrade.
|
|
3035
3091
|
const scheduleOwner = require('./lib/schedule-owner.js').create({ port: PORT });
|
|
3036
|
-
try { const _tick = setInterval(() => { try { if (!scheduleOwner.mayRun()) return; } catch { /* no lock: run as before */ } try { refreshRun.settings(); } catch { /* the refresh tick tries again */ } checkDueSchedules(); proactiveTick(); try { prepareTick({ manual: false }); } catch { /* the next tick tries again */ } try { dayTick(); } catch (e) { warnWriteFail('day run tick', e); } try { refreshRun.tick(); } catch (e) { warnWriteFail('refresh tick', e); } try { healthTick(); } catch (e) { warnWriteFail('health tick', e); } gated('sync', () => autoSync.tick().catch(() => {}))(); dashboardScheduleTick(); orchTick(); gated('driver', driverTick)(); gated('scan', scanTick)(); gated('finder', reportFinderTick)(); gated('coredocs', coreDocsTick)(); msReviewTick(); gated('propose', proposalTick)(); metricDraftTick(); reportDesignTick(); reportStructureTick(); }, TICK_MS); if (_tick.unref) _tick.unref(); } catch {}
|
|
3092
|
+
try { const _tick = setInterval(() => { try { if (!scheduleOwner.mayRun()) return; } catch { /* no lock: run as before */ } try { refreshRun.settings(); } catch { /* the refresh tick tries again */ } checkDueSchedules(); proactiveTick(); try { prepareTick({ manual: false }); } catch { /* the next tick tries again */ } try { dayTick(); } catch (e) { warnWriteFail('day run tick', e); } try { refreshRun.tick(); } catch (e) { warnWriteFail('refresh tick', e); } try { healthTick(); } catch (e) { warnWriteFail('health tick', e); } gated('sync', () => autoSync.tick().catch(() => {}))(); dashboardScheduleTick(); orchTick(); gated('driver', driverTick)(); gated('scan', scanTick)(); gated('finder', reportFinderTick)(); gated('coredocs', coreDocsTick)(); msReviewTick(); gated('propose', proposalTick)(); metricDraftTick(); impactTick(); metricReadTick(); reportDesignTick(); reportStructureTick(); }, TICK_MS); if (_tick.unref) _tick.unref(); } catch {}
|
|
3037
3093
|
|
|
3038
3094
|
// ── Sessions: real PTYs, owned by the server, with disk-backed scrollback + metadata. ──
|
|
3039
3095
|
/** @type {Map<string, {id,ws,name,agent,cwd,state,note,created,pty,buf,cols,rows,clients:Set}>} */
|
|
@@ -10226,7 +10282,7 @@ async function handleRequest(req, res) {
|
|
|
10226
10282
|
// pm-os-absorb Runs 2–5 — the planning layer's routes, one file per run (lib/route-modules.js). Last, so none shadows a route above.
|
|
10227
10283
|
// meeting-notes Run 1: the Notes routes keep notes in the per-user runtime directory and start the agent-summary session.
|
|
10228
10284
|
if (req.method === 'POST' && !(req.headers && req.headers['x-pmos-session'])) orchGate.touch(); // agent-orchestrator: a page press by the PM
|
|
10229
|
-
if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
|
|
10285
|
+
if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, metricReadRuns, tellGoalAlert: goalAlertTell, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
|
|
10230
10286
|
runtimeDir: STATE, homeRoot: HOME_ENABLED ? SELF_ROOT : null, spawnSession, jevModelOpts, sendToSession, endSupersededRuns, proSettings,
|
|
10231
10287
|
// premium-chat-session: every premium chat panel is an interactive Claude Code session the PM talks to (text as typed, `/` kept)
|
|
10232
10288
|
chatSessions,
|