create-pmos 0.712.0 → 0.714.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 (123) hide show
  1. package/package.json +99 -51
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/ui/README.md +1 -1
  4. package/payload/design-system/ui/components/State/README.md +21 -0
  5. package/payload/design-system/ui/components/State/preview.html +8 -0
  6. package/payload/design-system/ui/components/bundle.css +12 -0
  7. package/payload/design-system/ui/interactions.md +10 -0
  8. package/payload/planning/evals/eval-calibration.md +1 -1
  9. package/payload/planning/okrs/health-budgets.md +1 -1
  10. package/payload/state/discoveries.md +1 -1
  11. package/workspace/bin/back-place-health.js +70 -0
  12. package/workspace/changelog.json +98 -0
  13. package/workspace/design-system/ui/README.md +1 -1
  14. package/workspace/design-system/ui/components/State/README.md +21 -0
  15. package/workspace/design-system/ui/components/State/preview.html +8 -0
  16. package/workspace/design-system/ui/components/bundle.css +12 -0
  17. package/workspace/design-system/ui/interactions.md +10 -0
  18. package/workspace/guide/breakdown.md +20 -1
  19. package/workspace/guide/claude-proposes.md +5 -1
  20. package/workspace/guide/cli.md +10 -1
  21. package/workspace/guide/home.md +1 -0
  22. package/workspace/guide/initiatives-and-next-steps.md +13 -0
  23. package/workspace/guide/layout.md +27 -1
  24. package/workspace/guide/routine.md +10 -2
  25. package/workspace/guide/settings-and-switches.md +4 -0
  26. package/workspace/lib/briefing-premium-products.js +16 -2
  27. package/workspace/lib/changed-mark.js +34 -0
  28. package/workspace/lib/launch-cli.js +43 -5
  29. package/workspace/lib/launch-tiers.js +143 -0
  30. package/workspace/lib/moments.js +41 -3
  31. package/workspace/lib/needs-providers.js +1 -0
  32. package/workspace/lib/parked-cli.js +105 -0
  33. package/workspace/lib/parked-reasons.js +245 -0
  34. package/workspace/lib/pmos-verbs.js +4 -1
  35. package/workspace/lib/prefs-sync.js +138 -0
  36. package/workspace/lib/product-dots.js +60 -0
  37. package/workspace/lib/route-modules.js +2 -0
  38. package/workspace/lib/routes-briefing-premium.js +11 -1
  39. package/workspace/lib/routes-moments.js +1 -1
  40. package/workspace/lib/routes-prefs.js +56 -0
  41. package/workspace/lib/routes-strategy-card.js +53 -0
  42. package/workspace/lib/routes-use-log.js +24 -3
  43. package/workspace/lib/routine-sentence.js +250 -0
  44. package/workspace/lib/strategy-card.js +133 -0
  45. package/workspace/lib/unused-controls.js +178 -0
  46. package/workspace/lib/use-log.js +27 -3
  47. package/workspace/package-lock.json +2 -2
  48. package/workspace/package.json +1 -1
  49. package/workspace/premium-vw-doc-test.js +2 -0
  50. package/workspace/public/pm/action-keys.js +187 -0
  51. package/workspace/public/pm/back-place.js +87 -0
  52. package/workspace/public/pm/bd-pop-ds.css +10 -0
  53. package/workspace/public/pm/bd-pop-ds.js +27 -3
  54. package/workspace/public/pm/bd-strategy.js +85 -0
  55. package/workspace/public/pm/bd-views.js +2 -1
  56. package/workspace/public/pm/changed-mark.css +7 -0
  57. package/workspace/public/pm/changed-mark.js +117 -0
  58. package/workspace/public/pm/cozy-ev.css +7 -0
  59. package/workspace/public/pm/cozy-nav.js +2 -0
  60. package/workspace/public/pm/cozy-pick.css +12 -0
  61. package/workspace/public/pm/cozy-pop-work.css +10 -1
  62. package/workspace/public/pm/cozy-pop-work.js +201 -17
  63. package/workspace/public/pm/cozy-routine-job.js +50 -7
  64. package/workspace/public/pm/cozy-routine.css +2 -0
  65. package/workspace/public/pm/cozy-settings.js +21 -3
  66. package/workspace/public/pm/cozy-today-page.css +1 -0
  67. package/workspace/public/pm/cozy-viewer.css +1 -1
  68. package/workspace/public/pm/cozy-viewer.js +14 -2
  69. package/workspace/public/pm/cozy-vw-mtg.css +0 -2
  70. package/workspace/public/pm/cozy-vw.css +0 -1
  71. package/workspace/public/pm/home-app.js +21 -1
  72. package/workspace/public/pm/home-today.js +2 -0
  73. package/workspace/public/pm/ini-tasks.js +4 -1
  74. package/workspace/public/pm/komorebi.css +11 -0
  75. package/workspace/public/pm/page-chat.js +16 -0
  76. package/workspace/public/pm/prefs-sync.js +111 -0
  77. package/workspace/public/pm/premium-board.js +20 -2
  78. package/workspace/public/pm/premium-chart-tab.js +2 -1
  79. package/workspace/public/pm/premium-insights.js +2 -2
  80. package/workspace/public/pm/premium-mtg-replay.js +4 -3
  81. package/workspace/public/pm/premium-report-read.js +5 -4
  82. package/workspace/public/pm/premium-report-tab.js +4 -3
  83. package/workspace/public/pm/premium-vw-backlog.css +2 -1
  84. package/workspace/public/pm/premium-vw-backlog.js +4 -3
  85. package/workspace/public/pm/premium-vw-cal.css +1 -2
  86. package/workspace/public/pm/premium-vw-cal.js +14 -13
  87. package/workspace/public/pm/premium-vw-copies.js +3 -2
  88. package/workspace/public/pm/premium-vw-copy.css +0 -3
  89. package/workspace/public/pm/premium-vw-mtg.js +12 -11
  90. package/workspace/public/pm/product-switcher.js +41 -0
  91. package/workspace/public/pm/quiet-place.js +15 -2
  92. package/workspace/public/pm/report-orders-ui.js +2 -1
  93. package/workspace/public/pm/rp-parts.js +3 -2
  94. package/workspace/public/pm/state-blocks.js +67 -0
  95. package/workspace/public/pm/use-log.js +127 -1
  96. package/workspace/public/pm/work-select.js +92 -2
  97. package/workspace/public/pm/work-tree.js +70 -0
  98. package/workspace/public/premium-aud.html +1 -0
  99. package/workspace/public/premium-board.html +5 -0
  100. package/workspace/public/premium-buddy.html +1 -0
  101. package/workspace/public/premium-events.html +1 -0
  102. package/workspace/public/premium-goals.html +1 -0
  103. package/workspace/public/premium-intelligence.html +1 -0
  104. package/workspace/public/premium-library.html +1 -0
  105. package/workspace/public/premium-present.html +1 -0
  106. package/workspace/public/premium-rec.html +1 -0
  107. package/workspace/public/premium-routine.html +1 -0
  108. package/workspace/public/premium-viewer.html +1 -0
  109. package/workspace/public/premium-workflows.html +1 -0
  110. package/workspace/public/today.html +1 -0
  111. package/workspace/server.js +20 -0
  112. package/workspace/test-lists/action-keys.json +9 -0
  113. package/workspace/test-lists/back-place.json +9 -0
  114. package/workspace/test-lists/changed-mark.json +9 -0
  115. package/workspace/test-lists/launch-tiers.json +9 -0
  116. package/workspace/test-lists/parked-reasons.json +9 -0
  117. package/workspace/test-lists/prefs-follow-person.json +9 -0
  118. package/workspace/test-lists/product-switcher-dots.json +9 -0
  119. package/workspace/test-lists/routine-sentence.json +9 -0
  120. package/workspace/test-lists/shared-empty-states.json +9 -0
  121. package/workspace/test-lists/strategy-card.json +9 -0
  122. package/workspace/test-lists/unused-controls.json +9 -0
  123. package/workspace/test-lists/work-subtasks-followups.json +9 -0
@@ -0,0 +1,85 @@
1
+ /* pm/bd-strategy.js — the product's strategy in five lines, above the initiatives on its Board (bet A458, initiative strategy-five-lines).
2
+ *
3
+ * mount(host, { ws, board, single, say }) → draws the card into `host`; a Board that shows several products at once shows no card
4
+ *
5
+ * Built only from Komorebi parts: a Detail block (pm-block, its head with icon buttons, pm-field), pm-input to edit in place, pm-fold and
6
+ * pm-li for the notes. It reads and writes GET and POST /api/strategy-card (lib/routes-strategy-card.js) and nothing else.
7
+ * · Not written: one quiet line, "Strategy · not written yet", and the pencil.
8
+ * · Written: the five lines. Once all five are written, new work that does not fit folds under one line, "2 don't fit", that opens
9
+ * them, each with why. A note informs only; nothing is moved or blocked. No note, no line (zero is silence).
10
+ * · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
11
+ * The controls carry ids (bdStratEdit, bdStratSave, bdStratFits) so the local use log counts their use (the bet's kill line). */
12
+ import { pmPost } from './http.js';
13
+
14
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
16
+ const I = { compass: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18M15.5 8.5l-2 5-5 2 2-5z', pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4', ok: 'M5 12l5 5 9-10',
17
+ x: 'M6 6l12 12M18 6L6 18', chev: 'M7 10l5 5 5-5' };
18
+ export const FIELDS = ['for', 'problem', 'bet', 'win', 'wont'];
19
+ const LABELS = { for: 'Who it is for', problem: 'The problem', bet: 'The bet', win: 'How we win', wont: "What we won't do" };
20
+ const HINT = { for: 'Parents of primary pupils', problem: 'Exam prep is scattered across apps', bet: 'One weekly plan per child', win: "Teachers' own past papers", wont: 'Live tutoring, adult courses' };
21
+
22
+ /** The fold's words: "1 doesn't fit", "3 don't fit". */
23
+ export const fitsLine = (n) => n + (n === 1 ? " doesn't fit" : " don't fit");
24
+ const isEmpty = (c) => !c || FIELDS.every((k) => !String(c[k] || '').trim());
25
+
26
+ /** The card's markup. state = { card, complete, notes, editing, open }. Pure, so the test reads it. */
27
+ export function cardHtml(state) {
28
+ const { card, notes, editing, open } = state;
29
+ const head = (title, meta, acts) => `<div class="head">${SV(I.compass)}<h3 class="pm-h-sm" style="flex:1">${esc(title)}${meta ? ` <span class="pm-meta">· ${esc(meta)}</span>` : ''}</h3>${acts}</div>`;
30
+ const btn = (id, icon, label, kind) => `<button type="button" class="pm-btn${kind ? ' ' + kind : ''}" id="${id}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
31
+ if (editing) {
32
+ const rows = FIELDS.map((k) => `<dt><label for="bdStrat-${k}">${esc(LABELS[k])}</label></dt><dd><input class="pm-input" id="bdStrat-${k}" data-strat="${k}" maxlength="160" value="${esc(card && card[k])}" placeholder="${esc(HINT[k])}" /></dd>`).join('');
33
+ return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', btn('bdStratCancel', I.x, 'Cancel (Esc)', 'outline') + btn('bdStratSave', I.ok, 'Save the strategy', 'primary'))}<dl class="pm-field" style="margin:0">${rows}</dl></section>`;
34
+ }
35
+ if (isEmpty(card)) return `<section class="pm-block flat" aria-label="Strategy">${head('Strategy', 'not written yet', btn('bdStratEdit', I.pen, 'Write the strategy in five lines'))}</section>`;
36
+ const rows = FIELDS.map((k) => `<dt>${esc(LABELS[k])}</dt><dd>${String(card[k] || '').trim() ? esc(card[k]) : '<span class="pm-meta">Not written</span>'}</dd>`).join('');
37
+ const n = Array.isArray(notes) ? notes.length : 0;
38
+ const fold = n ? `<button type="button" class="pm-fold" id="bdStratFits" aria-expanded="${!!open}">${SV(I.chev)}${esc(fitsLine(n))}</button>`
39
+ + (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
40
+ : '';
41
+ return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}</section>`;
42
+ }
43
+
44
+ /** Draw the card again after a read of the Board, unless the PM is writing in it. */
45
+ export function refresh(host, opts) {
46
+ if (!host || host.querySelector('[data-strat]')) return;
47
+ mount(host, opts);
48
+ }
49
+
50
+ /** Draw the card into `host` and wire its presses. */
51
+ export async function mount(host, opts = {}) {
52
+ if (!host) return;
53
+ const { ws = null, board = null, single = true, say = null } = opts;
54
+ if (!single) { host.hidden = true; host.innerHTML = ''; return; }
55
+ const q = (ws ? '?ws=' + encodeURIComponent(ws) : '?') + (board ? (ws ? '&' : '') + 'board=' + encodeURIComponent(board) : '');
56
+ let r = null; try { r = await (await fetch('/api/strategy-card' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
57
+ if (!r || !r.ok) { host.hidden = true; return; } // the card is an extra: a failed read leaves the Board as it was
58
+ const S = { card: r.card, complete: r.complete, notes: r.notes, editing: false, open: host.dataset.open === '1' };
59
+ const draw = () => {
60
+ host.hidden = false; host.innerHTML = cardHtml(S);
61
+ if (S.editing) { const f = host.querySelector('[data-strat]'); if (f) f.focus(); }
62
+ };
63
+ const save = async () => {
64
+ const fields = {}; host.querySelectorAll('[data-strat]').forEach((el) => { fields[el.dataset.strat] = el.value; });
65
+ const before = Object.fromEntries(FIELDS.map((k) => [k, (S.card && S.card[k]) || '']));
66
+ const res = await pmPost('/api/strategy-card', { ws, fields }).catch(() => null);
67
+ if (!res || !res.ok) { if (say) say((res && res.error) || 'The strategy was not saved.'); return; }
68
+ S.editing = false; draw();
69
+ if (say) say('Strategy saved.', async () => { await pmPost('/api/strategy-card', { ws, fields: before }).catch(() => null); mount(host, opts); });
70
+ mount(host, opts);
71
+ };
72
+ host.onclick = (e) => {
73
+ const b = e.target.closest('button'); if (!b) return;
74
+ if (b.id === 'bdStratEdit') { S.editing = true; draw(); }
75
+ else if (b.id === 'bdStratCancel') { S.editing = false; draw(); }
76
+ else if (b.id === 'bdStratSave') save();
77
+ else if (b.id === 'bdStratFits') { S.open = !S.open; host.dataset.open = S.open ? '1' : ''; draw(); }
78
+ };
79
+ host.onkeydown = (e) => {
80
+ if (!S.editing) return;
81
+ if (e.key === 'Escape') { e.preventDefault(); S.editing = false; draw(); }
82
+ else if (e.key === 'Enter' && e.target.matches('[data-strat]')) { e.preventDefault(); save(); }
83
+ };
84
+ draw();
85
+ }
@@ -13,6 +13,7 @@ import { esc } from './premium-shell.js';
13
13
  import * as WF from './bd-wf.js';
14
14
  import * as GL from './bd-goal.js'; // By goal in every view (batch 29 item 4): a goal's head over its rows
15
15
  import { nextHtml } from './bd-next.js';
16
+ import { markFor } from './changed-mark.js'; // bet A456: the ✦ and Undo on a row PMOS changed in the last 24 h
16
17
  import { stageName, stageChip } from './stage-chip.js'; // W1: the one stage
17
18
  import { provenStatus, NO_SIGNAL } from './status-proof.js'; // T3: a status renders only with its source and read time
18
19
 
@@ -86,7 +87,7 @@ function listRow(r, pg) {
86
87
  + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${WK.iconHtml(r.kind)}${nameHtml(r)}</b></button>${pcells}`
87
88
  + `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${stageChip(r, { ms: (r.track || {}).ms })}${(r.track || {}).days ? ' <span class="bd-ell">' + (r.track || {}).days + 'd</span>' : ''}</span><span role="cell">${catPill(r)}</span>`
88
89
  + `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
89
- + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}</span>`
90
+ + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, factory: M().board.factory, due: false })}${markFor(r.ws || M().board.ws || '', r.id)}</span>`
90
91
  + `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span>`
91
92
  + `<button type="button" class="bd-ib sm" data-rowmenu="${esc(r.key)}" aria-haspopup="menu" aria-expanded="false" aria-label="More for ${esc(r.title)}" title="Actions">${SV(MORE)}</button></div>`;
92
93
  }
@@ -0,0 +1,7 @@
1
+ /* changed-mark.css — the ✦ and Undo on a row PMOS changed by itself in the last 24 h (pm/changed-mark.js, bet A456).
2
+ * Komorebi parts (pm-btn, pm-ic) and tokens only. */
3
+ .chg-mk { display: inline-flex; align-items: center; gap: var(--space-4); margin-left: var(--space-8); vertical-align: middle; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
4
+ .chg-mk .chg-sg { font-style: normal; color: var(--blue); }
5
+ .pm-ds .chg-mk .chg-un { width: var(--space-24); height: var(--space-24); color: var(--muted); }
6
+ @media (hover: hover) { .pm-ds .chg-mk .chg-un:hover { color: var(--ink); } }
7
+ .chg-mk.bad { color: var(--alert); }
@@ -0,0 +1,117 @@
1
+ /* pm/changed-mark.js — Undo right on the item PMOS changed (bet A456, initiative undo-on-changed-item).
2
+ *
3
+ * PMOS applies class A and B changes by itself (D106); each has an Undo in the logs (Home's "PMOS did", the routine log, the Viewer's work
4
+ * list). This puts the newest one on the item itself for 24 hours: a small ✦ and an Undo button on the initiative's row, the words in the
5
+ * tooltip and the accessible name ("signal, not label").
6
+ *
7
+ * latestOf(done, ws, now) → Map<ini, change> PURE: per initiative, the newest change applied in the last WINDOW_MS that is still undoable
8
+ * markHtml(c) → html PURE: the mark for one change ('' for none)
9
+ * afterUndo(state, ws, ref, answer) → { ok, error } PURE: the step after a press; a change that went back leaves the map
10
+ * read(wsList, redraw) reads GET /api/autonomy?ws= per product, at most once a minute each, then calls redraw()
11
+ * markFor(ws, ini) → html the mark for a row, from the last read
12
+ * bind({ onUndone }) one delegated press handler for every mark on the page: POST /api/autonomy/undo { ws, ref }
13
+ *
14
+ * It reads and posts only to the workspace's own server. Each Undo writes one [changed-mark] line to the console (the health log); the
15
+ * health number is the presses of data-changed-undo in the local use log (node lib/changed-mark.js uses). */
16
+ import { pmGet, pmPost } from './http.js';
17
+
18
+ export const WINDOW_MS = 24 * 3600 * 1000;
19
+ const SKEW_MS = 60 * 1000;
20
+ const READ_EVERY_MS = 60 * 1000;
21
+ const UNDO_PATH = 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3';
22
+
23
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
24
+ const str = (v) => (typeof v === 'string' ? v : '');
25
+
26
+ /** "3 h ago", "12 min ago", "just now" */
27
+ export function agoText(at, now) {
28
+ const m = Math.max(0, Math.round((now - Date.parse(at)) / 60000));
29
+ if (m < 1) return 'just now';
30
+ if (m < 60) return m + ' min ago';
31
+ return Math.round(m / 60) + ' h ago';
32
+ }
33
+
34
+ export function latestOf(done, ws, now = Date.now()) {
35
+ const out = new Map();
36
+ for (const d of Array.isArray(done) ? done : []) {
37
+ if (!d || typeof d !== 'object') continue;
38
+ const ini = str(d.ini), ref = str(d.ref), t = Date.parse(str(d.at));
39
+ if (!ini || !ref || !Number.isFinite(t)) continue;
40
+ if (t < now - WINDOW_MS || t > now + SKEW_MS) continue;
41
+ const until = Date.parse(str(d.undo_until));
42
+ if (Number.isFinite(until) && until <= now) continue;
43
+ const had = out.get(ini);
44
+ if (had && Date.parse(had.at) >= t) continue;
45
+ out.set(ini, { ws: str(ws), ini, ref, at: d.at, title: str(d.title) || 'A change', reason: str(d.reason), failed: '' });
46
+ }
47
+ return out;
48
+ }
49
+
50
+ export function markHtml(c, now = Date.now()) {
51
+ if (!c || !c.ref) return '';
52
+ const tip = 'Changed by PMOS ' + agoText(c.at, now) + ': ' + c.title + (c.reason ? ' · ' + c.reason : '');
53
+ if (c.failed) return `<span class="chg-mk bad" role="status" title="${esc(tip)}">Undo did not work: ${esc(c.failed)}</span>`;
54
+ return `<span class="chg-mk" title="${esc(tip)}"><i class="chg-sg" aria-hidden="true">✦</i>`
55
+ + `<button type="button" class="pm-btn chg-un" data-changed-undo data-ref="${esc(c.ref)}" data-ws="${esc(c.ws)}" aria-label="${esc('Undo: ' + c.title)}" title="${esc('Undo · ' + tip)}">`
56
+ + `<svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="${UNDO_PATH}"/></svg></button></span>`;
57
+ }
58
+
59
+ /* the page's state: per product, the last read time and the marks */
60
+ const S = { per: new Map() }; // ws → { at, marks: Map<ini, change> }
61
+
62
+ export function afterUndo(state, ws, ref, answer) {
63
+ const p = state.per.get(ws);
64
+ const hit = p ? [...p.marks.values()].find((c) => c.ref === ref) : null;
65
+ if (answer && answer.ok) { if (p && hit) p.marks.delete(hit.ini); return { ok: true, error: '' }; }
66
+ const error = (answer && answer.error) || 'the workspace server did not answer';
67
+ if (hit) hit.failed = error;
68
+ return { ok: false, error };
69
+ }
70
+
71
+ export async function read(wsList, redraw, now = Date.now()) {
72
+ const list = [...new Set((wsList || []).map(str))];
73
+ const due = list.filter((ws) => { const p = S.per.get(ws); return !p || now - p.at >= READ_EVERY_MS; });
74
+ if (!due.length) return false;
75
+ for (const ws of due) S.per.set(ws, { at: now, marks: (S.per.get(ws) || {}).marks || new Map() });
76
+ const got = await Promise.all(due.map((ws) => pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
77
+ let changed = false;
78
+ due.forEach((ws, i) => {
79
+ const a = got[i];
80
+ if (!a || !a.ok) return; // an unread product keeps its last marks; nothing is guessed
81
+ const marks = latestOf(a.done, ws, Date.now());
82
+ const before = S.per.get(ws).marks;
83
+ if (marks.size || before.size) changed = true;
84
+ S.per.set(ws, { at: now, marks });
85
+ });
86
+ if (changed && typeof redraw === 'function') redraw();
87
+ return changed;
88
+ }
89
+
90
+ export function markFor(ws, ini) {
91
+ const p = S.per.get(str(ws));
92
+ const c = p ? p.marks.get(str(ini)) : null;
93
+ if (!c) return '';
94
+ if (Date.now() - Date.parse(c.at) > WINDOW_MS) { p.marks.delete(c.ini); return ''; }
95
+ return markHtml(c);
96
+ }
97
+
98
+ let bound = false;
99
+ export function bind({ onUndone } = {}) {
100
+ if (bound || typeof document === 'undefined') return;
101
+ bound = true;
102
+ // one listener on the document for every mark's Undo; each Undo is a real <button> (Komorebi pm-btn), so it has its role and keyboard
103
+ document.addEventListener('click', async (e) => {
104
+ const b = e.target && e.target.closest ? e.target.closest('[data-changed-undo]') : null;
105
+ if (!b) return;
106
+ e.preventDefault(); e.stopPropagation();
107
+ if (b.disabled) return;
108
+ b.disabled = true;
109
+ const ws = b.dataset.ws || '', ref = b.dataset.ref || '';
110
+ const answer = await pmPost('/api/autonomy/undo', { ws: ws || undefined, ref }).catch(() => null);
111
+ const r = afterUndo(S, ws, ref, answer);
112
+ try { console.info('[changed-mark] undo ' + ref + (r.ok ? ' ok' : ' failed: ' + r.error)); } catch { /* no console */ }
113
+ if (typeof onUndone === 'function') onUndone(r);
114
+ });
115
+ }
116
+
117
+ export const _state = S; // tests
@@ -413,6 +413,9 @@
413
413
  /* a quiet place (pm/quiet-place.js, onboarding B3 ObA4Gradual): one honest line instead of empty tables, until its moment comes */
414
414
  .qp-on > :not(.qp-line) { display: none !important; }
415
415
  .qp-line { margin: 18vh auto 0; max-width: 520px; padding: 0 var(--space-16); text-align: center; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink2); line-height: 1.5; }
416
+ .qp-line > p { margin: 0; }
417
+ /* its one next step (initiative empty-page-next-action): the Komorebi Suggestion part, under the line, left-aligned inside */
418
+ .qp-line .pm-state-next, .ins-empty .pm-state-next { display: inline-flex; margin-top: var(--space-16); text-align: left; font-weight: var(--fw-regular); }
416
419
  /* Settings › Claude › How Claude decides and Lessons (boards AwG, AwG2): a lesson says what went wrong in amber, what changed in blue */
417
420
  .cz .ev-lead { margin: 0 0 var(--space-4); }
418
421
  .cz .ev-ls { display: flex; flex-direction: column; gap: 2px; }
@@ -539,3 +542,7 @@
539
542
  .ev-st.pm-ds svg.ev-gbar .bg { fill: var(--well); }
540
543
  .ev-st.pm-ds svg.ev-gbar .fg { fill: var(--leaf); }
541
544
 
545
+ /* ── the ? list of action keys (pm/action-keys.js, bet A477): a Komorebi sheet over the page; its parts are pm-h-sm, pm-row, pm-kbd, pm-meta, pm-btn ── */
546
+ .ev-keys.pm-ds { border: 0; border-radius: var(--radius-card); background: var(--card); color: var(--ink); box-shadow: var(--lift); padding: var(--space-24); width: min(420px, calc(100% - var(--space-32))); }
547
+ .ev-keys.pm-ds .ev-keys-head { justify-content: space-between; }
548
+ .ev-keys.pm-ds .ev-keys-list { list-style: none; margin: var(--space-16) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
@@ -44,6 +44,7 @@ import { mountToastFaces, loadPrefs } from './cozy-adler.js';
44
44
  import './draft-keep.js'; // forms-keep-drafts: every text box on every page keeps a draft until sent, saved or cleared
45
45
  import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
46
46
  import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
47
+ import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
47
48
 
48
49
  /* The six places (slice 1). A place shows once it has an href: Events, Library and Routine get theirs when their slice ships. Until then
49
50
  * Today is today.html (slice 5; Home before it), Work is the Board and Goals is premium-goals.html (slice 9; Intelligence before it); the keys stay the pages' own (home, board, insights). */
@@ -200,6 +201,7 @@ export function mountNav(here, doc = document, opts = {}) {
200
201
  doc.body.appendChild(w);
201
202
  mountToastFaces(doc); loadPrefs();
202
203
  startUseLog(doc);
204
+ startActionKeys(doc);
203
205
  const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
204
206
  const draw = () => {
205
207
  N.rail = railOn();
@@ -45,3 +45,15 @@
45
45
  /* pm/scope-chip.js: the menu's three parts (Products, Programs, Projects) */
46
46
  .scp-h { margin: var(--space-8) 10px var(--space-4); font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: .06em; text-transform: uppercase; color: var(--cz-ink3); }
47
47
  .scp-menu:not(.sheet) { left: var(--fr-menu-x, 12px); top: var(--fr-menu-y, 64px); }
48
+ /* pm/product-switcher.js (bet A381): one row of the chip's tiles on Today and Work; a tile's blue dot is its product needing the PM (no count);
49
+ * the product shown alone has the chip's open ring */
50
+ .psw { display: flex; align-items: center; gap: var(--space-4); overflow-x: auto; scrollbar-width: none; flex: none; }
51
+ .psw::-webkit-scrollbar { display: none; }
52
+ .psw-b { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; flex: none; }
53
+ .psw-b:hover, .psw-b:focus-visible { background: var(--cz-well); }
54
+ .psw-b[aria-pressed="true"] { background: var(--cz-bluebg); box-shadow: 0 0 0 2px var(--cz-c-b6c6dc); }
55
+ .psw-b .ppk-t { box-shadow: none; }
56
+ .psw-dot { position: absolute; top: 1px; right: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-blue); box-shadow: 0 0 0 2px var(--cz-card); }
57
+ .hv-psw { padding: 0 0 var(--space-8); }
58
+ @media (max-width: 760px) { .psw-b { width: 44px; height: 44px; } }
59
+ #crumbHost:has(.psw) { display: inline-flex; align-items: center; gap: var(--space-8); }
@@ -280,7 +280,9 @@ button.pw-fv .grey { color: var(--cz-ink3); }
280
280
  .pw-ph .pw-loose .pw-lk, .pw-pdocs { font-size: var(--fs-meta); color: var(--cz-ink2); }
281
281
  .pw-pdocs { display: inline-flex; align-items: center; gap: 2px; margin-top: 10px; border: 0; padding: 0; background: none; cursor: pointer; font-family: inherit; }
282
282
  .pw-pnone { margin: 6px 0 0; font-size: var(--fs-meta); color: var(--cz-ink3); }
283
- .pw-pask { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 4; display: flex; align-items: center; gap: var(--space-8); padding: 6px 6px 6px var(--space-16); border-radius: 26px; background: var(--cz-well); }
283
+ /* the ask box closes the page, in the flow (release check 0.711.0, phone-no-covered-control): pinned over the Viewer, which is itself
284
+ pinned on a phone, it covered the last Artefacts row */
285
+ .pw-pask { margin: var(--space-24) 0 calc(env(safe-area-inset-bottom, 0px) + var(--space-12)); display: flex; align-items: center; gap: var(--space-8); padding: 6px 6px 6px var(--space-16); border-radius: 26px; background: var(--cz-well); }
284
286
  .pw-pask input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: var(--fs-body); color: var(--cz-ink); height: 36px; }
285
287
  .pw-pask input::placeholder { color: var(--cz-ink3); }
286
288
  .pw-pask button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--cz-solid); color: var(--cz-onsolid); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
@@ -345,3 +347,10 @@ button.pw-fv .grey { color: var(--cz-ink3); }
345
347
  .pw-pbar { position: absolute; top: 50%; height: 10px; margin-top: -5px; border: 1.5px solid currentColor; border-radius: 3px; box-sizing: border-box; color: var(--cz-ink2); overflow: hidden; }
346
348
  .pw-pbar b { display: block; height: 100%; background: currentColor; }
347
349
  .pw-pbar.dn { opacity: .6; }
350
+ /* the follow-ups (initiative work-subtasks-followups): the Gantt's Jira column, a picked phone row, a bar while it is dragged. Tokens only. */
351
+ .pw-jc { display: flex; align-items: center; gap: var(--space-4); min-width: 0; overflow: hidden; padding: 0 var(--space-8); }
352
+ .pw-wbs.jc .pw-tr:not(.pw-sugrow):not(.pw-add) { grid-template-columns: var(--pw-gc); }
353
+ .pw-kr .pw-tl .iva-tb, .pw-kr .pw-tl .pw-pbar { cursor: ew-resize; }
354
+ .pw-ptk2.sel { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-tint); }
355
+ .pw-ph .ws-bar { margin: 0 0 var(--space-8); }
356
+ @container (max-width: 640px) { .pw-wbs .pw-jc { display: none; } }