create-pmos 0.396.0 → 0.398.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 (177) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/nine-stages.js +49 -20
  6. package/payload/state/discoveries.md +1 -1
  7. package/payload/state/log.md +1 -1
  8. package/workspace/briefing-premium-adddoc-test.js +103 -74
  9. package/workspace/briefing-premium-board-test.js +316 -154
  10. package/workspace/briefing-premium-calendar-2-test.js +135 -195
  11. package/workspace/briefing-premium-calendar-3-test.js +143 -413
  12. package/workspace/briefing-premium-calendar-test.js +86 -185
  13. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  14. package/workspace/briefing-premium-initiative-test.js +166 -294
  15. package/workspace/briefing-premium-insights-test.js +351 -214
  16. package/workspace/briefing-premium-metrics-test.js +53 -118
  17. package/workspace/briefing-premium-products-test.js +40 -27
  18. package/workspace/briefing-premium-sources-test.js +91 -52
  19. package/workspace/briefing-premium-test.js +150 -633
  20. package/workspace/briefing-premium-work-test.js +88 -269
  21. package/workspace/changelog.json +24 -0
  22. package/workspace/fixtures/board-premium-facts.js +2 -1
  23. package/workspace/fixtures/board-premium-jira.js +28 -0
  24. package/workspace/fixtures/board-premium-trail.js +32 -0
  25. package/workspace/fixtures/initiative-premium-facts.js +2 -1
  26. package/workspace/fixtures/initiatives-api/list.json +30 -42
  27. package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
  28. package/workspace/fixtures/initiatives-api/sheet.json +10 -14
  29. package/workspace/fixtures/insights-premium-facts.js +11 -2
  30. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  31. package/workspace/guide/briefing-premium.md +3 -1
  32. package/workspace/guide/home.md +47 -0
  33. package/workspace/guide/index.md +2 -0
  34. package/workspace/guide/lifecycle.md +51 -0
  35. package/workspace/home-shot.js +38 -0
  36. package/workspace/lib/agent-roles.js +71 -0
  37. package/workspace/lib/board-premium.js +160 -3
  38. package/workspace/lib/board-trail.js +223 -0
  39. package/workspace/lib/engine/boards.js +15 -14
  40. package/workspace/lib/engine/nine-stages.js +49 -20
  41. package/workspace/lib/engine/signals/detectors.js +13 -11
  42. package/workspace/lib/home-work-item.js +58 -0
  43. package/workspace/lib/insights-goals.js +196 -0
  44. package/workspace/lib/insights-premium.js +126 -1
  45. package/workspace/lib/insights-records.js +101 -0
  46. package/workspace/lib/jira-tickets.js +1 -1
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-board-premium.js +3 -2
  49. package/workspace/lib/routes-board-trail.js +33 -0
  50. package/workspace/lib/routes-home-desk.js +176 -0
  51. package/workspace/lib/routes-initiatives.js +1 -1
  52. package/workspace/lib/routes-insights-premium.js +19 -3
  53. package/workspace/lib/routes-insights-records.js +129 -0
  54. package/workspace/lib/routes-notes.js +1 -0
  55. package/workspace/lib/routes-viewer.js +108 -0
  56. package/workspace/lib/transcript-steps.js +123 -0
  57. package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
  58. package/workspace/lib/viewer-meeting.js +205 -0
  59. package/workspace/lib/viewer-report.js +89 -0
  60. package/workspace/package-lock.json +2 -2
  61. package/workspace/package.json +1 -1
  62. package/workspace/premium-agreed-viewer-shots.js +76 -0
  63. package/workspace/premium-board-actions-test.js +85 -73
  64. package/workspace/premium-briefing-depth-test.js +66 -53
  65. package/workspace/premium-chat-attach-test.js +54 -63
  66. package/workspace/premium-chat-chart-tab-test.js +35 -36
  67. package/workspace/premium-chat-context-test.js +22 -19
  68. package/workspace/premium-chat-goal-view-test.js +28 -26
  69. package/workspace/premium-chat-notes-test.js +29 -33
  70. package/workspace/premium-chat-report-tab-test.js +35 -25
  71. package/workspace/premium-chat-term-test.js +16 -14
  72. package/workspace/premium-chat-viewer-test.js +60 -53
  73. package/workspace/premium-core-doc-issue-test.js +50 -41
  74. package/workspace/premium-html-viewer-test.js +17 -18
  75. package/workspace/premium-phone-card-test.js +8 -2
  76. package/workspace/premium-phone-room-test.js +42 -31
  77. package/workspace/premium-report-read-test.js +115 -197
  78. package/workspace/premium-viewer-download-test.js +19 -22
  79. package/workspace/premium-viewer-flicker-test.js +11 -16
  80. package/workspace/premium-viewer-share-test.js +6 -9
  81. package/workspace/premium-viewer-test.js +41 -60
  82. package/workspace/premium-vw-backlog-test.js +53 -31
  83. package/workspace/premium-vw-cal-test.js +82 -123
  84. package/workspace/premium-vw-copy-test.js +17 -33
  85. package/workspace/premium-vw-doc-test.js +12 -11
  86. package/workspace/premium-vw-item-test.js +50 -48
  87. package/workspace/premium-vw-jira-test.js +55 -26
  88. package/workspace/premium-vw-meet-test.js +118 -187
  89. package/workspace/premium-vw-notes-test.js +85 -107
  90. package/workspace/premium-vw-rec-test.js +72 -193
  91. package/workspace/premium-vw-slides-test.js +46 -50
  92. package/workspace/premium-welcome-test.js +3 -2
  93. package/workspace/premium-work-depth-test.js +63 -51
  94. package/workspace/public/pm/bd-acts.js +305 -0
  95. package/workspace/public/pm/bd-span.js +224 -0
  96. package/workspace/public/pm/bd-stages.js +47 -0
  97. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  98. package/workspace/public/pm/c3-md.js +3 -395
  99. package/workspace/public/pm/c3-phone-detail.js +1 -1
  100. package/workspace/public/pm/c3-phone-model.js +3 -68
  101. package/workspace/public/pm/chat-term.js +3 -3
  102. package/workspace/public/pm/cozy-board.css +640 -0
  103. package/workspace/public/pm/cozy-home.css +580 -0
  104. package/workspace/public/pm/cozy-home.js +172 -0
  105. package/workspace/public/pm/cozy-initiative.css +138 -0
  106. package/workspace/public/pm/cozy-insights.css +421 -0
  107. package/workspace/public/pm/cozy-md.js +396 -0
  108. package/workspace/public/pm/cozy-nav.js +65 -0
  109. package/workspace/public/pm/cozy-placeholder.js +26 -0
  110. package/workspace/public/pm/cozy-viewer.css +143 -0
  111. package/workspace/public/pm/cozy-viewer.js +144 -0
  112. package/workspace/public/pm/cozy-vw.css +485 -0
  113. package/workspace/public/pm/cozy.css +254 -0
  114. package/workspace/public/pm/home-adddoc.js +48 -0
  115. package/workspace/public/pm/home-app.js +905 -0
  116. package/workspace/public/pm/home-around.js +515 -0
  117. package/workspace/public/pm/home-chat.js +459 -0
  118. package/workspace/public/pm/home-data.js +312 -0
  119. package/workspace/public/pm/home-draft.js +68 -0
  120. package/workspace/public/pm/home-more.js +249 -0
  121. package/workspace/public/pm/home-phone-card.js +109 -0
  122. package/workspace/public/pm/home-work.js +519 -0
  123. package/workspace/public/pm/lifecycle-lens-model.js +45 -27
  124. package/workspace/public/pm/lifecycle-lens.js +22 -11
  125. package/workspace/public/pm/phone-moment.js +69 -0
  126. package/workspace/public/pm/pm-work-view.js +1 -1
  127. package/workspace/public/pm/premium-attach.js +4 -0
  128. package/workspace/public/pm/premium-board.js +544 -253
  129. package/workspace/public/pm/premium-brief.js +1 -1
  130. package/workspace/public/pm/premium-chart-tab.js +110 -62
  131. package/workspace/public/pm/premium-chat.js +17 -10
  132. package/workspace/public/pm/premium-deck.js +3 -3
  133. package/workspace/public/pm/premium-first.js +25 -21
  134. package/workspace/public/pm/premium-initiative-head.js +138 -0
  135. package/workspace/public/pm/premium-initiative.js +28 -4
  136. package/workspace/public/pm/premium-insights.js +950 -440
  137. package/workspace/public/pm/premium-meeting.js +61 -549
  138. package/workspace/public/pm/premium-notes.js +1 -1
  139. package/workspace/public/pm/premium-report-frame.css +20 -0
  140. package/workspace/public/pm/premium-report-read.js +509 -480
  141. package/workspace/public/pm/premium-report-tab.js +87 -63
  142. package/workspace/public/pm/premium-shell.js +107 -124
  143. package/workspace/public/pm/premium-viewer.js +27 -1
  144. package/workspace/public/pm/premium-vw-cal.js +187 -48
  145. package/workspace/public/pm/premium-vw-doc.css +6 -0
  146. package/workspace/public/pm/premium-vw-doc.js +40 -2
  147. package/workspace/public/pm/premium-vw-file.js +2 -2
  148. package/workspace/public/pm/premium-vw-jira-model.js +22 -5
  149. package/workspace/public/pm/premium-vw-jira.css +11 -0
  150. package/workspace/public/pm/premium-vw-jira.js +11 -4
  151. package/workspace/public/pm/premium-vw-meet.js +6 -83
  152. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  153. package/workspace/public/pm/premium-vw-notes.js +56 -69
  154. package/workspace/public/pm/premium-vw-open.js +35 -0
  155. package/workspace/public/pm/premium-vw-page.js +16 -0
  156. package/workspace/public/pm/premium-vw-rec.js +11 -215
  157. package/workspace/public/pm/premium-vw-slides.css +5 -0
  158. package/workspace/public/pm/premium-vw-slides.js +44 -8
  159. package/workspace/public/pm/term-view.js +22 -0
  160. package/workspace/public/premium-board.html +57 -64
  161. package/workspace/public/premium-chat.html +7 -33
  162. package/workspace/public/premium-initiative.html +8 -41
  163. package/workspace/public/premium-insights.html +63 -62
  164. package/workspace/public/premium-viewer.html +20 -0
  165. package/workspace/public/premium-work.html +6 -72
  166. package/workspace/public/premium.html +21 -66
  167. package/workspace/public/vendor/nunito-var.woff2 +0 -0
  168. package/workspace/server.js +25 -3
  169. package/workspace/test-files.json +1 -0
  170. package/workspace/test-lists/home-libs.json +9 -0
  171. package/workspace/test-lists/premium-agreed-viewer.json +9 -0
  172. package/workspace/test-lists/premium-report-read.json +1 -1
  173. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  174. package/workspace/test-lists/premium-vw-notes.json +1 -1
  175. package/workspace/third-party/README.md +1 -0
  176. package/workspace/public/pm/premium-work.js +0 -719
  177. package/workspace/public/pm/premium.js +0 -1133
@@ -1,19 +1,21 @@
1
- /* pm/premium-report-tab.js — the Report tab beside a chat (initiative premium-reports-from-chat, slice B; PRD R1–R4). It replaces the Insight Studio's
2
- * Report mode: the PM asks in the chat, Claude ends its answer with a `pmos-report` block (public/pm/report-chat.js), and this tab shows it.
1
+ /* pm/premium-report-tab.js — a report from a chat, in the Viewer card (initiative premium-reports-from-chat, slice B; PRD R1–R4; re-drawn for
2
+ * premium-agreed-design, area viewer: Main.dc.html viewer "deck"). The PM asks in the chat, Claude ends its answer with a `pmos-report` block
3
+ * (public/pm/report-chat.js), and this view shows it in the czViewer card (cozy-viewer.js): no #dlg, no old tab, no premium.css.
3
4
  *
4
- * A NEW REPORT (block.proposal): its name, what it answers, audience, format, the seven sections every new report has, and the Schedule chip.
5
- * Set it up posts POST /api/report-setups/setup. A report with Schedule Off (none said) is then paused at once with POST /api/report-setups/edit,
6
- * so it runs once (PM, 2026-10-21).
7
- * A SET-UP REPORT (block.id): the Schedule chip (POST .../edit), Structure | Design with their versions, the cycles (drafts and issued reports) and
8
- * Delete template (POST .../remove). A change Claude proposes in words (block.structure, block.design, block.schedule) shows as one press.
9
- * Structure: GET /api/report-structure; turn, accept (Use this) and revert (Undo). Design: GET /api/report-design and its version renders;
10
- * turn, accept (This is it) and revert. A draft is discarded (POST /api/report-documents/discard); an issued report is kept for good and can
11
- * only be archived (POST /api/report-documents/archive). Share on a row opens the viewer's share popover (premium-vw-share.js) for that file.
5
+ * A NEW REPORT (block.proposal) is drawn as the design's slide deck: kind "Slide deck", the report's name, one large slide (the title slide,
6
+ * then one slide per section every new report has), ‹ "Slide n of N" ›, and the thumbnails. Under it, the part the design does not draw yet
7
+ * ("Waiting for design"): who it is for and its format, the Schedule chip, and Set it up (POST /api/report-setups/setup). A report with
8
+ * Schedule Off (none said) is then paused at once with POST /api/report-setups/edit, so it runs once (PM, 2026-10-21).
9
+ * A SET-UP REPORT (block.id), Waiting for design: the Schedule chip (POST .../edit), Structure | Design with their versions, the cycles (Open
10
+ * opens one in the report panel, czViews.openReport), Share, Discard or Archive, and Delete template (POST .../remove). A change Claude proposes
11
+ * in words (block.structure, block.design, block.schedule) shows as one press. Structure: GET /api/report-structure; turn, accept (Use this) and
12
+ * revert (Undo). Design: GET /api/report-design and its version renders; turn, accept (This is it) and revert. A confirm asks in the card.
12
13
  *
13
14
  * Every write is a press here, behind the launch nonce (http.js pmPost). Claude writes nothing: the routes refuse an agent session. A render is
14
15
  * HTML the server sanitized, shown in a frame with an empty sandbox, so nothing in it runs. Nothing is sent outward. */
15
16
  import { pmGet, pmPost } from './http.js';
16
- import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
17
+ import { open as vOpen, current as vCur, body as vBody } from './cozy-viewer.js';
18
+ import { vzStyle } from './premium-vw-open.js';
17
19
 
18
20
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
19
21
  const OUT = { 'google-slides': 'Google Slides', 'google-doc': 'Google Doc', 'google-sheets': 'Google Sheets', confluence: 'Confluence page', pdf: 'PDF' };
@@ -41,21 +43,28 @@ export function schedChoices(cur) {
41
43
  return ['off', { cadence: 'daily', time: '09:00' }, { cadence: 'weekly', day, time: '09:00' }, { cadence: 'bi-weekly', day, time: '09:00' }, { cadence: 'monthly', dayOfMonth: 1, time: '09:00' }];
42
44
  }
43
45
 
44
- const T = new Map(); // tab id → its state
45
- /** Open (or refresh) the Report tab for a checked block (report-chat.js cleanBlock). */
46
+ const T = new Map(); // view id → its state
47
+ const WAIT = (f) => `<span class="vz-wait" data-cz-placeholder="${esc(f)}">Waiting for design</span>`;
48
+ const SV = (d, n = 16) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
49
+ /** Open (or refresh) the view of a checked report block (report-chat.js cleanBlock). */
46
50
  export function openReportTab(block) {
47
51
  if (!block) return null;
48
- vwStyle('report');
52
+ vzStyle();
49
53
  const id = 'report:' + (block.id || block.proposal.name).toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 60);
50
54
  let t = T.get(id);
51
55
  if (!t || JSON.stringify(t.block) !== JSON.stringify(block)) {
52
- t = { id, block, sched: block.proposal ? (block.proposal.schedule || 'off') : null, open: false, view: 'structure', busy: false, msg: '', setup: null, docs: [], S: null, Z: null, sv: null, dv: null, render: new Map(), gone: false, loaded: false };
56
+ t = { id, block, sched: block.proposal ? (block.proposal.schedule || 'off') : null, open: false, view: 'structure', busy: false, msg: '', setup: null, docs: [], S: null, Z: null, sv: null, dv: null, render: new Map(), gone: false, loaded: false, i: 0, ask: null };
53
57
  T.set(id, t);
54
58
  if (block.id) load(t);
55
59
  }
56
- return vwOpen({ id, title: 'Report', icon: 'doc', render: (el) => draw(t, el), wire: (el) => { el.onclick = (e) => press(t, e); } });
60
+ return show(t);
57
61
  }
58
- const paneOf = (t) => document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(t.id)}"]`);
62
+ function show(t) {
63
+ const P = t.block.proposal;
64
+ return vOpen({ id: t.id, kind: P ? 'Slide deck' : 'Report template', title: P ? P.name : (t.setup && t.setup.name) || t.block.id, icon: P ? 'slides' : 'report',
65
+ render: (el) => { el.onclick = (e) => press(t, e); draw(t, el); } });
66
+ }
67
+ const paneOf = (t) => (vCur() && vCur().id === t.id ? vBody() : null);
59
68
  const redraw = (t) => { const el = paneOf(t); if (el) draw(t, el); };
60
69
 
61
70
  async function load(t) {
@@ -67,6 +76,7 @@ async function load(t) {
67
76
  if (S && S.ok) { t.S = S.structure; if (t.sv == null) t.sv = t.S.current; }
68
77
  t.loaded = true;
69
78
  if (t.view === 'design') await loadDesign(t);
79
+ if (t.setup && paneOf(t) && vCur().title !== t.setup.name) show(t); // the template's name is known now
70
80
  redraw(t);
71
81
  if (t.S && t.S.running) poll(t, 'structure');
72
82
  }
@@ -85,7 +95,7 @@ async function renderOf(t, n) {
85
95
  /* One structure or design job runs at a time; wait for it, then show its newest version. */
86
96
  async function poll(t, kind) {
87
97
  const end = Date.now() + POLL_MAX;
88
- while (Date.now() < end && paneOf(t)) {
98
+ while (Date.now() < end && T.get(t.id) === t) {
89
99
  await new Promise((ok) => setTimeout(ok, POLL_MS));
90
100
  if (kind === 'structure') {
91
101
  const S = await get('/api/report-structure', { id: t.block.id });
@@ -100,77 +110,84 @@ async function poll(t, kind) {
100
110
  const lastSaid = (log) => { const l = (log || []).filter((x) => x.who === 'pmos').pop(); return l ? l.text : ''; };
101
111
 
102
112
  /* ── drawing ── */
103
- const btn = (a, label, o = {}) => `<button type="button" class="btn${o.sec ? ' sec' : ''}${o.cls ? ' ' + o.cls : ''}" data-rt="${esc(a)}"${o.off ? ' disabled' : ''}${o.pressed != null ? ` aria-pressed="${o.pressed}"` : ''}>${esc(label)}</button>`;
113
+ const btn = (a, label, o = {}) => `<button type="button" class="${o.sec ? 'vz-sec2' : 'vz-issue'} vz-hv${o.cls ? ' ' + o.cls : ''}" data-rt="${esc(a)}"${o.off ? ' disabled' : ''}${o.pressed != null ? ` aria-pressed="${o.pressed}"` : ''}>${esc(label)}</button>`;
104
114
  function schedHtml(t, cur) {
105
- const chip = `<button type="button" class="rt-chip" data-rt="sched" aria-expanded="${t.open}"><em>Schedule</em><b>${esc(schedWords(cur))}</b></button>`;
115
+ const chip = `<button type="button" class="vz-c vz-hv" data-rt="sched" aria-haspopup="menu" aria-expanded="${t.open}">${SV('M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7v5l3 2', 14)}Schedule · <b>${esc(schedWords(cur))}</b>${SV('M7 10l5 5 5-5', 14)}</button>`;
106
116
  if (!t.open) return chip;
107
- const opts = schedChoices(cur).map((s, i) => `<button type="button" role="menuitemradio" aria-checked="${sameSched(s, cur)}" data-rt="pick|${i}">${esc(schedWords(s))}</button>`).join('');
117
+ const opts = schedChoices(cur).map((s, i) => `<button type="button" class="vz-mi vz-hv" role="menuitemradio" aria-checked="${sameSched(s, cur)}" data-rt="pick|${i}"><span class="vz-ring"></span>${esc(schedWords(s))}</button>`).join('');
108
118
  const days = cur && cur !== 'off' && (cur.cadence === 'weekly' || cur.cadence === 'bi-weekly')
109
- ? `<div class="rt-days" role="group" aria-label="Day">${Object.keys(DAYN).slice(0, 5).map((d) => btn('day|' + d, d, { sec: cur.day !== d, pressed: cur.day === d })).join('')}</div>` : '';
110
- return chip + `<div class="rt-menu" role="menu" aria-label="Schedule">${opts}${days}<p class="rt-note">Or say it in the chat: “make it every two weeks”.</p></div>`;
119
+ ? `<div class="vz-r1 vz-g6" role="group" aria-label="Day">${Object.keys(DAYN).slice(0, 5).map((d) => `<button type="button" class="vz-dbtn vz-hv" data-rt="day|${d}" aria-pressed="${cur.day === d}">${d}</button>`).join('')}</div>` : '';
120
+ return chip + `<div class="vz-schm" role="menu" aria-label="Schedule">${opts}${days}<p class="vz-note">Or say it in the chat: “make it every two weeks”.</p></div>`;
121
+ }
122
+ const sectionsHtml = (L) => `<ol class="vz-secs">${L.map(([h, d]) => `<li><b>${esc(h)}</b>${d ? `<span>${esc(d)}</span>` : ''}</li>`).join('')}</ol>`;
123
+ function askHtml(t) {
124
+ const A = t.ask; if (!A) return '';
125
+ return `<div class="vz-ask2" role="group" aria-label="${esc(A.yes)}"><span>${esc(A.text)}</span><div><button type="button" class="vz-issue vz-hv vz-h36" data-rt="askyes" data-k="bad">${esc(A.yes)}</button><button type="button" class="vz-sec2 vz-hv vz-h36" data-rt="askno">${esc(A.no)}</button></div></div>`;
111
126
  }
112
- const sectionsHtml = (L) => `<ol class="rt-secs">${L.map(([h, d]) => `<li><b>${esc(h)}</b>${d ? `<span>${esc(d)}</span>` : ''}</li>`).join('')}</ol>`;
113
-
114
127
  function draw(t, el) {
115
- const ask = el.querySelector(':scope > .vcf'); // an open confirm card outlives a redraw (a poll or a load), so its answer still lands
116
- el.innerHTML = `<div class="rt">${t.block.proposal ? newHtml(t) : setupHtml(t)}${t.msg ? `<p class="rt-msg" role="status">${esc(t.msg)}</p>` : ''}</div>`;
117
- if (ask) el.prepend(ask);
128
+ el.innerHTML = `<div class="vz ${t.block.proposal ? 'vz-dk' : 'vz-rtp'}" data-vw="${esc(t.id)}">${askHtml(t)}${t.block.proposal ? newHtml(t) : setupHtml(t)}${t.msg ? `<p class="vz-msg" role="status">${esc(t.msg)}</p>` : ''}</div>`;
118
129
  el.querySelectorAll('iframe[data-rt-frame]').forEach((f) => { f.srcdoc = t.render.get(+f.dataset.rtFrame) || ''; });
119
130
  }
131
+ /** The new report as slides: its title slide, then one slide per section every new report has. */
132
+ export function deckOf(p) {
133
+ 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 })));
134
+ }
120
135
  function newHtml(t) {
121
- const p = t.block.proposal;
122
- return `<p class="rt-eye">New report · from this chat</p><h3 class="rt-h">${esc(p.name)}</h3>${p.purpose ? `<p class="rt-sub">${esc(p.purpose)}</p>` : ''}`
123
- + `<p class="rt-meta">For ${esc(p.audience)} · ${esc(OUT[p.output] || p.output)}</p><div class="rt-row">${schedHtml(t, t.sched)}</div>`
124
- + `<p class="rt-label">Sections</p>${sectionsHtml(FRAME)}<p class="rt-note">Every new report has these sections. Once it is set up, ask in the chat to shape them.</p>`
125
- + `<div class="rt-foot">${btn('setup', t.busy ? 'Setting it up' : 'Set it up', { off: t.busy })}</div>`;
136
+ const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
137
+ return `<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>`
138
+ + `<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>`
139
+ + `<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>`
140
+ + `<section class="vz-blk" aria-label="Set it up"><div class="vz-r1"><h3>New report · from this chat</h3>${WAIT('Report setup from a chat')}</div>`
141
+ + `<p class="vz-note">For ${esc(p.audience)} · ${esc(OUT[p.output] || p.output)}. Every new report has these sections. Once it is set up, ask in the chat to shape them.</p>`
142
+ + `<div class="vz-rpc">${schedHtml(t, t.sched)}</div><div class="vz-r1">${btn('setup', t.busy ? 'Setting it up' : 'Set it up', { off: t.busy })}</div></section>`;
126
143
  }
127
144
  function setupHtml(t) {
128
145
  const s = t.setup;
129
- if (!t.loaded) return '<p class="rt-note" role="status">Reading the report.</p>';
130
- if (t.gone) return `<p class="rt-eye">Report</p><h3 class="rt-h">${esc(t.block.id)}</h3><p class="rt-note">This template is deleted, or it is not set up in this workspace. Its issued reports are kept.</p>${cyclesHtml(t)}`;
146
+ if (!t.loaded) return '<p class="vz-empty" role="status">Reading the report.</p>';
147
+ if (t.gone) return `<p class="vz-msg">This template (${esc(t.block.id)}) is deleted, or it is not set up in this workspace. Its issued reports are kept.</p>${cyclesHtml(t)}`;
131
148
  const cur = s.status === 'paused' ? 'off' : s.schedule;
132
- const want = t.block.schedule && !sameSched(t.block.schedule, cur) ? `<div class="rt-ask"><p>Claude proposes: <b>${esc(schedWords(t.block.schedule))}</b></p>${btn('sched-use', 'Change the schedule', { off: t.busy })}</div>` : '';
133
- return `<p class="rt-eye">Report template</p><h3 class="rt-h">${esc(s.name)}</h3><p class="rt-meta">For ${esc(s.audience || 'no one named')} · ${esc(OUT[s.output] || s.output)}${s.next_draft ? ' · next draft ' + esc(s.next_draft.slice(0, 10)) : ''}</p>`
134
- + `<div class="rt-row">${schedHtml(t, cur)}</div>${want}`
135
- + `<div class="rt-seg" role="group" aria-label="Step">${btn('view|structure', 'Structure', { sec: t.view !== 'structure', pressed: t.view === 'structure' })}${btn('view|design', 'Design', { sec: t.view !== 'design', pressed: t.view === 'design' })}</div>`
149
+ const want = t.block.schedule && !sameSched(t.block.schedule, cur) ? `<div class="vz-ask"><p>Claude proposes: <b>${esc(schedWords(t.block.schedule))}</b></p><div>${btn('sched-use', 'Change the schedule', { off: t.busy })}</div></div>` : '';
150
+ return `<div class="vz-r1">${WAIT('Report template')}</div><p class="vz-note">For ${esc(s.audience || 'no one named')} · ${esc(OUT[s.output] || s.output)}${s.next_draft ? ' · next draft ' + esc(s.next_draft.slice(0, 10)) : ''}</p>`
151
+ + `<div class="vz-rpc">${schedHtml(t, cur)}</div>${want}`
152
+ + `<div class="vz-sg" role="group" aria-label="Step"><button type="button" data-rt="view|structure" aria-pressed="${t.view === 'structure'}">Structure</button><button type="button" data-rt="view|design" aria-pressed="${t.view === 'design'}">Design</button></div>`
136
153
  + (t.view === 'design' ? designHtml(t) : structureHtml(t)) + cyclesHtml(t)
137
- + `<div class="rt-foot rt-end">${btn('remove', 'Delete template', { sec: true, cls: 'rt-del', off: t.busy })}</div>`;
154
+ + `<div class="vz-r1">${btn('remove', 'Delete template', { sec: true, off: t.busy })}</div>`;
138
155
  }
139
156
  function stepper(kind, n, list, saved) {
140
157
  if (n == null || !list.length) return '';
141
158
  const i = list.findIndex((v) => v.n === n);
142
- return `<div class="rt-ver"><button type="button" class="rt-arrow" data-rt="${kind}|${list[i - 1] ? list[i - 1].n : n}" aria-label="Earlier version"${i <= 0 ? ' disabled' : ''}>‹</button>`
143
- + `<span>${kind === 'sv' ? 'S' : 'D'}${n}${n === saved ? ' · saved' : ' · not saved'}</span><button type="button" class="rt-arrow" data-rt="${kind}|${list[i + 1] ? list[i + 1].n : n}" aria-label="Later version"${i >= list.length - 1 ? ' disabled' : ''}>›</button></div>`;
159
+ 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>`
160
+ + `<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>`;
144
161
  }
145
162
  function structureHtml(t) {
146
163
  const S = t.S, V = (S && S.versions) || [];
147
164
  const plan = S && S.plan, shown = t.sv;
148
165
  const L = plan && plan.outline ? plan.outline.map((x) => [x.title, x.notes || '']) : FRAME;
149
- const ask = t.block.structure && !(S && S.running) ? `<div class="rt-ask"><p>Your change: <b>“${esc(t.block.structure)}”</b></p>${btn('s-turn', 'Make the next version', { off: t.busy })}</div>` : '';
150
- const working = S && S.running ? '<p class="rt-note" role="status">PMOS is making the next version.</p>' : '';
166
+ 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>` : '';
167
+ const working = S && S.running ? '<p class="vz-note" role="status">PMOS is making the next version.</p>' : '';
151
168
  const save = shown != null && S && shown !== S.saved ? btn('s-accept', 'Use this', { off: t.busy }) : '';
152
169
  const undo = V.some((v) => v.n < (S ? S.current : 0)) ? btn('s-undo', 'Undo', { sec: true, off: t.busy }) : '';
153
- return `${stepper('sv', shown, V, S && S.saved)}${ask}${working}${sectionsHtml(L)}${!V.length ? '<p class="rt-note">No structure version yet: each cycle uses these sections. Say in the chat how to shape them.</p>' : ''}${save || undo ? `<div class="rt-foot">${undo}${save}</div>` : ''}`;
170
+ 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>` : ''}`;
154
171
  }
155
172
  function designHtml(t) {
156
173
  const Z = t.Z;
157
- if (!Z) return '<p class="rt-note" role="status">Reading the design.</p>';
158
- if (Z.err) return `<p class="rt-note">${esc(Z.err)}</p>`;
174
+ if (!Z) return '<p class="vz-note" role="status">Reading the design.</p>';
175
+ if (Z.err) return `<p class="vz-msg">${esc(Z.err)}</p>`;
159
176
  const V = Z.versions || [], saved = Z.saved ? Z.saved.version : null;
160
- const ask = t.block.design && !Z.running ? `<div class="rt-ask"><p>Your change: <b>“${esc(t.block.design)}”</b></p>${btn('d-turn', 'Make the next version', { off: t.busy })}</div>` : '';
161
- const working = Z.running ? '<p class="rt-note" role="status">PMOS is making the next version.</p>' : '';
162
- const frame = t.dv != null ? (t.render.has(t.dv) ? `<iframe class="rt-frame" sandbox="" title="Design version D${t.dv}" data-rt-frame="${t.dv}"></iframe>` : '<p class="rt-note">This version could not be read.</p>')
163
- : '<p class="rt-note">No design version yet. Say in the chat how it should look, or attach a sample. Each cycle uses the standard look until then.</p>';
177
+ const ask = t.block.design && !Z.running ? `<div class="vz-ask"><p>Your change: <b>“${esc(t.block.design)}”</b></p><div>${btn('d-turn', 'Make the next version', { off: t.busy })}</div></div>` : '';
178
+ const working = Z.running ? '<p class="vz-note" role="status">PMOS is making the next version.</p>' : '';
179
+ 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>')
180
+ : '<p class="vz-note">No design version yet. Say in the chat how it should look, or attach a sample. Each cycle uses the standard look until then.</p>';
164
181
  const save = t.dv != null && t.dv !== saved ? btn('d-accept', 'This is it', { off: t.busy }) : '';
165
182
  const undo = V.some((v) => v.n < (Z.current || 0)) ? btn('d-undo', 'Undo', { sec: true, off: t.busy }) : '';
166
- return `${stepper('dv', t.dv, V, saved)}${ask}${working}${frame}${save || undo ? `<div class="rt-foot">${undo}${save}</div>` : ''}`;
183
+ return `${stepper('dv', t.dv, V, saved)}${ask}${working}${frame}${save || undo ? `<div class="vz-r1">${undo}${save}</div>` : ''}`;
167
184
  }
168
185
  function cyclesHtml(t) {
169
186
  if (!t.docs.length) return '';
170
- const row = (d) => `<li><span class="rt-tag ${d.state}">${d.state === 'issued' ? 'Issued' : 'Draft'}</span><span class="rt-slot">${esc(d.slot)}${d.archived ? ' · archived' : ''}</span>`
171
- + `<button type="button" class="btn sec" data-rt="share|${esc(d.path)}" data-fsh aria-haspopup="dialog" aria-expanded="false">Share</button>`
172
- + (d.state === 'issued' ? btn((d.archived ? 'unarchive|' : 'archive|') + d.path, d.archived ? 'Bring back' : 'Archive', { sec: true, off: t.busy }) : btn('discard|' + d.path, 'Discard', { sec: true, off: t.busy })) + '</li>';
173
- return `<p class="rt-label">Reports</p><ul class="rt-cyc">${t.docs.map(row).join('')}</ul><p class="rt-note">An issued report is kept for good. A draft can be discarded until it is issued.</p>`;
187
+ const row = (d) => `<div class="vz-row vz-sm"><span class="vz-cc"${d.state === 'issued' ? ' data-k="ok"' : ''}>${d.state === 'issued' ? 'Issued' : 'Draft'}</span><span><b>${esc(d.slot)}${d.archived ? ' · archived' : ''}</b></span>`
188
+ + `<button type="button" class="vz-b vz-hv" data-rt="open|${esc(d.path)}">Open</button><button type="button" class="vz-b vz-hv" data-rt="share|${esc(d.path)}" data-fsh aria-haspopup="dialog" aria-expanded="false">Share</button>`
189
+ + (d.state === 'issued' ? `<button type="button" class="vz-b vz-hv" data-rt="${d.archived ? 'unarchive' : 'archive'}|${esc(d.path)}"${t.busy ? ' disabled' : ''}>${d.archived ? 'Bring back' : 'Archive'}</button>` : `<button type="button" class="vz-b vz-hv" data-rt="discard|${esc(d.path)}"${t.busy ? ' disabled' : ''}>Discard</button>`) + '</div>';
190
+ return `<h3>Reports</h3><div class="vz-col">${t.docs.map(row).join('')}</div><p class="vz-note">An issued report is kept for good. A draft can be discarded until it is issued.</p>`;
174
191
  }
175
192
 
176
193
  /* ── pressing ── */
@@ -189,6 +206,10 @@ async function press(t, e) {
189
206
  const b = e.target.closest('[data-rt]'); if (!b || b.disabled) return;
190
207
  const [a, v] = [b.dataset.rt.split('|')[0], b.dataset.rt.slice(b.dataset.rt.indexOf('|') + 1)];
191
208
  const cur = t.block.proposal ? t.sched : t.setup && (t.setup.status === 'paused' ? 'off' : t.setup.schedule);
209
+ if (a === 'askno') { t.ask = null; redraw(t); return; }
210
+ if (a === 'askyes') { const A = t.ask; t.ask = null; if (A) await A.run(); return; }
211
+ if (a === 'sl') { t.i += +v; redraw(t); return; }
212
+ if (a === 'go') { t.i = +v; redraw(t); return; }
192
213
  if (a === 'sched') { t.open = !t.open; redraw(t); return; }
193
214
  if (a === 'pick') { await setSchedule(t, schedChoices(cur)[+v]); return; }
194
215
  if (a === 'day') { await setSchedule(t, Object.assign({}, cur, { day: v })); return; }
@@ -197,6 +218,7 @@ async function press(t, e) {
197
218
  if (a === 'sv') { t.sv = +v; redraw(t); return; }
198
219
  if (a === 'dv') { t.dv = +v; await renderOf(t, t.dv); redraw(t); return; }
199
220
  if (a === 'setup') { await setUp(t); return; }
221
+ 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; }
200
222
  const id = t.block.id;
201
223
  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; }
202
224
  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; }
@@ -204,19 +226,21 @@ async function press(t, e) {
204
226
  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; }
205
227
  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 'D' + t.dv + ' is the saved design. The next cycle follows it.'; }); return; }
206
228
  if (a === 'd-undo') { const V = t.Z.versions.filter((x) => x.n < t.Z.current); const to = V[V.length - 1].n; await act(t, async () => { const r = await post('/api/report-design/revert', { id, n: to }); if (!r || !r.ok) return why(r, 'Undo did not go through.'); t.Z = r.design; t.dv = t.Z.current; await renderOf(t, t.dv); return 'Back to D' + to + '.'; }); return; }
207
- if (a === 'share') { vwStyle('doc'); const d = t.docs.find((x) => x.path === v); import('./premium-vw-share.js').then((M) => M.shareMenu(b, { name: (d && d.name ? d.name + ' · ' + d.slot : v.split('/').pop()), ws: ws(), rel: v, text: '' })); return; }
229
+ if (a === 'share') { const d = t.docs.find((x) => x.path === v); import('./premium-vw-share.js').then((M) => M.shareMenu(b, { name: (d && d.name ? d.name + ' · ' + d.slot : v.split('/').pop()), ws: ws(), rel: v, text: '' })); return; }
208
230
  if (a === 'discard' || a === 'archive' || a === 'unarchive') {
209
- if (a === 'discard' && !(await vwConfirm(paneOf(t), { text: 'Discard this draft? It is deleted. Issued reports are not touched.', yes: 'Discard', no: 'Keep it' }))) return;
210
- await act(t, async () => {
231
+ const run = () => act(t, async () => {
211
232
  const r = await post('/api/report-documents/' + (a === 'discard' ? 'discard' : 'archive'), a === 'discard' ? { path: v } : { path: v, archived: a === 'archive' });
212
233
  if (!r || !r.ok) return why(r, 'That did not go through.');
213
234
  await load(t); return a === 'discard' ? 'The draft is discarded.' : a === 'archive' ? 'Archived. It is kept, and hidden from the list.' : 'It is back in the list.';
214
235
  });
236
+ if (a === 'discard') { t.ask = { text: 'Discard this draft? It is deleted. Issued reports are not touched.', yes: 'Discard', no: 'Keep it', run }; redraw(t); return; }
237
+ await run();
215
238
  return;
216
239
  }
217
240
  if (a === 'remove') {
218
- if (!(await vwConfirm(paneOf(t), { text: 'Delete this template? Its schedule stops now. Its issued reports and its open draft stay.', yes: 'Delete template', no: 'Keep it' }))) return;
219
- await act(t, async () => { const r = await post('/api/report-setups/remove', { id }); if (!r || !r.ok) return why(r, 'The template was not deleted.'); await load(t); return 'Template deleted. Its schedule stopped; its reports are kept.'; });
241
+ t.ask = { text: 'Delete this template? Its schedule stops now. Its issued reports and its open draft stay.', yes: 'Delete template', no: 'Keep it',
242
+ run: () => act(t, async () => { const r = await post('/api/report-setups/remove', { id }); if (!r || !r.ok) return why(r, 'The template was not deleted.'); await load(t); return 'Template deleted. Its schedule stopped; its reports are kept.'; }) };
243
+ redraw(t);
220
244
  }
221
245
  }
222
246
  async function setUp(t) {
@@ -227,8 +251,8 @@ async function setUp(t) {
227
251
  sources: p.sources.length ? p.sources : ['The records of this workspace'], learned_from: 'Set up from a chat.' } });
228
252
  if (!r || !r.ok) return 'It was not set up: ' + why(r, 'the page could not reach PMOS') + '.';
229
253
  if (t.sched === 'off') await post('/api/report-setups/edit', { id: r.setup.id, schedule: { cadence: 'off' } });
230
- // the tab now shows the set-up report
231
- t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; await load(t);
254
+ // the view now shows the set-up report, under the same id, so the card stays on it
255
+ t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; show(t); await load(t);
232
256
  const d = r.drafted || {};
233
257
  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.' : '');
234
258
  });