create-pmos 0.578.0 → 0.580.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.578.0",
3
+ "version": "0.580.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.580.0",
38
+ "at": "2026-11-17T02:13:59.003Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1309,
43
+ "t": "Standing rules become checks; the harness joins the trigger list",
44
+ "s": "Standing rules become checks; the harness joins the trigger list",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.579.0",
51
+ "at": "2026-11-17T02:01:31.178Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1312,
56
+ "t": "Present a prototype round on a shared screen (live round W3)",
57
+ "s": "Present a prototype round on a shared screen (live round W3)",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.578.0",
38
64
  "at": "2026-11-17T01:49:28.275Z",
@@ -278,32 +304,6 @@
278
304
  "k": "fix"
279
305
  }
280
306
  ]
281
- },
282
- {
283
- "v": "0.560.0",
284
- "at": "2026-11-11T06:57:01.192Z",
285
- "f": 4,
286
- "prs": [
287
- {
288
- "n": 1290,
289
- "t": "Fix three flaky suites from batch 29",
290
- "s": "Fix three flaky suites from batch 29",
291
- "k": "fix"
292
- }
293
- ]
294
- },
295
- {
296
- "v": "0.559.0",
297
- "at": "2026-11-11T02:38:19.186Z",
298
- "f": 4,
299
- "prs": [
300
- {
301
- "n": 1288,
302
- "t": "Retire board and portfolio documents and the product page Documents tab",
303
- "s": "Retire board and portfolio documents and the product page Documents tab",
304
- "k": "new"
305
- }
306
- ]
307
307
  }
308
308
  ]
309
309
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@73e482c8
1
+ kernel-source: pmos@2e4ecfff
2
2
  assembled: 2026-11-17
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-17T01:49:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T02:13:55Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-17T01:49:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T02:13:55Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -25,6 +25,9 @@
25
25
  * the D11 triggers: the item failed before, a revert on the default branch in the last 14 days, a subsystem untouched 90 days ·
26
26
  * the line `PMOS-Merge: human` (PMOS writes it when autonomy is off or the factory is demoted; the PM may add it to stop a merge) ·
27
27
  * a pull request from a fork (a branch named pmos/… elsewhere is not PMOS's).
28
+ * D109 (harnessTriggers): held-out cases, the standing-rule registry, the improvement loop's code, evals and done tests, agent rules,
29
+ * skills and decision records, gates and the verifier, a fix that edits its own case (`PMOS-Case: <id>`), a fix from an outside
30
+ * source (`PMOS-Source: outside`).
28
31
  * agent-product-lane: a changed prompt or model-id file of a product that is an agent (pmos/factory.json agent.files), unless the item's
29
32
  * check names the product's simulation eval set (agent.eval_set).
30
33
  *
@@ -73,6 +76,53 @@ const ADDED = [
73
76
  { rule: 'agent-path', re: /(@anthropic-ai\/|\banthropic\b|\bopenai\b|\bclaude\s+-p\b|\blangchain\b|\bllm\b|child_process|\bexecSync\s*\(|\bexecFile(Sync)?\s*\(|\bspawn(Sync)?\s*\(|\beval\s*\(|new\s+Function\s*\(|subprocess\.|os\.system\s*\()/i, why: 'adds a model call or runs a program (a new agent path)' },
74
77
  ];
75
78
 
79
+ /* ---- D109: the harness and the judge. A change to the rules agents follow, to what judges a change, or to the improvement loop
80
+ * itself waits for Wawan; so does a fix that came from an outside source, and a fix that edits the case it is fixing. Exported as
81
+ * harnessTriggers(paths, { body, fixingCase }) so the improvement loop asks the same list before it lets a fix merge by itself. ---- */
82
+ const HARNESS = [
83
+ { rule: 'rule-book', re: /^planning\/improve\/standing-rules\.json$/, why: "is the standing-rule registry (Wawan's rule book): adding, changing or retiring a check" },
84
+ { rule: 'loop-code', re: /^(workspace\/lib\/improve[-/][^/]*|workspace\/lib\/improve\.js|scripts\/improve(-[^/]*)?\.js)$/, why: "is the improvement loop's own code" },
85
+ { rule: 'eval-files', re: /^(planning\/evals\/|planning\/done-tests\/|skills\/evals\/|kit\/skills\/evals\/)/, why: 'is an eval, a rubric or a done test (what judges a change)' },
86
+ { rule: 'harness-rules', re: /(^|\/)(agents|claude|gemini)\.md$|^(decisions|principles)\.md$|^okf\/products\/pmos\/adr\/|^(kit\/|workspace\/)?skills\/|^build-skills\/|^\.claude\//, why: 'is an agent rule, a skill or a decision record' },
87
+ { rule: 'gate-scripts', re: /^\.github\/|^scripts\/(factory-guardrail|standing-rules|workflow-state|frontmatter_lint|frontmatter_registry|check_[a-z_]+|check-[a-z-]+|verifier|verify-[a-z-]+|brakes|anchor-resolve|lane-defs|md-newlines|run-corrections)\.|^scripts\/git-hooks\/|^workspace\/(run-tests\.js|test-files\.json)$|^workspace\/lib\/(autonomy|verify-runs|factory-review)\.js$|^kit\/templates\/pmos-guardrail/, why: 'is a gate, the guardrail, the verifier or the test runner' },
88
+ ];
89
+ const caseIdsOf = (body, fixingCase) => {
90
+ const ids = new Set([].concat(fixingCase || []).map((x) => String(x).trim().toLowerCase()).filter(Boolean));
91
+ for (const m of String(body || '').matchAll(/^PMOS-Case:\s*([A-Za-z0-9_.-]+)\s*$/gmi)) ids.add(m[1].toLowerCase());
92
+ return ids;
93
+ };
94
+ /** changes: changed paths (repo-relative strings), or { path, status: 'A'|'M'|'D'|'R'|'C', from } as git's --name-status gives them.
95
+ * A case PR that only ADDS files under planning/improve/cases/ or heldout/ (plus appends to planning/improve/loop.jsonl) reads clear:
96
+ * the case writer is a separate run from the fixer. Any change to an existing case, any case change in a PR that also changes
97
+ * something outside planning/improve/ (a fix touching its judge), and the case a fix names with PMOS-Case all read human.
98
+ * → [{ rule, detail }]; empty means nothing on the D109 part of the list. */
99
+ function harnessTriggers(changes, { body = '', fixingCase = null } = {}) {
100
+ const out = [];
101
+ const ids = caseIdsOf(body, fixingCase);
102
+ const list = [].concat(changes || []).map((c) => (typeof c === 'string' ? { path: c, status: null, from: null } : { path: String((c && c.path) || ''), status: c && c.status ? String(c.status)[0].toUpperCase() : null, from: (c && c.from) || null }))
103
+ .map((c) => ({ ...c, path: c.path.replace(/^\.\//, '') })).filter((c) => c.path);
104
+ const CASES = /^planning\/improve\/(cases|heldout)\//;
105
+ const LEDGER = 'planning/improve/loop.jsonl';
106
+ const outsideImprove = list.some((c) => !c.path.toLowerCase().startsWith('planning/improve/') || (c.from && !String(c.from).toLowerCase().startsWith('planning/improve/')));
107
+ for (const c of list) {
108
+ const p = c.path, l = p.toLowerCase();
109
+ for (const h of HARNESS) if (h.re.test(l)) out.push({ rule: h.rule, detail: `${p} ${h.why} (D109)` });
110
+ if (CASES.test(l) || (c.from && CASES.test(String(c.from).toLowerCase()))) {
111
+ const kind = /^planning\/improve\/heldout\//.test(l) || (c.from && /^planning\/improve\/heldout\//.test(String(c.from).toLowerCase())) ? 'heldout' : 'case';
112
+ if (c.status !== 'A') out.push({ rule: kind === 'heldout' ? 'heldout' : 'case-edit', detail: `${p} ${c.status ? 'changes' : 'may change'} an existing ${kind === 'heldout' ? 'held-out case' : 'case'}: cases are added, never edited by the loop (D109)` });
113
+ else if (outsideImprove) out.push({ rule: kind === 'heldout' ? 'heldout' : 'case-with-fix', detail: `${p} adds a ${kind === 'heldout' ? 'held-out case' : 'case'} in the same pull request as a fix: the case and the fix come from separate runs (D109)` });
114
+ }
115
+ if (l === LEDGER && c.status && c.status !== 'M' && c.status !== 'A') out.push({ rule: 'loop-ledger', detail: `${p} is the loop's append-only ledger and this pull request ${c.status === 'D' ? 'deletes' : 'moves'} it (D109)` });
116
+ const m = /^planning\/improve\/(?:cases|heldout)\/([^/]+?)(\.[a-z0-9]+)?(\/|$)/.exec(l);
117
+ if (m && ids.has(m[1])) out.push({ rule: 'own-case', detail: `${p} is the case this fix is meant to pass: a fix may not touch its own case (D109)` });
118
+ }
119
+ const src = /^PMOS-Source:\s*(\S+)\s*$/mi.exec(String(body || ''));
120
+ const fam = src ? src[1].toLowerCase() : '';
121
+ if (fam === 'outside') out.push({ rule: 'outside-source', detail: 'the fix came from an outside source (PMOS-Source: outside): outside-sourced fixes never merge by themselves (D109)' });
122
+ if (fam === 'loop') out.push({ rule: 'loop-self', detail: 'the loop changes itself (PMOS-Source: loop): its own changes always wait for Wawan (D109)' });
123
+ return out;
124
+ }
125
+
76
126
  function git(cwd, args) {
77
127
  const r = cp.spawnSync('git', args, { cwd, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024, env: { ...process.env, GIT_TERMINAL_PROMPT: '0' } });
78
128
  return { ok: !r.error && r.status === 0, out: String(r.stdout || ''), err: String(r.stderr || (r.error && r.error.message) || '').trim() };
@@ -230,6 +280,8 @@ function classify({ cwd = process.cwd(), base, head, branch = '', body = '', led
230
280
  if (it && it.criterion) for (const r of pathsIn(it.criterion.ref)) if (p === r || p.startsWith(r.replace(/\/?$/, '/'))) human('self-test', `${p} is the item's own check (${it.criterion.ref})`);
231
281
  }
232
282
 
283
+ for (const r of harnessTriggers(files, { body })) human(r.rule, r.detail);
284
+
233
285
  // ---- agent-prompt: the agent product's prompts and model ids are code, and only its simulation eval set judges them
234
286
  const ag = agentDeclOf(cwd, base, factoryText);
235
287
  const agentHit = ag ? files.find((f) => inScope(f.path, ag.files) || (f.from && inScope(f.from, ag.files))) : null;
@@ -305,5 +357,5 @@ function cliMain(argv, { say = (s) => console.log(s), env = process.env, cwd = p
305
357
  return 0;
306
358
  }
307
359
 
308
- module.exports = { classify, summaryOf, actOnGitHub, cliMain, REVERT_DAYS, STALE_DAYS, MANIFESTS, LOCKS };
360
+ module.exports = { classify, harnessTriggers, HARNESS, summaryOf, actOnGitHub, cliMain, REVERT_DAYS, STALE_DAYS, MANIFESTS, LOCKS };
309
361
  if (require.main === module) process.exitCode = cliMain(process.argv.slice(2));
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-17T01:49:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-17T02:13:55Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.580.0",
4
+ "at": "2026-11-17T02:13:59.003Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1309,
9
+ "t": "Standing rules become checks; the harness joins the trigger list",
10
+ "s": "Standing rules become checks; the harness joins the trigger list",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.579.0",
17
+ "at": "2026-11-17T02:01:31.178Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1312,
22
+ "t": "Present a prototype round on a shared screen (live round W3)",
23
+ "s": "Present a prototype round on a shared screen (live round W3)",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.578.0",
4
30
  "at": "2026-11-17T01:49:28.275Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "What PMOS does behind the scenes, and what stays yours"
4
4
  description: "Every job PMOS runs by itself, what agents apply by themselves with Undo (D106), long-running goals, the team of role agents, the idle lab, and the PM-only acts."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-17
6
6
  ---
7
7
 
8
8
  # What PMOS does behind the scenes
@@ -216,6 +216,16 @@ A column with no source is left out, with one line that says why. PMOS is still
216
216
 
217
217
  Each prototype opens in a sandboxed frame. It cannot reach PMOS or your data.
218
218
 
219
+ ### Present a round
220
+
221
+ To show a round to other people, press ⤢ (Present this round) in the compare view's header. A new tab opens with the round's frames side by side, the initiative's name and the round number. Nothing else shows: no ✓ or ✕, no History, no menus. Share that tab on the call, or put it on the screen in the room.
222
+
223
+ - To fill the screen with one frame, tap it, or press its key: 1 to 3, or A to C.
224
+ - In a full-screen frame, you can use the prototype. The arrow keys go to the next or the earlier frame.
225
+ - To show all the frames again, press Esc or ⤡ in the corner. Esc works only when the focus is not in the prototype, so ⤡ is always there.
226
+
227
+ On a phone, the frames show one under the other. Present mode keeps and drops nothing: go back to the compare view to do that.
228
+
219
229
  ### Intelligence › Lab
220
230
 
221
231
  The Lab shows only once there is something to show. Top to bottom:
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+ /* lab-present.js — present mode (live round W3, initiative live-round-present): one prototype round as a clean screen for GET /api/lab/present
3
+ * (lib/routes-lab.js) and the page GET /pm/present (premium-present.html, pm/cozy-present.js). It reads the same proposal fold as the
4
+ * compare view (lib/idle-lab.js compareOf), so present mode keeps no state of its own.
5
+ *
6
+ * presentOf(P, id, { titleOf }) PURE → { ini, board, id, title, round, frames: [{ key, title, file }] } | null
7
+ */
8
+ /**
9
+ * PURE. One prototype round as a clean screen: the initiative title, the round number and its frames, nothing else.
10
+ * P lib/proposals.js fold; id: a prototyped (a first round: every specimen) or improved (a later round: its one file) proposal id
11
+ * → { ini, board, id, title, round, frames: [{ key, title, file }] } | null
12
+ */
13
+ function presentOf(P, id, { titleOf = () => '' } = {}) {
14
+ if (!P) return null;
15
+ const p = P.props.get(id);
16
+ if (!p || (p.group !== 'prototyped' && p.group !== 'improved') || !p.data) return null;
17
+ const frames = p.group === 'prototyped'
18
+ ? (p.data.specimens || []).filter((s) => s && s.file).map((s) => ({ key: String(s.key || ''), title: String(s.title || ''), file: s.file }))
19
+ : p.data.file ? [{ key: String(p.data.base || ''), title: String(p.data.changed || ''), file: p.data.file }] : [];
20
+ if (!frames.length) return null;
21
+ return { ini: p.ini, board: p.board || '', id: p.id, title: titleOf(p.ini) || p.ini, round: p.group === 'improved' ? p.data.round : 1, frames };
22
+ }
23
+
24
+ module.exports = { presentOf };
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * GET /api/lab?ws&board → { ok, lab } lab: lib/idle-lab.js labOf (null: nothing ran this week and nothing waits)
7
7
  * GET /api/lab/compare?ws&board&id[&key] → { ok, compare } lib/idle-lab.js compareOf (404 when the prototype is gone)
8
+ * GET /api/lab/present?ws&board&id → { ok, present } lib/lab-present.js presentOf: the round's frames for present mode (GET /pm/present)
8
9
  * GET /api/lab/specimen?file → text/html, a specimen from <runtime>/idle-lab/specimens/, served sandboxed (no scripts that can
9
10
  * reach PMOS: CSP sandbox without allow-same-origin, no network but the fonts)
10
11
  * POST /api/lab/keep { ws, id } → { ok, batch, said } ✓ on a Lab ✦: start keeps it and starts the initiative on its board
@@ -113,6 +114,17 @@ const READS = {
113
114
  ctx.json(res, { ok: true, compare: c });
114
115
  return true;
115
116
  },
117
+ '/api/lab/present': (ctx, res, url) => {
118
+ const w = wsOf(ctx, url.searchParams.get('ws')); if (!w) return fail(ctx, res, 404, 'no such workspace');
119
+ const dir = dirOf(ctx, w), id = url.searchParams.get('id') || '';
120
+ if (!dir || !ID_RE.test(id)) return fail(ctx, res, 400, 'id names a prototype');
121
+ const T = titles(w);
122
+ const v = require('./lab-present.js').presentOf(PR.read(dir), id, { titleOf: (ini) => (T.get(ini) || {}).title || '' });
123
+ if (!v) return fail(ctx, res, 404, 'That prototype is no longer here');
124
+ for (const f of v.frames) f.url = LAB.specimenUrl(f.file);
125
+ ctx.json(res, { ok: true, present: v });
126
+ return true;
127
+ },
116
128
  '/api/lab/specimen': (ctx, res, url) => {
117
129
  const f = LAB.specimenPath(ctx.runtimeDir, url.searchParams.get('file') || '');
118
130
  let html = null;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.578.0",
3
+ "version": "0.580.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.578.0",
9
+ "version": "0.580.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.578.0",
3
+ "version": "0.580.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  * openCompare({ where: { ws, board }, id, key?, H? }) the compare view in the Viewer: the ✦ line, the columns (Production, Design,
9
9
  * Prototype), "Where they differ" and History. A column whose source is not proven is left out with one line
10
10
  * why (lib/idle-lab.js PROVEN). A press on a round in History puts it in the Prototype column. ✓ and ✕ in the
11
- * header keep or drop the round shown.
11
+ * header keep or drop the round shown; ⤢ presents it on a clean screen in a new tab (GET /pm/present).
12
12
  * Every specimen loads from GET /api/lab/specimen in a sandboxed frame: it cannot reach PMOS. Nothing is written before the PM's ✓. */
13
13
  import { pmGet, pmPost } from './http.js';
14
14
 
@@ -16,7 +16,7 @@ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&':
16
16
  const SVG = (d, w = 16, sw = 1.8) => `<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>`;
17
17
  export const I = {
18
18
  proto: 'M3 4h18v14H3zM3 9h18', round: 'M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5', scan: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 3a15 15 0 0 1 0 18M3 12h18',
19
- open: 'M7 17 17 7M8 7h9v9', check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18',
19
+ open: 'M7 17 17 7M8 7h9v9', check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', present: 'M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7',
20
20
  };
21
21
  const GROUPS = ['prototyped', 'improved', 'scanned'];
22
22
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -91,8 +91,13 @@ function bodyHtml(c) {
91
91
  + `<div class="lab-below">${pins}${hist}</div></div>`;
92
92
  }
93
93
  function presses(c) {
94
- return c && c.state === 'open' ? [{ act: 'drop', label: 'Drop this round', icon: I.x }, { act: 'keep', label: 'Keep this round', icon: I.check, blue: true }] : [];
94
+ if (!c) return [];
95
+ // ⤢ present (live round W3): the round shown, on a clean screen in a new tab (GET /pm/present, pm/cozy-present.js)
96
+ const present = { act: 'present', label: 'Present this round', icon: I.present };
97
+ return c.state === 'open' ? [present, { act: 'drop', label: 'Drop this round', icon: I.x }, { act: 'keep', label: 'Keep this round', icon: I.check, blue: true }] : [present];
95
98
  }
99
+ /** The present page's address for the round shown. */
100
+ export const presentUrl = (at, c) => '/pm/present?ws=' + encodeURIComponent((at && at.ws) || '') + '&board=' + encodeURIComponent((at && at.board) || c.board || '') + '&id=' + encodeURIComponent(c.id);
96
101
  function draw() {
97
102
  const VW = window.czViewer, b = VW && VW.body(), cur = VW && VW.current();
98
103
  if (!b || !cur || cur.id !== 'lab:cmp' || !C.c) return;
@@ -111,6 +116,7 @@ async function load() {
111
116
  async function act(a) {
112
117
  const c = C.c, at = C.at || {}; if (!c) return;
113
118
  const say = (m, u) => { if (C.H && C.H.toast) C.H.toast(m, u); };
119
+ if (a === 'present') { window.open(presentUrl(at, c), '_blank', 'noopener'); return; }
114
120
  if (a === 'keep') {
115
121
  const r = await pmPost('/api/proposals/keep', { ws: at.ws, board: at.board || c.board, initiative: c.ini, ids: [c.id] }).catch(() => null);
116
122
  if (!r || r.ok === false) { say((r && r.error) || 'Nothing was kept.'); return; }
@@ -0,0 +1,33 @@
1
+ /* pm/cozy-present.css — present mode (premium-present.html, cozy-present.js; live round W3). A dark ground to the edge, like the audience
2
+ * tab: the frames are the only light on the screen. Type from the role tokens; colours from the cozy tokens. */
3
+ body.cz.prs-page { margin: 0; min-height: 100vh; background: var(--cz-c-17191c); color: var(--cz-c-eceef1); }
4
+ .prs { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 16px 24px 24px; box-sizing: border-box; gap: 12px; }
5
+ .prs-hd { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
6
+ .prs-title { margin: 0; font-size: var(--fs-page); line-height: var(--lh-page); font-weight: var(--fw-page); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
7
+ .prs-round { flex: none; font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: var(--fw-meta); color: var(--cz-c-9ea4ad); }
8
+ .prs-strip { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 16px; }
9
+ .prs-fr { position: relative; min-width: 0; min-height: 0; border-radius: 16px; overflow: hidden; background: var(--cz-c-ffffff); }
10
+ .prs-fr iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--cz-c-ffffff); }
11
+ .prs-tap { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: transparent; cursor: zoom-in; }
12
+ .prs-tap:focus-visible, .prs-back:focus-visible { outline: 3px solid var(--cz-c-6aaaf0); outline-offset: -3px; }
13
+ .prs-key { position: absolute; left: 12px; bottom: 12px; min-width: 28px; height: 28px; padding: 0 8px; box-sizing: border-box; border-radius: 14px;
14
+ display: inline-flex; align-items: center; justify-content: center; pointer-events: none;
15
+ font-size: var(--fs-label); line-height: var(--lh-label); font-weight: var(--fw-label); background: var(--cz-c-17191c); color: var(--cz-c-eceef1); opacity: .85; }
16
+ .prs-none { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-c-9ea4ad); }
17
+ /* one frame fills the screen: the header goes, the frame takes the whole page */
18
+ .prs:not([data-full=""]) { padding: 0; gap: 0; }
19
+ .prs:not([data-full=""]) .prs-hd { display: none; }
20
+ .prs:not([data-full=""]) .prs-strip { display: block; }
21
+ .prs-fr.full { width: 100%; height: 100%; border-radius: 0; }
22
+ .prs-back { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center;
23
+ background: var(--cz-c-17191c); color: var(--cz-c-eceef1); opacity: .8; cursor: zoom-out; }
24
+ .prs-back:hover { opacity: 1; }
25
+ /* a phone: the frames stack, each tall enough to read, and the page scrolls */
26
+ @media (max-width: 640px) {
27
+ .prs { height: auto; min-height: 100dvh; padding: 12px 16px 16px; }
28
+ .prs-title { font-size: var(--fs-panel); line-height: var(--lh-panel); }
29
+ .prs-strip { grid-template-columns: minmax(0, 1fr); }
30
+ .prs-fr { height: 78dvh; }
31
+ .prs:not([data-full=""]) { height: 100dvh; }
32
+ .prs-fr.full { height: 100dvh; }
33
+ }
@@ -0,0 +1,74 @@
1
+ /* pm/cozy-present.js — present mode (live round W3, initiative live-round-present; premium-present.html at GET /pm/present?ws&board&id).
2
+ *
3
+ * A prototype round on a shared screen: its frames side by side (A, B, C of a first round, or the one file of a later round), the
4
+ * initiative title and the round number. Nothing else: no keep or drop, no History, no nav, no Adler. It reads GET /api/lab/present and
5
+ * loads every frame from GET /api/lab/specimen in a sandboxed frame (allow-scripts only: a specimen cannot reach PMOS).
6
+ *
7
+ * A tap on a frame, or its key (1 to 3, or A to C), fills the screen with that frame. In full screen the frame can be used; the arrow
8
+ * keys move to the next or the earlier frame; Esc or the ⤡ press goes back to all of them. Keys reach the page only while the focus is
9
+ * not inside the frame, so the ⤡ press is always there.
10
+ *
11
+ * keyOf(e, n) → { go: index } | { back: true } | { step: ±1 } | null (pure, the key map)
12
+ * stripHtml(v, full) → html (pure, what the page draws) */
13
+ import { pmGet } from './http.js';
14
+
15
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
16
+ const BACK = '<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7"/></svg>';
17
+
18
+ /** The key map. n: how many frames. Digits 1..n and letters a.. pick a frame; Esc goes back; arrows step (in full screen only). */
19
+ export function keyOf(e, n, full) {
20
+ if (!e || e.metaKey || e.ctrlKey || e.altKey) return null;
21
+ const k = String(e.key || '');
22
+ if (k === 'Escape') return full != null ? { back: true } : null;
23
+ if (/^[1-9]$/.test(k) && +k <= n) return { go: +k - 1 };
24
+ if (/^[a-z]$/i.test(k)) { const i = k.toLowerCase().charCodeAt(0) - 97; if (i < n) return { go: i }; }
25
+ if (full != null && (k === 'ArrowRight' || k === 'ArrowDown')) return { step: 1 };
26
+ if (full != null && (k === 'ArrowLeft' || k === 'ArrowUp')) return { step: -1 };
27
+ return null;
28
+ }
29
+
30
+ /** The frames. full: the index shown full screen, or null for all of them side by side. */
31
+ export function stripHtml(v, full) {
32
+ return v.frames.map((f, i) => {
33
+ const on = full === i, off = full != null && !on;
34
+ const label = (f.key || String(i + 1)) + (f.title ? ', ' + f.title : '');
35
+ return `<section class="prs-fr${on ? ' full' : ''}"${off ? ' hidden' : ''} aria-label="${esc(label)}">`
36
+ + `<iframe src="${esc(f.url)}" sandbox="allow-scripts" title="${esc(label)}" tabindex="${on ? 0 : -1}"></iframe>`
37
+ + (on ? `<button type="button" class="prs-back" data-prs-back aria-label="Back to all frames">${BACK}</button>`
38
+ : `<button type="button" class="prs-tap" data-prs-go="${i}" aria-label="${esc('Fill the screen with ' + label)}"></button>`)
39
+ + (f.key ? `<span class="prs-key" aria-hidden="true">${esc(f.key)}</span>` : '')
40
+ + '</section>';
41
+ }).join('');
42
+ }
43
+
44
+ const S = { v: null, full: null };
45
+ const $ = (id) => document.getElementById(id);
46
+ function draw() {
47
+ const v = S.v, strip = $('prsStrip'); if (!v || !strip) return;
48
+ $('prs').dataset.full = S.full == null ? '' : String(S.full);
49
+ strip.style.setProperty('--n', String(v.frames.length));
50
+ strip.innerHTML = stripHtml(v, S.full);
51
+ const b = strip.querySelector('[data-prs-back]'); if (b) b.focus({ preventScroll: true });
52
+ }
53
+ function go(i) { if (!S.v) return; S.full = i == null ? null : (i + S.v.frames.length) % S.v.frames.length; draw(); }
54
+
55
+ async function boot() {
56
+ const q = new URLSearchParams(location.search);
57
+ const r = await pmGet('/api/lab/present?ws=' + encodeURIComponent(q.get('ws') || '') + '&board=' + encodeURIComponent(q.get('board') || '') + '&id=' + encodeURIComponent(q.get('id') || ''));
58
+ if (!r || r.ok === false || !r.present) { $('prsStrip').innerHTML = `<p class="prs-none">${esc((r && r.error) || 'The prototype could not be read.')}</p>`; return; }
59
+ S.v = r.present;
60
+ $('prsTitle').textContent = S.v.title;
61
+ $('prsRound').textContent = 'Round ' + S.v.round;
62
+ document.title = S.v.title + ' · PMOS';
63
+ draw();
64
+ $('prsStrip').addEventListener('click', (e) => {
65
+ if (e.target.closest('[data-prs-back]')) { go(null); return; }
66
+ const t = e.target.closest('[data-prs-go]'); if (t) go(+t.dataset.prsGo);
67
+ });
68
+ document.addEventListener('keydown', (e) => {
69
+ const a = keyOf(e, S.v.frames.length, S.full); if (!a) return;
70
+ e.preventDefault();
71
+ if (a.back) go(null); else if (a.step) go(S.full + a.step); else go(a.go);
72
+ });
73
+ }
74
+ if (typeof document !== 'undefined' && document.getElementById('prs')) boot();
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
+ <title>Present · PMOS</title>
8
+ <!-- Present mode (live round W3, initiative live-round-present): GET /pm/present?ws&board&id. A prototype round's frames on a shared
9
+ screen, with the initiative title and the round number only. It makes no press: no keep, no drop, no nav. pm/cozy-present.js draws it. -->
10
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
11
+ <link rel="stylesheet" href="/pm/cozy.css" />
12
+ <link rel="stylesheet" href="/pm/cozy-present.css" />
13
+ </head>
14
+ <body class="cz prs-page">
15
+ <main class="prs" id="prs" data-full="">
16
+ <header class="prs-hd"><h1 class="prs-title" id="prsTitle"></h1><span class="prs-round" id="prsRound"></span></header>
17
+ <div class="prs-strip" id="prsStrip" aria-live="polite"></div>
18
+ </main>
19
+ <script type="module" src="/pm/cozy-present.js"></script>
20
+ </body>
21
+ </html>
@@ -165,8 +165,9 @@ const WIDE = new Set([
165
165
  * - server.js: the changed lines (git diff -U0). A comment or blank line reaches nothing. A line inside one route block
166
166
  * of handleRequest (an `if (p === '/api/…')` statement up to the next statement at its indent) reaches that route. A
167
167
  * line inside a top-level function reaches whatever uses that function, followed by name to the route blocks and the
168
- * functions that use it. Anything else (top-level setup, middleware between route blocks, a page route, a name used
169
- * outside any function or route block) reaches every suite.
168
+ * functions that use it. The one-line page map (`const PAGES = { … }`) reaches the suites that name an entry the diff
169
+ * adds, drops or repoints, by its path or its page file. Anything else (top-level setup, middleware between route blocks,
170
+ * a page route, a name used outside any function or route block) reaches every suite.
170
171
  * - lib/routes-<x>.js (a route module that lib/route-modules.js loads): every '/api/…' route the file names under the
171
172
  * prefixes it declares (a route it only calls through ctx is left out). With no prefixes it can read: every route it names.
172
173
  * - 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.
@@ -404,6 +405,10 @@ function traceChanges(changes, ctx) {
404
405
  if (raw === undefined || !raw.trim()) continue; // a comment or a blank line reaches nothing
405
406
  const b = blockAt(n);
406
407
  if (b) { const w = routes(b.keys, `server.js:${n}`); if (w) return w; continue; }
408
+ // the page map (`const PAGES = { '/path': 'page.html', … }`, one line): a change to it reaches only the suites that name an entry
409
+ // it adds, drops or points elsewhere, by its path or its page file (live round W3: adding /pm/present reached all 511 suites)
410
+ const pm = pagesChanged(raw);
411
+ if (pm) { for (const x of pm) for (const sfile of list) if ((get(sfile) || '').includes(x)) picked.add(sfile); continue; }
407
412
  const own = fnAt(n);
408
413
  if (own && own.name !== 'handleRequest' && optionOnly(own, lines)) continue;
409
414
  if (own && own.name !== 'handleRequest') { const w = useOf(own.name); if (w) return `${own.name} (server.js:${n}) is used by ${w}`; continue; }
@@ -419,6 +424,20 @@ function traceChanges(changes, ctx) {
419
424
  }
420
425
  return null;
421
426
  };
427
+ // The entries a changed PAGES line adds, drops or repoints, as their paths and page files; null when the line is not that map, or the
428
+ // old map is not one line the diff removed (then the line stays wide).
429
+ const serverOld = ((changes.find((c) => c.file === 'server.js') || {}).old) || null;
430
+ const pagesChanged = (raw) => {
431
+ const isMap = (t) => /^\s*const PAGES = \{.*\};\s*$/.test(t);
432
+ if (!isMap(raw) || !serverOld) return null;
433
+ const was = serverOld.filter(isMap);
434
+ if (was.length !== 1) return null;
435
+ const mapOf = (t) => new Map([...t.matchAll(/'(\/[^']*)'\s*:\s*'([^']+)'/g)].map((m) => [m[1], m[2]]));
436
+ const a = mapOf(was[0]), b = mapOf(raw), out = new Set();
437
+ for (const [k, v] of b) if (a.get(k) !== v) { out.add(k); out.add(v); if (a.has(k)) out.add(a.get(k)); }
438
+ for (const [k, v] of a) if (!b.has(k)) { out.add(k); out.add(v); }
439
+ return out;
440
+ };
422
441
  // A line inside a top-level statement that builds one lib module (`const x = require('./lib/m.js').create({ ... })`): the module's file.
423
442
  const wiringOf = (n) => {
424
443
  const { C } = parseServer();
@@ -700,7 +719,7 @@ function changedSuites(list, ref, { exact = false } = {}) {
700
719
  const changes = files.map((file) => {
701
720
  if (file !== 'server.js' && file !== 'lib/route-modules.js' && !/^lib\/[^/]+\.js$/.test(file)) return { file };
702
721
  const d = git('diff', '-U0', base, '--', path.join(DIR, file));
703
- return { file, lines: d == null ? null : diffLines(d) };
722
+ return { file, lines: d == null ? null : diffLines(d), ...(file === 'server.js' && d != null ? { old: oldLines(d) } : {}) };
704
723
  });
705
724
  const read = (f) => { try { return fs.readFileSync(path.join(DIR, f), 'utf8'); } catch { return null; } };
706
725
  const browser = new Set([...FILES.panels, ...FILES.ui]);
@@ -728,6 +747,11 @@ function changedDeps(diff, changed) {
728
747
  return names.length ? [...new Set(names)] : null;
729
748
  }
730
749
 
750
+ /* The old-side text of the lines a `git diff -U0` removes or changes (without the leading '-'). */
751
+ function oldLines(diff) {
752
+ return String(diff).split('\n').filter((l) => /^-/.test(l) && !/^---/.test(l)).map((l) => l.slice(1));
753
+ }
754
+
731
755
  /* The new-side line numbers a `git diff -U0` touches. A pure removal counts the lines on both sides of where it was. */
732
756
  function diffLines(diff) {
733
757
  const out = [];
@@ -7211,7 +7211,7 @@ async function handleRequest(req, res) {
7211
7211
  res.writeHead(302, { Location: '/premium.html?onboard=1', 'Cache-Control': 'no-store' });
7212
7212
  return res.end();
7213
7213
  }
7214
- const PAGES = { '/': 'premium.html', '/index.html': 'premium.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-welcome': 'premium-welcome.html', '/premium-welcome.html': 'premium-welcome.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html' };
7214
+ const PAGES = { '/': 'premium.html', '/index.html': 'premium.html', '/premium': 'premium.html', '/premium.html': 'premium.html', '/premium-board': 'premium-board.html', '/premium-board.html': 'premium-board.html', '/premium-intelligence': 'premium-intelligence.html', '/premium-intelligence.html': 'premium-intelligence.html', '/premium-insights': 'premium-intelligence.html', '/premium-insights.html': 'premium-intelligence.html', '/premium-welcome': 'premium-welcome.html', '/premium-welcome.html': 'premium-welcome.html', '/premium-viewer': 'premium-viewer.html', '/premium-viewer.html': 'premium-viewer.html', '/premium-rec': 'premium-rec.html', '/premium-rec.html': 'premium-rec.html', '/premium-workflows': 'premium-workflows.html', '/premium-workflows.html': 'premium-workflows.html', '/pm/present': 'premium-present.html' };
7215
7215
  const page = capture ? 'capture.html' : Object.prototype.hasOwnProperty.call(PAGES, p) ? PAGES[p] : null;
7216
7216
  if (page) {
7217
7217
  // pm-os-absorb Run 2 (R25, X11): the per-launch nonce goes into the base meta line, nowhere else. no-store, so a
@@ -0,0 +1,7 @@
1
+ {
2
+ "_comment": "Live round W3, initiative live-round-present: present mode. lib/lab-present.js presentOf, GET /api/lab/present, the /pm/present page (premium-present.html, pm/cozy-present.js) and the compare view's present press. Backend and source reads only.",
3
+ "modules": [
4
+ "idle-lab-present.test.js"
5
+ ],
6
+ "seconds": { "idle-lab-present.test.js": 1 }
7
+ }