create-pmos 0.613.0 → 0.615.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 (38) hide show
  1. package/package.json +27 -39
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +26 -0
  7. package/workspace/guide/cli.md +2 -1
  8. package/workspace/guide/layout.md +24 -10
  9. package/workspace/guide/settings-and-switches.md +1 -0
  10. package/workspace/lib/events-place.js +46 -10
  11. package/workspace/lib/mention-cli.js +6 -3
  12. package/workspace/lib/mention-store.js +49 -10
  13. package/workspace/lib/routes-events-place.js +2 -1
  14. package/workspace/package-lock.json +2 -2
  15. package/workspace/package.json +1 -1
  16. package/workspace/public/pm/cozy-events-view.js +23 -4
  17. package/workspace/public/pm/cozy-events.js +8 -2
  18. package/workspace/public/pm/cozy-home-rows.css +55 -0
  19. package/workspace/public/pm/cozy-nav.js +15 -2
  20. package/workspace/public/pm/cozy-pop-work.css +3 -0
  21. package/workspace/public/pm/cozy-pop-work.js +5 -3
  22. package/workspace/public/pm/cozy-today-app.js +119 -12
  23. package/workspace/public/pm/cozy-today-model.js +278 -21
  24. package/workspace/public/pm/cozy-today-page.css +74 -15
  25. package/workspace/public/pm/cozy-today-view.js +89 -31
  26. package/workspace/public/pm/home-app.js +14 -6
  27. package/workspace/public/pm/home-data.js +1 -1
  28. package/workspace/public/pm/home-ini.js +17 -1
  29. package/workspace/public/pm/home-mentions.js +121 -6
  30. package/workspace/public/pm/ini-edit.js +2 -0
  31. package/workspace/public/pm/ini-view.css +2 -0
  32. package/workspace/public/pm/mention-one-model.js +115 -0
  33. package/workspace/public/pm/pop-work-model.js +17 -11
  34. package/workspace/public/pm/scope-chip.js +5 -2
  35. package/workspace/run-tests.js +11 -4
  36. package/workspace/server.js +8 -0
  37. package/workspace/skills/morning-brief.skill +1 -1
  38. package/workspace/test-run.js +2 -0
@@ -0,0 +1,115 @@
1
+ /* pm/mention-one-model.js — one mention, as Today opens it (Today round 3, points 1 to 13; nav-structure/audit/today-round3-mention.md). Pure:
2
+ * no DOM, so the tests import it. home-mentions.js draws it (oneHtml) in the popup.
3
+ *
4
+ * askTitle(m) → the ask in one clean line: the popup's title ("Plan cards or CAS template?"), never "Mentions"
5
+ * threadModel(th, o) → { shown, earlier }: the messages in time order, each { who, at, text, me, n }; the same words from the same person
6
+ * merge into one line with n ("×3"); all but the last o.keep (5) fold under "N earlier"
7
+ * blanksOf(text) → the blanks a draft leaves ("[your decision]", "[date]"): [{ i, label }]; fill(text, values) puts the values in
8
+ * checkOf(m, L, now) → { state: 'waiting' | 'answered' | 'unknown', text }: the self check's line in the header (point 10f). A source PMOS
9
+ * could not read says so and claims neither state
10
+ * didLeft(m, o) → { did: [past-tense lines from records], left: one action, verb first } (point 13)
11
+ * proofText(p, now) → "You replied Tue 17 Nov: “…”" for an answered mention (point 10c)
12
+ * The words say PMOS, never Claude. */
13
+ const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
14
+ const MO = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
15
+ const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'email', gmail: 'Gmail', figma: 'Figma', doc: 'the document' };
16
+ const T = (iso) => { const t = typeof iso === 'number' ? iso : Date.parse(iso || ''); return Number.isFinite(t) ? t : 0; };
17
+ const clip = (s, n) => { s = String(s || '').replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
18
+ const first = (who) => String(who || 'someone').replace(/[,;:]+$/, '').trim().split(/\s+/)[0];
19
+ export const srcName = (s) => SRC[s] || (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : 'its source');
20
+ const hm = (t) => { const d = new Date(t); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
21
+ const day0 = (t) => { const d = new Date(t); d.setHours(0, 0, 0, 0); return d.getTime(); };
22
+ /** "08:10" today, "Tue 08:10" this week, "Tue 17 Nov" before. */
23
+ export function whenText(at, now = Date.now()) {
24
+ const t = T(at); if (!t) return '';
25
+ const n = Math.round((day0(now) - day0(t)) / 86400000), d = new Date(t);
26
+ if (n <= 0) return hm(t);
27
+ if (n < 7) return WD[d.getDay()] + ' ' + hm(t);
28
+ return WD[d.getDay()] + ' ' + d.getDate() + ' ' + MO[d.getMonth()];
29
+ }
30
+ const dayText = (at) => { const d = new Date(T(at)); return WD[d.getDay()] + ' ' + d.getDate() + ' ' + MO[d.getMonth()]; };
31
+
32
+ /** The ask in one clean line. Sentence case; a leading "asks" or "asks whether" is dropped; ends as a question when it asks one. */
33
+ export function askTitle(m) {
34
+ let s = String((m && (m.ask || m.gist || m.text)) || '').replace(/\s+/g, ' ').trim().replace(/^[“"']|[”"']$/g, '');
35
+ for (let i = 0; i < 2; i++) s = s.replace(/^(asks?|asking)\s+(you\s+|the pm\s+)?/i, '');
36
+ s = s.replace(/^(whether|if)\s+/i, (w) => w); // "whether the paywall …" reads as the question it is
37
+ if (!s) return 'An ask';
38
+ if (notASentence(s)) return asWritten(m);
39
+ s = s.charAt(0).toUpperCase() + s.slice(1);
40
+ return clip(s, 120);
41
+ }
42
+ /** The cleaner made no sentence of it ("the PM whether the PM requires …", "for test card details …"): design check of round 3, point 3. */
43
+ export const notASentence = (s) => /^(the pm|pm|you|him|her|them|for|to|about|that|of)\b/i.test(String(s || '').trim());
44
+ /** The first words as written, in quotes, when no clean sentence can be made. */
45
+ export function asWritten(m, n = 8) {
46
+ const raw = String((m && (m.text || m.gist || m.ask)) || '').replace(/\s+/g, ' ').trim().replace(/^[“"']|[”"']$/g, '').replace(/\b(\w+)\s+\1\b/gi, '$1');
47
+ const w = raw.split(' '), cut = w.length > n;
48
+ return raw ? '“' + w.slice(0, n).join(' ').replace(/[.,;:!?]+$/, '') + (cut ? '…' : '') + '”' : 'An ask';
49
+ }
50
+ const norm = (s) => String(s || '').toLowerCase().replace(/[^a-z0-9 ]+/g, ' ').replace(/\b(asks?|whether|if|the pm|you)\b/g, ' ').replace(/\s+/g, ' ').trim();
51
+ /** PMOS's one sentence says more than the title (it is not the same ask again, and not a raw "asks …" line). */
52
+ export function saysMore(gist, title) {
53
+ const g = norm(gist), t = norm(title);
54
+ if (!g || /^asks?\b/i.test(String(gist || '').trim())) return false;
55
+ return !(g === t || g.includes(t) && g.length < t.length + 20);
56
+ }
57
+ /** The messages in time order, the same words from the same person once with how many times, the last `keep` shown. */
58
+ export function threadModel(th, o = {}) {
59
+ const keep = o.keep || 5;
60
+ const list = (Array.isArray(th) ? th : []).filter((x) => x && x.text).slice().sort((a, b) => T(a.at) - T(b.at));
61
+ const out = [], at = new Map();
62
+ for (const x of list) {
63
+ const k = (x.me ? 'me' : first(x.who).toLowerCase()) + '|' + String(x.text).replace(/\s+/g, ' ').trim().toLowerCase();
64
+ if (at.has(k)) { const y = out[at.get(k)]; y.n++; y.last = x.at || y.last; continue; }
65
+ at.set(k, out.length);
66
+ out.push({ who: x.me ? 'You' : String(x.who || 'Someone').replace(/[,;:]+$/, '').trim(), at: x.at || null, last: x.at || null, text: String(x.text), me: !!x.me, n: 1 });
67
+ }
68
+ return { shown: out.slice(-keep), earlier: out.slice(0, Math.max(0, out.length - keep)) };
69
+ }
70
+ const BLANK = /\[([^\[\]\n]{1,40})\]/g;
71
+ /** The blanks a draft leaves for the PM ("[your decision]"). */
72
+ export function blanksOf(text) { const out = []; let m, i = 0; BLANK.lastIndex = 0; while ((m = BLANK.exec(String(text || '')))) out.push({ i: i++, label: m[1].trim() }); return out; }
73
+ /** The draft with the PM's values in its blanks, in order. A blank with no value stays as it was. */
74
+ export function fill(text, values = []) { let i = 0; return String(text || '').replace(BLANK, (all) => { const v = String(values[i++] || '').trim(); return v || all; }); }
75
+
76
+ /** The proof the self check found, said once: "You replied Tue 17 Nov: “We go with CAS.”" */
77
+ export function proofText(p, now = Date.now()) {
78
+ if (!p) return '';
79
+ if (p.how === 'replied') return 'You replied ' + dayText(p.at) + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
80
+ if (p.how === 'closed') return 'The ticket is ' + String(p.text || 'closed').toLowerCase() + ' (read ' + whenText(p.at, now) + ')';
81
+ if (p.how === 'withdrawn') return 'They took the ask back' + (p.text ? ': “' + clip(p.text, 90) + '”' : '');
82
+ return '';
83
+ }
84
+ /** The self check's line (point 10f). L: { gaps, reads_at, as_of }. A source not read: say so, and claim neither state. */
85
+ export function checkOf(m, L = {}, now = Date.now()) {
86
+ const s = (m && m.source) || '';
87
+ const read = T((L.reads_at || {})[s]) || 0;
88
+ const gap = (L.gaps || []).some((g) => g && g.kind === 'source' && g.source === s);
89
+ if (gap || L.failed) return { state: 'unknown', text: srcName(s) + (read ? ' not read since ' + whenText(read, now) : ' not read today') };
90
+ const at = read ? (now - read < 120000 ? 'just now' : whenText(read, now)) : '';
91
+ if (m && m.waiting) return { state: 'waiting', text: (at ? 'Checked ' + at + ' · ' : '') + 'still waiting on you' };
92
+ if (m && m.proof) return { state: 'answered', text: 'Answered · ' + (m.proof.how === 'replied' ? 'you replied ' + dayText(m.proof.at) : m.proof.how === 'closed' ? 'the ticket is ' + String(m.proof.text || 'closed').toLowerCase() : 'they took it back') };
93
+ if (m && m.status === 'answered') return { state: 'answered', text: 'Answered · you marked it' };
94
+ return { state: m && m.waiting === false ? 'answered' : 'unknown', text: at ? 'Checked ' + at : '' };
95
+ }
96
+ /** What PMOS did (past tense, from records only) and what is left for the PM (one action, verb first). o: { now } */
97
+ export function didLeft(m, o = {}) {
98
+ const did = [], src = srcName(m && m.source), who = first(m && ((m.people && m.people[0]) || m.who));
99
+ const blanks = m && m.draft ? blanksOf(m.draft) : [];
100
+ if (m && m.draft && !m.drafted) did.push(blanks.length ? 'started the reply' : 'drafted the reply');
101
+ if (m && m.drafted) did.push('copied the reply for ' + (typeof m.drafted === 'string' ? m.drafted : src));
102
+ if (m && m.task) did.push('made it a task: ' + clip(m.task.title || 'Reply to ' + who, 60));
103
+ if (m && m.watch) did.push('is watching for ' + m.watch.what);
104
+ if (m && m.proof) did.push('checked ' + src + ': ' + proofText(m.proof, o.now).replace(/^You/, 'you').replace(/^The/, 'the').replace(/^They/, 'they'));
105
+ let left;
106
+ if (m && !m.waiting && !m.proof) left = 'Nothing, for your information';
107
+ else if (!m || !m.waiting) left = 'Nothing, just read';
108
+ else if (m.looks) left = 'Check whether ' + (m.looks.who ? first(m.looks.who) + '’s' : 'that') + ' answer settles it';
109
+ else if (m.drafted) left = 'Paste the reply in ' + src + ' and send it';
110
+ else if (m.draft && blanks.length) left = 'Fill in ' + listOf(blanks.map((b) => b.label.replace(/^your\s+/i, 'your '))) + ', then send';
111
+ else if (m.draft) left = 'Read the reply, then send it in ' + src;
112
+ else left = 'Reply to ' + who;
113
+ return { did, left };
114
+ }
115
+ const listOf = (a) => (a.length <= 1 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
@@ -294,11 +294,15 @@ function taskRow(x, t) {
294
294
  return { kind: 'task', uid: x.uid, title: x.title, status: st, date: dl.text, late: dl.late, start: x.start || '', end: x.end || '', since: x.since || '', done: !!x.closed, ms: !!x.ms, jira: !!x.jkey, canCheck: !!x.canCheck,
295
295
  prog: /progress|review/i.test(st), wont: !!x.wont || st === "Won't do" };
296
296
  }
297
+ /** o.focus: the task a Today row opened (round 3 item 11b): its stage, its done fold and the far stages open, and its row lit. */
298
+ const holds = (list, f) => !!f && (list || []).some((x) => x && String(x.uid) === f);
299
+ const tasksOf = (s) => (s.top || []).concat(...(s.groups || []).map((g) => g.rows || []));
297
300
  export function breakdownOf(r, v, o = {}) {
298
301
  const t = todayOf(o), list = ((v.stage || {}).ladder || []).map((s, i) => ({ name: s.name, status: s.cls, ms: !!s.ms, i }));
299
302
  const secs = (v.tasks || {}).sections || [];
300
303
  const ran = ranOf(r, secs.filter((s) => s.kind === 'stage').map((s) => ({ key: s.key, name: s.name, status: s.status })));
301
- const open = o.open || new Set(), shut = o.shut || new Set(), dOpen = o.doneOpen || new Set();
304
+ const open = o.open || new Set(), shut = o.shut || new Set(), dOpen = o.doneOpen || new Set(), f = o.focus ? String(o.focus) : '';
305
+ const lit = (row) => (f && row.uid != null && String(row.uid) === f ? { ...row, lit: true } : row);
302
306
  const stages = secs.filter((s) => s.kind === 'stage');
303
307
  const cur = stages.findIndex((s) => s.status === 'now');
304
308
  const rows = [];
@@ -322,7 +326,7 @@ export function breakdownOf(r, v, o = {}) {
322
326
  else if (s.status !== 'skip') { a = ta; b = tb; }
323
327
  const live = s.status === 'now' && r.status !== 'done' && !r.ended;
324
328
  const dl = b && (s.status === 'now' || s.status === 'next') ? dateLate(b, t, live || ts.some((x) => !x.closed)) : { text: b && s.status === 'done' ? '' : '', late: false };
325
- const isOpen = shut.has(s.key) ? false : open.has(s.key) ? true : s.status === 'now';
329
+ const isOpen = holds(all, f) ? true : shut.has(s.key) ? false : open.has(s.key) ? true : s.status === 'now';
326
330
  const count = n ? (s.status === 'next' && !nDone ? plural(n, 'task', 'tasks') : nDone + ' of ' + n + ' done') : '';
327
331
  const has = n + lz.length > 0;
328
332
  // the bar's gap line and its ◇s (pm/cozy-bar.js stageBar): the stage's dated tasks, and its milestone tasks
@@ -333,27 +337,29 @@ export function breakdownOf(r, v, o = {}) {
333
337
  if (!((isOpen || lz.length > 0) && has)) return;
334
338
  const sorted = ts.slice().sort(urgent);
335
339
  if (s.status === 'now' && sorted.length > MANY) many = true;
336
- // a long stage (round 3 point 7): the late and in-progress tasks, then the next NEXT, then "N more"
340
+ // a long stage (round 3 point 7): the late and in-progress tasks, then the next NEXT, then "N more"; the task a Today row opened always shows
337
341
  const all2 = sorted.map((x) => taskRow(x, t));
338
342
  let shown = all2;
339
343
  if (all2.length > NEXT + 3 && !(o.moreOpen && o.moreOpen.has(s.key))) {
340
- const hot = all2.filter((x) => x.late || x.prog), rest = all2.filter((x) => !x.late && !x.prog);
344
+ const hot = all2.filter((x) => x.late || x.prog || (f && String(x.uid) === f)), rest = all2.filter((x) => !hot.includes(x));
341
345
  const keep = new Set(hot.concat(rest.slice(0, NEXT)));
342
346
  shown = all2.filter((x) => keep.has(x));
343
347
  }
344
- for (const x of shown) rows.push({ ...x, sec: s.key });
348
+ for (const x of shown) rows.push(lit({ ...x, sec: s.key }));
345
349
  if (shown.length < all2.length) rows.push({ kind: 'more', key: s.key, n: all2.length - shown.length, label: plural(all2.length - shown.length, 'more task', 'more tasks') });
346
- for (const x of lz.slice().sort(urgent)) { rows.push({ ...taskRow(x, t), sec: '', loose: s.key }); loose.push({ uid: x.uid, title: x.title, to: s.key, name: s.name }); }
350
+ for (const x of lz.slice().sort(urgent)) { rows.push(lit({ ...taskRow(x, t), sec: '', loose: s.key })); loose.push({ uid: x.uid, title: x.title, to: s.key, name: s.name }); }
347
351
  if (nDone) {
348
352
  const dd = s.done.map((x) => x.end).filter(Boolean).sort();
349
- rows.push({ kind: 'done', key: s.key, n: nDone, label: plural(nDone, 'task', 'tasks') + ' done', open: dOpen.has(s.key), start: (s.done.map((x) => x.start).filter(Boolean).sort()[0]) || dd[0] || '', end: dd[dd.length - 1] || '' });
350
- if (dOpen.has(s.key)) for (const x of s.done) rows.push({ ...taskRow(x, t), sec: s.key });
353
+ const dO = dOpen.has(s.key) || holds(s.done, f);
354
+ rows.push({ kind: 'done', key: s.key, n: nDone, label: plural(nDone, 'task', 'tasks') + ' done', open: dO, start: (s.done.map((x) => x.start).filter(Boolean).sort()[0]) || dd[0] || '', end: dd[dd.length - 1] || '' });
355
+ if (dO) for (const x of s.done) rows.push(lit({ ...taskRow(x, t), sec: s.key }));
351
356
  }
352
357
  };
353
358
  // the stages after the next one fold into one row (board 20), unless the PM opened it
354
359
  const farFrom = cur >= 0 ? cur + 2 : -1;
355
360
  stages.forEach((s, i) => {
356
- if (farFrom > 0 && i >= farFrom && stages.length - farFrom >= 2 && !o.farOpen) {
361
+ const farHolds = farFrom > 0 && stages.slice(farFrom).some((q) => holds(tasksOf(q).concat(q.done || []), f));
362
+ if (farFrom > 0 && i >= farFrom && stages.length - farFrom >= 2 && !o.farOpen && !farHolds) {
357
363
  if (i === farFrom) {
358
364
  const far = stages.slice(farFrom), n = far.reduce((k, x) => k + (x.top || []).length + (x.done || []).length + (x.groups || []).reduce((m, g) => m + g.n, 0), 0);
359
365
  rows.push({ kind: 'far', n: s.n, name: far[0].name + ' to ' + far[far.length - 1].name, count: plural(far.length, 'stage', 'stages'), status: 'To do', tasks: n });
@@ -364,9 +370,9 @@ export function breakdownOf(r, v, o = {}) {
364
370
  });
365
371
  const ts = looseTs.filter((x) => !x.closed);
366
372
  if (ts.length) {
367
- const isOpen = open.has('') && !shut.has('');
373
+ const isOpen = holds(ts, f) || (open.has('') && !shut.has(''));
368
374
  rows.push({ kind: 'stage', key: '', n: '', name: 'Not in a stage', status: '', count: plural(ts.length, 'open task', 'open tasks'), date: '', start: '', end: '', open: isOpen, can: true, loose: true });
369
- if (isOpen) for (const x of ts.slice().sort(urgent)) rows.push({ ...taskRow(x, t), sec: '' });
375
+ if (isOpen) for (const x of ts.slice().sort(urgent)) rows.push(lit({ ...taskRow(x, t), sec: '' }));
370
376
  if (cur >= 0) for (const x of ts) loose.push({ uid: x.uid, title: x.title, to: stages[cur].key, name: stages[cur].name });
371
377
  }
372
378
  return { rows, many, list, loose };
@@ -16,7 +16,7 @@
16
16
  * picked, or the row is under one of them
17
17
  * narrowed(P, sel) · scopeWords(P, sel, groups) → is anything narrowed · "pmos-cas, Lightbox GA tracking" for a "Showing … only" line
18
18
  * whenNames() → resolves when the display names are in (redraw then) · setNames(workspaces) · productRows(P) → one row per product
19
- * displayName(workspace) → the name every page shows for a workspace (Routine's Product column uses it too)
19
+ * displayName(workspace) → the name every page shows for a workspace · productName(ws, fallback) → the same by workspace id
20
20
  * groups: { programs: [{ id: 'g:…', name, n? }], projects: [{ id: 'j:…', name, product?, n? }] }; a part with no options is left out.
21
21
  * Copy says PMOS. Every press is in the menu; nothing writes but savePick. */
22
22
  import { savePick, codeOf, tonesOf } from './cozy-pick.js'; // its import adds cozy-pick.css, which this menu uses
@@ -52,7 +52,10 @@ export function whenNames() {
52
52
  return namesP;
53
53
  }
54
54
  try { if (typeof document !== 'undefined') whenNames(); } catch { /* no page */ }
55
- const nameOfWs = (p) => (NAMES.get(p.ws) || {}).name || p.name;
55
+ /** The display name of a product by its workspace id, the one name every page prints (Work, Goals, Today, Events, Library, Routine):
56
+ * productName('pmos-idpf-wt', 'mainwt') → 'IDPF'. Before the names are in (whenNames), or for a workspace PMOS does not know, the fallback. */
57
+ export const productName = (ws, fallback = '') => (NAMES.get(ws) || {}).name || fallback;
58
+ const nameOfWs = (p) => productName(p.ws, p.name);
56
59
  const keyOfWs = (p) => (NAMES.get(p.ws) || {}).key || p.ws;
57
60
  /** A project's product by its display name: from its token 'j:<ws>|…', else the name the page gave. */
58
61
  export const projectProduct = (f) => { const m = /^j:([^|]+)\|/.exec(String(f.id || '')), n = m && NAMES.get(m[1]); return (n && n.name) || f.product || ''; };
@@ -358,7 +358,7 @@ function traceChanges(changes, ctx) {
358
358
  fn.push({ name: m[1] || m[2], a: i + 1, b: j + 1 });
359
359
  i = j;
360
360
  }
361
- const blocks = [];
361
+ const blocks = [], moves = [];
362
362
  const hr = fn.find((x) => x.name === 'handleRequest');
363
363
  if (hr) {
364
364
  const starts = [];
@@ -369,10 +369,13 @@ function traceChanges(changes, ctx) {
369
369
  if (!/^ {2}if \(/.test(head) || !/\bp\b/.test(head)) continue;
370
370
  const keys = [...head.matchAll(/'(\/[^']*)'/g)].map((m) => m[1]);
371
371
  for (const m of head.matchAll(/\/\^((?:\\\/|[\w-])+)/g)) keys.push(m[1].replace(/\\\//g, '/'));
372
- if (keys.length && keys.every((x) => x.startsWith('/api/'))) blocks.push({ keys, a: starts[k], b: starts[k + 1] - 1 });
372
+ if (keys.length && keys.every((x) => x.startsWith('/api/'))) { blocks.push({ keys, a: starts[k], b: starts[k + 1] - 1 }); continue; }
373
+ // a page redirect (`if (p === '/x' …) { res.writeHead(302, { Location: '/y.html' … }); return res.end(); }`): its paths and its target
374
+ const body = L.slice(starts[k], starts[k + 1] - 1).join('\n'), to = /writeHead\(30[12],\s*\{\s*Location:\s*'(\/[\w.-]*)/.exec(body);
375
+ if (to && keys.length && !keys.some((x) => x.startsWith('/api/')) && (body.match(/writeHead\(/g) || []).length === 1) moves.push({ keys: keys.concat([to[1]]), a: starts[k], b: starts[k + 1] - 1 });
373
376
  }
374
377
  }
375
- S = { L, C, fn, blocks, fnAt: (n) => fn.find((x) => n >= x.a && n <= x.b), blockAt: (n) => blocks.find((b) => n >= b.a && n <= b.b) };
378
+ S = { L, C, fn, blocks, fnAt: (n) => fn.find((x) => n >= x.a && n <= x.b), blockAt: (n) => blocks.find((b) => n >= b.a && n <= b.b), moveAt: (n) => moves.find((b) => n >= b.a && n <= b.b) };
376
379
  return S;
377
380
  };
378
381
  const used = new Set();
@@ -399,7 +402,7 @@ function traceChanges(changes, ctx) {
399
402
  return res;
400
403
  };
401
404
  const serverLines = (lines, viaUse = false) => {
402
- const { C, fnAt, blockAt } = parseServer();
405
+ const { C, fnAt, blockAt, moveAt } = parseServer();
403
406
  for (const n of lines) {
404
407
  const raw = C[n - 1];
405
408
  if (raw === undefined || !raw.trim()) continue; // a comment or a blank line reaches nothing
@@ -412,6 +415,10 @@ function traceChanges(changes, ctx) {
412
415
  // (six-place navigation slice 5: '/' moved from premium.html to today.html reached all 526 suites)
413
416
  const names = (src, x) => (x === '/' ? /(['"`])\/\1/.test(src) : src.includes(x));
414
417
  if (pm) { for (const x of pm) for (const sfile of list) if (names(get(sfile) || '', x)) picked.add(sfile); continue; }
418
+ // a page redirect block reaches the suites that name one of its paths or the page it sends to, like a repointed PAGES entry
419
+ // (design audit of nav slice 5: /premium.html sent to /today.html reached all 419 suites)
420
+ const mv = moveAt(n);
421
+ if (mv) { for (const x of mv.keys) { const re = new RegExp(reEsc(x) + '(?![\\w-])'); for (const sfile of list) if (re.test(get(sfile) || '')) picked.add(sfile); } continue; }
415
422
  const own = fnAt(n);
416
423
  if (own && own.name !== 'handleRequest' && optionOnly(own, lines)) continue;
417
424
  if (own && own.name !== 'handleRequest') { const w = useOf(own.name); if (w) return `${own.name} (server.js:${n}) is used by ${w}`; continue; }
@@ -7331,6 +7331,14 @@ async function handleRequest(req, res) {
7331
7331
  res.writeHead(302, { Location: '/premium.html' + (s ? '?' + s : ''), 'Cache-Control': 'no-store' });
7332
7332
  return res.end();
7333
7333
  }
7334
+ // Today is the place of Home (design audit of nav slice 5, 2026-11-19): a bare /premium.html, or one that names only ?item= (and ?ws=),
7335
+ // opens /today.html with the same query, where the item opens in the one popup. A phone gets Home there too (today.html keeps Home on a
7336
+ // phone). Other links (?ask=, ?around=, ?session=, ?ini=, …) stay on Home until they move to the popup (build plan, "After the nine
7337
+ // slices"). PMOS_DESK_HOME=keep (set by test-run.js) keeps Home at its address, so the Home suites test what still ships.
7338
+ if ((p === '/premium' || p === '/premium.html') && process.env.PMOS_DESK_HOME !== 'keep' && [...url.searchParams.keys()].every((k) => k === 'ws' || k === 'item')) {
7339
+ res.writeHead(302, { Location: '/today.html' + url.search, 'Cache-Control': 'no-store' });
7340
+ return res.end();
7341
+ }
7334
7342
  // One console address stays: the Chrome extension's popup frames /console.html?capture=1, which serves capture.html.
7335
7343
  const capture = (p === '/console.html' || p === '/c3.html') && url.searchParams.get('capture') === '1';
7336
7344
  if (!capture && (p === '/c3.html' || p === '/c3' || p === '/console' || p === '/console.html' || p === '/classic' || p === '/classic.html')) {
@@ -88,7 +88,7 @@ Procedure:
88
88
  "memory" is optional: give it only when calendar is "read". Its "from" and "to" are the window you read, and every event's start is inside it. The workspace replaces the days of that window in what it remembers.
89
89
  "places" holds at most 200 entries, each a name of at most 120 characters, only for a source that is "read". A digest has at most 5 decisions, 5 open questions and 5 goal lines, each at most 140 characters, and at most 30 digests. Write a digest only for a place with scope watch, and only for a source that is "read". Only report calendar events if calendar is "read". Only give an item a source that is "read" (or "derived"). Only use a goal id that `pmos proactive goals` listed today: the workspace refuses any other. Leave out a field you cannot fill: an empty string is worse than no field.
90
90
  5. Run `pmos proactive brief submit --file <that file>`. If it is refused, read the reason, fix the file and submit once more. Do not work around a refusal.
91
- 5b. MENTIONS NOTES. Run `pmos mention list`. It prints one line per conversation, with its id. For each conversation in Your move that has no reply drafted and that you cannot draft, because it needs a number or a decision that only the PM has, run `pmos mention nodraft <id> --text "<why, one line>"`. For a conversation where something is agreed, run `pmos mention stands <id> --settled "<what is agreed>" [--open "<what is still open>"]`. When a thread holds a promise with a date ("I will send the tag by end of day"), offer to watch for it: `pmos mention watch <id> --what "<Samuel’s tag>" --text "<I’ll watch for the tag and nudge Samuel at 09:00 if it’s still missing.>"`. When a promise you watch has come, run `pmos mention landed <id> --text "<Samuel’s tag landed.>"`. Write only what the saved reads say. These commands post nothing.
91
+ 5b. MENTIONS NOTES. Run `pmos mention list`. It prints one line per conversation, with its id. For each conversation in Your move that has no reply drafted and that you cannot draft, because it needs a number or a decision that only the PM has, run `pmos mention nodraft <id> --text "<why, one line>"`. For a conversation where something is agreed, run `pmos mention stands <id> --settled "<what is agreed>" [--open "<what is still open>"]`. When a thread holds a promise with a date ("I will send the tag by end of day"), offer to watch for it: `pmos mention watch <id> --what "<Samuel’s tag>" --text "<I’ll watch for the tag and nudge Samuel at 09:00 if it’s still missing.>"`. When a promise you watch has come, run `pmos mention landed <id> --text "<Samuel’s tag landed.>"`. When, after the ask, someone other than the PM gave the answer in the same thread and the asker accepted it or moved on, run `pmos mention looks <id> --who "<their name>" --text "<their line, quoted as written>" --on <when they wrote it, ISO>`. Only when the saved read holds that line; never for the PM's own reply (PMOS sees that from the records); not when the asker asked again after it. This closes nothing: the PM confirms with ✓ or keeps it with ✕. Write only what the saved reads say. These commands post nothing.
92
92
  6. RECORD THE PEOPLE, only when `pmos people settings` printed `calendar names: on` and calendar is "read". For each attendee of today's meetings other than the PM, write one sighting: {"source": "calendar", "handle": {"kind": "mail", "value": "<their address>"} (or {"kind": "name", "value": "<their name>"} when there is no address), "name": "<display name>", "external": true when they are outside the PM's company, "interaction": {"date": "YYYY-MM-DD", "kind": "Meeting" (or "1:1" for two people), "text": "<the meeting title, at most 200 characters>", "pointer": "calendar · <event id or link> · <date>"}}. Skip meetings marked private, personal, confidential or HR. Put the sightings in one file {"sightings": [...]} in the scratch folder and run `pmos people record --file <that file>` once. With `calendar names: off`, skip this step and say "people: off".
93
93
  7. Finish by saying in three lines how many goals have a step and which have none, how many priorities and worth-asking items you submitted, and which sources were not reached. Add how many people you recorded, or "people: off".
94
94
 
@@ -116,6 +116,8 @@ function configure({ name = 'run', port = null } = {}) {
116
116
  // A private tmux socket, never the PM's own ('pmos'), so a suite cannot reach their sessions.
117
117
  const tmuxSock = `pmos-${name}-${process.pid}`;
118
118
  process.env.PMOS_TMUX_SOCK = tmuxSock;
119
+ // Home stays at /premium.html in the suites (server.js sends a bare desk Home to Today otherwise): they test the Home that still ships
120
+ process.env.PMOS_DESK_HOME = 'keep';
119
121
 
120
122
  const chosen = Number(port) > 0 ? Number(port) : claimEphemeralPort();
121
123