create-pmos 0.536.0 → 0.538.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 (103) hide show
  1. package/package.json +81 -33
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/board-columns-test.js +11 -10
  8. package/workspace/board-programs-test.js +27 -24
  9. package/workspace/board-publish-ui-test.js +19 -15
  10. package/workspace/board-shared-ui-test.js +16 -13
  11. package/workspace/board-workflows-test.js +26 -32
  12. package/workspace/briefing-premium-board-test.js +70 -50
  13. package/workspace/briefing-premium-insights-test.js +24 -31
  14. package/workspace/briefing-premium-metrics-test.js +2 -2
  15. package/workspace/calm-timeline-test.js +1 -1
  16. package/workspace/changelog.json +80 -0
  17. package/workspace/ev-everywhere-test.js +4 -5
  18. package/workspace/fixtures/board-premium-facts.js +1 -1
  19. package/workspace/fixtures/board-workflows-facts.js +7 -1
  20. package/workspace/fixtures/initiative-premium-facts.js +1 -1
  21. package/workspace/fixtures/insights-premium-facts.js +6 -6
  22. package/workspace/fixtures/program-ascent.js +1 -1
  23. package/workspace/guide/adler.md +2 -2
  24. package/workspace/guide/agent-capabilities.md +38 -6
  25. package/workspace/guide/board.md +20 -2
  26. package/workspace/guide/claude-proposes.md +1 -1
  27. package/workspace/guide/home.md +2 -2
  28. package/workspace/guide/index.md +3 -3
  29. package/workspace/guide/intelligence-okr-goals.md +18 -7
  30. package/workspace/guide/lifecycle.md +2 -2
  31. package/workspace/guide/programs.md +2 -2
  32. package/workspace/guide/reports-needs-you.md +5 -5
  33. package/workspace/guide/settings.md +14 -11
  34. package/workspace/guide/workflows.md +3 -3
  35. package/workspace/guide/your-impact.md +1 -1
  36. package/workspace/lib/agent-team.js +262 -0
  37. package/workspace/lib/ai-cli.js +36 -4
  38. package/workspace/lib/bg-queue.js +9 -4
  39. package/workspace/lib/board-premium.js +6 -3
  40. package/workspace/lib/goal-source.js +77 -0
  41. package/workspace/lib/grill-runs.js +6 -3
  42. package/workspace/lib/headless.js +36 -4
  43. package/workspace/lib/idle-lab-engine.js +7 -6
  44. package/workspace/lib/initiative-premium.js +6 -3
  45. package/workspace/lib/insights-premium.js +1 -1
  46. package/workspace/lib/job-graph.js +191 -0
  47. package/workspace/lib/okr-goals.js +3 -0
  48. package/workspace/lib/orchestrator-keeprate.js +108 -7
  49. package/workspace/lib/pmos-verbs.js +3 -0
  50. package/workspace/lib/proposal-runs.js +8 -5
  51. package/workspace/lib/proposals.js +32 -2
  52. package/workspace/lib/report-slots.js +14 -10
  53. package/workspace/lib/routes-boards.js +2 -2
  54. package/workspace/lib/routes-insights-premium.js +11 -4
  55. package/workspace/lib/routes-premium-dashboards.js +20 -6
  56. package/workspace/lib/routes-proposals.js +10 -5
  57. package/workspace/lib/routes-your-move.js +6 -7
  58. package/workspace/lib/status-proof.js +45 -0
  59. package/workspace/lib/status-signal.js +4 -2
  60. package/workspace/lib/task-links.js +3 -1
  61. package/workspace/lib/team-cli.js +164 -0
  62. package/workspace/lib/team-runs.js +244 -0
  63. package/workspace/lib/verify-runs.js +112 -0
  64. package/workspace/okr-goals-ui-test.js +10 -13
  65. package/workspace/package-lock.json +2 -2
  66. package/workspace/package.json +1 -1
  67. package/workspace/premium-vw-backlog-test.js +2 -2
  68. package/workspace/premium-vw-jira-test.js +2 -2
  69. package/workspace/public/pm/bd-acts.js +30 -45
  70. package/workspace/public/pm/bd-ini-panel.js +38 -27
  71. package/workspace/public/pm/bd-publish.js +1 -1
  72. package/workspace/public/pm/bd-span.js +2 -1
  73. package/workspace/public/pm/bd-views.js +7 -5
  74. package/workspace/public/pm/bd-wf.js +5 -28
  75. package/workspace/public/pm/c3-ini-ui.js +9 -7
  76. package/workspace/public/pm/cozy-board.css +75 -31
  77. package/workspace/public/pm/cozy-insights.css +18 -0
  78. package/workspace/public/pm/cozy-nav.js +2 -2
  79. package/workspace/public/pm/cozy-search.js +29 -7
  80. package/workspace/public/pm/cozy-settings.js +39 -20
  81. package/workspace/public/pm/home-data.js +3 -1
  82. package/workspace/public/pm/home-ini-model.js +15 -1
  83. package/workspace/public/pm/home-ini.js +9 -3
  84. package/workspace/public/pm/ini-tail.js +61 -0
  85. package/workspace/public/pm/ini-view-model.js +10 -7
  86. package/workspace/public/pm/premium-board.js +119 -119
  87. package/workspace/public/pm/premium-insights.js +95 -112
  88. package/workspace/public/pm/premium-report-intel.js +3 -2
  89. package/workspace/public/pm/readonly.js +4 -3
  90. package/workspace/public/pm/stage-chip.js +2 -1
  91. package/workspace/public/pm/status-proof.js +43 -0
  92. package/workspace/public/premium-board.html +14 -35
  93. package/workspace/public/premium-intelligence.html +7 -9
  94. package/workspace/server.js +35 -1
  95. package/workspace/sort-order-test.js +10 -8
  96. package/workspace/test-files.json +4 -2
  97. package/workspace/test-lists/agent-team.json +9 -0
  98. package/workspace/test-lists/job-graph.json +11 -0
  99. package/workspace/test-lists/status-proof.json +5 -0
  100. package/workspace/workflows-setup-test.js +3 -2
  101. package/workspace/public/premium-chat.html +0 -14
  102. package/workspace/public/premium-initiative.html +0 -15
  103. package/workspace/public/premium-work.html +0 -14
@@ -2,8 +2,8 @@
2
2
  * Top to bottom: the ✦ strip (one finding at a time, its drafted move when it has one), the North Star with its inputs (KR metric records with role
3
3
  * north-star, input or guardrail), what Claude drafted for this product (GET /api/metric-drafts, one ✓ to keep each), the key results grouped by
4
4
  * objective with the health budgets, then "Did it work?" (to judge and in their window; a drafted verdict with ✓ Keep and Undo, POST
5
- * /api/insights-records/verdict and /verdict-undo; decided ones fold). ⋯ holds Reports and dashboards (the old Library, in a side panel), Delivery
6
- * trends, Sources, Export and About. The old ?tab=goals|outcomes|library links land on the matching section or panel; ?goal= and ?dash= still work.
5
+ * /api/insights-records/verdict and /verdict-undo; decided ones fold). A key result with no reading is not a table row: it waits in "Waiting on a
6
+ * source", one row per source (U3). ⋯ holds Reports and dashboards (the old Library, in a side panel) and Export CSV. The old ?tab=goals|outcomes|library links land on the matching section or panel; ?goal= and ?dash= still work.
7
7
  * Before it, the premium Insights in the Agreed design's frames (initiative premium-agreed-design): AgInsGoals, AgInsPeriod,
8
8
  * AgInsNewGoal, AgInsNewDash, AgInsChart, AgInsOutcomes, AgInsVerdict, AgInsLibrary and AgInsPhone.
9
9
  *
@@ -24,7 +24,7 @@
24
24
  * Viewer card (Setup, Issues, Brief); a request from Home with Set it up, Change it and Cancel. New report hands off to Home.
25
25
  * IsMenus the product chip (the one pick Home and Board share, batch 12 item 5: one ticked = that product; several = Portfolio, their
26
26
  * goals rolled up and grouped by product), the Dashboard menu, Find (goals,
27
- * reports and dashboards), Filter (status, owner, kind), ⋯ (Sources, Export, About) and the empty trend of a goal with one reading.
27
+ * reports and dashboards), Filter (status, owner, kind), ⋯ (Reports and dashboards, Export) and the empty trend of a goal with one reading.
28
28
  * IsPhone the goal detail full screen with Readings, Moved by and Dashboards; a report setup as a sheet.
29
29
  * window.czViewer is feature-detected, with this page's side panel as the fallback. A report file opens in the report reader
30
30
  * (pm/premium-report-read.js), the report panel in the Viewer card. The page has no #dlg. */
@@ -48,12 +48,13 @@ import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (pane
48
48
  import * as GC from './goals-clear.js';
49
49
  import * as LAB from './cozy-lab-ins.js'; // Intelligence › Lab (idle lab B+C, canvas I1 IlBC): what fits no initiative, the week's background record, next time
50
50
  import * as FCV from './goal-forecast.js'; // a goal's forecast in its Viewer (FcViewer, FcPhone): the state line, the range band, the baseline ✓ // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
51
+ import { provenStatus } from './status-proof.js'; // T3: an initiative's status word renders only with its source and read time
51
52
 
52
53
  let M = null; // the model
53
54
  let BM = null, bmErr = ''; // the Board measures (Delivery trends)
54
55
  let dash = null; // the view: a dashboard id; 'all' is every goal
55
56
  let per = null; // the period { key, label, name, from, to }
56
- let find = '';
57
+ const find = ''; // the words the tables narrow to: none since UI grill U2 (Find opens Search); the empty-table lines still read it
57
58
  let filt = { status: [], owner: [], kind: [] }; // the Filter (IsMenus): each group holds the chips that are on
58
59
  let PF = null; // Portfolio (IsMenus): { goals, charts, products } rolled up from the ticked products' models, or null
59
60
  // the products shown: the one saved pick (GET /api/briefing-premium/products). A link with ?ws= or ?board= is a one-off view of that product.
@@ -63,7 +64,7 @@ const pickedWs = () => (PKP && !DEEP ? PKP.products.filter((p) => p.on).sort((a,
63
64
  let loadedAt = 0;
64
65
  let selecting = false; let picked = []; // New dashboard: the goals picked in the table, in order
65
66
  wireRail('rep');
66
- mountNav('insights');
67
+ mountNav('insights', document, { scope: () => insScope() }); // ⌘K and Find open Search scoped to Intelligence first (UI grill U2)
67
68
  quietPlace('insights', document.getElementById('stage'));
68
69
  mountLivePill();
69
70
  // the page is the first panel (canvas BiI1Split): a goal row drags beside or opens beside on ⌘/Ctrl-click; the table needs about 880 px whole
@@ -102,7 +103,7 @@ const closeViewer = () => { if (window.czViewer && typeof window.czViewer.close
102
103
  /* ── small menus: one open at a time, Escape and an outside press close it ─────────────────────────────────────────────────────── */
103
104
  const MENUS = [['#viewChip', '#viewMenu'], ['#perChip', '#perMenu'], ['#filtB', '#filtMenu'], ['#moreB', '#moreMenu']];
104
105
  function menu(btn, box, open) { $(box).hidden = !open; $(btn).setAttribute('aria-expanded', String(open)); }
105
- function closeMenus(except) { for (const [b, m] of MENUS) if (m !== except && !$(m).hidden) menu(b, m, false); const cm = $('#chMenu'); if (cm) cm.hidden = true; if (!$('#findRow').hidden) closeFind(false); }
106
+ function closeMenus(except) { for (const [b, m] of MENUS) if (m !== except && !$(m).hidden) menu(b, m, false); const cm = $('#chMenu'); if (cm) cm.hidden = true; }
106
107
  for (const [b, m] of MENUS) {
107
108
  $(b).addEventListener('click', (e) => {
108
109
  e.stopPropagation(); const open = $(m).hidden; closeMenus(m); menu(b, m, open);
@@ -111,13 +112,11 @@ for (const [b, m] of MENUS) {
111
112
  }
112
113
  document.addEventListener('click', (e) => {
113
114
  for (const [b, m] of MENUS) if (!$(m).hidden && !e.target.closest(m) && !e.target.closest(b)) menu(b, m, false);
114
- if (!$('#findRow').hidden && !e.target.closest('#findRow, #findB')) closeFind(false);
115
115
  const tp = $('#tgPop'); if (tp && !e.target.closest('#tgPop, [data-tile]')) closeTarget();
116
116
  const om = $('#ngObjMenu'); if (om && !om.hidden && !e.target.closest('#ngObjMenu, #ngObjB')) { om.hidden = true; $('#ngObjB').setAttribute('aria-expanded', 'false'); }
117
117
  });
118
118
  document.addEventListener('keydown', (e) => {
119
119
  if (e.key !== 'Escape') return;
120
- if (!$('#findRow').hidden) { closeFind(true); return; }
121
120
  if ($('#tgPop')) { closeTarget(true); return; }
122
121
  if ($('#repSheet')) { closeSheet(); return; }
123
122
  for (const [b, m] of MENUS) if (!$(m).hidden) { menu(b, m, false); $(b).focus(); return; }
@@ -190,7 +189,6 @@ function drawBar() {
190
189
  $('#viewName').textContent = dash === TRENDS ? 'Delivery trends' : dashName(D);
191
190
  /* View (Iq8Overview): every view, the default one marked; Delivery trends; then Pin, New dashboard and Edit chart */
192
191
  $('#viewMenu').innerHTML = '<p class="ins-mh">Dashboard</p>' + M.dashboards.map((d) => `<button type="button" role="menuitemradio" aria-checked="${dash !== TRENDS && d.id === D.id}" data-view="${esc(d.id)}" title="${esc(d.id === 'all' ? 'Every goal and budget' : d.saved ? 'Saved dashboard · ' + nGoals(d.charts.length) : 'The goals of one objective')}">${esc(dashName(d))}<span class="k">${M.pinned === d.id ? 'default' : ''}</span></button>`).join('')
193
- + (M.board.ws ? `<button type="button" role="menuitemradio" aria-checked="${dash === TRENDS}" data-view="${TRENDS}" title="The Board’s measures, with their targets">Delivery trends</button>` : '')
194
192
  + '<div class="ins-hr"></div>' + (dash !== TRENDS && M.board.id ? `<button type="button" role="menuitem" data-pin${M.pinned === D.id ? ' disabled' : ''}>${SV(I.pin)}${M.pinned === D.id ? 'Pinned: it opens first' : 'Pin, so it opens first'}</button>` : '')
195
193
  + `<button type="button" role="menuitem" data-newdash>${SV(I.plus)}New dashboard</button><button type="button" role="menuitem" data-newchart>${SV(I.chart)}Edit chart</button>`;
196
194
  drawPeriod(); drawFilter();
@@ -330,90 +328,39 @@ $('#filtMenu').addEventListener('click', (e) => {
330
328
  redraw(); menu('#filtB', '#filtMenu', true);
331
329
  });
332
330
 
333
- /* Find (IsMenus): goals, reports and dashboards that hold the words, with the words marked. While it has words the tables narrow too. */
334
- function openFind() { closeMenus(); $('#findRow').hidden = false; $('#findB').setAttribute('aria-expanded', 'true'); drawFind(); $('#findIn').focus(); }
335
- function closeFind(focus) { $('#findIn').value = ''; const had = !!find; find = ''; $('#findRow').hidden = true; $('#findB').setAttribute('aria-expanded', 'false'); if (had) redraw(); if (focus) $('#findB').focus(); }
336
- $('#findB').addEventListener('click', (e) => { e.stopPropagation(); if ($('#findRow').hidden) openFind(); else closeFind(true); });
337
- $('#findIn').addEventListener('input', () => { find = $('#findIn').value.trim().toLowerCase(); redraw(); drawFind(); });
338
- $('#findIn').addEventListener('keydown', (e) => { if (e.key === 'Enter') { const f = $('#findRes [data-fo]'); if (f) { e.preventDefault(); f.click(); } } });
339
- $('#findX').addEventListener('click', () => closeFind(true));
331
+ /* Find (UI grill U2: one search). The page's own find box is gone: Find and ⌘K open Search (pm/cozy-search.js) scoped to Intelligence, so its
332
+ * goals, reports and dashboards come first, marked by group, and the rest of Search (initiatives, documents, meetings) after them. A result opens
333
+ * here as it did: a goal its detail, a report its row in Reports and dashboards, a dashboard as the view. The table no longer narrows to the words:
334
+ * Filter narrows it, and Search opens the one you meant. */
340
335
  const hit = (...s) => !find || s.some((x) => String(x || '').toLowerCase().includes(find));
341
- const markHtml = (t) => { const s = String(t || ''), i = find ? s.toLowerCase().indexOf(find) : -1; return i < 0 ? esc(s) : esc(s.slice(0, i)) + '<mark>' + esc(s.slice(i, i + find.length)) + '</mark>' + esc(s.slice(i + find.length)); };
342
- function drawFind() {
343
- if (!M) return;
344
- if (!find) { $('#findRes').innerHTML = '<p class="note ins-mnote">Type a few letters of a goal, a report or a dashboard.</p>'; return; }
345
- const row = (attr, name, sub) => `<button type="button" role="option" class="ins-fo" ${attr}><span><span>${markHtml(name)}</span><small>${esc(sub)}</small></span></button>`;
346
- const G = allGoals().filter((g) => hit(g.title, g.pillar)).slice(0, 5).map((g) => row(`data-fo="goal" data-id="${esc(g.id)}"`, (krId(g) ? krId(g) + ' · ' : '') + g.title, [PF ? g.prod : dashName(curDash()), g.nowTxt ? g.nowTxt + (g.targetTxt ? ' of ' + g.targetTxt : '') : 'no reading yet'].join(' · ')));
347
- const R = reportGroups().filter((x) => hit(x.x.name)).slice(0, 5).map((x) => row(`data-fo="${x.kind}" data-id="${esc(x.x.id)}"`, x.x.name, repState(x).pill[1]))
348
- .concat((M.reports.asks || []).filter((a) => hit(a.text, a.proposal && a.proposal.name)).slice(0, 3).map((a) => row(`data-fo="ask" data-id="${esc(a.id)}"`, a.proposal && a.proposal.name ? a.proposal.name : a.text, ASKST[a.state][2])));
349
- const D = M.dashboards.filter((d) => hit(dashName(d))).slice(0, 5).map((d) => row(`data-fo="dash" data-id="${esc(d.id)}"`, dashName(d), d.saved ? nGoals(d.charts.length) : d.id === 'all' ? 'Every goal and budget' : 'One objective'));
350
- const grp = (h, L) => (L.length ? `<p class="ins-mh">${h}</p>` + L.join('') : '');
351
- $('#findRes').innerHTML = grp('Goals', G) + grp('Reports', R) + grp('Dashboards', D) || `<p class="note ins-mnote">Nothing holds “${esc(find)}”.</p>`;
352
- }
353
- $('#findRes').addEventListener('click', (e) => {
354
- const b = e.target.closest('[data-fo]'); if (!b) return; e.stopPropagation();
355
- const k = b.dataset.fo, id = b.dataset.id; closeFind(false);
356
- if (k === 'goal') openGoalDetail(id);
357
- else if (k === 'dash') setView(id);
358
- else if (k === 'ask') { setTab('library'); openRequest(id); }
359
- else { setTab('library'); openReportRow(k, id); }
360
- });
336
+ const markHtml = (t) => esc(String(t || '')); // nothing to mark since the table no longer narrows to typed words
337
+ function insScope() {
338
+ return { name: 'Intelligence', hits: (q0) => {
339
+ if (!M) return [];
340
+ const q = String(q0 || '').trim().toLowerCase(), has = (...x) => x.some((v) => String(v || '').toLowerCase().includes(q));
341
+ const G = allGoals().filter((g) => has(g.title, g.pillar)).slice(0, 5).map((g) => ({ id: 'goal:' + g.id, icon: 'report', title: (krId(g) ? krId(g) + ' · ' : '') + g.title, sub: [PF ? g.prod : dashName(curDash()), g.nowTxt ? g.nowTxt + (g.targetTxt ? ' of ' + g.targetTxt : '') : 'no reading yet'].join(' · '), tag: 'Goal', open: () => openGoalDetail(g.id) }));
342
+ const R = reportGroups().filter((x) => has(x.x.name)).slice(0, 5).map((x) => ({ icon: 'report', title: x.x.name, sub: repState(x).pill[1], tag: 'Report', open: () => { setTab('library'); openReportRow(x.kind, x.x.id); } }))
343
+ .concat((M.reports.asks || []).filter((a) => has(a.text, a.proposal && a.proposal.name)).slice(0, 3).map((a) => ({ icon: 'report', title: a.proposal && a.proposal.name ? a.proposal.name : a.text, sub: ASKST[a.state][2], tag: 'Report', open: () => { setTab('library'); openRequest(a.id); } })));
344
+ const D = M.dashboards.filter((d) => has(dashName(d))).slice(0, 5).map((d) => ({ icon: 'report', title: dashName(d), sub: d.saved ? nGoals(d.charts.length) : d.id === 'all' ? 'Every goal and budget' : 'One objective', tag: 'Dashboard', open: () => setView(d.id) }));
345
+ return [{ label: 'In Intelligence · Goals', rows: G }, { label: 'In Intelligence · Reports', rows: R }, { label: 'In Intelligence · Dashboards', rows: D }];
346
+ } };
347
+ }
348
+ $('#findB').addEventListener('click', (e) => { e.stopPropagation(); closeMenus(); import('./cozy-search.js').then((S) => S.openSearch({ scope: insScope() })); });
361
349
 
362
- /* ⋯ (IsMenus): Sources with how long ago the page read them, Export as CSV and About these numbers, each in the Viewer card */
350
+ /* ⋯ (IsMenus; U3): Reports and dashboards and Export CSV. Metrics (the table is the metric list; + and the chat draft one), Delivery trends (the
351
+ * monthly metrics routine still opens it by ?view=trends), Sources (Settings › Connectors) and About these numbers (the guide page
352
+ * intelligence-okr-goals.md) left the menu. */
363
353
  $('#moreB').addEventListener('click', () => {
364
- const m = Math.round((Date.now() - loadedAt) / 60000); $('#srcAge').textContent = !loadedAt ? '' : m < 1 ? 'read just now' : 'read ' + m + ' min ago';
365
354
  if (!M) return;
366
355
  const R = M.reports || {}, nr = reportGroups().length, nd = savedDash().length, nf = (R.found || []).length + (R.asks || []).filter((a) => a.state === 'ready').length;
367
356
  $('#libSub').textContent = [nr ? nr + (nr === 1 ? ' report' : ' reports') : '', nd ? nd + (nd === 1 ? ' dashboard' : ' dashboards') : '', (R.found || []).length ? (R.found || []).length + ' found' : ''].filter(Boolean).join(' · ');
368
357
  $('#libNew').innerHTML = nf ? `<span class="cz-pill you">${nf} new</span>` : ''; // zero is silence
369
- const nm = PF ? 0 : OK.metricsOf(M, today()).length; $('#metN').textContent = nm || '';
370
358
  });
371
- /* ⋯ › Metrics (GsMetrics, GsMetricsTree): one list, goal metrics first, then the ones Claude watches with no goal (tagged "watch", no status).
372
- * One switch shows the same list as a tree: the North Star, its inputs and the guardrails. A press opens the metric's goal in the Viewer. */
373
- let metView = 'list';
374
- try { metView = localStorage.getItem('pmos.okr.metrics.view') === 'tree' ? 'tree' : 'list'; } catch { metView = 'list'; }
375
- function openMetrics() {
376
- if (!M || PF) return;
377
- viewer({ kind: 'Intelligence', title: 'Metrics', icon: 'chart', id: 'metrics', eye: 'Intelligence', render: (el) => {
378
- const draw = () => {
379
- const L = OK.metricsOf(M, today());
380
- el.innerHTML = `<div class="okr-mbar" role="group" aria-label="View"><button type="button" class="cz-ib sm${metView === 'list' ? ' on' : ''}" data-mv2="list" aria-pressed="${metView === 'list'}" aria-label="As a list" title="As a list">${OK.SV(OK.P.list)}</button><button type="button" class="cz-ib sm${metView === 'tree' ? ' on' : ''}" data-mv2="tree" aria-pressed="${metView === 'tree'}" aria-label="As a tree" title="As a tree">${OK.SV(OK.P.tree)}</button></div><div class="okr-met">${OK.metricsHtml(L, metView)}</div>`;
381
- };
382
- draw();
383
- el.addEventListener('click', (e) => {
384
- const v = e.target.closest('[data-mv2]'); if (v) { metView = v.dataset.mv2; try { localStorage.setItem('pmos.okr.metrics.view', metView); } catch { /* a private window forgets it */ } draw(); return; }
385
- const b = e.target.closest('[data-budget]'); if (b) { if (window.czViewer && window.czViewer.drill) window.czViewer.drill(); openBudget(b.dataset.budget); return; }
386
- const g = e.target.closest('[data-goal]'); if (g && goalById(g.dataset.goal)) { if (window.czViewer && window.czViewer.drill) window.czViewer.drill(); openGoalDetail(g.dataset.goal); }
387
- });
388
- } });
389
- }
390
359
  $('#moreMenu').addEventListener('click', (e) => {
391
360
  const b = e.target.closest('[data-more]'); if (!b || b.disabled) return; closeMenus();
392
361
  if (b.dataset.more === 'library') openLib();
393
- else if (b.dataset.more === 'trends') setView(TRENDS);
394
- else if (b.dataset.more === 'metrics') openMetrics();
395
- // Sources lives in Settings › Connectors (Fewer menus, brief 5; GsMore); with no Settings on the page, what this page reads in the Viewer
396
- else if (b.dataset.more === 'sources') import('./cozy-settings.js').then((S) => S.openSettings('connectors')).catch(() => viewer({ kind: 'Intelligence', title: 'Sources', icon: 'source', eye: 'What this page reads', render: (el) => { el.innerHTML = sourcesHtml(); } }));
397
362
  else if (b.dataset.more === 'export') location.assign('/api/insights-records/export?' + wsQ() + (M.board.id ? 'board=' + encodeURIComponent(M.board.id) : ''));
398
- else if (b.dataset.more === 'about') viewer({ kind: 'Intelligence', title: 'About these numbers', icon: 'info', eye: 'Intelligence', render: (el) => { el.innerHTML = ABOUT; } });
399
363
  });
400
- function sourcesHtml() {
401
- const miss = (M.header && M.header.missing) || [];
402
- const rows = [
403
- ['Goals', 'The KR metric records of this workspace and their readings (planning/records/kr-metrics.jsonl)', !miss.includes('outcomes')],
404
- ['What moves them', 'The board’s initiatives and their anchors', M.initiativesRead],
405
- ['Health budgets', 'The budget registry (planning/okrs/health-budgets.md) and the initiatives anchored to health:<id>', M.budgetsRead && M.initiativesRead],
406
- ['Charts and verdicts', 'Each chart’s form and range, the verdicts and the trend targets (the workspace’s insights-records.jsonl)', !((M.header && M.header.missing) || []).includes('insights records')],
407
- ['Delivery trends', 'The Board’s measures (corrections, merges, blocked and idle work)', !!BM],
408
- ['Library', 'The report files, the report setups and your requests', !M.reports.missing],
409
- ];
410
- return `<div class="ins-src">${rows.map(([a, b, ok]) => `<div><b>${esc(a)}</b><span>${esc(b)}</span><span class="cz-pill ${ok ? 'ok' : 'late'}">${ok ? 'Read' : 'Not read'}</span></div>`).join('')}</div>`
411
- + (miss.length ? `<p class="note">Not read on the last load: ${esc(miss.join(', '))}.</p>` : '');
412
- }
413
- const ABOUT = '<div class="ins-about"><p>Every goal is a KR metric record of this workspace, and every number on Goals is one of its readings, its target or its date. The bar under Now has a mark for how much of the goal’s time has gone.</p>'
414
- + '<p>“By its date” is a straight line through the last four readings, carried to the goal’s date. It is said, not drawn as a fact. A goal with fewer than two readings has no line and no pace.</p>'
415
- + '<p>What moves a goal is every initiative whose anchor names it. Its pill is read from its end date and owner: days over, ships soon, or no owner.</p>'
416
- + '<p>A press records only what it says: a goal in the KR metric records, or a dashboard in the workspace’s state folder. Nothing is sent from this page.</p></div>';
417
364
 
418
365
  /* ── the ✦ strip (Iq8Overview): one finding at a time, said plainly with its reason; the dots page through up to three and × moves on to the
419
366
  * next one. Ask why takes the finding to Home. A finding carries a drafted move only when the engine has one (feedback batch 16 item 1,
@@ -861,21 +808,22 @@ const TRACK_TONE = { late: 'late', 'at risk': 'risk', done: 'ok', 'on track': 'o
861
808
  /** The lifecycle track: six stages and two milestones; the current stage is the large dot in the initiative's status colour. A stage the Board
862
809
  * recorded as skipped (its "Skipped <stage>" warning) is a dashed ring. */
863
810
  function trackHtml(r) {
864
- const tone = TRACK_TONE[r.status] || 'q', labels = (M.lifecycle || []).map((x) => x.label.toLowerCase()), skip = new Set((r.skipped || []).map((x) => labels.indexOf(String(x).toLowerCase())).filter((i) => i >= 0));
865
- return `<span class="ins-trk" title="${esc(r.stageLabel || 'No stage')}" aria-label="${esc((r.stageLabel ? 'Stage ' + r.stageLabel : 'No lifecycle stage') + (r.status ? ', ' + r.status : ''))}" role="img">`
811
+ const tone = TRACK_TONE[provenStatus(r)] || 'q', labels = (M.lifecycle || []).map((x) => x.label.toLowerCase()), skip = new Set((r.skipped || []).map((x) => labels.indexOf(String(x).toLowerCase())).filter((i) => i >= 0));
812
+ return `<span class="ins-trk" title="${esc(r.stageLabel || 'No stage')}" aria-label="${esc((r.stageLabel ? 'Stage ' + r.stageLabel : 'No lifecycle stage') + (r.status ? ', ' + provenStatus(r) : ''))}" role="img">`
866
813
  + [0, 1, 2, 3, 4, 5, 6, 7].map((i) => `<i class="${[skip.has(i) && i !== r.idx ? 'k' : i < r.idx ? 'p' : '', i === r.idx ? 'c ' + tone : '', i === 5 || i === 7 ? 'm' : ''].filter(Boolean).join(' ')}"></i>`).join('') + '</span>';
867
814
  }
868
815
  /** The pill of an initiative that moves a goal: a delivery fact read from its end date and owner, else its status. */
869
816
  function movePill(r) {
870
- if (r.status === 'done') return ['ok', 'Done'];
871
- if (r.status === 'cancelled') return ['q', 'Stopped'];
817
+ const ps = provenStatus(r); // T3: a status word renders only with its source and read time (status-proof.js)
818
+ if (ps === 'done') return ['ok', 'Done'];
819
+ if (ps === 'cancelled') return ['q', 'Stopped'];
872
820
  const end = day(r.endAt), d = end === null ? null : Math.round((end - today()) / DAY);
873
821
  if (d !== null && d < 0 && r.idx < 6) return ['late', -d + (d === -1 ? ' day over' : ' days over')]; // Monitor and Evaluate have shipped
874
822
  if (!r.owner) return ['risk', 'No owner'];
875
823
  if (d === 0) return ['q', 'Ships today'];
876
824
  if (d === 1) return ['q', 'Ships tomorrow'];
877
825
  if (d !== null && d >= 0 && d <= 14) return ['q', 'Ships in ' + d + ' days'];
878
- return { late: ['late', 'Late'], 'at risk': ['risk', 'At risk'], 'on hold': ['q', 'On hold'], 'on track': ['q', 'On track'] }[r.status] || null;
826
+ return { late: ['late', 'Late'], 'at risk': ['risk', 'At risk'], 'on hold': ['q', 'On hold'], 'on track': ['q', 'On track'] }[ps] || null;
879
827
  }
880
828
  const initRow = (r, pill = true) => { const p = pill ? movePill(r) : null; return `<a class="ins-ini" href="${iniHref(r.id)}">${trackHtml(r)}<span class="n">${esc(r.title)}</span>${p ? `<span class="cz-pill ${p[0]}">${esc(p[1])}</span>` : ''}</a>`; };
881
829
  const TONE_BAR = { ok: 'var(--cz-dot-ok)', late: 'var(--cz-dot-late)', red: 'var(--cz-dot-red)', q: 'var(--cz-dot-q)', risk: 'var(--cz-dot-risk)' };
@@ -1036,12 +984,14 @@ function krRow(k) {
1036
984
  function okrTableHtml(head) {
1037
985
  const P = M.okrFile.period, shown = !P || !per || (P.from <= per.to && P.to >= per.from), filtered = !noFilter();
1038
986
  const readers = new Set(M.okrFile.readers || []);
1039
- const K = shown ? okrKrs().filter((k) => krHit(k) && (!filtered || (krGoal(k) && goalsShown().some((g) => g.id === k.goal)))) : [];
1040
- const other = goalsShown().filter((g) => !readers.has(g.id));
987
+ // U3 (UI grill item 4): a key result with no reading is not a row; it waits in the "Waiting on a source" list under the table (waitHtml)
988
+ const K = shown ? okrKrs().filter((k) => k.read && krGoal(k) && krHit(k) && (!filtered || goalsShown().some((g) => g.id === k.goal))) : [];
989
+ const other = goalsShown().filter((g) => !readers.has(g.id) && isRead(g));
1041
990
  const by = new Map(); for (const k of K) { if (!by.has(k.obj.id)) by.set(k.obj.id, []); by.get(k.obj.id).push(k); }
1042
991
  const groups = [...by.values()].map((L) => `<div class="ins-grp" role="row"><span role="cell"><b>${esc(L[0].obj.token)}</b> ${esc(L[0].obj.title)}</span></div>` + L.map(krRow).join('')).join('')
1043
992
  + (other.length ? `<div class="ins-grp" role="row"><span role="cell">Other goals</span> <span class="q">recorded here, not in the OKR file</span></div>` + other.map(goalRow).join('') : '');
1044
993
  const n = K.length + other.length;
994
+ if (!n && !find && !filtered) return ''; // nothing is read yet: the ✦ strip and the waiting list say it (zero is silence)
1045
995
  return head(n) + (n ? groups : `<div class="ins-empty">No key result matches${find ? ' “' + esc(find) + '”' : ''}${filtered ? ' this filter' : ''} in ${esc(per.label)}. <button type="button" class="lk" id="goalsAll">Show every goal</button></div>`);
1046
996
  }
1047
997
  /** A key result with no reader, in the Viewer: its words from the OKR file, what it needs, and the initiatives that move it. */
@@ -1056,33 +1006,73 @@ function openKr(key) {
1056
1006
  el.addEventListener('click', (e) => { if (e.target.closest('[data-krcon]')) import('./cozy-settings.js').then((S) => S.openSettings('connectors')).catch(() => toast('Open Settings › Connectors.')); });
1057
1007
  } });
1058
1008
  }
1009
+ /* ── Waiting on a source (U3, UI grill item 4): a key result or goal with no reading is not a table row. One row per source, the key results it
1010
+ * unblocks (each opens its Viewer card) and the one connect action. A key result that is a decision, or whose reader is connected but has not
1011
+ * read yet, waits too, with no connect action: there is nothing to connect. Hidden when nothing waits (zero is silence). ── */
1012
+ const isRead = (g) => (g.readings || 0) > 0;
1013
+ function waitGroups() {
1014
+ if (!M || PF || dash === TRENDS) return [];
1015
+ const by = new Map();
1016
+ const add = (key, label, sub, connect, item) => { if (!by.has(key)) by.set(key, { key, label, sub, connect, items: [] }); by.get(key).items.push(item); };
1017
+ const D = curDash();
1018
+ if (okrOn() && D.id === 'all') { // the same test as drawGoals: the OKR file is the list on All goals
1019
+ const P = M.okrFile.period, shown = !P || !per || (P.from <= per.to && P.to >= per.from);
1020
+ for (const k of shown ? okrKrs().filter(krHit) : []) {
1021
+ if (k.read) continue;
1022
+ const g = krGoal(k), item = { kr: k.key, tok: k.token, title: k.title };
1023
+ if (k.need) add('need:' + k.need, k.need, 'Connect it and I test a read before I keep it.', true, item);
1024
+ else if (k.decision) add('decision', 'A decision', 'Done when it is decided. No source reads it.', false, Object.assign(item, { due: k.due }));
1025
+ else if (g) add('first:' + srcOf(g), srcOf(g), 'Connected. The first reading is not taken yet.', false, item);
1026
+ else add('none', 'No source named', 'The OKR file names no source for these.', false, item);
1027
+ }
1028
+ const readers = new Set(M.okrFile.readers || []);
1029
+ for (const g of goalsShown()) if (!readers.has(g.id) && !isRead(g)) add('first:' + srcOf(g), srcOf(g), 'No reading yet.', false, { goal: g.id, title: g.title });
1030
+ } else {
1031
+ for (const g of goalsShown()) if (!isRead(g)) add('first:' + srcOf(g), srcOf(g), g.source && g.source !== 'typed' ? 'No reading yet.' : 'You type its readings in.', false, { goal: g.id, title: g.title });
1032
+ }
1033
+ // the sources to connect first, the most key results first; decisions and "no source named" last
1034
+ const rank = (x) => (x.connect ? 0 : x.key.startsWith('first:') ? 1 : 2);
1035
+ return [...by.values()].sort((a, b) => rank(a) - rank(b) || b.items.length - a.items.length);
1036
+ }
1037
+ function drawWait() {
1038
+ const el = $('#waitList'); if (!el) return;
1039
+ const W = waitGroups(), n = W.reduce((a, x) => a + x.items.length, 0);
1040
+ el.hidden = !n; if (!n) { el.innerHTML = ''; return; }
1041
+ const itemHtml = (it) => `<button type="button" class="ins-wkr" ${it.kr ? `data-kr="${esc(it.kr)}"` : `data-goal="${esc(it.goal)}"`}>${it.tok ? `<span class="ins-krt">${esc(it.tok)}</span>` : ''}${esc(it.title)}${it.due ? ` <span class="note">due ${esc(md(day(it.due)))}</span>` : ''}</button>`;
1042
+ el.innerHTML = `<div class="ins-wh"><h2 id="hWait">Waiting on a source</h2> <span class="q">${n === 1 ? '1 key result' : n + ' key results'}</span></div><div class="ins-wl" role="list">`
1043
+ + W.map((x) => `<div class="ins-wrow" role="listitem"><div class="ins-wsrc"><b>${esc(x.label)}</b><small>${esc(x.sub)}</small></div><div class="ins-wkrs">${x.items.map(itemHtml).join('')}</div>`
1044
+ + (x.connect ? `<button type="button" class="cz-ib sm solid" data-krcon aria-label="${esc('Connect ' + x.label + ' in Settings, Connectors')}" title="${esc('Connect ' + x.label)}">${SV(I.chk)}</button>` : '<span></span>') + '</div>').join('') + '</div>';
1045
+ }
1059
1046
  function drawGoals() {
1060
1047
  const G = goalsShown(), T = $('#goalTbl');
1061
1048
  document.body.classList.toggle('ins-trv', dash === TRENDS);
1062
- if (dash === TRENDS) { T.innerHTML = bmHtml(true); T.hidden = false; $('#goalCards').innerHTML = ''; return; }
1049
+ if (dash === TRENDS) { T.innerHTML = bmHtml(true); T.hidden = false; $('#goalCards').innerHTML = ''; drawWait(); return; }
1063
1050
  const head = `<div class="ins-tr ins-th ${COLS}" role="row"><div role="columnheader">Key results <span>${G.length} · ${esc(per ? per.label : '')}</span></div><div role="columnheader">Now, of target <span class="ins-lg"><span><i class="ins-tdk"></i>today</span></span></div><div role="columnheader">So far</div><div role="columnheader">By its date</div><div role="columnheader" class="ins-mvh">Moved by <span class="ins-lg"><span><i class="ins-trk"><i class="k"></i></i>Skipped</span><span><i class="ins-trk"><i class="p m"></i></i>Milestone</span></span></div></div>`;
1064
1051
  const D = curDash();
1065
1052
  if (okrOn() && D.id === 'all') {
1066
1053
  T.hidden = false;
1067
1054
  const head2 = (n) => head.replace(/Key results <span>[^<]*<\/span>/, `Key results <span>${n} · ${esc(per ? per.label : '')}</span>`);
1068
1055
  T.innerHTML = okrTableHtml(head2) + budgetsHtml(D);
1069
- drawCards(G, true); IP2.drawn(); return;
1056
+ T.hidden = !T.innerHTML; drawCards(G, true); drawWait(); IP2.drawn(); return;
1070
1057
  }
1071
1058
  if (!M.goals.filter(isKr).length) {
1072
1059
  // the drafts table above says what is drafted: no empty card under it (zero is silence)
1073
1060
  const B = budgetsHtml(D);
1074
1061
  T.innerHTML = PF || !tableRows().length ? '<div class="ins-empty"><b>No key result is recorded for this workspace.</b> A key result is a metric with a target and a date. Press + to add one.</div>' + B : B;
1075
- T.hidden = !T.innerHTML; drawCards([]); IP2.drawn(); return;
1062
+ T.hidden = !T.innerHTML; drawCards([]); drawWait(); IP2.drawn(); return;
1076
1063
  }
1064
+ drawWait();
1065
+ const R = PF ? G : G.filter(isRead); // Portfolio has no waiting list (one product at a time), so it keeps every goal
1066
+ if (!R.length && !find && noFilter() && !PF) { const B = budgetsHtml(D); T.innerHTML = B; T.hidden = !B; drawCards([]); IP2.drawn(); return; } // nothing read yet: the waiting list says what each goal needs
1077
1067
  T.hidden = false;
1078
1068
  /* by objective; Portfolio groups by product, each product's objectives said in its rows */
1079
1069
  const keyOf = (g) => (PF ? g.prod : g.pillar || '');
1080
- const by = new Map(); for (const g of G) { const k = keyOf(g); if (!by.has(k)) by.set(k, []); by.get(k).push(g); }
1070
+ const by = new Map(); for (const g of R) { const k = keyOf(g); if (!by.has(k)) by.set(k, []); by.get(k).push(g); }
1081
1071
  const objs = [...new Set(M.goals.filter(isKr).map((g) => g.pillar || ''))];
1082
1072
  const head1 = (k) => (PF ? esc(k || 'A product') : k ? 'Objective ' + (objs.indexOf(k) + 1) + ' · ' + esc(k) : 'No objective');
1083
1073
  const groups = [...by.entries()].map(([k, L]) => `<div class="ins-grp" role="row"><span role="cell">${head1(k)}</span> <span class="q">${esc(per ? per.label : '')}</span>${GRP_PILL(L)}</div>` + L.map(goalRow).join('')).join('');
1084
- T.innerHTML = allProductsHtml() + head + (G.length ? groups : `<div class="ins-empty">No goal matches${find ? ' “' + esc(find) + '”' : ''}${noFilter() ? '' : ' this filter'} in ${esc(per.label)}. <button type="button" class="lk" id="goalsAll">Show every goal</button></div>`) + budgetsHtml(D);
1085
- drawCards(G);
1074
+ T.innerHTML = allProductsHtml() + head + (R.length ? groups : `<div class="ins-empty">No goal matches${find ? ' “' + esc(find) + '”' : ''}${noFilter() ? '' : ' this filter'} in ${esc(per.label)}. <button type="button" class="lk" id="goalsAll">Show every goal</button></div>`) + budgetsHtml(D);
1075
+ drawCards(R);
1086
1076
  IP2.drawn();
1087
1077
  }
1088
1078
  function budgetsHtml(D) {
@@ -1101,16 +1091,10 @@ function cardPill(g) {
1101
1091
  if (t === 'ok') return g.done !== null && g.timeGone != null && g.done > g.timeGone ? ['ok', 'Ahead'] : ['ok', 'On track'];
1102
1092
  return null;
1103
1093
  }
1104
- /** A key result with no reader, as a phone card: its id and name, what it needs (or Not yet for a decision), its first mover. */
1105
- const krCard = (k) => `<div class="ins-card" role="listitem" data-kr="${esc(k.key)}" tabindex="0" aria-label="${esc(k.token + ' ' + k.title)}"><div class="ins-ch"><b><span class="ins-krt">${esc(k.token)}</span>${esc(k.title)}</b></div>`
1106
- + `<div class="ins-cs"><span class="note">${esc(k.decision && !k.need ? 'Not yet' + (k.due ? ' · due ' + md(day(k.due)) : '') : k.need ? 'needs ' + k.need : 'needs a source')}</span></div>`
1107
- + (k.moves[0] ? `<div class="ins-c1">${initRow(k.moves[0], false)}</div>` : '') + '</div>';
1108
1094
  function drawCards(G, okr = false) {
1109
- if (okr) { // the phone (IgA7Phone): a card per key result that is read or due as a decision; the ones that wait on a source fold under one line
1110
- const K = okrKrs().filter(krHit), shown = K.filter((k) => krGoal(k) || (k.decision && !k.need)), wait = K.filter((k) => !shown.includes(k));
1111
- const nw = wait.filter((k) => k.need).length;
1112
- $('#goalCards').innerHTML = shown.map((k) => (krGoal(k) ? cardOf(Object.assign({}, krGoal(k), { krTok: k.token })) : krCard(k))).join('')
1113
- + (wait.length ? `<details class="ins-cfold"><summary><b>${wait.length === 1 ? '1 more key result' : wait.length + ' more key results'}</b> <span class="note">${nw ? nw + ' wait on a source' : ''}</span></summary>${wait.map(krCard).join('')}</details>` : '');
1095
+ if (okr) { // the phone (IgA7Phone; U3): a card per key result that has a reading; the rest are in the waiting list, as on a computer
1096
+ const shown = okrKrs().filter((k) => k.read && krGoal(k) && krHit(k));
1097
+ $('#goalCards').innerHTML = shown.map((k) => cardOf(Object.assign({}, krGoal(k), { krTok: k.token }))).join('');
1114
1098
  return;
1115
1099
  }
1116
1100
  $('#goalCards').innerHTML = (PF ? allProductsHtml() : '') + G.map(cardOf).join('') || (M.goals.filter(isKr).length ? '<p class="note">No goal in this period.</p>' : '');
@@ -1124,9 +1108,14 @@ function cardOf(g) {
1124
1108
  + (g.moves[0] ? `<div class="ins-c1">${initRow(g.moves[0], false)}</div>` : '') + '</div>' + (PF ? '' : draftsFor(g.id).map(drHtml).join(''));
1125
1109
  }
1126
1110
  IP2.mount({ page: $('#stage'), table: $('#goalTbl'), selecting: () => selecting });
1111
+ $('#waitList').addEventListener('click', (e) => {
1112
+ if (e.target.closest('[data-krcon]')) { import('./cozy-settings.js').then((S) => S.openSettings('connectors')).catch(() => toast('Open Settings › Connectors.')); return; }
1113
+ const q = e.target.closest('[data-kr]'); if (q) { openKr(q.dataset.kr); return; }
1114
+ const g = e.target.closest('[data-goal]'); if (g) openGoalDetail(g.dataset.goal);
1115
+ });
1127
1116
  $('#goalCards').addEventListener('click', (e) => { if (e.target.closest('a, .okr-dr, summary')) return; const pp = e.target.closest('[data-prod]'); if (pp) { location.assign(setQ({ ws: pp.dataset.prod, board: null, goal: null })); return; } const q = e.target.closest('[data-kr]'); if (q) { openKr(q.dataset.kr); return; } const c = e.target.closest('[data-goal]'); if (c) pressGoal(c.dataset.goal); });
1128
1117
  $('#goalTbl').addEventListener('click', (e) => {
1129
- if (e.target.closest('#goalsAll')) { find = ''; $('#findIn').value = ''; clearFilter(); per = periods().find((p) => p.key === 'y'); redraw(); return; }
1118
+ if (e.target.closest('#goalsAll')) { clearFilter(); per = periods().find((p) => p.key === 'y'); redraw(); return; }
1130
1119
  if (e.target.closest('a')) return;
1131
1120
  const tile = e.target.closest('[data-tile], [data-mt]'); if (tile) { if (tgOpen) closeTarget(); openTile(tile.dataset.tile || tile.dataset.mt); return; }
1132
1121
  if (e.target.closest('.okr-dr')) return; // a draft under a row has its own presses
@@ -2069,7 +2058,6 @@ function drawList() {
2069
2058
  const reps = reportGroups().filter((g) => hit(g.x.name)), dashes = M.dashboards.filter((d) => hit(dashName(d)));
2070
2059
  const nRep = reps.length + asks.length;
2071
2060
  $('#repCap').textContent = String(nRep + dashes.length);
2072
- $('#newRep').href = homeAsk('insights', 'Make a new report: '); // with no product picked, Home still makes it; with one, + opens the drafted report (below)
2073
2061
  const fbox = found.length ? `<div class="ins-fd" aria-label="Found in your work"><div class="ins-fdh"><b>Found in your work · ${found.length}</b><span class="note">Things you write by hand often</span></div>`
2074
2062
  + found.map((f) => `<div class="ins-fcard" data-f="${esc(f.id)}"><button type="button" class="nm" data-fx="open" aria-label="${esc(f.name)}: what PMOS found"><b>${esc(f.name)}</b><small>${esc(f.why)}</small></button><button type="button" class="ins-btn sm dark" data-fx="setup">Set it up</button><button type="button" class="ins-btn sm ghost" data-fx="dismiss">Not a report</button></div>`).join('') + '</div>' : '';
2075
2063
  const empty = R.missing ? '<div class="ins-empty"><b>The report files could not be read</b>, so none is listed.</div>'
@@ -2082,7 +2070,8 @@ function drawList() {
2082
2070
  const rest = reps.filter((G) => !waits.includes(G)), restAsks = asks.filter((a) => !waitAsks.includes(a));
2083
2071
  const head3 = '<div class="ins-rl ins-rlh" role="presentation"><span>Report</span><span>Next</span><span>Status</span></div>';
2084
2072
  const nNeed = waits.length + waitAsks.length;
2085
- const needs = nNeed ? `<div class="ins-sec"><h3>Needs you</h3><span class="q">${nNeed}</span></div><div class="ins-nlist" id="repNeeds" role="list">${waits.map(needRowHtml).join('')}${waitAsks.map(askNeedHtml).join('')}</div>` : '';
2073
+ // U3: no "Needs you N" heading; the rows and their ✓ are the signal, and the count belongs to Your move on Home (zero is silence)
2074
+ const needs = nNeed ? `<div class="ins-nlist" id="repNeeds" role="list" aria-label="Waiting for you">${waits.map(needRowHtml).join('')}${waitAsks.map(askNeedHtml).join('')}</div>` : '';
2086
2075
  const table = rest.length + restAsks.length ? `<div class="ins-sec"><h3>Yours</h3><span class="q">${rest.length + restAsks.length}</span></div><div class="ins-rtbl" id="repAsks">${head3}<div role="list">${rest.map(repRowHtml).join('')}${restAsks.map(askRowHtml).join('')}</div></div>`
2087
2076
  : !empty && !needs ? (quietLine('reports') ? `<div class="ins-empty"><b>${esc(quietLine('reports'))}</b></div>` : '<div class="ins-empty"><b>No report is set up and no report file is on record.</b> Reports are made in Home.</div>') : '';
2088
2077
  const dd = savedDash().length ? null : draftedDash();
@@ -2169,13 +2158,7 @@ async function draftedPress(b) {
2169
2158
  /* the ready-made group before Yours (batch 17 item 1, PbA6): read once per open of the panel, again after a switch */
2170
2159
  const LIB = { L: null, read: false, open: new Set(), fold: {} };
2171
2160
  const drawLib = () => { const el = $('#readyLib'); if (el) { el.outerHTML = libFolds(LIB.L) || '<div id="readyLib"></div>'; wireFolds(); } };
2172
- /* + in the panel header (RgR4Make): the drafted report of this view, never a blank chat. With all products on screen there is no one product to
2173
- * draft for, so it keeps its link to Home. */
2174
- $('#newRep').addEventListener('click', (e) => {
2175
- if (PF || !M || !M.board || !M.board.ws) return;
2176
- e.preventDefault();
2177
- const D = curDash(); RI.openDraft(D && D.saved ? 'dashboard:' + D.id : 'view');
2178
- });
2161
+ /* U3: the report icon in the bar ("Make a report from this", pm/premium-report-intel.js) is the one report starter; the panel has no + */
2179
2162
  RL.wireLib($('#repBody'), { get ws() { return M && M.board ? M.board.ws : ''; }, open: LIB.open, toast: (t) => toast(t), redraw: drawLib,
2180
2163
  reload: async () => { LIB.L = await RL.readLib(M.board.ws); drawLib(); } });
2181
2164
  $('#repBody').addEventListener('click', async (e) => {
@@ -58,9 +58,10 @@ function drawMenu(step) {
58
58
  return;
59
59
  }
60
60
  if (step === 'one') {
61
- const G = (M.goals || []).filter((g) => !g.program && !g.initiative), O = (M.outcomes || []).filter((o) => o.verdict || o.group === 'verdict');
61
+ const G = (M.goals || []).filter((g) => !g.program && !g.initiative && (g.readings || 0) > 0), O = (M.outcomes || []).filter((o) => o.verdict || o.group === 'verdict');
62
62
  m.innerHTML = `<button type="button" role="menuitem" data-rs="back" class="ins-rpback">${SVG('M15 6l-6 6 6 6')}<span>One key result or outcome</span></button>`
63
- + G.slice(0, 12).map((g) => row('goal:' + g.id, I.rep, g.title, g.nowTxt ? g.nowTxt + (g.targetTxt ? ' of ' + g.targetTxt : '') : 'no reading yet')).join('')
63
+ + G.slice(0, 12).map((g) => row('goal:' + g.id, I.rep, g.title, g.nowTxt ? g.nowTxt + (g.targetTxt ? ' of ' + g.targetTxt : '') : '')).join('')
64
+ + (G.length || O.length ? '' : '<p class="ins-mh">No key result has a reading yet</p>')
64
65
  + O.slice(0, 6).map((o) => row('outcome:' + o.id, I.rep, o.title, 'Did it work?')).join('');
65
66
  return;
66
67
  }
@@ -18,9 +18,10 @@ export const RO = !!PACK;
18
18
  /** What a reader can do. Each is a selector; a press inside a match is let through. */
19
19
  export const VIEW_CONTROLS = [
20
20
  // the Timeline: the span, the legend behind (i), a column's sort, back to today, the Deliveries lane, the folds, an initiative's name (opens its viewer)
21
- '#bdSpans button', '#bdLgdBtn', '.tg-chd', '.tg-tback', '.dl-fb', '.dl-dn', '.dl-e[aria-label*="press to open"]', '.bd-fold', '.bd-prdb', 'label.tg-n', 'button.tg-n.ini2',
21
+ '#bdLgdBtn', '.tg-chd', '.tg-tback', '.dl-fb', '.dl-dn', '.dl-e[aria-label*="press to open"]', '.bd-fold', '.bd-prdb', 'label.tg-n', 'button.tg-n.ini2',
22
22
  // the stage track: the switch between it and the Timeline (the two views a publisher shares), an initiative's name, the Monitor and Evaluate fold
23
- '#ibTabs [data-v="track"]', '#ibTabs [data-v="time"]', 'button.bt-nm', '#fold',
23
+ // (UI grill U2: they live in the View chip with the span, and the menu draws only these two for a reader)
24
+ '#bdView', '#bdViewMenu [data-pv="track"]', '#bdViewMenu [data-pv="time"]', '#bdViewMenu [data-spick]', 'button.bt-nm', '#fold',
24
25
  // the viewer: the layout, the close, the folds, the Tasks view menu, a stage's fold and its done tasks
25
26
  '.cz-vw-ib[aria-label="Arrange"]', '.cz-vw-ib[aria-label="Close the viewer"]', '.cz-pn-menu', '[class*="cz-dv"]',
26
27
  '.iv-mctg', '.iv-gx-t', '.iv-ws', '.iv-grp', '.iv-ab-h', '.iv-fr', '.ivx-vb', '.tkc-pop [data-ivs-view]', '.tkc-pop [data-ivs-by]', '.tkc-pop [data-ivs-zoom]',
@@ -32,7 +33,7 @@ export const VIEW_CONTROLS = [
32
33
  ].join(',');
33
34
 
34
35
  /** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
35
- const HIDE = ['#ibTabs [data-v="stages"]', '#ibTabs [data-v="list"]', '#bdView', '#bdSpanPick', '.bd-title', '.bd-vr', '.bd-tabs', '#crumbHost', '#bdFind', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#bdPublish', '#chShared', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
36
+ const HIDE = ['#crumbHost', '#bdFind', '#bdFilter', '#bdPublish', '#newIni', '.tools-top', '#czFab'];
36
37
  /** Controls the code draws that write, or lead to something a share does not hold: removed. */
37
38
  const REMOVE = [
38
39
  '.po-grip', '.bd-nxa',
@@ -32,7 +32,8 @@ export function stageSource(r) {
32
32
  const o = r && r.oneStage;
33
33
  if (!o || !o.source) return '';
34
34
  const at = o.readAt ? readWords(o.readAt) : '';
35
- return o.source + (at ? (o.setBy === 'jira' ? ' · read ' : ' · ') + at : '');
35
+ // the server's 'spec files' in plain words (UI grill U1): the gate chips under it say which documents
36
+ return (o.source === 'spec files' ? 'From its documents' : o.source) + (at ? (o.setBy === 'jira' ? ' · read ' : ' · ') + at : '');
36
37
  }
37
38
  const TONE = { shipped: 'ok', 'on-hold': 'q', cancelled: 'q' };
38
39
  export function stageChip(r, opts = {}) {
@@ -0,0 +1,43 @@
1
+ /* status-proof.js — THE status provenance rule (OS evaluation T3, 8 Nov: "no status word, number or tile renders unless it carries a source
2
+ * and a read time; with none it says No signal"). Three grills found the same class of bug, a confident status from data nobody read; this
3
+ * turns their page fixes (W1, W2, Intelligence design A) into one invariant. lib/status-signal.js decides a status and stamps where it came
4
+ * from; this module is the gate every render goes through. lib/status-proof.js is its server twin (status-proof.test.js holds them equal).
5
+ *
6
+ * proven(sig, now) → true when sig = { source, readAt } names a source and a parseable read time that is not in the future
7
+ * provenStatus(r, now) → r.status when it is a claim ('on track', 'at risk', 'late', 'done', 'on hold', 'cancelled') AND r.signal is
8
+ * proven; else 'no signal'
9
+ * provenValue(v, sig, now) → v when sig is proven, else null (a number or a tile: the caller then says "No signal")
10
+ * fromLine(sig) → 'From Jira · read 3 Nov' for a title or a tooltip; '' when not proven
11
+ * NO_SIGNAL · CLAIMS
12
+ * Pure: no I/O, no clock beyond `now`.
13
+ */
14
+ export const NO_SIGNAL = 'no signal';
15
+ export const CLAIMS = Object.freeze(['on track', 'at risk', 'late', 'done', 'on hold', 'cancelled']);
16
+ const SKEW = 5 * 60e3; // a read stamped up to five minutes ahead (another machine's clock) still counts
17
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
18
+ /** A read time as ms: an ISO string or epoch ms; NaN for anything else. */
19
+ const atOf = (v) => (typeof v === 'number' ? v : typeof v === 'string' && v ? Date.parse(v) : NaN);
20
+
21
+ export function proven(sig, now) {
22
+ if (!sig || typeof sig !== 'object') return false;
23
+ const src = typeof sig.source === 'string' ? sig.source.trim() : '';
24
+ if (!src) return false;
25
+ const at = atOf(sig.readAt);
26
+ const t = typeof now === 'number' ? now : Date.now();
27
+ return Number.isFinite(at) && at <= t + SKEW;
28
+ }
29
+
30
+ export function provenStatus(r, now) {
31
+ const s = String((r && r.status) || '').toLowerCase();
32
+ if (!CLAIMS.includes(s)) return NO_SIGNAL;
33
+ return proven(r.signal, now) ? s : NO_SIGNAL;
34
+ }
35
+
36
+ export function provenValue(v, sig, now) { return proven(sig, now) ? v : null; }
37
+
38
+ export function fromLine(sig, now) {
39
+ if (!proven(sig, now)) return '';
40
+ const d = new Date(atOf(sig.readAt));
41
+ return 'From ' + String(sig.source).trim() + ' · read ' + d.getUTCDate() + ' ' + MON[d.getUTCMonth()];
42
+ }
43
+