create-pmos 0.257.0 → 0.259.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +171 -0
  7. package/workspace/briefing-premium-initiative-test.js +1 -1
  8. package/workspace/briefing-premium-insights-test.js +228 -0
  9. package/workspace/fixtures/insights-premium-facts.js +30 -0
  10. package/workspace/guide/briefing-premium.md +14 -2
  11. package/workspace/lib/board-premium.js +8 -5
  12. package/workspace/lib/briefing-premium-agent.js +2 -2
  13. package/workspace/lib/custom-docs.js +107 -0
  14. package/workspace/lib/initiative-premium.js +9 -4
  15. package/workspace/lib/insights-premium.js +133 -0
  16. package/workspace/lib/route-modules.js +2 -0
  17. package/workspace/lib/routes-board-premium.js +5 -1
  18. package/workspace/lib/routes-briefing-premium.js +2 -1
  19. package/workspace/lib/routes-custom-docs.js +62 -0
  20. package/workspace/lib/routes-initiative-premium.js +4 -1
  21. package/workspace/lib/routes-insights-premium.js +53 -0
  22. package/workspace/package-lock.json +2 -2
  23. package/workspace/package.json +1 -1
  24. package/workspace/public/pm/premium-board.js +7 -4
  25. package/workspace/public/pm/premium-initiative.js +8 -7
  26. package/workspace/public/pm/premium-insights.css +143 -0
  27. package/workspace/public/pm/premium-insights.js +143 -0
  28. package/workspace/public/pm/premium-shell.js +31 -2
  29. package/workspace/public/pm/premium.css +3 -1
  30. package/workspace/public/premium-board.html +2 -2
  31. package/workspace/public/premium-initiative.html +1 -1
  32. package/workspace/public/premium-insights.html +61 -0
  33. package/workspace/server.js +2 -2
  34. package/workspace/test-files.json +4 -0
  35. package/workspace/test-lists/briefing-premium.json +4 -0
@@ -5,7 +5,7 @@
5
5
  * existing /api/doc-sheet routes, initiative briefing-premium-doc-edit), Add a task and a task's status. Nothing here issues a document or moves an initiative. */
6
6
  import { pmPost } from './http.js';
7
7
  import { proposalsModel, editBody, acceptBody, rejectBody, askBody, askLine } from './premium-doc-edit.js';
8
- import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, crumbHtml, wireCrumb, AI } from './premium-shell.js';
8
+ import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, crumbHtml, wireCrumb, AI, openAddDoc } from './premium-shell.js';
9
9
 
10
10
  let M = null; // the model
11
11
  let taskView = 'list';
@@ -16,7 +16,7 @@ wireRail('init');
16
16
  const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
17
17
  const DOCI = '<path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>';
18
18
  const SPARK = '<path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/>';
19
- const STATE_ICO = { Live: '<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>', 'Up to date': '<path d="M5 12.5l4.5 4.5L19 7.5"/>', Draft: '<path d="M4 20l4-1 11-11-3-3L5 16z"/>', 'Not started': '<circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16.5v.5"/>', Stale: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>', Due: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>' };
19
+ const STATE_ICO = { Linked: '<path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/>', Live: '<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>', 'Up to date': '<path d="M5 12.5l4.5 4.5L19 7.5"/>', Draft: '<path d="M4 20l4-1 11-11-3-3L5 16z"/>', 'Not started': '<circle cx="12" cy="12" r="9"/><path d="M12 8v5M12 16.5v.5"/>', Stale: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>', Due: '<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>' };
20
20
  const TKI = { jira: '<rect x="4" y="5" width="16" height="14" rx="3"/><path d="m8.5 12 2.5 2.5 4.5-5"/>', task: '<path d="M6 4v16M6 5h11l-2.5 4L17 13H6"/>', req: '<path d="M6 3h9l4 4v14H6z"/><path d="M9 12h6M9 16h4"/>' };
21
21
  const TONE = { Done: 'ok', 'In progress': 'wip', 'In review': 'wip', 'To do': 'mut' };
22
22
 
@@ -103,6 +103,7 @@ function tasksHtml() {
103
103
  $('#iMain').addEventListener('click', (e) => {
104
104
  const v = e.target.closest('#tkTabs [data-v]'); if (v) { taskView = v.dataset.v; $('#tkBody').innerHTML = tasksBody(); $$('#tkTabs button').forEach((b) => b.setAttribute('aria-pressed', b.dataset.v === taskView)); pillOf($('#tkTabs')); return; }
105
105
  if (e.target.closest('[data-tkadd]')) { openAddTask(); return; }
106
+ if (e.target.closest('[data-adddoc]')) { openAddDoc({ ws: M.board.ws, scope: M.docs.scope, sub: M.title, onAdded: async () => { await load(); const b = $('[data-adddoc]'); if (b) b.focus(); } }); return; }
106
107
  const t = e.target.closest('[data-task]'); if (t) { openTask(M.tasks.rows.find((x) => x.key === t.dataset.task)); return; }
107
108
  const f = e.target.closest('[data-dmf]'); if (f) { docFilter = f.dataset.dmf; drawDocList(); return; }
108
109
  const d = e.target.closest('[data-draft]'); if (d && !d.disabled) { draft(d); return; }
@@ -153,7 +154,7 @@ function openAddTask() {
153
154
  /* ── documents ──────────────────────────────────────────────────────────────────────────────────────────── */
154
155
  function docRow(d) {
155
156
  const act = d.act && d.act.kind === 'draft' ? `<button class="dmcta alt" data-draft="${esc(d.key)}"${d.running ? ' disabled' : ''}>${d.running ? '<span class="spin"></span>' : ICO(SPARK)}${esc(d.act.label)}</button>` : d.path ? `<button class="dmcta alt" data-doc="${esc(d.key)}">Read</button>` : '';
156
- const inner = `<span class="dmi c-${esc(d.cat || 'Board')}">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.when ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}updated ${esc(d.when)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>`;
157
+ const inner = `<span class="dmi c-${esc(d.cat || 'Board')}">${ICO(DOCI)}</span><span class="dmn"><b>${esc(d.title)}</b><small>${esc(d.what)}</small><span class="dmm"><span class="s ${esc(d.st || 'live')}">${ICO(STATE_ICO[d.state] || STATE_ICO['Not started'])}${esc(d.state)}</span>${d.when ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}updated ${esc(d.when)}</span>` : ''}${d.added ? `<span>${ICO('<rect x="3" y="5" width="18" height="16" rx="3"/><path d="M3 10h18M8 3v4M16 3v4"/>')}added ${esc(d.added)}</span>` : ''}${d.by ? `<span>${ICO('<circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/>')}${esc(d.by)}</span>` : ''}</span></span>`;
157
158
  return `<div class="dmr ${esc(d.st || '')}" role="listitem">${d.path ? `<button class="dmo" data-doc="${esc(d.key)}" aria-haspopup="dialog">${inner}</button>` : `<span class="dmo">${inner}</span>`}<span class="dmq">${act}</span></div>`;
158
159
  }
159
160
  const matches = (d) => (docFilter === 'all' || (docFilter === 'none' ? d.st === 'missing' : docFilter === 'draft' ? d.st === 'draft' : (d.st === 'ok' || d.st === 'live'))) && (!docQuery.trim() || (d.title + ' ' + d.what).toLowerCase().includes(docQuery.trim().toLowerCase()));
@@ -166,16 +167,16 @@ function drawDocList() {
166
167
  }
167
168
  function docsHtml() {
168
169
  const D = M.docs, c = D.counts;
169
- if (!D.rows.length) return `<section class="card rise ifull" style="--d:6" id="cIniDoc" aria-labelledby="hDoc"><div class="ch"><span class="ic">${ICO(DOCI)}</span><h2 id="hDoc">Core documents</h2></div><p class="empty3 plain">${D.missing ? 'The core documents could not be read, so none is shown.' : 'No core documents are on record for this initiative.'}</p></section>`;
170
+ if (!D.rows.length) return `<section class="card rise ifull" style="--d:6" id="cIniDoc" aria-labelledby="hDoc"><div class="ch"><span class="ic">${ICO(DOCI)}</span><h2 id="hDoc">Core documents</h2><button class="fold alt dmadd2" data-adddoc="1" type="button">Add a document</button></div><p class="empty3 plain">${D.missing ? 'The core documents could not be read, so none is shown.' : 'No core documents are on record for this initiative.'}</p></section>`;
170
171
  const dot = { ok: 'ok', draft: 'warn', missing: 'mut' };
171
172
  const core = D.rows.filter((d) => !d.tech);
172
- return `<section class="card rise ifull" style="--d:6" id="cIniDoc" aria-labelledby="hDoc"><div class="ch"><span class="ic">${ICO(DOCI)}</span><h2 id="hDoc">Core documents</h2><small>${c.all}</small></div>
173
- <p class="dsum"><span><b>${c.draft}</b> ${c.draft === 1 ? 'draft' : 'drafts'} to review</span><span><b>${c.none}</b> not started</span><span><b>${c.ok}</b> up to date</span>${draftable().length > 1 ? `<button class="dlink" data-draftall="1">${ICO(SPARK)}Draft the ${draftable().length} not started</button>` : ''}</p>
173
+ return `<section class="card rise ifull" style="--d:6" id="cIniDoc" aria-labelledby="hDoc"><div class="ch"><span class="ic">${ICO(DOCI)}</span><h2 id="hDoc">Core documents</h2><small>${c.all}</small><button class="fold alt dmadd2" data-adddoc="1" type="button">Add a document</button></div>
174
+ <p class="dsum"><span><b>${c.draft}</b> ${c.draft === 1 ? 'draft' : 'drafts'} to review</span><span><b>${c.none}</b> not started</span><span><b>${c.ok}</b> up to date</span>${c.linked ? `<span><b>${c.linked}</b> linked</span>` : ''}${draftable().length > 1 ? `<button class="dlink" data-draftall="1">${ICO(SPARK)}Draft the ${draftable().length} not started</button>` : ''}</p>
174
175
  <div class="dprog" role="img" aria-label="${c.ok} of ${c.all} up to date">${core.map((d) => `<i class="${dot[d.st] || (d.st === 'live' ? 'ok' : 'mut')}"></i>`).join('')}</div>
175
176
  <div class="dtool"><div class="seg" id="dmF" role="group" aria-label="Filter documents"><i class="pill"></i>${[['all', 'All', c.all], ['none', 'Not started', c.none], ['draft', 'Draft', c.draft], ['ok', 'Up to date', c.ok]].map(([k, l, n]) => `<button data-dmf="${k}" aria-pressed="${docFilter === k}">${l}<em>${n}</em></button>`).join('')}</div>
176
177
  <label class="dmsr">${ICO('<circle cx="11" cy="11" r="6.5"/><path d="m20 20-4-4"/>')}<input id="dmQ" type="search" placeholder="Find a document" aria-label="Find a document" value="${esc(docQuery)}"></label></div>
177
178
  <div id="dmList"></div>
178
- <p class="note" style="margin-top:12px">The core documents of this initiative. Press a row to read it, see its edit log or its health. Draft it starts a read-only agent run that writes a draft for you to read; nothing is sent. Editing, issuing and dropping a document are not built on this page.</p></section>`;
179
+ <p class="note" style="margin-top:12px">The core documents of this initiative. Press a row to read it, see its edit log or its health. Draft it starts a read-only agent run that writes a draft for you to read; nothing is sent. Editing, issuing and dropping a document are not built on this page. A document you add is saved on the record; PMOS does not read a linked page.</p></section>`;
179
180
  }
180
181
  $('#iMain').addEventListener('input', (e) => { if (e.target.id === 'dmQ') { docQuery = e.target.value; drawDocList(); } });
181
182
  const draftable = () => M.docs.rows.filter((d) => !d.tech && d.st === 'missing' && d.act && d.act.kind === 'draft' && !d.running);
@@ -0,0 +1,143 @@
1
+ .ch.stuck{padding-block:12px;box-shadow:0 10px 24px -16px rgba(20,24,60,.3),inset 0 -1px 0 var(--hair)}
2
+ .ch.stuck .ic{transform:scale(.8)}
3
+ .ch.stuck small{opacity:0}
4
+ .mprog{height:4px;border-radius:8px;background:color-mix(in oklab,var(--ink) 10%,transparent);margin:0 0 6px;overflow:hidden}
5
+ .mprog b{display:block;height:100%;width:0;border-radius:8px;background:var(--ok);transition:width .6s var(--spring,ease)}
6
+ @media (max-width:700px){
7
+ .mprog{margin-top:8px}
8
+ }
9
+ .cx{display:grid;gap:24px;align-content:start}
10
+ .cx .label,.p-work .label{display:block;margin-bottom:8px}
11
+ .lk{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;color:var(--ink-2);padding:6px 10px 6px 4px;border-radius:999px}
12
+ .lk:hover{color:var(--ink);background:var(--well)}
13
+ .lk svg{width:15px;height:15px;transform:rotate(90deg)}
14
+ .mt1{background:var(--well);border-radius:18px;padding:14px 16px 12px;display:grid;gap:2px;align-content:start;outline:0}
15
+ .mt1 span{font-size:12.5px;color:var(--ink-3)}
16
+ .mt1 b{font-size:28px;letter-spacing:-.03em;line-height:1.15}
17
+ .mt1 em{font-style:normal;font-size:12.5px;color:var(--ink-3)}
18
+ .mt1.warn em{color:var(--ember-ink)}
19
+ .mt1.bad em{color:var(--bad)}
20
+ .mt1.ok em{color:var(--ok)}
21
+ .mch{cursor:crosshair}
22
+ .mch:focus-visible{box-shadow:0 0 0 2px var(--b3)}
23
+ .mch svg{width:100%;height:auto;display:block;margin-top:8px;overflow:visible}
24
+ .mch .ar{fill:color-mix(in oklab,var(--ink) 8%,transparent);stroke:none}
25
+ .mch .ln2{fill:none;stroke:var(--ink);stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}
26
+ .mch .tg{stroke:var(--ink-3);stroke-dasharray:3 3;stroke-width:1;vector-effect:non-scaling-stroke}
27
+ .mch .cx{stroke:var(--ink-3);stroke-width:1;opacity:0;vector-effect:non-scaling-stroke;transition:opacity .2s}
28
+ .mch .dt{fill:var(--ink);transition:cx .15s,cy .15s}
29
+ .mch.ok .dt{fill:var(--ok)}
30
+ .mch.warn .dt{fill:var(--ember)}
31
+ .mch.bad .dt{fill:var(--bad)}
32
+ .mch .gp{stroke:var(--ink-3);opacity:.55;stroke-dasharray:2 4;fill:none;stroke-width:1.4}
33
+ .calm{display:flex;align-items:center;gap:16px;padding:22px 4px 8px}
34
+ .calm[hidden]{display:none}
35
+ .calm i{width:44px;height:44px;border-radius:50%;background:var(--solid);color:var(--on-solid);display:grid;place-items:center;flex:none}
36
+ .calm i svg{stroke-width:2.6}
37
+ .calm b{display:block;font-size:var(--t-title);letter-spacing:-.01em}
38
+ .calm small{display:block;color:var(--ink-2);font-size:var(--t-small);margin-top:2px}
39
+ .spk{width:120px;height:34px;flex:none;overflow:visible}
40
+ .spk path{fill:none;stroke:var(--ink);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
41
+ .spk line{stroke:var(--ink-3);stroke-dasharray:3 3;stroke-width:1}
42
+ .spk circle{fill:var(--ink)}
43
+ .spk.ok circle{fill:var(--ok)}
44
+ .spk.warn circle{fill:var(--ember)}
45
+ .spk.bad circle{fill:var(--bad)}
46
+ .mhint{margin:2px 0 14px;color:var(--ink-2);font-size:12.5px;line-height:1.55;max-width:78ch}
47
+ .mhint b{color:var(--ink)}
48
+ .mlab{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
49
+ .mchip{font-style:normal;font-size:12.5px;font-weight:650;padding:2px 9px;border-radius:999px;background:var(--well);color:var(--ink-2)}
50
+ .mchip.ok{background:color-mix(in oklab,var(--ok) 14%,transparent);color:var(--ok)}
51
+ .mchip.warn{background:color-mix(in oklab,var(--ember) 18%,transparent);color:var(--ember-ink)}
52
+ .mt1.off{box-shadow:inset 0 0 0 1.5px color-mix(in oklab,var(--ember) 55%,transparent)}
53
+ .mchg{font-size:12.5px;color:var(--ink-3);margin-top:2px}
54
+ .mchg.bad{color:var(--ember-ink)}
55
+ .mfoot{display:flex;justify-content:space-between;gap:8px;font:600 12.5px var(--mono);letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);margin-top:4px}
56
+ .mfoot i{font-style:normal}
57
+ .mfoot .tgl{text-transform:none;font-family:var(--sans);font-weight:550;letter-spacing:0;color:var(--ink-3)}
58
+ .mt1[data-op]{cursor:pointer;transition:transform .25s,box-shadow .25s}
59
+ .mt1[data-op]:hover{transform:translateY(-2px)}
60
+ #cIni .mprog{margin:0 0 10px}
61
+ .ndh{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap}
62
+ .ndh h2{margin:0;font-size:20px;font-weight:700;letter-spacing:-.01em}
63
+ .ndh p{margin:4px 0 0;color:var(--ink-2);font-size:12.5px}
64
+ .nact{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
65
+ .nrow{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:14px 0 4px}
66
+ .nrow .seg{margin:0}
67
+ .ngrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:6px}
68
+ .ntw{display:grid;gap:6px;align-content:start}
69
+ .ntw .mt1{margin:0}
70
+ .nbn{margin:0 0 -2px 4px;font-size:12.5px;font-weight:600;color:var(--ink-3)}
71
+ .ntf{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-height:30px;padding-left:2px}
72
+ .ntf .lk{font-size:12.5px}
73
+ .nempty{display:grid;gap:10px;justify-items:start;padding:22px;border-radius:18px;background:var(--well)}
74
+ .nempty p{margin:0;color:var(--ink-2)}
75
+ .ngrp{margin-top:18px}
76
+ .ngrp>.label{margin:0 0 6px 4px}
77
+ .ncr .spk{width:104px;height:auto;display:block}
78
+ .nsrc{display:inline-flex;align-items:center;gap:5px}
79
+ .nsch{margin:14px 0 0;color:var(--ink-3);font-size:12.5px}
80
+ .dplist{display:grid;gap:6px}
81
+ .dplist button{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;padding:12px 14px;border-radius:14px;background:var(--well)}
82
+ .dplist button b{font-size:15px;font-weight:600}
83
+ .dplist button small{color:var(--ink-3);display:block;font-weight:400;font-size:12.5px}
84
+ .dplist button[aria-pressed="true"]{box-shadow:inset 0 0 0 1.5px var(--ink)}
85
+ .dplist button i{font-style:normal;font-size:12.5px;font-weight:650;color:var(--ink-2)}
86
+ @media (max-width:700px){
87
+ .ngrid{grid-template-columns:minmax(0,1fr)}
88
+ .ncr .spk{width:120px}
89
+ }
90
+ .ndh+.mprog{margin-top:14px}
91
+ .nfd{margin:16px 0 4px;padding:16px 18px;border-radius:18px;background:var(--well)}
92
+ .nfd .label{margin:0 0 8px}
93
+ .nfd ul{list-style:none;margin:0;padding:0;display:grid;gap:2px}
94
+ .nfd li{display:grid;grid-template-columns:14px minmax(0,1fr) auto;gap:10px;align-items:start;padding:8px 0}
95
+ .nfd li+li{border-top:1px solid var(--hair)}
96
+ .nfdot{width:9px;height:9px;border-radius:50%;margin-top:7px;background:var(--ink-3)}
97
+ .nfd li.worse .nfdot,.nfd li.stuck .nfdot,.nfd li.off .nfdot{background:var(--ember)}
98
+ .nfd li.closing .nfdot,.nfd li.reached .nfdot{background:var(--ok)}
99
+ .nft{font-size:15px;line-height:1.5;color:var(--ink)}
100
+ @media (max-width:700px){
101
+ .nfd li{grid-template-columns:14px minmax(0,1fr)}
102
+ }
103
+ .nl{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:18px;align-items:start}
104
+ .nlc,.nlr{min-width:0}
105
+ .nhb{display:flex;align-items:center;gap:8px;margin-left:12px;flex-wrap:nowrap}
106
+ .nhb .lk{font-size:12.5px;white-space:nowrap}
107
+ .nrep .nhb{margin-left:auto}
108
+ .ndt{margin:0;font-size:20px;font-weight:700;letter-spacing:-.01em;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
109
+ .ngl{margin:24px 0 8px 4px}
110
+ .ndg{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
111
+ .ndc{display:grid;gap:8px;align-content:start;text-align:left;padding:16px 18px;border-radius:18px;background:var(--well);transition:background .25s,transform .3s var(--spring)}
112
+ .ndc:hover{background:color-mix(in oklab,var(--ink) 8%,var(--well));transform:translateY(-2px)}
113
+ .ndc b{font-size:15px;display:flex;align-items:center;gap:8px}
114
+ .ndm{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
115
+ .ndm small{color:var(--ink-3);font-size:12.5px}
116
+ .nrep .mhint{margin-bottom:10px}
117
+ @media (max-width:999px){
118
+ .nl{grid-template-columns:minmax(0,1fr)}
119
+ }
120
+ @media (max-width:700px){
121
+ .ndg{grid-template-columns:minmax(0,1fr)}
122
+ .nhb{flex:1 0 100%;margin-left:0;flex-wrap:wrap}
123
+ .nrep .nhb{margin-left:0}
124
+ }
125
+ .ndh{margin-top:16px}
126
+ .mnote{margin:6px 0 0 4px;font-size:12.5px;color:var(--ink-2)}
127
+ .ntf .lk,.nfa .lk,.nhb .lk,.stx .lk,.stlh .lk,.stdone{min-height:44px;padding:0 10px}
128
+ .nfd li{display:block;padding:0}
129
+ .nfd li+li{border-top:1px solid var(--hair)}
130
+ .nfr{display:grid;grid-template-columns:14px minmax(0,1fr) 18px;gap:10px;align-items:start;width:100%;text-align:left;padding:10px 6px;margin:0 -6px;border-radius:14px;min-height:44px;transition:background .2s}
131
+ button.nfr:hover,button.nfr:focus-visible{background:color-mix(in oklab,var(--ink) 6%,transparent)}
132
+ .ndc{gap:10px}
133
+ .ndc b{display:flex;align-items:center;gap:8px;font-size:15px}
134
+ .ndu{color:var(--ink-2);font-size:12.5px;line-height:1.4}
135
+ .ndsp{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
136
+ .nsp{display:grid;gap:4px;min-width:0}
137
+ .nsp svg{width:100%;height:30px;color:var(--ink-2)}
138
+ .nsp.warn svg{color:var(--ember)}
139
+ .nsp em{font-style:normal;font-size:12.5px;color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
140
+ .ndm{display:flex;align-items:center;justify-content:space-between;gap:8px}
141
+ .ndm small{color:var(--ink-3)}
142
+ .ntf .lk,.nsch .lk{min-height:44px;display:inline-flex;align-items:center}
143
+ .ntf{min-height:44px}
@@ -0,0 +1,143 @@
1
+ /* pm/premium-insights.js — the premium Insights page (initiative briefing-premium-insights, slice 9). Reads GET /api/insights-premium and draws the model
2
+ * lib/insights-premium.js builds from the KR metric records and the report files the console's Reports tab reads: the Dashboards card (charts with a target
3
+ * line, what stands out), the Reports card, the dock and the standard dialog. Nothing here posts: no press changes a record, and nothing is sent. */
4
+ import { $, $$, esc, openDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, crumbHtml, wireCrumb } from './premium-shell.js';
5
+
6
+ let M = null; // the model
7
+ let dash = 'all'; // the dashboard on screen
8
+ wireRail('rep');
9
+ const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
10
+ const DOCI = '<path d="M6 3h9l4 4v14H6z"/><path d="M14 3v5h5M9 13h6M9 17h4"/>';
11
+ const CHV2 = '<svg class="i" viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></svg>';
12
+ const byKey = (k) => (M && M.charts || []).find((c) => c.key === k) || null;
13
+
14
+ /* ── header ───────────────────────────────────────────────────────────────────────────────────────────────────── */
15
+ let crumbed = false;
16
+ function drawHead() {
17
+ if (!crumbed) {
18
+ crumbed = true;
19
+ const boards = M.board.switcher || [];
20
+ $('#crumbHost').innerHTML = crumbHtml({ board: M.board.name || 'Insights', boards, ask: 'Ask about these measures' });
21
+ wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-insights.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)), ask: () => { const c = M.charts[0]; if (c) openChart(c); else toast('No measure has a series to ask about.'); } });
22
+ }
23
+ $('#snap').textContent = M.header.text;
24
+ $('#snap').title = 'Every figure on this page comes from a KR metric record. A measure with fewer than two readings is listed, not drawn.';
25
+ $('#brief').textContent = M.empty || '';
26
+ }
27
+
28
+ /* ── charts ───────────────────────────────────────────────────────────────────────────────────────────────────── */
29
+ const W = 220, H = 60, P = 5;
30
+ const X = (fx) => P + fx * (W - 2 * P), Y = (fy) => P + (1 - fy) * (H - 2 * P);
31
+ function tileHtml(c) {
32
+ const d = c.pts.map((p, i) => (i ? 'L' : 'M') + X(p.fx).toFixed(1) + ',' + Y(p.fy).toFixed(1)).join('');
33
+ const last = c.pts[c.pts.length - 1];
34
+ const cls = c.chipKind === 'bad' ? 'warn' : c.chipKind;
35
+ const chg = c.step === 0 ? '' : `<span class="mchg ${c.good === null ? '' : c.good ? 'good' : 'bad'}">${c.step > 0 ? '▲ ' : '▼ '}${esc(Math.abs(c.step) + (c.unit && /^[%°]/.test(c.unit) ? c.unit : c.unit ? ' ' + c.unit : ''))} since the last reading</span>`;
36
+ return `<div class="mt1 mch ${c.chipKind}${c.off ? ' off' : ''}" data-key="${esc(c.key)}" tabindex="0" role="img" aria-label="${esc(c.title)}, ${c.pts.length} readings, now ${esc(c.v)}${c.targetTxt ? ', ' + esc(c.targetTxt) : ''}. Use the arrow keys to read each reading."><span class="mlab">${esc(c.title)}<i class="mchip ${cls}">${esc(c.chip)}</i></span><b class="mval">${esc(c.v)}</b><em class="mwk">${esc('on ' + c.at + (c.targetTxt ? ' · ' + c.targetTxt : ''))}</em>${chg}`
37
+ + `<svg viewBox="0 0 ${W} ${H}"><path class="ar" d="${d}L${X(1)},${H}L${X(0)},${H}Z"/>${c.ty !== null ? `<line class="tg" x1="${P}" x2="${W - P}" y1="${Y(c.ty)}" y2="${Y(c.ty)}"/>` : ''}<path class="ln2" d="${d}"/><line class="cx" x1="0" x2="0" y1="0" y2="${H}"/><circle class="dt" cx="${X(last.fx)}" cy="${Y(last.fy)}" r="3.5"/></svg>`
38
+ + `<span class="mfoot"><i>${esc(c.ticks[0])}</i>${c.target !== null ? '<i class="tgl">dashed line is the target</i>' : ''}<i>${esc(c.ticks[1])}</i></span></div>`;
39
+ }
40
+ /* Point at reading j: the cursor line, the dot, the value and the date move to it. Without j the tile returns to the latest reading. */
41
+ function chartAt(t, j) {
42
+ const c = byKey(t.dataset.key); if (!c) return;
43
+ const n = c.pts.length; j = j == null ? n - 1 : Math.max(0, Math.min(n - 1, j));
44
+ const p = c.pts[j], last = j === n - 1;
45
+ const cx = $('.cx', t), dt = $('.dt', t);
46
+ cx.setAttribute('x1', X(p.fx)); cx.setAttribute('x2', X(p.fx)); dt.setAttribute('cx', X(p.fx)); dt.setAttribute('cy', Y(p.fy));
47
+ t.classList.toggle('hv', !last); t.dataset.j = j;
48
+ const val = last ? c.v : p.txt, cap = last ? 'on ' + c.at + (c.targetTxt ? ' · ' + c.targetTxt : '') : 'on ' + p.d + (c.targetTxt ? ' · ' + c.targetTxt : '');
49
+ $('.mval', t).textContent = val; $('.mwk', t).textContent = cap;
50
+ t.setAttribute('aria-label', c.title + ', ' + (last ? 'now ' : '') + val + ', ' + cap + '. Use the arrow keys to read each reading.');
51
+ }
52
+
53
+ /* ── the dashboards card ──────────────────────────────────────────────────────────────────────────────────────── */
54
+ const curDash = () => M.dashboards.find((d) => d.id === dash) || M.dashboards[0];
55
+ function findingsHtml() {
56
+ const F = M.findings.filter((f) => f.text);
57
+ if (!F.length) return '';
58
+ return `<div class="nfd" role="region" aria-label="What stands out"><p class="label">What stands out</p><ul>${F.map((f) => `<li class="${esc(f.kind)}">${f.chart
59
+ ? `<button class="nfr" data-open="${esc(f.chart)}" aria-haspopup="dialog"><i class="nfdot" aria-hidden="true"></i><span class="nft">${esc(f.text)}</span>${CHV2}</button>`
60
+ : `<div class="nfr"><i class="nfdot" aria-hidden="true"></i><span class="nft">${esc(f.text)}</span></div>`}</li>`).join('')}</ul></div>`;
61
+ }
62
+ function drawDash() {
63
+ const D = curDash(), L = D.keys.map(byKey).filter(Boolean);
64
+ $('#dashCap').textContent = M.counts.total ? M.counts.charts + ' drawn · ' + M.counts.noSeries + ' without a series' : '';
65
+ const tabs = $('#dashTabs'); tabs.hidden = M.dashboards.length < 2;
66
+ if (!tabs.hidden) { tabs.innerHTML = '<i class="pill"></i>' + M.dashboards.map((d) => `<button data-d="${esc(d.id)}" aria-pressed="${d.id === D.id}">${esc(d.name)}</button>`).join(''); pillOf(tabs); }
67
+ if (!M.charts.length) {
68
+ $('#dashBody').innerHTML = `<div class="nempty" style="margin-top:14px"><p><b>${esc(M.counts.total ? 'No KR metric holds two readings yet.' : 'No KR metric is recorded for this workspace.')}</b> ${esc(M.counts.total ? 'A chart needs a series, so nothing is drawn.' : 'There is nothing to chart. Add one where the KR metrics are kept.')}</p></div>` + noSeriesHtml();
69
+ return;
70
+ }
71
+ const off = D.off, tot = L.length;
72
+ $('#dashBody').innerHTML = `<div class="mprog" role="progressbar" aria-label="Measures on their line" aria-valuemin="0" aria-valuemax="${tot}" aria-valuenow="${tot - off}"><b style="width:${(tot - off) / tot * 100}%"></b></div>`
73
+ + findingsHtml()
74
+ + `<p class="mhint" style="margin-top:6px"><b>${tot - off} of ${tot}</b> on their line${off ? `. <b class="mflag">${off} ${off === 1 ? 'is' : 'are'} behind it.</b>` : '.'} Each chart is one KR metric, drawn at the dates of its readings. A gap between readings is left as a gap. The dashed line is the target.</p>`
75
+ + `<div class="ngrid">${L.map((c) => `<div class="ntw">${tileHtml(c)}<div class="ntf"><button class="lk" data-open="${esc(c.key)}">Details</button></div></div>`).join('')}</div>` + noSeriesHtml();
76
+ }
77
+ function noSeriesHtml() {
78
+ const N = M.noSeries; if (!N.length) return '';
79
+ return `<p class="label ngl">No series recorded · ${N.length}</p><div class="dplist" role="list">${N.map((n) => `<div class="nempty" role="listitem" style="margin-bottom:6px"><p><b>${esc(n.title)}</b>${n.pillar ? ' · ' + esc(n.pillar) : ''}<br>${esc(n.why)} It is not drawn.</p></div>`).join('')}</div>`;
80
+ }
81
+ $('#dashTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-d]'); if (!b) return; dash = b.dataset.d; drawDash(); });
82
+ $('#dashBody').addEventListener('click', (e) => { const o = e.target.closest('[data-open]'); if (o) openChart(byKey(o.dataset.open)); });
83
+ $('#dashBody').addEventListener('keydown', (e) => {
84
+ const t = e.target.closest && e.target.closest('.mch'); if (!t || !/^Arrow(Left|Right)$/.test(e.key)) return;
85
+ e.preventDefault(); const c = byKey(t.dataset.key), j = +(t.dataset.j == null ? c.pts.length - 1 : t.dataset.j); chartAt(t, j + (e.key === 'ArrowRight' ? 1 : -1));
86
+ });
87
+ $('#dashBody').addEventListener('pointermove', (e) => {
88
+ const t = e.target.closest && e.target.closest('.mch'); $$('#dashBody .mch.hv').forEach((x) => { if (x !== t) chartAt(x); });
89
+ if (!t) return; const c = byKey(t.dataset.key), r = $('svg', t).getBoundingClientRect(); if (!c || !r.width) return;
90
+ const fx = Math.max(0, Math.min(1, ((e.clientX - r.left) / r.width * W - P) / (W - 2 * P)));
91
+ let best = 0; c.pts.forEach((p, i) => { if (Math.abs(p.fx - fx) < Math.abs(c.pts[best].fx - fx)) best = i; }); chartAt(t, best);
92
+ });
93
+ $('#dashBody').addEventListener('pointerleave', () => $$('#dashBody .mch.hv').forEach((x) => chartAt(x)));
94
+
95
+ /* ── reports ──────────────────────────────────────────────────────────────────────────────────────────────────── */
96
+ function repRow(r) {
97
+ return `<div class="dmr ${esc(r.state)}" role="listitem"><button class="dmo" data-rep="1"><span class="dmi c-Board">${ICO(DOCI)}</span><span class="dmn"><b>${esc(r.cadence)} · ${esc(r.date || r.slot)}</b><small>${esc(r.path)}</small><span class="dmm"><span class="s ${esc(r.state === 'issued' ? 'issued' : 'draft')}">${esc(r.stateLabel)}</span></span></span></button></div>`;
98
+ }
99
+ function drawReps() {
100
+ const R = M.reports;
101
+ $('#repCap').textContent = R.rows.length ? String(R.rows.length) : '';
102
+ $('#repBody').innerHTML = `<p class="mhint">A report is a file in the repository. PMOS drafts it, you read it. <b>Nothing is sent from here.</b></p>`
103
+ + (R.missing ? '<div class="nempty"><p><b>The report files could not be read</b>, so none is listed.</p></div>'
104
+ : R.rows.length ? `<p class="note" style="margin:6px 0 10px"><b>${R.counts.draft}</b> ${R.counts.draft === 1 ? 'draft' : 'drafts'} · <b>${R.counts.issued}</b> issued</p><div class="dmg ngrp" role="list">${R.rows.map(repRow).join('')}</div>`
105
+ : '<div class="nempty"><p><b>No report file is on record.</b> PMOS drafts one when you ask for it in the console.</p></div>')
106
+ + `<p class="nsch"><button class="lk" id="repOpen">Open the Reports tab</button> to read, edit or issue one. Schedules are not shown here.</p>`;
107
+ }
108
+ $('#repBody').addEventListener('click', (e) => { if (e.target.closest('[data-rep]') || e.target.closest('#repOpen')) location.assign('/c3.html?tab=rep'); });
109
+
110
+ /* ── dock ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
111
+ function drawDock() { $('#dN').textContent = M.dock.needs; $('#dLab').textContent = M.dock.label; $('#dNext').innerHTML = M.dock.next ? `<i></i>First <b>${esc(M.dock.next)}</b>` : 'No measure is behind its line'; }
112
+
113
+ /* ── the dialog: the measure's record, no press, the read-only agent beside it ───────────────────────────────── */
114
+ function cardHtml(c) { return `<div class="acard" id="card"><p class="ct">What this page can do</p><p class="nodef" id="holdWhy">${esc(c.dialog.hold)}</p></div>`; }
115
+ function paneHtml(c) {
116
+ const p = c.dialog.pane;
117
+ return `<article class="paper doc"><p class="dpath">${esc(p.file)}</p><div class="kv2">${c.dialog.facts.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div><h3 class="h2">All ${c.pts.length} readings</h3><div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div><p class="xn">Read from the KR metric record. The line status is the record's own: the straight line from its baseline to its target. Nothing here is a forecast.</p></article>`;
118
+ }
119
+ function openChart(c) {
120
+ if (!c) return;
121
+ const d = c.dialog;
122
+ openDlg({ eye: d.eye + ' · real data', title: c.title, sub: c.sub + ' · ' + c.chip, say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(c), noteKey: c.key, pane: paneHtml(c), label: 'KR metric record' });
123
+ loadThread(c.key);
124
+ setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
125
+ }
126
+ $('#dBody').addEventListener('click', (e) => { const lt = e.target.closest('#logT'); if (lt) { const c = $('#alog').classList.toggle('col'); lt.setAttribute('aria-expanded', !c); } });
127
+
128
+ /* ── load ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
129
+ function draw() { drawHead(); if (!M.dashboards.some((d) => d.id === dash)) dash = 'all'; drawDash(); drawReps(); drawDock(); onScroll(); }
130
+ async function load() {
131
+ const p = new URLSearchParams(location.search), q = [p.get('ws') ? 'ws=' + encodeURIComponent(p.get('ws')) : '', p.get('board') ? 'board=' + encodeURIComponent(p.get('board')) : ''].filter(Boolean).join('&');
132
+ let r = null, status = 0;
133
+ try { const res = await fetch('/api/insights-premium' + (q ? '?' + q : ''), { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
134
+ if (!r || !r.ok) {
135
+ $('#snap').textContent = 'The records could not be read';
136
+ $('#brief').textContent = 'The KR metric records could not be read, so this page shows nothing rather than guess.' + (r && r.error ? ' The reason: ' + r.error : status ? ' (the server answered ' + status + ')' : ' The server did not answer.');
137
+ setTimeout(load, 15000);
138
+ return;
139
+ }
140
+ M = r.model; draw();
141
+ }
142
+ $('#brief').textContent = 'Reading the records.';
143
+ load();
@@ -141,8 +141,8 @@ export function onScroll() {
141
141
  }
142
142
  addEventListener('scroll', onScroll, { passive: true }); addEventListener('resize', onScroll);
143
143
 
144
- /* ── the rail: Briefing and My work are premium pages; Board and Insights open the console's tab until their slices land ── */
145
- const GO = { brief: '/premium.html', work: '/premium-work.html', init: '/premium-board.html', rep: '/c3.html?tab=rep' };
144
+ /* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
145
+ const GO = { brief: '/premium.html', work: '/premium-work.html', init: '/premium-board.html', rep: '/premium-insights.html' };
146
146
  export function wireRail(here) {
147
147
  const rail = $('.rail');
148
148
  rail.style.setProperty('--pi', String(['brief', 'work', 'init', 'rep'].indexOf(here)));
@@ -182,3 +182,32 @@ export function wireCrumb(o) {
182
182
  });
183
183
  $('#crAsk').onclick = () => o.ask && o.ask();
184
184
  }
185
+
186
+ /* ── Add a document: the dialog the Board and the initiative page share (initiative briefing-premium-adddoc) ──────────────────────────────────
187
+ * o = { ws, scope: 'board:<id>' | 'initiative:<id>', sub, onAdded }. The one press posts to POST /api/custom-docs/add and nothing else. */
188
+ export function openAddDoc(o) {
189
+ const ini = String(o.scope).startsWith('initiative:'), phases = ['Discover', 'Plan', 'Build', 'Evaluate'];
190
+ const form = `<div class="addf"><p class="note" style="margin:0">Add a document the core set does not cover, for example a research plan, a UAT plan or a contract. It is saved on the ${ini ? 'initiative' : 'board'}'s record with the address of a copy that lives in Confluence or Google Docs. PMOS does not read or sync that page.</p>
191
+ <label>Title<input id="adT" maxlength="80" placeholder="For example: UAT plan"></label>
192
+ ${ini ? `<label>Phase<select id="adC">${phases.map((k) => `<option>${k}</option>`).join('')}</select></label>` : ''}
193
+ <div><span class="label">Who writes it</span><div class="seg" id="adW" role="group" aria-label="Who writes it"><i class="pill"></i><button type="button" data-w="drafts" aria-pressed="true">PMOS drafts it</button><button type="button" data-w="you" aria-pressed="false">I write it</button></div></div>
194
+ <div><span class="label">Where it lives</span><div class="two"><label><select id="adK" aria-label="Where it lives"><option value="">In PMOS</option><option>Confluence</option><option>Google Docs</option><option>Google Slides</option></select></label><label><input id="adU" maxlength="300" placeholder="Paste the page address" aria-label="Page address" disabled></label></div></div>
195
+ <p class="note" id="adM" role="status" style="margin:0;min-height:1.2em"></p><div class="cact"><button class="cta" id="adGo">Add document</button><button class="cta alt" id="adNo">Cancel</button></div></div>`;
196
+ openDlg({ eye: 'New document · real data', title: 'Add a document', sub: o.sub, say: 'Name the document and say who writes it. It is saved on the record.', stream: turnA(ptx('Name the document and say who writes it. I save it on the record and change nothing else. A linked page is kept as an address only.')), noteKey: null, pane: `<article class="paper doc">${form}</article>`, label: 'Document' });
197
+ $('#askF').hidden = true; pillOf($('#adW'));
198
+ let who = 'drafts';
199
+ $('#oMain').onchange = (e) => { if (e.target.id === 'adK') { $('#adU').disabled = !e.target.value; if (e.target.value) $('#adU').focus(); } };
200
+ $('#oMain').onclick = async (e) => {
201
+ const w = e.target.closest('[data-w]');
202
+ if (w) { who = w.dataset.w; $$('#adW button').forEach((x) => x.setAttribute('aria-pressed', x === w)); pillOf($('#adW')); return; }
203
+ if (e.target.closest('#adNo')) { closeDlg(); return; }
204
+ if (!e.target.closest('#adGo')) return;
205
+ const title = $('#adT').value.trim(), m = $('#adM'), kind = $('#adK').value, url = ($('#adU').value || '').trim();
206
+ if (!title) { m.textContent = 'Give the document a title.'; $('#adT').focus(); return; }
207
+ if (kind && !url) { m.textContent = 'Paste the address of the ' + kind + ' page, or choose In PMOS.'; $('#adU').focus(); return; }
208
+ const go = $('#adGo'); go.disabled = true;
209
+ const res = await pmPost('/api/custom-docs/add', { ws: o.ws, scope: o.scope, title, writer: who, phase: ini ? document.getElementById('adC').value : undefined, kind: kind || undefined, url: kind ? url : undefined });
210
+ if (!res || res.ok !== true) { go.disabled = false; m.textContent = (res && res.error) || 'The document could not be added.'; return; }
211
+ toast('Document added. It is saved on the record.'); closeDlg(); if (o.onAdded) await o.onAdded();
212
+ };
213
+ }
@@ -151,6 +151,8 @@ input[type=range]:active::-webkit-slider-thumb{transform:scale(1.15)}
151
151
  .dbody .kv{display:grid;grid-template-columns:110px minmax(0,1fr);gap:6px 14px;font-size:15px}
152
152
  .dbody .kv span:nth-child(odd){color:var(--ink-3)}
153
153
  .cta{height:48px;padding:0 24px;border-radius:var(--r-chip);background:var(--solid);color:var(--on-solid);font-weight:650;display:inline-flex;align-items:center;gap:8px;transition:transform .35s var(--spring)}
154
+ .cta.alt{background:var(--well);color:var(--ink)}
155
+ .cta.alt{background:var(--card)}
154
156
  a.cta{text-decoration:none}
155
157
  .cta:hover{transform:translateY(-2px)}
156
158
  .cta:active{transform:scale(.97)}
@@ -754,7 +756,7 @@ a.cta{text-decoration:none}
754
756
  .dmi.c-Board{background:color-mix(in oklab,rgb(79,109,245) 12%,transparent);color:rgb(58,84,214)}
755
757
  .dmn{display:grid;gap:3px;min-width:0}
756
758
  .dmn b{font-size:15px;font-weight:650;line-height:1.3;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
757
- .dmn>small{font-size:12.5px;line-height:1.45;color:var(--ink-2)}
759
+ .dmn>small{font-size:12.5px;line-height:1.45;color:var(--ink-2);overflow-wrap:anywhere}
758
760
  .dmadd{font-style:normal;font:700 12.5px var(--mono);letter-spacing:.08em;text-transform:uppercase;padding:2px 8px;border-radius:999px;background:var(--well);color:var(--ink-2)}
759
761
  .dmm{display:flex;gap:4px 16px;flex-wrap:wrap;margin-top:3px;font:500 12.5px var(--mono);color:var(--ink-3)}
760
762
  .dmm>span{display:inline-flex;align-items:center;gap:6px}
@@ -66,12 +66,12 @@
66
66
  </div>
67
67
  </div>
68
68
  <section class="card rise" style="--d:8;margin-top:24px" id="cDocs" aria-labelledby="hDocs">
69
- <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="hDocs">Core documents</h2><small id="docCap"></small></div>
69
+ <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="hDocs">Core documents</h2><small id="docCap"></small><button class="fold alt dmadd2" id="addDoc" type="button" hidden>Add a document</button></div>
70
70
  <div id="docTop"></div>
71
71
  <div class="dmg two" id="docBody" role="list"></div>
72
72
  <p class="note" id="docNote" style="margin-top:12px"></p>
73
73
  </section>
74
- <p class="foot" id="foot">This page reads the board's own records, the same ones the Initiatives page reads. Its one press is Draft it on a core document, which starts the existing read-only run that writes a draft and sends nothing. Issue, Drop and moving an initiative are not built here. The Metrics charts are not drawn, because PMOS holds no metric series for a board. A sprint appears only when a session has read Jira.</p>
74
+ <p class="foot" id="foot">This page reads the board's own records, the same ones the Initiatives page reads. Its presses are Draft it on a core document, which starts the existing read-only run that writes a draft and sends nothing, and Add a document, which saves a document on the board's record. Issue, Drop and moving an initiative are not built here. The Metrics charts are not drawn, because PMOS holds no metric series for a board. A sprint appears only when a session has read Jira.</p>
75
75
  </main>
76
76
  <noscript>This page needs JavaScript.</noscript>
77
77
  <script type="module" src="/pm/premium-board.js"></script>
@@ -38,7 +38,7 @@
38
38
  </header>
39
39
  <section class="hero hero-slim"><p class="brief rise" style="--d:2" id="brief" aria-live="polite"></p></section>
40
40
  <div id="iMain"><p class="empty3 plain" id="iRead">The initiative is read from its records. This page shows nothing until it has read, rather than guess.</p></div>
41
- <p class="foot" id="foot">This page reads the initiative's own records, the same ones the Initiatives sheet reads. Its one press is Draft it on a core document, which starts the existing read-only run that writes a draft and sends nothing. Opening a document only reads it. Editing, Issue, Drop and adding a task are not built on this page.</p>
41
+ <p class="foot" id="foot">This page reads the initiative's own records, the same ones the Initiatives sheet reads. Its presses are Draft it on a core document, which starts the existing read-only run that writes a draft and sends nothing, Add a task, and Add a document, which saves a document on the initiative's record. Opening a document only reads it. Editing, Issue and Drop are not built on this page.</p>
42
42
  </main>
43
43
  <noscript>This page needs JavaScript.</noscript>
44
44
  <script type="module" src="/pm/premium-initiative.js"></script>
@@ -0,0 +1,61 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
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. It presses nothing and writes nothing. -->
9
+ <link rel="preload" href="/vendor/geist-var.woff2" as="font" type="font/woff2" crossorigin />
10
+ <link rel="stylesheet" href="/pm/premium.css" />
11
+ <link rel="stylesheet" href="/pm/premium-insights.css" />
12
+ </head>
13
+ <body>
14
+ <div class="sky"><i class="a"></i><i class="b"></i><i class="c"></i></div>
15
+ <nav class="rail glass" aria-label="Places">
16
+ <i class="ind"></i>
17
+ <button class="pl" data-go="brief"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>Briefing</button>
18
+ <button class="pl" data-go="work"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="m8.5 12 2.5 2.5 4.5-5"/></svg>My work</button>
19
+ <button class="pl" data-go="init"><svg class="i" viewBox="0 0 24 24"><path d="M12 3 3 8l9 5 9-5z"/><path d="m3 13 9 5 9-5"/></svg>Board</button>
20
+ <button class="pl" data-go="rep" aria-current="page"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg>Insights</button>
21
+ </nav>
22
+
23
+ <div class="dock glass" id="dock" inert><span class="nm">Insights</span><span class="sep"></span><span class="cnt"><b id="dN">·</b><span id="dLab">need a look</span></span><span class="sep hide-s"></span><span class="pl2 hide-s" id="dNext"></span><span class="sp"></span><button class="round" id="theme2" aria-label="Switch light or dark" style="width:44px;height:44px"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
24
+ <div class="veil" id="veil"></div>
25
+ <div class="dlg" id="dlg" role="dialog" aria-modal="true" aria-labelledby="dTitle" tabindex="-1" data-mode="split" inert>
26
+ <div class="grab"></div>
27
+ <div class="dhead"><div class="dht"><p class="label" id="dEye"></p><h2 id="dTitle"></h2><p class="dsub" id="dSub"></p></div>
28
+ <div class="dtools"><button class="round dx2" id="dPane" aria-label="Hide the conversation" aria-pressed="true" title="Hide the conversation"><svg class="i" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="16" rx="3"/><path d="M9 4v16"/></svg></button><button class="round dx2" id="dExpand" aria-label="Full screen" aria-pressed="false" title="Full screen"><svg class="i" viewBox="0 0 24 24"><path id="dExpP" d="M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7"/></svg></button><button class="round dx2" id="dClose" aria-label="Close"><svg class="i" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button></div></div>
29
+ <div class="dtabs" id="dTabs"><div class="seg" role="group" aria-label="Sections"><i class="pill"></i><button data-t="out" aria-pressed="true">Detail</button><button data-t="chat" aria-pressed="false">Conversation</button></div></div>
30
+ <div class="dgrid" id="dGrid" data-tab="out"><section class="pane p-work" id="dBody" aria-label="Conversation"></section>
31
+ <section class="pane p-out" id="dOut" aria-label="Detail"><div class="otop"><span class="ol" id="oLab">Detail</span></div><div class="obody" id="oMain"></div></section></div>
32
+ </div>
33
+ <div class="toast glass" id="toast" role="status"></div>
34
+ <main class="stage" id="stage">
35
+ <header class="top rise" style="--d:0">
36
+ <h1 class="vh">Insights</h1><div id="crumbHost"></div>
37
+ <div class="tools tools-top"><span class="snap" id="snap">Reading the records</span>
38
+ <button class="glass round" id="theme" aria-label="Switch light or dark"><svg class="i" viewBox="0 0 24 24"><path d="M20 14.5A8 8 0 0 1 9.5 4 8 8 0 1 0 20 14.5z"/></svg></button></div>
39
+ </header>
40
+ <section class="hero hero-slim"><p class="brief rise" style="--d:2" id="brief" aria-live="polite"></p></section>
41
+ <div class="nl">
42
+ <div class="nlc">
43
+ <section class="card rise" style="--d:5" id="cDash" aria-labelledby="hDash">
44
+ <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>
45
+ <div class="seg" id="dashTabs" role="group" aria-label="Dashboard" hidden><i class="pill"></i></div>
46
+ <div id="dashBody"></div>
47
+ </section>
48
+ </div>
49
+ <aside class="nlr" aria-label="Reports">
50
+ <section class="card nrep rise" style="--d:6" id="cRep" aria-labelledby="hRep">
51
+ <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>
52
+ <div id="repBody"></div>
53
+ </section>
54
+ </aside>
55
+ </div>
56
+ <p class="foot" id="foot">Charts read the KR metric records of this workspace and never invent a number. Left out: the Insight Studio (making your own chart, dashboard or report by conversation), run-based charts such as corrections per 100 runs (they belong to the Board's Metrics card), and any measure no record holds. This page presses nothing and sends nothing.</p>
57
+ </main>
58
+ <noscript>This page needs JavaScript.</noscript>
59
+ <script type="module" src="/pm/premium-insights.js"></script>
60
+ </body>
61
+ </html>
@@ -6093,12 +6093,12 @@ async function handleRequest(req, res) {
6093
6093
 
6094
6094
  // console3 (public/c3.html) is the default page: '/' and '/index.html' serve it, and '/c3.html' stays an alias so old links
6095
6095
  // keep working. The older shell (public/index.html) moved to '/classic.html' (c3-default-page), reachable and easy to return to.
6096
- if (p === '/' || p === '/index.html' || p === '/c3.html' || p === '/classic' || p === '/classic.html' || p === '/welcome' || p === '/welcome.html' || p === '/premium' || p === '/premium.html' || p === '/premium-work' || p === '/premium-work.html' || p === '/premium-board' || p === '/premium-board.html' || p === '/premium-initiative' || p === '/premium-initiative.html') {
6096
+ if (p === '/' || p === '/index.html' || p === '/c3.html' || p === '/classic' || p === '/classic.html' || p === '/welcome' || p === '/welcome.html' || p === '/premium' || p === '/premium.html' || p === '/premium-work' || p === '/premium-work.html' || p === '/premium-board' || p === '/premium-board.html' || p === '/premium-initiative' || p === '/premium-initiative.html' || p === '/premium-insights' || p === '/premium-insights.html') {
6097
6097
  // pm-os-absorb Run 2 (R25, X11): the per-launch nonce goes into the base meta line, nowhere else. no-store, so a
6098
6098
  // restarted server never answers a press from a page that holds the previous launch's value. The page code is
6099
6099
  // referenced under this launch's build prefix.
6100
6100
  const n = pmGuard.launchNonce();
6101
- return fs.readFile(path.join(PUB, (p === '/classic' || p === '/classic.html') ? 'index.html' : (p === '/welcome' || p === '/welcome.html') ? 'welcome.html' : (p === '/premium' || p === '/premium.html') ? 'premium.html' : (p === '/premium-work' || p === '/premium-work.html') ? 'premium-work.html' : (p === '/premium-board' || p === '/premium-board.html') ? 'premium-board.html' : (p === '/premium-initiative' || p === '/premium-initiative.html') ? 'premium-initiative.html' : 'c3.html'), 'utf8', (err, html) => {
6101
+ return fs.readFile(path.join(PUB, (p === '/classic' || p === '/classic.html') ? 'index.html' : (p === '/welcome' || p === '/welcome.html') ? 'welcome.html' : (p === '/premium' || p === '/premium.html') ? 'premium.html' : (p === '/premium-work' || p === '/premium-work.html') ? 'premium-work.html' : (p === '/premium-board' || p === '/premium-board.html') ? 'premium-board.html' : (p === '/premium-initiative' || p === '/premium-initiative.html') ? 'premium-initiative.html' : (p === '/premium-insights' || p === '/premium-insights.html') ? 'premium-insights.html' : 'c3.html'), 'utf8', (err, html) => {
6102
6102
  if (err) { res.writeHead(404); res.end('not found'); return; }
6103
6103
  let out = withBuild(html);
6104
6104
  if (n) out = out.replace('<meta name="' + pmGuard.NONCE_META + '" content="" />', '<meta name="' + pmGuard.NONCE_META + '" content="' + n + '" />');
@@ -40,7 +40,9 @@
40
40
  "briefing-premium-agent.test.js",
41
41
  "briefing-premium-work.test.js",
42
42
  "briefing-premium-board.test.js",
43
+ "briefing-premium-insights.test.js",
43
44
  "briefing-premium-initiative.test.js",
45
+ "briefing-premium-adddoc.test.js",
44
46
  "briefing-premium-doc-edit.test.js",
45
47
  "briefing-premium-products.test.js",
46
48
  "briefing-premium-sources.test.js",
@@ -203,7 +205,9 @@
203
205
  "briefing-premium-agent.test.js": 1,
204
206
  "briefing-premium-work.test.js": 1,
205
207
  "briefing-premium-board.test.js": 1,
208
+ "briefing-premium-insights.test.js": 1,
206
209
  "briefing-premium-initiative.test.js": 1,
210
+ "briefing-premium-adddoc.test.js": 1,
207
211
  "briefing-premium-doc-edit.test.js": 1,
208
212
  "briefing-premium-products.test.js": 1,
209
213
  "briefing-premium-sources.test.js": 1,
@@ -4,7 +4,9 @@
4
4
  "briefing-premium-test.js",
5
5
  "briefing-premium-work-test.js",
6
6
  "briefing-premium-board-test.js",
7
+ "briefing-premium-insights-test.js",
7
8
  "briefing-premium-initiative-test.js",
9
+ "briefing-premium-adddoc-test.js",
8
10
  "briefing-premium-doc-edit-test.js",
9
11
  "briefing-premium-products-test.js",
10
12
  "briefing-premium-sources-test.js",
@@ -15,7 +17,9 @@
15
17
  "briefing-premium-test.js": 60,
16
18
  "briefing-premium-work-test.js": 80,
17
19
  "briefing-premium-board-test.js": 120,
20
+ "briefing-premium-insights-test.js": 90,
18
21
  "briefing-premium-initiative-test.js": 120,
22
+ "briefing-premium-adddoc-test.js": 120,
19
23
  "briefing-premium-doc-edit-test.js": 90,
20
24
  "briefing-premium-products-test.js": 90,
21
25
  "briefing-premium-sources-test.js": 90,