create-pmos 0.475.0 → 0.477.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 (90) hide show
  1. package/package.json +33 -33
  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 +8 -2
  11. package/workspace/guide/forecast.md +16 -3
  12. package/workspace/guide/home.md +2 -2
  13. package/workspace/guide/settings.md +9 -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 +15 -4
  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/proposals.js +4 -3
  30. package/workspace/lib/report-chat.js +2 -0
  31. package/workspace/lib/route-modules.js +1 -0
  32. package/workspace/lib/routes-board-publish.js +7 -2
  33. package/workspace/lib/routes-boards.js +18 -5
  34. package/workspace/lib/routes-briefing-premium.js +16 -2
  35. package/workspace/lib/routes-forecast.js +8 -1
  36. package/workspace/lib/routes-grill.js +70 -0
  37. package/workspace/lib/routes-insight-moves.js +7 -5
  38. package/workspace/lib/routes-news.js +3 -1
  39. package/workspace/lib/routes-proposals.js +8 -6
  40. package/workspace/lib/routes-workflows.js +13 -0
  41. package/workspace/lib/wf-bridge.js +165 -0
  42. package/workspace/package-lock.json +2 -2
  43. package/workspace/package.json +1 -1
  44. package/workspace/panels-test.js +1 -2
  45. package/workspace/public/pm/bd-fc-card.js +45 -0
  46. package/workspace/public/pm/bd-next.js +1 -1
  47. package/workspace/public/pm/bd-publish.css +22 -18
  48. package/workspace/public/pm/bd-publish.js +57 -48
  49. package/workspace/public/pm/bd-shared.css +92 -30
  50. package/workspace/public/pm/bd-shared.js +143 -55
  51. package/workspace/public/pm/bd-span.js +27 -7
  52. package/workspace/public/pm/cozy-board.css +15 -0
  53. package/workspace/public/pm/cozy-ev.css +52 -0
  54. package/workspace/public/pm/cozy-home.css +4 -4
  55. package/workspace/public/pm/cozy-insights.css +23 -0
  56. package/workspace/public/pm/cozy-jl.js +158 -0
  57. package/workspace/public/pm/cozy-news.js +56 -2
  58. package/workspace/public/pm/cozy-panels.js +3 -2
  59. package/workspace/public/pm/cozy-settings.js +35 -7
  60. package/workspace/public/pm/cozy-today.css +6 -0
  61. package/workspace/public/pm/cozy-viewer.js +19 -3
  62. package/workspace/public/pm/goal-forecast.js +101 -0
  63. package/workspace/public/pm/grill-words.js +53 -0
  64. package/workspace/public/pm/hi-pop.css +16 -0
  65. package/workspace/public/pm/home-app.js +42 -5
  66. package/workspace/public/pm/home-day.js +5 -3
  67. package/workspace/public/pm/home-list.js +14 -4
  68. package/workspace/public/pm/home-mentions.js +5 -0
  69. package/workspace/public/pm/home-task.js +1 -1
  70. package/workspace/public/pm/home-today.js +14 -5
  71. package/workspace/public/pm/ini-props.js +41 -8
  72. package/workspace/public/pm/ini-view-model.js +27 -14
  73. package/workspace/public/pm/ini-view.css +62 -37
  74. package/workspace/public/pm/ini-view.js +1 -1
  75. package/workspace/public/pm/ini-wf-model.js +76 -19
  76. package/workspace/public/pm/ini-wf.js +69 -18
  77. package/workspace/public/pm/metric-drafts.css +9 -0
  78. package/workspace/public/pm/metric-drafts.js +2 -2
  79. package/workspace/public/pm/premium-board.js +13 -3
  80. package/workspace/public/pm/premium-insights.js +86 -11
  81. package/workspace/public/pm/premium-report-tab.js +13 -3
  82. package/workspace/public/pm/premium-vw-item.js +1 -1
  83. package/workspace/public/pm/readonly.js +1 -0
  84. package/workspace/public/pm/report-chat.js +2 -1
  85. package/workspace/public/pm/task-card.js +4 -3
  86. package/workspace/public/pm/wf-page.css +9 -0
  87. package/workspace/public/pm/wf-page.js +30 -1
  88. package/workspace/run-tests.js +10 -2
  89. package/workspace/server.js +5 -2
  90. package/workspace/test-lists/forecast-board.json +5 -0
@@ -8,6 +8,9 @@
8
8
  * + New workflow: the normal chat, scoped "New workflow". The PM describes the work; PMOS drafts it (skill workflow-setup,
9
9
  * `pmos workflow draft`) and the draft shows in the Viewer with Create workflow and Edit by hand. "Start blank" and
10
10
  * "from a copy" sit under the box.
11
+ * the bridge (batch 20 item 3, canvas WmB right) a workflow that replaces another (its saved bridge, or it began as a copy) shows
12
+ * "Replaces <name>": each old stage with a picker of this workflow's stages, Claude's proposal until the PM changes one. A change
13
+ * saves at once (POST /api/workflows/bridge); every later switch from the old workflow uses it.
11
14
  * Reads GET /api/workflows and GET /api/workflows/draft. Every write is the PM's press: POST /api/workflows/save | copy | archive | draft.
12
15
  * Product feature ships with PMOS and is read-only here: Copy makes an editable one. */
13
16
  import { pmGet, pmPost, pmHeaders } from './http.js';
@@ -18,6 +21,7 @@ import * as VW from './cozy-viewer.js';
18
21
  import { CATS, wfIcon, PRODUCT_FEATURE_ID } from './wf-model.js';
19
22
  import * as E from './wf-edit.js';
20
23
  import { openStage, setStageHost } from './wf-stage.js';
24
+ import { mapOf } from './ini-wf-model.js'; // the bridge: where each stage of the workflow it replaces lands (batch 20 item 3)
21
25
 
22
26
  const $ = (s) => document.querySelector(s);
23
27
  const post = (path, body) => pmPost(path, wsParam() ? { ws: wsParam(), ...body } : body); // the workspace this page shows (?ws=), else the server's own
@@ -107,10 +111,34 @@ function editorHtml(wf) {
107
111
  : `<button type="button" class="ib sm wf-push" data-wf-more aria-haspopup="menu" aria-label="${esc('More for ' + wf.name + ': copy, ' + (wf.archived ? 'restore' : 'archive'))}" title="More">${svg(ICON.more, 16)}</button>`) + '</div>';
108
112
  const note = ro ? `<p class="wf-box wf-small">${esc(wf.name)} ships with PMOS, so it cannot change here. <button type="button" class="wf-link" data-wf-copy>Copy it</button> to make a workflow of your own.</p>` : '';
109
113
  const arch = wf.archived ? '<p class="wf-box wf-small">Archived. New initiatives cannot use it. <button type="button" class="wf-link" data-wf-unarch>Restore it</button></p>' : '';
110
- return head + note + arch + colsHtml(wf, ro)
114
+ return head + note + arch + colsHtml(wf, ro) + bridgeHtml(wf, ro)
111
115
  + '<div class="wf-box wf-small wf-how"><b>One order, top to bottom</b><span>Stages run in the numbered order; drag to change it. A stage can be <b>Optional</b> (you may skip it) or run <b>Only when</b> a condition holds; otherwise PMOS skips it and the track shows it dashed. Each stage sits in To do, In progress or Done, as a status does in Jira.</span></div>'
112
116
  + `<p class="wf-small" role="status">${esc(S.msg)}</p>`;
113
117
  }
118
+ /** "Replaces Product feature" (WmB): each old stage → a picker of this workflow's stages. Saved with the workflow, used by every later switch. */
119
+ function bridgeHtml(wf, ro) {
120
+ if (ro || S.edit && S.edit.id === wf.id) return '';
121
+ const fromId = (wf.bridge && wf.bridge.from) || wf.copiedFrom;
122
+ const from = fromId && fromId !== wf.id ? wfOf(fromId) : null;
123
+ if (!from) return '';
124
+ const keys = new Set(wf.stages.map((x) => x.key));
125
+ if (!wf.bridge && from.stages.every((x) => keys.has(x.key))) return '';
126
+ const map = mapOf(from, wf);
127
+ const rows = from.stages.map((st) => `<label class="wf-brr"><span>${esc(st.name)}</span>${svg('M5 12h14M13 6l6 6-6 6', 18)}<select data-wf-br="${esc(st.key)}" aria-label="${esc('Where ' + st.name + ' goes')}"${S.busy ? ' disabled' : ''}>${wf.stages.map((t) => `<option value="${esc(t.key)}"${t.key === map[st.key] ? ' selected' : ''}>${esc(t.name)}</option>`).join('')}</select></label>`).join('');
128
+ return `<section class="wf-box wf-br" aria-label="${esc('Replaces ' + from.name)}"><div class="wf-brh"><b>Replaces ${esc(from.name)}</b><span class="wf-small wf-mut">${wf.bridge && wf.bridge.from === from.id ? 'saved once, used every time' : 'Claude’s proposal'}</span></div>${rows}`
129
+ + `<p class="wf-small wf-mut">Any initiative that switches from ${esc(from.name)} to ${esc(wf.name)} uses this bridge. Its stage and tasks move together. New initiatives start in ${esc(wf.stages[0].name)} as usual.</p></section>`;
130
+ }
131
+ async function saveBridge(wf, key, to) {
132
+ const fromId = (wf.bridge && wf.bridge.from) || wf.copiedFrom, from = wfOf(fromId);
133
+ if (!from) return;
134
+ const map = { ...mapOf(from, wf), [key]: to };
135
+ S.busy = true; drawMain();
136
+ const r = await post('/api/workflows/bridge', { id: wf.id, from: from.id, map });
137
+ S.busy = false;
138
+ if (!r || r.ok === false) { S.msg = (r && r.error) || 'The bridge was not saved.'; drawMain(); return; }
139
+ S.msg = 'Saved. A switch from ' + from.name + ' uses it.';
140
+ await load();
141
+ }
114
142
  function drawMain() {
115
143
  const m = $('#wfMain'), c = $('#wfChat'); if (!m) return;
116
144
  const isNew = S.sel === 'new';
@@ -381,6 +409,7 @@ function bind() {
381
409
  if (t.dataset.add) { const { wf: next, key } = E.addStage(stripCount(wf), t.dataset.add); edit(next).then((r) => { if (r.ok) openKey(key, { rename: true }); }); return; }
382
410
  if (t.dataset.stage) { openKey(t.dataset.stage); }
383
411
  });
412
+ main.addEventListener('change', (e) => { const k = e.target.dataset && e.target.dataset.wfBr; const wf = cur(); if (k && wf) saveBridge(wf, k, e.target.value); });
384
413
  main.addEventListener('submit', (e) => { if (e.target.closest('[data-wf-ren]')) { e.preventDefault(); const i = $('#wfName'); const wf = cur(); if (wf && i) rename(wf, i.value); } });
385
414
  main.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.closest('[data-wf-ren]')) { e.preventDefault(); e.stopPropagation(); S.renaming = false; S.renErr = ''; drawMain(); const b = main.querySelector('[data-wf-rn]'); if (b) b.focus(); } });
386
415
  $('#wfChat').addEventListener('click', (e) => {
@@ -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
@@ -311,7 +312,14 @@ function traceChanges(changes, ctx) {
311
312
  };
312
313
  const routes = (keys, where) => { for (const r of keys) { const w = route(r, where); if (w) return w; } return null; };
313
314
  const routeModule = (f) => {
314
- const keys = [...new Set([...strip(get(f) || '').matchAll(/['"`](\/api\/[^'"`?$]*)/g)].map((m) => m[1]))];
315
+ const t = strip(get(f) || '');
316
+ let keys = [...new Set([...t.matchAll(/['"`](\/api\/[^'"`?$]*)/g)].map((m) => m[1]))];
317
+ // a module that declares its prefixes serves only the paths under them; another '/api/…' it names is a route it CALLS (a read
318
+ // through ctx), which reaches nothing new. With no prefixes it can read, or none of its strings under them, every string counts.
319
+ const pm = /\bprefixes\s*[:=]\s*\[([^\]]*)\]/.exec(t);
320
+ const pre = pm ? [...pm[1].matchAll(/['"`](\/api\/[^'"`]+)['"`]/g)].map((m) => m[1]) : [];
321
+ const own = keys.filter((k) => pre.some((x) => k === x || k.startsWith(x.endsWith('/') ? x : x + '/') || x.startsWith(k)));
322
+ if (own.length) keys = own;
315
323
  return keys.length ? routes(keys, f) : `${f} names no /api/ route`;
316
324
  };
317
325
 
@@ -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
+ }