create-pmos 0.482.0 → 0.483.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.482.0",
3
+ "version": "0.483.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.482.0",
9
+ "version": "0.483.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.482.0",
3
+ "version": "0.483.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -5,10 +5,12 @@
5
5
  * here; every report press goes to the real report-setups and report-documents routes.
6
6
  * R1 at 1280 a pmos-report block is a chip under Claude's words, never JSON; opening the chat opens no tab; the chip opens the Report tab
7
7
  * R2 a new answer with a block opens the Report tab by itself
8
- * R3 a new report shows its name, audience, format, the seven sections and Schedule Off · runs once; a pick changes the chip only
9
- * R4 Set it up with Schedule Off records the report, writes its first draft and pauses it: the tab turns into the template, schedule Off
10
- * R5 the Schedule chip on a template changes the schedule through the route
11
- * R6 a draft is discarded after a confirm; the template is deleted after a confirm, and the tab says its reports stay
8
+ * R3 (batch 22 item 14, canvas RfH4) a new report asks its questions first, Claude's picks filled in: Format, Readers, Goes out, Look,
9
+ * Sources, Nothing goes out and Draft it; a pick writes nothing
10
+ * R4 Draft it with Once records the report, T1 and the conversation, writes its first draft and pauses it; the report's current state opens:
11
+ * the reader with Claude's review (RfH2) and the template icon
12
+ * R5 the template (RfH3): a changed format is marked, Make a different template applies it as T2, Go back to T1 restores it
13
+ * R6 under Sections, look and cycles: a draft is discarded after a confirm; the template is deleted after a confirm, and its reports stay
12
14
  * R7 at 390 the chip covers the page with the Report tab; no sideways scroll; no page error
13
15
  * Set REPORT_TAB_SHOTS=<dir> to save the page at 1280 and 390, light and dark. */
14
16
  const fs = require('fs');
@@ -43,7 +45,8 @@ const ANSWER = { role: 'assistant', text: 'Signups from the lightbox rose to 1,2
43
45
  * card ([data-rt="askyes"]). */
44
46
  const look = () => {
45
47
  const vw = document.querySelector('#czViewer:not([hidden])'), pane = vw ? vw.querySelector('.vz[data-vw^="report:"]') : null;
46
- return { shut: !pane, layer: false, chip: (document.querySelector('#hmLog [data-report-open]') || {}).textContent || null,
48
+ return { shut: !pane, title: vw ? ((vw.querySelector('.cz-vw-title') || {}).textContent || '') : '', reader: !!(vw && vw.querySelector('.vz-rp0')), review: vw && vw.querySelector('.rf-rv') ? vw.querySelector('.rf-rv').textContent : null,
49
+ tpl: !!(vw && vw.querySelector('[data-cz-vw-p="template"]')), layer: false, chip: (document.querySelector('#hmLog [data-report-open]') || {}).textContent || null,
47
50
  json: /pmos-report|"kind"/.test((document.querySelector('#hmLog') || {}).textContent || ''), user: [...document.querySelectorAll('#hmLog .hm-u .hm-bub')].map((u) => u.textContent.trim()),
48
51
  tabs: pane ? [(vw.querySelector('.cz-vw-kind') || {}).textContent || ''] : [], pane: pane ? pane.textContent.replace(/\s+/g, ' ').trim() : null,
49
52
  secs: pane ? (pane.querySelector('.vz-dkt') ? pane.querySelectorAll('.vz-dkt button').length - 1 : pane.querySelectorAll('.vz-secs li').length) : 0,
@@ -66,7 +69,7 @@ const look = () => {
66
69
  const open = async (width, scheme, messages) => {
67
70
  const st = { messages };
68
71
  const ctx = await browser.newContext({ viewport: { width, height: width < 1000 ? 844 : 860 }, colorScheme: scheme, hasTouch: width < 1000 });
69
- const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e)));
72
+ const p = await ctx.newPage(); const errs = []; p.on('pageerror', (e) => errs.push(String(e.stack || e)));
70
73
  await p.route('**/api/briefing-premium/thread?**', (r) => r.fulfill({ json: { ok: true, turns: [], session: 's-rep', goal: null } }));
71
74
  await p.route('**/api/sessions/conversation?**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'pm', messages: st.messages } }));
72
75
  await p.goto(chat + '&about=work:report-test'); // premium-agreed-design: /premium-chat.html opens Home with the chat ?about names; on a phone the chat is the page
@@ -81,33 +84,37 @@ const look = () => {
81
84
  ok('R1 opening the chat opens no tab by itself', s0.tabs.length === 0, JSON.stringify(s0));
82
85
  await p.click('#hmLog [data-report-open]');
83
86
  const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane ? v : null; }) || await p.evaluate(look);
84
- ok('R3 the new report opens the one report Viewer in its first state (OvReport): New · from your chat, Not set up yet, Set it up as an icon, the chips Once and the format, Slides | Document, a title slide and seven section slides, the folds At a glance and Structure and look', /Report · Growth leads/.test(s1.tabs.join(' ')) && /Social login weekly/.test(s1.pane || '') && !/Waiting for design/.test(s1.pane || '')
85
- && s1.sum && s1.sum.line === 'New · from your chatNot set up yet' && s1.sum.pri === 'Set it up' && s1.sum.chips === 'Once,Google Slides' && s1.sum.seg === 'Slides,Document' && s1.sum.folds === 'At a glanceFor, read by, goes out|Structure and looknew'
86
- && /One slide per section: Headline, Timeline/.test(s1.pane || '') && s1.secs === 7 && s1.slide === 'Slide 1 of 8' && s1.sched === 'Once' && !(await p.$('#czViewer .rt, #czViewer .obody, #dlg:not([hidden])')), JSON.stringify(s1));
87
- await p.click('#czViewer .czs-row[data-czs-fold="glance"]');
88
- ok('R3 At a glance opens with For, Read by, Goes out and Format', await until(() => p.evaluate(() => /Read byGrowth leads/.test(document.querySelector('#czViewer .czs-sec.on').textContent) && /FormatGoogle Slides/.test(document.querySelector('#czViewer .czs-sec.on').textContent) && /Goes outOff · runs once/.test(document.querySelector('#czViewer .czs-sec.on').textContent))));
89
- await p.click('#czViewer .czs-row[data-czs-fold="glance"]');
90
- await p.click('#czViewer [data-rt="view|doc"]');
91
- ok('R3 Document shows the outline as a page, and Slides brings the deck back', await until(() => p.evaluate(() => document.querySelectorAll('#czViewer .vz-dkp .vz-secs li').length === 7 && !document.querySelector('#czViewer .vz-dks'))));
92
- await p.click('#czViewer [data-rt="view|deck"]');
93
- await p.click('#czViewer [data-rt="sl|1"]');
94
- ok('R3 next shows the second slide, a section of the report', /Slide 2 of 8/.test((await p.evaluate(look)).slide || '') && /Headline/.test(await p.textContent('#czViewer .vz-dks')));
87
+ ok('R3 a new report asks its questions first (RfH4): Waits on your answers, Claude\'s picks filled in (Slides, Growth leads, Once), the standard look, its sources, Nothing goes out and Draft it', /Report · Growth leads/.test(s1.tabs.join(' ')) && /Social login weekly/.test(s1.title)
88
+ && /Waits on your answers/.test(s1.pane || '') && /my pick/.test(s1.pane || '') && /Standard PMOS look/.test(s1.pane || '') && /GA4/.test(s1.pane || '') && /Nothing goes out/.test(s1.pane || '')
89
+ && await p.evaluate(() => document.querySelector('#czViewer [data-rt="fmt|google-slides"]').getAttribute('aria-checked') === 'true' && document.querySelector('#czViewer [data-rt="rep|0"]').getAttribute('aria-checked') === 'true' && document.querySelector('#czViewer input[data-rt="aud"]').value === 'Growth leads' && !!document.querySelector('#czViewer [data-rt="draftit"]:not([disabled])'))
90
+ && !/Customer service|Follow a sample deck/.test(s1.pane || '') && !(await p.$('#czViewer .rt, #czViewer .obody, #dlg:not([hidden])')), JSON.stringify(s1));
95
91
  if (shots) await p.screenshot({ path: `${shots}/new-1280-light.png` });
96
- await p.click('#czViewer [data-rt="sched"]');
97
- await p.click('#czViewer [data-rt="pick|2"]');
98
- const s2 = await until(async () => { const v = await p.evaluate(look); return v.sched && /Every week/.test(v.sched) ? v : null; }) || await p.evaluate(look);
99
- ok('R3 a pick changes the chip only: nothing is written', s2.sched === 'Every week' && !ledger().some((l) => l.ev === 'setup'), JSON.stringify(s2));
100
- await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|0"]');
101
- await p.click('#czViewer [data-rt="setup"]');
102
- const s3 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Report template/.test(v.tabs.join()) && /Draft/.test(v.pane) ? v : null; }, 15000) || await p.evaluate(look);
92
+ await p.click('#czViewer [data-rt="rep|1"]');
93
+ const rp = await until(() => p.evaluate(() => !!document.querySelector('#czViewer select[data-rt="cad"]') && !!document.querySelector('#czViewer select[data-rt="day"]')));
94
+ ok('R3 Repeats asks how often, the day and the time; a pick writes nothing', rp && !ledger().some((l) => l.ev === 'setup'));
95
+ await p.click('#czViewer [data-rt="rep|0"]');
96
+ await p.click('#czViewer [data-rt="draftit"]');
97
+ const s3 = await until(async () => { const v = await p.evaluate(look); return v.reader && v.review != null ? v : null; }, 20000) || await p.evaluate(look);
103
98
  const L = ledger(), setup = L.find((l) => l.ev === 'setup');
104
- ok('R4 Set it up records the report and pauses it (Schedule Off: it runs once); the tab shows the template', !!setup && L.some((l) => l.ev === 'pause' && l.id === setup.id) && s3.sched === 'Off · runs once' && /Report template/.test(s3.tabs.join()), JSON.stringify([s3, L.map((l) => l.ev)]));
105
- ok('R4 its first draft is written and listed as a draft with Discard', /Draft/.test(s3.pane || '') && /Discard/.test(s3.pane || ''), JSON.stringify(s3));
99
+ const T1 = setup ? require('./lib/report-templates.js').fold(require('./lib/report-templates.js').readLines(F.team, setup.id)) : null;
100
+ ok('R4 Draft it records the report, pauses it (Once) and records T1', !!setup && setup.output === 'google-slides' && setup.audience === 'Growth leads' && L.some((l) => l.ev === 'pause' && l.id === setup.id) && T1 && T1.current === 1, JSON.stringify([L.map((l) => l.ev), T1]));
101
+ ok('R4 the report\'s current state opens: its first draft in the reader, Claude\'s review under it (RfH2), the template icon in the header', s3.reader && /I read it as your readers would/.test(s3.review || '') && s3.tpl, JSON.stringify(s3).slice(0, 600));
102
+ if (shots) await p.screenshot({ path: `${shots}/draft-1280-light.png` });
103
+ await p.click('#czViewer [data-cz-vw-p="template"]');
104
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz[data-panel="template"] [data-rt="fmt|google-doc"]')));
105
+ await p.click('#czViewer [data-rt="fmt|google-doc"]');
106
+ const t1 = await until(() => p.evaluate(() => { const v = document.querySelector('#czViewer .vz[data-panel="template"]'); return v && /changed, not saved yet/.test(v.textContent) ? v.textContent.replace(/\s+/g, ' ') : null; }));
107
+ ok('R5 a changed format is marked and makes a different template (RfH3)', !!t1 && /Format: Slides → Document/.test(t1) && /This makes a different template/.test(t1) && /Template history/.test(t1), t1);
108
+ await p.click('#czViewer [data-rt="maketpl"]');
109
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer [data-rt="restore|1"]')), 10000);
110
+ const c1 = RS.fold(ledger()).setups.get(setup.id);
111
+ ok('R5 Make a different template applies it as T2, and T1 keeps Go back', c1.output === 'google-doc' && require('./lib/report-templates.js').fold(require('./lib/report-templates.js').readLines(F.team, setup.id)).current === 2, JSON.stringify(c1.output));
106
112
  if (shots) await p.screenshot({ path: `${shots}/template-1280-light.png` });
107
- await p.click('#czViewer [data-rt="sched"]'); await p.click('#czViewer [data-rt="pick|3"]');
108
- const s4 = await until(async () => { const v = await p.evaluate(look); return v.sched && /Every two weeks/.test(v.sched) ? v : null; }) || await p.evaluate(look);
109
- const changed = RS.fold(ledger()).setups.get(setup && setup.id);
110
- ok('R5 the Schedule chip changes a template through the route and resumes it', !!changed && changed.status === 'active' && changed.schedule.cadence === 'bi-weekly' && /Every two weeks/.test(s4.sched || ''), JSON.stringify([s4.sched, changed]));
113
+ await p.click('#czViewer [data-rt="restore|1"]');
114
+ await until(() => p.evaluate(() => /Back to T1/.test((document.querySelector('#czViewer .vz[data-panel="template"]') || {}).textContent || '')), 10000);
115
+ ok('R5 Go back to T1 restores its format; nothing is deleted', RS.fold(ledger()).setups.get(setup.id).output === 'google-slides' && require('./lib/report-templates.js').fold(require('./lib/report-templates.js').readLines(F.team, setup.id)).versions.length === 2);
116
+ await p.click('#czViewer [data-rt="manage"]');
117
+ await until(() => p.evaluate(() => !!document.querySelector('#czViewer .vz[data-panel="manage"] [data-rt="view|design"]')), 10000);
111
118
  /* R8 the look conversation's card (canvas RpDesign): D1 is the saved look, D2 a new one; Design previews D2 beside the current look */
112
119
  const RDS = require('./lib/report-design.js');
113
120
  const look1 = '<style>.pmos-slide{background:#fff}</style><section class="pmos-slide" data-title="Headline"><h2>Light, long</h2></section>';
@@ -130,8 +137,8 @@ const look = () => {
130
137
  const s6 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Template deleted/.test(v.pane) ? v : null; }) || await p.evaluate(look);
131
138
  ok('R6 Delete template asks once, then the template is gone and the tab says its reports stay', /Template deleted/.test(s6.pane || '') && ledger().some((l) => l.ev === 'remove'), JSON.stringify(s6));
132
139
  st.messages = [ASK, ANSWER, { role: 'user', text: '[PMOS report] rule\n\nThe PM says: one for the board too' }, { role: 'assistant', text: 'Here.\n\n' + block({ kind: 'report', proposal: { ...PROP.proposal, name: 'Board summary' } }) }];
133
- const s7 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Board summary/.test(v.pane) ? v : null; }) || await p.evaluate(look);
134
- ok('R2 a new answer with a block opens the Report tab by itself', /Board summary/.test(s7.pane || ''), JSON.stringify(s7));
140
+ const s7 = await until(async () => { const v = await p.evaluate(look); return v.pane && /Board summary/.test(v.title) ? v : null; }) || await p.evaluate(look);
141
+ ok('R2 a new answer with a block opens the Report tab by itself, on its questions', /Board summary/.test(s7.title) && /Waits on your answers/.test(s7.pane || ''), JSON.stringify(s7));
135
142
  ok('F1 no page error and no sideways scroll', !errs.length && !s7.wide, errs.join(' | '));
136
143
  await ctx.close(); }
137
144
 
@@ -143,7 +150,7 @@ const look = () => {
143
150
  const shown = () => p.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); return !!v && v.getBoundingClientRect().width >= innerWidth - 1; });
144
151
  const s1 = await until(async () => { const v = await p.evaluate(look); return v.pane && await shown() ? v : null; }) || await p.evaluate(look);
145
152
  s1.detail = await shown();
146
- ok(`R7 (${scheme}) at 390 the chip covers the page with the Report tab`, s1.detail && /Social login weekly/.test(s1.pane || '') && s1.secs === 7, JSON.stringify(s1));
153
+ ok(`R7 (${scheme}) at 390 the chip covers the page with the report's questions`, s1.detail && /Social login weekly/.test(s1.title) && /Waits on your answers/.test(s1.pane || ''), JSON.stringify(s1));
147
154
  if (shots) await p.screenshot({ path: `${shots}/new-390-${scheme}.png` });
148
155
  ok(`F1 (${scheme}) no page error and no sideways scroll at 390`, !errs.length && !s1.wide, errs.join(' | '));
149
156
  await ctx.close();
@@ -231,3 +231,51 @@ button.rp-cy:hover { background: var(--cz-well); }
231
231
  .rp-wait::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-blue); animation: rp-wait 1.6s ease-in-out infinite; }
232
232
  @keyframes rp-wait { 50% { opacity: .3; } }
233
233
  @media (prefers-reduced-motion: reduce) { .rp-wait::before { animation: none; } }
234
+
235
+ /* ── the report building flow (batch 22 item 14, canvas RfH1–RfH7; public/pm/report-flow.js) ── */
236
+ .rf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
237
+ .rf-qs { display: flex; flex-direction: column; gap: 14px; }
238
+ .rf-st { display: flex; align-items: center; gap: 7px; margin: 0; font-size: var(--fs-2); font-weight: 700; color: var(--cz-blueink); }
239
+ .rf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cz-blue); flex: none; }
240
+ .rf-q { border: 0; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--cz-hair); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
241
+ .rf-q legend { float: left; width: 100%; padding: 0 0 6px; font-weight: 800; color: var(--cz-ink); display: flex; align-items: center; gap: 8px; }
242
+ .rf-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; margin: 0 0 6px; border-radius: 12px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; cursor: pointer; min-height: 44px; }
243
+ .rf-opt[aria-checked="true"] { border-color: color-mix(in oklab, var(--cz-blue) 55%, transparent); background: var(--cz-bluebg); }
244
+ .rf-opt .vz-ring { margin-top: 3px; }
245
+ .rf-ot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
246
+ .rf-ot > span:last-child { flex-basis: 100%; color: var(--cz-ink2); font-size: var(--fs-2); }
247
+ .rf-tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 99px; background: var(--cz-well); color: var(--cz-ink2); font-size: var(--fs-1); font-weight: 700; }
248
+ .rf-tag[data-k="ch"] { background: var(--cz-bluebg); color: var(--cz-blueink); }
249
+ .rf-in input, .rf-sel select { width: 100%; box-sizing: border-box; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; }
250
+ .rf-row { display: flex; flex-wrap: wrap; gap: 8px; }
251
+ .rf-row .rf-sel { flex: 1 1 120px; }
252
+ .rf-seg { min-height: 40px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-weight: 700; cursor: pointer; }
253
+ .rf-seg[aria-checked="true"] { background: var(--cz-bluebg); border-color: transparent; color: var(--cz-blueink); }
254
+ .rf-fix { margin: 0; display: flex; flex-direction: column; gap: 2px; } .rf-fix span { color: var(--cz-ink2); font-size: var(--fs-2); }
255
+ .rf-src { margin: 0; padding-left: 18px; color: var(--cz-ink); }
256
+ .rf-chg { margin: 0; font-size: var(--fs-2); color: var(--cz-ink2); }
257
+ .rf-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--cz-hair); }
258
+ .rf-foot .vz-note { margin-right: auto; }
259
+ .rf-ib { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
260
+ .rf-ib.pri { background: var(--cz-blue); border-color: transparent; color: var(--cz-onsolid); }
261
+ .rf-ib[disabled] { opacity: .45; cursor: default; }
262
+ .rf-hist h3 { margin: 4px 0 6px; font-size: var(--fs-3); }
263
+ .rf-hist ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
264
+ .rf-hv { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--cz-hair); }
265
+ .rf-hv > b { min-width: 28px; color: var(--cz-ink3); }
266
+ .rf-hv[aria-current="true"] > b, .rf-hv[data-k="new"] > b { color: var(--cz-blueink); }
267
+ .rf-hv > span { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
268
+ .rf-hv em { font-style: normal; color: var(--cz-ink3); font-size: var(--fs-2); }
269
+ .rf-wait { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--cz-bluebg); }
270
+ .rf-wait[data-k="bad"] { background: var(--cz-well); }
271
+ .rf-wait p { flex: 1; margin: 0; display: flex; flex-direction: column; gap: 2px; } .rf-wait p span { color: var(--cz-ink2); font-size: var(--fs-2); }
272
+ .rf-rv { display: flex; flex-direction: column; margin: 12px 0; }
273
+ .rf-rvh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--cz-bluebg); }
274
+ .rf-rvh > b { flex: 1; font-size: var(--fs-2); }
275
+ .rf-fx { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--cz-hair); }
276
+ .rf-fx + .rf-fx { margin-top: 0; } .rf-rvh + .rf-fx { border-top: 0; }
277
+ .rf-star { color: var(--cz-blueink); margin-top: 2px; }
278
+ .rf-fxt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; } .rf-fxt span { color: var(--cz-ink2); font-size: var(--fs-2); }
279
+ .rf-pass { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 10px 4px; border-top: 1px solid var(--cz-hair); font-size: var(--fs-2); }
280
+ .rf-pass span { color: var(--cz-ink3); }
281
+ .rf-opt[aria-checked="true"] .vz-ring { border: 5px solid var(--cz-blue); }
@@ -36,7 +36,7 @@ import { adler } from './cozy-adler.js';
36
36
  /* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
37
37
  const views = {
38
38
  ctx: () => import('./premium-vw-ctx.js'), file: () => import('./premium-vw-file.js'), attach: () => import('./premium-attach.js'),
39
- block: (b) => (b.kind === 'report' ? import('./premium-report-tab.js').then((M) => M.openReportTab(b)) : import('./premium-chart-tab.js').then((M) => M.openChartTab(b))),
39
+ block: (b, o) => (b.kind === 'report' ? import('./premium-report-tab.js').then((M) => M.openReportTab(b, o)) : import('./premium-chart-tab.js').then((M) => M.openChartTab(b))),
40
40
  };
41
41
 
42
42
  const SVG = (d, w = 16, sw = 2) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
@@ -327,7 +327,7 @@ export function mountChat(el, host) {
327
327
  function show(it) { if (host.desk()) openIt(it); else peek(it); }
328
328
  function openIt(it) {
329
329
  if (it.kind === 'goal') return openGoal();
330
- if (it.kind === 'report') return views.block(it.block);
330
+ if (it.kind === 'report') return views.block(it.block, { chat: C.t.key || null, auto: true });
331
331
  return views.ctx().then((M) => M.openCtx(it.item, where()));
332
332
  }
333
333
  function peek(it) {
@@ -480,7 +480,7 @@ export function mountChat(el, host) {
480
480
  if (C.addOpen && b.closest('.hm-addm')) { C.addOpen = false; drawFoot({ role: role() }); } // a press in the + menu closes it, then does its part
481
481
  if ('hmSignin' in d) { import('./cozy-settings.js').then((S) => S.openSettings('connectors')); return; } // a reach ask: Sign in to Jira opens Settings › Connectors
482
482
  if ('hmFile' in d) { const i = foot.querySelector('#hmFile'); if (i) i.click(); return; }
483
- if (d.reportOpen != null && d.reportOpen !== '') { e.preventDefault(); const m = ((C.conv && C.conv.messages) || [])[+d.reportOpen]; const bl = m ? splitReport(splitGoal(m.text).text).block : null; if (bl) views.block(bl); return; }
483
+ if (d.reportOpen != null && d.reportOpen !== '') { e.preventDefault(); const m = ((C.conv && C.conv.messages) || [])[+d.reportOpen]; const bl = m ? splitReport(splitGoal(m.text).text).block : null; if (bl) views.block(bl, { chat: C.t.key || null }); return; }
484
484
  if (d.ctx != null) { e.preventDefault(); views.ctx().then((M) => M.openCtx(M.itemOf(b), where())); return; }
485
485
  if (d.file) { e.preventDefault(); views.file().then((M) => M.openChatFile(d.file, where())); return; }
486
486
  if (d.att) { e.preventDefault(); if (/\/notes\/n[0-9a-z]{6,16}\.md$/.test(d.att)) openNotesHere(d.att.split('/').pop().replace(/\.md$/, '')); else views.attach().then((M) => M.openAttachment(d.att)); return; }
@@ -53,7 +53,9 @@ import { open as vOpen, current as vCur, czSections } from './cozy-viewer.js';
53
53
  import * as MP from './premium-mtg-present.js'; // the one presenter window for every kind (canvas note xvPresent)
54
54
  import { presentInRecording } from './cozy-rec-bridge.js'; // while a meeting records, the recording tab presents it (rule 10)
55
55
  import { placeholderHtml } from './cozy-placeholder.js';
56
- import { vzStyle } from './premium-vw-open.js'; // registers window.czViews; vzStyle adds the Viewer's sheet (cozy-vw.css)
56
+ import { vzStyle } from './premium-vw-open.js';
57
+ import { reviewHtml, ICON as RF_ICON } from './report-flow.js'; // Claude's review and the template icon (batch 22 item 14, canvas RfH2, RfH6)
58
+ import { adler } from './cozy-adler.js'; // registers window.czViews; vzStyle adds the Viewer's sheet (cozy-vw.css)
57
59
  import { cycleGroups, cycleName, briefModel, briefGlanceHtml, briefConfirmHtml, briefWhyHtml, briefLooksHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon, reportSummary,
58
60
  rpSumHtml, rpBarHtml, cadenceWords, goesOutWords, FORMATS } from './rp-parts.js';
59
61
 
@@ -434,8 +436,35 @@ function bodyHtml() {
434
436
  }
435
437
  const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
436
438
  : R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml();
437
- return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
439
+ return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
438
440
  }
441
+ /* ── Claude's review (batch 22 item 14, canvas RfH2): the checks PMOS runs on the draft, as ✦ fixes the report's own session makes ── */
442
+ function rvHtml() {
443
+ if (!R.rv) return '';
444
+ const n = (R.rv.fix || []).filter((f) => !R.rvHide.has(f.id) && !R.rvSent.has(f.id)).length;
445
+ return reviewHtml(R.rv, { hidden: R.rvHide, sent: R.rvSent, busy: R.busy, face: adler(n ? 'needs-you' : 'handled', 36) });
446
+ }
447
+ async function readReview() {
448
+ const me = R; if (!R || R.issued || !R.row.path) return;
449
+ const j = await Promise.resolve(pmGet('/api/report-flow/review?' + q({ ws: R.ws, path: R.row.path }))).catch(() => null);
450
+ if (R !== me) return;
451
+ R.rv = j && j.ok && j.review ? j.review : null; draw();
452
+ }
453
+ /** Do it (one fix, or all of them): the change goes to the report's own session, never to the PM's chat. */
454
+ async function rvAct(k, v) {
455
+ const me = R, L = (R.rv && R.rv.fix) || [];
456
+ if (k === 'rv-no') { R.rvHide.add(v); return draw(); }
457
+ const todo = (k === 'rv-all' ? L : L.filter((f) => f.id === v)).filter((f) => !R.rvHide.has(f.id) && !R.rvSent.has(f.id));
458
+ if (!todo.length || R.busy) return;
459
+ R.busy = true; draw();
460
+ const r = await pmPost('/api/report-flow/ask', { ws: R.ws, id: R.id, path: R.row.path, text: todo.map((f) => f.title + ' (' + f.why + ')').join('; ') }).catch(() => null);
461
+ if (R !== me) return;
462
+ R.busy = false;
463
+ if (!r || !r.ok) return say('That was not passed on: ' + ((r && r.error) || 'the page could not reach PMOS') + '.', 'bad');
464
+ todo.forEach((f) => R.rvSent.add(f.id));
465
+ say((r.started ? 'The report\'s session started with ' : 'Passed to the report\'s session: ') + (todo.length === 1 ? 'one change' : todo.length + ' changes') + '. They show here as it writes them. Nothing is issued.');
466
+ }
467
+ function openTemplate() { import('./premium-report-tab.js').then((M) => M.openReportTab({ kind: 'report', id: R.id }, { panel: 'template' })); }
439
468
  /** What Claude is still doing on this report, said where the PM reads it (Wawan, 2026-11-01, batch 22 item 13: "I have to wait, but there's
440
469
  * no indication of me having to wait"). Nothing running → ''. */
441
470
  export function waitWords(x, draft) {
@@ -526,7 +555,7 @@ function wire(b) {
526
555
  const top = b.getBoundingClientRect().top + 80; let n = 1; pgs.forEach((g, k) => { if (g.getBoundingClientRect().top <= top) n = k + 1; });
527
556
  const t = 'Page ' + n + ' of ' + pgs.length; if (c.textContent !== t) c.textContent = t;
528
557
  };
529
- b.onmousemove = (e) => { if (R.view !== 'live' || !R.LV) return; const pt = e.target.closest('.rp-pt'); if (pt) { const h = +pt.dataset.r.split('|')[2]; if (R.LV.hover !== h) { R.LV.hover = h; draw(); } } };
558
+ b.onmousemove = (e) => { if (!R || R.view !== 'live' || !R.LV) return; const pt = e.target.closest('.rp-pt'); if (pt) { const h = +pt.dataset.r.split('|')[2]; if (R.LV.hover !== h) { R.LV.hover = h; draw(); } } };
530
559
  }
531
560
  /* a 1280 x 720 frame scales to its slide's width */
532
561
  const RO = typeof ResizeObserver === 'function' ? new ResizeObserver((es) => { for (const e of es) scaleOf(e.target, e.contentRect.width); }) : null;
@@ -536,6 +565,7 @@ export function fit(root) { root.querySelectorAll('.vz-fr').forEach((c) => { if
536
565
  /* ── the presses ── */
537
566
  const say = (text, tone) => { R.msg = { text, tone }; draw(); };
538
567
  async function act([k, v], t) {
568
+ if (k === 'rv-do' || k === 'rv-no' || k === 'rv-all') return rvAct(k, v);
539
569
  if (k === 'pop') { R.pop = v || null; return draw(); }
540
570
  if (k === 'cut') return cutTo(v);
541
571
  if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
@@ -927,8 +957,10 @@ export async function openReport(row, hand = {}) {
927
957
  if (R) present(false);
928
958
  const me = R = { row, ws: hand.ws || '', id: c.cadence, name: hand.name || row.name || c.cadence || 'Report', audience: hand.audience || '', issued: row.state === 'issued', archived: !!row.archived,
929
959
  text: '', err: '', W: null, view: 'deck', BF: null, bfRaw: null, bfMsg: '', LV: null, blank: false, i: 0, cyc: null, setup: undefined, pop: null, conf: false, checks: null, issueErr: '', busy: false, ask: '', askErr: '', edit: false, msg: null,
930
- sch: schedPick(null), schErr: '', shr: null, shares: null, more: [], hand, cuts: hand.cuts ? { on: 'team', team: null, sponsors: null, err: '' } : null, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
960
+ sch: schedPick(null), schErr: '', shr: null, rv: null, rvHide: new Set(), rvSent: new Set(), shares: null, more: [], hand, cuts: hand.cuts ? { on: 'team', team: null, sponsors: null, err: '' } : null, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
931
961
  const head = me.head = () => ({ id: me.vid, kind: 'Report' + (me.audience ? ' · ' + me.audience : ''), title: me.name, icon: me.view === 'doc' ? 'doc' : 'report', full: true, url: viewUrl(row, me.ws), more: me.more,
962
+ // the template behind one icon (batch 22 item 14, canvas RfH1): format, readers, when it goes out, and its history
963
+ presses: me.setup ? [{ act: 'template', label: 'Template: format, readers, look, sources', icon: RF_ICON.tune }] : [], onPress: (a) => { if (a === 'template' && R === me) openTemplate(); },
932
964
  render: (b) => { syncMore(); b.innerHTML = panelHtml(); wire(b); }, onClose: () => { if (R === me && !me.reopen) { present(false); R = null; } } });
933
965
  vOpen(head());
934
966
  try { R.text = await textOf('/api/doc?' + q({ ws: R.ws, path: row.path })); R.W = wordsOf(R.text, R.name); if (!hand.name && R.W.title) R.name = R.W.title; } catch (x) { R.err = String((x && x.message) || x); R.W = { title: R.name, sections: [] }; }
@@ -941,7 +973,9 @@ export async function openReport(row, hand = {}) {
941
973
  await Promise.all([readCycle(), readSetup(), readShares()]);
942
974
  if (R !== me) return me;
943
975
  readBrief(); // the Brief tab's count shows at once
944
- if (vCur() && vCur().id === me.vid && (vCur().title !== me.name || me.audience)) { me.reopen = true; vOpen(head()); me.reopen = false; } // the name and audience are known now
976
+ readReview();
977
+ if (hand.say) me.msg = { text: hand.say };
978
+ if (vCur() && vCur().id === me.vid && (vCur().title !== me.name || me.audience || me.setup)) { me.reopen = true; vOpen(head()); me.reopen = false; } // the name and audience are known now
945
979
  draw();
946
980
  watchFile(me);
947
981
  return me;
@@ -957,7 +991,7 @@ async function watchFile(me) {
957
991
  if (document.hidden || me.edit || me.busy || me.pop || (me.cuts && me.cuts.on === 'sponsors')) continue; // the sponsors cut is read from the file, not the file
958
992
  const h = await stamp();
959
993
  if (R !== me || !h) continue;
960
- if (seen && h !== seen) { await reread(); if (R === me && !me.edit && !me.pop) draw(); }
994
+ if (seen && h !== seen) { await reread(); if (R === me && !me.edit && !me.pop) { draw(); readReview(); } }
961
995
  seen = h;
962
996
  }
963
997
  }