create-pmos 0.327.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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-insights-test.js +56 -25
  7. package/workspace/guide/briefing-premium.md +11 -5
  8. package/workspace/guide/docs.md +3 -0
  9. package/workspace/lib/doc-reads-store.js +90 -0
  10. package/workspace/lib/doc-reads.js +128 -0
  11. package/workspace/lib/doc-sync-store.js +1 -1
  12. package/workspace/lib/docs-cli.js +48 -3
  13. package/workspace/lib/insights-premium.js +111 -26
  14. package/workspace/lib/premium-dashboards.js +25 -5
  15. package/workspace/lib/routes-insights-premium.js +19 -4
  16. package/workspace/lib/routes-premium-dashboards.js +12 -1
  17. package/workspace/package-lock.json +2 -2
  18. package/workspace/package.json +1 -1
  19. package/workspace/premium-report-read-test.js +4 -2
  20. package/workspace/premium-studio-chart-test.js +3 -3
  21. package/workspace/premium-studio-report-test.js +1 -1
  22. package/workspace/premium-studio-test.js +4 -4
  23. package/workspace/premium-vw-copy-test.js +133 -0
  24. package/workspace/premium-vw-slides-test.js +8 -4
  25. package/workspace/public/pm/premium-doc-sheet.js +3 -1
  26. package/workspace/public/pm/premium-insights.css +52 -0
  27. package/workspace/public/pm/premium-insights.js +129 -50
  28. package/workspace/public/pm/premium-meeting.js +3 -2
  29. package/workspace/public/pm/premium-vw-copies.js +133 -0
  30. package/workspace/public/pm/premium-vw-copy.css +27 -0
  31. package/workspace/public/premium-insights.html +29 -19
  32. package/workspace/server.js +42 -0
  33. package/workspace/skills/doc-read.skill +32 -0
  34. package/workspace/test-lists/doc-reads.json +5 -0
  35. package/workspace/test-lists/premium-vw-copy.json +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.327.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@3505546
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:04:19Z"}
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:04:19Z"}
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:04:19Z"}
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
  }
@@ -191,6 +191,10 @@ Every markdown document opens as one page in a tab: a report, a PRD, a new docum
191
191
  - **Health**, **Links** and **Copies** under the toolbar show the document's checks, the documents it links to, and its linked copies. The checks only read the file.
192
192
  - A report also shows **Present**, **Print** and **Download** on the same toolbar.
193
193
 
194
+ ### Confluence pages and Google Docs
195
+
196
+ A Confluence page or Google Doc opens as a tab too. From a document's **Copies**, press **Preview** on a copy. If the last check found the same text in both, the PMOS file is shown as the page, with **Same as PMOS** and the check time. If the copy changed, the tab says so and shows the PMOS version dimmed. **Use the … version** writes the copy's text into the PMOS file after five seconds; press **Undo** to stop it. From a meeting's **Material**, press the page icon on a Google Doc or Confluence link. PMOS holds only the address of such a page, so the tab says so. **Read it now** starts one session that reads the page with your connector and keeps the text in PMOS; it changes nothing in Google Docs or Confluence. The tab then shows the text with when it was read. Press **Read again** for later edits.
197
+
194
198
  A decision opens with no option chosen, because no recommendation is on record. Choose one and the draft entry on the right changes. Nothing is written. The main button, "Not yet" and "Return this run to the agent" are off in this version, and each says why.
195
199
 
196
200
  ## The conversation
@@ -305,23 +309,25 @@ Not drawn, because PMOS holds no record for them: the mockup's demo tasks, its J
305
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.
306
310
 
307
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.
308
- - **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.
309
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.
310
- - **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.
311
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.
312
- - **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.
313
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.
314
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.
315
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.
316
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.
317
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.
318
- - **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.
319
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.
320
326
  - **No series recorded.** A KR metric with one reading or none is listed with the reason and is not drawn.
321
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**.
322
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.
323
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**.
324
- - **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.
325
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**.
326
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.
327
333
 
@@ -147,5 +147,8 @@ A link that you add in an initiative's artifacts is the same link and shows here
147
147
  | `pmos docs sync-start <file> confluence --use pmos` | Used by the sync session: opens a sync of one copy (`--use copy` for the other direction). |
148
148
  | `pmos docs sync-finish <sync> --version <v>` | Used by the sync session: closes the sync. The two sides are now the same. |
149
149
  | `pmos docs sync-fail <sync> --reason "…"` | Used by the sync session: closes the sync. Nothing was written. |
150
+ | `pmos docs read-start <address>` | Used by the read session: opens a read of one Google Doc or Confluence page. |
151
+ | `pmos docs read-finish <read> --file <text.md>` | Used by the read session: records the text it read (from stdin without `--file`). |
152
+ | `pmos docs read-fail <read> --reason "…"` | Used by the read session: closes the read. Nothing was read. |
150
153
 
151
154
  The session commands must name who read or wrote. In a workspace session that is the session. Outside the workspace, add `--by <profile>`.
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+ /* doc-reads-store.js — the file side of "Read it now". lib/doc-reads.js decides; this module reads and appends.
3
+ *
4
+ * The ledger is doc-reads.jsonl, in the same state directory as doc-checks.jsonl (lib/doc-sync-store.js#stateDir).
5
+ * Every write goes through doc-reads.js#checkRow, so a refused row is never on disk. Nothing here reads a page.
6
+ *
7
+ * latest(root, url, { now }) → { ok, kind, read, open, failed }
8
+ * readStart(root, { url, by, now }) → { ok, run, url, kind, remote_id } | { ok:false, code, error }
9
+ * readFinish(root, { run, by, text, title, revision, modified_at, now }) → { ok, truncated }
10
+ * readFail(root, { run, by, reason, now }) → { ok }
11
+ *
12
+ * Refusal codes: 'kind' (not a Google Doc or Confluence page), 'open' (a read of that page is open), 'run' (no such
13
+ * open read), 'state' (no state directory), 'row' (checkRow refused).
14
+ */
15
+ const crypto = require('crypto');
16
+ const fourPanel = require('./four-panel');
17
+ const DS = require('./doc-sync');
18
+ const R = require('./doc-reads');
19
+ const { stateDir } = require('./doc-sync-store');
20
+
21
+ const LEDGER = 'doc-reads.jsonl';
22
+
23
+ function readRows(root) {
24
+ const s = stateDir(root);
25
+ if (!s.ok) return { ok: false, code: 'state', error: s.error, rows: [] };
26
+ return fourPanel.readDeclarations(s.dir, LEDGER);
27
+ }
28
+ function append(root, row) {
29
+ const c = R.checkRow(row);
30
+ if (!c.ok) return { ok: false, code: 'row', error: c.error };
31
+ const s = stateDir(root);
32
+ if (!s.ok) return { ok: false, code: 'state', error: s.error };
33
+ return fourPanel.appendDeclaration(s.dir, LEDGER, c.row);
34
+ }
35
+ const t = (now) => (now instanceof Date ? now : new Date(now == null ? Date.now() : now));
36
+ const newRunId = () => 'r-' + crypto.randomBytes(6).toString('hex');
37
+ const KIND_ERROR = 'give the address of a Google Doc or a Confluence page (Slides and Sheets are not read yet)';
38
+
39
+ function latest(root, url, { now = Date.now() } = {}) {
40
+ const kind = R.kindOf(url);
41
+ if (!kind) return { ok: false, code: 'kind', error: KIND_ERROR };
42
+ const rows = readRows(root);
43
+ if (!rows.ok) return rows;
44
+ return { ok: true, kind, ...R.latestFor(rows.rows, url, { now: t(now).getTime() }) };
45
+ }
46
+
47
+ /** Open a read of one page. Refused while another read of that page is open. */
48
+ function readStart(root, { url, by, now } = {}) {
49
+ const u = String(url || '').trim();
50
+ const kind = R.kindOf(u);
51
+ if (!kind) return { ok: false, code: 'kind', error: KIND_ERROR };
52
+ if (!by) return { ok: false, code: 'row', error: 'a read must name the session or profile that runs it' };
53
+ const at = t(now);
54
+ const rows = readRows(root);
55
+ if (!rows.ok) return rows;
56
+ const cur = R.latestFor(rows.rows, u, { now: at.getTime() });
57
+ if (cur.open) return { ok: false, code: 'open', error: `that page is already being read (${cur.open.run}, started ${cur.open.started_at})`, open: cur.open };
58
+ const run = newRunId();
59
+ const w = append(root, { v: 1, ev: 'start', run, url: u, kind, by, at: at.toISOString() });
60
+ if (!w.ok) return w;
61
+ return { ok: true, run, url: u, kind, label: DS.KIND_LABEL[kind], remote_id: DS.remoteIdOf(kind, u) };
62
+ }
63
+
64
+ function openRun(root, run) {
65
+ const rows = readRows(root);
66
+ if (!rows.ok) return rows;
67
+ const x = R.runsOf(rows.rows).find((r) => r.run === run);
68
+ if (!x) return { ok: false, code: 'run', error: `${run || 'that'} is not a read that was started — run pmos docs read-start first` };
69
+ if (x.state !== 'open') return { ok: false, code: 'run', error: `${run} is already ${x.state}` };
70
+ return { ok: true, run: x };
71
+ }
72
+
73
+ /** Close a read with what the session read. The address and kind come from the start row, not the caller. */
74
+ function readFinish(root, { run, by, text, title, revision, modified_at, now } = {}) {
75
+ const o = openRun(root, run);
76
+ if (!o.ok) return o;
77
+ const w = append(root, { v: 1, ev: 'finish', run, url: o.run.url, kind: o.run.kind, by, at: t(now).toISOString(),
78
+ title: title || null, revision: revision == null ? null : String(revision), modified_at: modified_at || null, text });
79
+ if (!w.ok) return w;
80
+ return { ok: true, run, url: o.run.url, kind: o.run.kind, truncated: !!w.recorded.truncated, chars: w.recorded.text.length };
81
+ }
82
+
83
+ function readFail(root, { run, by, reason, now } = {}) {
84
+ const o = openRun(root, run);
85
+ if (!o.ok) return o;
86
+ const w = append(root, { v: 1, ev: 'fail', run, url: o.run.url, kind: o.run.kind, by, at: t(now).toISOString(), reason });
87
+ return w.ok ? { ok: true, run } : w;
88
+ }
89
+
90
+ module.exports = { LEDGER, readRows, latest, readStart, readFinish, readFail };
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+ /* doc-reads.js — "Read it now": a read-only snapshot of one Google Doc or Confluence page, by address.
3
+ *
4
+ * No route reads Google or Confluence (D53). The PM presses Read it now; a doc-read session reads the page with the
5
+ * PM's own connector and records it through `pmos docs read-finish`. This module decides which rows are valid and
6
+ * what the latest read of an address is. lib/doc-reads-store.js reads and appends the ledger.
7
+ *
8
+ * PURE: no file, no network, no clock. The caller passes `now`.
9
+ *
10
+ * checkRow(row) → { ok:true, row } | { ok:false, error } the gate every ledger line passes
11
+ * kindOf(url) → 'google' | 'confluence' | null Slides and Sheets are refused for now
12
+ * keyOf(url) → '<kind>:<remote id>' | null one page pasted in two shapes is one key
13
+ * latestFor(rows, url, { now }) → { read, open, failed }
14
+ *
15
+ * Row: { v:1, ev:'start'|'finish'|'fail', run:'r-…', url, kind, by, at, title?, revision?, modified_at?, text?, reason? }
16
+ * A finish names who read and the run it belongs to, and carries the text (markdown). A fail says why.
17
+ */
18
+ const DS = require('./doc-sync');
19
+
20
+ const KINDS = Object.freeze(['google', 'confluence']);
21
+ const EVENTS = Object.freeze(['start', 'finish', 'fail']);
22
+ const RUN_ID = DS.RUN_ID;
23
+ // The text a finish may carry. Longer text is cut here and the row says `truncated: true`.
24
+ const MAX_TEXT = 200 * 1024;
25
+ // A read left open this long has ended without saying so (the session closed). The page may be read again.
26
+ const OPEN_READ_MS = 10 * 60 * 1000;
27
+
28
+ const str = (v, n = 300) => (v == null || v === '' ? null : String(v).slice(0, n));
29
+ const isObj = (v) => v && typeof v === 'object' && !Array.isArray(v);
30
+ const isTime = (s) => !Number.isNaN(Date.parse(s));
31
+
32
+ /** The kind of a pasted address: a Google Doc or a Confluence page. Slides, Sheets and anything else: null. */
33
+ function kindOf(url) {
34
+ const k = DS.kindOfTarget(url);
35
+ return KINDS.includes(k) ? k : null;
36
+ }
37
+
38
+ /** One key per page, so the same page pasted with /edit or ?pageId= is the same read. */
39
+ function keyOf(url) {
40
+ const kind = kindOf(url);
41
+ if (!kind) return null;
42
+ const id = DS.remoteIdOf(kind, String(url).trim());
43
+ return id ? `${kind}:${id}` : null;
44
+ }
45
+
46
+ /** The one gate every ledger line passes. A refused row is never written, and the readers skip it. */
47
+ function checkRow(input) {
48
+ if (!isObj(input)) return { ok: false, error: 'a ledger row is an object' };
49
+ if (input.v !== 1) return { ok: false, error: 'v must be 1' };
50
+ const ev = String(input.ev || '');
51
+ if (!EVENTS.includes(ev)) return { ok: false, error: `ev must be one of: ${EVENTS.join(', ')}` };
52
+ const at = str(input.at, 40);
53
+ if (!at || !isTime(at)) return { ok: false, error: 'at must be an ISO time' };
54
+ if (!RUN_ID.test(String(input.run || ''))) return { ok: false, error: 'run must name the read it belongs to (r-…)' };
55
+ const by = str(input.by, 120);
56
+ if (!by) return { ok: false, error: 'a read row must name the session or profile that made it' };
57
+ const url = str(input.url, 2000);
58
+ const kind = url ? kindOf(url) : null;
59
+ if (!kind) return { ok: false, error: `url must be the address of a ${KINDS.map((k) => DS.KIND_LABEL[k]).join(' or ')} page` };
60
+ if (input.kind != null && input.kind !== kind) return { ok: false, error: `kind ${input.kind} does not match the address (${kind})` };
61
+ const row = { v: 1, ev, run: input.run, url, kind, by, at };
62
+
63
+ if (ev === 'finish') {
64
+ if (typeof input.text !== 'string' || !input.text.trim()) return { ok: false, error: 'a finished read carries the text it read' };
65
+ const modified_at = str(input.modified_at, 40);
66
+ if (modified_at && !isTime(modified_at)) return { ok: false, error: 'modified_at must be an ISO time' };
67
+ row.title = str(input.title, 300);
68
+ row.revision = str(input.revision, 120);
69
+ row.modified_at = modified_at;
70
+ row.text = input.text.slice(0, MAX_TEXT);
71
+ if (input.text.length > MAX_TEXT || input.truncated === true) row.truncated = true;
72
+ }
73
+ if (ev === 'fail') {
74
+ const reason = str(input.reason, 400);
75
+ if (!reason) return { ok: false, error: 'a failed read says why' };
76
+ row.reason = reason;
77
+ }
78
+ return { ok: true, row };
79
+ }
80
+
81
+ /** Every read of every page, by key: { run, key, url, kind, started_at, start_by, ended_at, state, row }. */
82
+ function runsOf(rows) {
83
+ const runs = new Map();
84
+ for (const raw of Array.isArray(rows) ? rows : []) {
85
+ const c = checkRow(raw);
86
+ if (!c.ok) continue;
87
+ const r = c.row;
88
+ const key = keyOf(r.url);
89
+ if (r.ev === 'start') {
90
+ if (!runs.has(r.run)) runs.set(r.run, { run: r.run, key, url: r.url, kind: r.kind, started_at: r.at, start_by: r.by, state: 'open', ended_at: null, row: null });
91
+ continue;
92
+ }
93
+ // A finish or fail counts only for a run that was started, for the same page, and only once.
94
+ const cur = runs.get(r.run);
95
+ if (!cur || cur.key !== key || cur.state !== 'open') continue;
96
+ cur.state = r.ev === 'finish' ? 'finished' : 'failed';
97
+ cur.ended_at = r.at;
98
+ cur.row = r;
99
+ }
100
+ return [...runs.values()];
101
+ }
102
+
103
+ /**
104
+ * The latest read of one address, the read still open, and the last failure after the last read.
105
+ * `now` (ms) ages an open read out after OPEN_READ_MS; without it an open read stays open.
106
+ */
107
+ function latestFor(rows, url, { now } = {}) {
108
+ const key = keyOf(url);
109
+ const none = { read: null, open: null, failed: null };
110
+ if (!key) return none;
111
+ const mine = runsOf(rows).filter((x) => x.key === key);
112
+ const done = mine.filter((x) => x.state === 'finished').sort((a, b) => a.ended_at.localeCompare(b.ended_at)).pop() || null;
113
+ const read = done ? {
114
+ title: done.row.title, revision: done.row.revision, modified_at: done.row.modified_at, read_at: done.ended_at,
115
+ by: done.row.by, text: done.row.text, ...(done.row.truncated ? { truncated: true } : {}), run: done.run,
116
+ } : null;
117
+ const live = (x) => x.state === 'open' && (now == null || now - Date.parse(x.started_at) < OPEN_READ_MS);
118
+ const o = mine.filter(live).sort((a, b) => a.started_at.localeCompare(b.started_at)).pop() || null;
119
+ const lastFail = mine.filter((x) => x.state === 'failed' && (!done || x.ended_at > done.ended_at))
120
+ .sort((a, b) => a.ended_at.localeCompare(b.ended_at)).pop() || null;
121
+ return {
122
+ read,
123
+ open: o ? { run: o.run, started_at: o.started_at } : null,
124
+ failed: !o && lastFail ? { run: lastFail.run, reason: lastFail.row.reason, at: lastFail.ended_at } : null,
125
+ };
126
+ }
127
+
128
+ module.exports = { KINDS, EVENTS, RUN_ID, MAX_TEXT, OPEN_READ_MS, checkRow, kindOf, keyOf, runsOf, latestFor };
@@ -319,4 +319,4 @@ function findFiles(root, q, { limit = 20 } = {}) {
319
319
  });
320
320
  }
321
321
 
322
- module.exports = { LEDGER, OPEN_RUN_MS, OPEN_SYNC_MS, syncStart, syncFinish, syncFail, findFiles, view, addLink, removeLink, checkStart, record, checkFinish, repoInfo, bodyHash, bodyOf, titleOf, links };
322
+ module.exports = { LEDGER, OPEN_RUN_MS, OPEN_SYNC_MS, stateDir, syncStart, syncFinish, syncFail, findFiles, view, addLink, removeLink, checkStart, record, checkFinish, repoInfo, bodyHash, bodyOf, titleOf, links };