create-pmos 0.479.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 +26 -27
- 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 +25 -0
- package/workspace/guide/briefing-premium.md +11 -4
- 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 +8 -4
- package/workspace/lib/report-draft.js +14 -5
- package/workspace/lib/report-structure.js +35 -1
- package/workspace/lib/routes-metric-drafts.js +2 -1
- package/workspace/lib/routes-ready-reports.js +6 -2
- package/workspace/lib/routes-report-setups.js +24 -4
- 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 +42 -5
- package/workspace/public/pm/premium-report-tab.js +89 -24
- 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 +20 -3
- 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
|
@@ -152,7 +152,7 @@ function readJsonl(file) {
|
|
|
152
152
|
*/
|
|
153
153
|
function readDefinition(root, cadence) {
|
|
154
154
|
const rel = definitionPath(root, cadence);
|
|
155
|
-
const out = { path: rel, exists: false, cadence: null, audience: null, product: null, sections: FRAME.slice(), errors: [] };
|
|
155
|
+
const out = { path: rel, exists: false, cadence: null, audience: null, product: null, sections: FRAME.slice(), errors: [], name: null, purpose: null };
|
|
156
156
|
let text;
|
|
157
157
|
try { text = fs.readFileSync(path.join(path.resolve(String(root)), rel), 'utf8'); } catch { return out; }
|
|
158
158
|
out.exists = true;
|
|
@@ -174,6 +174,10 @@ function readDefinition(root, cadence) {
|
|
|
174
174
|
if (out.cadence !== cadence) out.errors.push(`its cadence is ${JSON.stringify(out.cadence)}, not ${cadence}`);
|
|
175
175
|
out.audience = isStr(map.audience) && map.audience.trim() ? map.audience.trim() : null;
|
|
176
176
|
out.product = isStr(map.product) && map.product.trim() ? map.product.trim() : null;
|
|
177
|
+
// the report's name and purpose, for the draft's title and its one-line description (report-setups.js definitionText writes both)
|
|
178
|
+
if (isStr(map.title) && map.title.trim()) out.name = map.title.trim().replace(/\s+definition$/i, '') || null;
|
|
179
|
+
const pur = /\n## Purpose\r?\n\r?\n([^\n]+)/.exec(text.slice(fm[0].length - 1));
|
|
180
|
+
if (pur && pur[1].trim() && !/^#/.test(pur[1])) out.purpose = pur[1].trim().slice(0, 300);
|
|
177
181
|
if (!out.audience) out.errors.push('it names no audience, so Needs your call stays empty (X23)');
|
|
178
182
|
if (Array.isArray(map.sections)) {
|
|
179
183
|
const got = map.sections.map((s) => String(s).trim());
|
|
@@ -506,16 +510,20 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
506
510
|
// ── the markdown ────────────────────────────────────────────────────────────────────────────────────
|
|
507
511
|
const esc = (s) => String(s == null ? '' : s).replace(/\|/g, '\\|').replace(/\n/g, ' ');
|
|
508
512
|
|
|
509
|
-
function render(draft, { notes } = {}) {
|
|
513
|
+
function render(draft, { notes, name: given, purpose } = {}) {
|
|
510
514
|
if (!draft || draft.ok === false) return '';
|
|
511
515
|
const n = notes && typeof notes === 'object' ? notes : {};
|
|
512
516
|
const noteOf = (id, fallback) => (has(n, id) ? n[id] : (fallback == null ? '' : fallback));
|
|
513
|
-
|
|
517
|
+
// The title is the report's own name (its definition's), never its id: "Scarlet assessment report 2026-11-02", not "Scarlet-assessment-report report …".
|
|
518
|
+
const named = isStr(given) && given.trim() ? given.trim().replace(/["\\]/g, "'") : '';
|
|
519
|
+
const name = named ? (/\breport$/i.test(named) ? named.replace(/\s*report$/i, '') : named) : cap(draft.cadence);
|
|
520
|
+
// The description is what readers see under the title: the report's purpose. How the file is made stays in this module's header.
|
|
521
|
+
const desc = isStr(purpose) && purpose.trim() ? purpose.trim().replace(/["\\]/g, "'") : `The ${named || draft.cadence} report for ${draft.slot}.`;
|
|
514
522
|
const audience = draft.sources && draft.sources.definition ? draft.sources.definition.audience : null;
|
|
515
523
|
const out = [];
|
|
516
524
|
const push = (...l) => out.push(...l);
|
|
517
525
|
push('---', 'type: Reference', `title: "${name} report ${draft.slot}"`,
|
|
518
|
-
`description: "
|
|
526
|
+
`description: "${desc}"`,
|
|
519
527
|
`timestamp: ${draft.window.to}`, `cadence: ${draft.cadence}`, `slot: ${draft.slot}`,
|
|
520
528
|
`window: "${draft.window.from} to ${draft.window.to} (${draft.window.since === 'last_issue' ? 'since the last issue' : 'report_cycle_days back'})"`,
|
|
521
529
|
'---', '', `# ${name} report ${draft.slot}`, '');
|
|
@@ -620,7 +628,8 @@ function writeDraft(root, draft, { actor, notes, fresh, quiet } = {}) {
|
|
|
620
628
|
if (badId !== undefined) return refuse(400, `${JSON.stringify(badId)} cannot carry a note: use lower-case letters, digits, ".", "_" or "-". Nothing was written`);
|
|
621
629
|
const marked = Object.keys(kept).find((id) => kept[id] != null && MARKER_RE.test(String(kept[id])));
|
|
622
630
|
if (marked !== undefined) return refuse(400, `the note for ${marked} holds a note marker (<!-- pmos:note or <!-- /pmos:note). Remove it from the note. Nothing was written`);
|
|
623
|
-
|
|
631
|
+
let def = null; try { def = readDefinition(abs, draft.cadence); } catch { def = null; }
|
|
632
|
+
const md = render(draft, { notes: kept, name: def && def.name, purpose: def && def.purpose });
|
|
624
633
|
const tmp = `${file}.tmp-${crypto.randomBytes(6).toString('hex')}`;
|
|
625
634
|
try {
|
|
626
635
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* validateDry(dry, plan) → { ok, dry } | refusal a dry-run result (section 4)
|
|
10
10
|
* validateCheck(check, kind) → { ok, steps } | refusal the steps a check session wrote (section 5)
|
|
11
11
|
* landVersion(root, id, plan, meta) → { ok, n, plan } writes versions/S<n>.json and the version line (plus any `before` lines)
|
|
12
|
+
* planFromSections(titles, { readers, decision, base }) → { ok, plan } | refusal the plan of the sections the PM named, in order (headline first, needs and sources last)
|
|
12
13
|
* readVersion(root, id, n) → the plan of S<n> | null
|
|
13
14
|
* rewriteVersion(root, id, n, plan) → the plan written back to S<n>.json (accept links chart ids)
|
|
14
15
|
* writeDry · readDry · writeCheck · readCheck · pendingCheck
|
|
@@ -440,6 +441,39 @@ function landVersion(root, id, plan, { turn, answer, questions, options, from, b
|
|
|
440
441
|
return { ok: true, n, plan: v.plan };
|
|
441
442
|
}
|
|
442
443
|
|
|
444
|
+
/**
|
|
445
|
+
* The plan of the sections the PM named, in their order (report-from-chat fix, batch 21). The PM's own titles are kept; the ids follow the plan's
|
|
446
|
+
* rule: the first section is the fixed `headline`, a section named "Sources" (or one added) is the fixed `sources`, last, and the one before it is
|
|
447
|
+
* the fixed `needs`. One named section alone gets "Needs your call" after it. `base` (a saved plan) keeps its purpose, sources and charts.
|
|
448
|
+
* → { ok, plan } (validated) | refusal.
|
|
449
|
+
*/
|
|
450
|
+
function planFromSections(titles, { readers, decision, base, charts } = {}) {
|
|
451
|
+
const seen = new Set();
|
|
452
|
+
const list = listOf(titles).map((t) => (typeof t === 'string' ? t.replace(/\s+/g, ' ').trim().slice(0, 80) : '')).filter((t) => t && !seen.has(t.toLowerCase()) && seen.add(t.toLowerCase()));
|
|
453
|
+
if (!list.length) return refuse(400, 'name at least one section');
|
|
454
|
+
const isSrc = (t) => /^sources?\b/i.test(t) || /\bsources?$/i.test(t);
|
|
455
|
+
const si = list.findIndex(isSrc);
|
|
456
|
+
const srcTitle = si >= 0 ? list.splice(si, 1)[0] : 'Sources';
|
|
457
|
+
if (list.length === 1) list.push('Needs your call');
|
|
458
|
+
if (list.length + 1 > LIMITS.sections) return refuse(400, `a report holds at most ${LIMITS.sections} sections, Sources included`);
|
|
459
|
+
const taken = new Set(FIXED);
|
|
460
|
+
const slug = (t) => {
|
|
461
|
+
let b = t.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 36) || 'section';
|
|
462
|
+
if (!/^[a-z]/.test(b)) b = 's-' + b;
|
|
463
|
+
let id = b, k = 2;
|
|
464
|
+
while (taken.has(id)) id = b + '-' + k++;
|
|
465
|
+
taken.add(id); return id;
|
|
466
|
+
};
|
|
467
|
+
const sec = (id, title, fixed) => ({ id, title, fixed, charts: [], notes: '', show: '' });
|
|
468
|
+
const outline = [sec('headline', list[0], true)]
|
|
469
|
+
.concat(list.slice(1, -1).map((t) => sec(slug(t), t, false)), [sec('needs', list[list.length - 1], true), sec('sources', srcTitle, true)]);
|
|
470
|
+
const b = isObj(base) ? base : null;
|
|
471
|
+
const pu = b && isObj(b.purpose) ? b.purpose : {};
|
|
472
|
+
const plan = { purpose: { readers: str(pu.readers) || str(readers).slice(0, LIMITS.text), decision: str(pu.decision) || str(decision).slice(0, LIMITS.text), scope: str(pu.scope), cadence: str(pu.cadence), questions: listOf(pu.questions) },
|
|
473
|
+
sources: b ? listOf(b.sources) : [], charts: b ? listOf(b.charts) : [], outline, options: [] };
|
|
474
|
+
return validatePlan(plan, { charts });
|
|
475
|
+
}
|
|
476
|
+
|
|
443
477
|
// ── test pull (report-structure-gaps): ONE source read for the last complete period ──────────────────────────
|
|
444
478
|
/** What a pull job wrote for one source of a plan. → { ok, pull } | refusal. `reached` false is a valid answer: the source returned nothing. */
|
|
445
479
|
function validatePull(data, plan, sourceId) {
|
|
@@ -554,6 +588,6 @@ function writeBrief(root, id, setup, { now } = {}) {
|
|
|
554
588
|
return { ok: true, path: paths(root, id).briefRel };
|
|
555
589
|
}
|
|
556
590
|
|
|
557
|
-
module.exports = { EVENTS, KINDS, PMOS_KINDS, OUTSIDE_KINDS, STATES, FIXED, LIMITS, CHECK_STEPS, CHECK_STATES, CADENCE_RE, SLUG_RE, RUN_RE,
|
|
591
|
+
module.exports = { planFromSections, EVENTS, KINDS, PMOS_KINDS, OUTSIDE_KINDS, STATES, FIXED, LIMITS, CHECK_STEPS, CHECK_STATES, CADENCE_RE, SLUG_RE, RUN_RE,
|
|
558
592
|
paths, append, readEvents, fold, stateOf, nextN, badText, validatePlan, validateSource, validateDry, validateCheck, cleanQuestions, cleanOptions, addSourceTo, removeFrom,
|
|
559
593
|
landVersion, readVersion, rewriteVersion, writeDry, readDry, validatePull, writePull, readPull, readPulls, writeCheck, readCheck, readChecks, writeBrief, structureAnswer, savedOf, overlay, defaultState, newRun };
|
|
@@ -84,7 +84,8 @@ async function handle(req, res, url, ctx) {
|
|
|
84
84
|
if (!w) return send(bad(404, 'no such workspace'));
|
|
85
85
|
const sid = scope === 'product' ? (id || w.id) : id;
|
|
86
86
|
if (!sid) return send(bad(400, 'id names the program or the initiative'));
|
|
87
|
-
|
|
87
|
+
const view = viewFor(ctx, w, scope, sid);
|
|
88
|
+
return send({ status: 200, body: { ok: true, ...view, ...(scope === 'product' ? { krProposals: MD.krProposalsOf(view) } : {}) } });
|
|
88
89
|
}
|
|
89
90
|
if (!['keep', 'keep-all', 'drop', 'undo', 'start', 'stop', 'edit'].includes(what)) return send(bad(404, 'no such metric-drafts route'));
|
|
90
91
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
@@ -79,6 +79,10 @@ function openInis(ctx, w) {
|
|
|
79
79
|
return out;
|
|
80
80
|
} catch { return new Set(); }
|
|
81
81
|
}
|
|
82
|
+
/** Claude's pick as words, or ''. The card draws the "✦ My pick:" prefix itself. Only a new name or state is words: a dates item's `to` is
|
|
83
|
+
* { start, due }, which the proposal's title already names ("4 tasks to Nov 9–16"), so it has no pick line (batch 22 item 2: it showed
|
|
84
|
+
* "✦ My pick: ✦ My pick: [object Object]"). */
|
|
85
|
+
const pickOf = (x) => (x && typeof x.to === 'string' && x.to.trim() ? x.to.trim().slice(0, 120) : '');
|
|
82
86
|
const MAX_VIEWS = 5; // the Needs you block shows one decision: at most 5 initiatives' proposal views are built for it
|
|
83
87
|
function needsOf(ctx, w, boardId, ids) {
|
|
84
88
|
const out = [];
|
|
@@ -90,7 +94,7 @@ function needsOf(ctx, w, boardId, ids) {
|
|
|
90
94
|
const ps = v.groups.flatMap((g) => g.props || []).sort((a, b) => (a.group === 'dates' ? -1 : 0) - (b.group === 'dates' ? -1 : 0));
|
|
91
95
|
const p = ps[0]; if (!p) continue;
|
|
92
96
|
const first = (p.items || [])[0] || null;
|
|
93
|
-
out.push({ id: p.id, q: String(p.title || (first && first.title) || 'A change Claude proposes').slice(0, 160), sub: String(p.why || '').slice(0, 200), pick:
|
|
97
|
+
out.push({ id: p.id, q: String(p.title || (first && first.title) || 'A change Claude proposes').slice(0, 160), sub: String(p.why || '').slice(0, 200), pick: pickOf(first), from: ini, ini, board: boardId, group: p.group,
|
|
94
98
|
keep: { ids: [p.id] }, drop: { sig: p.sig } });
|
|
95
99
|
}
|
|
96
100
|
return out.sort((a, b) => (a.group === 'dates' ? -1 : 0) - (b.group === 'dates' ? -1 : 0));
|
|
@@ -475,4 +479,4 @@ function headsUpMd(setup, h, today) {
|
|
|
475
479
|
`Source: ${h.why === 'budget' ? 'the health budget readings' : 'the Jira tickets and the promise date'}, read ${today}.`, ''].join('\n');
|
|
476
480
|
}
|
|
477
481
|
|
|
478
|
-
module.exports = { prefixes: ['/api/ready-reports'], handle, tick, factsFor, readyExtras, ensureSetup, autoSend };
|
|
482
|
+
module.exports = { prefixes: ['/api/ready-reports'], handle, tick, factsFor, readyExtras, ensureSetup, autoSend, pickOf };
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* POST /api/report-setups/ask { ws, text } → { ok, id } starts the report-setup run (headless)
|
|
11
11
|
* POST /api/report-setups/change { ws, id, text } → { ok } a correction to a proposal; a second run revises it
|
|
12
12
|
* POST /api/report-setups/cancel { ws, id } → { ok }
|
|
13
|
-
* POST /api/report-setups/setup { ws, ask? | finding?, proposal? }
|
|
13
|
+
* POST /api/report-setups/setup { ws, ask? | finding?, proposal?, sections? } → { ok, setup, first_draft, drafted, structure? } THE press that sets a report up; drafts the first cycle.
|
|
14
|
+
* sections (the titles the PM named in the chat) are saved as S1 and the first draft follows them (drafted.drafting)
|
|
14
15
|
* POST /api/report-setups/draft { ws, id } → { ok, drafted: { slot, path }, id } Draft it now (the next cycle)
|
|
15
16
|
* POST /api/report-setups/dismiss { ws, finding } → { ok } "Not a report"
|
|
16
17
|
* POST /api/report-setups/pause | resume { ws, id } → { ok, setup }
|
|
@@ -54,6 +55,7 @@ const RC = require('./report-checks.js');
|
|
|
54
55
|
const RX = require('./report-export.js');
|
|
55
56
|
const RF = require('./report-finder.js');
|
|
56
57
|
const RD = require('./report-draft.js');
|
|
58
|
+
const RSt = require('./report-structure.js');
|
|
57
59
|
const logic = require('./schedule-logic.js');
|
|
58
60
|
const docSync = require('./doc-sync.js');
|
|
59
61
|
const headless = require('./headless.js');
|
|
@@ -415,14 +417,32 @@ async function handle(req, res, url, ctx) {
|
|
|
415
417
|
else if (body.finding) { const l = RS.lookupFinding(st, text(body.finding), text(body.name)); if (!l.ok) return send({ status: l.status, body: { ok: false, error: l.error, reason: l.reason } }); from = { finding: l.finding.id }; base = l.finding.proposal; }
|
|
416
418
|
const proposal = body.proposal && typeof body.proposal === 'object' && !Array.isArray(body.proposal) ? body.proposal : base;
|
|
417
419
|
if (!proposal) return send(bad(400, 'say which request or finding to set up, or give the proposal'));
|
|
420
|
+
// The sections the PM named in the chat (report-chat `sections`), checked before anything is written: a bad list sets nothing up.
|
|
421
|
+
let shaped = null;
|
|
422
|
+
if (body.sections !== undefined) {
|
|
423
|
+
shaped = RSt.planFromSections(body.sections, { readers: text(proposal.audience), decision: text(proposal.purpose) });
|
|
424
|
+
if (!shaped.ok) return fail(shaped);
|
|
425
|
+
}
|
|
418
426
|
const r = RS.setUp(root, { ...proposal, ...(from ? { from } : {}) }, opts);
|
|
419
427
|
if (!r.ok) return fail(r);
|
|
428
|
+
// The PM saw those sections in the tab and pressed Set it up: that press saves them as S1, so the first draft already follows them
|
|
429
|
+
// (Wawan, 2026-11-01: a report set up from chat kept the standard sections and a draft written before the change landed).
|
|
430
|
+
let structured = null;
|
|
431
|
+
if (shaped && r.setup.source === 'work') {
|
|
432
|
+
const v = RSt.landVersion(root, r.setup.id, shaped.plan, { turn: 'The sections named in the chat.', answer: 'Made S1 from the sections you named.', from: 'chat', actor: g.actor });
|
|
433
|
+
if (v.ok) { RSt.append(root, r.setup.id, { ev: 'accept', n: v.n, charts: [] }, { actor: g.actor }); RSt.writeBrief(root, r.setup.id, r.setup); structured = v.n; }
|
|
434
|
+
}
|
|
420
435
|
// The first cycle is drafted now, at the slot of its first scheduled draft, so the PM has a document to read the moment it is set up
|
|
421
436
|
// (the approved mockup's "Sample draft made when you set up"). The schedule later redrafts the same slot. A failed draft leaves the set-up
|
|
422
|
-
// in place and says why; Draft it now on the row tries again.
|
|
423
|
-
|
|
437
|
+
// in place and says why; Draft it now on the row tries again. A report with saved sections is drafted by the session that follows them.
|
|
438
|
+
let drafted = null;
|
|
439
|
+
if (structured != null && typeof ctx.structureDraft === 'function') {
|
|
440
|
+
let sd = null; try { sd = ctx.structureDraft(w, r.setup.id); } catch (e) { sd = { structured: true, status: 500, error: String((e && e.message) || e) }; }
|
|
441
|
+
if (sd && sd.structured) drafted = sd.status ? { error: sd.error } : { drafting: true, held: !!sd.held };
|
|
442
|
+
}
|
|
443
|
+
if (!drafted) drafted = firstDraft(root, r, g.actor);
|
|
424
444
|
if (drafted.path) ctx.invalidateNeedsAgg && ctx.invalidateNeedsAgg();
|
|
425
|
-
return send({ status: 200, body: { ok: true, setup: setupOut(r.setup, new Date(), documentsOf(ctx, w), copyIndex(root), root), first_draft: r.first_draft, drafted } });
|
|
445
|
+
return send({ status: 200, body: { ok: true, setup: setupOut(r.setup, new Date(), documentsOf(ctx, w), copyIndex(root), root), first_draft: r.first_draft, drafted, ...(structured != null ? { structure: structured } : {}) } });
|
|
426
446
|
}
|
|
427
447
|
if (sub === 'dismiss') {
|
|
428
448
|
const r = RS.dismissFinding(file, { id: text(body.finding), name: text(body.name), by: g.actor });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.481.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.481.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -49,6 +49,8 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
|
|
|
49
49
|
ok('H5 the CSP blocks every fetch and names no script host', /default-src 'none'/.test(M.FRAME_CSP) && /script-src 'unsafe-inline'$/.test(M.FRAME_CSP) && !/connect-src|https?:/.test(M.FRAME_CSP));
|
|
50
50
|
const src = M.fileHtml({ name: 'r.html', kind: 'html', text: '<b>"x"</b>', rel: 'r.html' });
|
|
51
51
|
ok('H5 the frame is sandboxed to scripts alone', /sandbox="allow-scripts"/.test(src) && !/allow-same-origin/.test(src), src);
|
|
52
|
+
const pdf = M.fileHtml({ name: 'deck.pdf', kind: 'pdf', src: '/api/asset?ws=w&path=planning%2Fdeck.pdf', rel: 'planning/deck.pdf' });
|
|
53
|
+
ok('H5b batch 22 item 12: a PDF shows in the browser\'s PDF viewer, from /api/asset, never "could not be shown"', /<iframe class="vwframe vwpdff"[^>]*src="\/api\/asset\?ws=w&path=planning%2Fdeck\.pdf#view=FitH"/.test(pdf) && !/could not be shown/.test(pdf) && M.downloadsOf({ name: 'deck.pdf', kind: 'pdf', src: 'x' }).length === 0, pdf);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
const exe = findBrowser();
|
|
@@ -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') {
|