create-pmos 0.328.0 → 0.329.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.328.0",
3
+ "version": "0.329.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@b062dc5
1
+ kernel-source: pmos@3dc6a31
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-19T23:26:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T23:40:22Z"}
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-19T23:26:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T23:40:22Z"}
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-19T23:26:25Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T23:40:22Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -31,7 +31,7 @@ const finish = async (code) => {
31
31
  };
32
32
  process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
33
33
 
34
- const mk = (o) => IP.build(F.facts(o));
34
+ const mk = (o) => IP.build(F.facts(Object.assign({ pinned: 'all' }, o))); // All measures pinned, so the top card starts on every measure
35
35
  const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'briefing-artifact.html');
36
36
 
37
37
  (async () => {
@@ -95,20 +95,22 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
95
95
  const ns = await p.evaluate(() => [...document.querySelectorAll('#dashBody .ngl, #dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ').trim()));
96
96
  ok('I4 a measure with one reading or none is listed with the record\'s reason and not drawn', ns[0] === 'No series recorded · 2' && /Partner NPS.*Only one reading is recorded\. It is not drawn\./.test(ns[1]) && /Monthly churn.*No reading is recorded yet\./.test(ns[2]), JSON.stringify(ns));
97
97
  /* I5 dashboards */
98
- const tabs = await p.evaluate(() => [...document.querySelectorAll('#dashTabs button')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')));
99
- ok('I5 dashboards: all measures first, then the saved ones (main marked), then the pillars the records name', tabs.join() === 'All measures:true,Weekly partner review · Main:false,Growth:false,Reliability:false', tabs.join());
100
- await p.click('#dashTabs [data-d="p:Reliability"]');
98
+ const tabs = await p.evaluate(() => [...document.querySelectorAll('#listRows [data-d]')].map((b) => b.querySelector('b').textContent + ':' + (b.parentElement.querySelector('[data-pin]') || { getAttribute: () => 'none' }).getAttribute('aria-pressed')));
99
+ ok('I5 dashboards: all measures first, then the saved ones, then the pillars the records name; the pinned one is marked, pillars cannot be pinned', tabs.join() === 'All measures:true,Weekly partner review:false,Growth:none,Reliability:none', tabs.join());
100
+ await p.click('#repBody [data-d="p:Reliability"]');
101
101
  ok('I5 choosing a pillar shows only its charts and one count', (await p.evaluate(() => document.querySelectorAll('#dashBody .mch').length)) === 1 && /1 of 1.*on their line/.test(await txt('#dashBody .mhint')) && (await p.evaluate(() => document.querySelector('#dashBody .mprog').getAttribute('aria-valuenow'))) === '1');
102
- await p.click('#dashTabs [data-d="all"]');
102
+ await p.click('#repBody [data-d="all"]');
103
103
  const hint = await txt('#dashBody .mhint');
104
104
  ok('I5 the card counts the measures behind their line from the records: 1 of 3 on their line', /1 of 3 on their line\. 2 are behind it\./.test(hint.replace(/\s+/g, ' ')), hint);
105
105
  ok('I5 the dock counts the same two', (await txt('#dN')) === '2' && /measures off their line/.test(await txt('#dLab')) && /First Time to first call/.test(await txt('#dNext')));
106
106
  /* I6 */
107
107
  const fd = await p.evaluate(() => [...document.querySelectorAll('.nfd li')].map((li) => li.className + ': ' + li.textContent.replace(/\s+/g, ' ').trim()));
108
- ok('I6 what stands out is up to three plain sentences with numbers from the series', fd.length >= 1 && fd.length <= 3 && /^stuck: Time to first call has been behind its line at three readings in a row/.test(fd[0]) && fd.some((x) => /from 30% to 28%/.test(x)), JSON.stringify(fd));
109
- ok('I6 no sentence forecasts or gives a cause', !fd.some((x) => /forecast|will reach|because|caused|expected to/i.test(x)));
108
+ ok('I6 the pinned card says what else stands out on it, with the reason and its numbers', fd.length === 2 && /^miss: Partner activation will miss its 50% target on 31 Dec at this pace\. It is at 28% and moving 0\.53 points a week/.test(fd[0]) && /^course: Partner uptime/.test(fd[1]) && /Also on this dashboard/.test(await txt('#dashBody .nfd .label')), JSON.stringify(fd));
109
+ ok('I6 no sentence gives a cause', !fd.some((x) => /forecast|because|caused|expected to/i.test(x)));
110
+ const hero = await p.evaluate(() => ({ eye: document.querySelector('#insEye').textContent, head: document.querySelector('#brief').textContent, why: document.querySelector('#insWhy').textContent, more: [...document.querySelectorAll('#insMore button')].map((b) => b.textContent), acts: [...document.querySelectorAll('#insAct button')].map((b) => b.textContent), note: document.querySelector('#insNote').textContent }));
111
+ ok('L1 the insight leads the page: the strongest finding, its reason, two more and the method', /2 of 3 behind their line · readings to 15 Oct/.test(hero.eye) && hero.head === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && /Over its last 4 readings it went from 8 days to 9 days/.test(hero.why) && hero.more.length === 2 && /Partner activation will miss/.test(hero.more[0]) && hero.acts.join() === 'Ask PMOS why,See the chart' && /straight line through its last four readings/.test(hero.note), JSON.stringify(hero));
110
112
  /* I7 dialog */
111
- await p.locator('.nfd .nfr').first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
113
+ await p.click('#insAct [data-open]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
112
114
  const dl = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, eye: document.querySelector('#dEye').textContent, kv: [...document.querySelectorAll('#oMain .kv2')].map((k) => k.textContent.replace(/\s+/g, ' ')).join(' | '), path: document.querySelector('#oMain .dpath').textContent, btn: document.querySelectorAll('#oMain button').length, hold: document.querySelector('#holdWhy').textContent, sw: [...document.querySelectorAll('#oMain [role=switch]')].map((b) => b.querySelector('b').textContent + ':' + b.getAttribute('aria-checked')).join(), inert: ['.rail', 'main.stage', '#dock'].every((s) => document.querySelector(s).inert) }));
113
115
  ok('I7 a finding opens the standard dialog: the record\'s numbers, its readings with dates, its path, and only the dashboard switch as a press', dl.title === 'Time to first call' && /real data/.test(dl.eye) && /Target3 days by 31 Dec/.test(dl.kv) && /15 Oct9 days/.test(dl.kv) && dl.path === 'planning/records/kr-metrics.jsonl' && dl.btn === 1 && dl.sw === 'Weekly partner review:true' && /Nothing here changes a record/.test(dl.hold) && dl.inert, JSON.stringify(dl));
114
116
  ok('I7 Escape closes it and focus returns', (await p.keyboard.press('Escape'), await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')))));
@@ -126,9 +128,11 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
126
128
  await R.ctx.close();
127
129
  }
128
130
  /* I8 reports */
129
- const rp = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#repDocs .dmr')].map((r) => r.querySelector('.dmn b').textContent + ' / ' + r.querySelector('.s').textContent), note: document.querySelector('#repBody .mhint').textContent, cap: document.querySelector('#repCap').textContent }));
130
- ok('I8 the Reports card lists the report files: cadence, slot, draft or issued', rp.rows.join() === 'biweekly · 14 Oct / Draft,monthly · 30 Sep / Issued 1 Oct' && /Nothing is sent from here/.test(rp.note) && rp.cap === '2', JSON.stringify(rp));
131
- { const R = await open(); await R.page.locator('#repDocs .dmo').first().click(); ok('I8 a report opens in the page\'s reader, not the console (premium-report-read R1)', await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd') && document.querySelector('#dlg').classList.contains('on')), 5000) && /premium-insights\.html/.test(R.page.url()), R.page.url());
131
+ await p.click('#listSeg [data-f="rep"]'); await sleep(100);
132
+ const rp = await p.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows [data-rep]')].map((r) => r.querySelector('.dmn b').textContent + ' / ' + r.querySelector('.s').textContent), note: document.querySelector('#cRep .mhint').textContent, cap: document.querySelector('#repCap').textContent, setups: document.querySelectorAll('#listRows [data-setup]').length, dash: document.querySelectorAll('#listRows [data-d]').length }));
133
+ ok('I8 the Reports filter lists the set-up reports, then the report files: cadence, slot, draft or issued', rp.rows.join() === 'biweekly · 14 Oct / Draft,monthly · 30 Sep / Issued 1 Oct' && rp.setups === 1 && rp.dash === 0 && /Nothing is sent from here/.test(rp.note) && rp.cap === '7', JSON.stringify(rp));
134
+ await p.click('#listSeg [data-f="all"]');
135
+ { const R = await open(); await R.page.click('#listSeg [data-f="rep"]'); await R.page.locator('#listRows [data-rep]').first().click(); ok('I8 a report opens in the page\'s reader, not the console (premium-report-read R1)', await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('rdrd') && document.querySelector('#dlg').classList.contains('on')), 5000) && /premium-insights\.html/.test(R.page.url()), R.page.url());
132
136
  await R.page.click('#dClose'); await R.page.click('#repOpen'); ok('I8 the Reports tab link still opens the console to edit or issue', await until(() => /\/console\.html\?tab=rep/.test(R.page.url()), 5000), R.page.url()); await R.ctx.close(); }
133
137
  /* I9 labels */
134
138
  ok('I9 no demo label, and the foot says what is left out', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && /Left out: any measure no record holds/.test(await txt('#foot')) && /Board measures card/.test(await txt('#foot')) && /Real data/.test(await txt('#snap')));
@@ -136,7 +140,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
136
140
  /* I10 empty */
137
141
  {
138
142
  const R = await open({ model: mk({ outcomes: [] }) });
139
- ok('I10 with no KR metric the page says so in one sentence and the Reports card still lists its files', await R.page.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No KR metric is recorded for this workspace/.test(document.querySelector('#dashBody').textContent) && document.querySelectorAll('#repDocs .dmr').length === 2 && document.querySelectorAll('#dashBody .mch').length === 0));
143
+ ok('I10 with no KR metric the page says there is no insight yet, draws nothing, and the list still holds the report files', await R.page.evaluate(() => /No KR metric is recorded/.test(document.querySelector('#brief').textContent) && /No KR metric is recorded for this workspace/.test(document.querySelector('#dashBody').textContent) && document.querySelectorAll('#listRows [data-rep]').length === 2 && document.querySelectorAll('#dashBody .mch').length === 0 && /There is no insight yet/.test(document.querySelector('#brief').textContent) && document.querySelectorAll('#insAct button').length === 0));
140
144
  await R.ctx.close();
141
145
  const R2 = await open({ model: mk({ reportsOk: false, reports: [], missing: ['reports'] }) });
142
146
  ok('I10 reports that could not be read are said to be unread, not empty', await R2.page.evaluate(() => /report files could not be read/.test(document.querySelector('#repBody').textContent) && /not read: reports/.test(document.querySelector('#snap').textContent)));
@@ -160,9 +164,9 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
160
164
  const last = () => sent[sent.length - 1] || [null, {}];
161
165
  const dlgOn = () => until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
162
166
  const shut = async () => { for (let i = 0; i < 2 && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on')); i++) { await q.keyboard.press('Escape'); await sleep(150); } await until(() => q.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))); }; // a full-screen dialog leaves full screen on the first Escape
163
- await q.click('#dashTabs [data-d="pd-1"]'); await sleep(200);
167
+ await q.click('#repBody [data-d="pd-1"]'); await sleep(200);
164
168
  const sv = await q.evaluate(() => ({ tiles: [...document.querySelectorAll('#dashBody .mch .mlab')].map((e) => e.firstChild.textContent), gone: [...document.querySelectorAll('#dashBody .dplist .nempty')].map((e) => e.textContent.replace(/\s+/g, ' ')), bar: document.querySelector('#dashBar').textContent }));
165
- ok('R1 a saved dashboard draws its charts in its order and says which chart is gone, in its place', sv.tiles.join() === 'Partner activation,Time to first call' && sv.gone.length === 1 && /krm-gone.*No KR metric record is called krm-gone/.test(sv.gone[0]) && /Main dashboard\..*Monday partner review/.test(sv.bar), JSON.stringify(sv));
169
+ ok('R1 a saved dashboard draws its charts in its order and says which chart is gone, in its place', sv.tiles.join() === 'Partner activation,Time to first call' && sv.gone.length === 1 && /krm-gone.*No KR metric record is called krm-gone/.test(sv.gone[0]) && /Monday partner review.*Pin.*Back to All measures.*Edit/.test(sv.bar), JSON.stringify(sv));
166
170
  await q.click('#pdEdit'); await dlgOn();
167
171
  const chipv = (k) => q.evaluate((x) => (document.querySelector(`#oMain [data-st="chip|${x}"] b`) || {}).textContent || '', k);
168
172
  await q.click('#oMain [data-st="chip|charts"]');
@@ -171,18 +175,18 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
171
175
  await q.click('#stTr [data-st="mv|1|-1"]'); await q.click('#stTr [data-st="rm|2"]'); await q.click('#oMain [data-st="lib"]'); await q.click('#stLb [data-st="libc|krm-up"]');
172
176
  await q.click('#oMain [data-st="chip|name"]'); await q.fill('#stI', 'Monday review'); await q.click('#oMain [data-st="save"]'); await sleep(400);
173
177
  ok('R2 Save posts the dashboard with the new order, name and Main to the one save route', last()[0] === '/api/premium-dashboards/save' && JSON.stringify(last()[1]) === JSON.stringify({ ws: 'w1', board: 'w1', id: 'pd-1', name: 'Monday review', purpose: 'The measures the Monday partner review reads.', charts: ['krm-ttfc', 'krm-act', 'krm-up'], main: true }), JSON.stringify(last()));
174
- await q.click('#pdNew'); await dlgOn(); await q.click('#oMain [data-st="save"]'); await sleep(200);
178
+ await q.click('#listNew'); await q.click('#pdNew'); await dlgOn(); await q.click('#oMain [data-st="save"]'); await sleep(200);
175
179
  ok('R2 a new dashboard without a name says so and posts nothing', /Give the dashboard a name/.test(await qt('#stMsg')) && last()[1].id === 'pd-1');
176
180
  answer = () => ({ ok: false, error: '“Weekly partner review” is already a dashboard on this board.' });
177
181
  await q.click('#oMain [data-st="chip|name"]'); await q.fill('#stI', 'Weekly partner review'); await q.click('#oMain [data-st="chip|use"]'); await q.fill('#stI', 'x'); await q.click('#oMain [data-st="save"]'); await sleep(300);
178
182
  ok('R7 the server\'s refusal is shown in words and the dialog stays open', /already a dashboard on this board/.test(await qt('#stMsg')) && await q.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !document.querySelector('#oMain [data-st="save"]').disabled));
179
183
  answer = (u, b) => ({ ok: true, dashboard: { id: b.id || 'pd-9' }, dashboards: [], setup: {}, drafted: { slot: '2026-10-23', path: 'planning/reports/release-readiness/2026-10-23.md' } });
180
184
  await shut();
181
- await q.click('#dashTabs [data-d="all"]'); await q.locator('#dashBody [data-open="ins:krm-up"]').click(); await dlgOn(); await q.click('#oMain [data-pdsw="pd-1"]'); await sleep(300);
185
+ await q.click('#pdBack'); await q.locator('#dashBody .lk[data-open="ins:krm-up"]').click(); await dlgOn(); await q.click('#oMain [data-pdsw="pd-1"]'); await sleep(300);
182
186
  ok('R3 the chart dialog\'s switch saves that dashboard with the chart added', last()[0] === '/api/premium-dashboards/save' && JSON.stringify(last()[1].charts) === JSON.stringify(['krm-act', 'krm-ttfc', 'krm-gone', 'krm-up']) && /Added to Weekly partner review/.test(await qt('#pdSwM')), JSON.stringify(last()));
183
187
  await shut();
184
188
  const groups = await q.evaluate(() => [...document.querySelectorAll('#repBody .ngrp > .label')].map((e) => e.textContent));
185
- ok('R1 the Reports card lists your requests, what PMOS found, the set-up reports and the documents', groups.join() === 'Your requests · 2,Found in your work · 1,Set up · 1,Documents · 1 draft · 1 issued', groups.join());
189
+ ok('R1 your requests and what PMOS found stay at the top of the list', groups.join() === 'Your requests · 2,Found in your work · 1', groups.join());
186
190
  await q.click('#repFound .dmo'); await dlgOn();
187
191
  ok('R2 a finding opens with its proposal and what PMOS saw', /ScheduleWeekly, Thursdays 09:00/.test(await qt('#oMain .kv2')) && (await q.evaluate(() => document.querySelectorAll('#oMain .pdev li').length)) === 2);
188
192
  const n0 = sent.length;
@@ -194,7 +198,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
194
198
  await q.click('#repFound .dmo'); await dlgOn(); await q.click('#oMain [data-rx="set"]'); await sleep(400);
195
199
  ok('R2 Set it up posts the finding and says where the first draft is', last()[0] === '/api/report-setups/setup' && last()[1].finding === 'f-1' && /first draft is planning\/reports\/release-readiness\/2026-10-23\.md/.test(await qt('#toast')), JSON.stringify(last()));
196
200
  await q.fill('#repAskIn', 'A weekly risk note'); await q.click('#repAskGo'); await sleep(300);
197
- ok('R3 the Ask box posts the request and says it only proposes', last()[0] === '/api/report-setups/ask' && last()[1].text === 'A weekly risk note' && /Nothing is set up yet/.test(await qt('#toast')) && /only proposes/.test(await qt('#repBody .nask-n')), JSON.stringify(last()));
201
+ ok('R3 the Ask box posts the request and says it only proposes', last()[0] === '/api/report-setups/ask' && last()[1].text === 'A weekly risk note' && /Nothing is set up yet/.test(await qt('#toast')) && /only proposes/.test(await qt('#cRep .nask-n')), JSON.stringify(last()));
198
202
  await q.click('#repAsks [data-ask="a-1"]'); await dlgOn(); await q.click('#oMain [data-rx="chg"]'); await sleep(100);
199
203
  ok('R3 Change it needs words first', /Say what to change/.test(await qt('#rxM')));
200
204
  await q.fill('#rxChg', 'quarterly'); await q.click('#oMain [data-rx="chg"]'); await sleep(300);
@@ -202,7 +206,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
202
206
  await q.click('#repAsks [data-ask="a-2"]'); await dlgOn();
203
207
  ok('R3 a running request says it is working and offers only Cancel', /background run is working/.test(await qt('#oMain')) && (await q.evaluate(() => [...document.querySelectorAll('#oMain [data-rx]')].map((b) => b.dataset.rx).join())) === 'cancel');
204
208
  await shut();
205
- await q.click('#repSetups .dmo'); await dlgOn();
209
+ await q.click('#repBody [data-setup="partner-update"]'); await dlgOn();
206
210
  const su = await q.evaluate(() => ({ kv: document.querySelector('#oMain .kv2').textContent, acts: [...document.querySelectorAll('#oMain [data-rx]')].map((b) => b.dataset.rx).join() }));
207
211
  ok('R4 a set-up report shows its schedule and next draft, with Draft it now, Pause and Shape it in the Studio', /ScheduleEvery other Monday at 09:00/.test(su.kv) && /Next draft26 Oct/.test(su.kv) && su.acts === 'draft,pause,studio', JSON.stringify(su));
208
212
  await q.click('#oMain [data-rx="pause"]'); await sleep(300);
@@ -212,10 +216,37 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
212
216
  await R.ctx.close();
213
217
  }
214
218
 
219
+ /* insights-one-list: the pinned card, the pin press, the menu and the pages (PRD L4, L5) */
220
+ {
221
+ const R = await open({ model: mk({ pinned: undefined }) }), q = R.page, sent = [];
222
+ await q.route('**/api/premium-dashboards/pin', (r) => { const b = JSON.parse(r.request().postData() || '{}'); sent.push(b); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, pinned: b.id }) }); });
223
+ const top = await q.evaluate(() => ({ h: document.querySelector('#hDash').textContent, tag: document.querySelector('#dashTag').textContent, tiles: document.querySelectorAll('#dashBody .mch').length, pin: document.querySelector('#pdPin').textContent }));
224
+ ok('L4 the saved main dashboard is the pinned one and shows at the top, with Unpin', top.h === 'Weekly partner review' && top.tag === 'Pinned' && top.tiles === 2 && top.pin === 'Unpin', JSON.stringify(top));
225
+ R.setModel(mk({ pinned: 'all' })); await q.click('#repBody [data-pin="all"]'); await sleep(300);
226
+ ok('L4 after Pin, the pinned dashboard is the top card', await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'All measures' && document.querySelector('#dashTag').textContent === 'Pinned')));
227
+ ok('L4 the pin on a row posts that dashboard to the pin route, and nothing else', sent.length === 1 && sent[0].id === 'all' && sent[0].ws === 'w1' && sent[0].board === 'w1' && R.posts.every((x) => x === 'POST /api/premium-dashboards/pin'), JSON.stringify([sent, R.posts]));
228
+ R.setModel(mk({ pinned: null })); await q.click('#pdPin'); await sleep(300);
229
+ ok('L4 Unpin posts no dashboard, and with nothing pinned the top card shows All measures as not pinned, with Pin', sent[sent.length - 1].id === null && await until(() => q.evaluate(() => document.querySelector('#hDash').textContent === 'All measures' && document.querySelector('#dashTag').textContent === 'Not pinned' && document.querySelector('#pdPin').textContent === 'Pin')), JSON.stringify(sent));
230
+ await q.click('#listNew');
231
+ const mn = await q.evaluate(() => ({ open: !document.querySelector('#listMenu').hidden, items: [...document.querySelectorAll('#listMenu button')].map((b) => b.textContent).join(), exp: document.querySelector('#listNew').getAttribute('aria-expanded') }));
232
+ await q.keyboard.press('Escape');
233
+ ok('L5 New offers Dashboard or Report, and Escape closes it', mn.open && mn.items === 'Dashboard,Report' && mn.exp === 'true' && await q.evaluate(() => document.querySelector('#listMenu').hidden), JSON.stringify(mn));
234
+ const pg1 = await q.evaluate(() => ({ rows: document.querySelectorAll('#listRows .dmr').length, pager: document.querySelector('#listPager').textContent }));
235
+ await q.click('#listPager [data-pg="2"]'); await sleep(100);
236
+ const pg2 = await q.evaluate(() => ({ rows: [...document.querySelectorAll('#listRows .dmo b')].map((b) => b.textContent), cur: document.querySelector('#listPager [aria-current="page"]').textContent }));
237
+ ok('L5 six rows to a page with page numbers; page 2 holds the rest', pg1.rows === 6 && /1–6 of 7/.test(pg1.pager) && pg2.cur === '2' && pg2.rows.join() === 'monthly · 30 Sep', JSON.stringify([pg1, pg2]));
238
+ await R.ctx.close();
239
+ const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
240
+ const R2 = await open({ model: mk({ leads: lead }) });
241
+ const ln = await R2.page.evaluate(() => ({ dash: [...document.querySelectorAll('#listRows [data-d] .nil')].map((e) => e.textContent), rep: [...document.querySelectorAll('#listRows [data-rep] .nil')].map((e) => e.textContent), su: document.querySelector('#listRows [data-setup] small').textContent }));
242
+ ok('L6 each dashboard row shows its top finding, a report row quotes its file, a setup with no file says no draft is written yet', ln.dash[0] === 'Time to first call will miss its 3 days target on 31 Dec unless it turns.' && ln.rep[0] === '“Activation slipped to 28% this fortnight.”' && /^No draft is written yet/.test(ln.su), JSON.stringify(ln));
243
+ await R2.ctx.close();
244
+ }
245
+
215
246
  /* I11 floors */
216
247
  for (const theme of ['light', 'dark']) {
217
248
  const R = await open({ w: 390, h: 844, theme }), q = R.page;
218
- const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#dashTabs button, #dashBar button, #dashBody .lk, #dashBody .nfr, #repBody .dmo, #repBody .lk, #repBody input, #repAskGo, #crSw')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1, small }; });
249
+ const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#listSeg button, #listNew, #listPager button, #repBody .npin, #insAct button, #insMore button, #dashBar button, #dashBody .lk, #dashBody .nfr, #repBody .dmo, #repBody .lk, #repBody input, #repAskGo, #crSw')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1, small }; });
219
250
  ok(`I11 at 390 px (${theme}) the page has no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0, JSON.stringify(m));
220
251
  await q.locator('#dashBody .nfr').first().click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(900);
221
252
  const g = await q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth, tabs: getComputedStyle(document.querySelector('#dTabs')).display }; });
@@ -259,10 +290,10 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
259
290
  await pg.goto(base2 + '/premium-insights.html');
260
291
  ok('E7 the real page draws that chart with the record\'s numbers and no script error', await until(() => pg.evaluate(() => { const t = document.querySelector('#dashBody .mch'); return !!t && t.querySelector('.mval').textContent === '30%' && /Partner activation/.test(t.textContent); }), 20000) && errs.length === 0, errs.join(' | '));
261
292
  /* briefing-premium-reports against the real server: New dashboard, Save, the switch, then the ledger answers it back */
262
- await pg.click('#pdNew'); await until(() => pg.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
293
+ await pg.click('#listNew'); await pg.click('#pdNew'); await until(() => pg.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
263
294
  await pg.click('#oMain [data-st="chip|name"]'); await pg.fill('#stI', 'Partner review'); await pg.click('#oMain [data-st="chip|use"]'); await pg.fill('#stI', 'The Monday partner review.');
264
295
  await pg.click('#stLb [data-st="libc|' + m.charts[0].id + '"]'); await pg.click('#oMain [data-st="chip|main"]'); await pg.click('#stTr [data-st="set|main|1"]'); await pg.click('#oMain [data-st="save"]');
265
- ok('E8 a dashboard made on the real page is saved and drawn as the main one', await until(() => pg.evaluate(() => !document.querySelector('#dlg').classList.contains('on') && [...document.querySelectorAll('#dashTabs button')].some((b) => b.textContent === 'Partner review · Main' && b.getAttribute('aria-pressed') === 'true') && document.querySelectorAll('#dashBody .mch').length === 1), 10000), await pg.evaluate(() => (document.querySelector('#pdM') || {}).textContent + ' / ' + [...document.querySelectorAll('#dashTabs button')].map((b) => b.textContent).join()));
296
+ ok('E8 a dashboard made on the real page as the main one is saved, pinned and drawn at the top', await until(() => pg.evaluate(() => !document.querySelector('#dlg').classList.contains('on') && document.querySelector('#hDash').textContent === 'Partner review' && document.querySelector('#dashTag').textContent === 'Pinned' && document.querySelectorAll('#dashBody .mch').length === 1), 10000), await pg.evaluate(() => (document.querySelector('#pdM') || {}).textContent + ' / ' + document.querySelector('#hDash').textContent + ' ' + document.querySelector('#dashTag').textContent));
266
297
  const j2 = await (await fetch(base2 + '/api/insights-premium')).json(), d2 = j2.model.dashboards.find((d) => d.saved);
267
298
  ok('E8 the model reads it back from the ledger', !!d2 && d2.name === 'Partner review' && d2.main && d2.charts.join() === m.charts[0].id, JSON.stringify(d2));
268
299
  const H = await T.pressHeaders(base2), body = JSON.stringify({ ws: m.board.ws, board: m.board.id, name: 'From an agent', purpose: 'x', charts: [] });
@@ -276,9 +307,9 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
276
307
  /* I11 fidelity against the mockup */
277
308
  if (!fs.existsSync(MOCKUP)) ok('I11 the mockup is in the repository', false, MOCKUP);
278
309
  else {
279
- const PAIRS = [['rail', '.rail', '.rail'], ['card', '.nlc .card', '.nlc .card'], ['heading', '#hNd', '#hDash'], ['band', '.nfd', '.nfd'], ['bandlabel', '.nfd .label', '.nfd .label'], ['finding', '.nfd .nfr', '.nfd .nfr'], ['findtext', '.nfd .nft', '.nfd .nft'], ['dot', '.nfd .nfdot', '.nfd .nfdot'],
310
+ const PAIRS = [['rail', '.rail', '.rail'], ['card', '.nlc .card', '#cDash'], ['heading', '#hNd', '#hDash'], ['band', '.nfd', '.nfd'], ['bandlabel', '.nfd .label', '.nfd .label'], ['finding', '.nfd .nfr', '.nfd .nfr'], ['findtext', '.nfd .nft', '.nfd .nft'], ['dot', '.nfd .nfdot', '.nfd .nfdot'],
280
311
  ['hint', '.mhint', '.mhint'], ['grid', '.ngrid', '.ngrid'], ['tile', '.ngrid .mt1', '.ngrid .mt1'], ['tlabel', '.ngrid .mlab', '.ngrid .mlab'], ['chip', '.ngrid .mchip', '.ngrid .mchip'], ['value', '.ngrid .mval', '.ngrid .mval'], ['caption', '.ngrid .mwk', '.ngrid .mwk'],
281
- ['foot', '.ngrid .mfoot', '.ngrid .mfoot'], ['link', '.ntf .lk', '.ntf .lk'], ['repcard', '.nlr .card', '.nlr .card'], ['dock', '.dock', '.dock']];
312
+ ['foot', '.ngrid .mfoot', '.ngrid .mfoot'], ['link', '.ntf .lk', '.ntf .lk'], ['repcard', '.nlr .card', '#cRep'], ['dock', '.dock', '.dock']];
282
313
  const SKIP_W = ['card', 'band', 'bandlabel', 'finding', 'findtext', 'hint', 'tile', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'heading', 'repcard', 'grid'];
283
314
  const PROPS = ['fontSize', 'fontWeight', 'fontFamily', 'color', 'backgroundColor', 'borderRadius', 'paddingTop', 'paddingLeft', 'letterSpacing', 'lineHeight', 'boxShadow', 'backdropFilter', 'borderTopColor'];
284
315
  const grab = (pg, which) => pg.evaluate(([pairs, props, idx]) => { const o = {}; for (const pr of pairs) { const n = pr[0], s0 = pr[idx]; const s = (n === 'rail' || n === 'dock') ? s0 : 'main.stage:not([hidden]) ' + s0; const e = document.querySelector(s); if (!e) { o[n] = null; continue; } const cs = getComputedStyle(e), r = e.getBoundingClientRect(), v = { left: Math.round(r.left), width: Math.round(r.width) }; props.forEach((k) => { v[k] = cs[k]; }); o[n] = v; } return o; }, [PAIRS, PROPS, which]);
@@ -294,7 +325,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
294
325
  if (!a[n] || !c[n]) { diffs.push(n + ' missing'); continue; }
295
326
  for (const k of Object.keys(a[n])) {
296
327
  const geom = k === 'left' || k === 'width';
297
- if (geom && (SKIP_W.includes(n) && k === 'width' || ['findtext', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'dot', 'finding', 'hint', 'heading'].includes(n) && k === 'left')) continue;
328
+ if (geom && (SKIP_W.includes(n) && k === 'width' || ['findtext', 'tlabel', 'chip', 'value', 'caption', 'foot', 'link', 'dot', 'finding', 'hint', 'heading', 'repcard'].includes(n) && k === 'left')) continue;
298
329
  if (geom ? Math.abs(a[n][k] - c[n][k]) > 2 : a[n][k] !== c[n][k]) diffs.push(`${n}.${k} ${a[n][k]} | ${c[n][k]}`);
299
330
  }
300
331
  }
@@ -309,23 +309,25 @@ Not drawn, because PMOS holds no record for them: the mockup's demo tasks, its J
309
309
  Insights is the fourth place on the rail, at `/premium-insights.html`. It reads the KR metric records of the board's workspace, your saved dashboards, and the report files and report setups the console's Reports tab lists. It writes only when you press a button: a dashboard goes to the workspace's state folder (`premium-dashboards.jsonl`), and a report press goes to the report ledger through the console's own report routes. An agent session cannot make either write.
310
310
 
311
311
  - **Charts.** One chart for each KR metric that holds at least two readings. The line runs through the readings at their dates, so a month with no reading is a gap and not a zero. The dashed line is the metric's target. The chip is the record's own line status: on its line, behind it, or well behind it. Pressing a chart, or its Details link, opens the metric's record in the dialog with the read-only agent beside it.
312
- - **Dashboards.** The switch lists All measures first, then your saved dashboards (the main one first, marked Main), then the pillars the metrics name. A saved dashboard draws its charts in the order you saved them. A chart whose record is gone, or that has fewer than two readings, is listed in its place with the reason and is not drawn.
312
+ - **The insight.** The page opens with one finding across the board's measures, in a large line, with the reason and its numbers under it, up to two more findings, **Ask PMOS why** (opens the measure's dialog on the Conversation tab) and **See the chart**. A measure that is short of its target, with a target date after its last reading, gets a projection: a straight line through its last four readings (all, when fewer), carried to the target date. When the line lands short, the finding says the measure will miss its target on that date at this pace, where it lands, how far short, and when it would get there. When the line lands on or past the target, it says the measure is on course. The page says how the projection is made, and no forecast line is drawn on a chart. With no KR metric, or none with two readings, the page says there is no insight yet and why.
313
+ - **The pinned dashboard.** The card under the insight shows the pinned dashboard: its insight band (the next findings on it, past the one the page leads with), its charts and **Unpin**. When nothing is pinned, it shows All measures, marked **Not pinned**, with **Pin**. Pressing a dashboard in the list shows it in this card, with **Pin** and **Back to** the pinned one. One dashboard per board is pinned, All measures included; pillar groups cannot be pinned. The pin is a line in `premium-dashboards.jsonl` and shows on Insights only.
314
+ - **Dashboards and reports.** One list holds the dashboards (All measures, your saved ones, then the pillars the metrics name) and then the reports (your set-up reports, then the report files). **All**, **Dashboards** and **Reports** filter it; it shows six rows to a page, with page numbers. A dashboard row shows its top finding and a pin. A report row quotes the opening sentence of its latest file; a set-up report with no file says no draft is written yet. **New** offers **Dashboard** or **Report**. Your requests and what PMOS found in your work stay at the top of the list. A saved dashboard draws its charts in the order you saved them. A chart whose record is gone, or that has fewer than two readings, is listed in its place with the reason and is not drawn.
313
315
  - **Open the Studio from the top.** **Chat** beside the board name opens the Insight Studio: on the saved dashboard you are looking at, otherwise on a new dashboard, or in Report mode when no measure has a series yet.
314
- - **Make or edit a dashboard.** **New dashboard**, or **Edit** on a saved one, opens the **Insight Studio**, a wide dialog. On the right, the brief shows the Name, Purpose, Charts and Main dashboard; press a chip to change it. **Library** lists the board's measures and saved dashboards to add. The preview draws the dashboard as the page will, and lists a measure with no series as not drawn. The checks (a name, a purpose, a chart, six or fewer, no repeat, a main dashboard on the board) say what fails, with a one-press fix. On the left you can say it instead: "add Partner activation", "remove …", "move … first", "call it …", "it is for …", "make it the main dashboard", "undo" or "start a new one". A turn changes the draft only. **Undo** steps back one change. **Save the dashboard** records it; **Remove the dashboard** asks once more and then removes it. In a chart's dialog, **On your dashboards** has a switch for each saved dashboard, which adds the chart to it or takes it off.
316
+ - **Make or edit a dashboard.** **New**, then **Dashboard**, or **Edit** on a saved one, opens the **Insight Studio**, a wide dialog. On the right, the brief shows the Name, Purpose, Charts and Main dashboard; press a chip to change it. **Library** lists the board's measures and saved dashboards to add. The preview draws the dashboard as the page will, and lists a measure with no series as not drawn. The checks (a name, a purpose, a chart, six or fewer, no repeat, a main dashboard on the board) say what fails, with a one-press fix. On the left you can say it instead: "add Partner activation", "remove …", "move … first", "call it …", "it is for …", "make it the main dashboard", "undo" or "start a new one". A turn changes the draft only. **Undo** steps back one change. **Save the dashboard** records it; **Remove the dashboard** asks once more and then removes it. In a chart's dialog, **On your dashboards** has a switch for each saved dashboard, which adds the chart to it or takes it off.
315
317
  - **Make your own chart.** **New chart**, or **Edit** on one of your charts, opens the Insight Studio in **Chart** mode; the switch at the top moves between Chart and Dashboard, and each keeps its own draft. The brief shows the Question, Measure, Form (line, bars, number or meter), Range (all readings or the last few) and Target; **More** adds the Title, Better when, Note and Add to (a dashboard). The Studio suggests a form from the question and says why. The checks (a question, a target, enough readings, a form that fits the question, one scale) say what fails, with a one-press fix. You can say it instead: "show it as bars", "last 4 readings", "target 35", "lower is better", "call it …", "note: …", "add it to Weekly", or a question. A pie is declined, with the reason. **Save the chart** records it in the workspace's state folder, and adds it to the dashboard you named. Your charts are listed under **All measures**, and a dashboard can hold them beside the measures. **Remove the chart** asks once more; a dashboard that held it then says it was removed.
316
- - **Set up a report in the Studio.** **New report** on the Reports card opens the Insight Studio in **Report** mode. The brief shows the Title, What it answers, Audience, Format, Schedule, Draw from (your work, or the board's dashboard) and the Sections. A new report always has the same sections, in the same order, so they are listed, not edited. The checks (what it answers, an audience, a format that fits the audience, a new title, the answer first) say what fails, with a one-press fix. You can say it instead: "it answers: …", "for leadership", "slides", "monthly", "every two weeks on Thursday", "call it …". **Set it up** records the report and writes its first draft as a file.
318
+ - **Set up a report in the Studio.** **New**, then **Report**, on the list opens the Insight Studio in **Report** mode. The brief shows the Title, What it answers, Audience, Format, Schedule, Draw from (your work, or the board's dashboard) and the Sections. A new report always has the same sections, in the same order, so they are listed, not edited. The checks (what it answers, an audience, a format that fits the audience, a new title, the answer first) say what fails, with a one-press fix. You can say it instead: "it answers: …", "for leadership", "slides", "monthly", "every two weeks on Thursday", "call it …". **Set it up** records the report and writes its first draft as a file.
317
319
  - **Change the size of the Studio.** On a wide window, **Normal**, **Half**, **3/4** and **Whole** sit beside **Library**. Whole is the full screen. At Half, the conversation and the Studio are two tabs. The Studio opens on Whole, and PMOS remembers your choice on this browser.
318
320
  - **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.
319
321
  - **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.
320
322
  - **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.
321
323
  - **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.
322
- - **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.
324
+ - **The findings.** Each finding is one sentence with its reason, taken from the series: will miss its target at this pace, on course, 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. No cause is given.
323
325
  - **Board measures.** The same four tiles as the Board's Metrics card, counted from the board's repository and drawn the same way. Choose **8 weeks**, **26 weeks** or **52 weeks**; the page keeps your choice. Press a measure to read its definition and values and to set its target: type a number and press **Save target**, or press **Clear target**. For Corrections, Blocked and Idle, lower is better, so the target is the most you accept; for Merged a week it is the least. The target goes to the workspace's state folder (`board-metric-targets.jsonl`) and the Board draws it too. An agent session cannot set one.
324
326
  - **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
325
327
  - **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**.
326
328
  - **Found in your work.** Up to three reports PMOS found in your calendar, mail or documents, each with why and what it saw. **Set it up** records the report and drafts its first cycle as a file. **Not a report** hides it and records it after 5 seconds, unless you press **Undo**. If the finding changed while the window was open, the window says what happened. It was already set up, it was marked not a report, or a new scan replaced it. The list is read again. Close the window and open the report from the list. If PMOS does not hear back, the window says nothing was recorded. Press the button to try again.
327
329
  - **Set up.** Your recurring reports, with their schedule and next draft. A report opens with **Draft it now** (for a report drawn from your work) and **Pause** or **Resume**.
328
- - **Documents.** The report files of the workspace, with cadence, slot and whether each is a draft or issued. Pressing one opens it on the page at the normal dialog size, with a status line (Draft or Issued, the saved design version, the file). The **slide deck / Document** menu picks the view: a deck is a title slide, then one slide for each section, with the arrow keys and a strip of slides; a document is a page. The **Read** menu holds **Present**, which shows the slide on the whole screen (the arrow keys move and Escape stops), and **Print or save as PDF**, which prints one slide to a page. **Download** gives PowerPoint, Word, Excel, CSV or the Markdown file; the files carry the words, not the look. **Open in the console** is where a document is edited or issued. Nothing is sent from this page.
330
+ - **Report files.** The report files of the workspace, in the list, with cadence, slot and whether each is a draft or issued. Pressing one opens it on the page at the normal dialog size, with a status line (Draft or Issued, the saved design version, the file). The **slide deck / Document** menu picks the view: a deck is a title slide, then one slide for each section, with the arrow keys and a strip of slides; a document is a page. The **Read** menu holds **Present**, which shows the slide on the whole screen (the arrow keys move and Escape stops), and **Print or save as PDF**, which prints one slide to a page. **Download** gives PowerPoint, Word, Excel, CSV or the Markdown file; the files carry the words, not the look. **Open in the console** is where a document is edited or issued. Nothing is sent from this page.
329
331
  - **Edit the slides.** In the **Read** menu of a draft, **Edit the slides** opens the same file as a **Slides** tab beside the report. The rail on the left lists the slides. Drag a slide to move it, or use the up and down buttons on it; the buttons also duplicate and delete a slide, and **+ Slide** adds one from a layout. On the slide, click an item to select it, drag it to move it (a line shows when it is centred), and drag a corner to resize it. Double-click text to type. The toolbar adds text, an image, a chart, a table or a shape, and changes the layout of the slide or the theme of the deck. The bar under it changes the selected item: text style, alignment and colour; bars or a line and **Edit data** for a chart; rows and columns for a table. An image is a file that is already in the workspace: type its path, such as `planning/design/screen.png`. Speaker notes go in the box under the slide. **Undo** and **Redo** cover every change. **Present** opens the presenter view: the slide, the next slide, your speaker notes (you can type in them) and a timer. The arrow keys move, and Escape stops. **Slides only** hides the notes. **Audience window** opens a second window with the slide alone, for the screen you share; it follows your slide and closes when you stop. **Save** asks why the slides change, then writes the file; the reason goes in the Edit log. The file stays markdown: each slide is a heading with its text under it, and a hidden comment keeps the layout and the notes. If someone changed the text of a slide in the file, the editor shows the file's text and says so. If the file changed while the slides were open, Save stops and tells you to open the slides again. An issued report opens its slides read-only, with **Open the slides**.
330
332
  - **Shape a report's look.** On a draft, **Add a sample** takes a PDF, PowerPoint, Word, PNG or JPG file to follow. Say how it should look in the conversation; PMOS draws the next design version (D1, D2, …) and says what it changed. Press a version to go back to it. **This is it** saves the version shown as the report's design, and PMOS draws the cycle to match. An issued cycle is frozen with its look.
331
333
 
@@ -2,7 +2,7 @@
2
2
  /* lib/insights-premium.js — the premium Insights page's model, built from the KR metric records and the report files the console's Reports tab reads
3
3
  * (initiative briefing-premium-insights).
4
4
  *
5
- * build(facts) → model PURE. facts = { now, board, boards, outcomes, reports, reportsOk, missing[], saved, setups }
5
+ * build(facts) → model PURE. facts = { now, board, boards, outcomes, reports, reportsOk, missing[], saved, setups, pinned, leads }
6
6
  * peekModel() → the last model built, for the agent to find a chart in (null before the first)
7
7
  *
8
8
  * facts come from the routes of lib/routes-c3-strategy.js and lib/routes-reports.js:
@@ -11,10 +11,13 @@
11
11
  * reports GET /api/report → .reports [{ cadence, slot, path, status, issued: { at, by } | null, edited }]
12
12
  * saved lib/premium-dashboards.js list(root, board.id) → [{ id, name, purpose, charts: [KR metric id], main, at }] (briefing-premium-reports D1)
13
13
  * setups GET /api/report-setups → { setups, findings, asks } | null when it could not be read (briefing-premium-reports R1)
14
+ * pinned lib/premium-dashboards.js pinned(root, board.id) → 'all' | a saved id | null (insights-one-list L4)
15
+ * leads { [report path]: the opening sentence of that file } — read by the route; a path left out has none (insights-one-list L6)
14
16
  *
15
17
  * THE RULE THE FILE FOLLOWS (as the other premium models): a number, chip, line or date is made only from a field of a record. A measure with fewer than two
16
18
  * readings gets no chart and says why. The time between two readings is drawn as the time it is, so a gap in a series shows as a gap and never as a zero. No
17
- * forecast is drawn and no cause is given. Run-based series (corrections per 100 runs, merges a week) belong to the Board's Metrics card and are not built here (PRD decision 4). */
19
+ * forecast is drawn and no cause is given. One projection is said in words (initiative insights-one-list L2, amending briefing-premium-insights I6): for a
20
+ * measure short of its target with a target date ahead, a straight line through its last four readings carried to that date. Its method is stated. Run-based series (corrections per 100 runs, merges a week) belong to the Board's Metrics card and are not built here (PRD decision 4). */
18
21
 
19
22
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
20
23
  const isoDay = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
@@ -22,9 +25,12 @@ const shortDate = (v) => { const t = isoDay(v); if (t === null) return ''; const
22
25
  const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
23
26
  const fin = (v) => typeof v === 'number' && Number.isFinite(v);
24
27
  const r2 = (v) => Math.round(v * 100) / 100;
28
+ const r1 = (v) => Math.round(v * 10) / 10;
25
29
  const num = (v, unit) => { const u = String(unit || '').trim(), s = String(r2(v)); return u ? (/^[A-Za-z]/.test(u) ? s + ' ' + u : s + u) : s; };
26
30
  const CHIP = { ok: ['On its line', 'ok'], drift: ['Behind its line', 'warn'], off: ['Well behind its line', 'bad'] };
27
31
  const MAX_FINDINGS = 3;
32
+ const DAY = 864e5, WEEK = 7 * DAY;
33
+ const PROJ_N = 4; // the projection's line runs through the last four readings (insights-one-list L2)
28
34
  const KR_FILE = 'planning/records/kr-metrics.jsonl';
29
35
 
30
36
  let last = null;
@@ -56,7 +62,7 @@ function chartOf(o) {
56
62
  const rid = clip(o.id, 100);
57
63
  return {
58
64
  key: 'ins:' + rid, id: o.id, title: clip(o.name, 120), sub: [o.pillar, rs.length + ' readings'].filter(Boolean).join(' · '), pillar: o.pillar || '',
59
- unit: u, v: num(now, u), at: shortDate(rs[rs.length - 1].at), target: tgt, targetTxt: tgt !== null ? 'target ' + num(tgt, u) : '', by: o.by ? shortDate(o.by) : '',
65
+ unit: u, v: num(now, u), at: shortDate(rs[rs.length - 1].at), target: tgt, targetTxt: tgt !== null ? 'target ' + num(tgt, u) : '', by: o.by ? shortDate(o.by) : '', byAt: isoDay(o.by) !== null ? String(o.by).slice(0, 10) : null,
60
66
  ty: tgt !== null ? (tgt - lo) / range : null, state: o.status || 'unscored', chip: chip[0], chipKind: chip[1], off: o.status === 'drift' || o.status === 'off', pivot: !!o.pivot,
61
67
  step: r2(step), good, dir, first: rs[0].at, lastAt: rs[rs.length - 1].at, pts, range: [lo, hi],
62
68
  ticks: [shortDate(rs[0].at), shortDate(rs[rs.length - 1].at)],
@@ -85,34 +91,73 @@ function mineOf(m, outcomes) {
85
91
  });
86
92
  }
87
93
 
88
- /** Up to three plain sentences about what stands out, from the series alone. No forecast and no cause. */
89
- function findingsOf(charts) {
94
+ /** The projection of one chart (insights-one-list L2): a straight line through its last four readings (all, when fewer), at the dates they were taken,
95
+ * carried to the record's target date. null when the chart has no target, no target date after its last reading, or has reached its target. */
96
+ function projectionOf(c) {
97
+ if (c.target === null || !c.dir || !c.byAt) return null;
98
+ const P = c.pts.slice(-PROJ_N), a = P[0], z = P[P.length - 1], t0 = isoDay(a.at), t1 = isoDay(z.at), due = isoDay(c.byAt);
99
+ if (due === null || due <= t1 || t1 <= t0) return null;
100
+ if (c.dir > 0 ? z.v >= c.target : z.v <= c.target) return null;
101
+ const perDay = (z.v - a.v) / (t1 - t0) * DAY, atDue = z.v + perDay * (due - t1) / DAY;
102
+ const reaches = c.dir > 0 ? atDue >= c.target : atDue <= c.target, toward = perDay * c.dir > 0;
103
+ const when = toward ? t1 + (c.target - z.v) / perDay * DAY : null;
104
+ return { n: P.length, from: a, now: z.v, perWeek: perDay * 7, atDue, reaches, toward, when, short: Math.abs(c.target - atDue) };
105
+ }
106
+ const amount = (v, u) => String(u).trim() === '%' ? r2(v) + (r2(v) === 1 ? ' point' : ' points') : num(v, u);
107
+ const dayTxt = (t) => { const d = new Date(t); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()] + ' ' + d.getUTCFullYear(); };
108
+
109
+ /** Every finding of one chart, the strongest first. Each is { kind, score, text, why, key, chart }: `text` the headline, `why` one sentence with its numbers.
110
+ * Every number is a reading, the record's target or target date, or the projection said in words. No cause is given. */
111
+ function findingsOfChart(c) {
112
+ const u = c.unit, f = [];
113
+ const move = (a, b) => 'from ' + num(a, u) + ' to ' + num(b, u);
114
+ const prev = c.pts[c.pts.length - 2].v, now = c.pts[c.pts.length - 1].v, at = c.pts[c.pts.length - 1].d;
115
+ const spread = (c.range[1] - c.range[0]) || 1, tg = c.target !== null ? num(c.target, u) : '', by = c.by ? ' by ' + c.by : '';
116
+ const p = projectionOf(c);
117
+ if (c.pivot) f.push({ kind: 'stuck', score: 100, text: c.title + ' has been behind its line at three readings in a row, and the gap is not closing.', why: 'It is at ' + num(now, u) + ' on ' + at + (tg ? ', against a target of ' + tg + by : '') + '.' });
118
+ else if (c.off && c.good === false && c.step !== 0) f.push({ kind: 'worse', score: 90, text: c.title + ' is behind its line, and its last reading moved away from the target (' + move(prev, now) + ').', why: 'Its latest reading is ' + num(now, u) + ' on ' + at + (tg ? ', against a target of ' + tg + by : '') + '.' });
119
+ else if (c.off && c.good) f.push({ kind: 'closing', score: 60, text: c.title + ' is behind its line, and its last reading moved toward the target (' + move(prev, now) + ').', why: 'Its latest reading is ' + num(now, u) + ' on ' + at + (tg ? ', against a target of ' + tg + by : '') + '.' });
120
+ else if (c.off) f.push({ kind: 'off', score: 55, text: c.title + ' is behind its line at ' + num(now, u) + '.', why: tg ? 'The target is ' + tg + by + '.' : 'The record holds no target for it.' });
121
+ else if (c.state === 'ok' && c.good === false && c.step !== 0) f.push({ kind: 'slip', score: 50, text: c.title + ' is on its line, but its last reading moved away from the target (' + move(prev, now) + ').', why: 'The reading was taken on ' + at + (tg ? '. The target is ' + tg + by : '') + '.' });
122
+ if (c.target !== null && c.dir && (c.dir > 0 ? now >= c.target : now <= c.target)) f.push({ kind: 'reached', score: 58, text: c.title + ' has reached its target of ' + tg + '.', why: 'It read ' + num(now, u) + ' on ' + at + '.' });
123
+ if (p && !p.toward) f.push({ kind: 'stall', score: c.pivot ? 101 : 96, text: c.title + ' will miss its ' + tg + ' target on ' + c.by + ' unless it turns.', proj: true,
124
+ why: (c.pivot ? 'It has been behind its line at three readings in a row. ' : '') + 'Over its last ' + p.n + ' readings it went ' + move(p.from.v, p.now) + ', which is ' + (p.perWeek === 0 ? 'no move' : 'away from the target') + '. A straight line through them never reaches ' + tg + '.' });
125
+ else if (p && !p.reaches) f.push({ kind: 'miss', score: 95, text: c.title + ' will miss its ' + tg + ' target on ' + c.by + ' at this pace.', proj: true,
126
+ why: 'It is at ' + num(now, u) + ' and moving ' + amount(Math.abs(p.perWeek), u) + ' a week toward it, so it reaches about ' + num(r1(p.atDue), u) + ' by ' + c.by + ', ' + amount(r1(p.short), u) + ' short.'
127
+ + (p.when && p.when - isoDay(c.lastAt) < 5 * 365 * DAY ? ' At this pace it gets there around ' + dayTxt(p.when) + '.' : '') });
128
+ else if (p) f.push({ kind: 'course', score: 62, text: c.title + ' is short of its target but on course to reach ' + tg + by + '.', proj: true,
129
+ why: 'It is at ' + num(now, u) + ' and moving ' + amount(Math.abs(p.perWeek), u) + ' a week toward it.' });
130
+ if (Math.abs(now - prev) / spread >= 0.4 && !f.some((x) => x.score >= 90)) f.push({ kind: 'move', score: 70, text: c.title + ' moved ' + move(prev, now) + ' in one reading.', why: 'That is ' + Math.round(Math.abs(now - prev) / spread * 100) + '% of the range its readings span. The reading was taken on ' + at + '.' });
131
+ f.sort((a, b) => b.score - a.score);
132
+ return f.map((x) => Object.assign(x, { key: c.key, chart: c.key }));
133
+ }
134
+
135
+ /** The strongest finding of each chart, strongest first. `max` caps the list (three on the page). */
136
+ function findingsOf(charts, max = MAX_FINDINGS) {
90
137
  const out = [];
91
- for (const c of charts) {
92
- const u = c.unit, f = [];
93
- const move = (a, b) => 'from ' + num(a, u) + ' to ' + num(b, u);
94
- const prev = c.pts[c.pts.length - 2].v, now = c.pts[c.pts.length - 1].v;
95
- const spread = (c.range[1] - c.range[0]) || 1;
96
- if (c.pivot) f.push({ kind: 'stuck', score: 100, text: c.title + ' has been behind its line at three readings in a row, and the gap is not closing.' });
97
- else if (c.off && c.good === false && c.step !== 0) f.push({ kind: 'worse', score: 90, text: c.title + ' is behind its line, and its last reading moved away from the target (' + move(prev, now) + ').' });
98
- else if (c.off && c.good) f.push({ kind: 'closing', score: 60, text: c.title + ' is behind its line, and its last reading moved toward the target (' + move(prev, now) + ').' });
99
- else if (c.off) f.push({ kind: 'off', score: 55, text: c.title + ' is behind its line at ' + num(now, u) + '.' });
100
- else if (c.state === 'ok' && c.good === false && c.step !== 0) f.push({ kind: 'slip', score: 50, text: c.title + ' is on its line, but its last reading moved away from the target (' + move(prev, now) + ').' });
101
- if (c.target !== null && c.dir && (c.dir > 0 ? now >= c.target : now <= c.target)) f.push({ kind: 'reached', score: 58, text: c.title + ' has reached its target of ' + num(c.target, u) + '.' });
102
- if (Math.abs(now - prev) / spread >= 0.4 && !(f[0] && f[0].score >= 90)) f.push({ kind: 'move', score: 70, text: c.title + ' moved ' + move(prev, now) + ' in one reading.' });
103
- f.sort((a, b) => b.score - a.score);
104
- if (f[0]) out.push(Object.assign(f[0], { key: c.key, chart: c.key }));
105
- }
138
+ for (const c of charts) { const f = findingsOfChart(c); if (f[0]) out.push(f[0]); }
106
139
  out.sort((a, b) => b.score - a.score);
107
- return out.slice(0, MAX_FINDINGS);
140
+ return out.slice(0, max);
141
+ }
142
+
143
+ /** A dashboard's insight (insights-one-list L4, L6): its charts' findings, strongest first, at most three. The page shows the first; the pinned card skips
144
+ * the one the page already leads with. `calm` when no chart has a finding. */
145
+ function dashInsightOf(L) {
146
+ if (!L.length) return { finds: [], calm: false, none: true };
147
+ const finds = findingsOf(L, 3).map(({ kind, text, why, chart, proj }) => ({ kind, text, why, chart, proj: !!proj }));
148
+ return { finds, calm: !finds.length, none: false, calmText: L.some((c) => c.target !== null) ? 'Nothing stands out here. No measure moved much, and none is far behind its line.' : 'Nothing stands out here. No measure on it has a target.' };
108
149
  }
109
150
 
110
- function reportRows(reports) {
111
- return (reports || []).slice().sort((a, b) => String(b.slot).localeCompare(String(a.slot)) || String(a.cadence).localeCompare(String(b.cadence))).slice(0, 12).map((r) => {
151
+ const REPORTS_MAX = 60;
152
+ /** The report files, newest first. `lead` is the opening sentence of the file as the route read it (insights-one-list L6), '' when it has none. */
153
+ function reportRows(reports, leads) {
154
+ const L = leads || {};
155
+ return (reports || []).slice().sort((a, b) => String(b.slot).localeCompare(String(a.slot)) || String(a.cadence).localeCompare(String(b.cadence))).slice(0, REPORTS_MAX).map((r) => {
112
156
  const issued = !!r.issued;
113
157
  return {
114
158
  key: 'rep:' + r.cadence + ':' + r.slot, cadence: r.cadence, slot: r.slot, date: shortDate(r.slot), state: issued ? 'issued' : r.status === 'draft' ? 'draft' : 'file',
115
159
  stateLabel: issued ? 'Issued' + (r.issued.at ? ' ' + shortDate(r.issued.at) : '') : r.status === 'draft' ? 'Draft' : 'Report file', path: r.path || '',
160
+ lead: typeof L[r.path] === 'string' ? clip(L[r.path], 240) : '',
116
161
  };
117
162
  });
118
163
  }
@@ -169,6 +214,42 @@ function proposalOf(p) {
169
214
  return { name: p.name ? clip(p.name, 120) : '', rows };
170
215
  }
171
216
 
217
+ /** Each setup's latest report file (a row whose cadence is the setup's id; the rows are newest first), so its row can quote that file's opening sentence. */
218
+ function latestOf(su, rows) {
219
+ for (const s of su.setups) { const r = rows.find((x) => x.cadence === s.id); s.latest = r ? { key: r.key, date: r.date, path: r.path, lead: r.lead } : null; }
220
+ return su;
221
+ }
222
+
223
+ /** The page's insight (insights-one-list L1): the strongest finding across the board's measures with its reason, up to two more, and the counts it rests on.
224
+ * With no chart it says why there is no insight, and makes no number. */
225
+ function insightOf(charts, findings, total) {
226
+ if (!charts.length) return { none: true, text: total ? 'There is no insight yet. No KR metric holds two readings.' : 'There is no insight yet. No KR metric is recorded for this workspace.',
227
+ why: total ? 'PMOS draws an insight from the readings of your KR metrics. A measure needs two readings before it has a series.' : 'PMOS draws an insight from the readings of your KR metrics. Add one where the KR metrics are kept, and it shows here after two readings.' };
228
+ const last = charts.map((c) => c.lastAt).sort().pop(), off = charts.filter((c) => c.off).length;
229
+ const head = findings[0] || null;
230
+ return { none: false, off, total: charts.length, asOf: shortDate(last), calm: !head,
231
+ text: head ? head.text : charts.some((c) => c.target !== null) ? 'Nothing stands out. No measure moved much, and none is far behind its line.' : 'Nothing stands out. No measure here has a target, so the series can only be described.',
232
+ why: head ? head.why : '', chart: head ? head.chart : null, kind: head ? head.kind : 'calm', proj: !!(head && head.proj),
233
+ more: findings.slice(1, 3).map((x) => ({ text: x.text, chart: x.chart })) };
234
+ }
235
+
236
+ /** The opening sentence of a report file (insights-one-list L6): the first prose paragraph after the frontmatter, past headings, lists, tables, quotes, code
237
+ * and comments, cut at its first sentence end and clipped. '' when the file holds no prose. PURE. The page marks it as quoted from the file. */
238
+ function leadOf(text) {
239
+ let t = String(text || '').replace(/\r/g, '');
240
+ if (/^---\n/.test(t)) { const e = t.indexOf('\n---', 4); t = e < 0 ? '' : t.slice(e + 4); }
241
+ t = t.replace(/<!--[\s\S]*?-->/g, '').replace(/```[\s\S]*?```/g, '');
242
+ for (const para of t.split(/\n\s*\n/)) {
243
+ const lines = para.split('\n').map((x) => x.trim()).filter(Boolean);
244
+ if (!lines.length || lines.some((x) => /^(#|[-*+] |\d+[.)] |\||>|<|!\[)/.test(x))) continue;
245
+ const prose = lines.join(' ').replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1').replace(/[*_`]{1,3}([^*_`]+)[*_`]{1,3}/g, '$1').replace(/\s+/g, ' ').trim();
246
+ if (prose.length < 12) continue;
247
+ const m = /^(.+?[.!?])(\s+(?=[A-Z0-9"“(])|$)/.exec(prose);
248
+ return clip(m ? m[1] : prose, 220);
249
+ }
250
+ return '';
251
+ }
252
+
172
253
  function build(facts) {
173
254
  const f = facts || {};
174
255
  const outcomes = f.outcomes || [], missing = (f.missing || []).slice();
@@ -185,7 +266,9 @@ function build(facts) {
185
266
  const dash = (id, name, L) => ({ id, name, keys: L.map((c) => c.key), total: L.length, off: offOf(L), chip: !L.length ? '' : offOf(L) ? offOf(L) + ' off its line' : 'On their lines' });
186
267
  const dashboards = [dash('all', 'All measures', charts)].concat(savedOf(f.saved, outcomes, charts.concat(mine), mineAll), pillars.length > 1 ? pillars.map((p) => dash('p:' + p, p, charts.filter((c) => c.pillar === p))) : []);
187
268
  const findings = findingsOf(charts);
188
- const rep = reportRows(f.reports);
269
+ const rep = reportRows(f.reports, f.leads);
270
+ for (const d of dashboards) Object.assign(d, { insight: dashInsightOf(d.keys.map((k) => charts.concat(mine).find((c) => c.key === k)).filter(Boolean)) });
271
+ const pin0 = f.pinned !== undefined ? f.pinned : ((f.saved || []).find((d) => d.main) || {}).id, pinned = pin0 && dashboards.some((d) => d.id === pin0) ? pin0 : null;
189
272
  const off = offOf(charts);
190
273
  const board = f.board || {};
191
274
  const model = {
@@ -194,7 +277,9 @@ function build(facts) {
194
277
  charts, mine, mineGone, mineSaved: mineAll, noSeries, dashboards, rows: charts,
195
278
  findings: findings.length ? findings : [{ kind: 'calm', key: null, text: charts.length ? (charts.some((c) => c.target !== null) ? 'Nothing stands out. No measure moved much, and none is far behind its line.' : 'Nothing stands out. No measure here has a target, so the series can only be described.') : '' }],
196
279
  calm: !findings.length && charts.length > 0,
197
- reports: Object.assign({ rows: rep, ok: f.reportsOk !== false, counts: { draft: rep.filter((r) => r.state === 'draft').length, issued: rep.filter((r) => r.state === 'issued').length }, missing: f.reportsOk === false }, setupsOf(f.setups, f.now)),
280
+ reports: Object.assign({ rows: rep, ok: f.reportsOk !== false, counts: { draft: rep.filter((r) => r.state === 'draft').length, issued: rep.filter((r) => r.state === 'issued').length }, missing: f.reportsOk === false }, latestOf(setupsOf(f.setups, f.now), rep)),
281
+ insight: insightOf(charts, findings, outcomes.length),
282
+ pinned,
198
283
  measures: outcomes.map((o) => ({ id: o.id, title: clip(o.name, 120), pillar: o.pillar || '', charted: charts.some((c) => c.id === o.id) })),
199
284
  empty: !outcomes.length ? 'No KR metric is recorded for this workspace, so there is nothing to chart. Add one where the KR metrics are kept.' : !charts.length ? 'No KR metric holds two readings yet, so nothing is drawn.' : '',
200
285
  dock: { needs: off, label: off === 1 ? 'measure off its line' : 'measures off their line', next: findings[0] && findings[0].chart ? (charts.find((c) => c.key === findings[0].chart) || {}).title || null : null },
@@ -204,4 +289,4 @@ function build(facts) {
204
289
  return model;
205
290
  }
206
291
 
207
- module.exports = { build, peekModel, chartOf, mineOf, findingsOf, shortDate, num };
292
+ module.exports = { build, peekModel, chartOf, mineOf, findingsOf, findingsOfChart, projectionOf, leadOf, shortDate, num };