create-pmos 0.784.0 → 0.786.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/package.json +90 -59
  2. package/payload/AGENTS.md +160 -0
  3. package/payload/KIT-VERSION +1 -1
  4. package/payload/design-system/ui/components/Badge/README.md +2 -2
  5. package/payload/design-system/ui/components/Glyph/README.md +28 -0
  6. package/payload/design-system/ui/components/bundle.css +3 -0
  7. package/payload/planning/evals/eval-calibration.md +1 -1
  8. package/payload/planning/okrs/health-budgets.md +1 -1
  9. package/payload/state/discoveries.md +1 -1
  10. package/workspace/bin/card-catalog-gen.js +22 -0
  11. package/workspace/board-columns-test.js +2 -2
  12. package/workspace/briefing-premium-insights-test.js +5 -4
  13. package/workspace/calm-timeline-test.js +4 -3
  14. package/workspace/changelog.json +89 -0
  15. package/workspace/design-system/ui/components/Badge/README.md +2 -2
  16. package/workspace/design-system/ui/components/Glyph/README.md +28 -0
  17. package/workspace/design-system/ui/components/bundle.css +3 -0
  18. package/workspace/guide/cli.md +19 -0
  19. package/workspace/guide/home.md +5 -3
  20. package/workspace/guide/index.md +2 -2
  21. package/workspace/guide/jira.md +8 -0
  22. package/workspace/guide/layout.md +16 -2
  23. package/workspace/lib/briefing-premium-agent.js +3 -0
  24. package/workspace/lib/card-catalog-gen.js +123 -0
  25. package/workspace/lib/cos-chat.js +1 -0
  26. package/workspace/lib/declined-asks.js +177 -0
  27. package/workspace/lib/declined-cli.js +87 -0
  28. package/workspace/lib/goal-chat.js +1 -0
  29. package/workspace/lib/initiative-chat.js +1 -0
  30. package/workspace/lib/jira-status.js +11 -2
  31. package/workspace/lib/live-events.js +99 -0
  32. package/workspace/lib/pmos-verbs.js +6 -0
  33. package/workspace/lib/program-chat.js +1 -0
  34. package/workspace/lib/quiet-cli.js +81 -0
  35. package/workspace/lib/quiet-sweep.js +228 -0
  36. package/workspace/lib/report-chat.js +1 -0
  37. package/workspace/lib/route-modules.js +1 -0
  38. package/workspace/lib/routes-backlog.js +21 -1
  39. package/workspace/lib/routes-live-rows.js +30 -0
  40. package/workspace/lib/routes-slash.js +142 -2
  41. package/workspace/lib/routes-your-move.js +39 -3
  42. package/workspace/lib/task-cli.js +5 -3
  43. package/workspace/lib/workflow-chat.js +1 -0
  44. package/workspace/okr-goals-ui-test.js +3 -2
  45. package/workspace/package-lock.json +2 -2
  46. package/workspace/package.json +1 -1
  47. package/workspace/public/pm/bd-cols.js +3 -1
  48. package/workspace/public/pm/bd-span.js +13 -7
  49. package/workspace/public/pm/bd-sprint.js +29 -1
  50. package/workspace/public/pm/bd-views.js +6 -3
  51. package/workspace/public/pm/bd-work-ds.css +1 -0
  52. package/workspace/public/pm/bd-work.js +15 -2
  53. package/workspace/public/pm/cozy-board.css +3 -0
  54. package/workspace/public/pm/cozy-insights.css +3 -4
  55. package/workspace/public/pm/ds-bridge.css +12 -0
  56. package/workspace/public/pm/goal-forecast.js +7 -4
  57. package/workspace/public/pm/home-app.js +14 -4
  58. package/workspace/public/pm/komorebi.css +1 -0
  59. package/workspace/public/pm/live-edit.js +34 -3
  60. package/workspace/public/pm/live-feed.js +43 -0
  61. package/workspace/public/pm/okr-list.js +5 -2
  62. package/workspace/public/pm/premium-board.js +2 -0
  63. package/workspace/public/pm/premium-insights.js +10 -4
  64. package/workspace/public/pm/premium-vw-doc.css +5 -0
  65. package/workspace/public/pm/premium-vw-doc.js +11 -31
  66. package/workspace/public/pm/premium-vw-file.js +13 -8
  67. package/workspace/public/pm/premium-vw-guide.css +9 -0
  68. package/workspace/public/pm/premium-vw-guide.js +20 -17
  69. package/workspace/public/pm/quiet-view.js +107 -0
  70. package/workspace/public/pm/reading-view.js +44 -0
  71. package/workspace/public/pm/state-glyph.js +135 -0
  72. package/workspace/skills/jira-sync.skill +4 -3
  73. package/workspace/task-milestones-test.js +2 -2
  74. package/workspace/test-lists/a2ui-chat-rules.json +9 -0
  75. package/workspace/test-lists/a2ui-live-rows.json +9 -0
  76. package/workspace/test-lists/declined-asks.json +9 -0
  77. package/workspace/test-lists/quiet-sweep.json +9 -0
  78. package/workspace/test-lists/state-glyph.json +5 -0
@@ -28,6 +28,7 @@ const path = require('path');
28
28
  const { execFileSync } = require('child_process');
29
29
  const actorLib = require('./actor.js');
30
30
  const driver = require('./driver.js');
31
+ const LIVE = require('./live-events.js'); // bet A458: each change shows on the open pages at once (GET /api/live-rows)
31
32
  const { repoScript } = require('./repo-script.js');
32
33
  const B = require(repoScript('boards.js'));
33
34
  const TI = require('./task-items.js');
@@ -187,6 +188,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
187
188
  if (!e.body || e.body.ok !== true) return fail(`added ${t.uid}, but it was not placed under ${sec}: ${(e.body && e.body.error) || 'the write was refused'}`);
188
189
  }
189
190
  if (body.parent) console.error('[task-parent]', 'add', 1);
191
+ LIVE.emit(stateDir, { id: t.uid, field: 'added', value: { initiative: id, title: t.title, status: t.status, owner: t.owner || '', start: t.start || '', end: t.end || '', ...(sec ? { section: sec } : {}), ...(body.parent ? { parent: body.parent } : {}) } });
190
192
  if (json) say(JSON.stringify({ ok: true, task: { id: t.uid, board: t.board, title: t.title, state: t.status, owner: t.owner, start: t.start, due: t.end, ...(sec ? { stage: sec } : {}), ...(body.parent ? { parent: body.parent } : {}) } }));
191
193
  else say(`✓ added ${t.uid} · ${t.status} · ${t.title}${body.parent ? ' · a subtask of ' + body.parent : ''}${sec ? ' · under ' + sec : ''}${t.end ? ' · due ' + t.end : ''}. The initiative's Tasks section shows it. Nothing was sent.`);
192
194
  return 0;
@@ -249,7 +251,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
249
251
  if (PIN_FLAGS.some((k) => flags[k])) body.pinned = flags.pin ? true : flags['no-pin'] ? false : null;
250
252
  const e = boards.taskEdit(ctx, body, g);
251
253
  if (!e.body || e.body.ok !== true) refused.push({ task: id, error: (e.body && e.body.error) || 'the write was refused' });
252
- else done.push({ task: id, title: t.title, set: Object.fromEntries(keys.map((k) => [k, k === 'stage' ? body.section : body[k]])), ...(body.parent !== undefined ? { was: (e.body.from && e.body.from.parent) || '' } : {}) });
254
+ else { LIVE.emit(stateDir, LIVE.fieldEvents(id, body)); done.push({ task: id, title: t.title, set: Object.fromEntries(keys.map((k) => [k, k === 'stage' ? body.section : body[k]])), ...(body.parent !== undefined ? { was: (e.body.from && e.body.from.parent) || '' } : {}) }); }
253
255
  }
254
256
  const what = (x) => Object.entries(x).map(([k, v]) => (k === 'stage' ? (v ? 'under ' + v : 'under no stage') : k === 'parent' ? (v ? 'under ' + v : 'at the top level') : k === 'milestone' ? (v ? 'a milestone' : 'not a milestone') : k === 'pinned' ? (v === true ? 'pinned to the timeline' : v === false ? 'off the timeline' : 'pinned by the rule') : v === '' ? 'no ' + k : k + ' ' + v)).join(', ');
255
257
  // a date changed outside a drag: inside the approved links, what waits on it moves quietly (batch 11 item 15, the grey ✦ on the page)
@@ -329,7 +331,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
329
331
  if (!t) { refused.push({ task: id, error: `no task ${id}; pmos task list <initiative> --all names them` }); continue; }
330
332
  const r = boards.taskDelete(ctx, { ws: w.id, board: t.board, task: id, ...(flags.why ? { why: flags.why } : {}) }, g);
331
333
  if (!r.body || r.body.ok !== true) refused.push({ task: id, error: (r.body && r.body.error) || 'the write was refused' });
332
- else done.push({ task: id, title: t.title });
334
+ else { LIVE.emit(stateDir, { id, field: 'removed', value: true }); done.push({ task: id, title: t.title }); }
333
335
  }
334
336
  if (json) say(JSON.stringify({ ok: !refused.length, done, refused }));
335
337
  else {
@@ -388,7 +390,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
388
390
  if (t.state === to) { done.push({ task: id, title: t.title, state: to, same: true }); continue; }
389
391
  const r = boards.taskState(ctx, { ws: w.id, board: t.board, task: id, state: to, ...(flags.why ? { why: flags.why } : {}) }, g);
390
392
  if (!r.body || r.body.ok !== true) refused.push({ task: id, error: (r.body && r.body.error) || 'the write was refused' });
391
- else done.push({ task: id, title: t.title, state: to });
393
+ else { LIVE.emit(stateDir, { id, field: 'state', value: to }); done.push({ task: id, title: t.title, state: to }); }
392
394
  }
393
395
  if (json) say(JSON.stringify({ ok: !refused.length, done, refused }));
394
396
  else {
@@ -19,6 +19,7 @@ const RULE = [
19
19
  'Write conditions in the PM\'s plain words ("Only when they touch customer data"), never as a rule or code.',
20
20
  'In the chat, say in one line per choice why you drafted it so (quote the PM or the file they added), then ask at most one question when something is unclear.',
21
21
  'You never save, copy or archive a workflow: the PM presses Create workflow. Never write a .jsonl file by hand.',
22
+ /* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: pmos workflow switch <id> --to <workflow> --stage <stage> --why <text> (Use for an initiative; you); pmos build rollout <item> --to <percent> (Roll out; waits); pmos build rollback <item> (Roll back; waits); pmos build review <item> (Review; agent); pmos lab delete <ini> --version <n> (Delete version; you); pmos lab undo <batch> (Undo; you); pmos grill mode full|exits|off (Change mode; you); pmos grill cap <dollars> (Set the cap; you)."/* card-catalog:end */,
22
23
  ].join('\n');
23
24
 
24
25
  /** The message as PMOS types it into the session: the rule, then the PM's words. */
@@ -156,8 +156,9 @@ const ROWS = [
156
156
 
157
157
  /* R · a broken limit */
158
158
  const C = await open({ m: model({ crit: true }), rows: [] });
159
- const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow .ins-nsc .cz-dot.m-crit') }));
160
- ok('R1 a broken limit is the one time the ✦ line turns red, and its dot pulses', cr.crit && /fell under its floor/.test(cr.t) && cr.pulse, JSON.stringify(cr));
159
+ const cr = await C.page.evaluate(() => ({ crit: document.querySelector('#insHero').classList.contains('crit'), t: document.querySelector('#brief').textContent, pulse: !!document.querySelector('#nsRow .ins-nsc .pm-glyph[data-state="late"]') }));
160
+ // state-glyphs: the broken limit is the Late glyph; only Needs you moves now (brief agreed 2026-11-23), so it no longer pulses
161
+ ok('R1 a broken limit is the one time the ✦ line turns red, and its glyph says Late', cr.crit && /fell under its floor/.test(cr.t) && cr.pulse, JSON.stringify(cr));
161
162
  await shot(C.page, 'okr-crit', '#stage');
162
163
  await C.ctx.close();
163
164
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.784.0",
3
+ "version": "0.786.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.784.0",
9
+ "version": "0.786.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.784.0",
3
+ "version": "0.786.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -14,6 +14,7 @@ import { endStage } from './bd-pins.js';
14
14
  import { stageOfRow, wfOf, wfIcon, catOfRow, catLabel, CAT_ORDER } from './bd-wf.js';
15
15
  import { offTone, md, dy } from './bd-span.js';
16
16
  import { stageName as oneStageName } from './stage-chip.js';
17
+ import { stateGlyph } from './state-glyph.js';
17
18
 
18
19
  /** Every column in its place, left to right: key, title, width in px. Initiative takes what the others leave of its 250 px. */
19
20
  export const COLS = [
@@ -84,7 +85,8 @@ const stageName = (r) => oneStageName(r) || ((s) => (s && s.name) || '')(stageOf
84
85
  function cell(r, k, o) {
85
86
  const now = o.now;
86
87
  if (k === 'stage') return `<span class="tg-c">${esc(stageName(r))}</span>`;
87
- if (k === 'status') { const t = stTone(r, now); return t ? `<span class="tg-c tg-cst ${t === 'none' ? 'q' : t}"><i class="cz-dot ${t === 'none' ? 'q' : t}" aria-hidden="true"></i>${STATUS[t]}</span>` : '<span class="tg-c"></span>'; }
88
+ // a state is a shape, not a word (state-glyphs): the glyph carries the word as its label and tooltip; the facts stay in their own cells
89
+ if (k === 'status') { const t = stTone(r, now); if (!t) return '<span class="tg-c"></span>'; const m = nextMs(r, now); return `<span class="tg-c tg-cst">${stateGlyph(t, { why: m && m.late ? `${m.name}, ${m.over} ${m.over === 1 ? 'day' : 'days'} late` : '' })}</span>`; }
88
90
  if (k === 'start') { const d = day(r.start); return `<span class="tg-c">${d ? esc(dy(d, now)) : ''}</span>`; }
89
91
  if (k === 'ms') {
90
92
  const m = nextMs(r, now);
@@ -48,7 +48,8 @@ import { mergeClose } from './program-model.js';
48
48
  import { stagesOfRow } from './bd-wf.js';
49
49
  import { shownMs, endStage } from './bd-pins.js';
50
50
  import { stageName } from './stage-chip.js'; // W1: the one stage
51
- import { provenStatus } from './status-proof.js'; // T3: a status renders only with its source and read time
51
+ import { provenStatus } from './status-proof.js';
52
+ import { stateGlyph } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs) // T3: a status renders only with its source and read time
52
53
 
53
54
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
54
55
  const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
@@ -123,7 +124,8 @@ export function fcRange(r) {
123
124
  const toneOf = (r, now) => { const ps = provenStatus(r); return r.late || anyMsLate(r, now) ? 'late' : ps === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : ps === 'on track' ? 'ok' : 'q'; }; // T3: a proven status only
124
125
  /** A row's dot (batch 13 item 4): only off track. 'late' | 'risk' | 'q' (on hold) | null. */
125
126
  export const offTone = (r, now) => { const t = toneOf(r, now); return t === 'late' || t === 'risk' ? t : r.status === 'on hold' ? 'q' : null; };
126
- const dotHtml = (r, now) => { const t = offTone(r, now); return t ? `<i class="cz-dot ${t}${t === 'q' ? '' : ' m-warn'}" aria-hidden="true"></i>` : ''; };
127
+ /** A row's state glyph (state-glyphs): only off track, as before; on hold is Waiting on others. '' when on track (zero is silence). */
128
+ const dotHtml = (r, now, cls = '') => { const t = offTone(r, now); return t ? stateGlyph(t === 'q' ? 'wait' : t, { size: 12, cls }) : ''; };
127
129
  const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast)) || (r.draft && day(r.draft.start));
128
130
  /** Done work leaves no edge tab (TsCGrill 5): the initiative is closed (its workflow's terminal stage, batch 26 item 5), past Deliver, or every
129
131
  * part it counts is done. */
@@ -221,7 +223,7 @@ const slipWords = (r, e) => { const p = r.plan, b = p && day(p.end), n = p && p.
221
223
  * (pm/cozy-pop-work.js), so the bar has one design everywhere (Wawan, 2026-11-19). X: a date → its percent of the box; the markup sits in a
222
224
  * position:relative box of the row's height. o: { pxPct: px per 1 % of the box, reach: days in which ◇s merge, mode: 'all' | 'pinned',
223
225
  * label: false drops the end label, phone } → html */
224
- export const rowBar = (r, X, now, o = {}) => qBar(r, X, now, !!o.phone, md, o.pxPct || 0, { reach: o.reach || 7, mode: o.mode || 'all', noLabel: o.label === false, endIn: !!o.endIn });
226
+ export const rowBar = (r, X, now, o = {}) => qBar(r, X, now, !!o.phone, md, o.pxPct || 0, { reach: o.reach || 7, mode: o.mode || 'all', noLabel: o.label === false, endIn: !!o.endIn, noState: true }); // Work and the popup show the state before the title (state-glyphs)
225
227
  function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
226
228
  const s = day(r.start), e = day(r.end), fr = fcRange(r), fc = r.forecast ? null : r.track && day(r.track.forecast), tone = toneOf(r);
227
229
  const tm = taskMarks(r, X, now, phone, pxPct, ms), et = tm.end, note = markWords(r, now);
@@ -248,10 +250,13 @@ function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
248
250
  const ed = et ? day(et.date) : e; if (+ed !== +e) hover.push('Initiative ends ' + dy(e, now));
249
251
  const name = landsOf(r, et), eTitle = name + ' · ' + md(ed) + (et && et.stage ? ' · ◆ ' + et.stage : '') + (et && et.done ? ' · done' : isLate ? ' · late' : '');
250
252
  // nothing lands (batch 25 item 13): a workflow with no ◆ stage and no dated milestone draws no ◇ and no label; the bar's own end says it
251
- if (!name) return out + planMarks(r, X, phone, fmt);
253
+ // the state glyph sits at the end of the bar (state-glyphs): after the end label, or at the bar's end when there is no label
254
+ const sg = phone || ms.noState ? '' : dotHtml(r, now, 'tg-sg'), atEnd = Math.max(X(e), over ? X(now) : 0, late ? X(fc) : 0, fr ? X(fr.high) : 0);
255
+ if (!name) return out + (sg ? `<span class="tg-sgw" style="left:${P(atEnd)}">${sg}</span>` : '') + planMarks(r, X, phone, fmt);
252
256
  if (!tm.endMerged) out += `<button type="button" class="tg-end${et && et.done ? ' dn' : ''}${isLate ? ' late' : ''}" data-ms-pick="${esc(r.key)}" data-ms-id="${esc(et ? et.id : '')}" style="left:${P(X(ed))}" aria-haspopup="dialog" aria-label="${esc(eTitle + '. Milestones of ' + r.title)}" title="${esc(eTitle + (clash ? '. ' + clash : ''))}"></button>`;
253
257
  // with the Next milestone column on, the column names it and the bar's end has no label (StsA8Board); the ◇ keeps the words as its hover
254
- if (!ms.noLabel) out += endLabel(Math.max(X(e), X(ed), over ? X(now) : 0, late ? X(fc) : 0, fr ? X(fr.high) : 0), name, ed, isLate ? 'late' : risk, now, pxPct, hover, slipHtml(r));
258
+ if (!ms.noLabel) out += endLabel(Math.max(atEnd, X(ed)), name, ed, isLate ? 'late' : risk, now, pxPct, hover, slipHtml(r) + sg);
259
+ else if (sg) out += `<span class="tg-sgw" style="left:${P(Math.max(atEnd, X(ed)))}">${sg}</span>`;
255
260
  } else if (fc) {
256
261
  out += `<span class="tg-fc solo" style="left:${P(X(fc))};width:12px;margin-left:-12px" title="Jira forecast ${esc(md(fc))}"></span>` + endLabel(X(fc), 'Jira forecast', fc, '', now, pxPct, [], '');
257
262
  } else if (r.draft && day(r.draft.start)) {
@@ -537,7 +542,7 @@ function scaled(rows, M, o) {
537
542
  const ratio = days / viewDays, tpx = Math.max(200, o.trackPx || (o.phone ? 340 : 1100)), pxDay = tpx / viewDays;
538
543
  // the columns beside the names (batch 19 item 5, StsA8Board): a desktop only; o.cols from pm/bd-cols.js colsFor, or null
539
544
  const C = !o.phone && o.cols ? o.cols : null;
540
- const msO = { sp, reach: Math.max(1, Math.round(40 / pxDay)), mode: o.msMode || 'pinned', noLabel: !!(C && C.msOn) }; // a row's milestone ◇s closer than ~40 px merge (batch 11 item 3); the Filter's milestones (batch 13 item 4)
545
+ const msO = { sp, reach: Math.max(1, Math.round(40 / pxDay)), mode: o.msMode || 'pinned', noLabel: !!(C && C.msOn), noState: !!(C && C.statusOn) }; // a row's milestone ◇s closer than ~40 px merge (batch 11 item 3); the Filter's milestones (batch 13 item 4)
541
546
  const ov = overlay(W, X, now, sprint, rel), pxPct = (tpx * (W.fixed ? 1 : ratio)) / 100;
542
547
  const ra = rel && day(rel.iso), sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
543
548
  // an undated initiative's track says so beside today, where the view opens
@@ -584,7 +589,8 @@ function scaled(rows, M, o) {
584
589
  // one line per initiative (PgTimeline): its status dot and its name; the owner and the step stay in the row's title for a pointer and a reader
585
590
  const one = (r, cls) => { const s = o.status(r), sub = [r.owner, stageName(r), s.text].filter(Boolean).join(' · ');
586
591
  // the dot keeps its place while it is silent, so every name starts at the same line (XcalmA1Desk)
587
- const dot = dotHtml(r, now) || '<i class="tg-nodot" aria-hidden="true"></i>', nm = `<b>${r.inProgram && o.memberIcon ? o.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>`;
592
+ // the state glyph sits at the end of the bar now (state-glyphs); the blank keeps every name on the same line
593
+ const dot = '<i class="tg-nodot" aria-hidden="true"></i>', nm = `<b>${r.inProgram && o.memberIcon ? o.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>`;
588
594
  // with columns, the Status cell carries the dot and the name has none (say it once)
589
595
  const inner = C ? `<span class="tg-c0">${C.statusOn ? '' : dot}${nm}</span>${C.cells(r)}` : dot + nm, lab = C ? [r.title, C.label(r)].filter(Boolean).join(', ') : r.title + ', ' + sub;
590
596
  return `<div class="tg-r${cls || ''}${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}" title="${esc(sub)}" aria-label="${esc(lab)}">${inner}</button><div class="tg-p"${ext(r)}>${ov}${dated(r) ? qBar(r, X, now, false, fmt, pxPct, msO) + edgeTabs(r, X, now, false) : ND}</div></div>`; };
@@ -16,6 +16,8 @@
16
16
  * one ✦ line on the carried-over work and its bars. A past sprint shows frozen (SpH2): the snapshot mark, done of total, carried to
17
17
  * which sprint, points, the goal result, its themes, What happened (PMOS-written, editable) and Lessons (the PM's), and the list below is
18
18
  * that sprint's tickets with their state at close. A sprint PMOS never saw (SpH3) says so once, with an icon to read it from Jira now.
19
+ * ✦ One change (initiative sprint-retro-one-change): why work was carried, the one change tracked into the next sprint (✕ drops it,
20
+ * with Undo), and whether the previous sprint's change helped (lib/sprint-retro.js, sprint.retro on GET /api/backlog/sprint).
19
21
  * pm/bd-backlog.js calls bandHtml() while the chip is on, themeOf() for the list, pastOn()/pastListHtml() for a past sprint's list, and
20
22
  * press() first on each press in the Backlog. */
21
23
  import * as SK from './bk-sprint.js';
@@ -209,9 +211,27 @@ function pastHtml(o, H, x, deps) {
209
211
  const carriedCol = x.carried ? `<div class="sbo-b"><h4>Carried to ${esc(to)}</h4><ul><li><span>${x.carried} open ${x.carried === 1 ? 'ticket' : 'tickets'}</span>`
210
212
  + (x.carriedTo && H.list.some((y) => y.name === x.carriedTo) ? `<button type="button" class="bk-lnk" data-spgo="${esc(x.carriedTo)}">open ${esc(to)}</button>` : '') + '</li>'
211
213
  + (whyLine ? `<li class="sbo-why"><span>${esc(whyLine)}</span></li>` : '') + '</ul></div>' : '';
212
- const pl = `<div class="sbo-pl">${pblock('happened', 'What happened', happened, !note.happened, 'PMOS writes this when the sprint closes.')}${carriedCol}${pblock('lessons', 'Lessons', lessons, false, 'Add what the team learned. Kept with the snapshot.')}</div>`;
214
+ const pl = `<div class="sbo-pl">${pblock('happened', 'What happened', happened, !note.happened, 'PMOS writes this when the sprint closes.')}${carriedCol}${pblock('lessons', 'Lessons', lessons, false, 'Add what the team learned. Kept with the snapshot.')}${d && d.retro ? retroHtml(d.retro, to) : ''}</div>`;
213
215
  return `<section class="sbo-band sbo-past" aria-label="${esc(SK.labelOf(x.name))}, snapshot"><div class="sbo-top">${sum}${th}</div>${pl}</section>`;
214
216
  }
217
+ /** One change (initiative sprint-retro-one-change): why work was carried, the one change PMOS tracks into the next sprint, and whether the
218
+ * previous sprint's change helped. Built from the system's sbo-b block. Zero is silence: nothing to say draws nothing. */
219
+ const RESULT = { helped: ['It helped.', 'green'], same: ['No change.', 'amber'], worse: ['It got worse.', 'red'] };
220
+ export function retroHtml(x, to) {
221
+ if (!x || !x.reasons) return '';
222
+ const r = x.reasons, L = [];
223
+ const parts = [r.never && `${r.never} never started`, r.started && `${r.started} started`, r.review && `${r.review} in review`, r.twice && `${r.twice} carried two sprints in a row`].filter(Boolean);
224
+ if (r.carried && parts.length) L.push(`<li><span>Carried: ${esc(parts.join(' · '))}${r.added ? esc(` · ${r.added} added after the start`) : ''}</span></li>`);
225
+ if (x.change) L.push(`<li><span>${esc(x.change.text)} <span class="sbo-meta">${esc(x.change.number)}: ${x.change.count}</span></span>`
226
+ + `<button type="button" class="bk-ib" data-spretro="drop" aria-label="Drop this change" title="Drop this change">${SV(I.x)}</button></li>`);
227
+ else if (x.by === 'dropped') L.push('<li><span>No change tracked: you dropped it.</span></li>');
228
+ if (x.check) {
229
+ const [w, c] = RESULT[x.check.result] || RESULT.same;
230
+ L.push(`<li><span><i class="bk-dot ${c}"></i>Last sprint's change: ${esc(x.check.number)} went from ${x.check.before} to ${x.check.after}. ${w}</span></li>`);
231
+ }
232
+ if (!L.length) return '';
233
+ return `<div class="sbo-b"><h4><span class="sbo-s" aria-hidden="true">${SPARK}</span>One change${x.change ? ' for ' + esc(to) : ''}</h4><ul>${L.join('')}</ul></div>`;
234
+ }
215
235
  /** True while the band shows a past sprint that has a snapshot: the list below is its tickets (pastListHtml). */
216
236
  export const pastOn = () => !!(CURP && CURP.x.kept !== 'none');
217
237
  /** The past sprint's tickets with their state at close (SpH2), in the Backlog's own table. '' while the snapshot is read. */
@@ -282,6 +302,14 @@ export async function press(e, deps) {
282
302
  for (const ms of [60000, 150000, 300000]) setTimeout(() => { DET.delete(k); deps.load(); }, ms);
283
303
  return true;
284
304
  }
305
+ if (CURP && CURP.d && hit('data-spretro')) {
306
+ const at = { ws: CURP.H.ws, board: CURP.H.board, sprint: CURP.x.name }, k = at.ws + '|' + at.board + '|' + at.sprint;
307
+ const r = await deps.post('/api/backlog/sprint-retro', { ...at, ev: 'drop' });
308
+ if (!r || r.ok === false) { deps.say((r && r.error) || 'The change was not dropped.'); return true; }
309
+ DET.delete(k);
310
+ deps.say('No change tracked for ' + SK.labelOf(at.sprint) + '.', async () => { await deps.post('/api/backlog/sprint-retro', { ...at, ev: 'undo' }); DET.delete(k); deps.load(); });
311
+ await deps.load(); return true;
312
+ }
285
313
  if (CURP && (b = hit('data-sppedit'))) { EDIT = EDIT === b.dataset.sppedit ? '' : b.dataset.sppedit; deps.draw(); const ta = document.querySelector('[data-spta]'); if (ta) ta.focus(); return true; }
286
314
  if (CURP && (b = hit('data-sppsave'))) {
287
315
  const k = b.dataset.sppsave, ta = document.querySelector(`[data-spta="${k}"]`), words = ta ? ta.value.trim() : '';
@@ -16,6 +16,7 @@ import { nextHtml } from './bd-next.js';
16
16
  import { markFor } from './changed-mark.js'; // bet A456: the ✦ and Undo on a row PMOS changed in the last 24 h
17
17
  import { stageName, stageChip } from './stage-chip.js'; // W1: the one stage
18
18
  import { provenStatus, NO_SIGNAL } from './status-proof.js';
19
+ import { stateGlyph, fromStatus, isStateWord } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
19
20
  import * as PL from './bd-phone-line.js'; // the phone row's own small line, no Gantt on a phone (board PhIniB) // T3: a status renders only with its source and read time
20
21
 
21
22
  let A = null; // the page: { M(), statusOf(r), usual(t), trail(r), sel(), groups(L), folded(key), laneHead(g), subTile(name), memberIcon(id), programOf(r), programs(),
@@ -302,11 +303,13 @@ export function stagesHtml(L, o = {}) {
302
303
  }
303
304
 
304
305
  /* ── the phone list (BdPhone) ─────────────────────────────────────────────────────────────────────────────────── */
305
- /** A phone row: the status dot, the title, the stage and what it waits on; the workflow's icon at the end when the board has more than one. */
306
+ /** A phone row: the state glyph, the title, the stage and what it waits on; the workflow's icon at the end when the board has more than one. */
306
307
  function phoneRow(r) {
307
308
  const s = statusLine(r), t = r.track || {}, w = WF.stageOfRow(r);
308
309
  // the phone design (Ph2_work): "Discover · 15 days over · wawan", the late or at risk words in their own tone, no kind icon before the name
309
- const say = t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' ? s.text.toLowerCase() : '';
310
+ // the state word is the glyph before the title (state-glyphs); a fact ("15 days over") stays in the meta line
311
+ const say = t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' && !isStateWord(s.text) ? s.text.replace(/^At risk · /, '').toLowerCase() : '';
312
+ const gs = fromStatus(s);
310
313
  const st = stageName(r) || (w && w.name) || '';
311
314
  // a Project (Ph2 checks across kinds): the end date leads the late words, "ends 4 Dec"
312
315
  const em = WK.kindOf(r.kind) === 'project' && /^\d{4}-\d{2}-\d{2}/.test(String(r.end || '')) ? String(r.end).slice(0, 10).split('-') : null;
@@ -323,7 +326,7 @@ function phoneRow(r) {
323
326
  const line = PL.lineHtml(r, { today, next: ahead, alert: s.tone === 'red' || s.tone === 'late' || s.tone === 'risk' });
324
327
  const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the tap opens the panel, which lists them (sigListHtml)
325
328
  const sub = [st ? stIc + esc(st) : '', line ? '' : ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
326
- return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s q">${sub}</span>${line}</span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
329
+ return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog">${stateGlyph(gs.state, { why: gs.why, size: 16, progress: outOf(r) ? outOf(r).pct / 100 : 0 })}<span class="tx"><span class="t">${nameHtml(r)}</span><span class="s q">${sub}</span>${line}</span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
327
330
  }
328
331
  export function phoneListHtml(L) {
329
332
  const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
@@ -42,6 +42,7 @@ table.pm-table.wk:not(.has-x) col.c-title { width: auto; }
42
42
  @media (max-width: 1280px) { table.pm-table.wk col.c-title { width: 200px; } table.pm-table.wk col.c-ms { width: 130px; } table.pm-table.wk col.c-date { width: 150px; } table.pm-table.wk col.c-stage { width: 96px; } }
43
43
  table.pm-table.wk th, table.pm-table.wk td { height: 40px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
44
44
  table.pm-table.wk td.n { font-weight: var(--fw-strong); color: var(--ink); }
45
+ table.pm-table.wk td.n .wk-sg { margin-right: 8px; } /* the state glyph before the title (state-glyphs) */
45
46
  table.pm-table.wk tr.wk-i { cursor: pointer; }
46
47
  table.pm-table.wk tr.wk-i:focus-visible { outline: none; box-shadow: inset var(--glow); }
47
48
  table.pm-table.wk tr.wk-i.sel td { background: var(--blue-tint); }
@@ -17,6 +17,7 @@
17
17
  * handlers: pm/premium-board.js wires the presses (pressOf and apply say what a press means; wireDrag does the menu's drag). */
18
18
  import { stageOfRow, stagesOfRow, wfOf, catOfRow, posOf } from './bd-wf.js';
19
19
  import { stageName as oneStageName } from './stage-chip.js';
20
+ import { stateGlyph } from './state-glyph.js';
20
21
 
21
22
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
22
23
  const SV = (d, n) => `<svg viewBox="0 0 24 24"${n ? ` width="${n}" height="${n}"` : ''} aria-hidden="true"><path d="${d}"/></svg>`;
@@ -127,9 +128,21 @@ export function dateOf(r, now = new Date()) {
127
128
  if (r.closed || r.status === 'done') return { text, tone: '', note: '' };
128
129
  if (over > 0) return { text, tone: 'late', note: over + ' ' + plural(over, 'day', 'days') + ' late', over };
129
130
  // a date still ahead is never "late" (design check of the shared copy, 2026-11-19): a row the reading calls late, with its date to come, is at risk
130
- if (r.status === 'at risk' || r.status === 'late') return { text, tone: 'risk', note: 'at risk' };
131
+ // the state word is the row's glyph now (state-glyphs): the Date cell keeps only the fact
132
+ if (r.status === 'at risk' || r.status === 'late') return { text, tone: 'risk', note: '' };
131
133
  return { text, tone: '', note: '' };
132
134
  }
135
+ /** The row's state for its glyph (state-glyphs): done, late, at risk, on hold, no signal, or on track with its share done. → { state, why, progress } */
136
+ export function rowState(r, now = new Date()) {
137
+ if (r.closed || r.status === 'done' || catOfRow(r) === 'done') return { state: 'done', why: '', progress: 1 };
138
+ const d = dateOf(r, now), n = nextOf(r);
139
+ if (d.tone === 'late') return { state: 'late', why: (n && n.name ? n.name + ', ' : '') + d.note, progress: 0 };
140
+ if (d.tone === 'risk') return { state: 'risk', why: n ? (n.name ? n.name + ' ' : 'Due ') + d.text : '', progress: 0 };
141
+ if (r.status === 'on hold' || r.status === 'blocked') return { state: 'wait', why: '', progress: 0 };
142
+ if (r.status === 'no signal') return { state: 'none', why: 'nothing read yet', progress: 0 };
143
+ const p = r.track && r.track.prog, progress = p && p.total > 0 ? p.done / p.total : 0;
144
+ return { state: 'on', why: p && p.total > 0 ? `${p.done} of ${p.total} done` : '', progress };
145
+ }
133
146
 
134
147
  /* ── stages ──────────────────────────────────────────────────────────────────────────────────────────────────── */
135
148
  const norm = (s) => String(s || '').trim().toLowerCase();
@@ -408,7 +421,7 @@ export function listHtml(rows, o = {}) {
408
421
  + `<div class="wk-tw"><table class="pm-table wk${tl ? ' has-x' : ''}" aria-label="Initiatives"><colgroup><col class="c-title">${keys.map((k) => `<col class="c-${k}">`).join('')}${tl ? '<col class="c-x">' : ''}</colgroup>`
409
422
  + `<thead><tr>${sortHd('title', 'Initiative')}${keys.map((k) => sortHd(k, byK[k].n)).join('')}${tlHead}</tr></thead><tbody>`;
410
423
  const row = (r) => `<tr class="wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
411
- + `<td class="n">${esc(r.title)}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
424
+ + `<td class="n">${((g) => stateGlyph(g.state, { why: g.why, progress: g.progress, cls: 'wk-sg' }))(rowState(r, now))}${esc(r.title)}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
412
425
  + (tl ? `<td class="wk-x" data-wkbar="${esc(r.key)}"><div class="wk-bw pm-gt">${grid}${o.bar ? o.bar(r, W) : barHtml(r, W, { now })}</div>${CARD === r.key ? cardHtml(r, W, now) : ''}</td>` : '') + '</tr>';
413
426
  const all = o.order ? o.order(rows) : rows, base = all.filter((r) => !isClosed(r)), shut = all.filter(isClosed), G = groupsOf(base, v.group, oo);
414
427
  const gline = (inner) => `<tr class="wk-g"><td colspan="${ncol}"><div class="pm-group">${inner}</div></td></tr>`;
@@ -1617,3 +1617,6 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1617
1617
  .bd-sigs .bd-sign { display: block; color: var(--cz-ink2); }
1618
1618
  /* Work's Ask PMOS icon (bug 2026-11-23, initiative work-ask-chat) is a computer's: a phone's top bar is one row, and its Ask PMOS is in the menu */
1619
1619
  @media (max-width: 760px) { .bd-hd .bd-ask { display: none; } }
1620
+ /* the state glyph at the end of a Timeline bar (state-glyphs): after the end label, or alone at the bar's end */
1621
+ .tg-endl .tg-sg { margin-left: 6px; vertical-align: -1px; }
1622
+ .tg-sgw { position: absolute; top: 50%; transform: translate(8px, -50%); line-height: 0; z-index: 3; }
@@ -130,7 +130,7 @@ body.cz { padding: 0; }
130
130
  .ins-ini { display: flex; align-items: center; gap: var(--space-8); font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--muted); min-width: 0; text-decoration: none; border-radius: var(--radius-md); line-height: var(--lh-label); }
131
131
  @media (hover: hover) { .ins-ini:hover .n { text-decoration: underline; } }
132
132
  .ins-ini .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
133
- .ins-ini .pm-badge { margin-left: auto; }
133
+ .ins-ini .pm-badge, .ins-ini > .pm-meta { margin-left: auto; } /* a fact at the row end; the state is the glyph before the title (state-glyphs) */
134
134
  .ins-trk { display: inline-flex; align-items: center; gap: 3px; flex: none; }
135
135
  .ins-trk i { width: 6px; height: 6px; border-radius: 50%; background: var(--well); display: block; }
136
136
  .ins-trk i.p { background: var(--muted); }
@@ -661,7 +661,7 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
661
661
  .okr-t b { font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: 1.3; color: var(--ink); }
662
662
  .okr-t .note { font-size: var(--fs-meta); color: var(--muted); line-height: var(--lh-meta); }
663
663
  .okr-none { margin: 0; padding: 14px var(--space-16); color: var(--muted); font-size: var(--fs-body); line-height: var(--lh-body); }
664
- .okr-dot { width: 10px; height: 10px; margin-top: 6px; }
664
+ .okr-dot { margin-top: 5px; } /* the state glyph (state-glyphs) sizes itself */
665
665
  .cz-dot.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
666
666
  .okr-av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-badge); font-weight: var(--fw-strong); background: var(--well); color: var(--ink); line-height: var(--lh-badge); }
667
667
  .okr-av.none { background: transparent; border: 2px dashed var(--muted); box-sizing: border-box; }
@@ -723,8 +723,7 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
723
723
  .okr-pl { display: flex; align-items: center; gap: 10px; min-width: 0; }
724
724
  .okr-plt { flex: 1; min-width: 0; }
725
725
  .okr-pld { display: inline-flex; gap: var(--space-4); flex: none; }
726
- .okr-pld .okr-dot { margin-top: 0; width: 8px; height: 8px; }
727
- @media (prefers-reduced-motion: reduce) { .okr-dot.m-crit::after { animation: none; } }
726
+ .okr-pld .okr-dot { margin-top: 0; }
728
727
  textarea.ins-dri { height: auto; padding: 6px var(--space-8); font-weight: var(--fw-regular); resize: vertical; }
729
728
  /* ── goals made clear (batch 18 item 11, 11-B; frames Gc*): the drafts table, the check panel, first readings, failed and held ── */
730
729
  .ins-dr .gc-tbl + .okr-card { margin-top: var(--space-12); }
@@ -21,3 +21,15 @@
21
21
  :root body.pm-ds :focus-visible { outline: none; box-shadow: var(--glow); }
22
22
  /* the ground follows the clock (pm/day-tint.js, bet A339): after the first paint, a change of part moves slowly */
23
23
  :root[data-daytint-ease] body.pm-ds { transition: background-color var(--duration-light) var(--ease-drift); }
24
+
25
+ /* the state glyph (pm/state-glyph.js, initiative state-glyphs): its shape, the one pulse of Needs you, and the phone press-and-hold sheet.
26
+ * The seven --state-* colours are design-system tokens (ui/components/bundle.css); these rules sit here, the sheet every page loads, so
27
+ * the design system sent to a prototype run stays under its size cap. */
28
+ .pm-glyph{display:inline-flex;flex:none;align-items:center;justify-content:center;vertical-align:-2px;line-height:0}
29
+ .pm-glyph svg{display:block;overflow:visible}
30
+ .pm-glyph[data-state="you"] .pm-glyph-dot{transform-box:fill-box;transform-origin:center;animation:pm-glyph-pulse 1.2s var(--ease-out) 1}
31
+ @keyframes pm-glyph-pulse{0%{transform:scale(1)}40%{transform:scale(1.35)}100%{transform:scale(1)}}
32
+ .pm-glyph-sheet{position:fixed;left:12px;right:12px;bottom:12px;z-index:60;background:var(--card);color:var(--ink);border-radius:var(--radius-card);box-shadow:var(--lift);padding:14px 16px}
33
+ .pm-glyph-sheet-h{display:flex;align-items:center;gap:8px;font-weight:var(--fw-strong)}
34
+ .pm-glyph-sheet p{margin:4px 0 0;font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
35
+ @media (prefers-reduced-motion:reduce){.pm-glyph[data-state="you"] .pm-glyph-dot{animation:none}}
@@ -2,7 +2,7 @@
2
2
  * The data is g.forecast on /api/insights-premium (lib/forecast.js, one straight-line method): { state, likely, low, high, by, asOf, source,
3
3
  * driftFrom, weeks, why, baseline, offer }. This module is pure HTML; premium-insights.js draws it in the goal Viewer and wires the presses.
4
4
  *
5
- * stateHtml(g, o) the state line: a tag (On track, At risk, Will miss, Held, Too early) and its words. '' when there is no forecast
5
+ * stateHtml(g, o) the state line: a state glyph (On track, At risk, Late, No signal) and its words. '' when there is no forecast
6
6
  * chartLayer(g, x, y) what the goal chart adds: the range band, the dashed likely path and the shaded readings a baseline leaves out
7
7
  * legendHtml(g) under the chart: history, likely, range, and "Projected, not promised"
8
8
  * baselineHtml(g, o) the ✓ that keeps a baseline ("Without the reading of 14 Sep, the range is 2 to 4%"), or the kept one with its ×
@@ -11,8 +11,11 @@
11
11
  * o: { md(ms) → "Oct 8", day(iso) → ms, unit(v) → "3.1%", next: "The next reading comes from Jira on Nov 3.", source, ws, rid, dismissed }
12
12
  * What-if lines (FcViewer's "Simulated, not the plan") are not drawn: no what-if proposal is filed on a goal yet. */
13
13
 
14
+ import { stateGlyph } from './state-glyph.js';
15
+
14
16
  const RANGED = new Set(['on-track', 'at-risk', 'will-miss', 'held']);
15
- const TAG = { 'on-track': ['On track', 'ok'], 'at-risk': ['At risk', 'risk'], 'will-miss': ['Will miss', 'late'], held: ['Held', ''], 'too-early': ['Too early', ''] };
17
+ // the forecast's state as a glyph (state-glyphs): the shape and its label, the words beside it stay the facts
18
+ const TAG = { 'on-track': ['on', ''], 'at-risk': ['risk', ''], 'will-miss': ['late', 'will miss the target'], held: ['none', 'readings paused'], 'too-early': ['none', 'too early to forecast'] };
16
19
  const e = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
17
20
  const n1 = (v) => String(Math.round(v * 10) / 10);
18
21
  const ICON = {
@@ -34,7 +37,7 @@ export function rangeTxt(lo, hi, unit) {
34
37
  export function stateHtml(g, o) {
35
38
  const F = g && g.forecast;
36
39
  if (!F || !TAG[F.state]) return '';
37
- const [label, tone] = TAG[F.state];
40
+ const [state, why] = TAG[F.state];
38
41
  let say = '', act = '';
39
42
  if (F.state === 'too-early') {
40
43
  const n = (g.series || []).length, wk = Math.floor(F.weeks || 0);
@@ -47,7 +50,7 @@ export function stateHtml(g, o) {
47
50
  } else {
48
51
  say = 'Likely ' + o.unit(+n1(F.likely)) + ', range ' + rangeTxt(F.low, F.high, o.unit) + '.' + (F.driftFrom ? ' Was on track on ' + o.md(o.day(F.driftFrom)) + '.' : '');
49
52
  }
50
- return `<div class="fc-state"><span class="fc-tag${tone ? ' ' + tone : ''}">${e(label)}</span><span class="fc-say">${e(say)}</span>${act}</div>`;
53
+ return `<div class="fc-state">${stateGlyph(state, { why, size: 16, progress: state === 'on' ? 1 : 0 })}<span class="fc-say">${e(say)}</span>${act}</div>`;
51
54
  }
52
55
 
53
56
  /** The spans a kept baseline leaves out, else the ones the offer would leave out: shaded on the chart so the ✓ is read against them. */
@@ -83,6 +83,7 @@ import * as PV from './prog-page.js'; // the product page is the one program a
83
83
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
84
84
  import * as SWN from './cozy-status-when.js'; // a stage move asks when it really happened (round 3 follow-up of point 18)
85
85
  import * as CC from './change-cues.js'; // idea A313: a short cue on a row that is done, before the list draws again
86
+ import { stateGlyph } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
86
87
 
87
88
  const $ = (s, r = document) => r.querySelector(s);
88
89
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -447,6 +448,8 @@ function rankIn() {
447
448
  for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: l.n + (l.n === 1 ? ' Lab finding' : ' Lab findings') + ' to keep or drop', sub: l.say || 'Keep one to start an initiative, or let it go.' });
448
449
  // weekly-what-moved (A441): last week's date and scope moves of every product, one row until the PM opens the list (pm/moves-view.js)
449
450
  if (S.movesRow) extra.push(S.movesRow);
451
+ // quiet-work-sweep (A503): the initiatives quiet 30 days or more on every product, one row a week until the PM opens the list (pm/quiet-view.js)
452
+ if (S.quietRow) extra.push(S.quietRow);
450
453
  // try-what-shipped: one row while the updates brought changes to try (beta only; GET /api/try says the row, pm/try-view.js opens the list)
451
454
  if (S.tryRow) extra.push(S.tryRow);
452
455
  return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
@@ -475,12 +478,17 @@ async function readMove() {
475
478
  S.moves = mv.filter((r) => r && r.ok);
476
479
  const prevMoves = JSON.stringify(S.movesRow || null);
477
480
  try { const MV = await import('./moves-view.js'); S.movesRow = MV.rowOf(S.moves, { looked: MV.lookedWeek() }); } catch { S.movesRow = null; }
481
+ // quiet-work-sweep (A503): each product's quiet initiatives (GET /api/quiet, from the cached line), folded into one Your move row
482
+ const qs = await Promise.all(L.map((ws) => pmGet('/api/quiet' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
483
+ S.quiet = qs.filter((r) => r && r.ok);
484
+ const prevQuiet = JSON.stringify(S.quietRow || null);
485
+ try { const QV = await import('./quiet-view.js'); S.quietRow = QV.rowOf(S.quiet, { looked: QV.lookedWeek() }); } catch { S.quietRow = null; }
478
486
  const prevTry = JSON.stringify(S.tryRow || null);
479
487
  try { const TV = await import('./try-view.js'); S.tryRow = TV.rowOf(await pmGet('/api/try').catch(() => null)); } catch { S.tryRow = null; }
480
488
  const ob = await pmGet('/api/outbox').catch(() => null);
481
489
  const outbox = ob && ob.ok && Array.isArray(ob.entries) ? ob.entries.filter((e) => e && (e.state === 'queued' || e.state === 'blocked')) : [];
482
490
  const lab = labs.filter(Boolean);
483
- const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevTry === JSON.stringify(S.tryRow || null);
491
+ const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevQuiet === JSON.stringify(S.quietRow || null) && prevTry === JSON.stringify(S.tryRow || null);
484
492
  S.move = next; S.outbox = outbox; S.lab = lab;
485
493
  if (!same) { redrawLater(); drawList(); }
486
494
  // a demotion notice is said once: drawn now, then marked seen so the next read leaves it out
@@ -518,6 +526,7 @@ async function movePress(b) {
518
526
  if (r.go === 'impact') { S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; }
519
527
  if (r.go === 'loose') { VW.drill(); LPV.open(lpHost); return; }
520
528
  if (r.go === 'moves') { VW.drill(); import('./moves-view.js').then((MV) => { MV.openMoves(S.moves || [], { toast }); S.movesRow = null; drawList(); }); return; }
529
+ if (r.go === 'quiet') { VW.drill(); import('./quiet-view.js').then((QV) => { QV.openQuiet(S.quiet || [], { pmPost, toast, toastUndo }); S.quietRow = null; drawList(); }); return; }
521
530
  if (r.go === 'try') { VW.drill(); import('./try-view.js').then((TV) => TV.openTry({ toast, toastUndo, onChange: (l) => { S.tryRow = TV.rowOf({ ...l, ok: true, row: l.total ? { ...S.tryRow, title: l.total + (l.total === 1 ? ' new thing to try' : ' new things to try') } : null }); drawList(); } })); return; }
522
531
  if (r.go === 'lab') { VW.drill(); import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: r.ws, board: r.board }), iniHref: (id) => '/premium-initiative.html?' + (r.ws ? 'ws=' + encodeURIComponent(r.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })); return; }
523
532
  return;
@@ -851,9 +860,10 @@ function headOf(id) {
851
860
  }
852
861
  /* An item's mark (AgInitAgents, AgInitStalled): done ✓, the PM's ring, the working agent's avatar, an empty grey circle for a step that is
853
862
  * next, ! for a risk, J for Jira. Its tag: You; Working (a plain word), or Stuck (an outlined pill) when the initiative is stalled; Next. */
854
- const markHtml = (k, role) => (k === 'done' ? `<span class="hm-mk done" aria-hidden="true">${SVG(I.check, 12, 3)}</span>` : k === 'risk' ? '<span class="hm-mk risk" aria-hidden="true">!</span>' : k === 'jira' ? '<span class="hm-mk jira" aria-hidden="true">J</span>'
863
+ // done, at risk and no signal are the shared state glyph (state-glyphs); the state word they had as a tag goes
864
+ const markHtml = (k, role) => (k === 'done' || k === 'risk' || k === 'none' ? stateGlyph(k, { size: 18, cls: 'hm-mk-g' }) : k === 'jira' ? '<span class="hm-mk jira" aria-hidden="true">J</span>'
855
865
  : k === 'agent' && role ? avHtml(role, 20, 'hm-mk-av') : `<span class="hm-mk ${esc(k)}" aria-hidden="true"></span>`);
856
- const TAG = { you: 'You', agent: 'Working', wait: 'Next', jira: 'Jira', risk: 'At risk', none: 'No signal' };
866
+ const TAG = { you: 'You', agent: 'Working', wait: 'Next', jira: 'Jira' };
857
867
  const itemHtml = (x, o = {}) => {
858
868
  const k = x.kind === 'agent' && !o.role && !o.stalled ? 'wait' : x.kind; // an agent step with no agent at work on it waits: it is next
859
869
  const tag = k === 'agent' && o.stalled ? 'Stuck' : TAG[k];
@@ -1253,7 +1263,7 @@ async function fillGoals(b, ws) {
1253
1263
  const L = r && r.ok ? OKL.productLine(r) : null, line = b.querySelector('[data-okr-line]'), dots = b.querySelector('[data-okr-dots]');
1254
1264
  if (!line) return;
1255
1265
  line.textContent = L ? L.text : 'Open them in Intelligence';
1256
- if (dots) dots.innerHTML = L ? L.dots.map((d) => OKL.dotHtml(d)).join('') : '';
1266
+ if (dots) dots.innerHTML = L ? L.dots.map((d) => OKL.dotHtml(d, '', 10)).join('') : '';
1257
1267
  }
1258
1268
  /** The product's page in the Viewer (HbCProduct): Goals, the KRs and budgets with what is at risk, and This week, the weekly update and the
1259
1269
  * metrics review. A press opens that one; ← comes back to the page. */
@@ -221,6 +221,7 @@
221
221
  @media (prefers-reduced-motion:reduce) {
222
222
  .pm-ds .pm-chart path.line, .pm-ds .pm-li.gone, .pm-ds .pm-tip{transition:none}
223
223
  }
224
+ .pm-ds{--state-on:var(--leaf);--state-risk:var(--alert);--state-late:var(--alert);--state-you:var(--blue);--state-wait:var(--muted);--state-none:var(--muted);--state-done:var(--leaf)}
224
225
  .pm-ds .pm-tip{left:var(--pm-tip-x,0);top:var(--pm-tip-y,0)}
225
226
  .pm-ds .pm-leg i.pm-sw-blue{background:var(--blue)}
226
227
  .pm-ds .pm-leg i.pm-sw-leaf{background:var(--leaf)}
@@ -16,7 +16,9 @@
16
16
  * source({ model, redraw }) a page's data (a root, or a list of roots) and the draw that shows it; returns the call that removes it.
17
17
  * view(el, redraw) an open view drawn from those sources (the popup body, the big Work breakdown); dropped once el leaves the page.
18
18
  *
19
- * Pure apart from the redraw calls and install(): no DOM reads, no requests of its own, so live-edit.test.js runs it in Node.
19
+ * remote(ops) a change made elsewhere (the chat, another tab): put on every copy and drawn at once (pm/live-feed.js)
20
+ *
21
+ * Pure apart from the redraw calls, install() and the live-feed start: no DOM reads, so live-edit.test.js runs it in Node.
20
22
  */
21
23
 
22
24
  /** The write's field → the names a page's copy of a task uses for it (the Board's rows say status and end; Home's and the Backlog's say
@@ -204,6 +206,30 @@ export function paint(views = true) {
204
206
  }
205
207
  }
206
208
 
209
+ /** A change made somewhere else: by the chat (the server's live stream, pm/live-feed.js) or by a press in another tab of this browser.
210
+ * It is put on every copy the pages hold and drawn at once, like a press here, but nothing waits for an answer: the next read holds it
211
+ * anyway. Returns how many copies changed. */
212
+ export function remote(ops) {
213
+ const list = (Array.isArray(ops) ? ops : [ops]).filter((op) => op && typeof op === 'object' && (op.id || op.ini));
214
+ let n = 0;
215
+ for (const op of list) n += apply(op).length;
216
+ if (n) paint();
217
+ return n;
218
+ }
219
+
220
+ // a press that landed here shows in this browser's other tabs at once (bet A458); a stand-in row for a new task stays in this tab
221
+ let CHANNEL = null;
222
+ function share(ops) {
223
+ try {
224
+ if (!CHANNEL && typeof BroadcastChannel === 'function' && typeof window !== 'undefined') {
225
+ CHANNEL = new BroadcastChannel('pmos-live');
226
+ CHANNEL.onmessage = (m) => { if (m && m.data && Array.isArray(m.data.ops)) remote(m.data.ops); };
227
+ }
228
+ const out = ops.filter((op) => op.kind === 'patch' || op.kind === 'remove');
229
+ if (CHANNEL && out.length) CHANNEL.postMessage({ ops: out });
230
+ } catch { /* the other tabs read it on their next read */ }
231
+ }
232
+
207
233
  /** A write is about to be sent. null when it is not a task write. */
208
234
  export function begin(path, body) {
209
235
  const ops = opsOf(path, body);
@@ -212,7 +238,8 @@ export function begin(path, body) {
212
238
  const steps = ops.flatMap((op) => apply(op));
213
239
  if (steps.length) paint();
214
240
  return {
215
- ok(at) { const t = at || Date.now(); for (const [, e] of entries) e.saved = t; },
241
+ ops,
242
+ ok(at) { const t = at || Date.now(); for (const [, e] of entries) e.saved = t; share(ops); },
216
243
  fail() {
217
244
  for (const [k] of entries) PENDING.delete(k);
218
245
  // only a copy still showing this change goes back: a newer read or a newer change is left as it is
@@ -278,7 +305,11 @@ export function install(g = globalThis) {
278
305
  g.fetch = watched;
279
306
  return true;
280
307
  }
281
- if (typeof window !== 'undefined' && typeof document !== 'undefined') install(window);
308
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
309
+ install(window);
310
+ // the chat's changes and the other tabs' presses arrive here too (bet A458); the stream is the one request this module starts
311
+ import('./live-feed.js').then((m) => m.start(window)).catch(() => { /* the turn-end read still draws them */ });
312
+ }
282
313
 
283
314
  export function source(s) { SOURCES.add(s); return () => SOURCES.delete(s); }
284
315
  export function view(el, redraw) { VIEWS.set(el, redraw); return () => { if (VIEWS.get(el) === redraw) VIEWS.delete(el); }; }