create-pmos 0.660.0 → 0.662.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.
@@ -45,6 +45,7 @@ import * as RI from './premium-report-intel.js'; // a report made from Intelli
45
45
  import * as TRV from './trends-review.js'; // Delivery trends' words (batch 22 item 4): the month line, Up N vs last week, What moved it
46
46
  import * as OK from './okr-list.js'; // Claude runs the OKRs (batch 16 item 6, 6-B): the goal list, its drafts, the ✦ line, ⋯ › Metrics, the notify choice
47
47
  import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (panels on Board and Intelligence, P-B): the narrow form, Moved by, the open row
48
+ import * as KO from './komorebi.js'; // the design system's Chart behaviour: hover tip, keys, press a point (North Star, intelligence-ds-page)
48
49
  import * as GC from './goals-clear.js';
49
50
  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
51
  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
@@ -197,6 +198,7 @@ const dashName = (D) => (D.id === 'all' ? 'All goals' : D.name);
197
198
  const nGoals = (k) => k + (k === 1 ? ' goal' : ' goals');
198
199
  function drawBar() {
199
200
  drawPick();
201
+ $('#goalsLink').href = '/premium-goals.html' + (DEEP && M.board.ws ? '?ws=' + encodeURIComponent(M.board.ws) : ''); // the path goes back to Goals, on the product on screen
200
202
  const D = curDash();
201
203
  $('#viewName').textContent = dash === TRENDS ? 'Delivery trends' : dashName(D);
202
204
  /* View (Iq8Overview): every view, the default one marked; Delivery trends; then Pin, New dashboard and Edit chart */
@@ -233,6 +235,7 @@ const setQ = (o) => { const q = new URLSearchParams(location.search); for (const
233
235
  function setTab(t) {
234
236
  if (t === 'library') openLib();
235
237
  else if (t === 'outcomes') { const o = $('#pOutcomes'); if (o && !o.hidden) o.scrollIntoView({ block: 'start' }); }
238
+ else if (t === 'goals') { krShow = true; drawGoals(); return; } // an old Goals tab link shows the key results here, and keeps its tab, so a reload does too
236
239
  if (new URLSearchParams(location.search).has('tab')) addr({ tab: null });
237
240
  }
238
241
  /** The address follows the goal open in the Viewer, so Back from another page comes back to it (batch 14 item 7). It goes
@@ -371,6 +374,7 @@ $('#moreB').addEventListener('click', () => {
371
374
  $('#moreMenu').addEventListener('click', (e) => {
372
375
  const b = e.target.closest('[data-more]'); if (!b || b.disabled) return; closeMenus();
373
376
  if (b.dataset.more === 'library') openLib();
377
+ else if (b.dataset.more === 'krs') { krShow = !krShow; addr({ tab: krShow ? 'goals' : null }); drawGoals(); if (krShow) $('#pGoals').scrollIntoView({ block: 'start' }); }
374
378
  else if (b.dataset.more === 'export') location.assign('/api/insights-records/export?' + wsQ() + (M.board.id ? 'board=' + encodeURIComponent(M.board.id) : ''));
375
379
  });
376
380
 
@@ -439,43 +443,64 @@ function stripList() {
439
443
  // a calm finding ("Nothing stands out") says what the ✦ line already says: it is left out
440
444
  return ok.concat(finds.filter((f) => !(ok.length && f.calm)), more, PF ? [] : RI.stripItems(), mine); // the outcome check due and the late work follow the readings' own findings
441
445
  }
446
+ /* What PMOS found (board IntelligenceDS): the finding in one paragraph, "n of N" with ‹ › to page through the open ones, and a drafted move as the
447
+ * expanded Suggestion (pm-sug x): Why (the finding's evidence), PMOS will (the move; a note to someone is shown in full first, since it goes outside
448
+ * once you send it), What changes, Based on. Its answers are Change it first (a chat about the move), Yes (✓ makes it, Done + Undo after) and No
449
+ * (Not now). Without a move the answers the line already had stay under the paragraph: ✓✓ keep every draft, ✦ draft them, the forecast findings,
450
+ * a report's presses, the source of Your impact. Adler keeps his place in the line's icon slot (batch 16 item 2), never in a chart. */
451
+ function sugRows(f, mv) {
452
+ const g = (M.goals || []).find((x) => x.key && x.key === f.chart) || (mv.goal && (M.goals || []).find((x) => x.id === mv.goal)) || null;
453
+ const will = [esc(mv.text)].concat(mv.kind === 'chase' && mv.body ? ['Drafts this ' + (mv.epic ? 'Jira comment' : 'note') + ', shown here before anything goes: “' + esc(mv.body) + '”', 'Puts it in the outbox; nothing is sent until you send it'] : []);
454
+ const based = g ? [g.title + ' readings', srcOf(g) === 'Recorded' ? '' : srcOf(g), freshOf(g)].filter(Boolean).join(', ') : 'The goal’s readings and the work that moves it';
455
+ return `<dl>${f.why ? `<dt>Why</dt><dd>${esc(f.why)}</dd>` : ''}<dt>PMOS will</dt><dd><ul>${will.map((w) => `<li>${w}</li>`).join('')}</ul></dd>`
456
+ + (mv.said ? `<dt>What changes</dt><dd>${esc(mv.said)}</dd>` : '') + `<dt>Based on</dt><dd class="src">${esc(based)}</dd></dl>`;
457
+ }
442
458
  function drawStrip() {
443
459
  const G = goalsShown(), behind = G.filter((g) => g.tone === 'late' || g.tone === 'red').length;
444
- $('#insEye').textContent = ''; $('#insAct').innerHTML = ''; $('#insPg').innerHTML = ''; $('#insMv').hidden = true; $('#insMv').innerHTML = ''; $('#insHero').classList.remove('mv', 'crit');
460
+ const hero = $('#insHero'), act = $('#insAct'), mvBox = $('#insMv');
461
+ if (act.parentNode !== hero) hero.appendChild(act);
462
+ $('#insEye').textContent = ''; act.innerHTML = ''; act.className = 'ins-hact'; $('#insPg').innerHTML = ''; mvBox.hidden = true; mvBox.innerHTML = ''; hero.classList.remove('mv', 'crit');
445
463
  if (PF) { $('#brief').textContent = PF.rows && PF.rows.length > 1 ? allProductsLine() : 'Portfolio: ' + nGoals(G.length) + ' across ' + PF.products.length + (PF.products.length === 1 ? ' product' : ' products') + (behind ? ', ' + behind + ' behind.' : '.'); $('#insWhy').textContent = 'The finding under it is read one product at a time.'; $('#askWhy').href = homeAsk('insights', 'Which product needs me most this quarter?'); $('#askWhy').hidden = false; return; }
446
464
  const L = stripList(), open = L.map((f, i) => i).filter((i) => !insSkip.has(i));
447
465
  if (!open.includes(insIdx)) insIdx = open.length ? open[0] : 0;
448
466
  const f = L[insIdx];
467
+ const mv = !f.report && f.move ? f.move : null;
449
468
  $('#brief').textContent = f.text;
450
- $('#insWhy').textContent = f.why || '';
451
- // Claude's line carries Adler's face in the line's mood: honest when a goal is behind or the finding says so plainly, needs you on a
452
- // proposal or drafts, handled otherwise. A broken limit is the one time the line turns red: it carries the alert, not a face (GsM4Break).
453
- // The rows and charts below stay pure data.
469
+ $('#insWhy').textContent = mv ? '' : f.why || ''; // with a move, the reason is the Suggestion's Why
470
+ // the icon slot carries Adler's face in the line's mood: honest when a goal is behind or the finding says so plainly, needs you on a proposal
471
+ // or drafts, handled otherwise. A broken limit is the one time the line turns red: it carries the alert, not a face (GsM4Break).
454
472
  const crit = f.okr && f.tone === 'crit';
455
- $('#insHero').classList.toggle('crit', crit);
456
- const sp = $('#insHero .sp');
473
+ hero.classList.toggle('crit', crit);
474
+ const sp = $('#insHero .ins-ad');
457
475
  if (sp && crit) { sp.classList.remove('ad'); sp.innerHTML = OK.SV(OK.P.alert, 20); }
458
- else if (sp) { sp.classList.add('ad'); sp.innerHTML = AD.adler(f.report || (f.okr && f.tone === 'drafts') ? 'needs-you' : (f.okr ? f.tone === 'behind' : behind) || /^Straight answer/.test(f.text) || AD.moodOfText(f.text) === 'honest' ? 'honest' : 'handled', 40, { label: false }); }
476
+ else if (sp) { sp.classList.add('ad'); sp.innerHTML = AD.adler(f.report || (f.okr && f.tone === 'drafts') ? 'needs-you' : (f.okr ? f.tone === 'behind' : behind) || /^Straight answer/.test(f.text) || AD.moodOfText(f.text) === 'honest' ? 'honest' : 'handled', 28, { label: false }); }
459
477
  // Ask why opens a chat titled from the goal the line is about, else the product's goals, never "ins:insights" (workspace grill W4)
460
478
  const goalOf = goalsShown().find((g) => g.title && (f.text || '').includes(g.title));
461
479
  $('#askWhy').href = homeAsk('insights', 'Why? ' + f.text, goalOf ? goalOf.title : ((M.board && M.board.name) || 'Product') + ' goals');
462
- $('#askWhy').hidden = !!(f.report || f.impact); $('#askWhy').style.display = f.report || f.impact ? 'none' : ''; // a report Claude proposes carries its own presses: See the draft, Not now, ✓ Set it up
463
- if (f.report) $('#insAct').innerHTML = RI.stripActs(f.report);
464
- const mv = !f.report && f.move ? f.move : null;
465
- $('#insHero').classList.toggle('mv', !!mv);
466
- if (mv) { $('#insMv').innerHTML = `${SV(I.spark)}<span>${esc(mv.text)}</span>`; $('#insMv').hidden = false; $('#insMv').classList.toggle('dn', !!mv.done); }
467
- const mvAct = !mv ? '' : mv.done ? `<span class="pm-badge ok">Done</span><button type="button" class="pm-btn" data-mv="undo" aria-label="Undo: ${esc(mv.label)}" title="Undo">${SV(I.undo)}</button>`
468
- : `<button type="button" class="pm-btn primary" data-mv="apply" aria-label="${esc(mv.label)}" title="${esc(mv.label)}">${SV(I.chk)}</button>`;
469
- // the ✦ line's own press: ✓✓ keeps every draft (GsM1, GsM5); with nothing to read, ✦ asks Claude to draft the goals
470
- const okAct = !f.okr ? '' : f.keepAll ? `<button type="button" class="pm-btn primary" data-okl="keep-all" aria-label="Keep all ${f.keepAll}" title="Keep all ${f.keepAll}">${OK.SV(OK.P.checks)}</button>`
471
- : f.start && M.board.ws ? `<button type="button" class="pm-btn primary" data-okl="start" aria-label="${f.retry ? 'Try drafting again' : 'Draft them'}" title="${f.retry ? 'Try again' : 'Draft them'}">${SV(I.spark)}</button>` : '';
472
- const fcAct = f.fcGrill ? `<button type="button" class="pm-btn primary" data-fcg aria-label="${esc('Open the ' + f.fcGrill.n + (f.fcGrill.n === 1 ? ' finding' : ' findings') + ' on ' + f.fcGrill.title)}" title="Open the findings">${SV(I.spark)}</button>` : '';
473
- if (!f.report) $('#insAct').innerHTML = mvAct + okAct + fcAct;
480
+ $('#askWhy').hidden = !!(f.report || f.impact); $('#askWhy').style.display = f.report || f.impact ? 'none' : ''; // a report PMOS proposes carries its own presses: See the draft, Not now, ✓ Set it up
481
+ if (f.report) act.innerHTML = RI.stripActs(f.report);
482
+ hero.classList.toggle('mv', !!mv);
483
+ const no = open.length > 1 ? `<button type="button" class="pm-btn${mv ? ' outline' : ''}" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` : '';
484
+ if (mv) {
485
+ mvBox.innerHTML = `<div class="ttl">${SV(I.spark)}<span>${esc(mv.label || mv.text)}</span></div>${sugRows(f, mv)}`;
486
+ mvBox.hidden = false; mvBox.classList.toggle('dn', !!mv.done);
487
+ act.className = 'ins-hact ans'; mvBox.appendChild(act);
488
+ act.innerHTML = mv.done ? `<span class="pm-badge ok">Done</span><button type="button" class="pm-btn" data-mv="undo" aria-label="Undo: ${esc(mv.label)}" title="Undo">${SV(I.undo)}</button>`
489
+ : `<a class="pm-btn" href="${esc(homeAsk('insights', 'Change this before you do it: ' + mv.text, goalOf ? goalOf.title : ''))}" aria-label="Change it first" title="Change it first">${SV(I.pen)}</a>`
490
+ + `<button type="button" class="pm-btn primary" data-mv="apply" aria-label="${esc(mv.label)}" title="${esc(mv.label)}">${SV(I.chk)}</button>${no}`;
491
+ } else if (!f.report) {
492
+ // the line's own press: ✓✓ keeps every draft (GsM1, GsM5); with nothing to read, ✦ asks PMOS to draft the goals
493
+ const okAct = !f.okr ? '' : f.keepAll ? `<button type="button" class="pm-btn primary" data-okl="keep-all" aria-label="Keep all ${f.keepAll}" title="Keep all ${f.keepAll}">${OK.SV(OK.P.checks)}</button>`
494
+ : f.start && M.board.ws ? `<button type="button" class="pm-btn primary" data-okl="start" aria-label="${f.retry ? 'Try drafting again' : 'Draft them'}" title="${f.retry ? 'Try again' : 'Draft them'}">${SV(I.spark)}</button>` : '';
495
+ const fcAct = f.fcGrill ? `<button type="button" class="pm-btn primary" data-fcg aria-label="${esc('Open the ' + f.fcGrill.n + (f.fcGrill.n === 1 ? ' finding' : ' findings') + ' on ' + f.fcGrill.title)}" title="Open the findings">${SV(I.spark)}</button>` : '';
496
+ act.innerHTML = no + okAct + fcAct;
497
+ }
498
+ // "n of N" with ‹ ›: each arrow names the finding it goes to (data-ins), so a press lands on that one
474
499
  if (open.length > 1) {
475
- if (!f.report) $('#insAct').innerHTML = `<button type="button" class="pm-btn" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` + mvAct + okAct + fcAct;
476
- $('#insPg').innerHTML = L.map((x, i) => `<button type="button" class="${i === insIdx ? 'on' : ''}" data-ins="${i}" aria-label="Finding ${i + 1} of ${L.length}" aria-pressed="${i === insIdx}"${insSkip.has(i) ? ' hidden' : ''}></button>`).join('');
500
+ const at = open.indexOf(insIdx), prev = open[(at - 1 + open.length) % open.length], next = open[(at + 1) % open.length];
501
+ $('#insPg').innerHTML = `<span class="pm-meta" id="insOf">${at + 1} of ${open.length}</span><button type="button" class="pm-btn" data-ins="${prev}" aria-label="Previous finding" title="Previous finding">${SV('M15 6l-6 6 6 6')}</button><button type="button" class="pm-btn" data-ins="${next}" aria-label="Next finding" title="Next finding">${SV('M10 8l4 4-4 4')}</button>`;
477
502
  }
478
- if (f.impact && f.impact.url) $('#insAct').insertAdjacentHTML('beforeend', `<a class="pm-btn" href="${esc(f.impact.url)}"${/^https:/i.test(f.impact.url) ? ' target="_blank" rel="noopener noreferrer"' : ''} aria-label="Open the source: ${esc(f.impact.label)}" title="Open the source">${SV(I.open || 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5')}</a>`);
503
+ if (f.impact && f.impact.url) act.insertAdjacentHTML('beforeend', `<a class="pm-btn" href="${esc(f.impact.url)}"${/^https:/i.test(f.impact.url) ? ' target="_blank" rel="noopener noreferrer"' : ''} aria-label="Open the source: ${esc(f.impact.label)}" title="Open the source">${SV(I.open || 'M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5')}</a>`);
479
504
  }
480
505
  $('#insHero').addEventListener('click', async (e) => {
481
506
  if (e.target.closest('[data-rp]')) { await RI.stripPress(e); return; }
@@ -521,20 +546,6 @@ function spanChange(g, span = nsSpan) {
521
546
  return { d, pct: pctd, prev, last, better, t0 };
522
547
  }
523
548
  const pctSay = (p) => (p === null ? '' : (p > 0 ? '+' : p < 0 ? '−' : '') + (Math.round(Math.abs(p) * 10) / 10) + '%');
524
- /** The North Star's line: the readings of the span solid, the span before it dashed and laid under it, the latest a dot. Each reading has a
525
- * title, so a hover says its value and day. */
526
- function nsSvg(g, ch, W = 520, H = 120) {
527
- const S = g.series || [], tl = day(S[S.length - 1].at), span = ch ? tl - ch.t0 : 28 * DAY;
528
- const cur = S.filter((r) => day(r.at) >= tl - span), prev = S.filter((r) => day(r.at) >= tl - 2 * span && day(r.at) <= tl - span);
529
- const ys = cur.concat(prev).map((r) => r.v), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1, f = (n) => n.toFixed(1);
530
- const x = (t) => 8 + (span ? (t - (tl - span)) / span : 1) * (W - 16), y = (v) => 10 + (1 - (v - lo) / rg) * (H - 26);
531
- const path = (L, sh) => L.map((r, i) => (i ? 'L' : 'M') + f(x(day(r.at) + sh)) + ' ' + f(y(r.v))).join('');
532
- const dots = cur.map((r) => `<circle class="pt" cx="${f(x(day(r.at)))}" cy="${f(y(r.v))}" r="3"><title>${esc(md(day(r.at)) + ' · ' + unitV(g, r.v))}</title></circle>`).join('');
533
- const z = cur[cur.length - 1];
534
- return `<svg class="ins-nsch" viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" role="img" aria-label="${esc(g.title + ': ' + cur.length + ' readings in the span' + (prev.length > 1 ? ', the span before it dashed' : ''))}">`
535
- + (prev.length > 1 ? `<path class="pv" d="${path(prev, span)}"/>` : '') + (cur.length > 1 ? `<path class="ar" d="${path(cur, 0)}L${f(x(tl))} ${H}L${f(x(day(cur[0].at)))} ${H}Z"/><path class="ln" d="${path(cur, 0)}"/>` : '')
536
- + dots + `<circle class="dt" cx="${f(x(day(z.at)))}" cy="${f(y(z.v))}" r="4.5"/></svg>`;
537
- }
538
549
  const RM = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
539
550
  let nsCounted = false;
540
551
  /** The North Star's number counts up once, on the first draw (principle 12 as amended for Intelligence: subtle, honest, reduced motion respected). */
@@ -553,23 +564,60 @@ function nsNote(g) {
553
564
  const F = GC.firstOf(g); if (F) return [F.source, GC.atTxt(F.at)].filter(Boolean).join(' · ');
554
565
  const src = srcOf(g); return [src === 'Recorded' ? '' : src, freshOf(g)].filter(Boolean).join(' · ');
555
566
  }
567
+ /** The North Star's chart data for the system's Chart part (pm/komorebi.js): the readings of the span as the blue line and the target as the
568
+ * dashed plan line, so the tip reads "value · day · ± vs the target". One range: the span Tabs above it pick the span and redraw it. */
569
+ function nsData(g, ch) {
570
+ const S = g.series || [], tl = day(S[S.length - 1].at), span = ch ? tl - ch.t0 : 28 * DAY;
571
+ const cur = S.filter((r) => day(r.at) >= tl - span);
572
+ const series = [{ id: 'now', label: g.title, role: 'blue', values: cur.map((r) => r.v) }];
573
+ if (g.target !== null && g.target !== undefined && Number.isFinite(Number(g.target))) series.push({ id: 'target', label: 'Target', role: 'leaf', plan: true, values: cur.map(() => Number(g.target)) });
574
+ const span0 = (SPANS.find((x) => x[0] === nsSpan) || SPANS[0])[1];
575
+ return { cur, data: { answer: g.title + ': ' + cur.length + ' readings in ' + span0.toLowerCase() + (g.targetTxt ? ', target ' + g.targetTxt : ''), unit: '', ranges: [{ id: nsSpan, label: span0, dates: cur.map((r) => md(day(r.at))), series }] } };
576
+ }
577
+ /** A diamond on each day work that moves the North Star shipped, placed between the readings it falls between (the chart spaces its readings
578
+ * evenly), with the work's name over it and a dashed line down through the chart. */
579
+ function nsShips(g, cur) {
580
+ if (cur.length < 2) return '';
581
+ const t0 = day(cur[0].at), tl = day(cur[cur.length - 1].at), n = cur.length;
582
+ const at = (t) => { for (let i = 1; i < n; i++) { const a = day(cur[i - 1].at), b = day(cur[i].at); if (t <= b) return (i - 1 + (b > a ? (t - a) / (b - a) : 0)) / (n - 1); } return 1; };
583
+ return shipsOf(g).filter((s) => s.t >= t0 && s.t <= tl).map((s) => `<span class="ins-ship" style="left:${(at(s.t) * 100).toFixed(2)}%" title="${esc(s.label + ', ' + md(s.t))}"><i class="pm-dia dn" aria-hidden="true"></i><span class="pm-meta">${esc(s.label.replace(/ shipped$/, ''))}</span></span>`).join('');
584
+ }
585
+ /** A small line of the last readings for a Number: blue when more is better, leaf when less is, muted for a guardrail. */
586
+ function miniLine(g, W = 160, H = 36) {
587
+ const S = (g.series || []).slice(-8); if (S.length < 2) return '';
588
+ const vs = S.map((r) => r.v), lo = Math.min(...vs), hi = Math.max(...vs), rg = hi - lo || 1;
589
+ const pts = S.map((r, i) => (2 + i / (S.length - 1) * (W - 4)).toFixed(1) + ',' + (3 + (1 - (r.v - lo) / rg) * (H - 6)).toFixed(1)).join(' ');
590
+ const col = g.role === 'guardrail' ? 'var(--muted)' : g.direction === 'down' ? 'var(--leaf)' : 'var(--blue)';
591
+ return `<svg class="ins-msp" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" aria-hidden="true"><polyline points="${pts}" fill="none" stroke="${col}" stroke-width="2" stroke-linejoin="round"/></svg>`;
592
+ }
593
+ const paceBadge = (g) => { if (!g.pace || GC.firstOf(g) || g.failed || (g.held || []).length) return ''; const t = g.pace.tone; return `<span class="pm-badge ${t === 'ok' ? 'blue' : t === 'late' || t === 'risk' || t === 'red' ? 'alert' : ''}">${esc(g.pace.head)}</span>`; };
556
594
  function drawNs() {
557
595
  const box = $('#nsRow');
558
596
  if (!M || PF) { box.hidden = true; box.innerHTML = ''; return; }
559
597
  const g = nsGoal();
560
598
  if (!g) { box.hidden = true; box.innerHTML = ''; return; }
561
599
  const F = GC.firstOf(g), line = !F || F.n >= 2, ch = line ? spanChange(g) : null, I0 = inputGoals(), bad = !!(g.failed || (g.held || []).length);
562
- const pill = ch && ch.pct !== null && !bad ? `<span class="pm-badge ${ch.better === null ? 'q' : ch.better ? 'ok' : 'late'}">${esc(pctSay(ch.pct))}</span><span class="note">vs ${esc(unitV(g, ch.prev.v))} ${nsSpan === 'q' ? 'last quarter, same day' : 'the previous ' + (SPANS.find((x) => x[0] === nsSpan) || SPANS[0])[1]}</span>` : '';
563
- const seg = line && (g.series || []).length > 1 ? `<div class="cz-seg ins-seg" role="group" aria-label="Compare">${SPANS.map(([k, l]) => `<button type="button" aria-pressed="${nsSpan === k}" data-span="${k}">${esc(l)}</button>`).join('')}</div>` : '';
564
- const chart = !line ? GC.firstChart(g) : (g.series || []).length ? nsSvg(g, ch) : `<p class="note">${esc(nextReading(g))}</p>`;
600
+ const change = ch && ch.pct !== null && !bad ? `<span class="pm-meta">${esc(pctSay(ch.pct))} vs ${esc(unitV(g, ch.prev.v))} ${nsSpan === 'q' ? 'last quarter, same day' : 'the previous ' + (SPANS.find((x) => x[0] === nsSpan) || SPANS[0])[1]}</span>` : '';
601
+ const tabs = line && (g.series || []).length > 1 ? `<div class="pm-tabs" role="tablist" aria-label="Compare">${SPANS.map(([k, l]) => `<button type="button" class="pm-tab" role="tab" aria-selected="${nsSpan === k}" data-span="${k}">${esc(l)}</button>`).join('')}</div>` : '';
602
+ const D = line && (g.series || []).length > 1 ? nsData(g, ch) : null;
603
+ const chart = !line ? GC.firstChart(g) : !(g.series || []).length ? `<p class="pm-meta">${esc(nextReading(g))}</p>` : D ? '<div class="ins-nsch" id="nsChart"></div>' : `<p class="pm-meta">${esc(nextReading(g))}</p>`;
565
604
  const drafts = draftsFor(g.id).map(drHtml).join('');
566
- const card = `<div class="ins-nsc${bad ? ' bad' : ''}" data-goal="${esc(g.id)}"><div class="ins-nsh"><span class="ins-lbl2">${OK.dotOf(g) === 'broken' ? OK.dotHtml('broken') + ' ' : ''}North Star <span>${esc(g.title)}</span></span>${seg}</div>`
567
- + `<div class="ins-nsv"><button type="button" class="ins-big" data-nsopen aria-label="Open ${esc(g.title)}"><b id="nsNum">${esc(nowOf(g))}</b></button>${pill}<span class="note ins-nsn">${esc(nsNote(g))}</span></div>`
568
- + chart + (drafts ? `<div class="ins-nsd">${drafts}</div>` : '') + '</div>';
569
- const row = (x) => { const c = F ? null : spanChange(x), warn = gcSay(x); return `<button type="button" class="ins-inr" data-goal="${esc(x.id)}"><span class="nm">${esc(x.title)}${warn ? `<small class="note">${esc(warn)}</small>` : ''}</span><span class="v"><b>${esc(nowOf(x))}</b>${c && !warn ? `<span class="${c.better === null ? 'q' : c.better ? 'up' : 'dn'}">${esc(sgn(c.d, x.unit))}</span>` : ''}</span></button>`; };
570
- const ins = I0.filter((x) => x.role === 'input'), grd = I0.filter((x) => x.role === 'guardrail');
571
- const side = ins.length || grd.length ? `<div class="ins-nsi">${ins.length ? `<span class="ins-lbl2">Inputs <span>what moves the North Star</span></span>${ins.map(row).join('')}` : ''}${grd.length ? `<span class="ins-lbl2">Guardrails <span>must not get worse</span></span>${grd.map(row).join('')}` : ''}</div>` : '';
572
- box.innerHTML = card + side; box.hidden = false; box.classList.toggle('one', !side);
605
+ const head = `<div class="head"><h2 class="pm-h ins-lbl2">${OK.dotOf(g) === 'broken' ? OK.dotHtml('broken') + ' ' : ''}North Star <span>· ${esc(g.title)}</span></h2><span class="sp"></span>${tabs}`
606
+ + `<button type="button" class="ins-big" data-nsopen aria-label="Open ${esc(g.title)}"><b class="pm-num" id="nsNum">${esc(nowOf(g))}</b></button>${paceBadge(g)}</div>`;
607
+ const note = `<div class="ins-nsv pm-row">${change}<span class="pm-meta ins-nsn">${esc(nsNote(g))}</span></div>`;
608
+ const cap = D && shipsOf(g).length ? '<p class="pm-meta">A diamond is the day work that moves it shipped.</p>' : ''; // the Chart says how to read a point itself
609
+ const num = (x) => { const warn = gcSay(x), tg = x.targetTxt ? (x.role === 'guardrail' ? 'must stay ' + x.targetTxt : 'target ' + x.targetTxt) : '';
610
+ return `<button type="button" class="pm-block ins-inr" data-goal="${esc(x.id)}" aria-label="${esc(x.title + ', ' + nowOf(x))}"><span class="pm-row ins-nmr"><b class="nm">${esc(x.title)}</b><span class="sp"></span><span class="pm-meta">${esc([x.role === 'guardrail' ? 'guardrail' : 'input', tg].filter(Boolean).join(' · '))}</span></span>`
611
+ + `<span class="pm-row ins-nvr"><b class="pm-num v">${esc(nowOf(x))}</b><span class="sp"></span>${warn ? `<span class="pm-meta">${esc(warn)}</span>` : miniLine(x)}</span></button>`; };
612
+ const nums = I0.length ? `<div class="ins-nsi">${I0.filter((x) => x.role === 'input').concat(I0.filter((x) => x.role === 'guardrail')).map(num).join('')}</div>` : '';
613
+ box.innerHTML = `<div class="ins-nsc${bad ? ' bad' : ''}" data-goal="${esc(g.id)}">${head}${note}${chart}${cap}${drafts ? `<div class="ins-nsd">${drafts}</div>` : ''}</div>${nums}`;
614
+ box.hidden = false; box.classList.toggle('one', !nums);
615
+ if (D) {
616
+ const el = $('#nsChart');
617
+ KO.chart(el, D.data, { onPick: () => openGoalDetail(g.id) });
618
+ const pc = el.querySelector('.pm-chart'), sh = nsShips(g, D.cur);
619
+ if (pc && sh) pc.insertAdjacentHTML('beforeend', `<div class="ins-ships">${sh}</div>`);
620
+ }
573
621
  countUp($('#nsNum'), g);
574
622
  }
575
623
  $('#nsRow').addEventListener('click', (e) => {
@@ -615,14 +663,31 @@ function drEditHtml(r) {
615
663
  }
616
664
  const drHtml = (r) => (drEdit === r.id && r.state === 'open' ? drEditHtml(r) : OK.draftHtml(r));
617
665
  /** The loose box: drafts that belong to no row on the list. Zero is silence. */
666
+ /** "PMOS drafted N measures for <product>" (board IntelligenceDS): each drafted metric is a ListRow: ✦, its name, one line that says what it is
667
+ * (an input to the North Star, a guardrail, a key result), how it is counted, where and how often it is read and its target, then ✓ Keep and ✕.
668
+ * A press on the row opens its check panel (GcJ1Drafts) in the Viewer card. The hooks gc-tr, data-gc-row and data-gc stay as before. */
669
+ const GROUP_ONE = { 'North Star': 'The North Star', Inputs: 'An input to the North Star', Guardrails: 'A guardrail: it must not get worse', 'Key results': 'A key result this quarter' };
670
+ function measuresHtml(rows) {
671
+ const R = rows.filter((r) => r && r.kind === 'metric' && r.state === 'open'); if (!R.length) return '';
672
+ const name = (M.board && M.board.name) || 'this product';
673
+ const row = (r) => {
674
+ const rc = (r.raw && r.raw.recipe) || null, src = (rc && rc.connector) || r.source || '', R0 = GC.rhythmOf(r), live = r.raw && r.raw.live && r.raw.live.ok !== false ? (r.raw.live.txt || '') : '';
675
+ const sub = [GROUP_ONE[r.group] || '', GC.countedOf(r), src ? 'Read ' + (R0 ? R0.long + ' ' : '') + 'from ' + src : R0 ? 'Read ' + R0.long : '', live ? 'now ' + live : '', r.targetTxt ? 'Target ' + r.targetTxt : ''].filter(Boolean).join('. ');
676
+ const busy = tblBusy.has(r.id) ? ' disabled' : '';
677
+ return `<div class="pm-li gc-tr${CHK && CHK.id === r.id ? ' now sel' : ''}" role="listitem" data-gc-row="${esc(r.id)}" tabindex="0" aria-label="${esc('Check ' + r.name)}">${SV(I.spark)}`
678
+ + `<span class="txt gc-nm"><b class="t">${esc(r.name)}</b><span class="w gc-hw">${esc(sub ? sub + '.' : 'Not written yet.')}</span></span>`
679
+ + `<span class="gc-acts"><button type="button" class="pm-btn" data-gc="keep" data-row="${esc(r.id)}" aria-label="${esc('Keep: ' + r.name)}" title="Keep"${busy}>${SV(I.chk)}</button>`
680
+ + `<button type="button" class="pm-btn" data-gc="drop" data-row="${esc(r.id)}" aria-label="${esc('Not now: ' + r.name)}" title="Not now"${busy}>${SV(I.x)}</button></span></div>`;
681
+ };
682
+ return `<div class="head"><h2 class="pm-h-sm" id="hDr">PMOS drafted ${R.length === 1 ? '1 measure' : R.length + ' measures'} for ${esc(name)}</h2></div><div class="rows" role="list" aria-labelledby="hDr">${R.map(row).join('')}</div>`;
683
+ }
618
684
  function drawDrafts() {
619
685
  const box = $('#draftBox');
620
686
  if (!M || PF) { box.hidden = true; box.innerHTML = ''; return; }
621
687
  const placed = new Set(['North Star', 'Inputs', 'Guardrails', 'Key results']);
622
688
  const L = looseDrafts().filter((r) => !(r.kind === 'metric' && placed.has(r.group)));
623
- // batch 18 item 11 (GcJ1aTable): the drafted metrics are ONE table, how each is counted and where and how often it is read; the other loose
624
- // drafts follow it as before
625
- const T = GC.tableHtml(tableRows(), { busy: tblBusy, sel: CHK && CHK.id });
689
+ // the drafted metrics are one List (batch 18 item 11 as redrawn by IntelligenceDS); the other loose drafts follow it as before
690
+ const T = measuresHtml(tableRows());
626
691
  box.innerHTML = T + (L.length ? `<div class="okr-card">${L.map((r) => `<div class="okr-row">${drHtml(r)}</div>`).join('')}</div>` : '');
627
692
  box.hidden = !T && !L.length;
628
693
  box.classList.toggle('gc-on', !!T);
@@ -1050,12 +1115,52 @@ function drawWait() {
1050
1115
  const el = $('#waitList'); if (!el) return;
1051
1116
  const W = waitGroups(), n = W.reduce((a, x) => a + x.items.length, 0);
1052
1117
  el.hidden = !n; if (!n) { el.innerHTML = ''; return; }
1053
- 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>`;
1054
- 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">`
1055
- + 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>`
1056
- + (x.connect ? `<button type="button" class="pm-btn primary" 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>';
1057
- }
1118
+ // Waiting on a source (IntelligenceDS): a List block. Each source is a row (Connect when it can be connected); its key results sit under it,
1119
+ // each opening its goal, where a reading can be added.
1120
+ const itemHtml = (it) => `<button type="button" class="pm-li nest ins-wkr" ${it.kr ? `data-kr="${esc(it.kr)}"` : `data-goal="${esc(it.goal)}"`} aria-label="${esc('Open ' + it.title + '. Add a reading there')}"><span class="txt"><span class="t">${it.tok ? `<span class="ins-krt">${esc(it.tok)}</span> ` : ''}${esc(it.title)}</span>${it.due ? `<span class="w">due ${esc(md(day(it.due)))}</span>` : ''}</span><span class="pm-btn" aria-hidden="true">${SV(I.pen)}</span></button>`;
1121
+ el.innerHTML = `<div class="head"><h2 class="pm-h-sm" id="hWait">Waiting on a source</h2><span class="pm-meta">${n === 1 ? '1 key result' : n + ' key results'} with no reading, so not in the charts</span></div><div class="rows" role="list">`
1122
+ + W.map((x) => `<div class="ins-wrow" role="listitem"><div class="pm-li ins-wsrc">${SV('M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1')}<span class="txt"><b class="t">${esc(x.label)}</b><span class="w">${esc(x.sub)}</span></span>`
1123
+ + (x.connect ? `<button type="button" class="pm-btn primary" data-krcon aria-label="${esc('Connect ' + x.label + ' in Settings, Connectors')}" title="${esc('Connect ' + x.label)}">${SV(I.chk)}</button>` : '') + `</div><div class="ins-wkrs">${x.items.map(itemHtml).join('')}</div></div>`).join('') + '</div>';
1124
+ }
1125
+ /* Key results live on Goals (IntelligenceDS): on a desk they show here only on a dashboard view (a saved one, an objective, Delivery trends),
1126
+ * while a new dashboard picks its goals, in Portfolio, or when More › Key results here (or an old ?tab=goals link) asks for them. A phone keeps
1127
+ * its goal cards. The table stays in the page either way, so a goal link, Find and the panels still reach a row. */
1128
+ let krShow = new URLSearchParams(location.search).get('tab') === 'goals';
1129
+ const krOn = () => !!(PF || selecting || krShow || dash === TRENDS || (M && curDash() && curDash().id !== 'all'));
1130
+ function setKrs() {
1131
+ document.body.classList.toggle('ins-krs', krOn());
1132
+ const it = $('#krsItem'); if (it) it.querySelector('span').firstChild.textContent = krShow ? 'Hide key results' : 'Key results here';
1133
+ }
1134
+ /* Delivery trends (IntelligenceDS): the Board's measures as Number tiles in their own block, under the drafted measures. Choose tiles picks the
1135
+ * ones shown (kept in this browser). A press opens the tile; its target popover sets the target, as before. In the Delivery trends view the big
1136
+ * tiles take the page, so this block steps aside. */
1137
+ const TILE_KEY = 'pmos.intel.tiles.off';
1138
+ const tilesOff = () => { try { return new Set(JSON.parse(localStorage.getItem(TILE_KEY) || '[]')); } catch { return new Set(); } };
1139
+ let tileMenu = false;
1140
+ function drawTrends() {
1141
+ const box = $('#trendBox'); if (!box) return;
1142
+ if (!M || PF || dash === TRENDS || !M.board || !M.board.ws) { box.hidden = true; box.innerHTML = ''; return; }
1143
+ const off = tilesOff(), shown = tilesOn().filter(([k]) => !off.has(k));
1144
+ const tile = ([k, l]) => { const t = tileOf(k), on = tgOpen === k; return `<div class="pm-block ins-tile${t.warn ? ' warn' : ''}${t.abs ? ' abs' : ''}${on ? ' sel' : ''}" data-tile="${k}" role="button" tabindex="0" aria-expanded="${on}" aria-label="${esc(l + ', ' + t.v + (t.s ? ', ' + t.s : '') + (t.change && t.change.d !== 0 ? ', ' + t.change.txt : '') + (t.T.line ? ', ' + t.T.line : ''))}"${t.s ? ` title="${esc(t.s)}"` : ''}>`
1145
+ + `<span class="pm-row"><b class="l">${esc(l)}</b><span class="sp"></span><span class="pm-meta">${esc(t.change && t.change.d !== 0 ? t.change.txt : t.s || '')}</span></span>`
1146
+ + `<span class="pm-row"><b class="pm-num v">${esc(t.v)}</b><span class="sp"></span>${miniSpark(t.ser, 160, 34)}</span><span class="pm-meta tg">${on ? 'Setting target…' : esc(t.T.line)}</span></div>`; };
1147
+ const menu = tileMenu ? `<div class="pm-menu ins-tilemenu" id="tileMenu" role="dialog" aria-label="Choose tiles">${tilesOn().map(([k, l]) => `<div class="pm-set"><span class="sp">${esc(l)}</span><button type="button" class="pm-switch" role="switch" aria-checked="${!off.has(k)}" data-tileon="${k}" aria-label="${esc('Show ' + l)}"></button></div>`).join('')}</div>` : '';
1148
+ box.innerHTML = `<div class="head"><h2 class="pm-h-sm" id="hTr">Delivery trends</h2><span class="pm-meta">all ${esc(M.board.name || 'this product')} work, last 8 weeks</span><span class="sp"></span>`
1149
+ + `<span class="ins-mw"><button type="button" class="pm-btn" id="tileB" aria-haspopup="dialog" aria-expanded="${tileMenu}" aria-label="Choose tiles" title="Choose tiles">${SV('M4 7h10M18 7h2M4 17h4M12 17h8M14 5v4M8 15v4')}</button>${menu}</span></div>`
1150
+ + (shown.length ? `<div class="ins-tiles" id="bmBody">${shown.map(tile).join('')}</div>` : '<p class="pm-meta">Every tile is off. Choose tiles turns them back on.</p>');
1151
+ box.hidden = false;
1152
+ }
1153
+ $('#trendBox').addEventListener('click', (e) => {
1154
+ if (e.target.closest('#tileB')) { e.stopPropagation(); tileMenu = !tileMenu; drawTrends(); return; }
1155
+ const sw = e.target.closest('[data-tileon]');
1156
+ if (sw) { e.stopPropagation(); const off = tilesOff(), k = sw.dataset.tileon; if (off.has(k)) off.delete(k); else off.add(k); try { localStorage.setItem(TILE_KEY, JSON.stringify([...off])); } catch { /* this browser keeps no choice */ } drawTrends(); return; }
1157
+ if (e.target.closest('#tileMenu')) return;
1158
+ const tile = e.target.closest('[data-tile]'); if (tile) { if (tgOpen) closeTarget(); openTile(tile.dataset.tile); }
1159
+ });
1160
+ $('#trendBox').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-tile]')) { e.preventDefault(); e.target.click(); } });
1161
+ document.addEventListener('click', (e) => { if (tileMenu && !e.target.closest('#tileMenu, #tileB')) { tileMenu = false; drawTrends(); } });
1058
1162
  function drawGoals() {
1163
+ setKrs(); drawTrends();
1059
1164
  const G = goalsShown(), T = $('#goalTbl');
1060
1165
  document.body.classList.toggle('ins-trv', dash === TRENDS);
1061
1166
  if (dash === TRENDS) { T.innerHTML = bmHtml(true); T.hidden = false; $('#goalCards').innerHTML = ''; drawWait(); return; }
@@ -1652,28 +1757,31 @@ let decOpen = false;
1652
1757
  function outRow(r) {
1653
1758
  const due = dueOf(r), P = promiseOf(r), dr = draftOf(r), ship = day(r.endAt);
1654
1759
  const pr = r.promise || null;
1655
- const promised0 = P ? `<b>${esc(P.g.title + (P.promised !== null ? ' ' + sgn(P.promised, P.g.unit) : ''))}</b><div class="note">${esc(P.g.byAt ? 'by ' + md(day(P.g.byAt)) : 'no date')}</div>` : `<span class="note">${r.anchor ? 'Anchored to ' + esc(r.anchor) + ', which is not a goal with readings.' : 'No goal is anchored, so nothing was promised to measure.'}</span>`;
1760
+ const by = P && P.g.byAt ? 'by ' + md(day(P.g.byAt)) : '';
1761
+ const chk = pr && pr.horizon ? `<span class="ins-chk">${OK.dotHtml(pr.overdue ? 'behind' : 'q')}check ${esc(md(day(pr.horizon)))}${pr.overdue ? ', overdue' : ''}</span>` : '<span class="pm-meta">No check date</span>';
1656
1762
  // the D57 promise (outcome_metric) is what the row promised; the anchor goal's numbers stay under it when there is one
1657
- const promised = pr && pr.metric ? `<b>${esc(pr.metric)}</b>${P ? `<div class="note">${esc(P.g.title + (P.promised !== null ? ' ' + sgn(P.promised, P.g.unit) : ''))}</div>` : ''}` : P ? promised0 : '<span class="pm-badge q">No outcome promised</span>';
1658
- const check = pr && pr.horizon ? `<span class="ins-chk">${OK.dotHtml(pr.overdue ? 'behind' : 'q')}<b>${esc(md(day(pr.horizon)))}</b></span>${pr.overdue ? '<div class="note">overdue</div>' : ''}` : '<span class="note">No check date</span>';
1659
- const got = P ? `<span class="ins-gotw">${bulletHtml(P)}<b>${esc(P.moved === null ? 'no reading yet' : sgn(P.moved, P.g.unit))}</b></span>${guardOf(r) ? `<div class="note">${esc(guardOf(r).name + ': ' + guardOf(r).text)}</div>` : ''}` : '';
1763
+ const expected = pr && pr.metric ? `<b>${esc(pr.metric)}</b>${P ? `<div class="pm-meta">${esc([P.g.title + (P.promised !== null ? ' ' + sgn(P.promised, P.g.unit) : ''), by].filter(Boolean).join(' '))}</div>` : ''}`
1764
+ : P ? `<b>${esc(P.g.title + (P.promised !== null ? ' ' + sgn(P.promised, P.g.unit) : ''))}</b><div class="pm-meta">${esc(by || 'no date')}</div>`
1765
+ : r.anchor ? `<span class="pm-meta">Anchored to ${esc(r.anchor)}, which is not a goal with readings.</span>` : '<span class="pm-badge">No outcome promised</span>';
1766
+ const G = guardOf(r);
1767
+ const got = P ? `<span class="ins-gotw">${bulletHtml(P)}<b>${esc(P.moved === null ? 'no reading yet' : sgn(P.moved, P.g.unit))}</b></span>${G ? `<div class="pm-meta">${esc(G.name + ': ' + G.text)}</div>` : ''}` : '<span class="pm-meta">—</span>';
1660
1768
  let verdict, act = '';
1661
1769
  if (r.group === 'verdict') {
1662
1770
  const dd = pr && pr.horizon ? day(pr.horizon) : due;
1663
- verdict = dr ? `<span class="ins-dv"><span class="sp" aria-hidden="true">${SV(I.spark)}</span><span><b>${esc(dr.verdict)}.</b> ${esc(dr.text)}</span></span>` : `<span class="pm-badge you">To judge${dd !== null ? (pr && pr.overdue ? ' · was due ' : ' · due ') + esc(md(dd)) : ''}</span>`;
1664
- act = `<button type="button" class="pm-btn" data-verdict="${esc(r.id)}" aria-haspopup="dialog" aria-label="Decide: Keep, Iterate or Stop" title="Decide">${SV(I.pen)}</button>`
1665
- + (dr ? `<button type="button" class="pm-btn primary" data-keep="${esc(r.id)}" aria-label="Record the verdict: Keep" title="Record the verdict: Keep">${SV(I.chk)}</button>` : '');
1771
+ verdict = dr ? `<span class="ins-dv">${SV(I.spark)}<span><span class="pm-badge blue">${esc(dr.verdict === 'Keep' ? 'Yes' : dr.verdict)}</span> ${esc(dr.text)}</span></span>` : `<span class="pm-badge blue">To judge${dd !== null ? (pr && pr.overdue ? ' · was due ' : ' · due ') + esc(md(dd)) : ''}</span>`;
1772
+ act = (dr ? `<button type="button" class="pm-btn" data-keep="${esc(r.id)}" aria-label="Record the verdict: Keep" title="Keep">${SV(I.chk)}</button>` : '')
1773
+ + `<button type="button" class="pm-btn" data-verdict="${esc(r.id)}" aria-haspopup="dialog" aria-label="Decide: Keep, Iterate or Stop" title="Change">${SV(I.pen)}</button>`;
1666
1774
  } else if (r.group === 'decided') {
1667
1775
  const v = r.verdict;
1668
- verdict = v ? `<span class="pm-badge ${v.verdict === 'Stop' ? 'q' : 'ok'}">${v.verdict === 'Keep' ? SV(I.chk) + 'Kept' : v.verdict === 'Iterate' ? 'Changed' : 'Stopped'}${v.at ? ' · ' + esc(md(day(v.at))) : ''}</span><div class="note">${esc(v.learned)}</div>`
1669
- : '<span class="pm-badge q">Stopped</span><div class="note">No learning recorded.</div>'; // only a stopped initiative is decided without a verdict
1776
+ verdict = v ? `<span class="pm-badge ${v.verdict === 'Stop' ? '' : 'blue'}">${v.verdict === 'Keep' ? SV(I.chk) + 'Kept' : v.verdict === 'Iterate' ? 'Changed' : 'Stopped'}${v.at ? ' · ' + esc(md(day(v.at))) : ''}</span><div class="pm-meta">${esc(v.learned)}</div>`
1777
+ : '<span class="pm-badge">Stopped</span><div class="pm-meta">No learning recorded.</div>'; // only a stopped initiative is decided without a verdict
1670
1778
  if (v && v.at === M.today) act = `<button type="button" class="pm-btn" data-vundo="${esc(r.id)}" aria-label="Undo the verdict" title="Undo">${SV(I.undo)}</button>`;
1671
- } else verdict = `<span class="pm-badge q">${esc(due !== null ? 'Judged ' + md(due) : r.idx === 6 ? 'Being monitored' : 'Too early')}</span>`;
1672
- return `<div class="ins-tr ins-row ins-ocols" role="row" data-ini="${esc(r.id)}"><div class="nm" role="cell"><a href="${iniHref(r.id)}"><b>${esc(r.title)}</b></a><small>${esc(ship !== null ? 'shipped ' + md(ship) : 'no ship date recorded')}</small></div>`
1673
- + `<div role="cell" class="pace">${promised}</div><div role="cell" class="pace">${check}</div><div role="cell" class="pace">${got}</div><div role="cell" class="pace">${verdict}</div><div role="cell" class="ins-act">${act}</div></div>`;
1779
+ } else verdict = `<span class="pm-badge">${esc(due !== null ? 'Judged ' + md(due) : r.idx === 6 ? 'Being monitored' : 'Too early')}</span>`;
1780
+ return `<tr data-ini="${esc(r.id)}"><td class="nm"><a href="${iniHref(r.id)}"><b>${esc(r.title)}</b></a><div class="pm-meta">${esc(ship !== null ? 'shipped ' + md(ship) : 'no ship date recorded')}</div></td>`
1781
+ + `<td class="pace">${expected}<div>${chk}</div></td><td class="pace">${got}</td><td class="pace">${verdict}</td><td class="ins-act">${act}</td></tr>`;
1674
1782
  }
1675
- /** Did it work? (Iq8Overview): only the work to judge and the work in its window; the decided ones fold under one line that counts them. The
1676
- * section is not drawn when nothing has shipped. */
1783
+ /** Did it work? (IntelligenceDS): a Table of the work to judge and the work in its window (Work, Expected, What happened, PMOS thinks), PMOS's
1784
+ * drafted verdict with ✓ Keep and ✎ Change; the decided ones fold under one line that counts them. Not drawn when nothing has shipped. */
1677
1785
  function drawOutcomes() {
1678
1786
  const L = outcomesShown(), sec = $('#pOutcomes');
1679
1787
  const live = L.filter((r) => r.group !== 'decided'), dec = L.filter((r) => r.group === 'decided');
@@ -1682,9 +1790,11 @@ function drawOutcomes() {
1682
1790
  const nj = live.filter((r) => r.group === 'verdict').length, nw = live.length - nj;
1683
1791
  const vOf = (r) => (r.verdict ? r.verdict.verdict : 'Stop'), cnt = (k) => dec.filter((r) => vOf(r) === k).length; // kept only from a recorded verdict
1684
1792
  const np = live.filter((r) => !(r.promise && r.promise.metric) && !r.goal).length;
1685
- const head = `<div class="ins-tr ins-th ins-ocols" role="row"><div role="columnheader">Did it work? <span>${esc([nj ? nj + ' to judge' : '', nw ? nw + ' in window' : '', np ? np + ' without a promise' : ''].filter(Boolean).join(' · '))}</span></div><div role="columnheader">Promised</div><div role="columnheader">Check</div><div role="columnheader">Got</div><div role="columnheader">Verdict</div><div></div></div>`;
1686
- const foot = dec.length ? `<button type="button" class="ins-foot" id="decFold" aria-expanded="${decOpen}">Decided <b>${dec.length}</b> · ${esc([cnt('Keep') ? cnt('Keep') + ' kept' : '', cnt('Iterate') ? cnt('Iterate') + ' changed' : '', cnt('Stop') ? cnt('Stop') + ' stopped' : ''].filter(Boolean).join(', '))}${SV(decOpen ? I.up : I.down)}</button>` : '';
1687
- $('#outTbl').innerHTML = oneNote() + head + live.map(outRow).join('') + foot + (decOpen ? dec.map(outRow).join('') : '');
1793
+ const head = `<div class="head"><h2 class="pm-h" id="hOut">Did it work?</h2><span class="pm-meta">${esc([nj ? nj + ' to judge' : '', nw ? nw + ' in window' : '', np ? np + ' without a promise' : ''].filter(Boolean).join(' · '))}</span></div>`;
1794
+ const shown = live.concat(decOpen ? dec : []);
1795
+ const table = shown.length ? `<table class="pm-table ins-otbl"><thead><tr><th>Work</th><th>Expected</th><th>What happened</th><th>PMOS thinks</th><th><span class="vh">Keep or change</span></th></tr></thead><tbody>${shown.map(outRow).join('')}</tbody></table>` : '';
1796
+ const foot = dec.length ? `<button type="button" class="pm-fold" id="decFold" aria-expanded="${decOpen}">Decided <b>${dec.length}</b> · ${esc([cnt('Keep') ? cnt('Keep') + ' kept' : '', cnt('Iterate') ? cnt('Iterate') + ' changed' : '', cnt('Stop') ? cnt('Stop') + ' stopped' : ''].filter(Boolean).join(', '))}${SV(decOpen ? I.up : I.down)}</button>` : '';
1797
+ $('#outTbl').innerHTML = head + oneNote() + table + foot;
1688
1798
  }
1689
1799
  $('#outTbl').addEventListener('click', async (e) => {
1690
1800
  if (e.target.closest('#decFold')) { decOpen = !decOpen; drawOutcomes(); return; }
@@ -2337,7 +2447,7 @@ async function load() {
2337
2447
  // A shared goal link (?goal=<id>, from "Copy link" in the goal's ⋯) opens that goal once, after the first read.
2338
2448
  if (first) { const gid = new URLSearchParams(location.search).get('goal'); if (gid && allGoals().some((g) => g.id === gid)) openGoalDetail(gid); }
2339
2449
  // an old tab link (Insights had Goals, Outcomes and Library): it lands on the section or the panel, once
2340
- if (first) { const t = new URLSearchParams(location.search).get('tab'); if (t === 'outcomes' || t === 'library') setTab(t); }
2450
+ if (first) { const t = new URLSearchParams(location.search).get('tab'); if (t === 'outcomes' || t === 'library' || t === 'goals') setTab(t); }
2341
2451
  if (first) draftsLoad();
2342
2452
  if (!PF) fcGrillLoad().then(() => { if (M && FCG) drawStrip(); }).catch(() => {});
2343
2453
  if (!PF) LAB.load(); else { const el = $('#pLab'); if (el) el.hidden = true; }
@@ -5,10 +5,12 @@
5
5
  <meta name="pmos-nonce" content="" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
7
  <title>PMOS · Intelligence</title>
8
- <!-- Intelligence (batch 15 item 1; it was Insights, and /premium-insights.html still serves it): ONE page, no tabs, drawn to the frames Iq8Overview,
9
- Iq8Suggest and Iq8Phone. The ✦ strip, the North Star with its inputs, PMOS's drafted metrics, the key results by objective with the health budgets,
10
- then "Did it work?". A key result with no reading is not a table row: it waits in "Waiting on a source" (U3). ⋯ holds Reports and dashboards and Export only. Old ?tab=goals|outcomes|library links land on the matching
11
- section or panel. Before it: the premium Insights in the Agreed design (initiative premium-agreed-design, G1 and G2; before it briefing-premium-insights and insights-one-list),
8
+ <!-- Intelligence (batch 15 item 1; it was Insights, and /premium-insights.html still serves it): ONE column of Komorebi blocks, drawn to the board
9
+ IntelligenceDS (initiative intelligence-ds-page): What PMOS found (1 of N, ‹ ›, the finding's Suggestion), the North Star chart with its inputs and
10
+ guardrails as Numbers, the measures PMOS drafted (✓ ✕), Delivery trends (Choose tiles), "Did it work?" as a Table whose decided rows fold, and
11
+ "Waiting on a source". The key results live on Goals: here they show only from ⋯ › Key results here, ?tab=goals or a dashboard view. ⋯ holds
12
+ Reports and dashboards, Key results here and Export CSV. Old ?tab=goals|outcomes|library links land on the matching section or panel.
13
+ Before it: Before it: the premium Insights in the Agreed design (initiative premium-agreed-design, G1 and G2; before it briefing-premium-insights and insights-one-list),
12
14
  with the Uncovered features frames IsGoal, IsTarget, IsLibrary, IsMenus and IsPhone (initiative premium-uncovered-features).
13
15
  One bar: the product picker, the tabs Goals, Outcomes and Library, the view, the period and the icon tools. No page header; the floating place menu
14
16
  (pm/cozy-nav.js) replaces the rail. It reads GET /api/insights-premium (the KR metric records, the board's initiatives, the report files and setups)
@@ -32,45 +34,57 @@
32
34
 
33
35
  <main class="cz-panel ins stage" id="stage">
34
36
  <h1 class="vh">Intelligence</h1>
37
+ <!-- the top line (board IntelligenceDS, initiative intelligence-ds-page): the path Goals › Intelligence, the product, view and period chips, then the
38
+ icon buttons Find, Filter, Make a report, New and More. Intelligence is reached from Goals › More. -->
35
39
  <div class="ins-bar" id="insBar">
40
+ <nav class="pm-path ins-path" aria-label="Path"><a id="goalsLink" href="/premium-goals.html">Goals</a><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 8l4 4-4 4"/></svg><b>Intelligence</b></nav>
36
41
  <span class="ins-mw ins-pkw" id="prodHost"></span>
37
42
  <span class="ins-ttl" aria-hidden="true">Intelligence</span>
38
- <span class="cz-vr ins-vw"></span>
39
- <span class="ins-mw ins-vw"><button type="button" class="cz-pick" id="viewChip" aria-haspopup="menu" aria-expanded="false" aria-controls="viewMenu" aria-label="View: a saved dashboard or all goals">View: <b id="viewName">All goals</b><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10l5 5 5-5"/></svg></button><div class="ins-menu" id="viewMenu" role="menu" aria-label="Dashboard" hidden></div></span>
43
+ <span class="ins-mw ins-vw"><button type="button" class="cz-pick ins-chip" id="viewChip" aria-haspopup="menu" aria-expanded="false" aria-controls="viewMenu" aria-label="View: a saved dashboard or all goals">View: <b id="viewName">All goals</b><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10l5 5 5-5"/></svg></button><div class="ins-menu" id="viewMenu" role="menu" aria-label="Dashboard" hidden></div></span>
44
+ <span class="ins-mw ins-perw"><button type="button" class="cz-chip ins-chip" id="perChip" aria-haspopup="menu" aria-expanded="false" aria-controls="perMenu"><b id="perName">Q4</b><span class="ins-perd" id="perSub"></span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10l5 5 5-5"/></svg></button><div class="ins-menu ins-permenu" id="perMenu" role="menu" aria-label="Period" hidden></div></span>
40
45
  <div class="cz-tools ins-tools">
41
- <span class="ins-mw ins-perw"><button type="button" class="cz-chip" id="perChip" aria-haspopup="menu" aria-expanded="false" aria-controls="perMenu"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 6h16v14H4zM4 10h16M9 3v4M15 3v4"/></svg><b id="perName">Q4</b><span class="ins-perd" id="perSub"></span><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 10l5 5 5-5"/></svg></button><div class="ins-menu ins-permenu" id="perMenu" role="menu" aria-label="Period" hidden></div></span>
42
- <span class="cz-vr ins-dk"></span>
43
46
  <span class="ins-mw"><button type="button" class="pm-btn" id="findB" aria-haspopup="dialog" aria-label="Find a goal or report. Opens Search" title="Find a goal or report"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14M20 20l-4-4"/></svg></button></span>
44
47
  <span class="ins-mw ins-dk"><button type="button" class="pm-btn" id="filtB" aria-haspopup="dialog" aria-expanded="false" aria-controls="filtMenu" aria-label="Filter by status, owner or kind" title="Filter by status, owner or kind"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16l-6 8v6l-4-2v-4z"/></svg><i class="ins-fdot" id="filtDot" hidden></i></button><div class="ins-menu ins-right ins-filtp" id="filtMenu" role="dialog" aria-label="Filter" hidden></div></span>
45
48
  <span class="ins-mw"><button type="button" class="pm-btn" id="repB" aria-haspopup="menu" aria-expanded="false" aria-controls="repMenu" aria-label="Make a report from this" title="Make a report from this"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h9l4 4v14H6zM14 3v5h5M9 18v-3M12 18v-6M15 18v-4"/></svg></button><div class="ins-menu ins-right ins-rpmenu" id="repMenu" role="menu" aria-label="Make a report from" hidden></div></span>
46
49
  <span class="ins-mw"><button type="button" class="pm-btn primary" id="newB" aria-label="New metric or key result" title="New metric or key result"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
47
50
  <span class="ins-mw"><button type="button" class="pm-btn" id="moreB" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More: reports and dashboards, export" title="More: reports and dashboards, export"><svg viewBox="0 0 24 24" aria-hidden="true" stroke-width="3"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button><div class="ins-menu ins-right" id="moreMenu" role="menu" aria-label="More" hidden>
48
51
  <button type="button" role="menuitem" data-more="library"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h9l4 4v14H6zM14 3v5h5M9 13h6M9 17h4"/></svg><span>Reports and dashboards<small id="libSub"></small></span><span class="k" id="libNew"></span></button>
52
+ <button type="button" role="menuitem" data-more="krs" id="krsItem"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 20V10M12 20V4M18 20v-7"/></svg><span>Key results here<small>They live on Goals</small></span></button>
49
53
  <button type="button" role="menuitem" data-more="export"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11M7 10l5 5 5-5M5 20h14"/></svg>Export CSV</button>
50
54
  </div></span>
51
55
  </div>
52
56
  </div>
53
57
 
54
- <!-- the ✦ strip (Iq8Overview): one finding at a time, its drafted move when it has one, Ask why, Not now and the dots that page through them -->
55
- <div class="ins-strip ins-hero" id="insHero"><span class="sp" aria-hidden="true"><svg viewBox="0 0 24 24"><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"/></svg></span><p class="t" id="insText" aria-live="polite"><b id="insEye"></b> <span id="brief">Reading the records.</span> <span id="insWhy"></span><span class="ins-mv" id="insMv" hidden></span></p><span class="ins-hact" id="insAct"></span><a class="cz-chip gh" id="askWhy" href="/premium.html?ask=insights"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z"/></svg>Ask why</a><span class="ins-pg" id="insPg"></span></div>
56
- <!-- the North Star and its inputs (Iq8Overview): drawn only when a KR metric record has role north-star -->
57
- <section class="ins-ns" id="nsRow" aria-label="North Star" hidden></section>
58
- <!-- what PMOS drafted for this product (Iq8Suggest, Iq9Draft): shown only while a draft is running or waits for your ✓ -->
59
- <section class="ins-dr" id="draftBox" aria-label="Drafted metrics" hidden></section>
60
- <!-- Key results by objective, then the health budgets (Iq8Overview); goals as cards on a phone (Iq8Phone) -->
61
- <section class="ins-pane" id="pGoals" aria-label="Key results">
58
+ <!-- one column of Komorebi blocks (IntelligenceDS): the finding, the North Star, the drafted measures, the trends, Did it work?, Waiting on a source -->
59
+ <div class="ins-col" id="insCol">
60
+ <!-- What PMOS found: one finding at a time ("1 of 3", ‹ ›), and its drafted move as the expanded Suggestion with Change it first, Yes and No -->
61
+ <section class="pm-block ins-hero" id="insHero" aria-labelledby="hFound">
62
+ <div class="head"><span class="ins-ad" aria-hidden="true"><svg class="pm-ic pm-star" viewBox="0 0 24 24"><path d="M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z"/></svg></span><h2 class="pm-h-sm" id="hFound">What PMOS found</h2><span class="sp"></span><a class="pm-btn" id="askWhy" href="/premium.html?ask=insights" aria-label="Ask why" title="Ask why"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z"/></svg></a><span class="ins-pg" id="insPg"></span></div>
63
+ <div class="ins-txt" id="insText" aria-live="polite"><p class="ins-say"><b id="insEye"></b> <span id="brief">Reading the records.</span> <span id="insWhy"></span></p><div class="pm-sug x ins-mv" id="insMv" role="group" aria-label="PMOS suggests" hidden></div></div>
64
+ <span class="ins-hact" id="insAct"></span>
65
+ </section>
66
+ <!-- the North Star (a KR metric record with role north-star): its number and pace, the chart with its target line and a diamond on each ship day,
67
+ then its inputs and guardrails as small Numbers -->
68
+ <section class="pm-block ins-nsb" id="nsRow" aria-label="North Star" hidden></section>
69
+ <!-- the measures PMOS drafted for this product: shown only while a draft is running or waits for your ✓ -->
70
+ <section class="pm-block ins-dr" id="draftBox" aria-label="Drafted metrics" hidden></section>
71
+ <!-- Delivery trends: the Board's measures as tiles; Choose tiles; a press opens the tile, its target popover sets the target -->
72
+ <section class="pm-block ins-trb" id="trendBox" aria-labelledby="hTr" hidden></section>
73
+ <!-- Key results by objective, then the health budgets: they live on Goals, so on a desk they show only on a dashboard view, while picking a new
74
+ dashboard, or for an old ?tab=goals link. A phone keeps its goal cards. -->
75
+ <section class="pm-block list ins-pane" id="pGoals" aria-label="Key results">
62
76
  <div class="ins-tbl" id="goalTbl" role="table" aria-label="Key results"></div>
63
77
  <div class="ins-cards" id="goalCards" role="list" aria-label="Key results"></div>
64
78
  </section>
65
- <!-- Waiting on a source (U3): one row per source with the key results it unblocks and its one connect ✓. Hidden when nothing waits. -->
66
- <section class="ins-pane ins-wait" id="waitList" aria-labelledby="hWait" hidden></section>
67
- <!-- Did it work? (Iq8Overview): shipped work to judge and in its window, a drafted verdict with ✓ Keep; decided ones fold. Hidden when empty. -->
68
- <section class="ins-pane" id="pOutcomes" aria-label="Did it work?" hidden>
69
- <div class="ins-tbl" id="outTbl" role="table" aria-label="Did it work?"></div>
79
+ <!-- Did it work?: shipped work to judge and in its window, PMOS's verdict with ✓ Keep; decided ones fold. Hidden when empty. -->
80
+ <section class="pm-block ins-pane" id="pOutcomes" aria-labelledby="hOut" hidden>
81
+ <div class="ins-otb" id="outTbl"></div>
70
82
  </section>
71
- <!-- Lab (idle lab B+C, canvas I1 IlBC): the ✦ that fit no initiative, the week's record of every background job, the keep rate, next time.
72
- Hidden until there is something (pm/cozy-lab-ins.js). -->
73
- <section class="ins-pane lab-sec" id="pLab" aria-labelledby="hLab" hidden></section>
83
+ <!-- Waiting on a source: a key result with no reading, so not in the charts; Connect or open it. Hidden when nothing waits. -->
84
+ <section class="pm-block ins-pane ins-wait" id="waitList" aria-labelledby="hWait" hidden></section>
85
+ <!-- Lab: the ✦ that fit no initiative, the week's record of every background job, the keep rate, next time (pm/cozy-lab-ins.js). -->
86
+ <section class="pm-block ins-pane lab-sec" id="pLab" aria-labelledby="hLab" hidden></section>
87
+ </div>
74
88
  </main>
75
89
 
76
90
  <!-- Reports and dashboards (⋯; the old Library): Found in your work, requests from Home, the reports, then the dashboards -->