create-pmos 0.327.0 → 0.329.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 +1 -1
- package/payload/KIT-VERSION +1 -1
- 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/workspace/briefing-premium-insights-test.js +56 -25
- package/workspace/guide/briefing-premium.md +11 -5
- package/workspace/guide/docs.md +3 -0
- package/workspace/lib/doc-reads-store.js +90 -0
- package/workspace/lib/doc-reads.js +128 -0
- package/workspace/lib/doc-sync-store.js +1 -1
- package/workspace/lib/docs-cli.js +48 -3
- package/workspace/lib/insights-premium.js +111 -26
- package/workspace/lib/premium-dashboards.js +25 -5
- package/workspace/lib/routes-insights-premium.js +19 -4
- package/workspace/lib/routes-premium-dashboards.js +12 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-report-read-test.js +4 -2
- package/workspace/premium-studio-chart-test.js +3 -3
- package/workspace/premium-studio-report-test.js +1 -1
- package/workspace/premium-studio-test.js +4 -4
- package/workspace/premium-vw-copy-test.js +133 -0
- package/workspace/premium-vw-slides-test.js +8 -4
- package/workspace/public/pm/premium-doc-sheet.js +3 -1
- package/workspace/public/pm/premium-insights.css +52 -0
- package/workspace/public/pm/premium-insights.js +129 -50
- package/workspace/public/pm/premium-meeting.js +3 -2
- package/workspace/public/pm/premium-vw-copies.js +133 -0
- package/workspace/public/pm/premium-vw-copy.css +27 -0
- package/workspace/public/premium-insights.html +29 -19
- package/workspace/server.js +42 -0
- package/workspace/skills/doc-read.skill +32 -0
- package/workspace/test-lists/doc-reads.json +5 -0
- package/workspace/test-lists/premium-vw-copy.json +12 -0
|
@@ -123,7 +123,7 @@ export function meetingView(row, replay, material, extra) {
|
|
|
123
123
|
notesLine: S ? '' : !replay ? 'Reading the notes.' : replay.state === 'error' ? 'The notes could not be read: ' + clip(replay.error, 120) : replay.state === 'none' ? 'No notes for this meeting.' : '',
|
|
124
124
|
brief: (extra && extra.brief) || null,
|
|
125
125
|
replay: rep && (rep.audio || heard) ? { minutes: heard, keyPoints: keys.length, lines: Array.isArray(rep.lines) ? rep.lines.length : 0 } : null,
|
|
126
|
-
material: material && material.state === 'ok' ? (material.items || []).map((i, n) => ({ n, title: clip(i.title || i.ref || i.url, 120), kind: i.kind || '', topic: clip(i.topic, 80), scope: i.scope === 'series' ? 'every meeting of this series' : 'this meeting', removable: i.from === 'you' && (i.scope === 'series' || i.scope === 'meeting'), line: removeLine(i) })) : null,
|
|
126
|
+
material: material && material.state === 'ok' ? (material.items || []).map((i, n) => ({ n, title: clip(i.title || i.ref || i.url, 120), kind: i.kind || '', topic: clip(i.topic, 80), scope: i.scope === 'series' ? 'every meeting of this series' : 'this meeting', removable: i.from === 'you' && (i.scope === 'series' || i.scope === 'meeting'), line: removeLine(i), preview: (i.kind === 'gdoc' || i.kind === 'conf') && /^https:\/\//.test(i.url || '') ? { url: i.url, kind: i.kind === 'conf' ? 'confluence' : 'google' } : null })) : null,
|
|
127
127
|
...prepOf(row, people, material, extra, aboutOf(row.level)),
|
|
128
128
|
materialLine: !material ? 'Reading the material.' : material.state === 'error' ? 'The material could not be read: ' + clip(material.error, 120) : (material.items || []).length ? '' : 'No material is linked to this meeting.',
|
|
129
129
|
row,
|
|
@@ -511,7 +511,7 @@ export function mountMeeting(d) {
|
|
|
511
511
|
const prow = (x) => `<div class="prow"><span class="pi${x.ok ? '' : ' w'}">${ic(x.ic)}</span><div><b>${esc(x.l)}</b><div class="pv">${x.about && aboutNow ? '<span>It is about <b>' + esc(aboutNow) + '</b>.</span>' : x.people ? x.people.map(person).join('') : x.chips && x.chips.length ? x.chips.map((c) => `<span class="chp sm">${ic('doc')}${esc(c)}</span>`).join('') : '<span>' + esc(x.text) + '</span>'}</div></div>${x.ok ? '<span class="chp ok sm"><i></i>Ready</span>' : '<span class="chp warn sm"><i></i>Not yet</span>'}</div>`;
|
|
512
512
|
const ready = v.prepReady;
|
|
513
513
|
const prep = secH('Prepared for you', ready === v.prep.length ? 'all ready' : ready + ' of ' + v.prep.length + ' ready') + `<div class="prows">${v.prep.map(prow).join('')}</div>`;
|
|
514
|
-
const mats = v.materialLine ? `<p class="mut">${esc(v.materialLine)}</p>` : `<div class="mats">${v.material.map((m) => `<div class="mat"><span class="kd">${esc(m.kind || 'link')}</span><div><b>${esc(m.title)}</b><small>${esc([m.topic, 'for ' + m.scope].filter(Boolean).join(' · '))}</small></div><span class="mb">${m.removable ? `<button class="ib2 mtg-rm" data-rm="${m.n}" aria-label="Remove ${esc(m.title)}" title="${esc(m.line)}">${ic('x')}</button>` : ''}</span></div>`).join('')}</div>`;
|
|
514
|
+
const mats = v.materialLine ? `<p class="mut">${esc(v.materialLine)}</p>` : `<div class="mats">${v.material.map((m) => `<div class="mat"><span class="kd">${esc(m.kind || 'link')}</span><div><b>${esc(m.title)}</b><small>${esc([m.topic, 'for ' + m.scope].filter(Boolean).join(' · '))}</small></div><span class="mb">${m.preview ? `<button class="ib2 mtg-pv" data-mpv="${m.n}" aria-label="Preview ${esc(m.title)}" title="Preview in the viewer">${ic('doc')}</button>` : ''}${m.removable ? `<button class="ib2 mtg-rm" data-rm="${m.n}" aria-label="Remove ${esc(m.title)}" title="${esc(m.line)}">${ic('x')}</button>` : ''}</span></div>`).join('')}</div>`;
|
|
515
515
|
const mat = secH('Material', v.material && v.material.length ? v.material.length + ' linked' : '', `<button class="addb" id="mmAdd" title="Your calendar invite is not changed.">${ic('plus')}Add material</button>`) + mats;
|
|
516
516
|
const prev = secH('Previous meetings', v.prev.length ? v.prev.length + ' before this' : '') + (v.prev.length ? `<div class="prevs">${v.prev.map((p) => `<div class="pvx"><div class="pvh"><time>${esc(p.date)}</time><span>${p.decided} decided</span><span>${p.steps} new next ${p.steps === 1 ? 'step' : 'steps'}</span></div></div>`).join('')}</div>` : '<p class="mut">No earlier notes of this meeting are kept.</p>');
|
|
517
517
|
const tops = secH('Topics', v.planned.length ? 'planned' : '') + (v.planned.length ? `<div class="tops">${v.planned.map((t, i) => `<div class="tp plan"><i>${i + 1}</i><span>${esc(clip(t.text, 120))}</span><small>planned</small></div>`).join('')}</div>` : '<p class="mut">The meeting has no topics yet.</p>');
|
|
@@ -831,6 +831,7 @@ export function mountMeeting(d) {
|
|
|
831
831
|
if ($('#mmAdd')) $('#mmAdd').focus();
|
|
832
832
|
return;
|
|
833
833
|
}
|
|
834
|
+
if (t.dataset.mpv !== undefined) { const m = (meetingView(row, replay, material, extra).material || [])[+t.dataset.mpv]; if (m && m.preview) import('./premium-vw-copies.js').then((V) => V.openCopy({ ws: d.ws(), url: m.preview.url, kind: m.preview.kind, title: m.title, where: 'material for ' + row.title })); return; }
|
|
834
835
|
if (t.dataset.rm !== undefined) { const it = ((material && material.items) || [])[+t.dataset.rm]; if (it) await removeItem(it); return; }
|
|
835
836
|
if (t.dataset.task !== undefined) { t.disabled = true; await makeTask(+t.dataset.task); if (!ui.tasked.has(+t.dataset.task)) paint(); return; }
|
|
836
837
|
if (t.id === 'mtgUndo') { const fn = undoFn; undoFn = null; if (fn) await fn(); return; }
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* pm/premium-vw-copies.js — a Confluence page or Google Doc in the premium viewer (initiative premium-viewer, R11).
|
|
2
|
+
* PMOS never reads either tool from a route (D53), so the view shows only what a record holds:
|
|
3
|
+
* a copy linked to a PMOS file → GET /api/docs (the link and its signal) + GET /api/doc (the file). When the last check found the same text,
|
|
4
|
+
* the file is the page's text. When the copy changed, the file is shown dimmed and labelled as the PMOS version,
|
|
5
|
+
* with Use the copy's version (POST /api/docs/sync use=copy, held five seconds behind Undo) and Check again.
|
|
6
|
+
* a page PMOS only links to → GET /api/docs/read (the last read, if any). Read it now (POST /api/docs/read) starts one read-only session
|
|
7
|
+
* that reads the page with the PM's connector and keeps the text; nothing is written to the tool.
|
|
8
|
+
* openCopy({ ws, url, kind?, title?, path?, where? }) opens or refreshes the tab
|
|
9
|
+
* copyModel(link, text) · readModel(answer) the pure models (premium-vw-copy.test.js) */
|
|
10
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
11
|
+
import { pmGet, pmPost } from './http.js';
|
|
12
|
+
import { mdHtml, copyKindOf } from './premium-doc-edit.js';
|
|
13
|
+
|
|
14
|
+
const TOOL = { google: 'Google Docs', confluence: 'Confluence', 'google-slides': 'Google Slides', 'google-sheets': 'Google Sheets' };
|
|
15
|
+
const COPY = { google: 'the Google Doc', confluence: 'the Confluence page', 'google-slides': 'the slides', 'google-sheets': 'the sheet' };
|
|
16
|
+
const UNDO_MS = 5000;
|
|
17
|
+
const POLL_MS = 4000;
|
|
18
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
19
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
20
|
+
/** "today 14:02", or "12 Oct 14:02". Local time, as the rest of the premium pages show it. */
|
|
21
|
+
export function when(iso, now = Date.now()) {
|
|
22
|
+
const t = Date.parse(iso || ''); if (Number.isNaN(t)) return '';
|
|
23
|
+
const d = new Date(t), n = new Date(now), hm = String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0');
|
|
24
|
+
return d.toDateString() === n.toDateString() ? 'today ' + hm : d.getDate() + ' ' + MON[d.getMonth()] + ' ' + hm;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A linked copy as the view draws it. `link` is one link of GET /api/docs; `text` is the PMOS file or null. */
|
|
28
|
+
export function copyModel(link, text, now) {
|
|
29
|
+
const kind = link && link.kind, tool = TOOL[kind] || 'the other tool', it = COPY[kind] || 'the copy', sig = (link && link.signal) || 'unchecked';
|
|
30
|
+
const checked = link && link.checked_at ? when(link.checked_at, now) : '';
|
|
31
|
+
const base = { kind, tool, title: (link && link.title) || tool, url: (link && link.url) || '', checked, syncing: !!(link && link.syncing), text: text == null ? null : String(text) };
|
|
32
|
+
const meta = [tool, link && link.remote_modified_at ? 'edited there ' + when(link.remote_modified_at, now) : '', checked ? 'checked ' + checked : 'not checked yet'].filter(Boolean).join(' · ');
|
|
33
|
+
if (sig === 'same') return { ...base, sig, tone: 'ok', chip: 'Same as PMOS', head: 'Same as PMOS', meta, why: `The last check found the same text in PMOS and in ${it}, so this is the page's text.`, dim: false, use: false };
|
|
34
|
+
if (sig === 'behind' || sig === 'diverged') {
|
|
35
|
+
return { ...base, sig, tone: 'warn', chip: sig === 'behind' ? 'Changed in ' + tool : 'Changed in both', meta, dim: true, use: true,
|
|
36
|
+
head: sig === 'behind' ? `${it[0].toUpperCase() + it.slice(1)} changed after it last matched PMOS.` : `Both ${it} and PMOS changed after they last matched.`,
|
|
37
|
+
why: `Below is the PMOS version, not the text of ${it}. Use its version to write that text into the PMOS file.` };
|
|
38
|
+
}
|
|
39
|
+
if (sig === 'ahead') return { ...base, sig, tone: 'warn', chip: 'PMOS is ahead', head: 'PMOS has changes the copy does not have.', meta, why: `Below is the PMOS version. ${it[0].toUpperCase() + it.slice(1)} still has the older text.`, dim: false, use: false };
|
|
40
|
+
const words = { unchecked: 'No check has read this copy yet.', unreadable: 'The last check could not open the copy.', 'missing-remote': `${it[0].toUpperCase() + it.slice(1)} is not there any more.`, 'missing-repo': 'The PMOS file is not in the repository any more.' };
|
|
41
|
+
return { ...base, sig, tone: '', chip: (link && link.words) || 'Not checked', head: words[sig] || (link && link.words) || 'Not compared yet.', meta, why: 'Below is the PMOS version. It is not known whether the copy has the same text.', dim: false, use: false };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The answer of GET /api/docs/read as the view draws it: the last read, a read in progress, or nothing yet. */
|
|
45
|
+
export function readModel(a, now) {
|
|
46
|
+
if (!a || a.ok === false) return { state: 'error', error: (a && a.error) || 'The last read could not be loaded.' };
|
|
47
|
+
if (a.open) return { state: 'reading', since: when(a.open.started_at, now) };
|
|
48
|
+
const r = a.read;
|
|
49
|
+
if (!r || r.text == null) return a.failed ? { state: 'none', failed: a.failed.reason || 'no reason was given' } : { state: 'none' };
|
|
50
|
+
return { state: 'read', title: r.title || '', text: String(r.text), at: when(r.read_at, now), by: r.by || 'a session', revision: r.revision || '' };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const ICON = (k) => `<span class="cpv-lg" aria-hidden="true">${k === 'confluence' ? 'C' : 'G'}</span>`;
|
|
54
|
+
const ext = (url, tool) => (url ? `<a class="dmcta alt" href="${esc(url)}" target="_blank" rel="noopener noreferrer">Open in ${esc(tool)}</a>` : '');
|
|
55
|
+
const page = (text, dim) => { const m = mdHtml(text); return `<div class="cpv-page dsbody${dim ? ' dim' : ''}">${m.html}</div>`; };
|
|
56
|
+
|
|
57
|
+
/** Open one page in the viewer. With `path`, it is a copy linked to that PMOS file; without, a page PMOS only has the address of. */
|
|
58
|
+
export function openCopy(o) {
|
|
59
|
+
if (!o || !o.url) return null;
|
|
60
|
+
vwStyle('copy');
|
|
61
|
+
const kind = o.kind || copyKindOf(o.url) || 'google';
|
|
62
|
+
const id = 'copy:' + (o.path ? o.path + '|' + kind : o.url);
|
|
63
|
+
const S = { o: { ...o, kind }, model: null, read: null, err: '', wait: null, poll: null, busy: false };
|
|
64
|
+
const wsq = () => (o.ws ? 'ws=' + encodeURIComponent(o.ws) + '&' : '');
|
|
65
|
+
let pane = null;
|
|
66
|
+
const tok = String(Date.now()) + Math.random();
|
|
67
|
+
const live = () => !!(pane && pane.isConnected && pane.dataset.cpTok === tok);
|
|
68
|
+
const draw = () => { if (live()) pane.innerHTML = html(); };
|
|
69
|
+
function html() {
|
|
70
|
+
const tool = TOOL[kind] || 'the tool', t = esc(o.title || S.model && S.model.title || tool);
|
|
71
|
+
if (S.err) return `<div class="cpv"><div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}</small></div></div><p class="note">${esc(S.err)}</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
|
|
72
|
+
if (o.path) {
|
|
73
|
+
const m = S.model; if (!m) return `<div class="cpv"><p class="note">Reading the copy and the PMOS file.</p></div>`;
|
|
74
|
+
const acts = S.wait ? `<button type="button" class="dmcta alt" data-cp="undo">Undo</button><span class="note">Using the version in ${esc(TOOL[kind])} in five seconds.</span>`
|
|
75
|
+
: `${m.use && !m.syncing ? `<button type="button" class="dmcta" data-cp="use">Use the ${esc(TOOL[kind])} version</button>` : ''}<button type="button" class="dmcta alt" data-cp="check"${S.busy ? ' disabled' : ''}>${S.busy ? 'Checking' : 'Check again'}</button>${ext(m.url || o.url, m.tool)}`;
|
|
76
|
+
return `<div class="cpv"><div class="cpv-bar ${m.tone}">${ICON(kind)}<div><b>${esc(m.head)}</b><small>${esc(m.meta)}</small></div><span class="chp ${m.tone}"><i></i>${esc(m.syncing ? 'Updating' : m.chip)}</span></div>`
|
|
77
|
+
+ `<p class="note cpv-why">${esc(m.syncing ? 'A session is writing the copy\'s text into the PMOS file.' : m.why)} File: <code>${esc(o.path)}</code></p><div class="cpv-acts">${acts}</div>`
|
|
78
|
+
+ (m.text == null ? '<p class="note">The PMOS file could not be read.</p>' : page(m.text, m.dim)) + '</div>';
|
|
79
|
+
}
|
|
80
|
+
const r = S.read || { state: 'loading' }, where = o.where ? ' · ' + esc(o.where) : '';
|
|
81
|
+
if (r.state === 'loading') return `<div class="cpv"><p class="note">Reading what PMOS holds for this page.</p></div>`;
|
|
82
|
+
if (r.state === 'read') {
|
|
83
|
+
return `<div class="cpv"><div class="cpv-bar">${ICON(kind)}<div><b>Read ${esc(r.at)} by ${esc(r.by)}</b><small>${esc(tool)}${r.revision ? ' · revision ' + esc(r.revision) : ''} · view only${where}</small></div><span class="chp"><i></i>Read</span></div>`
|
|
84
|
+
+ `<p class="note cpv-why">This is the text as it was when it was read. Edits made in ${esc(tool)} after that show after you read it again.</p>`
|
|
85
|
+
+ `<div class="cpv-acts"><button type="button" class="dmcta alt" data-cp="read"${S.busy ? ' disabled' : ''}>Read again</button>${ext(o.url, tool)}</div>${page(r.text, false)}</div>`;
|
|
86
|
+
}
|
|
87
|
+
const head = `<div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}${where}</small></div><span class="chp"><i></i>${r.state === 'reading' ? 'Reading' : 'Link only'}</span></div>`;
|
|
88
|
+
if (r.state === 'reading') return `<div class="cpv">${head}<p class="note">A session is reading the page with your ${esc(tool)} connector${r.since ? ' (started ' + esc(r.since) + ')' : ''}. The text shows here when it is done.</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
|
|
89
|
+
return `<div class="cpv">${head}<div class="cpv-empty"><b>PMOS has only the address of this page.</b><p>It was added as a link, so PMOS holds no text to show here.</p>`
|
|
90
|
+
+ `<div class="cpv-acts">${r.state === 'none' ? `<button type="button" class="dmcta" data-cp="read"${S.busy ? ' disabled' : ''}>Read it now</button>` : ''}${ext(o.url, tool)}</div>`
|
|
91
|
+
+ `<p class="note">${r.state === 'error' ? esc(r.error) : r.failed ? 'The last read did not finish: ' + esc(r.failed) + '. Press Read it now to try again.' : `Read it now starts one session that reads the page with your ${esc(tool)} connector and keeps the text in PMOS. It changes nothing in ${esc(tool)}.`}</p></div></div>`;
|
|
92
|
+
}
|
|
93
|
+
async function load() {
|
|
94
|
+
S.err = '';
|
|
95
|
+
if (o.path) {
|
|
96
|
+
const [d, f] = await Promise.all([pmGet('/api/docs?' + wsq()).catch(() => null), fetch('/api/doc?' + wsq() + 'path=' + encodeURIComponent(o.path), { credentials: 'same-origin' }).then((r) => (r.ok ? r.text() : null)).catch(() => null)]);
|
|
97
|
+
const doc = d && d.ok !== false ? (d.docs || []).find((x) => x.path === o.path) : null, link = doc ? (doc.links || []).find((l) => l.kind === kind) : null;
|
|
98
|
+
if (!link) S.err = d && d.ok !== false ? 'This copy is no longer linked to ' + o.path + '.' : 'The copies could not be read.';
|
|
99
|
+
else S.model = copyModel(link, f);
|
|
100
|
+
S.busy = !!(d && (d.session || d.open));
|
|
101
|
+
} else {
|
|
102
|
+
S.read = readModel(await pmGet('/api/docs/read?' + wsq() + 'url=' + encodeURIComponent(o.url)).catch(() => null));
|
|
103
|
+
clearTimeout(S.poll);
|
|
104
|
+
if (S.read.state === 'reading') S.poll = setTimeout(() => { if (live()) load(); }, POLL_MS);
|
|
105
|
+
}
|
|
106
|
+
draw();
|
|
107
|
+
}
|
|
108
|
+
async function press(a) {
|
|
109
|
+
if (a === 'undo') { clearTimeout(S.wait); S.wait = null; draw(); return; }
|
|
110
|
+
if (a === 'use') {
|
|
111
|
+
S.wait = setTimeout(async () => {
|
|
112
|
+
S.wait = null; draw();
|
|
113
|
+
const r = await pmPost('/api/docs/sync', { ws: o.ws, path: o.path, kind, use: 'copy' }).catch(() => null);
|
|
114
|
+
if (!r || !r.ok) S.err = (r && r.error) || 'The sync did not start.';
|
|
115
|
+
load();
|
|
116
|
+
}, UNDO_MS);
|
|
117
|
+
draw(); return;
|
|
118
|
+
}
|
|
119
|
+
if (a === 'check') { S.busy = true; draw(); const r = await pmPost('/api/docs/check', { ws: o.ws }).catch(() => null); if (r && !r.ok && !/already running/.test(r.error || '')) S.err = r.error || 'The check did not start.'; load(); return; }
|
|
120
|
+
if (a === 'read') {
|
|
121
|
+
S.busy = true; draw();
|
|
122
|
+
const r = await pmPost('/api/docs/read', { ws: o.ws, url: o.url }).catch(() => null);
|
|
123
|
+
S.busy = false;
|
|
124
|
+
if (!r || !r.ok) { S.read = { state: 'error', error: (r && r.error) || 'The read did not start.' }; draw(); return; }
|
|
125
|
+
S.read = { state: 'reading', since: '' }; draw(); clearTimeout(S.poll); S.poll = setTimeout(() => { if (live()) load(); }, POLL_MS);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
pane = vwOpen({ id, title: o.title || TOOL[kind] || 'Page', icon: 'doc', html: html(),
|
|
129
|
+
wire: (el) => { el.onclick = (e) => { const b = e.target.closest('[data-cp]'); if (b) press(b.dataset.cp); }; } }); // delegated to the view's buttons
|
|
130
|
+
if (pane) pane.dataset.cpTok = tok;
|
|
131
|
+
load();
|
|
132
|
+
return pane;
|
|
133
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@font-face{font-family:"Space Grotesk";src:url(/vendor/space-grotesk-var.woff2) format("woff2");font-weight:300 700;font-display:swap}
|
|
2
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-400.woff2) format("woff2");font-weight:400;font-display:swap}
|
|
3
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-500.woff2) format("woff2");font-weight:500;font-display:swap}
|
|
4
|
+
@font-face{font-family:"IBM Plex Mono";src:url(/vendor/ibm-plex-mono-700.woff2) format("woff2");font-weight:600 700;font-display:swap}
|
|
5
|
+
:root{--fs-1:11px;--fs-2:12px;--fs-3:14px;--fs-4:16px;--fs-5:20px;--fs-6:28px}
|
|
6
|
+
/* pm/premium-vw-copy.css — a Confluence page or Google Doc in the premium viewer (premium-vw-copies.js, premium-viewer R11). Loaded by vwStyle('copy'). */
|
|
7
|
+
.cpv{display:grid;gap:12px;max-width:760px}
|
|
8
|
+
.cpv-bar{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);box-shadow:var(--card-shadow)}
|
|
9
|
+
.cpv-bar.warn{background:color-mix(in oklab,var(--ember) 12%,var(--card-solid))}
|
|
10
|
+
.cpv-bar>div{flex:1;min-width:0;display:grid;gap:2px}
|
|
11
|
+
.cpv-bar b{font-size:var(--fs-3);font-weight:600;color:var(--ink)}
|
|
12
|
+
.cpv-bar small{font-size:var(--fs-2);color:var(--ink-3)}
|
|
13
|
+
.cpv-lg{width:28px;height:28px;flex:none;display:grid;place-items:center;border-radius:6px;background:var(--well);color:var(--ink);font-size:var(--fs-2);font-weight:600}
|
|
14
|
+
.cpv-why{margin:0}
|
|
15
|
+
.cpv-why code{font-size:var(--fs-2)}
|
|
16
|
+
.cpv-acts{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
|
|
17
|
+
.cpv-acts .dmcta{border-radius:6px;text-decoration:none}
|
|
18
|
+
.cpv-empty{display:grid;gap:8px;padding:18px 20px;border:1px dashed var(--ink-3);border-radius:8px;color:var(--ink-2)}
|
|
19
|
+
.cpv-empty b{font-size:var(--fs-4);font-weight:600;color:var(--ink)}
|
|
20
|
+
.cpv-empty p{margin:0;font-size:var(--fs-3)}
|
|
21
|
+
.cpv-page{padding:18px 22px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
|
|
22
|
+
.cpv-page.dim{opacity:.62}
|
|
23
|
+
@media (max-width:700px){
|
|
24
|
+
.cpv-bar{flex-wrap:wrap}
|
|
25
|
+
.cpv-acts .dmcta{min-height:44px}
|
|
26
|
+
.cpv-page{padding:14px}
|
|
27
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<title>PMOS · Insights</title>
|
|
8
|
-
<!-- The premium Insights (initiative briefing-premium-insights, slice 9). The fourth place on the rail, in the Briefing's shell. It reads GET /api/insights-premium, built from the KR metric records and the report files the console's Reports tab reads, and GET /api/board-metrics-premium for the Board measures card, whose one press sets a target (POST /api/board-metric-targets/save). -->
|
|
8
|
+
<!-- The premium Insights (initiative briefing-premium-insights, slice 9; insights-one-list puts the insight first, the pinned dashboard on top and one paged list below). The fourth place on the rail, in the Briefing's shell. It reads GET /api/insights-premium, built from the KR metric records and the report files the console's Reports tab reads, and GET /api/board-metrics-premium for the Board measures card, whose one press sets a target (POST /api/board-metric-targets/save). -->
|
|
9
9
|
<link rel="preload" href="/vendor/geist-var.woff2" as="font" type="font/woff2" crossorigin />
|
|
10
10
|
<link rel="stylesheet" href="/pm/premium.css" />
|
|
11
11
|
<link rel="stylesheet" href="/pm/premium-insights.css" />
|
|
@@ -36,29 +36,39 @@
|
|
|
36
36
|
<h1 class="vh">Insights</h1><div id="crumbHost"></div>
|
|
37
37
|
<div class="tools tools-top"><span class="vh" id="snap">Reading the records</span></div>
|
|
38
38
|
</header>
|
|
39
|
-
<section class="hero hero
|
|
40
|
-
|
|
39
|
+
<section class="hero ins-hero rise" style="--d:2" id="insHero" aria-label="Insight">
|
|
40
|
+
<p class="ieye" id="insEye"></p>
|
|
41
|
+
<p class="brief ihead" id="brief" aria-live="polite"></p>
|
|
42
|
+
<p class="iwhy" id="insWhy"></p>
|
|
43
|
+
<ul class="imore" id="insMore"></ul>
|
|
44
|
+
<div class="iact" id="insAct"></div>
|
|
45
|
+
<p class="note inote" id="insNote"></p>
|
|
46
|
+
</section>
|
|
47
|
+
<section class="card pdcard rise" style="--d:5" id="cDash" aria-labelledby="hDash">
|
|
48
|
+
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg></span><h2 id="hDash">Dashboard</h2><i class="ptag" id="dashTag"></i><small id="dashCap"></small></div>
|
|
49
|
+
<div class="nact pdbar" id="dashBar" hidden></div>
|
|
50
|
+
<div id="dashBody"></div>
|
|
51
|
+
</section>
|
|
52
|
+
<section class="card nrep rise" style="--d:6" id="cRep" aria-labelledby="hRep">
|
|
53
|
+
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h10"/></svg></span><h2 id="hRep">Dashboards and reports</h2><small id="repCap"></small></div>
|
|
54
|
+
<div class="seg" id="listSeg" role="group" aria-label="Show"><i class="pill"></i></div>
|
|
55
|
+
<div class="lbar">
|
|
56
|
+
<span class="newm"><button class="dmcta" id="listNew" aria-haspopup="menu" aria-expanded="false" aria-controls="listMenu">New ▾</button>
|
|
57
|
+
<span class="lmenu" id="listMenu" role="menu" hidden><button role="menuitem" id="pdNew">Dashboard</button><button role="menuitem" id="repNew">Report</button></span></span>
|
|
58
|
+
<form class="nask" id="repAsk"><input id="repAskIn" maxlength="500" autocomplete="off" placeholder="Ask PMOS to set up a report" aria-label="Ask PMOS to set up a report"><button class="dmcta" id="repAskGo" type="submit">Ask</button></form>
|
|
59
|
+
</div>
|
|
60
|
+
<p class="note nask-n">Ask starts a background run that only proposes a report. Nothing is set up until you press Set it up.</p>
|
|
61
|
+
<p class="mhint">A report is a file in the repository. PMOS drafts it, you read it. <b>Nothing is sent from here.</b> The pin puts one dashboard at the top of this page. It shows nowhere else.</p>
|
|
62
|
+
<div id="repBody"></div>
|
|
63
|
+
<div class="lpager" id="listPager"></div>
|
|
64
|
+
<p class="nsch"><button class="lk" id="repOpen">Open the Reports tab</button> to edit or issue a document.</p>
|
|
65
|
+
</section>
|
|
66
|
+
<section class="card rise" style="--d:7" id="cBm" aria-labelledby="hBm" hidden>
|
|
41
67
|
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg></span><h2 id="hBm">Board measures</h2><small id="bmCap"></small><div class="seg mper" id="bmRange" role="group" aria-label="Range"><i class="pill"></i><button data-w="8" aria-pressed="true">8 weeks</button><button data-w="26" aria-pressed="false">26 weeks</button><button data-w="52" aria-pressed="false">52 weeks</button></div></div>
|
|
42
68
|
<p class="mhint" id="bmHint"></p>
|
|
43
69
|
<div class="bt2 ibt" id="bmBody"></div>
|
|
44
70
|
<p class="note" id="bmNote"></p>
|
|
45
71
|
</section>
|
|
46
|
-
<div class="nl">
|
|
47
|
-
<div class="nlc">
|
|
48
|
-
<section class="card rise" style="--d:5" id="cDash" aria-labelledby="hDash">
|
|
49
|
-
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg></span><h2 id="hDash">Dashboards</h2><small id="dashCap"></small></div>
|
|
50
|
-
<div class="seg" id="dashTabs" role="group" aria-label="Dashboard" hidden><i class="pill"></i></div>
|
|
51
|
-
<div class="nact pdbar" id="dashBar" hidden></div>
|
|
52
|
-
<div id="dashBody"></div>
|
|
53
|
-
</section>
|
|
54
|
-
</div>
|
|
55
|
-
<aside class="nlr" aria-label="Reports">
|
|
56
|
-
<section class="card nrep rise" style="--d:6" id="cRep" aria-labelledby="hRep">
|
|
57
|
-
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 13h6M9 17h4"/></svg></span><h2 id="hRep">Reports</h2><small id="repCap"></small></div>
|
|
58
|
-
<div id="repBody"></div>
|
|
59
|
-
</section>
|
|
60
|
-
</aside>
|
|
61
|
-
</div>
|
|
62
72
|
<p class="foot" id="foot">Charts read the KR metric records of this workspace and never invent a number. A press here records only what it says: a dashboard or a chart in the workspace's state folder, a report setup, request or dismissal in the report ledger, or a report's look in its design folder. The Board measures card counts the Board's four measures from the repository, over 8, 26 or 52 weeks; a target set there is saved in the workspace's state folder and drawn on the Board too. Left out: any measure no record holds. Nothing is sent from this page.</p>
|
|
63
73
|
</main>
|
|
64
74
|
<noscript>This page needs JavaScript.</noscript>
|
package/workspace/server.js
CHANGED
|
@@ -153,6 +153,9 @@ const docCheckSessions = new Map();
|
|
|
153
153
|
// The session each Use … version press started (workspace id|path|kind → { session, use }), so the line says "Updating…"
|
|
154
154
|
// before the session has opened its sync, and a second press on the same copy refuses.
|
|
155
155
|
const docSyncSessions = new Map();
|
|
156
|
+
// The session each Read it now press started (workspace id|<kind>:<page id> → { session, run }): one read per page.
|
|
157
|
+
const docReadSessions = new Map();
|
|
158
|
+
const docReadsStore = require('./lib/doc-reads-store'); // Read it now: doc-reads.jsonl, the read-only snapshot of one page
|
|
156
159
|
const docGraphs = new Map(); // root -> { at, graph }: the document tab's Connections, held 15 s
|
|
157
160
|
const jiraTickets = require('./lib/jira-tickets.js'); // jira-wbs — the ticket draft, the PM's selection, the push plan
|
|
158
161
|
const jiraStatus = require('./lib/jira-status.js'); // …and the status snapshot an agent's read writes
|
|
@@ -7658,6 +7661,45 @@ async function handleRequest(req, res) {
|
|
|
7658
7661
|
const linked = new Set(v.ok ? v.docs.map((d) => d.path) : []);
|
|
7659
7662
|
return json(res, { ok: true, files: found.filter((f) => !linked.has(f.path)) });
|
|
7660
7663
|
}
|
|
7664
|
+
// Read it now: a read-only snapshot of one Google Doc or Confluence page, by address. GET answers the latest read
|
|
7665
|
+
// from doc-reads.jsonl. POST (a page press only) starts one `doc-read` session that reads the page with the PM's own
|
|
7666
|
+
// connector and records it through `pmos docs read-finish` (D53). No route reads the page.
|
|
7667
|
+
if (p === '/api/docs/read' && req.method === 'GET') {
|
|
7668
|
+
const w = getWs(url.searchParams.get('ws'));
|
|
7669
|
+
const root = w ? w.root : SELF_ROOT;
|
|
7670
|
+
const r = docReadsStore.latest(root, String(url.searchParams.get('url') || '').slice(0, 2000));
|
|
7671
|
+
if (!r.ok) return json(res, { ok: false, error: r.error }, r.code === 'kind' ? 400 : 500);
|
|
7672
|
+
const live = docReadSessions.get(`${w ? w.id : ''}|${require('./lib/doc-reads').keyOf(url.searchParams.get('url'))}`);
|
|
7673
|
+
const open = r.open && live && live.run === r.open.run ? { ...r.open, session: live.session } : r.open;
|
|
7674
|
+
return json(res, { ok: true, kind: r.kind, read: r.read, open, failed: r.failed });
|
|
7675
|
+
}
|
|
7676
|
+
if (p === '/api/docs/read' && req.method === 'POST') {
|
|
7677
|
+
let body = {}; try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
7678
|
+
const g = pmGuard.requirePagePress(req, body);
|
|
7679
|
+
if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
|
|
7680
|
+
// It uses the PM's connectors, so an agent session never presses it (the same 403 as create-copy).
|
|
7681
|
+
if (req.headers['x-pmos-session']) return json(res, { ok: false, error: 'an agent session cannot start a read. Only a press on the page does' }, 403);
|
|
7682
|
+
const w = body.ws ? workspaces.get(String(body.ws)) : getWs(null);
|
|
7683
|
+
if (!w) return json(res, { ok: false, error: 'no such workspace' }, 404);
|
|
7684
|
+
const address = String(body.url || '').trim().slice(0, 2000);
|
|
7685
|
+
const docReads = require('./lib/doc-reads');
|
|
7686
|
+
const kind = docReads.kindOf(address);
|
|
7687
|
+
if (!kind) return json(res, { ok: false, error: 'give the address of a Google Doc or a Confluence page (Slides and Sheets are not read yet)' }, 400);
|
|
7688
|
+
const key = `${w.id}|${docReads.keyOf(address)}`;
|
|
7689
|
+
const prev = docReadSessions.get(key);
|
|
7690
|
+
if (prev && sessions.get(prev.session) && sessions.get(prev.session).state !== 'exited') return json(res, { ok: false, error: 'that page is already being read', session: prev.session }, 409);
|
|
7691
|
+
const task = taskById('doc-read', w.root);
|
|
7692
|
+
if (!task || !task.prompt) return json(res, { ok: false, error: 'the doc-read skill is not installed' }, 500);
|
|
7693
|
+
const st = docReadsStore.readStart(w.root, { url: address, by: 'page:pm' });
|
|
7694
|
+
if (!st.ok) return json(res, { ok: false, error: st.error }, st.code === 'open' ? 409 : st.code === 'kind' ? 400 : 500);
|
|
7695
|
+
const ask = `\n\nThis read:\n- address: ${address}\n- kind: ${kind}\n- read: ${st.run}`;
|
|
7696
|
+
const s = spawnSession({ name: 'Doc read', agent: task.agent || 'claude', ws: w.id, origin: 'docs:read',
|
|
7697
|
+
initialInput: task.prompt + ask + '\r', modelAsk: { skillTier: task.tier || null, skill: task.skill } });
|
|
7698
|
+
const started = s.state !== 'exited';
|
|
7699
|
+
if (started) docReadSessions.set(key, { session: s.id, run: st.run, at: new Date().toISOString() });
|
|
7700
|
+
else docReadsStore.readFail(w.root, { run: st.run, by: 'page:pm', reason: s.note || 'could not start the session' });
|
|
7701
|
+
return json(res, { ok: started, session: s.id, run: st.run, error: started ? undefined : (s.note || 'could not start the session') }, started ? 200 : 500);
|
|
7702
|
+
}
|
|
7661
7703
|
if ((p === '/api/docs/link' || p === '/api/docs/unlink' || p === '/api/docs/check' || p === '/api/docs/sync' || p === '/api/docs/create-copy') && req.method === 'POST') {
|
|
7662
7704
|
let body = {}; try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
7663
7705
|
const g = pmGuard.requirePagePress(req, body);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-read
|
|
3
|
+
label: "Read one Google Doc or Confluence page now"
|
|
4
|
+
description: "Read one Google Doc or Confluence page with the PM's connector, convert it to markdown and record it. Read-only: it writes no document, page, comment or file."
|
|
5
|
+
run: agent
|
|
6
|
+
agent: claude
|
|
7
|
+
output:
|
|
8
|
+
- Read
|
|
9
|
+
- Not read
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
/doc-read — the PM pressed "Read it now" for ONE page. Read that page, record its text, and stop. The lines after this procedure give the address, the kind and the read id.
|
|
13
|
+
|
|
14
|
+
A page is one of two kinds: `google` (a Google Doc) or `confluence` (a Confluence page).
|
|
15
|
+
|
|
16
|
+
Rules that always hold:
|
|
17
|
+
1. READ-ONLY EVERYWHERE. Never create, update, move, rename, comment on, share or delete a Google Doc, a Drive file or a Confluence page. Never edit, create or delete a file in this repository. Never commit or push.
|
|
18
|
+
2. ONE PAGE. Read only the page at the address below. Do not read its child pages, its comments or the pages it links to.
|
|
19
|
+
3. THE ONLY RECORDS are `pmos docs read-start`, `pmos docs read-finish` and `pmos docs read-fail`. Never write a `*.jsonl` file by hand.
|
|
20
|
+
4. USE THE PM'S CONNECTORS. Google Docs: the Google Drive tools (`read_file_content`, and the file metadata). Confluence: the Atlassian tools (`getConfluencePage`, with its version). If the connector is missing or refuses, record the read as failed with the error.
|
|
21
|
+
5. KEEP THE DOCUMENT. Convert the page to markdown faithfully: the same headings, paragraphs, lists, tables and links, in the same order. Do not add a summary, a note or a heading of your own.
|
|
22
|
+
|
|
23
|
+
Procedure:
|
|
24
|
+
1. If the lines below give a `read` id, use it. If not, run `pmos docs read-start "<address>" --json` and keep `run`. If it is refused (for example, the page is already being read), stop and say why.
|
|
25
|
+
2. Read the page with the connector of its kind. Take its title, its revision or version number and its last-modified time.
|
|
26
|
+
3. Convert the content to markdown. Write it to a temporary file outside this repository (for example, under `/tmp`).
|
|
27
|
+
4. Run `pmos docs read-finish <read> --file <the temporary file> --title "<title>" --revision "<revision>" --modified-at "<ISO time>"`. Leave out a flag whose value you did not read. Then delete the temporary file.
|
|
28
|
+
5. If any step failed, run `pmos docs read-fail <read> --reason "<the error, in one line>"` instead of step 4.
|
|
29
|
+
|
|
30
|
+
Output contract — produce EXACTLY these sections, one short line each:
|
|
31
|
+
- Read
|
|
32
|
+
- Not read
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative premium-viewer R11: a Confluence page or Google Doc in the premium viewer (a checked copy, or a read on the PM's press).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"premium-vw-copy.test.js"
|
|
5
|
+
],
|
|
6
|
+
"panels": [
|
|
7
|
+
"premium-vw-copy-test.js"
|
|
8
|
+
],
|
|
9
|
+
"seconds": {
|
|
10
|
+
"premium-vw-copy-test.js": 40
|
|
11
|
+
}
|
|
12
|
+
}
|