create-pmos 0.303.0 → 0.305.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.303.0",
3
+ "version": "0.305.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": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@2c3014c
1
+ kernel-source: pmos@63f4202
2
2
  assembled: 2026-10-19
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-10-19T07:23:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T08:44:50Z"}
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-10-19T07:23:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T08:44:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -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-10-19T07:23:01Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T08:44:50Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -8,8 +8,9 @@
8
8
  * fresh the freshness line is one dot beside the date; pressing it shows the full line
9
9
  * more Backlog, Releases, Docs and Sprints show only after More; each still opens
10
10
  * calendar one Layers button shows and hides the layer chips
11
+ * scroll after a scroll the page tabs and the tools stay at the top of the window
11
12
  * reports no deck is drawn
12
- * phone at 400 wide on the desktop layout (lib/c3-full-console.js), nothing changes: the title shows and no dot is drawn (c3-phone-test.js tests the companion)
13
+ * phone at 400 wide on the desktop layout (lib/c3-full-console.js), nothing changes: the title shows, and no dot and no pinned bar is drawn (c3-phone-test.js tests the companion)
13
14
  * No script error may be raised.
14
15
  */
15
16
  const path = require('path');
@@ -127,6 +128,17 @@ const shown = (s) => { const n = document.querySelector(s); return !!n && getCom
127
128
  }
128
129
  await page.context().close();
129
130
 
131
+ /* ── the top bar stays put as the page scrolls, demo Briefing (a long page) ── */
132
+ page = await open(1280, '/console.html?demo=1&tab=brief');
133
+ await waitFor(page, () => !!document.querySelector('.qt-bar') && document.documentElement.scrollHeight > innerHeight + 200);
134
+ const navTop = () => page.evaluate(() => Math.round(document.querySelector('nav.c3tabs').getBoundingClientRect().top));
135
+ const before = await navTop();
136
+ await page.mouse.wheel(0, 600);
137
+ await waitFor(page, () => scrollY > 200, null, 5000);
138
+ const pinned = await page.evaluate(() => ({ y: Math.round(scrollY), nav: Math.round(document.querySelector('nav.c3tabs').getBoundingClientRect().top), tools: Math.round(document.querySelector('.c3top').getBoundingClientRect().bottom) }));
139
+ ok('S1 after a scroll the page tabs and the tools stay at the top of the window', pinned.y > 200 && pinned.nav >= 0 && pinned.nav <= Math.max(before, 0) && pinned.tools > 0, JSON.stringify({ before, ...pinned }));
140
+ await page.context().close();
141
+
130
142
  /* ── Reports, demo mode ── */
131
143
  page = await open(1280, '/console.html?demo=1&tab=rep');
132
144
  await waitFor(page, () => !!document.querySelector('[data-rp3]'));
@@ -136,8 +148,8 @@ const shown = (s) => { const n = document.querySelector(s); return !!n && getCom
136
148
  /* ── phone: unchanged ── */
137
149
  page = await open(400, '/console.html?tab=init');
138
150
  await page.waitForTimeout(400);
139
- const ph = await page.evaluate((shownSrc) => { const vis = new Function('s', 'return (' + shownSrc + ')(s)'); return { title: vis('.c3top h1'), dot: !!document.querySelector('[data-c3pg="fresh-dot"]') }; }, shown.toString());
140
- ok('P1 at 400 wide the page keeps today\'s layout: the title shows and no dot is drawn', ph.title && !ph.dot, JSON.stringify(ph));
151
+ const ph = await page.evaluate((shownSrc) => { const vis = new Function('s', 'return (' + shownSrc + ')(s)'); return { title: vis('.c3top h1'), dot: !!document.querySelector('[data-c3pg="fresh-dot"]'), bar: !!document.querySelector('.qt-bar') }; }, shown.toString());
152
+ ok('P1 at 400 wide the page keeps today\'s layout: the title shows, no dot and no pinned bar is drawn', ph.title && !ph.dot && !ph.bar, JSON.stringify(ph));
141
153
  await page.context().close();
142
154
 
143
155
  ok('E1 no script error', errors.length === 0, errors.join(' | '));
@@ -269,6 +269,7 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
269
269
  - **Shape a report's sections.** On a report drawn from your work, **Shape it in the Studio** opens Report mode on it. Tell PMOS how to shape the sections in your own words; PMOS proposes the next version and says what it changed. **Leave out** on a section makes the next version without it; the headline, Needs your call and Sources are always in. **Undo** goes back one version. **Use this structure** saves the version shown, and the next cycle follows it.
270
270
  - **Design how a report looks.** A set-up report in the Studio has two tabs: **1 Structure** (what it says) and **2 Design** (how it looks). The Design tab shows the versions D1 to Dn, the slides of the one shown (a large preview, previous and next, and thumbnails), and the samples the look follows. **Add a file** (PDF, PowerPoint, Word or an image) or **Add the link** (Google or Confluence) adds a sample, and PMOS says what it took from it. Say how it should look, for example "use the theme of my picture", and PMOS makes the next version. Pick a version to look at it. **Undo** goes back one version. **This is it** saves the version shown as the design, and each new cycle is drawn to it. When you open a report again, both tabs show what was said before.
271
271
  - **Choose a deck or a document, and read the design brief.** On the Design tab, the **Format** chip offers **Deck** and **Document** for the next version. Versions you already made keep their form. Once a design is saved, a **Design brief** chip shows what PMOS reads each cycle: your description, your samples, the reference version, and what stays the same, what changes and what PMOS learned. The cycles drafted to match it are checked on the report itself.
272
+ - **Point, make the next version, compare.** On the Design tab, click any part of a slide to attach a request to that spot: a numbered pin appears, and you type the request under the preview (**Point and say**; the switch turns pointing off). **Make the next version** sends the typed line and every pinned request to PMOS, which makes the next version; the pins are cleared once it starts. **Compare two** shows the same slide of two versions side by side; pick the version on each side.
272
273
  - **What stands out.** Up to three plain sentences taken from the series: behind its line for three readings in a row, behind and still moving away from the target, closing in, slipped, reached its target, or a large one-step move. There is no forecast and no cause.
273
274
  - **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
274
275
  - **Ask PMOS to set up a report.** Type what the report is for and press **Ask**. A background run proposes a report and does nothing else. The request is listed as Working, then Ready to review. A ready request opens with its proposal: **Set it up**, **Change it** (say what to change; the run revises it), or **Cancel**.
@@ -154,4 +154,6 @@ An item has its actions in one place only. On the Briefing, Today and Portfolio
154
154
 
155
155
  At 400 pixels wide the Briefing is one column (greeting, The brief, cards, Needs you, Mentions, Today, Portfolio pulse) with no sideways scroll. Each button in an opened row is 44 pixels high.
156
156
 
157
+ On a screen wider than 600 pixels, the top bar stays at the top of the window when you scroll a page. The top bar holds the five tabs, the date and the tool buttons. Cards that also stay in place as you scroll, such as the right column, stop under the top bar.
158
+
157
159
  On a phone, every console page has the same top. The page title has Record at its right. The sunrise line is under it, then the tool buttons in one row. The five tabs share the width, and each tab shows an icon over its name, so Initiatives and Reports are always on screen. A count shows at the top right of its tab's icon. A person in a row shows as a small round letter, and you can tap anywhere in the 44-pixel square around it. A line that has a sentence and a due date wraps like normal text.
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+ /* orchestrator-spawn.js — puts the scheduled background jobs under the orchestrator gate (initiative agent-orchestrator, PRD "Capacity
3
+ * governor" and "Gates that stay yours").
4
+ *
5
+ * wrap({ gate, spawn, driverRunning }) → { spawn(spec), running() }
6
+ *
7
+ * `spawn(spec)` is used ONLY by the schedule ticks (the core documents, the weekly report finder). A run the PM starts by a press uses the
8
+ * plain spawn and is never counted or held. Before it starts a run the wrapper asks gate.mayStart. A held start returns an exited session
9
+ * row with a note, which the callers already read as "could not start"; they try again on their next tick, so nothing is lost or refused.
10
+ * A run that started is counted toward the day's cap (gate.granted). The count of running runs adds the Driver's runs to the runs
11
+ * started here that have not ended, so the cap covers all orchestrator work together. */
12
+ function wrap({ gate, spawn, driverRunning = () => 0 }) {
13
+ const live = new Set();
14
+ const prune = () => { for (const s of [...live]) if (!s || s.state === 'exited') live.delete(s); };
15
+ const running = () => { prune(); return live.size + (Number(driverRunning()) || 0); };
16
+ function held(reason) { return { id: null, state: 'exited', headless: null, note: `held by the capacity governor: ${reason}` }; }
17
+ return {
18
+ running,
19
+ spawn(spec) {
20
+ let g = { allowed: true };
21
+ try { g = gate.mayStart({ running: running() }) || g; } catch { /* a broken gate must not stop the PM's schedules */ }
22
+ if (!g.allowed) return held(g.reason || 'it is not time to start more runs');
23
+ const s = spawn(spec);
24
+ if (s && s.state !== 'exited') { live.add(s); try { gate.granted(); } catch { /* a counter */ } }
25
+ return s;
26
+ },
27
+ };
28
+ }
29
+ module.exports = { wrap };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.303.0",
3
+ "version": "0.305.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.303.0",
9
+ "version": "0.305.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.303.0",
3
+ "version": "0.305.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",
@@ -84,7 +84,8 @@ const model = async () => (await (await fetch(BASE + '/api/insights-premium')).j
84
84
 
85
85
  const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } }), p = await ctx.newPage(), errs = [], posts = [];
86
86
  p.on('pageerror', (e) => errs.push(String(e)));
87
- p.on('request', (r) => { if (r.method() === 'POST') posts.push(new URL(r.url()).pathname); });
87
+ const turnBodies = [];
88
+ p.on('request', (r) => { if (r.method() === 'POST') { posts.push(new URL(r.url()).pathname); if (/report-design\/turn$/.test(r.url())) turnBodies.push(r.postData() || ''); } });
88
89
  await p.goto(BASE + '/premium-insights.html');
89
90
  await until(() => p.evaluate(() => !!document.querySelector('#repNew')));
90
91
  const M0 = await model(), bname = M0.board.name;
@@ -214,6 +215,7 @@ const model = async () => (await (await fetch(BASE + '/api/insights-premium')).j
214
215
  await tap('#oMain [data-st="save"]');
215
216
  await until(() => chipv('dsv').then((v) => v === 'D1, saved'));
216
217
  ok('D5 This is it saves D1 as the design, and is then not offered', await chipv('dsv') === 'D1, saved' && await cta() === 'This is it:off' && posts.includes('/api/report-design/accept'), await chipv('dsv'));
218
+ await until(() => p.evaluate(() => { const b = document.querySelector('#stPv [data-st="dznext"]'); return !!b && !b.disabled; }), 30000); // the cycle redraw after This is it has finished
217
219
  ok('B3 the Design brief chip appears once a design is saved, and not before', await chipv('dbr') === 'D1');
218
220
  await tap('#oMain [data-st="chip|dbr"]'); await sleep(150);
219
221
  const brTxt = await p.evaluate(() => (document.querySelector('#stTr') || {}).textContent || '');
@@ -221,6 +223,20 @@ const model = async () => (await (await fetch(BASE + '/api/insights-premium')).j
221
223
  const nDesc = posts.filter((x) => x === '/api/report-design/describe').length;
222
224
  await tap('#oMain [data-st="chip|dfmt"]'); await sleep(100); await tap('#stTr [data-st="dzfmt|doc"]'); await sleep(600);
223
225
  ok('F7 with a description saved, choosing Document posts it with the format', posts.filter((x) => x === '/api/report-design/describe').length === nDesc + 1 && await chipv('dfmt') === 'Document', posts.join());
226
+ /* D7 to D9: point and say, make the next version, compare two */
227
+ await until(() => p.evaluate(() => { const b = document.querySelector('#stPv [data-st="dznext"]'); return !!b && !b.disabled; }), 30000);
228
+ await p.click('#dzSlide', { position: { x: 200, y: 100 } });
229
+ await until(() => p.evaluate(() => document.querySelectorAll('#stPv .dzpin').length === 1));
230
+ await p.fill('#stPv [data-dzp="1"]', 'Make this bigger');
231
+ ok('D7 a click on the slide attaches a request, typed under the preview', await p.evaluate(() => document.querySelectorAll('#stPv .dzsay li').length === 1 && document.querySelector('#stPv [data-dzp="1"]').value === 'Make this bigger'));
232
+ await tap('#stPv [data-st="dznext"]');
233
+ await until(() => dver().then((v) => /D2\*/.test(v)), 60000);
234
+ const tb = turnBodies[turnBodies.length - 1] || '';
235
+ ok('D8 Make the next version makes D2 and sends the pointed request with its slide, x and y', /D2\*/.test(await dver()) && /"points":\[\{"n":1,"slide":"[a-z]+","x":[0-9.]+,"y":[0-9.]+,"text":"Make this bigger"\}\]/.test(tb), (await dver()) + ' ' + tb);
236
+ await tap('#stPv [data-st="dzcmp"]'); await sleep(500);
237
+ ok('D9 Compare two shows the same slide of two versions side by side', await p.evaluate(() => document.querySelectorAll('#stPv .dzcc').length === 2 && document.querySelectorAll('#stPv .dzcc .rdbig').length === 2));
238
+ await tap('#stPv [data-st="dzcmp"]'); await sleep(200);
239
+ await tap('#oMain [data-st="save"]'); await until(() => chipv('dsv').then((v) => v === 'D2, saved'));
224
240
  await shot('report-design-1280');
225
241
  await p.click('#oMain [data-st="rtab|structure"]');
226
242
  await until(() => chipv('ver').then((v) => /^S/.test(v)));
@@ -2,7 +2,9 @@
2
2
  * At most two rows sit above a page's content: row one is the page tabs with the date, the freshness dot and the tools on the
3
3
  * right; row two is the page's own context (breadcrumb, status, sub-tabs, actions). Teaching sentences, empty cards and extra
4
4
  * chips are not drawn; decks show on Briefing only. Everything is scoped under .c3 and uses tokens only. */
5
- /* Phone widths keep today's layout: the phone gets its own companion design (Wawan, 2026-10-12), so every rule here is for 601px and up. */
5
+ /* Phone widths keep today's layout: the phone gets its own companion design (Wawan, 2026-10-12), so every rule below is for 601px and up. */
6
+ /* Below 601px the bar wrapper draws nothing, so the phone layout is the same as before. */
7
+ .c3 .qt-bar{display:contents}
6
8
  @media (min-width:601px){
7
9
  /* 1. Header: one row. Title and date left, a short tool set right. */
8
10
  .c3 .c3top{display:flex !important;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:nowrap}
@@ -102,4 +104,10 @@
102
104
  .c3 [data-ini-view="board"] > .calbody{padding-top:4px}
103
105
  .c3.qt-stack .c3top{position:static;justify-content:flex-end !important;min-height:0}
104
106
  .c3.qt-stack nav.c3tabs{padding-right:0}
107
+ /* The top bar (page tabs, date and tools) stays at the top of the window while the page scrolls.
108
+ * Cards that already stay put as the page scrolls (a right column, the Settings sections, a Work item's detail) stop under it. */
109
+ .c3 .qt-bar{display:block;position:sticky;top:0;z-index:10;background:var(--background)}
110
+ .c3.qt-stack .qt-bar{display:grid;gap:14px}
111
+ .c3 .bcol.r,.c3 .c3set .st-nav{top:calc(var(--in-qt-bar, 0px) + 12px)}
112
+ .c3 .td-day__detail{top:calc(var(--in-qt-bar, 0px) + 8px);max-height:calc(100vh - var(--in-qt-bar, 0px) - 16px)}
105
113
  }
@@ -2,6 +2,7 @@
2
2
  * version 2, linked from the initiative record).
3
3
  *
4
4
  * mountQuiet(root) links c3-quiet.css once and keeps the page in its quiet layout as the views draw:
5
+ * - the page tabs and the tools stay at the top of the window while the page scrolls;
5
6
  * - the freshness line folds into one dot next to the date ("4 sources not read"); pressing the dot shows the full line;
6
7
  * - a board: its status joins the breadcrumb, the board tabs join that row, Backlog, Releases, Docs and Sprints go
7
8
  * behind More (a menu; the open one shows beside the five, c3-board-declutter), Dashboard and the all-zero Work items card are not shown;
@@ -51,8 +52,16 @@ function header(root) {
51
52
  dot.classList.toggle('ok', !bad);
52
53
  if (dot.title !== words) { dot.title = words; dot.setAttribute('aria-label', words + '. Show when each source was read'); }
53
54
  }
54
- // The tools sit on the tab row when both fit; when they do not (a narrow window, the demo banner), they take their own row.
55
+ // The page tabs and the tools share one bar that stays at the top of the window while the page scrolls.
56
+ // Its height is kept on the root, so cards that also stay put as the page scrolls stop under it.
55
57
  const nav = root.querySelector('nav.c3tabs');
58
+ if (nav && !root.querySelector('.qt-bar') && nav.parentElement === top.parentElement) {
59
+ const bar = mk('div', 'qt-bar'); bar.setAttribute('data-c3pg', 'top-bar');
60
+ top.before(bar); bar.append(top, nav);
61
+ const keep = () => root.style.setProperty('--in-qt-bar', bar.offsetHeight + 'px');
62
+ keep(); new ResizeObserver(keep).observe(bar);
63
+ }
64
+ // The tools sit on the tab row when both fit; when they do not (a narrow window, the demo banner), they take their own row.
56
65
  const w = Math.ceil(top.getBoundingClientRect().width);
57
66
  if (nav && w) {
58
67
  const tabs = [...nav.querySelectorAll('[role="tab"]')];
@@ -109,6 +118,15 @@ function portfolio(v) {
109
118
  /* Phone widths keep today's layout (the phone gets its own companion design), so nothing moves below 601px. */
110
119
  const wide = () => typeof matchMedia !== 'function' || matchMedia('(min-width: 601px)').matches;
111
120
 
121
+ /* Work: the lenses beside Add work. A redraw draws the lenses again in their own bar, so the old copy beside Add work goes first:
122
+ * this runs straight from the observer as well, so the page never holds two lens rows at once. */
123
+ function work(root) {
124
+ for (const w of root.querySelectorAll('.wk')) {
125
+ const add = w.querySelector(':scope > .c3add'), bar = w.querySelector(':scope > .calbar'), l = bar && bar.querySelector('[data-pm-lenses]');
126
+ if (add && l && l.parentElement === bar) { for (const o of add.querySelectorAll('[data-pm-lenses]')) o.remove(); add.appendChild(l); bar.classList.add('qt-moved'); }
127
+ }
128
+ }
129
+
112
130
  function apply(root) {
113
131
  if (!wide()) return;
114
132
  header(root);
@@ -138,11 +156,7 @@ function apply(root) {
138
156
  }
139
157
  // Calendar: the Detail card shows once a meeting or a marker is picked (not its "Select a meeting" note).
140
158
  for (const d of root.querySelectorAll('[data-cal3="detail"]')) d.classList.toggle('qt-hide', /^Select a meeting to see/.test((d.querySelector('.cal3-note') || {}).textContent || '') && !d.querySelector('button, a'));
141
- // Work: the lenses beside Add work.
142
- for (const w of root.querySelectorAll('.wk')) {
143
- const add = w.querySelector(':scope > .c3add'), bar = w.querySelector(':scope > .calbar'), l = bar && bar.querySelector('[data-pm-lenses]');
144
- if (add && l && l.parentElement === bar) { for (const o of add.querySelectorAll('[data-pm-lenses]')) o.remove(); add.appendChild(l); bar.classList.add('qt-moved'); }
145
- }
159
+ work(root);
146
160
  // Reports: Send this as a report and Edit dashboard on the tab row.
147
161
  for (const r of root.querySelectorAll('[data-rp3]')) {
148
162
  const scope = r.querySelector(':scope > .calbar .rp3-scope'), acts = r.querySelector('.rp3-head > .chips2');
@@ -158,6 +172,6 @@ export function mountQuiet(root) {
158
172
  let t = null;
159
173
  const run = () => { t = null; try { apply(root); } catch { /* a view mid-draw; the next mutation runs it again */ } };
160
174
  run();
161
- new MutationObserver(() => { if (!t) t = setTimeout(run, 50); }).observe(root, { subtree: true, childList: true });
175
+ new MutationObserver(() => { if (wide()) { try { work(root); } catch { /* the next run moves it */ } } if (!t) t = setTimeout(run, 50); }).observe(root, { subtree: true, childList: true });
162
176
  if (typeof matchMedia === 'function') matchMedia('(min-width: 601px)').addEventListener('change', () => { if (!t) t = setTimeout(run, 50); });
163
177
  }
@@ -22,12 +22,13 @@ export function useStudio(x) { X = x; }
22
22
  const hand = () => X.P.design;
23
23
 
24
24
  /* ── the state of one report's design, kept on its draft: d.D = { design, err, loading, shown, ver: Map, i } ── */
25
- export function fresh() { return { fmt: null, design: null, err: '', loading: false, shown: null, ver: new Map(), i: 0, working: false, link: '' }; }
25
+ export function fresh() { return { fmt: null, design: null, err: '', loading: false, shown: null, ver: new Map(), i: 0, working: false, link: '', points: [], point: true, cmp: false, cmpB: null }; }
26
26
  const FMTN = { deck: 'Deck', doc: 'Document' };
27
27
  const fmtOf = (z) => z.fmt || (z.design && z.design.format) || 'deck';
28
28
  const saved = (z) => (z.design && z.design.saved ? z.design.saved.version : null);
29
29
  const versions = (z) => (z.design && z.design.versions) || [];
30
- const slidesOf = (z) => { const r = z.ver.get(z.shown); return r ? r.slides.map((s) => ({ k: 'frame', h: s.h, html: s.html, css: r.style })) : []; };
30
+ const slidesAt = (z, n) => { const r = z.ver.get(n); return r ? r.slides.map((s) => ({ k: 'frame', h: s.h, id: ((/data-slide-id="([^"]*)"/.exec(s.html) || [])[1]) || '', html: s.html, css: r.style })) : []; };
31
+ const slidesOf = (z) => slidesAt(z, z.shown);
31
32
 
32
33
  export async function load(d) {
33
34
  const z = d.Z; z.loading = true;
@@ -112,13 +113,29 @@ export function preview(d) {
112
113
  if (!v.length) return `<div class="stpvw"><p class="note">${z.working ? 'PMOS is making the first version.' : 'No version yet. Add a sample, or say how the report should look. PMOS makes D1.'}</p></div>`;
113
114
  const L = slidesOf(z), i = z.i = Math.max(0, Math.min(z.i, L.length - 1));
114
115
  const strip = `<span class="rdv" role="group" aria-label="Design versions">${v.map((x) => `<button type="button" data-st="dzver|${x.n}" aria-pressed="${x.n === z.shown}"${z.working ? ' disabled' : ''} title="${esc((x.n === n ? 'Saved. ' : '') + (x.turn || ''))}" aria-label="D${x.n}${x.n === n ? ', saved' : ''}">D${x.n}${x.n === n ? CHK : ''}</button>`).join('')}</span>`;
115
- const big = L.length ? `<div class="rdk"><div class="rdbig" id="dzSlide" tabindex="0" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(L[i].h)}">${slideCard(L[i])}</div>`
116
- + `<div class="rdnv"><button type="button" data-st="dzgo|${i - 1}" aria-label="Previous slide"${i === 0 ? ' disabled' : ''}>${PREV}</button><span>${i + 1} / ${L.length}</span><button type="button" data-st="dzgo|${i + 1}" aria-label="Next slide"${i === L.length - 1 ? ' disabled' : ''}>${NEXT}</button></div>`
116
+ const tools = `<span class="dzact"><button type="button" class="dmcta alt" data-st="dzcmp" aria-pressed="${z.cmp}"${v.length < 2 ? ' disabled' : ''}>Compare two</button><button type="button" class="dmcta" data-st="dznext"${z.working ? ' disabled' : ''}>Make the next version</button></span>`;
117
+ const note = `<span class="note">${z.working ? 'PMOS is working on the next version.' : z.shown === n ? 'The saved design.' : 'Not saved. Press This is it to keep it.'}</span>`;
118
+ const nav = (len) => `<div class="rdnv"><button type="button" data-st="dzgo|${i - 1}" aria-label="Previous slide"${i === 0 ? ' disabled' : ''}>${PREV}</button><span>${i + 1} / ${len}</span><button type="button" data-st="dzgo|${i + 1}" aria-label="Next slide"${i >= len - 1 ? ' disabled' : ''}>${NEXT}</button></div>`;
119
+ if (z.cmp) return `<div class="stpvw dzpv"><div class="dzbar">${strip}${tools}${note}</div>${compare(z, i, nav)}</div>`;
120
+ const pins = z.points.filter((q) => L[i] && q.slide === L[i].id).map((q) => `<span class="dzpin" data-x="${q.x}" data-y="${q.y}" aria-hidden="true">${q.n}</span>`).join('');
121
+ const big = L.length ? `<div class="rdk"><div class="rdbig dzbig" id="dzSlide" tabindex="0" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(L[i].h)}.${z.point ? ' Click a part of it to attach a request.' : ''}">${slideCard(L[i])}${pins}</div>${nav(L.length)}`
117
122
  + `<div class="rdt dzth" role="group" aria-label="Slides">${L.map((x, j) => `<button type="button" data-st="dzgo|${j}"${j === i ? ' aria-current="true"' : ''} aria-label="Slide ${j + 1}: ${esc(x.h)}">${slideCard(x, true)}<i>${j + 1}</i></button>`).join('')}</div></div>`
118
123
  : '<p class="note">This version is not drawn as slides. It is a page.</p>';
119
- return `<div class="stpvw dzpv"><div class="dzbar">${strip}<span class="note">${z.working ? 'PMOS is working on the next version.' : z.shown === n ? 'The saved design.' : 'Not saved. Press This is it to keep it.'}</span></div>${big}</div>`;
124
+ const say = `<div class="dzsay"><div class="dzsh"><span class="label">Point and say <b>${z.points.length}</b></span><label class="dzon"><input type="checkbox" id="dzPoint"${z.point ? ' checked' : ''}> On</label></div>`
125
+ + (z.points.length ? `<ul class="sul">${z.points.map((q) => `<li><span class="dzpn">${q.n}</span><input class="sti" data-dzp="${q.n}" value="${esc(q.text)}" placeholder="What should change here? Slide ${esc(q.slide)}" maxlength="1000" aria-label="Request ${q.n}, on slide ${esc(q.slide)}" autocomplete="off"><button type="button" class="lk" data-st="dzpx|${q.n}" aria-label="Remove request ${q.n}">Remove</button></li>`).join('')}</ul><p class="note">The next version carries these. Make the next version, or say it in the chat.</p>` : `<p class="note">${z.point ? 'Click any part of the preview to attach a request to it.' : 'Pointing is off.'}</p>`) + '</div>';
126
+ return `<div class="stpvw dzpv"><div class="dzbar">${strip}${tools}${note}</div>${big}${L.length ? say : ''}</div>`;
120
127
  }
121
- export function afterDraw() { const m = $('#stPv'); if (m) fit(m); }
128
+ /* Compare two: the same slide of two versions side by side */
129
+ function compare(z, i, nav) {
130
+ const v = versions(z);
131
+ const B = z.cmpB != null && v.some((x) => x.n === z.cmpB) ? z.cmpB : ((v.filter((x) => x.n !== z.shown).pop() || {}).n);
132
+ z.cmpB = B;
133
+ const A = slidesOf(z), Bs = slidesAt(z, B), len = Math.max(A.length, Bs.length);
134
+ const pick = (k, cur) => `<span class="rdv" role="group" aria-label="${k === 'dzcl' ? 'Left' : 'Right'} version">${v.map((x) => `<button type="button" data-st="${k}|${x.n}" aria-pressed="${x.n === cur}">D${x.n}</button>`).join('')}</span>`;
135
+ const cell = (L, n, k) => `<div class="dzcc"><div class="dzch">${pick(k, n)}</div>${L[i] ? `<div class="rdbig" role="group" aria-label="D${n}, slide ${i + 1}: ${esc(L[i].h)}">${slideCard(L[i])}</div>` : `<p class="note">D${n} has no slide ${i + 1}.</p>`}</div>`;
136
+ return `<div class="dzcmp"><div class="dzcg">${cell(A, z.shown, 'dzcl')}${cell(Bs, B, 'dzcr')}</div>${nav(len)}<p class="note">Left is the version shown. Press Compare two again to go back to one.</p></div>`;
137
+ }
138
+ export function afterDraw() { const m = $('#stPv'); if (!m) return; fit(m); m.querySelectorAll('.dzpin').forEach((p) => { p.style.setProperty('--rp-pinx', p.dataset.x + '%'); p.style.setProperty('--rp-piny', p.dataset.y + '%'); }); }
122
139
  export function checks(d) {
123
140
  const z = d.Z, S = (z.design || {}).samples || [], n = saved(z), v = versions(z);
124
141
  return [
@@ -139,6 +156,11 @@ export async function press(d, a) {
139
156
  const [k, v] = a, z = d.Z;
140
157
  if (k === 'dzgo') { z.i = +v; X.draw(['pv']); afterDraw(); const s = $('#dzSlide'); if (s) s.focus(); return; }
141
158
  if (k === 'dzver') { await show(d, +v, true); return; }
159
+ if (k === 'dzcmp') { z.cmp = !z.cmp; if (z.cmp) { const V = versions(z).filter((x) => x.n !== z.shown); z.cmpB = (V.pop() || {}).n; await read(z, z.cmpB); } X.draw(['pv']); afterDraw(); return; }
160
+ if (k === 'dzcl') { z.shown = +v; await read(z, z.shown); X.draw(); afterDraw(); return; }
161
+ if (k === 'dzcr') { z.cmpB = +v; await read(z, z.cmpB); X.draw(['pv']); afterDraw(); return; }
162
+ if (k === 'dzpx') { z.points = z.points.filter((q) => q.n !== +v); X.draw(['pv']); afterDraw(); return; }
163
+ if (k === 'dznext') { const i = $('#stIn'), t = i ? i.value.trim() : ''; X.converse(t || (z.points.length ? 'Make the next version with the requests I pointed at.' : 'Make the next version.')); return; }
142
164
  if (k === 'dzfmt') { await setFmt(d, v); return; }
143
165
  if (k === 'dzkeep') { await keep(d); return; }
144
166
  if (k === 'dzpick') { const f = $('#dzFile'); if (f) f.click(); return; }
@@ -178,6 +200,18 @@ export async function keep(d) {
178
200
  if (!r || r.ok !== true) { s.msg = (r && r.error) || 'The design could not be saved.'; X.draw(); return; }
179
201
  z.design = r.design; s.msg = 'D' + n + ' is saved as the design. ' + (r.redraw && r.redraw.started ? 'PMOS is drawing the current cycle to match it.' : 'Each new cycle is drawn to match it.');
180
202
  X.draw(); afterDraw(); X.P.reportsChanged();
203
+ // the cycle is redrawn to the saved design by the one design job of this report; a turn waits for it
204
+ if (r.redraw && r.redraw.started) {
205
+ z.working = true; X.draw();
206
+ const t0 = Date.now();
207
+ for (;;) {
208
+ await new Promise((ok) => setTimeout(ok, POLL_MS));
209
+ if (X.r() !== d) return;
210
+ const g = await refresh(d);
211
+ if (!g || !g.running || Date.now() - t0 > POLL_MAX) break;
212
+ }
213
+ z.working = false; X.draw(); afterDraw();
214
+ }
181
215
  }
182
216
  async function sample(d, body) {
183
217
  const z = d.Z, s = X.st; s.msg = 'Adding the sample.'; X.draw(['ft']);
@@ -208,8 +242,10 @@ export async function turn(d, t, low) {
208
242
  if (!r0 || r0.ok !== true) { z.working = false; X.draw(); return 'The description was not saved: ' + ((r0 && r0.error) || 'the press did not go through.'); }
209
243
  }
210
244
  const before = ((z.design && z.design.log) || []).length;
211
- const r = await hand().post('turn', d.id, { text: t });
245
+ const pts = z.points.filter((q) => q.text.trim() && q.slide).map((q) => ({ n: q.n, slide: q.slide, x: q.x, y: q.y, text: q.text.trim() }));
246
+ const r = await hand().post('turn', d.id, pts.length ? { text: t, points: pts } : { text: t });
212
247
  if (!r || r.ok !== true) { z.working = false; X.draw(); return 'Nothing changed: ' + ((r && r.error) || 'the change could not start.'); }
248
+ z.points = []; X.draw(['pv']); afterDraw();
213
249
  return wait(d, before);
214
250
  }
215
251
  async function wait(d, before) {
@@ -228,3 +264,23 @@ async function wait(d, before) {
228
264
  if (Date.now() - t0 > POLL_MAX) { z.working = false; X.draw(); return 'PMOS has not answered yet. The version shows when you open this report again.'; }
229
265
  }
230
266
  }
267
+
268
+ /* Point and say: a click on the slide attaches a request to that spot; each request is typed under the preview. */
269
+ const inDesign = (e) => { const r = X && X.r && X.r(); return r && r.kind === 'setup' && r.tab === 'design' && $('#dlg').classList.contains('stud') && $('#dlg').classList.contains('on') && e.target.closest && e.target.closest('#oMain'); };
270
+ document.addEventListener('click', (e) => {
271
+ if (!inDesign(e)) return;
272
+ const big = e.target.closest('#dzSlide'); if (!big) return;
273
+ const d = X.r(), z = d.Z; if (!z.point || z.working || z.cmp) return;
274
+ const L = slidesOf(z), sl = L[Math.max(0, Math.min(z.i, L.length - 1))]; if (!sl || !sl.id) return;
275
+ const b = big.getBoundingClientRect(); if (!b.width) return;
276
+ if (z.points.length >= 20) return;
277
+ const n = z.points.reduce((m, q) => Math.max(m, q.n), 0) + 1;
278
+ z.points.push({ n, slide: sl.id, x: Math.round(((e.clientX - b.left) / b.width) * 1000) / 10, y: Math.round(((e.clientY - b.top) / b.height) * 1000) / 10, text: '' });
279
+ X.draw(['pv']); afterDraw();
280
+ const i = document.querySelector(`#stPv [data-dzp="${n}"]`); if (i) i.focus();
281
+ });
282
+ document.addEventListener('input', (e) => {
283
+ if (!inDesign(e) || !e.target.dataset || !e.target.dataset.dzp) return;
284
+ const q = X.r().Z.points.find((x) => x.n === +e.target.dataset.dzp); if (q) q.text = e.target.value;
285
+ });
286
+ document.addEventListener('change', (e) => { if (inDesign(e) && e.target.id === 'dzPoint') { X.r().Z.point = e.target.checked; X.draw(['pv']); afterDraw(); } });
@@ -26,7 +26,7 @@ const HELP = 'I understand: call it something, it answers something (or a questi
26
26
  const HELPS = 'Tell me how to shape the sections in your own words, for example: leave out the timeline, or put the decisions first. PMOS proposes the next version; nothing is saved until you press Use this structure. Undo goes back one version.';
27
27
 
28
28
  let X = null; // the Studio's hand: { st, P, chip, opt, field, draw, plural }
29
- export function useStudio(x) { X = x; DES.useStudio({ get st() { return x.st; }, get P() { return x.P; }, chip: x.chip, draw: x.draw, say: x.say, restream: x.restream, r: () => x.st.r }); }
29
+ export function useStudio(x) { X = x; DES.useStudio({ get st() { return x.st; }, get P() { return x.P; }, chip: x.chip, draw: x.draw, say: x.say, restream: x.restream, converse: x.converse, r: () => (x.st ? x.st.r : null) }); }
30
30
  const design = (d) => d.kind === 'setup' && d.tab === 'design';
31
31
  const st = () => X.st;
32
32
  const r = () => X.st.r;
@@ -439,6 +439,7 @@ export function openStudio(p) {
439
439
  REP.useStudio({ get st() { return st; }, get P() { return P; }, chip: (k, l, v) => chip(k, l, v), opt: (...a) => opt(...a), field: (...a) => field(...a), draw: (x) => draw(x), snap: () => snap(),
440
440
  replay: (L) => { const el = $('#dBody .stream'); if (!el || !L.length) return; el.insertAdjacentHTML('beforeend', L.map((x) => (x.who === 'u' ? turnU(x.text) : turnA(ptx(x.text)))).join('')); el.scrollTop = el.scrollHeight; },
441
441
  say: (text) => { const el = $('#dBody .stream'); if (!el) return; el.insertAdjacentHTML('beforeend', turnA(ptx(text))); el.scrollTop = el.scrollHeight; draw(); },
442
+ converse: (t) => { const i = $('#stIn'), f = $('#stF'); if (!i || !f) return; i.value = t; if (f.requestSubmit) f.requestSubmit(); else f.dispatchEvent(new Event('submit', { cancelable: true, bubbles: true })); },
442
443
  restream: (L) => { const el = $('#dBody .stream'); if (!el) return; el.innerHTML = L.map((x) => (x.who === 'u' ? turnU(x.text) : turnA(ptx(x.text)))).join(''); el.scrollTop = el.scrollHeight; },
443
444
  done: (msg) => { closeDlg(); toast(msg); P.reportsChanged(); } });
444
445
  /* The Studio's presses. The dialog is shared, so each listener first asks whether the Studio is what it holds. */
@@ -1961,3 +1961,16 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
1961
1961
  .dlg.stud.sz-half[data-mode="split"] .dgrid{grid-template-columns:minmax(0,1fr)}
1962
1962
  .dlg.stud.sz-half[data-mode="split"] .dgrid[data-tab="chat"] .p-out,.dlg.stud.sz-half[data-mode="split"] .dgrid[data-tab="out"] .p-work{display:none}
1963
1963
  }
1964
+ .dzact{display:inline-flex;gap:8px;flex-wrap:wrap;margin-left:auto}
1965
+ .dzact .dmcta[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
1966
+ .dzbig{position:relative;cursor:crosshair}
1967
+ .dzpin{position:absolute;left:var(--rp-pinx,0);top:var(--rp-piny,0);transform:translate(-50%,-50%);min-width:24px;height:24px;padding:0 6px;border-radius:999px;background:var(--ember);color:var(--on-solid);font:700 12px var(--mono);display:grid;place-items:center;box-shadow:0 1px 4px color-mix(in oklab,var(--ink) 30%,transparent);pointer-events:none}
1968
+ .dzsay{margin-top:12px;padding:12px;border-radius:14px;background:var(--well)}
1969
+ .dzsh{display:flex;align-items:center;justify-content:space-between;gap:8px}
1970
+ .dzon{display:inline-flex;align-items:center;gap:6px;min-height:44px;font-size:13px}
1971
+ .dzsay .sul li{display:flex;align-items:center;gap:8px}
1972
+ .dzsay .sul .sti{flex:1 1 auto;min-width:0}
1973
+ .dzpn{flex:0 0 auto;min-width:24px;height:24px;border-radius:999px;background:var(--ember);color:var(--on-solid);font:700 12px var(--mono);display:grid;place-items:center}
1974
+ .dzcg{display:grid;grid-template-columns:1fr 1fr;gap:12px}
1975
+ @media (max-width:700px){.dzcg{grid-template-columns:1fr}}
1976
+ .dzch{margin-bottom:6px}
@@ -2605,6 +2605,9 @@ const driver = driverRunLib.create({
2605
2605
  const driverTick = () => { try { driver.tick({}); } catch (e) { warnWriteFail('driver tick', e); } };
2606
2606
  // agent-orchestrator: the health rows (lib/orchestrator-health.js) and the nightly backup of the state folder (lib/state-backup.js, only when the PM has chosen a destination).
2607
2607
  let orchLastTickAt = null, orchBackupRunning = false;
2608
+ // agent-orchestrator: the scheduled background jobs (core documents, the weekly finder) start through the gate, so the stop switch, the
2609
+ // away/working caps and the daily cap govern them with the Driver. A press by the PM uses the plain spawnSession and is never held.
2610
+ const orchSpawn = require('./lib/orchestrator-spawn.js').wrap({ gate: orchGate, spawn: (spec) => spawnSession(spec), driverRunning: () => driver.active().length });
2608
2611
  const orchHealth = () => {
2609
2612
  const backupLib = require('./lib/state-backup.js'), log = backupLib.readLog(STATE);
2610
2613
  return require('./lib/orchestrator-health.js').rows({ now: Date.now(), stopped: orchGate.status({}).stopped, lastTickAt: orchLastTickAt, tickMs: TICK_MS,
@@ -2663,7 +2666,7 @@ const reportFinder = reportFinderLib.create({
2663
2666
  headlessOff: () => headlessLib.switchedOff(process.env),
2664
2667
  env: process.env,
2665
2668
  promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
2666
- spawn: (spec) => spawnSession({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
2669
+ spawn: (spec) => orchSpawn.spawn({ name: spec.name, agent: 'claude', ws: spec.ws, origin: spec.origin, initialInput: spec.initialInput, extraEnv: spec.env, autoDelete: undefined, onDone: spec.onDone }),
2667
2670
  stop: (s) => { if (s && s.child) stopHeadless(s); },
2668
2671
  warn: (what, e) => warnWriteFail(what, e),
2669
2672
  });
@@ -2704,7 +2707,7 @@ const coreDocsTick = () => {
2704
2707
  const t = process.env.PMOS_CORE_DOCS_NOW ? Date.parse(process.env.PMOS_CORE_DOCS_NOW) : NaN;
2705
2708
  try {
2706
2709
  m.tick({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, selfRoot: EMBEDDED_SELF ? SELF_ROOT : null, initiativeIndex,
2707
- spawnSession, stopSession: (id) => { const x = sessions.get(String(id || '')); if (x && x.child) stopHeadless(x); }, invalidateNeedsAgg,
2710
+ spawnSession: orchSpawn.spawn, stopSession: (id) => { const x = sessions.get(String(id || '')); if (x && x.child) stopHeadless(x); }, invalidateNeedsAgg,
2708
2711
  proSettings, inQuiet: (now, quiet) => proactiveLib.inQuietHours(now, quiet), isLead: (w) => isPlanNeedsTree(w) }, Number.isFinite(t) ? { now: t } : {});
2709
2712
  } catch (e) { warnWriteFail('core documents tick', e); }
2710
2713
  };
@@ -1,15 +1,17 @@
1
1
  {
2
- "_comment": "agent-orchestrator slice B: the gate that joins the governor and the stop switch, the health rows, the nightly state backup and the status route (node, no server).",
2
+ "_comment": "agent-orchestrator slice B: the gate that joins the governor and the stop switch, the health rows, the nightly state backup and the status route, and the wrapper that puts the scheduled jobs under the gate (node, no server).",
3
3
  "modules": [
4
4
  "orchestrator-gate.test.js",
5
5
  "orchestrator-health.test.js",
6
6
  "state-backup.test.js",
7
- "routes-orchestrator.test.js"
7
+ "routes-orchestrator.test.js",
8
+ "orchestrator-spawn.test.js"
8
9
  ],
9
10
  "seconds": {
10
11
  "orchestrator-gate.test.js": 1,
11
12
  "orchestrator-health.test.js": 1,
12
13
  "state-backup.test.js": 1,
13
- "routes-orchestrator.test.js": 1
14
+ "routes-orchestrator.test.js": 1,
15
+ "orchestrator-spawn.test.js": 1
14
16
  }
15
17
  }