create-pmos 0.413.0 → 0.414.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/AGENTS.md +2 -2
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/README.md +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +11 -5
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/pmos-log.sh +12 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +45 -9
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/changelog.json +12 -0
- package/workspace/guide/programs.md +13 -0
- package/workspace/guide/workflows.md +7 -0
- package/workspace/home-other-product-test.js +18 -0
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/headless.js +10 -1
- package/workspace/lib/initiative-chat.js +2 -1
- package/workspace/lib/milestone-review.js +120 -0
- package/workspace/lib/milestone-suggest.js +176 -0
- package/workspace/lib/pmos-verbs.js +6 -0
- package/workspace/lib/program-cli.js +56 -0
- package/workspace/lib/programs.js +4 -1
- package/workspace/lib/routes-boards.js +4 -2
- package/workspace/lib/routes-programs.js +73 -7
- package/workspace/lib/task-cli.js +120 -0
- package/workspace/milestone-suggest-test.js +175 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-line-test.js +3 -1
- package/workspace/public/pm/bd-ini-model.js +81 -0
- package/workspace/public/pm/bd-ini-panel.js +123 -58
- package/workspace/public/pm/bd-prog-panel.js +54 -14
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-panel.css +2 -0
- package/workspace/public/pm/cozy-viewer.js +2 -0
- package/workspace/public/pm/cozy-xv.css +51 -16
- package/workspace/public/pm/cozy-xv.js +6 -5
- package/workspace/public/pm/home-app.js +13 -11
- package/workspace/public/pm/home-ask.js +9 -3
- package/workspace/public/pm/home-chat.js +10 -1
- package/workspace/public/pm/home-list.js +12 -7
- package/workspace/public/pm/home-today.js +5 -8
- package/workspace/public/pm/ms-suggest.css +50 -0
- package/workspace/public/pm/ms-suggest.js +98 -0
- package/workspace/public/pm/premium-board.js +1 -1
- package/workspace/public/pm/premium-initiative-head.js +13 -4
- package/workspace/public/pm/program-charter.js +47 -7
- package/workspace/public/pm/program-model.js +4 -1
- package/workspace/public/pm/wf-page.js +3 -0
- package/workspace/server.js +23 -1
- package/workspace/skills/milestone-review.skill +53 -0
- package/workspace/test-lists/bd-ini-panel.json +5 -0
- package/workspace/test-lists/milestone-suggest.json +6 -0
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* lr({ title, sub, right, mk, tk, attrs }) one row in a section: a mark (mk 'warn' | 'done' | 'you' | 'task' | 'late'), the title (markup),
|
|
7
7
|
* one quiet line, an end value; tk makes it a press that opens that Jira ticket
|
|
8
|
-
* stageBar(steps, k, skipped, nowTitle)
|
|
9
|
-
* nowTitle is the current one's tooltip (its days in the step, and
|
|
8
|
+
* stageBar(steps, k, skipped, nowTitle, aria) one segment per step: the passed ones grey, the current one blue, the skipped ones hatched,
|
|
9
|
+
* a milestone (s.ms) a diamond; nowTitle is the current one's tooltip (its days in the step, and
|
|
10
|
+
* the usual days); every other bar names its stage on hover; aria replaces the default label
|
|
10
11
|
* chips(list) a wrap of quiet chips (markup strings)
|
|
11
12
|
* copyText(text, said) copies the text and says so in the page's toast (setSay) */
|
|
12
13
|
import { esc, toast } from './premium-shell.js';
|
|
@@ -20,10 +21,10 @@ export const lr = (o) => {
|
|
|
20
21
|
return `<${tag} class="xv-lr${o.tk ? ' go' : ''}"${o.tk ? ` data-tk="${esc(o.tk)}"` : ''}${o.attrs || ''}><span class="xv-mk${o.mk ? ' ' + o.mk : ''}" aria-hidden="true"></span>`
|
|
21
22
|
+ `<span class="w"><b>${o.title}</b>${o.sub ? `<span>${esc(o.sub)}</span>` : ''}</span>${o.right ? `<span class="r">${o.right}</span>` : ''}</${end}>`;
|
|
22
23
|
};
|
|
23
|
-
export function stageBar(steps, k, skipped, nowTitle) {
|
|
24
|
+
export function stageBar(steps, k, skipped, nowTitle, aria) {
|
|
24
25
|
const S = steps || [], sk = new Set(skipped || []);
|
|
25
|
-
const label = k >= 0 && S[k] ? 'Stage ' + (k + 1) + ' of ' + S.length + ', ' + S[k].label : 'No stage on record';
|
|
26
|
-
return `<div class="xv-stg" role="img" aria-label="${esc(label)}">${S.map((s, j) => `<i class="${[j < k && !sk.has(j) ? 'on' : '', j === k ? 'now' : '', sk.has(j) ? 'sk' : ''].filter(Boolean).join(' ')}" title="${esc(j === k && nowTitle ? nowTitle : s.label)}"></i>`).join('')}</div>`;
|
|
26
|
+
const label = aria || (k >= 0 && S[k] ? 'Stage ' + (k + 1) + ' of ' + S.length + ', ' + S[k].label : 'No stage on record');
|
|
27
|
+
return `<div class="xv-stg" role="img" aria-label="${esc(label)}">${S.map((s, j) => `<i class="${[j < k && !sk.has(j) ? 'on' : '', j === k ? 'now' : '', sk.has(j) ? 'sk' : '', s.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(j === k && nowTitle ? nowTitle : s.label + (sk.has(j) ? ' · skipped' : j < k ? ' · done' : ''))}"></i>`).join('')}</div>`;
|
|
27
28
|
}
|
|
28
29
|
export const chips = (list) => (list && list.length ? `<div class="xv-chips">${list.join('')}</div>` : '');
|
|
29
30
|
let say = toast;
|
|
@@ -87,14 +87,14 @@ const S = {
|
|
|
87
87
|
doneOpen: false, stepsMore: false, sheet: false, rec: {}, pin: new Set(JSON.parse(store.get('pmos.home.pin') || '[]')),
|
|
88
88
|
cardFold: store.get('pmos.home.cardfold') === '1', // the card's checklist folded to one line (AgInitSpec), kept in this browser
|
|
89
89
|
// the one list (premium-uncovered-features): the filter, the picked product, which groups and initiatives are open, kept in this browser
|
|
90
|
-
filter: 'today', product: store.get('pmos.home.product') || null, kidsOff: new Set(), rest: new Set(),
|
|
90
|
+
filter: 'today', product: store.get('pmos.home.product') || null, kidsOff: new Set(), rest: new Set(), cap: false, day: false,
|
|
91
91
|
pg: (() => { try { return JSON.parse(store.get('pmos.home.pg') || '{}') || {}; } catch { return {}; } })(),
|
|
92
92
|
eodHidden: store.get('pmos.home.eod') === L.dayOf(), phoneChat: false,
|
|
93
93
|
};
|
|
94
94
|
// every fold of the list is kept in this browser (HvAC: "every group can be hidden or shown, and the choice is remembered"): the groups in
|
|
95
95
|
// pmos.home.pg, an initiative's rows and its "N more" in pmos.home.kids
|
|
96
|
-
(() => { try { const k = JSON.parse(store.get('pmos.home.kids') || '{}') || {}; for (const [n, v] of [['on', S.kids], ['off', S.kidsOff], ['rest', S.rest]
|
|
97
|
-
const keepKids = () => store.set('pmos.home.kids', JSON.stringify({ on: [...S.kids], off: [...S.kidsOff], rest: [...S.rest]
|
|
96
|
+
(() => { try { const k = JSON.parse(store.get('pmos.home.kids') || '{}') || {}; for (const [n, v] of [['on', S.kids], ['off', S.kidsOff], ['rest', S.rest]]) for (const x of k[n] || []) v.add(x); } catch { /* none kept */ } })();
|
|
97
|
+
const keepKids = () => store.set('pmos.home.kids', JSON.stringify({ on: [...S.kids], off: [...S.kidsOff], rest: [...S.rest] }));
|
|
98
98
|
const toast = (t) => { const el = $('#toast'); el.classList.remove('act'); el.textContent = t; el.classList.add('on'); clearTimeout(toast.t); toast.t = setTimeout(() => el.classList.remove('on'), 4200); };
|
|
99
99
|
/** The toast with Undo (RnASaved: "Renamed · Undo"), the shape home-work.js draws: undo() runs the write's opposite once. */
|
|
100
100
|
function toastUndo(msg, undo) {
|
|
@@ -255,7 +255,7 @@ function homeListHtml() {
|
|
|
255
255
|
// a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
|
|
256
256
|
const pOpen = (g) => (g.key in S.pg ? !!S.pg[g.key] : g.kind === 'loose' ? !isPhone() : g.kind === 'program' || g.primary || M.products.length === 1 || (!!S.product && !!g.product && S.product === g.product.key));
|
|
257
257
|
return TD.listHtml(M, todayModel(), {
|
|
258
|
-
sel: S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null), selHead: S.head, isOpen: open, pOpen, restOpen: (k) => S.rest.has(k), cap: S.cap,
|
|
258
|
+
sel: S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null), selHead: S.head, isOpen: open, pOpen, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
|
|
259
259
|
product: S.product, review: R, mic: canDictate(), phone: isPhone(), day: S.day, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
|
|
260
260
|
});
|
|
261
261
|
}
|
|
@@ -413,9 +413,9 @@ function draw() { drawList(); drawTop(); chat.refresh(); }
|
|
|
413
413
|
function allRows() {
|
|
414
414
|
const out = [];
|
|
415
415
|
const M = S.M || L.homeList(S.D, { now: NOW() });
|
|
416
|
-
const add = (r) => { if (!r) return; out.push(r); (r.kids || []).forEach(add); };
|
|
416
|
+
const add = (r) => { if (!r) return; out.push(r); (r.kids || []).forEach(add); (r.tasks || []).forEach(add); };
|
|
417
417
|
H.needsOf(S.D).forEach(add);
|
|
418
|
-
for (const g of M.groups) { (g.flat || []).forEach(add); (g.inis || []).forEach(add); (g.rest || []).forEach(add); (g.rows || []).forEach(add); (g.tasks || []).forEach(add); }
|
|
418
|
+
for (const g of M.groups) { (g.flat || []).forEach(add); (g.inis || []).forEach(add); (g.rest || []).forEach(add); (g.rows || []).forEach(add); (g.tasks || []).forEach(add); add(g.msRow); }
|
|
419
419
|
if (M.list) M.list.rows.forEach(add);
|
|
420
420
|
if (S.filter !== 'today') { const T = L.homeList(S.D, { now: NOW() }); T.groups.forEach((g) => { (g.rows || []).forEach(add); (g.inis || []).concat(g.rest || []).forEach(add); }); }
|
|
421
421
|
for (const s of S.D.sessions) { const r = { id: 's:' + s.id, kind: 'session', sid: s.id, key: H.keyOfSession(s), ini: H.iniOfSession(s), name: H.nameOf(s), role: H.roleOf(s, S.D.desk && S.D.desk.roles), state: s.shown }; out.push(r); }
|
|
@@ -685,6 +685,7 @@ function select(id, o = {}) {
|
|
|
685
685
|
if (!r) { S.phoneChat = false; if (S.ini) openTarget(iniTarget(S.ini)); else openTarget(homeTarget()); drawList(); return; }
|
|
686
686
|
if (r.kind === 'ini') { goIni(r.ini); return; }
|
|
687
687
|
if (r.kind === 'product') { goIni('product'); return; }
|
|
688
|
+
if (r.kind === 'msreview') { goProgram(r.program); return; } // Claude's milestone changes: the program panel, where they lead Waits on you
|
|
688
689
|
S.head = null;
|
|
689
690
|
// a row with a conversation opens it; on a phone it opens over the list, with a back bar (HmPhone2)
|
|
690
691
|
if (isPhone() && (r.kind === 'update' || (r.kind === 'need' && r.row) || r.kind === 'session' || r.needSession)) S.phoneChat = true;
|
|
@@ -745,7 +746,10 @@ function goOtherProduct(g) {
|
|
|
745
746
|
render: (b) => {
|
|
746
747
|
const goals = C.items.map((x) => itemHtml({ kind: x.kind === 'ok' ? 'done' : 'risk', label: x.label })).join('') || '<p class="hm-none">No KR or budget is anchored on this board.</p>';
|
|
747
748
|
b.innerHTML = `<div class="hi-v hi-page"><section class="hi-pg" aria-label="Goals"><div class="hi-pgh"><b>Goals</b><span class="hi-n">${esc(C.of)}</span></div>${goals}</section>`
|
|
748
|
-
+ `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div><div class="hm-r hi-r"><a class="hm-rm" href="${esc(own)}" target="_blank" rel="noopener"><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>Weekly update and metrics review</b><em class="q">In ${esc(name)}'s own Home, in a new tab</em></span></a></div></section
|
|
749
|
+
+ `<section class="hi-pg" aria-label="This week"><div class="hi-pgh"><b>This week</b></div><div class="hm-r hi-r"><a class="hm-rm" href="${esc(own)}" target="_blank" rel="noopener"><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>Weekly update and metrics review</b><em class="q">In ${esc(name)}'s own Home, in a new tab</em></span></a></div></section>`
|
|
750
|
+
+ (isPhone() ? `<button type="button" class="hi-talk" data-hp="talk">Message Claude about ${esc(name)}</button>` : '') + '</div>';
|
|
751
|
+
// a phone has no chat beside the page: its own chat is one press away, as on the board's own product (Wawan, 2026-10-25)
|
|
752
|
+
b.onclick = (e) => { const t = e.target.closest('[data-hp="talk"]'); if (t) talk(); };
|
|
749
753
|
} });
|
|
750
754
|
}
|
|
751
755
|
/** A program heading's name: the program panel in the Viewer, the program's own chat (HbCProg). */
|
|
@@ -1343,7 +1347,6 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
1343
1347
|
}
|
|
1344
1348
|
if (d.hmPg) { const open = b.getAttribute('aria-expanded') === 'true'; S.pg[d.hmPg] = !open; store.set('pmos.home.pg', JSON.stringify(S.pg)); drawList(); const f = $(`#hmList [data-hm-pg="${CSS.escape(d.hmPg)}"]`); if (f) f.focus(); return; }
|
|
1345
1349
|
if ('hmProd' in d) { goIni('product'); return; }
|
|
1346
|
-
if (d.hmTasks) { if (S.tasks.has(d.hmTasks)) S.tasks.delete(d.hmTasks); else S.tasks.add(d.hmTasks); keepKids(); drawList(); return; }
|
|
1347
1350
|
if (d.hmRest) { if (S.rest.has(d.hmRest)) S.rest.delete(d.hmRest); else S.rest.add(d.hmRest); keepKids(); drawList(); return; }
|
|
1348
1351
|
if (d.hmFilter) { S.filter = S.filter === d.hmFilter ? 'today' : d.hmFilter; drawList(); const f = $(`#hmList [data-hm-filter="${d.hmFilter}"]`); if (f) f.focus(); return; }
|
|
1349
1352
|
if (d.hmCheck) { checkRow(d.hmCheck); return; }
|
|
@@ -1430,7 +1433,7 @@ mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni:
|
|
|
1430
1433
|
/* The program panel in Home's Viewer (HbCProg): Home's board model and programs; an initiative of it opens here, with ← back to the program.
|
|
1431
1434
|
* Read on the first program press, never at start: the panel's modules load premium-shell.js, whose start reads ?session= for the old dialog. */
|
|
1432
1435
|
let progPanel = null;
|
|
1433
|
-
const programPanel = () => progPanel || (progPanel = import('./bd-prog-panel.js').then((PP) => { PP.mount({ M: () => S.D.board, programs: () => S.D.programs || [], openIni: (id) => goIni(id), close: () => {}, reload: () => load(), say: (m) => toast(m), drill: true }); return PP; }));
|
|
1436
|
+
const programPanel = () => progPanel || (progPanel = import('./bd-prog-panel.js').then((PP) => { PP.mount({ M: () => S.D.board, programs: () => S.D.programs || [], openIni: (id) => goIni(id), close: () => {}, reload: () => load(), say: (m) => toast(m), drill: true, talk: () => (isPhone() ? talk : null) }); return PP; }));
|
|
1434
1437
|
PO.mount({ programs: () => S.D.programs || [], stateOf: (p) => (((S.M && S.M.groups) || []).find((g) => g.kind === 'program' && g.program.id === p.id) || {}).st || null,
|
|
1435
1438
|
saved: (p) => { const L2 = S.D.programs || [], i = L2.findIndex((x) => x.id === p.id); if (i >= 0) L2[i] = { ...L2[i], ...p }; drawList(); },
|
|
1436
1439
|
say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)), openIni: (id) => goIni(id) });
|
|
@@ -1466,9 +1469,8 @@ load().then(() => {
|
|
|
1466
1469
|
const about = KEY.test(P.get('about') || '') ? P.get('about') : KEY.test(asked) ? asked : null;
|
|
1467
1470
|
if (isPhone() && ((open && !blockOpen) || sid || about)) { S.phoneChat = true; drawList(); } // the conversation the address names, not the list
|
|
1468
1471
|
if (open && !blockOpen) {
|
|
1469
|
-
// ?item=pt:<program>:<key> (the program panel's link to a program task) names the row by its id;
|
|
1472
|
+
// ?item=pt:<program>:<key> (the program panel's link to a program task) names the row by its id; Home lists no task, so the chat opens
|
|
1470
1473
|
const r = allRows().find((x) => x.key === open || (/^pt:/.test(open) && x.id === open));
|
|
1471
|
-
if (r && r.kind === 'ptask') { S.pg['g:' + r.program] = true; drawList(); }
|
|
1472
1474
|
if (r) select(r.id); else if (KEY.test(open)) openTarget({ ...homeTarget(), key: open, title: open });
|
|
1473
1475
|
}
|
|
1474
1476
|
else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
|
|
@@ -23,6 +23,7 @@ export const ICON = {
|
|
|
23
23
|
again: 'M4 12a8 8 0 1 0 2.3-5.6M4 4v4.5h4.5',
|
|
24
24
|
to: 'M5 12h14M13 6l6 6-6 6',
|
|
25
25
|
dots: 'M5 12h.01M12 12h.01M19 12h.01',
|
|
26
|
+
term: 'M4 5h16v14H4zM8 10l3 2-3 2M13 15h3',
|
|
26
27
|
};
|
|
27
28
|
const svg = (d, w = 2) => `<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${w}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"></path></svg>`;
|
|
28
29
|
/** One answer as an icon button. a = { icon, label, attr, pri }. */
|
|
@@ -37,11 +38,16 @@ export function permissionAsk(conv) {
|
|
|
37
38
|
const c = conv || {};
|
|
38
39
|
if (c.state === 'ended' || !c.ask) return null;
|
|
39
40
|
const opts = Array.isArray(c.ask.options) ? c.ask.options : [];
|
|
40
|
-
|
|
41
|
+
const ch = c.change || null;
|
|
42
|
+
// a prompt whose choices PMOS could not read still asks: the card says what it can and the answer is in the terminal (never a blue line
|
|
43
|
+
// with nothing under it)
|
|
44
|
+
if (!opts.length) {
|
|
45
|
+
return { kind: 'file', label: 'Asks before it goes on', title: (ch && ch.what) || clip(c.ask.question, 200) || 'Its terminal waits for your answer',
|
|
46
|
+
from: '', to: '', answers: [{ icon: 'term', label: 'Answer in its terminal', attr: 'data-hm-term', pri: true }], more: [] };
|
|
47
|
+
}
|
|
41
48
|
const deny = opts.find((o) => /^no\b/i.test(o.label)) || opts[opts.length - 1];
|
|
42
49
|
const allow = opts[0];
|
|
43
50
|
const more = opts.filter((o) => o !== allow && o !== deny);
|
|
44
|
-
const ch = c.change || null;
|
|
45
51
|
const send = !!ch && OUTSIDE.test(ch.system || '') && WRITE.test(ch.tool || '');
|
|
46
52
|
const verb = ch && ch.tool && !/^mcp__/.test(ch.tool) ? ch.tool + ' ' : '';
|
|
47
53
|
return {
|
|
@@ -115,7 +121,7 @@ export function openAsk(conv) {
|
|
|
115
121
|
const m = ms[i];
|
|
116
122
|
if (m.role === 'user') return false;
|
|
117
123
|
if (m.role === 'tool' && m.ask) return true;
|
|
118
|
-
if (m.role === 'assistant') return !!splitAsk(m.text).block;
|
|
124
|
+
if (m.role === 'assistant') return !!blockAsk(splitAsk(m.text).block); // only a block that draws a card
|
|
119
125
|
}
|
|
120
126
|
return false;
|
|
121
127
|
}
|
|
@@ -261,7 +261,16 @@ export function mountChat(el, host) {
|
|
|
261
261
|
if (k === 'all') { C.plAll = true; drawLine(); return; }
|
|
262
262
|
if (k === 'toggle') {
|
|
263
263
|
const m = lineModel();
|
|
264
|
-
if (m && m.tone === 'you') {
|
|
264
|
+
if (m && m.tone === 'you') {
|
|
265
|
+
// the card that asks; a goal that waits on the PM asks in Claude's newest message, so that one, with the box ready for the answer.
|
|
266
|
+
// Only with neither does the tap open the goal as on a working line (a tap is never silent: feedback batch 4, item 3)
|
|
267
|
+
const a = [...log.querySelectorAll('.hm-askw, .hm-askc, .hm-a.ask')].pop() || [...log.querySelectorAll('.hm-a')].pop();
|
|
268
|
+
if (a) {
|
|
269
|
+
a.scrollIntoView({ block: 'center', behavior: 'smooth' }); a.classList.remove('hm-flash'); void a.offsetWidth; a.classList.add('hm-flash');
|
|
270
|
+
if (!a.querySelector('.hm-askk') && host.desk()) { const box = el.querySelector('textarea'); if (box) box.focus({ preventScroll: true }); }
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
265
274
|
if (host.desk()) { if (vwShows()) window.czViewer.close(); else openGoal(); return; }
|
|
266
275
|
C.plOpen = !C.plOpen; drawLine();
|
|
267
276
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* the other products), phoneDay (GET /api/phone-day), review (GET /api/home-review) }. A part that did not answer is left out, never guessed. */
|
|
18
18
|
import { needsOf, boardRows, productCard, productName, sessionRow, nameOf, iniOfSession, todayOf, live, OPEN, hm } from './home-data.js';
|
|
19
19
|
import { programState, groupRows } from './program-model.js';
|
|
20
|
+
import { homeSub } from './ms-suggest.js';
|
|
20
21
|
import { STEPS, stageKey } from './premium-initiative-head.js';
|
|
21
22
|
|
|
22
23
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
@@ -68,7 +69,6 @@ export function productsOf(D) {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
/* ── rows ── */
|
|
71
|
-
export const TASKS_SHOWN = 3;
|
|
72
72
|
function taskHint(t, now, mine) {
|
|
73
73
|
const d = t.end ? dayDiff(t.end, now) : null;
|
|
74
74
|
const when = d == null ? '' : d === 0 ? 'due today' : d === 1 ? 'due tomorrow' : d < 0 ? plural(-d, 'day', 'days') + ' late' : 'due ' + shortDay(t.end);
|
|
@@ -117,10 +117,11 @@ function iniRowOf(D, r, needs, now) {
|
|
|
117
117
|
const mine = tasks.filter((t) => t.mine).length;
|
|
118
118
|
const run = ses.filter((s) => s.state === 'working').length;
|
|
119
119
|
const right = turn ? 'your turn' + (mine ? ' · ' + plural(mine, 'task', 'tasks') : '') : mine ? plural(mine, 'task', 'tasks') : run ? run + ' running' : 'Nothing today';
|
|
120
|
-
// next steps, sessions and today's meetings
|
|
121
|
-
|
|
120
|
+
// next steps, sessions and today's meetings sit under the initiative; its tasks do not (Wawan, 2026-10-25: Home lists no tasks, the
|
|
121
|
+
// initiative's page in the Viewer holds them). The row keeps them for Your move, where the PM's own late ones still lead
|
|
122
|
+
const kids = [...steps, ...ses.sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0)), ...meet];
|
|
122
123
|
const hint = [(r.wf && r.wf.name) || 'Product feature', r.stage].filter(Boolean).join(' · '); // D99: Kind becomes Workflow
|
|
123
|
-
return { id: 'i:' + r.id, kind: 'ini', ini: r.id, name: r.title, hint, right, turn, busy: kids.length > 0, state: turn ? 'needs' : run ? 'working' : 'quiet', kids, board: r, updated: r.updated || '',
|
|
124
|
+
return { id: 'i:' + r.id, kind: 'ini', ini: r.id, name: r.title, hint, right, turn, busy: kids.length > 0, state: turn ? 'needs' : run ? 'working' : 'quiet', kids, tasks, board: r, updated: r.updated || '',
|
|
124
125
|
stage: r.stage || '', at: rowAt(r), steps: ownSteps(r), yours: kids.filter(isMove).length, late: kids.some((k) => k.kind === 'task' && k.mine && k.late) };
|
|
125
126
|
}
|
|
126
127
|
|
|
@@ -162,8 +163,11 @@ export function programGroups(D, groups, products, o, now) {
|
|
|
162
163
|
if (!inis.length && !tasks.length && !fresh) continue;
|
|
163
164
|
const st = programState(pr, rowsOf, now);
|
|
164
165
|
const turnN = inis.filter((x) => x.turn).length;
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
// Claude's milestone changes wait on the PM: one Your move line per program, never one per change (canvas XmsgB, Home frame)
|
|
167
|
+
const msSub = homeSub(pr);
|
|
168
|
+
const msRow = msSub ? { id: 'ms:' + pr.id, kind: 'msreview', program: pr.id, name: pr.title, hint: msSub, state: 'needs' } : null;
|
|
169
|
+
out.push({ key: 'g:' + pr.id, kind: 'program', program: pr, st, name: pr.title, subs, inis, rest: [], tasks, count: inis.length, turnN, msRow,
|
|
170
|
+
yours: inis.reduce((n, x) => n + x.yours, 0) + tasks.filter((t) => t.mine && t.late).length + (msRow ? 1 : 0), late: inis.some((x) => x.late) || tasks.some((t) => t.late),
|
|
167
171
|
products: st.products, closedLine: closedOf(inis.length, turnN) });
|
|
168
172
|
}
|
|
169
173
|
return out;
|
|
@@ -248,8 +252,9 @@ function moveOf(groups, needs) {
|
|
|
248
252
|
for (const g of groups) {
|
|
249
253
|
if (g.kind === 'loose') { for (const r of g.rows) if (r.check && r.late) put(late, r); else if (r.state === 'needs' || r.state === 'blocked') put(rest, r, r.kind === 'session' ? '' : bareHint(r)); continue; }
|
|
250
254
|
for (const t of g.tasks || []) if (t.mine && t.late) put(late, t, g.name);
|
|
255
|
+
if (g.msRow) put(rest, g.msRow, g.msRow.hint);
|
|
251
256
|
for (const r of g.flat || []) put(rest, r, '');
|
|
252
|
-
for (const i of (g.inis || []).concat(g.rest || [])) for (const k of i.kids) if (isMove(k)) put(k.kind === 'task' ? late : rest, k, i.name);
|
|
257
|
+
for (const i of (g.inis || []).concat(g.rest || [])) for (const k of i.kids.concat(i.tasks || [])) if (isMove(k)) put(k.kind === 'task' ? late : rest, k, i.name);
|
|
253
258
|
}
|
|
254
259
|
for (const r of needs) if (!seen.has(r.id) && !r.needSession) put(rest, r, r.kind === 'session' ? '' : bareHint(r));
|
|
255
260
|
return late.concat(rest);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* more than one product, on a desktop the filter icon for Kept and Done, New), the "N are yours" line, the Today card only while the day has
|
|
6
6
|
* a moment (a recording, a meeting soon or on now, the end of the day, the weekly review open), each program's group, then each product's
|
|
7
7
|
* group (an initials tile, the name, the goal dots, a chevron; one-line rows with the stage track on the right; sessions, next steps and
|
|
8
|
-
*
|
|
8
|
+
* meetings indented under their initiative; its tasks are on its page in the Viewer, not here), and "Not in an initiative" as a folded line. Your day (dayHtml) is a sheet over the list: the date
|
|
9
9
|
* and the day's meetings, Your move with its count, and This week with the Weekly review. Every group folds; home-app.js keeps the folds.
|
|
10
10
|
* The model is home-list.js (pure). This file only turns it into HTML: every control is a <button> (or the capture form) with a data-hm-*
|
|
11
11
|
* press that home-app.js handles. Text from the records goes through esc(). */
|
|
@@ -78,13 +78,10 @@ export function chatHeadHtml(h) {
|
|
|
78
78
|
return `${mk}${same ? lead : ''}${name}${same && !h.prog ? track(h.at == null ? -1 : h.at, h.stage || '', h.steps) : ''}${chip}`;
|
|
79
79
|
}
|
|
80
80
|
/** An initiative row: its mark, its title, the count of what is yours while it is folded, the stage track, and a chevron when something
|
|
81
|
-
* sits under it. The title opens the initiative; the chevron shows or hides its sessions, next steps
|
|
81
|
+
* sits under it. The title opens the initiative; the chevron shows or hides its sessions, next steps and meetings. */
|
|
82
82
|
function iniHtml(r, o, po) {
|
|
83
83
|
const open = o.isOpen(r.id);
|
|
84
|
-
const
|
|
85
|
-
const kids = all ? r.kids : r.kids.filter((k) => !k.extra);
|
|
86
|
-
const more = hid ? `<button type="button" class="hv-fold kid" data-hm-tasks="${esc(r.id)}" aria-expanded="${all}"><span class="hv-mk"></span>${all ? 'Fewer' : hid + ' more'}${svg(all ? P.chevU : P.chevD, 15)}</button>` : '';
|
|
87
|
-
const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${kids.map((k) => rowHtml(k, { ...o, kid: true })).join('')}${more}</div>` : '';
|
|
84
|
+
const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${r.kids.map((k) => rowHtml(k, { ...o, kid: true })).join('')}</div>` : '';
|
|
88
85
|
const badge = !open && r.yours ? `<span class="hv-c" role="img" aria-label="${r.yours === 1 ? '1 is yours' : r.yours + ' are yours'}">${r.yours}</span>` : '';
|
|
89
86
|
const chev = r.kids.length ? `<button type="button" class="hv-xc" data-hm-kids="${esc(r.id)}" aria-expanded="${open}" aria-label="${open ? 'Hide' : 'Show'} what is in ${esc(r.name)}">${svg(open ? P.chevD : P.chevR, 15)}</button>` : '<span class="hv-xc" aria-hidden="true"></span>';
|
|
90
87
|
return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"${po ? ` data-po-id="${esc(r.ini || r.id)}"` : ''}>${po ? gripHtml(r.name) : ''}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${o.sel === r.id ? ' aria-current="true"' : ''} title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
|
|
@@ -129,8 +126,8 @@ function programHtml(g, o) {
|
|
|
129
126
|
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
130
127
|
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
|
|
131
128
|
if (!open) return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}</section>`;
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
// the program's tasks are on its panel (On the program), not on Home: Home lists no tasks (Wawan, 2026-10-25)
|
|
130
|
+
const body = g.subs.map((x) => `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div><div class="po-list" data-po-list="${esc(g.program.id)}">${x.inis.map((r) => iniHtml(r, o, true)).join('')}</div>`).join('');
|
|
134
131
|
return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}<div class="hv-card">${body || `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`}</div></section>`;
|
|
135
132
|
}
|
|
136
133
|
/** "Not in an initiative" (HvAC .lh): a line under the groups. Folded it shows a blue dot when a row waits on you, an amber square when one
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* pm/ms-suggest.css — Claude's milestone suggestions (pm/ms-suggest.js; canvas XmsgB). ms-suggest.js loads it once, so it works wherever the
|
|
2
|
+
* program panel opens (Board, Home). Token vars only, over pm/cozy.css; the program's purple falls back to the frames' when the page sets none.
|
|
3
|
+
* Quiet: no motion. Every class starts with msg-. */
|
|
4
|
+
.msg-box, .msg-list { --msg-prog: var(--pp-prog, var(--cz-c-6b4fa3)); --msg-progbg: var(--pp-progbg, rgba(107,79,163,.10)); }
|
|
5
|
+
.msg-box { border: 1px dashed color-mix(in srgb, var(--msg-prog) 45%, transparent); border-radius: 16px; overflow: hidden; }
|
|
6
|
+
.msg-hd { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; background: var(--msg-progbg); font-size: 12.5px; color: var(--cz-ink2); }
|
|
7
|
+
.msg-ht { flex: 1; min-width: 0; }
|
|
8
|
+
.msg-ht b { color: var(--msg-prog); font-weight: 700; }
|
|
9
|
+
.msg-list { display: flex; flex-direction: column; }
|
|
10
|
+
.msg-r { display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px; }
|
|
11
|
+
.msg-box .msg-r + .msg-r, .msg-box .msg-hd + div .msg-r:first-child { border-top: 1px dashed color-mix(in srgb, var(--msg-prog) 25%, transparent); }
|
|
12
|
+
.msg-list .msg-r + .msg-r { border-top: 1px solid color-mix(in srgb, var(--cz-ink) 8%, transparent); }
|
|
13
|
+
.msg-mk { color: var(--msg-prog); display: inline-flex; flex: none; padding-top: 2px; }
|
|
14
|
+
.msg-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
|
|
15
|
+
.msg-h { display: flex; gap: 8px; align-items: baseline; width: 100%; }
|
|
16
|
+
.msg-h b { font-size: 13px; font-weight: 700; color: var(--cz-ink); flex: 1; min-width: 0; }
|
|
17
|
+
.msg-d { font-size: 12px; font-weight: 700; color: var(--cz-ink2); white-space: nowrap; }
|
|
18
|
+
.msg-w { font-size: 12px; color: var(--cz-ink3); line-height: 1.4; }
|
|
19
|
+
.msg-src { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--cz-ink2); background: var(--cz-well); border-radius: 999px; padding: 2px 8px; }
|
|
20
|
+
.msg-src svg { color: var(--cz-ink3); }
|
|
21
|
+
.msg-gd { width: 7px; height: 7px; transform: rotate(45deg); border-radius: 2px; background: var(--msg-prog); display: inline-block; }
|
|
22
|
+
.msg-ends { display: inline-flex; align-items: center; gap: 2px; flex: none; }
|
|
23
|
+
.msg-ok, .msg-ib { all: unset; box-sizing: border-box; cursor: pointer; width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
|
|
24
|
+
.msg-ok { background: var(--msg-prog); color: var(--cz-card); }
|
|
25
|
+
.msg-ib { color: var(--cz-ink3); }
|
|
26
|
+
@media (hover: hover) { .msg-ib:hover { background: var(--cz-well); color: var(--cz-ink); } .msg-ok:hover { filter: brightness(1.08); } }
|
|
27
|
+
.msg-ok:focus-visible, .msg-ib:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
28
|
+
.msg-ok[disabled], .msg-ib[disabled] { opacity: .45; cursor: default; }
|
|
29
|
+
/* a phone: the touch target grows to 44 px; the row wraps its presses under the text when it is narrow */
|
|
30
|
+
@media (max-width: 760px) { .msg-ok, .msg-ib { width: 40px; height: 40px; } .msg-r { flex-wrap: wrap; } }
|
|
31
|
+
/* in Waits on you (blue well): the rows sit on the card */
|
|
32
|
+
.pp-needs .msg-list { background: var(--cz-card); border-radius: 12px; margin-bottom: 4px; }
|
|
33
|
+
|
|
34
|
+
/* the charter: last checked and Check now (XmsgB, last frame), and the change filled in from the pencil */
|
|
35
|
+
.msg-chk { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--cz-ink3); }
|
|
36
|
+
.msg-chk span { flex: 1; min-width: 0; }
|
|
37
|
+
.msg-chk .msg-ib { width: 28px; height: 28px; }
|
|
38
|
+
.msg-chk .msg-ib.on svg { animation: msg-spin 1.2s linear infinite; }
|
|
39
|
+
@keyframes msg-spin { to { transform: rotate(360deg); } }
|
|
40
|
+
@media (prefers-reduced-motion: reduce) { .msg-chk .msg-ib.on svg { animation: none; } }
|
|
41
|
+
.msg-risk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--cz-risk); }
|
|
42
|
+
.msg-risk span { flex: 1; min-width: 0; }
|
|
43
|
+
.msg-risk { margin: 4px 0 0 30px; }
|
|
44
|
+
.msg-risk i { width: 7px; height: 7px; border-radius: 50%; background: var(--pc-amberdot, var(--cz-risk)); flex: none; }
|
|
45
|
+
.msg-risk .pc-ib { width: 28px; height: 28px; }
|
|
46
|
+
.msg-chg { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0 0 30px; font-size: 12px; color: var(--cz-ink2); }
|
|
47
|
+
.msg-chg svg { color: var(--pp-prog, var(--cz-c-6b4fa3)); flex: none; margin-top: 1px; }
|
|
48
|
+
.pc-lnw.msg-on > .pc-ln { border: 1px dashed color-mix(in srgb, var(--pp-prog, var(--cz-c-6b4fa3)) 45%, transparent); border-radius: 14px; }
|
|
49
|
+
.pc-ms > .msg-chg { margin: 0 0 8px; }
|
|
50
|
+
.pc-ms > .msg-chk { margin: 0 0 8px; }
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* pm/ms-suggest.js — Claude's milestone suggestions on the program panel and on Home (feedback batch 4 item 6; canvas XmsgB, sticky xmsgRules).
|
|
2
|
+
*
|
|
3
|
+
* openOf(p) the suggestions that wait on the PM (GET /api/programs' p.review.open), [] when none
|
|
4
|
+
* words(p, i) one suggestion in words: { title, day, why, src, op }
|
|
5
|
+
* firstHtml(p, L) a program with no milestones: Claude's first suggestions where "Add the first milestone" was (XmsgB, first frame)
|
|
6
|
+
* rowsHtml(p, L) later changes, as rows at the top of Waits on you (XmsgB, second frame)
|
|
7
|
+
* homeSub(p) Home's Your move line under the program's name: "3 milestone changes · Pilot live to Dec 2", '' when none
|
|
8
|
+
* factsOf(st, milestoneStep) the ◆ dates of the program's initiatives as one string, for POST /api/programs/facts (a moved date asks Claude once)
|
|
9
|
+
* answer(pmPost, p, key, a) POST /api/programs/suggestion: keep (written at once), edit (saved from the charter), decline
|
|
10
|
+
*
|
|
11
|
+
* Every press is icon-only: ✓ keeps, the pencil opens the charter with the change filled in, ✕ drops it (Claude does not ask again unless the
|
|
12
|
+
* source changes). A row says why and where it came from. Nothing shows when there is nothing to suggest (zero is silence). The presses carry
|
|
13
|
+
* data-ms-act and data-key; the panel handles them. */
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
15
|
+
const SV = (d, w, sw) => `<svg viewBox="0 0 24 24" width="${w || 16}" height="${w || 16}" fill="none" stroke="currentColor" stroke-width="${sw || 1.8}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
16
|
+
const I = {
|
|
17
|
+
check: 'M5 12l5 5 9-10', pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4', x: 'M6 6l12 12M18 6L6 18',
|
|
18
|
+
spark: 'M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5L18 18M6 18l2.5-2.5M15.5 8.5L18 6',
|
|
19
|
+
cal: 'M4 6h16v14H4zM4 10h16M8 3v4M16 3v4', mic: 'M12 3a3 3 0 0 1 3 3v5a3 3 0 0 1-6 0V6a3 3 0 0 1 3-3zM5 11a7 7 0 0 0 14 0M12 18v3',
|
|
20
|
+
tk: 'M4 6h16v12H4zM8 10h8M8 14h5', dot: 'M12 12h.01',
|
|
21
|
+
};
|
|
22
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
23
|
+
const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
24
|
+
/** "Nov 14" this year, "Feb 20, 2027" another year. */
|
|
25
|
+
export function shortDate(iso, now = Date.now()) {
|
|
26
|
+
const d = dayOf(iso); if (!d) return '';
|
|
27
|
+
return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== new Date(now).getFullYear() ? ', ' + d.getFullYear() : '');
|
|
28
|
+
}
|
|
29
|
+
const list = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
|
|
30
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
31
|
+
(function sheet() { // once, at import: the panel opens on the Board and in Home's Viewer, and the look must come with it on both
|
|
32
|
+
if (typeof document === 'undefined' || !document.head || typeof document.getElementById !== 'function' || document.getElementById('msgCss')) return;
|
|
33
|
+
const l = document.createElement('link'); l.id = 'msgCss'; l.rel = 'stylesheet';
|
|
34
|
+
try { l.href = new URL('./ms-suggest.css', import.meta.url).href; } catch { l.href = '/pm/ms-suggest.css'; }
|
|
35
|
+
document.head.appendChild(l);
|
|
36
|
+
})();
|
|
37
|
+
|
|
38
|
+
export const openOf = (p) => ((p && p.review && Array.isArray(p.review.open)) ? p.review.open : []);
|
|
39
|
+
const msOf = (p, id) => ((p && p.milestones) || []).find((m) => m.id === id) || null;
|
|
40
|
+
export function words(p, i, now) {
|
|
41
|
+
const m = i.milestone ? msOf(p, i.milestone) : null, name = (m && m.name) || i.name || 'A milestone';
|
|
42
|
+
const title = i.op === 'add' ? i.name
|
|
43
|
+
: i.op === 'move' ? 'Move ' + name + ' to ' + shortDate(i.date, now)
|
|
44
|
+
: i.op === 'rename' ? 'Rename ' + name + ' to ' + i.name
|
|
45
|
+
: i.op === 'drop' ? 'Drop ' + name
|
|
46
|
+
: 'Mark ' + name + ' at risk';
|
|
47
|
+
return { op: i.op, title, day: i.op === 'add' ? shortDate(i.date, now) : '', why: i.why, src: i.src || { kind: '', label: '' } };
|
|
48
|
+
}
|
|
49
|
+
const SRC_ICON = { jira: I.tk, meeting: I.mic, task: I.tk, target: I.cal, deliver: '', member: '', charter: '' };
|
|
50
|
+
function srcHtml(s) {
|
|
51
|
+
if (!s || !s.label) return '';
|
|
52
|
+
// an initiative or a ◆ date carries the program's diamond; Jira and tasks a ticket; meetings a mic; the target a calendar
|
|
53
|
+
const mark = SRC_ICON[s.kind] ? SV(SRC_ICON[s.kind], 12) : '<i class="msg-gd" aria-hidden="true"></i>';
|
|
54
|
+
return `<span class="msg-src">${mark}${esc(s.label)}</span>`;
|
|
55
|
+
}
|
|
56
|
+
function presses(i, t) {
|
|
57
|
+
return `<span class="msg-ends"><button type="button" class="msg-ok" data-ms-act="keep" data-key="${esc(i.key)}" aria-label="${esc('Keep: ' + t)}" title="Keep">${SV(I.check, 15, 2.4)}</button>`
|
|
58
|
+
+ `<button type="button" class="msg-ib" data-ms-act="edit" data-key="${esc(i.key)}" aria-label="${esc('Change in the charter: ' + t)}" title="Change in the charter">${SV(I.pen, 15)}</button>`
|
|
59
|
+
+ `<button type="button" class="msg-ib" data-ms-act="drop" data-key="${esc(i.key)}" aria-label="${esc('Drop: ' + t)}" title="Drop">${SV(I.x, 15)}</button></span>`;
|
|
60
|
+
}
|
|
61
|
+
function rowHtml(p, i, cls) {
|
|
62
|
+
const w = words(p, i);
|
|
63
|
+
return `<div class="msg-r${cls ? ' ' + cls : ''}" role="listitem"><span class="msg-mk" aria-hidden="true">${SV(I.spark, 14)}</span>`
|
|
64
|
+
+ `<span class="msg-t"><span class="msg-h"><b>${esc(w.title)}</b>${w.day ? `<span class="msg-d">${esc(w.day)}</span>` : ''}</span><span class="msg-w">${esc(w.why)}</span>${srcHtml(w.src)}</span>${presses(i, w.title)}</div>`;
|
|
65
|
+
}
|
|
66
|
+
/** What the first suggestions came from, in words: "the initiatives' ◆ dates, a task and the steering notes". */
|
|
67
|
+
function fromWords(L) {
|
|
68
|
+
const out = [];
|
|
69
|
+
const add = (s) => { if (s && !out.includes(s)) out.push(s); };
|
|
70
|
+
for (const i of L) {
|
|
71
|
+
const k = i.src && i.src.kind;
|
|
72
|
+
add(k === 'deliver' || k === 'member' ? 'the initiatives\' ◆ dates' : k === 'task' ? 'a task' : k === 'meeting' ? 'the ' + String(i.src.label).replace(/,.*$/, '').toLowerCase() + ' notes'
|
|
73
|
+
: k === 'jira' ? 'Jira' : k === 'target' ? 'the target date' : k === 'charter' ? 'the charter' : '');
|
|
74
|
+
}
|
|
75
|
+
return list(out);
|
|
76
|
+
}
|
|
77
|
+
export function firstHtml(p, L) {
|
|
78
|
+
const n = L.length, from = fromWords(L);
|
|
79
|
+
const all = L.length > 1 ? `<span class="msg-ends"><button type="button" class="msg-ok" data-ms-act="keepall" aria-label="Keep all ${n} suggestions" title="Keep all">${SV(I.check, 15, 2.4)}</button>`
|
|
80
|
+
+ `<button type="button" class="msg-ib" data-ms-act="dropall" aria-label="Drop all ${n} suggestions" title="Drop all">${SV(I.x, 15)}</button></span>` : '';
|
|
81
|
+
return `<div class="msg-box" role="group" aria-label="Claude's suggested milestones"><div class="msg-hd"><span class="msg-mk" aria-hidden="true">${SV(I.spark, 14)}</span>`
|
|
82
|
+
+ `<span class="msg-ht"><b>Claude suggests ${n} ${plural(n, 'milestone', 'milestones')}</b>${from ? ' from ' + esc(from) : ''}</span>${all}</div>`
|
|
83
|
+
+ `<div role="list">${L.map((i) => rowHtml(p, i, 'first')).join('')}</div></div>`;
|
|
84
|
+
}
|
|
85
|
+
export function rowsHtml(p, L) { return L.length ? `<div class="msg-list" role="list" aria-label="Claude's milestone changes">${L.map((i) => rowHtml(p, i, '')).join('')}</div>` : ''; }
|
|
86
|
+
export function homeSub(p) {
|
|
87
|
+
const L = openOf(p); if (!L.length) return '';
|
|
88
|
+
if (!((p && p.milestones) || []).length && L.every((i) => i.op === 'add')) return L.length + ' ' + plural(L.length, 'milestone', 'milestones') + ' suggested';
|
|
89
|
+
return L.length + ' milestone ' + plural(L.length, 'change', 'changes') + ' · ' + words(p, L[0]).title.replace(/^Move /, '');
|
|
90
|
+
}
|
|
91
|
+
/** The ◆ dates the page reads for the program's initiatives: "ini:2026-11-14,…" sorted, '' when none has one. */
|
|
92
|
+
export function factsOf(st, step) {
|
|
93
|
+
return ((st && st.inis) || []).map((i) => { const s = step(i.row); return s && s.date ? i.id + ':' + s.date : ''; }).filter(Boolean).sort().join(',');
|
|
94
|
+
}
|
|
95
|
+
export async function answer(pmPost, p, key, a) {
|
|
96
|
+
const r = await pmPost('/api/programs/suggestion', { program: p.id, key, answer: a }).catch(() => null);
|
|
97
|
+
return r && r.ok ? { ok: true } : { ok: false, error: (r && r.error) || 'Not saved. The server did not say why.' };
|
|
98
|
+
}
|
|
@@ -794,7 +794,7 @@ Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, o
|
|
|
794
794
|
Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
|
|
795
795
|
openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
|
|
796
796
|
grouping: () => ({ on: groupingOn(), byProduct }), setGrouping });
|
|
797
|
-
BI.mount({ M: () => M, statusOf, dayTitle, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
797
|
+
BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
798
798
|
send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
|
|
799
799
|
acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
|
|
800
800
|
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), rename: renameIni, turnProgram });
|
|
@@ -37,6 +37,9 @@ const PAYOFF = {
|
|
|
37
37
|
evaluate: 'You decide to keep it, iterate on it or stop it.',
|
|
38
38
|
};
|
|
39
39
|
const YOU_STEPS = /^(contract|review|accept|commit|signoff|sign-off)$/;
|
|
40
|
+
// a failed review: the engine reports a FAIL verdict as a pending review whose evidence names it (scripts/workflow-state.js R3), or blocks on it
|
|
41
|
+
const failedReview = (c) => c.k === 'review' && c.state !== 'done' && c.state !== 'na' && (c.state === 'blocked' || /\bFAIL/i.test(c.owed || ''));
|
|
42
|
+
const isFailedReview = (m) => (m.checks || []).some(failedReview);
|
|
40
43
|
const STEP_SAY = { spec: 'PRD and rubric written', contract: 'Your go on the done criteria', review: 'The Review Gate failed: weigh its findings', accept: 'Your sign-off', route: 'Lane chosen', commit: 'Your Commit' };
|
|
41
44
|
const CTA_SAY = { contract: 'Review the done criteria', review: 'Open the findings', accept: 'Give your sign-off', spec: 'Ask about the PRD', commit: 'Review the Commit' };
|
|
42
45
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
@@ -77,8 +80,12 @@ export function headModel(M, now = Date.now()) {
|
|
|
77
80
|
// the workflow engine's checks: done and waiting; Build and Quality are the engineers' (Jira below), so they are not listed as PMOS work
|
|
78
81
|
for (const c of m.checks || []) {
|
|
79
82
|
if (c.k === 'build' || c.k === 'quality') continue;
|
|
80
|
-
|
|
83
|
+
// the Review Gate is optional (D93): a review nobody ran waits on no one, so it is not a step; only a failed one asks the PM to weigh it
|
|
84
|
+
// (feedback batch 4, item 7: every initiative said "The Review Gate failed" while none had been reviewed)
|
|
85
|
+
if (c.k === 'review' && c.state !== 'done' && !failedReview(c)) continue;
|
|
86
|
+
const say = c.k === 'review' && c.state === 'done' ? 'Reviewed' : STEP_SAY[c.k] || cap1(c.label);
|
|
81
87
|
if (c.state === 'done') items.push({ kind: 'done', label: say });
|
|
88
|
+
else if (failedReview(c)) items.push({ kind: 'you', label: say, note: c.owed || '' });
|
|
82
89
|
else if (c.state === 'blocked') items.push({ kind: 'risk', label: say + ' is blocked', note: c.owed || '' });
|
|
83
90
|
else if (c.state === 'pending' || c.state === 'current') items.push({ kind: YOU_STEPS.test(c.k) ? 'you' : 'agent', label: say, note: c.owed || '' });
|
|
84
91
|
}
|
|
@@ -92,7 +99,7 @@ export function headModel(M, now = Date.now()) {
|
|
|
92
99
|
// the waiting record says who; a step that waits on the PM and is not in the list yet is added
|
|
93
100
|
const youWait = ov.who === 'Waits on you';
|
|
94
101
|
const step = own ? '' : String(ov.h || '').replace(/^Next: /, ''); // the engine's next step is Product feature's
|
|
95
|
-
if (!own && youWait && step && !items.some((x) => x.kind === 'you')) items.push({ kind: 'you', label: STEP_SAY[step] || cap1(step) });
|
|
102
|
+
if (!own && youWait && step && (step !== 'review' || isFailedReview(m)) && !items.some((x) => x.kind === 'you')) items.push({ kind: 'you', label: STEP_SAY[step] || cap1(step) });
|
|
96
103
|
const done = items.filter((x) => x.kind === 'done'), rest = items.filter((x) => x.kind !== 'done');
|
|
97
104
|
const life = acts.life || null;
|
|
98
105
|
const turn = rest.some((x) => x.kind === 'you') ? 'you' : life === 'hold' || life === 'cancelled' || rest.some((x) => x.kind === 'risk') ? 'stalled'
|
|
@@ -104,7 +111,8 @@ export function headModel(M, now = Date.now()) {
|
|
|
104
111
|
const end = dayOf(m.end || head.end || (m.dock && m.dock.end));
|
|
105
112
|
const finish = (head.meta || []).find((x) => /^planned finish /.test(x));
|
|
106
113
|
if (since && cur) {
|
|
107
|
-
|
|
114
|
+
// whole days, midnight to midnight: from noon on, now − since rounded up a day (stage-card D3 read 10 of ~7 on day 9)
|
|
115
|
+
const n = Math.max(0, Math.round((new Date(new Date(now).getFullYear(), new Date(now).getMonth(), new Date(now).getDate()) - since) / 864e5));
|
|
108
116
|
time = 'In ' + cur.label + ' for ' + plural(n, 'day', 'days') + (usual != null ? ' · usually ' + usual : ''); over = usual != null && n > usual;
|
|
109
117
|
clock = { n, usual, over }; // stage card D: "4 of ~6 days", amber when over; only from a record that holds the day it entered
|
|
110
118
|
} else if (finish && cur) {
|
|
@@ -112,7 +120,8 @@ export function headModel(M, now = Date.now()) {
|
|
|
112
120
|
} else if (cur) time = 'In ' + cur.label + ' · time in this stage is not recorded';
|
|
113
121
|
// one CTA: your step when it waits on you, else a question for the read-only agent
|
|
114
122
|
const cta = turn === 'you' ? (CTA_SAY[step] || ('Open ' + (step || 'the next step'))) : turn === 'stalled' ? 'Ask what is stuck' : turn === 'jira' ? 'Ask about the tickets' : 'Ask what is next';
|
|
115
|
-
const ask = turn === 'you' ? '
|
|
123
|
+
const ask = turn === 'you' && isFailedReview(m) ? 'The Review Gate failed for this initiative. Read its latest verdict and findings in planning/runs/evals.jsonl, list each failing dimension with the evidence, and say what would fix it. Change nothing.'
|
|
124
|
+
: turn === 'you' ? 'What do I need to do for the ' + (step || 'next') + ' step of this initiative? Read the evidence in this repository, say what you could not find, and change nothing.'
|
|
116
125
|
: turn === 'stalled' ? 'What is stuck in this initiative, and what would move it? Read this repository, say what you could not find, and change nothing.'
|
|
117
126
|
: turn === 'jira' ? 'Where do this initiative\'s Jira tickets stand, from the last Jira read? Name the assignee of each where the read holds one, and change nothing.'
|
|
118
127
|
: 'What happens next in this initiative, and who does it? Read this repository and change nothing.';
|