create-pmos 0.476.0 → 0.478.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 (83) hide show
  1. package/package.json +33 -27
  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/board-publish-ui-test.js +11 -16
  7. package/workspace/board-shared-ui-test.js +34 -33
  8. package/workspace/changelog.json +32 -0
  9. package/workspace/guide/briefing-premium.md +2 -2
  10. package/workspace/guide/claude-proposes.md +3 -1
  11. package/workspace/guide/forecast.md +16 -3
  12. package/workspace/guide/home.md +2 -2
  13. package/workspace/guide/published-board.md +1 -0
  14. package/workspace/guide/workflows.md +13 -2
  15. package/workspace/home-railcard-test.js +4 -4
  16. package/workspace/home-rows-test.js +17 -5
  17. package/workspace/ini-workflow-test.js +1 -1
  18. package/workspace/lib/board-pack.js +20 -1
  19. package/workspace/lib/board-trail.js +17 -1
  20. package/workspace/lib/boards-host.js +22 -2
  21. package/workspace/lib/briefing-premium-agent.js +2 -2
  22. package/workspace/lib/engine/boards.js +15 -3
  23. package/workspace/lib/engine/workflows.js +79 -10
  24. package/workspace/lib/forecast-offer.js +57 -0
  25. package/workspace/lib/grill-runs.js +1 -0
  26. package/workspace/lib/grill.js +1 -1
  27. package/workspace/lib/insight-moves.js +8 -6
  28. package/workspace/lib/news-for-you.js +6 -4
  29. package/workspace/lib/report-chat.js +2 -0
  30. package/workspace/lib/routes-board-publish.js +7 -2
  31. package/workspace/lib/routes-boards.js +18 -5
  32. package/workspace/lib/routes-briefing-premium.js +16 -2
  33. package/workspace/lib/routes-forecast.js +8 -1
  34. package/workspace/lib/routes-insight-moves.js +7 -5
  35. package/workspace/lib/routes-news.js +3 -1
  36. package/workspace/lib/routes-workflows.js +13 -0
  37. package/workspace/lib/wf-bridge.js +165 -0
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/panels-test.js +1 -2
  41. package/workspace/public/pm/bd-fc-card.js +45 -0
  42. package/workspace/public/pm/bd-next.js +1 -1
  43. package/workspace/public/pm/bd-publish.css +22 -18
  44. package/workspace/public/pm/bd-publish.js +57 -48
  45. package/workspace/public/pm/bd-shared.css +92 -30
  46. package/workspace/public/pm/bd-shared.js +143 -55
  47. package/workspace/public/pm/bd-span.js +27 -7
  48. package/workspace/public/pm/cozy-board.css +16 -0
  49. package/workspace/public/pm/cozy-ev.css +46 -0
  50. package/workspace/public/pm/cozy-home.css +4 -4
  51. package/workspace/public/pm/cozy-insights.css +21 -0
  52. package/workspace/public/pm/cozy-jl.js +158 -0
  53. package/workspace/public/pm/cozy-news.js +56 -2
  54. package/workspace/public/pm/cozy-panels.js +3 -2
  55. package/workspace/public/pm/cozy-settings.js +11 -7
  56. package/workspace/public/pm/cozy-today.css +3 -0
  57. package/workspace/public/pm/cozy-viewer.js +19 -3
  58. package/workspace/public/pm/goal-forecast.js +101 -0
  59. package/workspace/public/pm/hi-pop.css +16 -0
  60. package/workspace/public/pm/home-app.js +11 -4
  61. package/workspace/public/pm/home-day.js +5 -3
  62. package/workspace/public/pm/home-list.js +14 -4
  63. package/workspace/public/pm/home-mentions.js +5 -0
  64. package/workspace/public/pm/home-task.js +1 -1
  65. package/workspace/public/pm/home-today.js +11 -4
  66. package/workspace/public/pm/ini-view-model.js +27 -14
  67. package/workspace/public/pm/ini-view.js +1 -1
  68. package/workspace/public/pm/ini-wf-model.js +76 -19
  69. package/workspace/public/pm/ini-wf.js +69 -18
  70. package/workspace/public/pm/metric-drafts.css +9 -0
  71. package/workspace/public/pm/metric-drafts.js +2 -2
  72. package/workspace/public/pm/premium-board.js +13 -3
  73. package/workspace/public/pm/premium-insights.js +43 -6
  74. package/workspace/public/pm/premium-report-tab.js +13 -3
  75. package/workspace/public/pm/premium-vw-item.js +1 -1
  76. package/workspace/public/pm/readonly.js +4 -0
  77. package/workspace/public/pm/report-chat.js +2 -1
  78. package/workspace/public/pm/task-card.js +4 -3
  79. package/workspace/public/pm/wf-page.css +9 -0
  80. package/workspace/public/pm/wf-page.js +30 -1
  81. package/workspace/run-tests.js +54 -8
  82. package/workspace/server.js +5 -2
  83. package/workspace/test-lists/forecast-board.json +5 -0
@@ -167,7 +167,8 @@ const WIDE = new Set([
167
167
  * line inside a top-level function reaches whatever uses that function, followed by name to the route blocks and the
168
168
  * functions that use it. Anything else (top-level setup, middleware between route blocks, a page route, a name used
169
169
  * outside any function or route block) reaches every suite.
170
- * - lib/routes-<x>.js (a route module that lib/route-modules.js loads): every '/api/…' route the file names.
170
+ * - lib/routes-<x>.js (a route module that lib/route-modules.js loads): every '/api/…' route the file names under the
171
+ * prefixes it declares (a route it only calls through ctx is left out). With no prefixes it can read: every route it names.
171
172
  * - lib/route-modules.js, when the diff only adds module names to its list: what each added lib/routes-<x>.js reaches. Any other change to it is the rule below.
172
173
  * - Any other file: the files that name it (a require, an import or a path string), followed the same way: server.js
173
174
  * through the names it binds the module to, a lib/ file through its own users, a suite directly. A lib/ file that no
@@ -300,18 +301,31 @@ function traceChanges(changes, ctx) {
300
301
  let hit = false;
301
302
  for (const f of code) {
302
303
  if (f === 'server.js' || /^lib\/route(s-|-modules)/.test(f)) continue;
303
- const t = get(f); if (!t || !keys.some((k) => t.includes(k))) continue;
304
+ // the code without its comments: a file whose header comment names a route does not call it (batch 20: lib/chat-files.js
305
+ // documents GET /api/chat-file, and that sent a change to lib/routes-briefing-premium.js to every suite through spawnSessionInner)
306
+ const t = sget(f); if (!t || !keys.some((k) => t.includes(k))) continue;
304
307
  hit = true;
305
308
  if (inList.has(f)) picked.add(f);
306
309
  else if (SUITE_NAME.test(f)) continue; // a suite of another group: nothing depends on it
307
310
  else if (f.startsWith('public/')) viaPublic(f);
308
311
  else { const w = users(f); if (w) return w; }
309
312
  }
310
- return hit ? null : `${where}: nothing names the route ${r}`;
313
+ if (hit) return null;
314
+ // 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)
315
+ const file = /^(lib\/[\w.-]+\.js)/.exec(String(where));
316
+ if (file) { nameHits(file[1]).forEach((x) => picked.add(x)); return null; }
317
+ return `${where}: nothing names the route ${r}`;
311
318
  };
312
319
  const routes = (keys, where) => { for (const r of keys) { const w = route(r, where); if (w) return w; } return null; };
313
320
  const routeModule = (f) => {
314
- const keys = [...new Set([...strip(get(f) || '').matchAll(/['"`](\/api\/[^'"`?$]*)/g)].map((m) => m[1]))];
321
+ const t = strip(get(f) || '');
322
+ let keys = [...new Set([...t.matchAll(/['"`](\/api\/[^'"`?$]*)/g)].map((m) => m[1]))];
323
+ // a module that declares its prefixes serves only the paths under them; another '/api/…' it names is a route it CALLS (a read
324
+ // through ctx), which reaches nothing new. With no prefixes it can read, or none of its strings under them, every string counts.
325
+ const pm = /\bprefixes\s*[:=]\s*\[([^\]]*)\]/.exec(t);
326
+ const pre = pm ? [...pm[1].matchAll(/['"`](\/api\/[^'"`]+)['"`]/g)].map((m) => m[1]) : [];
327
+ const own = keys.filter((k) => pre.some((x) => k === x || k.startsWith(x.endsWith('/') ? x : x + '/') || x.startsWith(k)));
328
+ if (own.length) keys = own;
315
329
  return keys.length ? routes(keys, f) : `${f} names no /api/ route`;
316
330
  };
317
331
 
@@ -325,7 +339,11 @@ function traceChanges(changes, ctx) {
325
339
  const m = /^(?:async\s+)?function\s*\*?\s*(\w+)|^(?:const|let)\s+(\w+)\s*=\s*(?:async\s*)?(?:function\b|\([^)]*\)\s*=>|\w+\s*=>)/.exec(C[i]);
326
340
  if (!m) continue;
327
341
  let j = i;
328
- if (/\{\s*$/.test(C[i]) || !/;\s*$/.test(C[i])) { j = i + 1; while (j < C.length && !/^\}/.test(C[j])) j++; }
342
+ // a function whole on its one line (its braces balance, e.g. `function f(s) { try { x(); } catch {} }`) ends there: before,
343
+ // it ran on to the next line that starts with '}' and swallowed the function after it (batch 20: noteSessionEnd took spawnSessionInner)
344
+ const open = (C[i].match(/\{/g) || []).length, shut = (C[i].match(/\}/g) || []).length;
345
+ const whole = open > 0 && open === shut;
346
+ if (!whole && (/\{\s*$/.test(C[i]) || !/;\s*$/.test(C[i]))) { j = i + 1; while (j < C.length && !/^\}/.test(C[j])) j++; }
329
347
  fn.push({ name: m[1] || m[2], a: i + 1, b: j + 1 });
330
348
  i = j;
331
349
  }
@@ -347,7 +365,29 @@ function traceChanges(changes, ctx) {
347
365
  return S;
348
366
  };
349
367
  const used = new Set();
350
- const serverLines = (lines) => {
368
+ // A NEW OPTION (batch 20): every changed line of a function names one of its destructured parameters that nothing else in
369
+ // server.js names. With no caller passing it the function does what it did, so the change reaches only the callers that pass
370
+ // it: the suites that name it, and the suites of each lib/ or public/ file that names it. (Before, adding `typedByPm` to
371
+ // spawnSessionInner reached every suite, through the boot code that calls spawnSession.)
372
+ const optSeen = new Map();
373
+ const optionOnly = (own, lines) => {
374
+ if (optSeen.has(own.name)) return optSeen.get(own.name);
375
+ const { C } = parseServer();
376
+ const sig = /\(\s*\{([^}]*)\}/.exec(C[own.a - 1] || '');
377
+ const params = sig ? sig[1].split(',').map((x) => x.trim().split(/[\s=:]/)[0]).filter((x) => /^\w+$/.test(x)) : [];
378
+ const outside = C.filter((_, k) => k + 1 < own.a || k + 1 > own.b).join('\n');
379
+ const fresh = params.filter((x) => !new RegExp('\\b' + x + '\\b').test(outside));
380
+ const mine = lines.filter((n) => n >= own.a && n <= own.b && (C[n - 1] || '').trim());
381
+ const res = fresh.length > 0 && mine.length > 0 && mine.every((n) => fresh.some((x) => new RegExp('\\b' + x + '\\b').test(C[n - 1])));
382
+ if (res) {
383
+ const re = new RegExp('\\b(' + fresh.join('|') + ')\\b');
384
+ for (const sfile of list) if (re.test(get(sfile) || '')) picked.add(sfile);
385
+ for (const f of code) if (f !== 'server.js' && !inList.has(f) && re.test(sget(f) || '')) nameHits(f).forEach((x) => picked.add(x));
386
+ }
387
+ optSeen.set(own.name, res);
388
+ return res;
389
+ };
390
+ const serverLines = (lines, viaUse = false) => {
351
391
  const { C, fnAt, blockAt } = parseServer();
352
392
  for (const n of lines) {
353
393
  const raw = C[n - 1];
@@ -355,10 +395,16 @@ function traceChanges(changes, ctx) {
355
395
  const b = blockAt(n);
356
396
  if (b) { const w = routes(b.keys, `server.js:${n}`); if (w) return w; continue; }
357
397
  const own = fnAt(n);
398
+ if (own && own.name !== 'handleRequest' && optionOnly(own, lines)) continue;
358
399
  if (own && own.name !== 'handleRequest') { const w = useOf(own.name); if (w) return `${own.name} (server.js:${n}) is used by ${w}`; continue; }
359
400
  const req = /^(?:const|let)\s+\w+\s*=\s*require\(\s*'\.\/(lib\/[\w.-]+)'\s*\)\s*;?\s*$/.exec(raw); // a plain top-level `const x = require('./lib/m.js')`: its uses are other lines, traced on their own
360
401
  const mod = wiringOf(n) || (req ? req[1] : null);
361
402
  if (mod) { nameHits(mod).forEach((x) => picked.add(x)); if (inList.has('test.js')) picked.add('test.js'); continue; } // start-up wiring of one lib module: the suites that name it, and the server boot suite
403
+ // a USE of a changed function at the top level (boot, a timer, session restore): the server boot suite runs that code, and
404
+ // the routes that use the function are traced on their own. Only a changed line of its own out there reaches every suite
405
+ // (PM, 2026-11-01: "DO NOT do full regression every time"; before, any function session restore calls reached all 446 suites)
406
+ // A timer (setInterval/setTimeout) runs it on its own all through every suite, so that use still reaches every suite.
407
+ if (viaUse && !/\bset(Interval|Timeout)\s*\(/.test(raw)) { if (inList.has('test.js')) picked.add('test.js'); continue; }
362
408
  return `server.js:${n}, outside every route and function`;
363
409
  }
364
410
  return null;
@@ -386,7 +432,7 @@ function traceChanges(changes, ctx) {
386
432
  if (!own && /^(?:const|let|var)\s[^=]*=\s*require\(/.test(L[i])) continue; // the binding itself
387
433
  at.push(i + 1);
388
434
  }
389
- return serverLines(at);
435
+ return serverLines(at, true);
390
436
  };
391
437
  // the files that name f, followed until a suite, a route or a page; the reason it cannot tell, or null
392
438
  const userMemo = new Map();
@@ -428,7 +474,7 @@ function traceChanges(changes, ctx) {
428
474
  if (inList.has('test.js')) picked.add('test.js');
429
475
  }
430
476
  for (const name of names) { const w = useOf(name); if (w) return w; }
431
- const w = serverLines(inline); if (w) return w;
477
+ const w = serverLines(inline, true); if (w) return w; // the lines that require it are uses of it, as useOf's
432
478
  continue;
433
479
  }
434
480
  if (/^lib\/routes-/.test(g)) { const w = routeModule(g); if (w) return w; continue; }
@@ -4483,7 +4483,7 @@ function spawnSession(opts) {
4483
4483
  return s;
4484
4484
  }
4485
4485
  function noteSessionEnd(s) { try { if (refreshRun) refreshRun.ended(s); } catch (e) { warnWriteFail('refresh log (end)', e); } }
4486
- function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths, chatClaude, byPm }) {
4486
+ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile, initiative, modelAsk, planItem, workType, autoDelete, launchFlags, addDirs, onDone, scratch, extraEnv, writePaths, chatClaude, byPm, typedByPm }) {
4487
4487
  const id = nextSessionId();
4488
4488
  /* pm-os-absorb Run 1 — every AGENT session gets a token, `<id>.<8 hex>`, in its environment as PMOS_SESSION, and
4489
4489
  * PMOS_BIN, this workspace's own bin/pmos.js. `pmos item` run inside it is then attributed `agent:<token>` (the token
@@ -4503,7 +4503,8 @@ function spawnSessionInner({ name, agent, cwd, ws, origin, initialInput, profile
4503
4503
  // safeFirstInput: a first input that begins with `/` is read by the agent as a slash command, not as the task.
4504
4504
  // firstInput.deliver waits until the agent is ready to read, types the prompt, then presses Enter as its own key
4505
4505
  // (lib/first-input.js): a burst written at a fixed 700 ms was lost or left unsent while the agent was still starting.
4506
- const feed = (s) => { if (initialInput && s && s.pty) { try { deliverInput(s, safeFirstInput(initialInput)); } catch {} } };
4506
+ // typedByPm (batch 20 item 7): the PM typed a / command in the chat box: it goes as typed, so Claude Code runs it (/clear, /model, a skill)
4507
+ const feed = (s) => { if (initialInput && s && s.pty) { try { deliverInput(s, typedByPm ? String(initialInput) : safeFirstInput(initialInput)); } catch {} } };
4507
4508
  // shell gets a real fallback to `sh`; agent CLIs run as-is (harness untouched), NO fallback —
4508
4509
  // falling back from `claude` to `sh` would be a lie.
4509
4510
  const cmd = isShell ? (commandExists(SHELL) ? SHELL : 'sh') : agent;
@@ -10463,6 +10464,8 @@ async function handleRequest(req, res) {
10463
10464
  runtimeDir: STATE, claudeSetup, registerWorkspace, pickFolder, broadcast, workspaceList: () => [...workspaces.values()], homeRoot: HOME_ENABLED ? SELF_ROOT : null, spawnSession, jevModelOpts, sendToSession, endSupersededRuns, proSettings,
10464
10465
  // premium-chat-session: every premium chat panel is an interactive Claude Code session the PM talks to (text as typed, `/` kept)
10465
10466
  chatSessions,
10467
+ // batch 20 item 13: "grill this" in an initiative's chat starts Claude's grill run at once (lib/grill-runs.js start, why 'ask')
10468
+ grillStart: (o) => grillRuns.start(o),
10466
10469
  // report-workspace: the schedule store a recurring report registers its draft-only schedule in, a skill's body, and the stop of a headless run
10467
10470
  scheduleStore: { read: readSchedules, write: writeSchedules },
10468
10471
  // report-structure-gaps: Draft it now on a report with a saved structure starts the draft session the schedule would, and the row reads its state
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "The Board's forecast ranges (Grill and Forecast, UI-B Board; FcBoard): the hatched range past the promised date, the program's milestones at risk, the forecast card's words.",
3
+ "modules": ["forecast-board.test.js"],
4
+ "seconds": { "forecast-board.test.js": 2 }
5
+ }