create-pmos 0.541.0 → 0.542.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 (55) hide show
  1. package/package.json +20 -26
  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/adler-moments-test.js +4 -8
  7. package/workspace/briefing-premium-board-test.js +1 -1
  8. package/workspace/briefing-premium-initiative-test.js +1 -1
  9. package/workspace/briefing-premium-sources-test.js +3 -3
  10. package/workspace/briefing-premium-test.js +2 -4
  11. package/workspace/changelog.json +19 -0
  12. package/workspace/ev-everywhere-test.js +3 -3
  13. package/workspace/guide/home.md +22 -9
  14. package/workspace/guide/intelligence-okr-goals.md +1 -1
  15. package/workspace/guide/settings-and-switches.md +1 -0
  16. package/workspace/home-rows-test.js +19 -24
  17. package/workspace/lib/briefing-premium-agent.js +7 -2
  18. package/workspace/lib/cos-chat.js +75 -0
  19. package/workspace/lib/done-feed.js +33 -0
  20. package/workspace/lib/grill-runs.js +1 -1
  21. package/workspace/lib/headless.js +29 -2
  22. package/workspace/lib/loop-health.js +65 -0
  23. package/workspace/lib/proposal-runs.js +1 -1
  24. package/workspace/lib/proposals.js +44 -9
  25. package/workspace/lib/routes-sources.js +2 -0
  26. package/workspace/lib/routes-your-move.js +25 -4
  27. package/workspace/lib/verify-runs.js +22 -1
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/public/pm/batch-press.js +184 -0
  31. package/workspace/public/pm/bd-fc-card.js +2 -1
  32. package/workspace/public/pm/bd-next.js +2 -1
  33. package/workspace/public/pm/chat-src.js +18 -0
  34. package/workspace/public/pm/cozy-home.css +4 -0
  35. package/workspace/public/pm/cozy-lab-ins.js +17 -1
  36. package/workspace/public/pm/cozy-nav.js +22 -21
  37. package/workspace/public/pm/cozy-search.js +18 -9
  38. package/workspace/public/pm/cozy-today.css +7 -0
  39. package/workspace/public/pm/cozy-viewer.js +1 -1
  40. package/workspace/public/pm/goal-chat.js +1 -1
  41. package/workspace/public/pm/good-morning.js +1 -1
  42. package/workspace/public/pm/home-app.js +65 -14
  43. package/workspace/public/pm/home-chat.js +8 -4
  44. package/workspace/public/pm/home-day.js +46 -14
  45. package/workspace/public/pm/home-today.js +5 -4
  46. package/workspace/public/pm/ini-props.js +7 -2
  47. package/workspace/public/pm/ini-view.css +14 -0
  48. package/workspace/public/pm/move-rank.js +67 -9
  49. package/workspace/public/pm/outbox-view.js +35 -0
  50. package/workspace/public/pm/page-chat.css +2 -0
  51. package/workspace/public/pm/page-chat.js +33 -5
  52. package/workspace/run-tests.js +23 -4
  53. package/workspace/server.js +2 -1
  54. package/workspace/task-links-test.js +6 -2
  55. package/workspace/test-lists/chief-of-staff-chat.json +9 -0
@@ -0,0 +1,35 @@
1
+ /* pm/outbox-view.js — one outbox draft, opened from Your move (chief-of-staff C3 and C6, boards CsE and CsC: "Reach outside: Claude drafts it.
2
+ * It waits in your outbox and you send it. Nothing leaves PMOS on its own").
3
+ *
4
+ * openDraft(entry, H) the Viewer: who it is for, where it goes, the words. Copy puts the words on the clipboard so the PM sends them from
5
+ * their own tool (no channel is connected: POST /api/outbox/confirm sends nothing yet), ✕ discards the draft with
6
+ * Undo (POST /api/outbox/discard { id } and { id, undo: true }). A draft whose claim failed the trust rules says so.
7
+ * H: { pmPost, toast, toastUndo, reload } */
8
+
9
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
10
+ const SVG = (d, w = 16, sw = 2) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
11
+ const I = { mail: 'M3 5h18v14H3zM3 7l9 6 9-6', copy: 'M8 8h11v13H8zM5 16V3h11', x: 'M6 6l12 12M18 6L6 18' };
12
+ const cap = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
13
+
14
+ export function draftHtml(e) {
15
+ const where = [cap(e.channel), e.recipient ? 'to ' + e.recipient : ''].filter(Boolean).join(' ');
16
+ const refused = e.claims && e.claims.ok === false && (e.claims.refused || []).length ? `<p class="yd-exp">A claim in it needs a look: ${esc((e.claims.refused || []).join('; '))}</p>` : '';
17
+ return `<div class="ob-d"><p class="yd-exp">${esc(where ? 'Drafted for ' + where + '. ' : '')}It waits here until you send it.</p>${refused}`
18
+ + (e.subject ? `<h3>${esc(e.subject)}</h3>` : '') + `<pre class="ob-body">${esc(e.body || '')}</pre></div>`;
19
+ }
20
+ export function openDraft(e, H) {
21
+ const VW = window.czViewer; if (!VW || !e || !e.id) return;
22
+ VW.open({ id: 'ob:' + e.id, kind: 'Outbox', title: e.subject || 'A draft to send', icon: I.mail,
23
+ presses: [{ act: 'discard', label: 'Discard the draft', icon: I.x }, { act: 'copy', label: 'Copy to send it yourself', icon: I.copy, solid: true }],
24
+ onPress: async (act) => {
25
+ if (act === 'copy') { try { await navigator.clipboard.writeText(e.body || ''); H.toast('Copied. Paste it where you send it.'); } catch { H.toast('It could not be copied. Select the words and copy them.'); } return; }
26
+ if (act === 'discard') {
27
+ const r = await H.pmPost('/api/outbox/discard', { id: e.id }).catch(() => null);
28
+ if (!r || r.ok === false) { H.toast((r && r.error) || 'It could not be discarded.'); return; }
29
+ VW.back();
30
+ H.toastUndo('Discarded.', async () => { const u = await H.pmPost('/api/outbox/discard', { id: e.id, undo: true }).catch(() => null); if (H.reload) H.reload(); return u || { ok: false }; });
31
+ if (H.reload) H.reload();
32
+ }
33
+ },
34
+ render: (body) => { body.innerHTML = draftHtml(e); } });
35
+ }
@@ -7,3 +7,5 @@
7
7
  .pc-chat form.hm-box textarea:focus-visible { outline: none; }
8
8
  /* "In:" names the item the chat is about; on the Board it cannot change, so it is not a press */
9
9
  .pc-chat [data-hm-scope] { pointer-events: none; }
10
+ /* chief-of-staff C5 (CsB): the soft "You are on …" chip is a press: × drops it */
11
+ .pc-chat [data-hm-scope].soft { pointer-events: auto; background: var(--cz-well); border-color: transparent; }
@@ -1,5 +1,14 @@
1
- /* pm/page-chat.js — the chat as a panel on a page that has no chat column (the Board; batch 26 item 4, Wawan 2026-11-03: "User should be
2
- * able to open chat panel on board page").
1
+ /* pm/page-chat.js — the one chat over any page (chief-of-staff C5, board CsB on the main canvas, In development; first built as the Board's
2
+ * chat panel, batch 26 item 4, Wawan 2026-11-03: "User should be able to open chat panel on board page").
3
+ *
4
+ * ONE CHAT, ONE WAY (C5 and the UI grill's item 5). The chat icon in the floating menu (cozy-nav.js) opens the chief-of-staff chat (Home's own
5
+ * conversation, chat:main, lib/cos-chat.js) over the page you are on, with a soft "You are on …" chip: Claude answers about that page first,
6
+ * and × on the chip drops it (the chip then reads Everything). ⧉ (the Viewer's Open in a new tab) opens the same conversation full on Home.
7
+ * A phone shows the Viewer as its sheet from the bottom. "Discuss in chat" on an initiative or a program opens its scoped chat the same way
8
+ * (the same chat with the scope filled in), and Settings › Workflows' New workflow opens here too, so there is no second chat column.
9
+ *
10
+ * openCos({ here, ws? }) → true the chief-of-staff chat; here: the page's words for the chip ("Board · Atlas"), '' for none
11
+ * openTarget(t, o) → true any chat target (home-chat.js mountChat open), o: { title, url }
3
12
  *
4
13
  * "Discuss in chat" on the Board's initiative or program panel opens the chat about that item in a Viewer of its own, beside the panel
5
14
  * (1600 px and wider) or sliding over it (a laptop), through the panels engine (cozy-panels.js openBeside). The page stays where it is.
@@ -49,7 +58,9 @@ function host() {
49
58
  esc, toast, pmGet, pmPost, pressHeaders: () => { const h = pmHeaders(); delete h['Content-Type']; return h; },
50
59
  roles: () => [], seen: () => null, markSeen: () => {}, session: () => null, queued: () => [],
51
60
  touch: (sid) => { if (sid) pmPost('/api/session/touch', { id: sid }).then(() => document.dispatchEvent(new CustomEvent('cz:live'))).catch(() => {}); },
52
- onScope: () => {}, onTo: () => {}, onLink: () => {},
61
+ // × on the "You are on …" chip drops the page: the chat reads Everything again (C5)
62
+ onScope: () => { if (Q.t && Q.t.cos && Q.t.here) { Q.t = cosTarget('', Q.t.ws); Q.chat.open(Q.t); } },
63
+ onTo: () => {}, onLink: () => {},
53
64
  workItem: () => toast('Make a work-item from Home, in the initiative’s own chat.'),
54
65
  viewerClosed: () => false, reopenViewer: () => {}, desk: () => true, head: () => '',
55
66
  // a finished turn: the page reads its records again, so what Claude changed shows with no refresh (as Home, batch 25 item 3)
@@ -62,17 +73,34 @@ async function mod() {
62
73
  }
63
74
  const shownAt = () => VW.panels.list().find((p) => p.open && p.item && p.item.id === CHAT_ID) || null;
64
75
 
76
+ const GLOBE = 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18';
77
+ const PIN = 'M4 5h16v14H4z';
78
+ /** The chief-of-staff chat's target (lib/cos-chat.js): Home's own conversation; the chip says where the PM is, and context carries it. */
79
+ export function cosTarget(here, ws) {
80
+ const h = String(here || '').replace(/\s+/g, ' ').trim().slice(0, 80);
81
+ return { key: 'chat:main', ws: ws || undefined, title: 'Ask PMOS', about: 'Ask PMOS', role: CLAUDE, rich: false, cos: true, here: h,
82
+ scope: h ? { text: 'You are on ' + h, icon: PIN, drop: true } : { text: 'Everything', icon: GLOBE }, context: h || undefined,
83
+ placeholder: 'Ask or tell PMOS', empty: 'Ask anything about your work. I read it with PMOS and say where each answer came from.' };
84
+ }
85
+ /** The chief-of-staff chat over this page (the menu's chat icon). here: "Board · Atlas"; × on the chip drops it. */
86
+ export function openCos(o = {}) {
87
+ return openTarget(cosTarget(o.here, o.ws), { title: 'Ask PMOS', url: '/premium.html' });
88
+ }
65
89
  export async function openChat(it, o = {}) {
66
90
  const key = keyOf(it); if (!key) return false;
91
+ return openTarget(targetOf(it, o.ws), { title: targetOf(it, o.ws).title, url: homeHref(it, key) });
92
+ }
93
+ export async function openTarget(t, o = {}) {
94
+ if (!t || !t.key) return false;
67
95
  sheets();
68
96
  const M = await mod();
69
97
  if (!Q.el) {
70
98
  Q.el = document.createElement('section'); Q.el.className = 'hm-chat pc-chat'; Q.el.setAttribute('aria-label', 'Conversation');
71
99
  Q.chat = M.mountChat(Q.el, host());
72
100
  }
73
- Q.t = targetOf(it, o.ws);
101
+ Q.t = t;
74
102
  const item = {
75
- id: CHAT_ID, kind: 'Chat', title: Q.t.title, icon: CHAT_ICON, url: homeHref(it, key), outward: true, fresh: true,
103
+ id: CHAT_ID, kind: 'Chat', title: o.title || Q.t.title, icon: CHAT_ICON, url: o.url || '/premium.html', outward: true, fresh: true,
76
104
  render: (body) => { body.classList.add('pc-body'); body.appendChild(Q.el); Q.chat.open(Q.t); },
77
105
  onClose: () => { if (Q.chat) Q.chat.stop(); },
78
106
  };
@@ -288,6 +288,7 @@ function traceChanges(changes, ctx) {
288
288
  };
289
289
  // a route: its users, or the reason it cannot tell
290
290
  const routeMemo = new Map();
291
+ const synth = new Map(); // a lib file reached as a route's client: the lines that name the route stand in for its change (route1)
291
292
  const route = (r, where) => {
292
293
  if (routeMemo.has(r)) return routeMemo.get(r);
293
294
  routeMemo.set(r, null);
@@ -308,7 +309,16 @@ function traceChanges(changes, ctx) {
308
309
  if (inList.has(f)) picked.add(f);
309
310
  else if (SUITE_NAME.test(f)) continue; // a suite of another group: nothing depends on it
310
311
  else if (f.startsWith('public/')) viaPublic(f);
311
- else { const w = users(f); if (w) return w; }
312
+ else {
313
+ // a lib file that names the route is its client only in the declarations that hold the name (lib/goal-chat.js builds its hook URLs
314
+ // under /api/briefing-premium/ in hookSettings, and goalOf, read by the session list's heartbeat, sent every chat change to every
315
+ // suite): those lines count as its change, so only the users of those exports follow (changedExports)
316
+ if (/^lib\/[^/]+\.js$/.test(f) && !changes.some((c) => c.file === f) && !synth.has(f)) {
317
+ const lines = []; (get(f) || '').split('\n').forEach((line, i) => { if (keys.some((k) => line.includes(k))) lines.push(i + 1); });
318
+ if (lines.length) synth.set(f, { file: f, lines });
319
+ }
320
+ const w = users(f); if (w) return w;
321
+ }
312
322
  }
313
323
  if (hit) return null;
314
324
  // a route no page and no suite names: only a suite that opens its module can reach it (PM, 2026-11-01: no full regression)
@@ -429,7 +439,7 @@ function traceChanges(changes, ctx) {
429
439
  const changedExports = (f) => {
430
440
  if (exportsMemo.has(f)) return exportsMemo.get(f);
431
441
  exportsMemo.set(f, null);
432
- const ch = changes.find((c) => c.file === f);
442
+ const ch = changes.find((c) => c.file === f) || synth.get(f);
433
443
  const text = get(f);
434
444
  if (!ch || !Array.isArray(ch.lines) || !ch.lines.length || text == null) return null;
435
445
  const C = strip(text).split('\n');
@@ -459,7 +469,8 @@ function traceChanges(changes, ctx) {
459
469
  grew = false;
460
470
  for (const x of spans) {
461
471
  if (touched.has(x.name)) continue;
462
- const body = C.slice(x.a, x.b + 1).join('\n');
472
+ // quoted strings out: a declaration that says 'chat:' in a string does not call chat()
473
+ const body = C.slice(x.a, x.b + 1).join('\n').replace(/'(?:[^'\\\n]|\\.)*'|"(?:[^"\\\n]|\\.)*"/g, "''");
463
474
  if ([...touched].some((t) => new RegExp(`(^|[^\\w$.])${reEsc(t)}\\b`).test(body))) { touched.add(x.name); grew = true; }
464
475
  }
465
476
  }
@@ -474,6 +485,14 @@ function traceChanges(changes, ctx) {
474
485
  exportsMemo.set(f, out);
475
486
  return out;
476
487
  };
488
+ // An inline `require('./lib/f.js').name(…)` in server.js reads one export. true when every require of f on the line reads an export the
489
+ // change did not touch (lib/briefing-premium-agent.js: a new rule in chat() sent every suite through .chatClaudeOfSession in the session list).
490
+ const onlyOther = (line, f) => {
491
+ const ex = changedExports(f); if (!ex) return false;
492
+ const reqRe = new RegExp(`require\\(\\s*['"\`][^'"\`]*/${reEsc(stemOf(f))}(?:\\.m?js)?['"\`]\\s*\\)((?:\\.[\\w$]+)?)`, 'g');
493
+ const used = [...line.matchAll(reqRe)];
494
+ return used.length > 0 && used.every((u) => u[1] && !ex.has(u[1].slice(1)));
495
+ };
477
496
  // Does file g use one of the changed exports of the changed lib file f? false only when it can tell: every require of f in g is a
478
497
  // plain binding whose every use is `binding.<export>`, or a destructuring, or `require(…).<export>`, and none names a changed export.
479
498
  const usesChanged = (g, f, re) => {
@@ -568,7 +587,7 @@ function traceChanges(changes, ctx) {
568
587
  if (m && /require\([^)]*\)\.create\(/.test(line)) factories.push(m[2]); // a service built at start-up: only a route that calls it can reach a page
569
588
  else if (m && m[2] && changedExports(f)) whole.push(m[2]); // a whole-module binding: only the changed exports count
570
589
  else if (m) names.push(...(m[1] ? m[1].split(',').map((x) => x.split(':').pop().trim()).filter(Boolean) : [m[2]]));
571
- else inline.push(i + 1); // a require inside a function or a route: that line
590
+ else if (!onlyOther(line, f)) inline.push(i + 1); // a require inside a function or a route: that line, unless it only reads exports the change left alone
572
591
  });
573
592
  for (const name of factories.filter(Boolean)) { // only the uses inside a route block; a timer or a start-up call is the boot suite's
574
593
  if (used.has(name)) continue; used.add(name);
@@ -4618,7 +4618,8 @@ function startHeadless(base, workdir, kind, launchArgs, env, initialInput, addDi
4618
4618
  const args = headlessLib.argsFor(kind, { lean, modelArgs: launchArgs, addDirs: Array.isArray(addDirs) ? addDirs : [], writePaths: Array.isArray(writePaths) ? writePaths : [],
4619
4619
  budgetUsd: !env ? null : kind === 'grill' ? env.PMOS_GRILL_BUDGET : kind === 'lab-proto' || kind === 'lab-scan' ? env.PMOS_LAB_BUDGET : null,
4620
4620
  connectorTools: headlessLib.CONNECTOR_READ_KINDS.includes(kind) ? knownConnectorTools(env) : [],
4621
- team: kind === 'team' && env ? { role: env.PMOS_TEAM_ROLE, mode: env.PMOS_TEAM_MODE } : null });
4621
+ team: kind === 'team' && env ? { role: env.PMOS_TEAM_ROLE, mode: env.PMOS_TEAM_MODE } : null,
4622
+ memory: headlessLib.memoryNote([workdir, ...(Array.isArray(addDirs) ? addDirs : [])], env) });
4622
4623
  const s = { ...base, cwd: workdir, state: 'working', pty: null, tmux: null, headless: kind, child: null, ...(lean ? { lean: true } : {}),
4623
4624
  note: '', buf: '', cols: 80, rows: 24, clients: new Set(), created: nowISO(), lastOutputAt: Date.now() };
4624
4625
  const say = (text) => {
@@ -113,10 +113,10 @@ function model() {
113
113
  const h = document.querySelector('#czViewer .iv-th');
114
114
  const chip = document.querySelector('#czViewer .cz-vw-hd [data-cz-vw="chip"]');
115
115
  return { order: [...h.children].map((n) => (n.classList.contains('n') ? 'count' : n.dataset.lkChip || n.className.split(' ')[0])).filter((x) => /count|prop|moved|late|vs-/.test(x)),
116
- prop: chip ? chip.textContent : '', moved: (h.querySelector('[data-lk-chip="moved"]') || {}).textContent || '', late: (h.querySelector('[data-lk-chip="late"]') || {}).textContent || '' };
116
+ prop: chip ? chip.textContent : '', chipOn: !!chip, moved: (h.querySelector('[data-lk-chip="moved"]') || {}).textContent || '', late: (h.querySelector('[data-lk-chip="late"]') || {}).textContent || '' };
117
117
  });
118
118
  ok('H1 the header: count, then the grey ✦ and the late count, in that order; no blue ✦ in Tasks', H.order.slice(0, 3).join(',') === 'count,moved,late', JSON.stringify(H));
119
- ok('H2 the counts: the ✦ after the title holds 2 (the late spec\'s dates, the pilot\'s link), 1 quiet move, 2 tasks after a late one', H.prop.trim() === '2' && H.moved.trim() === '1' && H.late.trim() === '2', JSON.stringify(H));
119
+ ok('H2 the counts: the ✦ after the title is there with no number (chief-of-staff C4: one press opens them), 1 quiet move, 2 tasks after a late one', H.chipOn && !/\d/.test(H.prop) && H.moved.trim() === '1' && H.late.trim() === '2', JSON.stringify(H));
120
120
 
121
121
  // ── T: the Timeline
122
122
  const T0 = await page.evaluate(() => {
@@ -151,6 +151,8 @@ function model() {
151
151
 
152
152
  // ── S: the chips' lists
153
153
  await page.locator('#czViewer .cz-vw-hd [data-cz-vw="chip"]').click();
154
+ await page.waitForSelector('#czViewer [data-bp-full]', { timeout: 4000 }); // chief-of-staff C4: one press opens the batch; every change is one press away
155
+ await page.locator('#czViewer [data-bp-full]').click();
154
156
  await page.waitForSelector('#czViewer .pp [data-pp^="lk:"]', { timeout: 4000 });
155
157
  const S1 = await page.evaluate(() => { const m = document.querySelector('#czViewer .pp [data-pp^="lk:"]'); return { title: document.querySelector('#czVwTitle').textContent, text: m.textContent, yes: m.querySelectorAll('[data-pp-keep]').length, no: m.querySelectorAll('[data-pp-droplk]').length }; });
156
158
  ok('S1 the ✦ opens "Claude proposes 2": the link proposal sits under Links with ✓ and ✕', /Claude proposes 2/.test(S1.title) && S1.yes === 1 && S1.no === 1 && /Pilot with 3 partners waits on Load test at 3x peak/.test(S1.text), JSON.stringify(S1));
@@ -159,6 +161,8 @@ function model() {
159
161
  await page.waitForTimeout(400);
160
162
  const acc = posts.filter((p) => p.route === '/api/proposals/keep');
161
163
  ok('S2 ✓ posts /api/proposals/keep with that proposal', acc.length === 1 && acc[0].body.initiative === 'partner-rate-limits' && acc[0].body.ids.length === 1 && /^lk:/.test(acc[0].body.ids[0]), JSON.stringify(acc));
164
+ await page.waitForSelector('#czViewer .pp.bp, #czViewer .pp-none', { timeout: 4000 }); // back to the batch it was opened from (C4)
165
+ await page.locator('#czViewer .cz-vw-hd [data-cz-vw="back"]').click();
162
166
  await page.waitForSelector('#czViewer .iv-th', { timeout: 4000 });
163
167
  await page.locator('#czViewer [data-lk-chip="moved"]').click();
164
168
  await page.waitForSelector('.lk-pop .lk-m', { timeout: 4000 });
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "chief-of-staff chat (boards CsA–CsF): lib/cos-chat.js routing and rule, pm/chat-src.js sources, lib/proposals.js 14-day expiry, lib/done-feed.js Done (pure, node).",
3
+ "modules": [
4
+ "chief-of-staff-chat.test.js"
5
+ ],
6
+ "seconds": {
7
+ "chief-of-staff-chat.test.js": 1
8
+ }
9
+ }