create-pmos 0.397.0 → 0.399.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/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +105 -52
- package/workspace/briefing-premium-board-test.js +284 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +85 -196
- package/workspace/briefing-premium-doc-edit-test.js +99 -83
- package/workspace/briefing-premium-initiative-test.js +175 -290
- package/workspace/briefing-premium-insights-test.js +414 -219
- package/workspace/briefing-premium-metrics-test.js +55 -97
- package/workspace/briefing-premium-products-test.js +44 -28
- package/workspace/briefing-premium-sources-test.js +70 -49
- package/workspace/briefing-premium-test.js +155 -648
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +210 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +187 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +68 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-grill.js +63 -0
- package/workspace/lib/board-premium.js +121 -24
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/initiative-layout.js +77 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +64 -15
- package/workspace/lib/insights-records.js +115 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/meeting-points.js +52 -0
- package/workspace/lib/news-for-you.js +88 -0
- package/workspace/lib/notes-series.js +29 -6
- package/workspace/lib/report-confirm.js +48 -0
- package/workspace/lib/route-modules.js +12 -0
- package/workspace/lib/routes-board-docs.js +46 -0
- package/workspace/lib/routes-board-grill.js +90 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-home-review.js +108 -0
- package/workspace/lib/routes-initiative-layout.js +57 -0
- package/workspace/lib/routes-insights-premium.js +16 -4
- package/workspace/lib/routes-insights-records.js +133 -0
- package/workspace/lib/routes-meeting-points.js +37 -0
- package/workspace/lib/routes-news.js +57 -0
- package/workspace/lib/routes-notes.js +3 -1
- package/workspace/lib/routes-report-confirm.js +31 -0
- package/workspace/lib/routes-search.js +38 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/search-index.js +176 -0
- package/workspace/lib/transcript-steps.js +123 -0
- 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-board-actions-test.js +128 -82
- package/workspace/premium-briefing-depth-test.js +104 -90
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +37 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +46 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +52 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +10 -3
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +152 -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 -33
- package/workspace/premium-vw-cal-test.js +97 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +17 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +115 -187
- package/workspace/premium-vw-notes-test.js +88 -109
- package/workspace/premium-vw-rec-test.js +71 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +383 -0
- package/workspace/public/pm/bd-asks.js +261 -0
- package/workspace/public/pm/bd-pop.js +59 -0
- package/workspace/public/pm/bd-span.js +222 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/bd-views.js +169 -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 +798 -230
- package/workspace/public/pm/cozy-ev.css +228 -0
- package/workspace/public/pm/cozy-evmodel.js +106 -0
- package/workspace/public/pm/cozy-evui.js +47 -0
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +437 -170
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +104 -29
- package/workspace/public/pm/cozy-news.js +140 -0
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-search.js +203 -0
- package/workspace/public/pm/cozy-settings.js +198 -0
- package/workspace/public/pm/cozy-sources.js +89 -0
- package/workspace/public/pm/cozy-today.css +217 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +145 -0
- package/workspace/public/pm/cozy-vw-mtg.css +350 -0
- package/workspace/public/pm/cozy-vw-rp.css +152 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +1179 -0
- package/workspace/public/pm/home-around.js +413 -0
- package/workspace/public/pm/home-chat.js +512 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-dictate.js +54 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-ini-model.js +190 -0
- package/workspace/public/pm/home-ini.css +171 -0
- package/workspace/public/pm/home-ini.js +456 -0
- package/workspace/public/pm/home-list.js +276 -0
- package/workspace/public/pm/home-more.js +132 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-review.js +104 -0
- package/workspace/public/pm/home-task.js +67 -0
- package/workspace/public/pm/home-today.js +144 -0
- package/workspace/public/pm/home-work.js +547 -0
- 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 +548 -395
- package/workspace/public/pm/premium-chart-tab.js +109 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +23 -21
- package/workspace/public/pm/premium-insights.js +1102 -581
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-mtg-present.js +138 -0
- package/workspace/public/pm/premium-mtg-replay.js +142 -0
- 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 +669 -476
- package/workspace/public/pm/premium-report-tab.js +116 -67
- package/workspace/public/pm/premium-shell.js +76 -123
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +277 -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-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +958 -0
- package/workspace/public/pm/premium-vw-notes.js +116 -68
- 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 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/rp-parts.js +269 -0
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +29 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +26 -64
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +18 -107
- package/workspace/r/m1.png +0 -0
- package/workspace/r/m2.png +0 -0
- package/workspace/r/m3.png +0 -0
- package/workspace/r/nl.png +0 -0
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/initiative-layout.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
- package/workspace/test-lists/premium-uncovered-reports.json +9 -0
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/test-lists/uf-everywhere.json +15 -0
- package/workspace/test-lists/uf-home.json +9 -0
- package/workspace/test-lists/uncovered-board.json +9 -0
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -1,19 +1,24 @@
|
|
|
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, At a glance as the Brief draws it
|
|
7
|
+
* (premium-uncovered-features, canvas RpBrief): For, Read by, Goes out (the Schedule chip) and Format, then Set it up
|
|
8
|
+
* (POST /api/report-setups/setup). A report with Schedule Off (none said) is then paused at once with POST /api/report-setups/edit, so it
|
|
9
|
+
* runs once (PM, 2026-10-21).
|
|
10
|
+
* A SET-UP REPORT (block.id): At a glance with the Schedule chip (POST .../edit), Structure | Design with their versions, the cycles (Open
|
|
11
|
+
* opens one in the report panel, czViews.openReport), Share, Discard or Archive, and Delete template (POST .../remove). A change Claude proposes
|
|
12
|
+
* in words (block.structure, block.design, block.schedule) shows as one press. Structure: GET /api/report-structure; turn, accept (Use this) and
|
|
13
|
+
* revert (Undo). Design is the look conversation's card (canvas RpDesign): the name, who reads it and when it goes out, "Previewing new look"
|
|
14
|
+
* while the shown version is not the saved one, what the look follows (its samples and rules), Current beside New look, the preview, then
|
|
15
|
+
* Use it (accept) and Keep current (revert to the saved look). GET /api/report-design and its version renders. A confirm asks in the card.
|
|
12
16
|
*
|
|
13
17
|
* 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
18
|
* HTML the server sanitized, shown in a frame with an empty sandbox, so nothing in it runs. Nothing is sent outward. */
|
|
15
19
|
import { pmGet, pmPost } from './http.js';
|
|
16
|
-
import {
|
|
20
|
+
import { open as vOpen, current as vCur, body as vBody } from './cozy-viewer.js';
|
|
21
|
+
import { vzStyle } from './premium-vw-open.js';
|
|
17
22
|
|
|
18
23
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
19
24
|
const OUT = { 'google-slides': 'Google Slides', 'google-doc': 'Google Doc', 'google-sheets': 'Google Sheets', confluence: 'Confluence page', pdf: 'PDF' };
|
|
@@ -41,21 +46,32 @@ export function schedChoices(cur) {
|
|
|
41
46
|
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
47
|
}
|
|
43
48
|
|
|
44
|
-
const T = new Map(); //
|
|
45
|
-
/**
|
|
49
|
+
const T = new Map(); // view id → its state
|
|
50
|
+
/** The report parts' sheet (cozy-vw-rp.css), added to the page once (premium-report-read.js adds the same one). */
|
|
51
|
+
function rpStyle() {
|
|
52
|
+
if (typeof document === 'undefined' || document.querySelector('link[data-rp-css]')) return;
|
|
53
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/cozy-vw-rp.css'; l.setAttribute('data-rp-css', ''); document.head.appendChild(l);
|
|
54
|
+
}
|
|
55
|
+
const SV = (d, n = 16) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
56
|
+
/** Open (or refresh) the view of a checked report block (report-chat.js cleanBlock). */
|
|
46
57
|
export function openReportTab(block) {
|
|
47
58
|
if (!block) return null;
|
|
48
|
-
|
|
59
|
+
vzStyle(); rpStyle();
|
|
49
60
|
const id = 'report:' + (block.id || block.proposal.name).toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 60);
|
|
50
61
|
let t = T.get(id);
|
|
51
62
|
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 };
|
|
63
|
+
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
64
|
T.set(id, t);
|
|
54
65
|
if (block.id) load(t);
|
|
55
66
|
}
|
|
56
|
-
return
|
|
67
|
+
return show(t);
|
|
68
|
+
}
|
|
69
|
+
function show(t) {
|
|
70
|
+
const P = t.block.proposal;
|
|
71
|
+
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',
|
|
72
|
+
render: (el) => { el.onclick = (e) => press(t, e); draw(t, el); } });
|
|
57
73
|
}
|
|
58
|
-
const paneOf = (t) =>
|
|
74
|
+
const paneOf = (t) => (vCur() && vCur().id === t.id ? vBody() : null);
|
|
59
75
|
const redraw = (t) => { const el = paneOf(t); if (el) draw(t, el); };
|
|
60
76
|
|
|
61
77
|
async function load(t) {
|
|
@@ -67,6 +83,7 @@ async function load(t) {
|
|
|
67
83
|
if (S && S.ok) { t.S = S.structure; if (t.sv == null) t.sv = t.S.current; }
|
|
68
84
|
t.loaded = true;
|
|
69
85
|
if (t.view === 'design') await loadDesign(t);
|
|
86
|
+
if (t.setup && paneOf(t) && vCur().title !== t.setup.name) show(t); // the template's name is known now
|
|
70
87
|
redraw(t);
|
|
71
88
|
if (t.S && t.S.running) poll(t, 'structure');
|
|
72
89
|
}
|
|
@@ -76,6 +93,7 @@ async function loadDesign(t) {
|
|
|
76
93
|
t.Z = r.design;
|
|
77
94
|
if (t.dv == null) t.dv = t.Z.current != null ? t.Z.current : (t.Z.saved ? t.Z.saved.version : null);
|
|
78
95
|
await renderOf(t, t.dv);
|
|
96
|
+
if (t.Z.saved) await renderOf(t, t.Z.saved.version);
|
|
79
97
|
if (t.Z.running) poll(t, 'design');
|
|
80
98
|
}
|
|
81
99
|
async function renderOf(t, n) {
|
|
@@ -85,7 +103,7 @@ async function renderOf(t, n) {
|
|
|
85
103
|
/* One structure or design job runs at a time; wait for it, then show its newest version. */
|
|
86
104
|
async function poll(t, kind) {
|
|
87
105
|
const end = Date.now() + POLL_MAX;
|
|
88
|
-
while (Date.now() < end &&
|
|
106
|
+
while (Date.now() < end && T.get(t.id) === t) {
|
|
89
107
|
await new Promise((ok) => setTimeout(ok, POLL_MS));
|
|
90
108
|
if (kind === 'structure') {
|
|
91
109
|
const S = await get('/api/report-structure', { id: t.block.id });
|
|
@@ -100,77 +118,95 @@ async function poll(t, kind) {
|
|
|
100
118
|
const lastSaid = (log) => { const l = (log || []).filter((x) => x.who === 'pmos').pop(); return l ? l.text : ''; };
|
|
101
119
|
|
|
102
120
|
/* ── drawing ── */
|
|
103
|
-
const btn = (a, label, o = {}) => `<button type="button" class="
|
|
121
|
+
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
122
|
function schedHtml(t, cur) {
|
|
105
|
-
const chip = `<button type="button" class="
|
|
123
|
+
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
124
|
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('');
|
|
125
|
+
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
126
|
const days = cur && cur !== 'off' && (cur.cadence === 'weekly' || cur.cadence === 'bi-weekly')
|
|
109
|
-
? `<div class="
|
|
110
|
-
return chip + `<div class="
|
|
127
|
+
? `<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>` : '';
|
|
128
|
+
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>`;
|
|
129
|
+
}
|
|
130
|
+
/** At a glance (RpBrief): For, Read by, Goes out (the Schedule chip, html) and Format. A field no record holds says "not said". */
|
|
131
|
+
const glance = (forTxt, readBy, goes, fmt) => `<dl class="rp-kv"><dt>For</dt><dd>${forTxt ? esc(forTxt) : '<span class="rp-ns">not said</span>'}</dd><dt>Read by</dt><dd>${readBy ? esc(readBy) : '<span class="rp-ns">not said</span>'}</dd>`
|
|
132
|
+
+ `<dt>Goes out</dt><dd class="vz-rpc">${goes}</dd><dt>Format</dt><dd>${esc(fmt || 'PDF')}</dd></dl>`;
|
|
133
|
+
const sectionsHtml = (L) => `<ol class="vz-secs">${L.map(([h, d]) => `<li><b>${esc(h)}</b>${d ? `<span>${esc(d)}</span>` : ''}</li>`).join('')}</ol>`;
|
|
134
|
+
function askHtml(t) {
|
|
135
|
+
const A = t.ask; if (!A) return '';
|
|
136
|
+
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
137
|
}
|
|
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
138
|
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);
|
|
139
|
+
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
140
|
el.querySelectorAll('iframe[data-rt-frame]').forEach((f) => { f.srcdoc = t.render.get(+f.dataset.rtFrame) || ''; });
|
|
119
141
|
}
|
|
142
|
+
/** The new report as slides: its title slide, then one slide per section every new report has. */
|
|
143
|
+
export function deckOf(p) {
|
|
144
|
+
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 })));
|
|
145
|
+
}
|
|
120
146
|
function newHtml(t) {
|
|
121
|
-
const p = t.block.proposal;
|
|
122
|
-
return `<
|
|
123
|
-
+ `<
|
|
124
|
-
+ `<
|
|
125
|
-
+ `<
|
|
147
|
+
const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
|
|
148
|
+
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>`
|
|
149
|
+
+ `<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>`
|
|
150
|
+
+ `<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>`
|
|
151
|
+
+ `<section class="vz-blk rp-brief" aria-label="Set it up"><p class="rp-lbl">At a glance</p>${glance(p.purpose, p.audience, schedHtml(t, t.sched), OUT[p.output] || p.output)}`
|
|
152
|
+
+ `<p class="vz-note">Every new report has these sections. Once it is set up, ask in the chat to shape them.</p><div class="vz-r1">${btn('setup', t.busy ? 'Setting it up' : 'Set it up', { off: t.busy })}</div></section>`;
|
|
126
153
|
}
|
|
127
154
|
function setupHtml(t) {
|
|
128
155
|
const s = t.setup;
|
|
129
|
-
if (!t.loaded) return '<p class="
|
|
130
|
-
if (t.gone) return `<p class="
|
|
156
|
+
if (!t.loaded) return '<p class="vz-empty" role="status">Reading the report.</p>';
|
|
157
|
+
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
158
|
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="rt-
|
|
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>`
|
|
159
|
+
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>` : '';
|
|
160
|
+
return `<div class="rp-brief"><p class="rp-lbl">At a glance</p>${glance(s.purpose, s.audience, schedHtml(t, cur) + (s.next_draft ? ` <span class="vz-note">next draft ${esc(s.next_draft.slice(0, 10))}</span>` : ''), OUT[s.output] || s.output)}</div>${want}`
|
|
161
|
+
+ `<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
162
|
+ (t.view === 'design' ? designHtml(t) : structureHtml(t)) + cyclesHtml(t)
|
|
137
|
-
+ `<div class="
|
|
163
|
+
+ `<div class="vz-r1">${btn('remove', 'Delete template', { sec: true, off: t.busy })}</div>`;
|
|
138
164
|
}
|
|
139
165
|
function stepper(kind, n, list, saved) {
|
|
140
166
|
if (n == null || !list.length) return '';
|
|
141
167
|
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="
|
|
168
|
+
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>`
|
|
169
|
+
+ `<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
170
|
}
|
|
145
171
|
function structureHtml(t) {
|
|
146
172
|
const S = t.S, V = (S && S.versions) || [];
|
|
147
173
|
const plan = S && S.plan, shown = t.sv;
|
|
148
174
|
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="
|
|
175
|
+
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>` : '';
|
|
176
|
+
const working = S && S.running ? '<p class="vz-note" role="status">PMOS is making the next version.</p>' : '';
|
|
151
177
|
const save = shown != null && S && shown !== S.saved ? btn('s-accept', 'Use this', { off: t.busy }) : '';
|
|
152
178
|
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="
|
|
179
|
+
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
180
|
}
|
|
181
|
+
/** The look conversation's card (RpDesign): the preview of the shown look against the saved one, Use it and Keep current. */
|
|
155
182
|
function designHtml(t) {
|
|
156
183
|
const Z = t.Z;
|
|
157
|
-
if (!Z) return '<p class="
|
|
158
|
-
if (Z.err) return `<p class="
|
|
159
|
-
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
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
184
|
+
if (!Z) return '<p class="vz-note" role="status">Reading the design.</p>';
|
|
185
|
+
if (Z.err) return `<p class="vz-msg">${esc(Z.err)}</p>`;
|
|
186
|
+
const V = Z.versions || [], saved = Z.saved ? Z.saved.version : null, s = t.setup || {};
|
|
187
|
+
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>` : '';
|
|
188
|
+
const working = Z.running ? '<p class="vz-note" role="status">PMOS is making the next look.</p>' : '';
|
|
189
|
+
const preview = t.dv != null && t.dv !== saved;
|
|
190
|
+
const head = `<div class="vz-r1"><div class="rp-grow"><h2 class="rp-h2">${esc(s.name || t.block.id)}</h2><p class="vz-note">${esc([s.audience, OUT[s.output] || s.output, s.status === 'paused' ? 'not scheduled' : 'goes out ' + schedWords(s.schedule).replace(/^./, (c) => c.toLowerCase())].filter(Boolean).join(' · '))}</p></div>`
|
|
191
|
+
+ (preview ? '<span class="cz-pill you">Previewing new look</span>' : t.dv != null ? '<span class="cz-pill ok">Saved look</span>' : '') + '</div>';
|
|
192
|
+
const r = Z.rules || {};
|
|
193
|
+
const follows = (Z.samples || []).map((x) => x.name).concat((r.same || []).slice(0, 3)).filter(Boolean);
|
|
194
|
+
const fol = follows.length ? `<p class="rp-lbl">Follows</p><div class="rp-chips">${follows.map((x) => `<span class="rp-chip">${esc(String(x).slice(0, 40))}</span>`).join('')}</div>` : '';
|
|
195
|
+
const fr = (n, title) => (n != null && t.render.has(n) ? `<iframe sandbox="" tabindex="-1" title="${esc(title)}" data-rt-frame="${n}"></iframe>` : '<span class="rp-std">Standard PMOS look</span>');
|
|
196
|
+
const pair = preview ? `<div class="rp-pair"><button type="button" class="rp-thumb vz-hv" data-rt="dv|${saved == null ? t.dv : saved}"${saved == null ? ' disabled' : ''}><span class="rp-tf">${fr(saved, 'The current look')}</span><span class="rp-tl">Current</span></button>`
|
|
197
|
+
+ `<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>` : '';
|
|
198
|
+
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>')
|
|
199
|
+
: '<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>';
|
|
200
|
+
const use = preview ? btn('d-accept', 'Use it', { off: t.busy }) + btn('d-keep', 'Keep current', { sec: true, off: t.busy }) : '';
|
|
201
|
+
const undo = !preview && V.some((v) => v.n < (Z.current || 0)) ? btn('d-undo', 'Undo', { sec: true, off: t.busy }) : '';
|
|
202
|
+
return `${head}${stepper('dv', t.dv, V, saved)}${ask}${working}${fol}${pair}${frame}${use || undo ? `<div class="vz-r1">${use}${undo}</div>` : ''}`;
|
|
167
203
|
}
|
|
168
204
|
function cyclesHtml(t) {
|
|
169
205
|
if (!t.docs.length) return '';
|
|
170
|
-
const row = (d) => `<
|
|
171
|
-
+ `<button type="button" class="
|
|
172
|
-
+ (d.state === 'issued' ?
|
|
173
|
-
return `<
|
|
206
|
+
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>`
|
|
207
|
+
+ `<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>`
|
|
208
|
+
+ (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>';
|
|
209
|
+
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
210
|
}
|
|
175
211
|
|
|
176
212
|
/* ── pressing ── */
|
|
@@ -189,6 +225,10 @@ async function press(t, e) {
|
|
|
189
225
|
const b = e.target.closest('[data-rt]'); if (!b || b.disabled) return;
|
|
190
226
|
const [a, v] = [b.dataset.rt.split('|')[0], b.dataset.rt.slice(b.dataset.rt.indexOf('|') + 1)];
|
|
191
227
|
const cur = t.block.proposal ? t.sched : t.setup && (t.setup.status === 'paused' ? 'off' : t.setup.schedule);
|
|
228
|
+
if (a === 'askno') { t.ask = null; redraw(t); return; }
|
|
229
|
+
if (a === 'askyes') { const A = t.ask; t.ask = null; if (A) await A.run(); return; }
|
|
230
|
+
if (a === 'sl') { t.i += +v; redraw(t); return; }
|
|
231
|
+
if (a === 'go') { t.i = +v; redraw(t); return; }
|
|
192
232
|
if (a === 'sched') { t.open = !t.open; redraw(t); return; }
|
|
193
233
|
if (a === 'pick') { await setSchedule(t, schedChoices(cur)[+v]); return; }
|
|
194
234
|
if (a === 'day') { await setSchedule(t, Object.assign({}, cur, { day: v })); return; }
|
|
@@ -197,26 +237,35 @@ async function press(t, e) {
|
|
|
197
237
|
if (a === 'sv') { t.sv = +v; redraw(t); return; }
|
|
198
238
|
if (a === 'dv') { t.dv = +v; await renderOf(t, t.dv); redraw(t); return; }
|
|
199
239
|
if (a === 'setup') { await setUp(t); return; }
|
|
240
|
+
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
241
|
const id = t.block.id;
|
|
201
242
|
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
243
|
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; }
|
|
203
244
|
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; }
|
|
204
245
|
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
|
-
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 + '
|
|
246
|
+
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; }
|
|
247
|
+
if (a === 'd-keep') {
|
|
248
|
+
const Z = t.Z, saved = Z.saved ? Z.saved.version : null;
|
|
249
|
+
if (saved == null) { t.dv = null; t.msg = 'It keeps the standard look. The new look stays in the versions until you press Use it.'; redraw(t); return; }
|
|
250
|
+
await act(t, async () => { const r = await post('/api/report-design/revert', { id, n: saved }); if (!r || !r.ok) return why(r, 'The look did not change.'); t.Z = r.design; t.dv = saved; await renderOf(t, saved); return 'Kept the current look (D' + saved + ').'; });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
206
253
|
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') {
|
|
254
|
+
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
255
|
if (a === 'discard' || a === 'archive' || a === 'unarchive') {
|
|
209
|
-
|
|
210
|
-
await act(t, async () => {
|
|
256
|
+
const run = () => act(t, async () => {
|
|
211
257
|
const r = await post('/api/report-documents/' + (a === 'discard' ? 'discard' : 'archive'), a === 'discard' ? { path: v } : { path: v, archived: a === 'archive' });
|
|
212
258
|
if (!r || !r.ok) return why(r, 'That did not go through.');
|
|
213
259
|
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
260
|
});
|
|
261
|
+
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; }
|
|
262
|
+
await run();
|
|
215
263
|
return;
|
|
216
264
|
}
|
|
217
265
|
if (a === 'remove') {
|
|
218
|
-
|
|
219
|
-
|
|
266
|
+
t.ask = { text: 'Delete this template? Its schedule stops now. Its issued reports and its open draft stay.', yes: 'Delete template', no: 'Keep it',
|
|
267
|
+
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.'; }) };
|
|
268
|
+
redraw(t);
|
|
220
269
|
}
|
|
221
270
|
}
|
|
222
271
|
async function setUp(t) {
|
|
@@ -227,8 +276,8 @@ async function setUp(t) {
|
|
|
227
276
|
sources: p.sources.length ? p.sources : ['The records of this workspace'], learned_from: 'Set up from a chat.' } });
|
|
228
277
|
if (!r || !r.ok) return 'It was not set up: ' + why(r, 'the page could not reach PMOS') + '.';
|
|
229
278
|
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);
|
|
279
|
+
// the view now shows the set-up report, under the same id, so the card stays on it
|
|
280
|
+
t.block = { kind: 'report', id: r.setup.id }; t.loaded = false; show(t); await load(t);
|
|
232
281
|
const d = r.drafted || {};
|
|
233
282
|
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
283
|
});
|