create-pmos 0.478.0 → 0.480.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 (40) hide show
  1. package/package.json +26 -27
  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-initiative-test.js +1 -1
  7. package/workspace/changelog.json +25 -0
  8. package/workspace/guide/briefing-premium.md +3 -2
  9. package/workspace/guide/home.md +2 -1
  10. package/workspace/guide/programs.md +15 -5
  11. package/workspace/lib/board-pack-route.js +10 -1
  12. package/workspace/lib/board-pack.js +31 -2
  13. package/workspace/lib/briefing-premium-products.js +5 -2
  14. package/workspace/lib/briefing-premium.js +5 -3
  15. package/workspace/lib/ready-reports.js +31 -6
  16. package/workspace/lib/report-chat.js +7 -4
  17. package/workspace/lib/report-draft.js +14 -5
  18. package/workspace/lib/report-structure.js +35 -1
  19. package/workspace/lib/routes-report-setups.js +24 -4
  20. package/workspace/metric-drafts-ui-test.js +2 -1
  21. package/workspace/milestone-suggest-test.js +12 -6
  22. package/workspace/package-lock.json +2 -2
  23. package/workspace/package.json +1 -1
  24. package/workspace/program-charter-test.js +5 -5
  25. package/workspace/program-panel-test.js +28 -25
  26. package/workspace/public/pm/bd-prog-panel.js +84 -60
  27. package/workspace/public/pm/chat-md.js +5 -2
  28. package/workspace/public/pm/cozy-home.css +3 -0
  29. package/workspace/public/pm/dash-view.js +9 -5
  30. package/workspace/public/pm/goal-chat.js +3 -1
  31. package/workspace/public/pm/home-app.js +53 -21
  32. package/workspace/public/pm/home-chat.js +2 -2
  33. package/workspace/public/pm/premium-report-read.js +8 -1
  34. package/workspace/public/pm/premium-report-tab.js +34 -20
  35. package/workspace/public/pm/premium.css +1 -0
  36. package/workspace/public/pm/prog-page.css +76 -0
  37. package/workspace/public/pm/prog-page.js +112 -0
  38. package/workspace/public/pm/readonly.js +8 -1
  39. package/workspace/public/pm/report-chat.js +14 -3
  40. package/workspace/ready-dash-ui-test.js +53 -73
@@ -108,13 +108,13 @@ async function poll(t, kind) {
108
108
  await new Promise((ok) => setTimeout(ok, POLL_MS));
109
109
  if (kind === 'structure') {
110
110
  const S = await get('/api/report-structure', { id: t.block.id });
111
- if (S && S.ok && !S.structure.running) { t.S = S.structure; t.sv = t.S.current; t.busy = false; t.msg = lastSaid(t.S.log); redraw(t); return; }
111
+ if (S && S.ok && !S.structure.running) { t.S = S.structure; t.sv = t.S.current; t.msg = lastSaid(t.S.log); redraw(t); return; }
112
112
  } else {
113
113
  const r = await get('/api/report-design', { id: t.block.id });
114
- if (r && r.ok && !r.design.running) { t.Z = r.design; t.dv = t.Z.current; await renderOf(t, t.dv); t.busy = false; t.msg = lastSaid(t.Z.log); redraw(t); return; }
114
+ if (r && r.ok && !r.design.running) { t.Z = r.design; t.dv = t.Z.current; await renderOf(t, t.dv); t.msg = lastSaid(t.Z.log); redraw(t); return; }
115
115
  }
116
116
  }
117
- t.busy = false; t.msg = 'PMOS has not answered yet. The new version shows when you open this report again.'; redraw(t);
117
+ t.msg = 'PMOS has not answered yet. The new version shows when you open this report again.'; redraw(t);
118
118
  }
119
119
  const lastSaid = (log) => { const l = (log || []).filter((x) => x.who === 'pmos').pop(); return l ? l.text : ''; };
120
120
 
@@ -145,9 +145,11 @@ function draw(t, el) {
145
145
  el.querySelectorAll('iframe[data-rt-frame]').forEach((f) => { f.srcdoc = t.render.get(+f.dataset.rtFrame) || ''; });
146
146
  }
147
147
  /** The new report as slides: its title slide, then one slide per section every new report has. */
148
- export function deckOf(p) {
149
- return [{ eye: p.audience ? 'For ' + p.audience : 'New report', h: p.name, t: p.purpose || '' }].concat(FRAME.map(([h, d]) => ({ eye: p.name, h, t: d })));
148
+ export function deckOf(p, sections) {
149
+ return [{ eye: p.audience ? 'For ' + p.audience : 'New report', h: p.name, t: p.purpose || '' }].concat(frameOf(sections).map(([h, d]) => ({ eye: p.name, h, t: d })));
150
150
  }
151
+ /** The sections a new report will have: the ones the PM named in the chat (block.sections), else the standard frame. */
152
+ export const frameOf = (sections) => (Array.isArray(sections) && sections.length ? sections.map((h) => [h, '']) : FRAME);
151
153
  /**
152
154
  * A new report from the chat: the one report Viewer in its first state (canvas OvReport). The summary says it is new and not set up, what
153
155
  * it will hold, and its one primary, Set it up (a check icon); its chips are the schedule (Once until one is picked; it opens the choices)
@@ -155,20 +157,23 @@ export function deckOf(p) {
155
157
  * At a glance and Structure and look ("new"). Edit, Present, Share and Download have nothing to act on until it is set up, so they are not drawn.
156
158
  */
157
159
  function newHtml(t) {
158
- const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
160
+ const p = t.block.proposal, named = t.block.sections, F = frameOf(named), L = deckOf(p, named), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
159
161
  const sum = rpSumHtml({ line: 'New · from your chat', tone: 'you', right: 'Not set up yet',
160
- text: t.block.structure ? 'It starts with the standard sections. When you set it up, Claude reshapes them to your change, and you keep it with one press. Nothing goes out until you set it up.'
161
- : 'One slide per section: ' + FRAME.map(([h]) => h).join(', ') + '. Nothing goes out until you set it up.',
162
+ text: named ? 'One slide per section: ' + F.map(([h]) => h).join(', ') + '. Press the check to set it up: it keeps these sections and drafts the first report with them. Nothing goes out.'
163
+ : t.block.structure ? 'It starts with the standard sections. When you set it up, Claude reshapes them to your change, and you keep it with one press. Nothing goes out until you set it up.'
164
+ : 'One slide per section: ' + FRAME.map(([h]) => h).join(', ') + '. Press the check to set it up. Nothing goes out.',
162
165
  chips: [{ icon: 'repeat', label: cadenceWords(t.sched), act: 'sched', exp: t.open }, { icon: 'file', label: OUT[p.output] || p.output || 'PDF' }],
163
166
  primary: { act: 'setup', label: t.busy ? 'Setting it up' : 'Set it up', icon: 'check', disabled: t.busy } }, 'data-rt');
164
167
  const bar = rpBarHtml({ view: t.nv, views: [['deck', 'Slides'], ['doc', 'Document']] }, 'data-rt');
165
168
  const deck = `<div class="vz-dks" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(s.h)}"><p class="vz-dke">${esc(s.eye)}</p><h2>${esc(s.h)}</h2>${s.t ? `<p>${esc(s.t)}</p>` : ''}</div>`
166
169
  + `<div class="vz-dkn"><button type="button" class="vz-dkb vz-hv" data-rt="sl|-1" aria-label="Previous slide"${i === 0 ? ' disabled' : ''}>${SV('M15 6l-6 6 6 6')}</button><span aria-live="polite">Slide ${i + 1} of ${L.length}</span><button type="button" class="vz-dkb vz-hv" data-rt="sl|1" aria-label="Next slide"${i === L.length - 1 ? ' disabled' : ''}>${SV('M9 6l6 6-6 6')}</button></div>`
167
170
  + `<div class="vz-dkt" role="group" aria-label="Slides">${L.map((x, k) => `<button type="button" class="vz-hv" data-rt="go|${k}" aria-label="Slide ${k + 1}: ${esc(x.h)}"${k === i ? ' aria-current="true"' : ''}><span>${esc(x.h)}</span></button>`).join('')}</div>`;
168
- const page = `<article class="vz-dkp"><h2>${esc(p.name)}</h2>${p.purpose ? `<p class="vz-note">${esc(p.purpose)}</p>` : ''}${sectionsHtml(FRAME)}</article>`;
171
+ const page = `<article class="vz-dkp"><h2>${esc(p.name)}</h2>${p.purpose ? `<p class="vz-note">${esc(p.purpose)}</p>` : ''}${sectionsHtml(F)}</article>`;
169
172
  const folds = czSections([
170
173
  { id: 'glance', title: 'At a glance', count: 'For, read by, goes out', render: () => `<div class="rp-brief">${glance(p.purpose, p.audience, esc(schedWords(t.sched)), OUT[p.output] || p.output)}</div>` },
171
- { id: 'look', title: 'Structure and look', count: t.block.structure ? 'change' : 'new', render: () => (t.block.structure ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p><p class="vz-note">Claude makes this change as soon as the report is set up. The first draft uses the sections below.</p></div>` : '')
174
+ { id: 'look', title: 'Structure and look', count: named ? F.length + ' sections' : t.block.structure ? 'change' : 'new', render: () => named
175
+ ? `${sectionsHtml(F)}<p class="vz-note">The sections you named in the chat. It uses the standard PMOS look until you say how it should look.</p>`
176
+ : (t.block.structure ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p><p class="vz-note">Claude makes this change as soon as the report is set up. The first draft uses the sections below.</p></div>` : '')
172
177
  + `${sectionsHtml(FRAME)}<p class="vz-note">Every new report has these sections. ${t.block.structure ? '' : 'Once it is set up, ask in the chat to shape them. '}It uses the standard PMOS look until you say how it should look.</p>` },
173
178
  ], { key: 'report-new' });
174
179
  return sum + schedMenu(t, t.sched) + bar + (t.nv === 'doc' ? page : deck) + folds;
@@ -190,14 +195,18 @@ function stepper(kind, n, list, saved) {
190
195
  return `<div class="vz-r1 vz-g6"><button type="button" class="vz-nav vz-hv" data-rt="${kind}|${list[i - 1] ? list[i - 1].n : n}" aria-label="Earlier version"${i <= 0 ? ' disabled' : ''}>${SV('M15 6l-6 6 6 6', 14)}</button>`
191
196
  + `<span class="vz-t13">${kind === 'sv' ? 'S' : 'D'}${n}${n === saved ? ' · saved' : ' · not saved'}</span><button type="button" class="vz-nav vz-hv" data-rt="${kind}|${list[i + 1] ? list[i + 1].n : n}" aria-label="Later version"${i >= list.length - 1 ? ' disabled' : ''}>${SV('M9 6l6 6-6 6', 14)}</button></div>`;
192
197
  }
198
+ /** The change to a set-up report's sections in words: the titles the PM named, else the change Claude carried. */
199
+ const shapeOf = (b) => (b.sections && b.sections.length ? 'Use exactly these sections, in this order: ' + b.sections.join('; ') + '.' : b.structure || '');
193
200
  function structureHtml(t) {
194
201
  const S = t.S, V = (S && S.versions) || [];
195
202
  const plan = S && S.plan, shown = t.sv;
196
203
  const L = plan && plan.outline ? plan.outline.map((x) => [x.title, x.notes || '']) : FRAME;
197
- const ask = t.block.structure && !(S && S.running) ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p><div>${btn('s-turn', 'Make the next version', { off: t.busy })}</div></div>` : '';
204
+ const want = shapeOf(t.block);
205
+ const ask = want && !(S && S.running) ? `<div class="vz-ask"><p>Your change: <b>“${esc(want)}”</b></p><div>${btn('s-turn', 'Make the next version', { off: t.busy })}</div></div>` : '';
198
206
  const working = S && S.running ? '<p class="vz-note" role="status">PMOS is making the next version.</p>' : '';
199
- const save = shown != null && S && shown !== S.saved ? btn('s-accept', 'Use this', { off: t.busy }) : '';
200
- const undo = V.some((v) => v.n < (S ? S.current : 0)) ? btn('s-undo', 'Undo', { sec: true, off: t.busy }) : '';
207
+ const held = t.busy || !!(S && S.running); // a running job holds only these two; Discard and Delete template stay free
208
+ const save = shown != null && S && shown !== S.saved ? btn('s-accept', 'Use this', { off: held }) : '';
209
+ const undo = V.some((v) => v.n < (S ? S.current : 0)) ? btn('s-undo', 'Undo', { sec: true, off: held }) : '';
201
210
  return `${stepper('sv', shown, V, S && S.saved)}${ask}${working}${sectionsHtml(L)}${!V.length ? '<p class="vz-note">No structure version yet: each cycle uses these sections. Say in the chat how to shape them.</p>' : ''}${save || undo ? `<div class="vz-r1">${undo}${save}</div>` : ''}`;
202
211
  }
203
212
  /** The look conversation's card (RpDesign): the preview of the shown look against the saved one, Use it and Keep current. */
@@ -219,8 +228,9 @@ function designHtml(t) {
219
228
  + `<button type="button" class="rp-thumb on" data-rt="dv|${t.dv}" aria-current="true"><span class="rp-tf">${fr(t.dv, 'The new look D' + t.dv)}</span><span class="rp-tl"><b>New look</b> · D${t.dv}</span></button></div>` : '';
220
229
  const frame = t.dv != null ? (t.render.has(t.dv) ? `<div class="vz-pagefr"><iframe sandbox="" title="Design version D${t.dv}" data-rt-frame="${t.dv}"></iframe></div>` : '<p class="vz-note">This version could not be read.</p>')
221
230
  : '<p class="vz-note">No look yet. Say in the chat how it should look, or attach a sample. Each cycle uses the standard look until then.</p>';
222
- const use = preview ? btn('d-accept', 'Use it', { off: t.busy }) + btn('d-keep', 'Keep current', { sec: true, off: t.busy }) : '';
223
- const undo = !preview && V.some((v) => v.n < (Z.current || 0)) ? btn('d-undo', 'Undo', { sec: true, off: t.busy }) : '';
231
+ const held = t.busy || !!Z.running;
232
+ const use = preview ? btn('d-accept', 'Use it', { off: held }) + btn('d-keep', 'Keep current', { sec: true, off: held }) : '';
233
+ const undo = !preview && V.some((v) => v.n < (Z.current || 0)) ? btn('d-undo', 'Undo', { sec: true, off: held }) : '';
224
234
  return `${head}${stepper('dv', t.dv, V, saved)}${ask}${working}${fol}${pair}${frame}${use || undo ? `<div class="vz-r1">${use}${undo}</div>` : ''}`;
225
235
  }
226
236
  function cyclesHtml(t) {
@@ -262,8 +272,8 @@ async function press(t, e) {
262
272
  if (a === 'setup') { await setUp(t); return; }
263
273
  if (a === 'open') { const d = t.docs.find((x) => x.path === v); if (window.czViews) window.czViews.openReport(d ? { path: d.path, slot: d.slot, state: d.state, archived: !!d.archived } : v, { ws: ws(), name: t.setup ? t.setup.name : '' }); return; }
264
274
  const id = t.block.id;
265
- if (a === 's-turn') { t.busy = true; t.msg = ''; redraw(t); const r = await post('/api/report-structure/turn', { id, text: t.block.structure }); if (!r || !r.ok) { t.busy = false; t.msg = 'That did not start: ' + why(r, 'no answer') + '.'; redraw(t); return; } t.S = Object.assign({}, t.S, { running: true }); t.block = Object.assign({}, t.block, { structure: undefined }); redraw(t); poll(t, 'structure'); return; }
266
- if (a === 'd-turn') { t.busy = true; t.msg = ''; redraw(t); const r = await post('/api/report-design/turn', { id, text: t.block.design, points: [] }); if (!r || !r.ok) { t.busy = false; t.msg = 'That did not start: ' + why(r, 'no answer') + '.'; redraw(t); return; } t.Z = Object.assign({}, t.Z, { running: true }); t.block = Object.assign({}, t.block, { design: undefined }); redraw(t); poll(t, 'design'); return; }
275
+ if (a === 's-turn') { t.busy = true; t.msg = ''; redraw(t); const r = await post('/api/report-structure/turn', { id, text: shapeOf(t.block) }); if (!r || !r.ok) { t.busy = false; t.msg = 'That did not start: ' + why(r, 'no answer') + '.'; redraw(t); return; } t.busy = false; t.S = Object.assign({}, t.S, { running: true }); t.block = Object.assign({}, t.block, { structure: undefined, sections: undefined }); redraw(t); poll(t, 'structure'); return; }
276
+ if (a === 'd-turn') { t.busy = true; t.msg = ''; redraw(t); const r = await post('/api/report-design/turn', { id, text: t.block.design, points: [] }); if (!r || !r.ok) { t.busy = false; t.msg = 'That did not start: ' + why(r, 'no answer') + '.'; redraw(t); return; } t.busy = false; t.Z = Object.assign({}, t.Z, { running: true }); t.block = Object.assign({}, t.block, { design: undefined }); redraw(t); poll(t, 'design'); return; }
267
277
  if (a === 's-accept') { await act(t, async () => { const r = await post('/api/report-structure/accept', { id, n: t.sv }); if (!r || !r.ok) return why(r, 'The structure was not saved.'); t.S = r.structure; return 'S' + t.sv + ' is saved. The next cycle follows it.'; }); return; }
268
278
  if (a === 's-undo') { const V = t.S.versions.filter((x) => x.n < t.S.current); const to = V[V.length - 1].n; await act(t, async () => { const r = await post('/api/report-structure/revert', { id, n: to }); if (!r || !r.ok) return why(r, 'Undo did not go through.'); t.S = r.structure; t.sv = t.S.current; return 'Back to S' + to + '.'; }); return; }
269
279
  if (a === 'd-accept') { await act(t, async () => { const r = await post('/api/report-design/accept', { id, n: t.dv }); if (!r || !r.ok) return why(r, 'The design was not saved.'); t.Z = r.design; return 'Using the new look (D' + t.dv + '). The next cycle follows it, and every section and figure stays.'; }); return; }
@@ -295,12 +305,13 @@ async function setUp(t) {
295
305
  const p = t.block.proposal;
296
306
  const schedule = t.sched === 'off' ? { cadence: 'weekly', day: 'Mon', time: '09:00' } : t.sched;
297
307
  await act(t, async () => {
308
+ const named = t.block.sections;
298
309
  const r = await post('/api/report-setups/setup', { proposal: { name: p.name, purpose: p.purpose || p.name, audience: p.audience, source: 'work', output: p.output, schedule,
299
- sources: p.sources.length ? p.sources : ['The records of this workspace'], learned_from: 'Set up from a chat.' } });
310
+ sources: p.sources.length ? p.sources : ['The records of this workspace'], learned_from: 'Set up from a chat.' }, ...(named ? { sections: named } : {}) });
300
311
  if (!r || !r.ok) return 'It was not set up: ' + why(r, 'the page could not reach PMOS') + '.';
301
312
  if (t.sched === 'off') await post('/api/report-setups/edit', { id: r.setup.id, schedule: { cadence: 'off' } });
302
313
  // the view now shows the set-up report, under the same id, so the card stays on it
303
- const shape = t.block.structure;
314
+ const shape = r.structure ? null : named ? 'Use exactly these sections, in this order: ' + named.join('; ') + '.' : t.block.structure;
304
315
  t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; show(t); await load(t);
305
316
  const d = r.drafted || {};
306
317
  // the change Claude proposed with the new report: start it now, the PM keeps it with Use this (batch 20 item 9)
@@ -310,6 +321,9 @@ async function setUp(t) {
310
321
  if (s && s.ok) { t.S = Object.assign({}, t.S, { running: true }); t.view = 'structure'; poll(t, 'structure'); shaping = ' Claude is reshaping the sections to your change now.'; }
311
322
  else { t.block = Object.assign({}, t.block, { structure: shape }); shaping = ' The change to its sections did not start: ' + why(s, 'no answer') + '. Press Make the next version to try again.'; }
312
323
  }
313
- return 'Set up. ' + (d.path ? 'The first draft is written.' : 'The first draft was not written' + (d.error ? ': ' + d.error : '') + '.') + (t.sched === 'off' ? ' Schedule is Off, so it runs once.' : '') + shaping;
324
+ if (r.structure) t.view = 'structure';
325
+ const first = d.drafting ? 'Claude is writing the first draft with your ' + named.length + ' sections. It opens under Reports when it lands.'
326
+ : d.path ? 'The first draft is written.' : 'The first draft was not written' + (d.error ? ': ' + d.error : '') + '.';
327
+ return 'Set up' + (r.structure ? ' with your sections. ' : '. ') + first + (t.sched === 'off' ? ' Schedule is Off, so it runs once.' : '') + shaping;
314
328
  });
315
329
  }
@@ -2258,6 +2258,7 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2258
2258
  .md{font-size:var(--fs-3);line-height:1.6;color:var(--ink);max-width:64ch;overflow-wrap:anywhere}
2259
2259
  .md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}
2260
2260
  .md p{margin:0 0 10px}
2261
+ .ub .md{max-width:none;color:inherit}
2261
2262
  .md h4,.md h5,.md h6{margin:18px 0 6px;line-height:1.35;font-weight:600}
2262
2263
  .md h4{font-size:var(--fs-4)}.md h5{font-size:var(--fs-3)}
2263
2264
  .md h6{font:600 var(--fs-2) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)}
@@ -0,0 +1,76 @@
1
+ /* pm/prog-page.css — the one program and product page (pm/prog-page.js; canvas Ready for development RdProgL–RdProgP, batch 21 item 2).
2
+ * Token vars only, over pm/cozy.css; the type scale is --fs-1..--fs-6. Every class starts with pv-. The rows inside a tab keep the classes of
3
+ * the parts they came from (pp- for the program's tree, db- for the reports). */
4
+
5
+ .pv { display: flex; flex-direction: column; gap: 14px; padding: 2px 0 18px; color: var(--cz-ink); font-family: var(--cz-sans); min-width: 0; }
6
+
7
+ /* the ✦ line: the next step, with the M face once */
8
+ .pv-line { display: flex; align-items: center; gap: 12px; border-radius: 16px; padding: 8px 12px 8px 12px; background: var(--cz-bluebg); border: 1px solid color-mix(in srgb, var(--cz-blueink) 18%, transparent); }
9
+ .pv-line p { margin: 0; flex: 1; min-width: 0; font-size: var(--fs-4); line-height: 1.4; color: var(--cz-ink3); }
10
+ .pv-line b { color: var(--cz-ink); font-weight: 800; }
11
+ .pv-face { flex: none; width: 36px; height: 36px; display: inline-flex; }
12
+ .pv-face svg, .pv-face img { width: 36px; height: 36px; }
13
+
14
+ /* the goal card, with the milestones inside it; a proposed goal is dashed */
15
+ .pv-gc { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
16
+ .pv-gc.p { border: 1.5px dashed color-mix(in srgb, var(--cz-blueink) 40%, transparent); }
17
+ .pv-gc > .md-card { border: 0; padding: 0; background: transparent; box-shadow: none; }
18
+ .pv-gc .pp-sec { margin: 0; }
19
+ .pv-gc .pp-lh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
20
+ .pv-gc .pp-lh { margin-bottom: 4px; }
21
+ .pv-gc .pp-lh .lbl { margin: 0; }
22
+ .pv-k { margin: 0; font-size: var(--fs-1); font-weight: 800; color: var(--cz-blueink); }
23
+ .pv-gr { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; }
24
+ button.pv-gr { cursor: pointer; }
25
+ .pv-gr:focus-visible, .pv-one:focus-visible, .pv-tab:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 10px; }
26
+ .pv-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
27
+ .pv-rt b { font-size: var(--fs-4); font-weight: 800; line-height: 1.3; }
28
+ .pv-gr .pv-rt b { font-size: var(--fs-5); }
29
+ .pv-rt small { font-size: var(--fs-2); color: var(--cz-ink3); line-height: 1.4; }
30
+ .pv-kr { flex: none; font-size: var(--fs-1); font-weight: 800; border-radius: 6px; padding: 2px 6px; background: var(--cz-bluebg); color: var(--cz-blueink); }
31
+ .pv-fc { display: flex; align-items: center; gap: 10px; padding-left: 19px; }
32
+ .pv-fc small { flex: none; font-size: var(--fs-2); color: var(--cz-ink3); }
33
+ .pv-bar { position: relative; flex: 1; height: 10px; border-radius: 5px; background: var(--cz-well); }
34
+ .pv-bar i { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--cz-ink3); }
35
+ .pv-bar i.ok { background: var(--cz-dot-ok); } .pv-bar i.risk { background: var(--cz-dot-risk); } .pv-bar i.late { background: var(--cz-dot-late); }
36
+ .pv-bar.held { opacity: .55; }
37
+ .pv-bar .tg { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--cz-ink); }
38
+ .pv-bar .lk { position: absolute; top: 1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--cz-card); border: 2px solid var(--cz-ink); box-sizing: border-box; }
39
+
40
+ /* the top cards of a product: Programs, Health budgets */
41
+ .pv-card { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 10px 16px; display: flex; flex-direction: column; min-width: 0; }
42
+ .pv-ch { display: flex; align-items: center; gap: 10px; padding: 2px 0 4px; }
43
+ .pv-ch h4 { margin: 0; font-size: var(--fs-4); font-weight: 800; }
44
+ .pv-ch small { flex: 1; font-size: var(--fs-2); color: var(--cz-ink3); }
45
+ .pv-row { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--cz-hair); min-width: 0; width: 100%; }
46
+ .pv-ch + .pv-row { border-top: 0; }
47
+ button.pv-row, a.pv-row { cursor: pointer; }
48
+ .pv-row > svg, .pv-chev { flex: none; color: var(--cz-ink3); display: inline-flex; }
49
+ .pv-pill { flex: none; font-size: var(--fs-2); color: var(--cz-ink2); background: var(--cz-well); border-radius: 99px; padding: 2px 10px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
50
+ .pv-late { flex: none; font-size: var(--fs-2); font-weight: 800; color: var(--cz-late); }
51
+ .pv-none { margin: 0; padding: 6px 0; font-size: var(--fs-3); color: var(--cz-ink3); line-height: 1.5; }
52
+
53
+ /* the proposals, folded to one row (the owner only) */
54
+ .pv-props { display: flex; flex-direction: column; gap: 8px; }
55
+ .pv-one { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px; background: var(--cz-card); border: 1px solid color-mix(in srgb, var(--cz-blueink) 25%, transparent); border-radius: 16px; padding: 10px 14px; min-width: 0; }
56
+ .pv-ic { flex: none; color: var(--cz-blueink); display: inline-flex; }
57
+ .pv-one[aria-expanded="true"] .pv-chev { transform: rotate(180deg); }
58
+ .pv-pbody { display: flex; flex-direction: column; gap: 8px; }
59
+
60
+ /* the tabs */
61
+ .pv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--cz-hair); overflow-x: auto; scrollbar-width: none; }
62
+ .pv-tab { all: unset; box-sizing: border-box; cursor: pointer; flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 10px 8px; font-size: var(--fs-4); font-weight: 700; color: var(--cz-ink3); display: flex; align-items: center; gap: 8px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
63
+ .pv-tab.on { color: var(--cz-ink); font-weight: 800; border-bottom-color: var(--cz-blue); }
64
+ .pv-n { font-size: var(--fs-1); font-weight: 800; color: var(--cz-ink3); }
65
+ .pv-sg { width: 8px; height: 8px; border-radius: 50%; flex: none; }
66
+ .pv-sg.late { background: var(--cz-dot-late); } .pv-sg.ready { background: var(--cz-blue); }
67
+ .pv-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
68
+
69
+ @media (max-width: 480px) {
70
+ .pv-tab { padding: 10px 4px; gap: 5px; font-size: var(--fs-3); }
71
+ .pv-pill { display: none; }
72
+ }
73
+
74
+ /* a tab names its part once: the Reports block's own heading is the tab's (say it once) */
75
+ .pv-panel .db-b > .db-h { display: none; }
76
+ .pv-pbody .db-b > .db-h { display: none; }
@@ -0,0 +1,112 @@
1
+ /* pm/prog-page.js — the ONE page of a program and of a product in the Viewer (feedback batch 21 item 2; canvas Ready for development,
2
+ * RdProgL Initiatives, RdProgM Tasks, RdProgN Reports, RdProgO a teammate on a shared board, RdProgP the phone; note rdProgAgreed).
3
+ * It replaces the batch 17 Work | Dashboard pair: there is no toggle. The program panel (bd-prog-panel.js, on the Board and in Home) and the
4
+ * product page (home-app.js) draw it; each host gives the parts it already has, and this file only lays them out and wires the tabs.
5
+ *
6
+ * pageHtml(m) the page. m: {
7
+ * page 'program:<id>' | 'product:<ws>', the key the last tab is kept under (this browser only)
8
+ * line { lead, rest } the ✦ line with the next step (the M face leads it, once per screen); a shared copy says who shared it
9
+ * goal html of the goal card: the goal's short title with its KR chip, its range bar, and the milestones inside it
10
+ * cards html of more cards in the top area (a product: Programs, Health budgets)
11
+ * props { n, sub, html } the proposals that wait on the owner, folded to one row; never on a shared board (RdProgO)
12
+ * tabs [{ id: 'tasks'|'initiatives'|'reports'|'documents', label, n?, sig?: 'late'|'ready', html() }]
13
+ * shared true on a teammate's read-only copy
14
+ * }
15
+ * tabOf(page) the tab that opens: the viewer's last one on this page, else Initiatives (Wawan 2026-11-01: "initiative as default")
16
+ * wirePage(body, h) once per body: a tab press, the arrow keys on the tab list, the proposals fold. h: { redraw() }
17
+ *
18
+ * Zero is silence: a tab count of 0 is not drawn, an empty top part is left out. Icon-only presses carry their words in aria-label and title. */
19
+ import { adler } from './cozy-adler.js';
20
+
21
+ const CSS = new URL('./prog-page.css', import.meta.url).href;
22
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
23
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
24
+ }
25
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
26
+ const SV = (d, w = 16) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
27
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', DOWN = 'M7 10l5 5 5-5';
28
+
29
+ export const TABS = Object.freeze(['tasks', 'initiatives', 'reports', 'documents']);
30
+ const KEY = 'pmos.pv.tab:';
31
+ const OPEN = new Set(); // pages whose proposals row is open, this page load
32
+ const get = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
33
+ const set = (k, v) => { try { localStorage.setItem(k, v); } catch { /* a private window */ } };
34
+ export const tabOf = (page) => { const v = get(KEY + page); return TABS.includes(v) ? v : 'initiatives'; };
35
+ export const keepTab = (page, t) => { if (TABS.includes(t)) set(KEY + page, t); };
36
+
37
+ const SIG = { late: ['late', 'Something is late'], ready: ['ready', 'A report is ready'] };
38
+ function tabsHtml(m, on) {
39
+ return `<div class="pv-tabs" role="tablist" aria-label="${esc('Parts of the page')}">${m.tabs.map((t) => {
40
+ const s = SIG[t.sig];
41
+ return `<button type="button" class="pv-tab${t.id === on ? ' on' : ''}" role="tab" id="pvt-${esc(t.id)}" aria-controls="pvp" aria-selected="${t.id === on}" tabindex="${t.id === on ? 0 : -1}" data-pv="tab" data-k="${esc(t.id)}">`
42
+ + `${esc(t.label)}${t.n ? `<span class="pv-n">${esc(t.n)}</span>` : ''}${s ? `<i class="pv-sg ${s[0]}" role="img" aria-label="${esc(s[1])}"></i>` : ''}</button>`;
43
+ }).join('')}</div>`;
44
+ }
45
+ function lineHtml(l) {
46
+ if (!l || !(l.lead || l.rest)) return '';
47
+ return `<div class="pv-line" role="status"><span class="pv-face">${adler(l.warn ? 'honest' : 'handled', 36, { label: false, id: 'pv' })}</span><p>${l.lead ? `<b>${esc(l.lead)}</b>` : ''}${l.rest ? ' <span>' + esc(l.rest) + '</span>' : ''}</p></div>`;
48
+ }
49
+ function propsHtml(m) {
50
+ const P = m.props; if (m.shared || !P || !P.n) return '';
51
+ const open = OPEN.has(m.page);
52
+ return `<div class="pv-props"><button type="button" class="pv-one" data-pv="props" aria-expanded="${open}"><span class="pv-ic">${SV(SPARK)}</span>`
53
+ + `<span class="pv-rt"><b>${esc(P.n + (P.n === 1 ? ' proposal waits on you' : ' proposals wait on you'))}</b>${P.sub ? `<small>${esc(P.sub)}</small>` : ''}</span><span class="pv-chev">${SV(DOWN)}</span></button>`
54
+ + (open && P.html ? `<div class="pv-pbody">${P.html}</div>` : '') + '</div>';
55
+ }
56
+ /** The whole page: the top (✦ line, goal card, more cards, proposals), the tabs, the open tab's part. */
57
+ export function pageHtml(m) {
58
+ const on = m.tabs.some((t) => t.id === tabOf(m.page)) ? tabOf(m.page) : (m.tabs.find((t) => t.id === 'initiatives') || m.tabs[0] || {}).id;
59
+ const t = m.tabs.find((x) => x.id === on);
60
+ return `<div class="pv${m.shared ? ' shared' : ''}" data-pv-page="${esc(m.page)}">${lineHtml(m.line)}${m.goal || ''}${m.cards || ''}${propsHtml(m)}`
61
+ + (m.tabs.length ? tabsHtml(m, on) + `<div class="pv-panel" id="pvp" role="tabpanel" aria-labelledby="pvt-${esc(on)}">${t ? t.html() : ''}</div>` : '') + (m.tail || '') + '</div>';
62
+ }
63
+ /** The tab presses and the proposals fold, once per body. A press keeps the tab for this page and draws again (h.redraw). */
64
+ export function wirePage(body, h) {
65
+ if (body.dataset.pvWired) return; body.dataset.pvWired = '1';
66
+ const pageOf = () => { const p = body.querySelector('[data-pv-page]'); return p ? p.dataset.pvPage : ''; };
67
+ const go = (k) => { keepTab(pageOf(), k); h.redraw(); const t = body.querySelector(`[data-pv="tab"][data-k="${k}"]`); if (t) t.focus(); };
68
+ body.addEventListener('click', (e) => {
69
+ const b = e.target.closest('[data-pv]'); if (!b || !body.contains(b)) return;
70
+ if (b.dataset.pv === 'tab') go(b.dataset.k);
71
+ else if (b.dataset.pv === 'props') { const p = pageOf(); if (OPEN.has(p)) OPEN.delete(p); else OPEN.add(p); h.redraw(); const x = body.querySelector('[data-pv="props"]'); if (x) x.focus(); }
72
+ });
73
+ body.addEventListener('keydown', (e) => {
74
+ const b = e.target.closest && e.target.closest('[data-pv="tab"]'); if (!b || !['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(e.key)) return;
75
+ const L = [...body.querySelectorAll('[data-pv="tab"]')].map((x) => x.dataset.k), i = L.indexOf(b.dataset.k);
76
+ const j = e.key === 'Home' ? 0 : e.key === 'End' ? L.length - 1 : (i + (e.key === 'ArrowRight' ? 1 : -1) + L.length) % L.length;
77
+ e.preventDefault(); go(L[j]);
78
+ });
79
+ }
80
+
81
+ /* ── the goal card's parts, the same on a program and a product ── */
82
+ const DOT = { ahead: 'ok', on: 'ok', ok: 'ok', done: 'ok', behind: 'risk', risk: 'risk', late: 'late', none: 'q' };
83
+ const dotWord = (d) => (d === 'none' ? 'No reading yet' : d === 'behind' ? 'Behind its line' : d === 'ahead' ? 'Ahead of its line' : 'On its line');
84
+ const FC = { 'on-track': ['ok', 'On track'], 'at-risk': ['risk', 'At risk'], 'will-miss': ['late', 'Will miss'], held: ['q', 'Held'] };
85
+ const num = (v, u) => { const s = String(Math.round(v * 10) / 10), t = String(u || '').trim(); return t ? (/^[A-Za-z$]/.test(t) ? (t === '$' ? '$' + s : s + ' ' + t) : s + t) : s; };
86
+ /** Forecast's range bar on the goal card (FcIntel, rdProgAgreed): low to high, the goal as a tick, likely as a dot. Too early draws nothing. */
87
+ export function rangeHtml(fc) {
88
+ const w = fc && FC[fc.state], ok = (v) => typeof v === 'number' && Number.isFinite(v);
89
+ if (!w || !ok(fc.low) || !ok(fc.high)) return '';
90
+ const vs = [fc.low, fc.high].concat(ok(fc.target) ? [fc.target] : []), a = Math.min(...vs), b = Math.max(...vs), pad = (b - a) * 0.15 || Math.abs(b) * 0.1 || 1;
91
+ const x = (v) => Math.max(0, Math.min(100, ((v - (a - pad)) / (b - a + 2 * pad)) * 100)).toFixed(1);
92
+ const say = 'Forecast ' + num(fc.low, fc.unit) + ' to ' + num(fc.high, fc.unit) + (ok(fc.likely) ? ', likely ' + num(fc.likely, fc.unit) : '') + (ok(fc.target) ? ', goal ' + num(fc.target, fc.unit) : '');
93
+ return `<div class="pv-fc"><div class="pv-bar${fc.state === 'held' ? ' held' : ''}" role="img" aria-label="${esc(say)}"><i class="${w[0]}" style="left:${x(fc.low)}%;width:${(x(fc.high) - x(fc.low)).toFixed(1)}%"></i>`
94
+ + (ok(fc.target) ? `<span class="tg" style="left:${x(fc.target)}%"></span>` : '') + (ok(fc.likely) && fc.state !== 'held' ? `<span class="lk" style="left:${x(fc.likely)}%"></span>` : '') + `</div><small>${esc(w[1])}</small></div>`;
95
+ }
96
+ /** One goal of the card: its dot, the KR chip, the SHORT title (lib/ready-reports.js shortTitle), its reading; a press opens the goal. */
97
+ export function goalRow(g, o = {}) {
98
+ const tag = o.button === false ? 'div' : 'button type="button"', end = o.button === false ? 'div' : 'button';
99
+ return `<${tag} class="pv-gr"${o.button === false ? '' : ` data-db="goal" data-k="${esc(g.id)}"${g.ws ? ` data-ws="${esc(g.ws)}"` : ''}`} title="${esc(g.title || '')}">`
100
+ + `<span class="db-dot ${DOT[g.dot] || 'q'}" role="img" aria-label="${esc(dotWord(g.dot))}"></span>${g.kr ? `<span class="pv-kr">${esc(g.kr)}</span>` : ''}`
101
+ + `<span class="pv-rt"><b>${esc(g.short || g.title)}</b>${g.sub ? `<small>${esc(g.sub)}</small>` : ''}</span></${end}>${rangeHtml(g.fc)}`;
102
+ }
103
+ /** The goal card: the goals (or the one Claude proposes), then the milestones inside it; '' when it holds nothing. */
104
+ const GOALS_SHOWN = 3; // the card stays one card: the goals behind their line first, 3 shown, the rest one fold away (a product has many)
105
+ export function goalCard({ goals = [], proposed = '', inner = '', label = 'Goal', shared = false, open = null } = {}) {
106
+ const RANK = { behind: 0, risk: 0, late: 0, none: 2 }, L = goals.slice().sort((a, b) => (RANK[a.dot] ?? 1) - (RANK[b.dot] ?? 1));
107
+ const all = !!(open && open.has('goals')), shown = all || L.length <= GOALS_SHOWN + 1 ? L : L.slice(0, GOALS_SHOWN), rest = L.length - shown.length;
108
+ const more = L.length > GOALS_SHOWN + 1 ? `<button type="button" class="db-fold" data-db="fold" data-k="goals" aria-expanded="${all}"><span class="db-rt"><b>${all ? 'Show fewer' : rest + ' more'}</b>${all ? '' : `<small>${esc(L.slice(GOALS_SHOWN).map((g) => g.short || g.title).slice(0, 3).join(' · '))}</small>`}</span>${SV(DOWN)}</button>` : '';
109
+ const rows = shown.map((g) => goalRow(g, { button: !shared })).join('') + more;
110
+ if (!rows && !proposed && !inner) return '';
111
+ return `<section class="pv-gc${!rows && proposed ? ' p' : ''}" aria-label="${esc(goals.length > 1 ? label + 's' : label)}">${rows ? `<p class="pv-k">${esc(goals.length > 1 ? label + 's' : label)}</p>${rows}` : proposed}${inner}</section>`;
112
+ }
@@ -24,6 +24,9 @@ export const VIEW_CONTROLS = [
24
24
  // the viewer: the layout, the close, the folds, the Tasks view menu, a stage's fold and its done tasks
25
25
  '.cz-vw-ib[aria-label="Arrange"]', '.cz-vw-ib[aria-label="Close the viewer"]', '.cz-pn-menu', '[class*="cz-dv"]',
26
26
  '.iv-mctg', '.iv-gx-t', '.iv-ws', '.iv-grp', '.iv-ab-h', '.iv-fr', '.ivx-vb', '.tkc-pop [data-ivs-view]', '.tkc-pop [data-ivs-by]', '.tkc-pop [data-ivs-zoom]',
27
+ // the one program page (batch 21 item 2, RdProgO): open the program, its tabs, its folds, the period of its goals, an initiative of it
28
+ 'button.tg-pgo', 'button.bt-pgo', 'button.bd-lho', '#czViewer .pv-tab', '#czViewer [data-czs-fold]', '#czViewer .pp-nd .tw', '#czViewer [data-pp="ms"]', '#czViewer [data-pp="itasks"]',
29
+ '#czViewer [data-db="fold"]', '#czViewer [data-pp="period"]', '#czViewer [data-pp="per"]', '#czViewer [data-pp="early"]', '#czViewer [data-pp="ini"]',
27
30
  // the line above the Board
28
31
  '.ro-back',
29
32
  ].join(',');
@@ -36,11 +39,15 @@ const REMOVE = [
36
39
  '#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
37
40
  '.cz-vw-ib[aria-label="Discuss in chat"]', '.cz-vw-ib[aria-label="More"]', '.iv-addp', '.iv-prog', '.iv-plus', '.iv-car', '.iv-scgn', '.iv-gx-a',
38
41
  '.sm-card', '.pp-p', '.lk-chip.mv', // what Claude proposes to the publisher (batch 20 item 1): the pack carries none, and none is drawn
42
+ // the program page's writes and what a share does not hold (batch 21 item 2): proposals, adding, the charter, a document's file, the talk line
43
+ '.pv-props', '.pp-needs', '.msg-list', '.pp-add', '[data-pp="add"]', '[data-pp="first"]', '[data-pp="edit"]', '[data-pp="charter"]', '[data-pp="talk"]', '[data-doc]', '[data-db="milestones"]', '#czViewer .md-card',
39
44
  '.ab-lk', '[data-ivs-view="kanban"]', '.ivs-cols', '.ivs-h:has(+ .ivs-cols)', '[data-ivs-more]', '.iv-tasks .ig-emp', '.iv-tasks .ivk-h', '.iv-tasks .ig-read', '.iv-th .iv-ib', '.iv-th .iv-plus',
40
45
  ];
41
46
  /** Controls whose words are the content (a title, a date, a name, a program's milestone in the Deliveries lane): set as plain text, same look. A program's
42
47
  * milestone opens the program's charter in the workspace; a share does not hold the charter. */
43
- const PLAIN = ['button.dl-e[aria-label*="Program milestone"]:not([aria-label*="press to open"])', 'button.cz-vw-rn', 'button.iv-tt', 'button.iv-dc', 'button.iv-stc', 'button.iv-dtc', 'button.iv-wf', 'button.iv-cb', 'button.tg-pgo', 'button.bt-pgo', 'button.tg-end'];
48
+ const PLAIN = ['button.dl-e[aria-label*="Program milestone"]:not([aria-label*="press to open"])', 'button.cz-vw-rn', 'button.iv-tt', 'button.iv-dc', 'button.iv-stc', 'button.iv-dtc', 'button.iv-wf', 'button.iv-cb', 'button.tg-end',
49
+ // the program page (batch 21 item 2): a task's check box, a goal (its Viewer is in Intelligence), a report (its file is the publisher's), a program check
50
+ 'button.pp-ck', 'button.pv-gr', 'button.db-rep', 'button.pp-dm'];
44
51
  /** A fold whose body goes with it: Documents and Linked are not listed. */
45
52
  const WITH_BODY = ['[data-iv-fold="docs"]', '[data-iv-docs]', '[data-iv-fold="linked"]'];
46
53
 
@@ -43,6 +43,14 @@ function cleanChartBlock(b) {
43
43
  return out;
44
44
  }
45
45
 
46
+ /** The sections the PM named, in order: up to 10 short titles, each once. null when there are none. */
47
+ function cleanSections(v) {
48
+ if (!Array.isArray(v)) return null;
49
+ const seen = new Set();
50
+ const out = v.filter((x) => typeof x === 'string').map((x) => clip(x, 80)).filter((x) => x && !seen.has(x.toLowerCase()) && seen.add(x.toLowerCase())).slice(0, 10);
51
+ return out.length ? out : null;
52
+ }
53
+
46
54
  /** The block as the tab uses it, or null when it is not a block. Unknown keys are dropped; text is clipped. */
47
55
  export function cleanBlock(b) {
48
56
  if (b && typeof b === 'object' && (b.kind === 'chart' || b.kind === 'dashboard')) return cleanChartBlock(b);
@@ -51,12 +59,13 @@ export function cleanBlock(b) {
51
59
  const out = { kind: 'report', id: b.id };
52
60
  if (b.schedule !== undefined) { const s = cleanSchedule(b.schedule); if (s) out.schedule = s; }
53
61
  for (const k of ['structure', 'design']) { const v = clip(b[k], 600); if (v) out[k] = v; }
62
+ const secs = cleanSections(b.sections); if (secs) out.sections = secs;
54
63
  return out;
55
64
  }
56
65
  const p = b.proposal && typeof b.proposal === 'object' ? b.proposal : null;
57
66
  if (!p || !clip(p.name, 80)) return null;
58
- const shape = clip(b.structure, 600);
59
- return { kind: 'report', ...(shape ? { structure: shape } : {}), proposal: {
67
+ const shape = clip(b.structure, 600), secs = cleanSections(b.sections);
68
+ return { kind: 'report', ...(shape ? { structure: shape } : {}), ...(secs ? { sections: secs } : {}), proposal: {
60
69
  name: clip(p.name, 80), purpose: clip(p.purpose, 400), audience: clip(p.audience, 120) || 'The team',
61
70
  output: OUTPUTS.includes(p.output) ? p.output : 'google-doc', schedule: cleanSchedule(p.schedule) === 'off' ? null : cleanSchedule(p.schedule),
62
71
  sources: (Array.isArray(p.sources) ? p.sources : []).map((x) => clip(x, 160)).filter(Boolean).slice(0, 8),
@@ -86,5 +95,7 @@ export function reportChipHtml(block, i) {
86
95
  const what = k === 'report' && !P ? (block.schedule ? 'Schedule change' : block.structure || block.design ? 'Report change' : 'Report')
87
96
  : P && !block.id ? 'New ' + noun : P ? noun[0].toUpperCase() + noun.slice(1) + ' change' : noun[0].toUpperCase() + noun.slice(1);
88
97
  const tab = k === 'report' ? 'Report' : k === 'chart' ? 'Chart' : 'Dashboard';
89
- return `<div class="ctxc"><button type="button" class="ctxchip lead" data-report-open="${i}"><span><b>${esc(name)}</b><em>${esc(what)} · View in the ${tab} tab</em></span></button></div>`;
98
+ // a new report waits for one press, so the chip names it (Wawan, 2026-11-01: "I still don't know how to set it up")
99
+ const next = k === 'report' && P && !block.id ? 'Set it up in the Report tab' : 'View in the ' + tab + ' tab';
100
+ return `<div class="ctxc"><button type="button" class="ctxchip lead" data-report-open="${i}"><span><b>${esc(name)}</b><em>${esc(what)} · ${esc(next)}</em></span></button></div>`;
90
101
  }