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.
- package/package.json +25 -25
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/nine-stages.js +49 -20
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +103 -74
- package/workspace/briefing-premium-board-test.js +316 -154
- package/workspace/briefing-premium-calendar-2-test.js +135 -195
- package/workspace/briefing-premium-calendar-3-test.js +143 -413
- package/workspace/briefing-premium-calendar-test.js +86 -185
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +166 -294
- package/workspace/briefing-premium-insights-test.js +351 -214
- package/workspace/briefing-premium-metrics-test.js +53 -118
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +91 -52
- package/workspace/briefing-premium-test.js +150 -633
- package/workspace/briefing-premium-work-test.js +88 -269
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/board-premium-facts.js +2 -1
- package/workspace/fixtures/board-premium-jira.js +28 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/initiative-premium-facts.js +2 -1
- package/workspace/fixtures/initiatives-api/list.json +30 -42
- package/workspace/fixtures/initiatives-api/roadmap.json +40 -56
- package/workspace/fixtures/initiatives-api/sheet.json +10 -14
- package/workspace/fixtures/insights-premium-facts.js +11 -2
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/lifecycle.md +51 -0
- package/workspace/home-shot.js +38 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +160 -3
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/engine/boards.js +15 -14
- package/workspace/lib/engine/nine-stages.js +49 -20
- package/workspace/lib/engine/signals/detectors.js +13 -11
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +126 -1
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-premium.js +3 -2
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-initiatives.js +1 -1
- package/workspace/lib/routes-insights-premium.js +19 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/vendor/scripts/nine-stages.js +49 -20
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-agreed-viewer-shots.js +76 -0
- package/workspace/premium-board-actions-test.js +85 -73
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -36
- package/workspace/premium-chat-context-test.js +22 -19
- package/workspace/premium-chat-goal-view-test.js +28 -26
- package/workspace/premium-chat-notes-test.js +29 -33
- package/workspace/premium-chat-report-tab-test.js +35 -25
- package/workspace/premium-chat-term-test.js +16 -14
- package/workspace/premium-chat-viewer-test.js +60 -53
- package/workspace/premium-core-doc-issue-test.js +50 -41
- package/workspace/premium-html-viewer-test.js +17 -18
- package/workspace/premium-phone-card-test.js +8 -2
- package/workspace/premium-phone-room-test.js +42 -31
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -31
- package/workspace/premium-vw-cal-test.js +82 -123
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +12 -11
- package/workspace/premium-vw-item-test.js +50 -48
- package/workspace/premium-vw-jira-test.js +55 -26
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -107
- package/workspace/premium-vw-rec-test.js +72 -193
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +63 -51
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +224 -0
- package/workspace/public/pm/bd-stages.js +47 -0
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +640 -0
- package/workspace/public/pm/cozy-home.css +580 -0
- package/workspace/public/pm/cozy-home.js +172 -0
- package/workspace/public/pm/cozy-initiative.css +138 -0
- package/workspace/public/pm/cozy-insights.css +421 -0
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +65 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +143 -0
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +254 -0
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/lifecycle-lens-model.js +45 -27
- package/workspace/public/pm/lifecycle-lens.js +22 -11
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +544 -253
- package/workspace/public/pm/premium-brief.js +1 -1
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-chat.js +17 -10
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-initiative-head.js +138 -0
- package/workspace/public/pm/premium-initiative.js +28 -4
- package/workspace/public/pm/premium-insights.js +950 -440
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +107 -124
- package/workspace/public/pm/premium-viewer.js +27 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-jira-model.js +22 -5
- package/workspace/public/pm/premium-vw-jira.css +11 -0
- package/workspace/public/pm/premium-vw-jira.js +11 -4
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -215
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +57 -64
- package/workspace/public/premium-chat.html +7 -33
- package/workspace/public/premium-initiative.html +8 -41
- package/workspace/public/premium-insights.html +63 -62
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium-work.html +6 -72
- package/workspace/public/premium.html +21 -66
- package/workspace/public/vendor/nunito-var.woff2 +0 -0
- package/workspace/server.js +25 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-agreed-viewer.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/third-party/README.md +1 -0
- package/workspace/public/pm/premium-work.js +0 -719
- package/workspace/public/pm/premium.js +0 -1133
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
/* pm/premium-report-tab.js —
|
|
2
|
-
*
|
|
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)
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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 {
|
|
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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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(); //
|
|
45
|
-
|
|
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
|
-
|
|
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
|
|
60
|
+
return show(t);
|
|
57
61
|
}
|
|
58
|
-
|
|
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 &&
|
|
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="
|
|
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="
|
|
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="
|
|
110
|
-
return chip + `<div class="
|
|
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
|
-
|
|
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 `<
|
|
123
|
-
+ `<
|
|
124
|
-
+ `<
|
|
125
|
-
+ `<
|
|
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="
|
|
130
|
-
if (t.gone) return `<p class="
|
|
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="
|
|
133
|
-
return `<
|
|
134
|
-
+ `<div class="
|
|
135
|
-
+ `<div class="
|
|
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="
|
|
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="
|
|
143
|
-
+ `<span>${kind === 'sv' ? 'S' : 'D'}${n}${n === saved ? ' · saved' : ' · not saved'}</span><button type="button" class="
|
|
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="
|
|
150
|
-
const working = S && S.running ? '<p class="
|
|
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="
|
|
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="
|
|
158
|
-
if (Z.err) return `<p class="
|
|
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="
|
|
161
|
-
const working = Z.running ? '<p class="
|
|
162
|
-
const frame = t.dv != null ? (t.render.has(t.dv) ? `<
|
|
163
|
-
: '<p class="
|
|
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="
|
|
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) => `<
|
|
171
|
-
+ `<button type="button" class="
|
|
172
|
-
+ (d.state === 'issued' ?
|
|
173
|
-
return `<
|
|
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') {
|
|
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
|
-
|
|
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
|
-
|
|
219
|
-
|
|
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
|
|
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
|
});
|