create-pmos 0.429.0 → 0.430.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 (67) hide show
  1. package/package.json +13 -13
  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/briefing-premium-board-test.js +2 -2
  8. package/workspace/briefing-premium-insights-test.js +1 -1
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/guide/adler.md +45 -0
  11. package/workspace/guide/briefing-premium.md +2 -0
  12. package/workspace/guide/home.md +2 -2
  13. package/workspace/guide/index.md +1 -0
  14. package/workspace/guide/metric-drafts.md +2 -1
  15. package/workspace/guide/programs.md +2 -0
  16. package/workspace/intelligence-gaps-ui-test.js +168 -0
  17. package/workspace/lib/initiative-writer.js +16 -2
  18. package/workspace/lib/insight-moves.js +135 -0
  19. package/workspace/lib/insights-premium.js +4 -3
  20. package/workspace/lib/intel-report.js +16 -3
  21. package/workspace/lib/metric-drafts.js +32 -2
  22. package/workspace/lib/page-opens.js +74 -0
  23. package/workspace/lib/report-setups.js +1 -1
  24. package/workspace/lib/route-modules.js +2 -0
  25. package/workspace/lib/routes-insight-moves.js +119 -0
  26. package/workspace/lib/routes-insights-premium.js +10 -1
  27. package/workspace/lib/routes-metric-drafts.js +10 -1
  28. package/workspace/lib/routes-page-opens.js +26 -0
  29. package/workspace/lib/routes-report-setups.js +6 -1
  30. package/workspace/lib/settings-store.js +6 -0
  31. package/workspace/metric-drafts-ui-test.js +4 -4
  32. package/workspace/milestone-suggest-test.js +4 -4
  33. package/workspace/package-lock.json +2 -2
  34. package/workspace/package.json +1 -1
  35. package/workspace/premium-viewer-flicker-test.js +1 -1
  36. package/workspace/public/pm/bd-prog-panel.js +3 -3
  37. package/workspace/public/pm/bd-prog.js +2 -2
  38. package/workspace/public/pm/cozy-adler.css +82 -0
  39. package/workspace/public/pm/cozy-adler.js +270 -0
  40. package/workspace/public/pm/cozy-ev.css +3 -0
  41. package/workspace/public/pm/cozy-home.css +4 -0
  42. package/workspace/public/pm/cozy-insights.css +15 -1
  43. package/workspace/public/pm/cozy-nav.js +2 -0
  44. package/workspace/public/pm/cozy-search.js +4 -2
  45. package/workspace/public/pm/cozy-settings.js +15 -2
  46. package/workspace/public/pm/cozy-today.css +15 -0
  47. package/workspace/public/pm/cozy.css +16 -0
  48. package/workspace/public/pm/home-app.js +7 -9
  49. package/workspace/public/pm/home-chat.js +10 -2
  50. package/workspace/public/pm/home-day.js +39 -16
  51. package/workspace/public/pm/home-today.js +5 -3
  52. package/workspace/public/pm/ini-view-model.js +1 -1
  53. package/workspace/public/pm/ini-view.css +6 -0
  54. package/workspace/public/pm/ini-view.js +13 -0
  55. package/workspace/public/pm/metric-drafts.css +7 -0
  56. package/workspace/public/pm/metric-drafts.js +46 -7
  57. package/workspace/public/pm/ms-suggest.js +2 -1
  58. package/workspace/public/pm/premium-board.js +2 -2
  59. package/workspace/public/pm/premium-insights.js +76 -10
  60. package/workspace/public/pm/premium-vw-cal.js +1 -1
  61. package/workspace/public/pm/premium-welcome.js +3 -2
  62. package/workspace/public/pm/premium.css +3 -0
  63. package/workspace/public/pm/program-model.js +7 -0
  64. package/workspace/public/pm/split-merge.js +2 -1
  65. package/workspace/public/premium-intelligence.html +1 -1
  66. package/workspace/test-lists/intelligence-gaps-ui.json +5 -0
  67. package/workspace/test-lists/intelligence-gaps.json +5 -0
@@ -32,7 +32,7 @@ import * as V from './bd-views.js';
32
32
  import * as WF from './bd-wf.js';
33
33
  import * as Asks from './bd-asks.js';
34
34
  import * as PG from './bd-prog.js';
35
- import { programOf } from './program-model.js';
35
+ import { programOf, liveRows } from './program-model.js';
36
36
  import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
37
37
  import * as VW from './cozy-viewer.js';
38
38
  import * as PP from './bd-prog-panel.js';
@@ -671,7 +671,7 @@ async function loadOthers() {
671
671
  let a = null; try { a = await (await fetch('/api/board-premium?ws=' + encodeURIComponent(w) + '&board=' + encodeURIComponent(b.id), { credentials: 'same-origin' })).json(); } catch { a = null; }
672
672
  const m = a && a.ok && a.model; if (!m) continue; // still reading, or not read: the member stays "missing", never guessed
673
673
  const st = m.steps || [];
674
- XR[w] = { name: (m.board && (m.board.product || m.board.name)) || b.name, rows: (m.rows || []).filter((x) => x.id).map((x) => ({ id: x.id, title: x.title, stage: x.track && x.track.k >= 0 && st[x.track.k] ? st[x.track.k].key : x.stage, start: x.start || null, end: x.end || null })) };
674
+ XR[w] = { name: (m.board && (m.board.product || m.board.name)) || b.name, rows: liveRows(m).filter((x) => x.id).map((x) => ({ id: x.id, title: x.title, stage: x.track && x.track.k >= 0 && st[x.track.k] ? st[x.track.k].key : x.stage, start: x.start || null, end: x.end || null })) };
675
675
  }
676
676
  if (Object.keys(XR).length) drawInit();
677
677
  }
@@ -34,6 +34,7 @@ import * as PK from './cozy-pick.js'; // the one product picker Home, Board an
34
34
  import { openReport } from './premium-report-read.js';
35
35
  import { mountNav } from './cozy-nav.js';
36
36
  import { mountLivePill } from './cozy-live-pill.js';
37
+ import * as AD from './cozy-adler.js'; // Adler in Claude's ✦ line only, never in a chart (batch 16 item 2, canvas AdH3, AdM3)
37
38
  import * as RI from './premium-report-intel.js'; // a report made from Intelligence (batch 15 item 4): the header icon, the ✦ proposals, the draft panel
38
39
 
39
40
  let M = null; // the model
@@ -218,7 +219,16 @@ document.addEventListener('cz-viewer', (e) => {
218
219
  const d = e.detail || {}, id = d.open && /^goal:/.test(d.id || '') ? d.id.slice(5) : null;
219
220
  if ((new URLSearchParams(location.search).get('goal') || null) !== id) addr({ goal: id });
220
221
  });
221
- function setView(id) { dash = id; closeLib(); redraw(); }
222
+ function setView(id) { dash = id; closeLib(); redraw(); noteOpen(); }
223
+ /* the view on screen, noted once a day per view (feedback batch 16 item 1; POST /api/page-opens, local only): it is what lets the ✦ strip say
224
+ * "You open this every week" from a record, never from a guess. Portfolio is no one product's view, so it is not noted. */
225
+ const NOTED = new Set();
226
+ async function noteOpen() {
227
+ if (!M || PF || !M.board.ws) return;
228
+ const D = curDash(), view = D && D.saved ? 'dashboard:' + D.id : 'view', k = M.board.ws + '|' + view;
229
+ if (NOTED.has(k)) return; NOTED.add(k);
230
+ await Promise.resolve(pmPost('/api/page-opens', { ws: M.board.ws, page: 'intelligence', view })).catch(() => null);
231
+ }
222
232
 
223
233
  /* Portfolio: the goals of the ticked products (several ticked, batch 12 item 5), each product's model read once through GET /api/insights-premium,
224
234
  * grouped by product. A goal of another product keeps its own workspace, so a reading added to it goes there. Budgets, Outcomes and Library stay
@@ -341,38 +351,62 @@ const ABOUT = '<div class="ins-about"><p>Every goal is a KR metric record of thi
341
351
  + '<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>';
342
352
 
343
353
  /* ── 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
344
- * next one. Ask why takes the finding to Home. A finding carries a drafted move only when the engine has one: then ✓ makes it and Undo takes it
345
- * back. None has a move yet, so no ✓ is drawn rather than a press that does nothing. ── */
354
+ * 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,
355
+ * lib/insight-moves.js: chase the owner, anchor an initiative, move the date): the move is said under the reason, ✓ makes it (POST
356
+ * /api/insight-moves/apply, the server finds the move again by its sig) and Undo takes it back (/undo). A finding with no move draws no ✓. ── */
346
357
  let insIdx = 0;
347
358
  const insSkip = new Set(); // the findings put off with Not now, this visit only
348
359
  function stripList() {
349
360
  const I0 = M.insight || { none: true, text: '' };
350
361
  if (I0.none) return [{ text: I0.text, why: I0.why || '', none: true }].concat(PF ? [] : RI.stripItems());
351
- return [{ text: I0.text, why: I0.why || '', chart: I0.chart }].concat((I0.more || []).map((x) => ({ text: x.text, why: '', chart: x.chart })), PF ? [] : RI.stripItems());
362
+ return [{ text: I0.text, why: I0.why || '', chart: I0.chart, move: I0.move || null }].concat((I0.more || []).map((x) => ({ text: x.text, why: x.why || '', chart: x.chart, move: x.move || null })), PF ? [] : RI.stripItems());
352
363
  }
353
364
  function drawStrip() {
354
365
  const G = goalsShown(), behind = G.filter((g) => g.tone === 'late' || g.tone === 'red').length;
355
- $('#insEye').textContent = ''; $('#insAct').innerHTML = ''; $('#insPg').innerHTML = '';
366
+ $('#insEye').textContent = ''; $('#insAct').innerHTML = ''; $('#insPg').innerHTML = ''; $('#insMv').hidden = true; $('#insMv').innerHTML = ''; $('#insHero').classList.remove('mv');
356
367
  if (PF) { $('#brief').textContent = '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; }
357
368
  const L = stripList(), open = L.map((f, i) => i).filter((i) => !insSkip.has(i));
358
369
  if (!open.includes(insIdx)) insIdx = open.length ? open[0] : 0;
359
370
  const f = L[insIdx];
360
371
  $('#brief').textContent = f.text;
361
372
  $('#insWhy').textContent = f.why || '';
373
+ // 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
374
+ // proposal, handled otherwise. The charts and KR rows below stay pure data.
375
+ const sp = $('#insHero .sp');
376
+ if (sp) { sp.classList.add('ad'); sp.innerHTML = AD.adler(f.report ? 'needs-you' : behind || /^Straight answer/.test(f.text) || AD.moodOfText(f.text) === 'honest' ? 'honest' : 'handled', 40, { label: false }); }
362
377
  $('#askWhy').href = homeAsk('insights', f.none ? 'Why is there no finding on my goals yet?' : 'Why? ' + f.text);
363
378
  $('#askWhy').hidden = !!f.report; $('#askWhy').style.display = f.report ? 'none' : ''; // a report Claude proposes carries its own presses: See the draft, Not now, ✓ Set it up
364
379
  if (f.report) $('#insAct').innerHTML = RI.stripActs(f.report);
380
+ const mv = !f.report && f.move ? f.move : null;
381
+ $('#insHero').classList.toggle('mv', !!mv);
382
+ if (mv) { $('#insMv').innerHTML = `${SV(I.spark)}<span>${esc(mv.text)}</span>`; $('#insMv').hidden = false; $('#insMv').classList.toggle('dn', !!mv.done); }
383
+ const mvAct = !mv ? '' : mv.done ? `<span class="cz-pill ok">Done</span><button type="button" class="cz-ib sm" data-mv="undo" aria-label="Undo: ${esc(mv.label)}" title="Undo">${SV(I.undo)}</button>`
384
+ : `<button type="button" class="cz-ib sm solid" data-mv="apply" aria-label="${esc(mv.label)}" title="${esc(mv.label)}">${SV(I.chk)}</button>`;
385
+ if (!f.report) $('#insAct').innerHTML = mvAct;
365
386
  if (open.length > 1) {
366
- if (!f.report) $('#insAct').innerHTML = `<button type="button" class="cz-ib sm" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>`;
387
+ if (!f.report) $('#insAct').innerHTML = `<button type="button" class="cz-ib sm" id="insNo" aria-label="Not now" title="Not now">${SV(I.x)}</button>` + mvAct;
367
388
  $('#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('');
368
389
  }
369
390
  }
370
391
  $('#insHero').addEventListener('click', async (e) => {
371
392
  if (e.target.closest('[data-rp]')) { await RI.stripPress(e); return; }
393
+ const b = e.target.closest('[data-mv]'); if (b) { await pressMove(b); return; }
372
394
  const d = e.target.closest('[data-ins]'); if (d) { insIdx = +d.dataset.ins; drawStrip(); return; }
373
395
  if (e.target.closest('#insNo')) { insSkip.add(insIdx); const L = stripList(), n = L.findIndex((x, i) => i > insIdx && !insSkip.has(i)); insIdx = n >= 0 ? n : L.findIndex((x, i) => !insSkip.has(i)); drawStrip(); }
374
396
  });
375
397
 
398
+ /** ✓ on a drafted move, or Undo on a made one. The server finds the move again by its sig; the toast carries Undo. */
399
+ async function pressMove(b) {
400
+ const f = stripList()[insIdx], mv = f && f.move; if (!mv || b.disabled) return;
401
+ b.disabled = true;
402
+ const undo = async () => { const r = await pmPost('/api/insight-moves/undo', { ws: M.board.ws, sig: mv.sig }); toast(r && r.ok ? 'Undone. It is as it was.' : (r && r.error) || 'It could not be undone.'); await load(); };
403
+ if (b.dataset.mv === 'undo') { await undo(); return; }
404
+ const r = await pmPost('/api/insight-moves/apply', { ws: M.board.ws, board: M.board.id, sig: mv.sig });
405
+ if (!r || r.ok !== true) { b.disabled = false; toast((r && r.error) || 'It could not be done. Nothing changed.'); return; }
406
+ toast(r.said || mv.said || 'Done.', { label: 'Undo', fn: undo });
407
+ await load();
408
+ }
409
+
376
410
  /* ── the North Star and its inputs (Iq8Overview): the KR metric record with role north-star, drawn as its number with the change against the
377
411
  * span before it and its readings as a line; the records with role input (and guardrail) as a list beside it, each with its change over the same
378
412
  * span. Every number is a reading. With no North Star the row is not drawn (zero is silence); Claude's drafts say what is missing. ── */
@@ -440,8 +474,8 @@ $('#nsRow').addEventListener('click', (e) => {
440
474
  });
441
475
 
442
476
  /* ── what Claude drafted (Iq8Suggest, Iq9Draft): GET /api/metric-drafts for this product. While a run drafts, the five steps and what it read;
443
- * once ready, each proposed metric with its Now, its Target, why that target and where it is measured, ✓ to track it and × to remove it, ✓ all for
444
- * the rest. A ✓ writes a KR metric record (lib/routes-metric-drafts.js); Undo takes it back. Nothing drafted: the box is not drawn. ── */
477
+ * once ready, each proposed metric with its Now, its Target, why that target and where it is measured, ✎ to edit its name, target and source in
478
+ * place (batch 16 item 1), ✓ to track it and × to remove it, ✓ all for the rest. A ✓ writes a KR metric record (lib/routes-metric-drafts.js); Undo takes it back. Nothing drafted: the box is not drawn. ── */
445
479
  let DR = null, drTimer = 0;
446
480
  const DR_STEPS = ['Read', 'Shape', 'Measure', 'Target', 'Ready'];
447
481
  async function draftsLoad() {
@@ -466,8 +500,9 @@ function drawDrafts() {
466
500
  let grp = '';
467
501
  const body = rows.map((r) => {
468
502
  const g = r.group !== grp ? `<div class="ins-grp" role="row"><span role="cell">${esc(r.group)}</span></div>` : ''; grp = r.group;
503
+ if (r.state === 'open' && drEdit === r.id) return g + drEditRow(r);
469
504
  const src = r.ticket ? `<span class="cz-pill risk">${esc(r.ticket.text || (r.ticket.key + ' drafted'))}</span>` : r.source ? `<span class="note">${esc(r.source)}</span>` : '';
470
- const act = r.state === 'open' ? `<button type="button" class="cz-ib sm" data-dr="drop" data-row="${esc(r.id)}" aria-label="Remove ${esc(r.name)}" title="Remove">${SV(I.x)}</button><button type="button" class="cz-ib sm solid" data-dr="keep" data-row="${esc(r.id)}" aria-label="Track ${esc(r.name)}" title="Track this metric">${SV(I.chk)}</button>`
505
+ const act = r.state === 'open' ? `<button type="button" class="cz-ib sm" data-dr="edit" data-row="${esc(r.id)}" aria-label="Edit ${esc(r.name)}" title="Edit">${SV(I.pen)}</button><button type="button" class="cz-ib sm" data-dr="drop" data-row="${esc(r.id)}" aria-label="Remove ${esc(r.name)}" title="Remove">${SV(I.x)}</button><button type="button" class="cz-ib sm solid" data-dr="keep" data-row="${esc(r.id)}" aria-label="Track ${esc(r.name)}" title="Track this metric">${SV(I.chk)}</button>`
471
506
  : `<span class="cz-pill ${r.state === 'kept' ? 'ok' : 'q'}">${r.state === 'kept' ? 'Tracking' : 'Removed'}</span><button type="button" class="cz-ib sm" data-dr="undo" data-row="${esc(r.id)}" aria-label="Undo" title="Undo">${SV(I.undo)}</button>`;
472
507
  return g + `<div class="ins-tr ins-row ins-dcols${r.state === 'dropped' ? ' gone' : ''}" role="row"><div class="nm" role="cell"><b>${esc(r.name)}</b>${r.type ? `<small><span class="cz-pill q ins-type">${esc(r.type)}</span></small>` : ''}</div>`
473
508
  + `<div role="cell"><b>${esc(r.nowTxt || '—')}</b></div><div role="cell"><b>${esc(r.targetTxt || '—')}</b></div><div role="cell" class="note">${esc(r.why || '')}</div><div role="cell">${src}</div><div role="cell" class="ins-act">${act}</div></div>`;
@@ -477,9 +512,40 @@ function drawDrafts() {
477
512
  box.innerHTML = `<div class="ins-drh"><span class="sp" aria-hidden="true">${SV(I.spark)}</span><div><b>${esc(head)}</b>${!busy && DR.sub ? `<span class="note">${esc(DR.sub)}</span>` : ''}</div>${tools}</div>${busy ? steps : ''}${reads}${table}${!busy && DR.src ? `<p class="note">Read: ${esc(DR.src)}</p>` : ''}`;
478
513
  box.hidden = false;
479
514
  }
515
+ /* the inline edit of an open draft (batch 16 item 1): its name, its target and where it is measured, in place on the row; ✓ saves (POST
516
+ * /api/metric-drafts/edit), × puts it back, and the chat icon asks Claude in Home for anything else (the why, the group, a new metric). */
517
+ let drEdit = null;
518
+ function drEditRow(r) {
519
+ const askQ = 'Change the drafted metric ' + r.name + ': ';
520
+ const tgt = r.type === 'Done or not' ? `<b>${esc(r.targetTxt || 'Done')}</b>` : `<input class="ins-dri" data-drf="target" inputmode="decimal" value="${esc(r.target == null ? '' : String(r.target))}" aria-label="Target of ${esc(r.name)}"${r.unit || r.type === 'Percentage' ? ` placeholder="${esc(r.type === 'Percentage' ? '%' : r.unit)}"` : ''}>`;
521
+ return `<div class="ins-tr ins-row ins-dcols ins-dred" role="row" data-dred="${esc(r.id)}"><div class="nm" role="cell"><input class="ins-dri" data-drf="name" value="${esc(r.name)}" maxlength="80" aria-label="Name"></div>`
522
+ + `<div role="cell"><b>${esc(r.nowTxt || '—')}</b></div><div role="cell">${tgt}</div><div role="cell" class="note">${esc(r.why || '')}</div>`
523
+ + `<div role="cell"><input class="ins-dri" data-drf="source" value="${esc(r.source || '')}" maxlength="40" aria-label="Measured by" placeholder="Measured by"></div>`
524
+ + `<div role="cell" class="ins-act"><a class="cz-ib sm" href="${esc(homeAsk('insights', askQ))}" aria-label="Ask Claude in Home to change something else" title="Ask Claude in Home">${SV('M4 5h16v11H9l-5 4z')}</a>`
525
+ + `<button type="button" class="cz-ib sm" data-dr="cancel" data-row="${esc(r.id)}" aria-label="Cancel the edit" title="Cancel">${SV(I.x)}</button><button type="button" class="cz-ib sm solid" data-dr="save" data-row="${esc(r.id)}" aria-label="Save ${esc(r.name)}" title="Save">${SV(I.chk)}</button></div></div>`;
526
+ }
527
+ $('#draftBox').addEventListener('keydown', (e) => {
528
+ const f = e.target.closest('[data-drf]'); if (!f) return;
529
+ const ed = f.closest('[data-dred]');
530
+ if (e.key === 'Enter') { e.preventDefault(); const s = ed && ed.querySelector('[data-dr="save"]'); if (s) s.click(); }
531
+ if (e.key === 'Escape') { e.preventDefault(); drEdit = null; drawDrafts(); }
532
+ });
480
533
  $('#draftBox').addEventListener('click', async (e) => {
481
534
  const b = e.target.closest('[data-dr]'); if (!b || b.disabled || !DR) return;
482
535
  const k = b.dataset.dr, row = b.dataset.row || null, r0 = row ? (DR.rows || []).find((x) => x.id === row) : null;
536
+ if (k === 'edit') { drEdit = row; drawDrafts(); const n = $('#draftBox').querySelector(`[data-dred="${CSS.escape(row)}"] [data-drf="name"]`); if (n) { n.focus(); n.select(); } return; }
537
+ if (k === 'cancel') { drEdit = null; drawDrafts(); return; }
538
+ if (k === 'save') {
539
+ const ed = b.closest('[data-dred]'), val = (f) => { const x = ed && ed.querySelector(`[data-drf="${f}"]`); return x ? x.value : undefined; };
540
+ const body = { ws: M.board.ws, scope: 'product', id: M.board.ws, row, name: val('name'), source: val('source') };
541
+ if (val('target') !== undefined) body.target = val('target');
542
+ b.disabled = true;
543
+ const res = await pmPost('/api/metric-drafts/edit', body);
544
+ if (!res || res.ok !== true) { b.disabled = false; toast((res && res.error) || 'It could not be saved. Nothing changed.'); return; }
545
+ drEdit = null; toast(res.changed ? 'Saved. Track it to keep it as you wrote it.' : 'Nothing changed.');
546
+ await draftsLoad();
547
+ return;
548
+ }
483
549
  b.disabled = true;
484
550
  const res = await pmPost('/api/metric-drafts/' + k, Object.assign({ ws: M.board.ws, scope: 'product', id: M.board.ws }, row ? { row } : {}));
485
551
  if (!res || res.ok !== true) { b.disabled = false; toast((res && res.error) || 'It could not be done. Nothing changed.'); return; }
@@ -1570,7 +1636,7 @@ async function load() {
1570
1636
  // an old tab link (Insights had Goals, Outcomes and Library): it lands on the section or the panel, once
1571
1637
  if (first) { const t = new URLSearchParams(location.search).get('tab'); if (t === 'outcomes' || t === 'library') setTab(t); }
1572
1638
  if (first) draftsLoad();
1573
- if (!PF) RI.loadProposals(M.board.ws, M.board.id).then(() => { if (M) drawStrip(); });
1639
+ if (!PF) { await noteOpen(); RI.loadProposals(M.board.ws, M.board.id).then(() => { if (M) drawStrip(); }); }
1574
1640
  }
1575
1641
  /* a report from Intelligence (batch 15 item 4): the view on screen is its first scope; a saved dashboard is its own */
1576
1642
  RI.mount({ model: () => (PF ? null : M), scope: () => { const D = curDash(); return D && D.saved ? 'dashboard:' + D.id : 'view'; }, viewer, close: () => closeMenus(), reload: () => load(),
@@ -214,7 +214,7 @@ export function dayModel(W, notes, picked, today, now = Date.now()) {
214
214
  const status = n && n.state === 'ended' ? 'notes ready' : '';
215
215
  const who = (r.who || []).slice(0, 3).join(', ') + ((r.who || []).length > 3 ? ' and ' + ((r.who || []).length - 3) + ' more' : '');
216
216
  const ended = !n && Number.isFinite(end) && end < now;
217
- return { kind: 'event', t: Number.isFinite(at) ? at : 0, time: hasTime(r.at) ? hmOf(r.at) : 'All day', title: r.title, sub: [about || 'Not linked', status, soon].filter(Boolean).join(' · '), who, chip, k, next, ended, linked: !!about || linked, row: r, note: n ? n.id : '', mins: hasTime(r.at) && Number.isFinite(end) && end > at ? Math.round((end - at) / 60000) : 0 };
217
+ return { kind: 'event', t: Number.isFinite(at) ? at : 0, time: hasTime(r.at) ? hmOf(r.at) : 'All day', title: r.title, sub: [about || 'Not linked', status, soon].filter(Boolean).join(' · '), who, chip, k, next, ended, linked: !!about || linked, row: r, note: n ? n.id : '', mins: hasTime(r.at) && Number.isFinite(end) && end > at && end - at < 864e5 ? Math.round((end - at) / 60000) : 0 };
218
218
  });
219
219
  for (const n of N) {
220
220
  const m = n.meeting;
@@ -6,6 +6,7 @@
6
6
  * Text taken from the scanned folder is untrusted: every value goes through esc() and no quoted file text is shown. The pure half is premium-welcome-model.js. */
7
7
  import { pmGet, pmPost } from './http.js';
8
8
  import * as W from './premium-welcome-model.js';
9
+ import { adlerScene, prefs as adPrefs } from './cozy-adler.js'; // Adler says hello once (batch 16 item 2, canvas AdH6), and reads with his glasses on
9
10
 
10
11
  const $ = (s, r = document) => r.querySelector(s);
11
12
  const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -99,7 +100,7 @@ const err = () => (S.error ? `<p class="wl-err" role="alert">${esc(S.error)}</p>
99
100
  function viewAbout() {
100
101
  const a = S.about;
101
102
  const f = (k, text, hint, max) => `<label>${text}<input data-f="${k}" maxlength="${max}" value="${esc(a[k])}" placeholder="${esc(hint)}" autocomplete="off"></label>`;
102
- return `<h1 id="wlH" tabindex="-1">Welcome to PMOS</h1><p class="wl-lede">Tell PMOS who you are, so your Briefing knows what matters to you. Every field is optional, and you can change them later in the console's Settings.</p>
103
+ return `<div class="wl-ad">${adlerScene('morning', 'needs-you', { label: 'Adler says hello' })}</div>${adPrefs()['adler.amount'] === 'off' ? '' : '<p class="wl-hi">Hi, I’m Adler. I do the boring bits, so you get the calls only you can make.</p>'}<h1 id="wlH" tabindex="-1">Welcome to PMOS</h1><p class="wl-lede">Tell PMOS who you are, so your Briefing knows what matters to you. Every field is optional, and you can change them later in the console's Settings.</p>
103
104
  <div class="wl-f">${f('name', 'Your name', 'For example: Dana', 40)}${f('role', 'Your role', 'For example: Senior PM, Payments', 80)}${f('work', 'What you do', 'In one line, for example: I run checkout and the payment methods', 200)}
104
105
  <label>Your job description<textarea data-f="duties" maxlength="1000" placeholder="What you own, decide and deliver. Paste it from your job description if you have one.">${esc(a.duties)}</textarea></label></div>${err()}`
105
106
  + foot('', btn('about', 'Continue', { busy: 'about', busyText: 'Saving' }));
@@ -115,7 +116,7 @@ function viewSources() {
115
116
  const rows = [`<li class="wl-row"><span class="wl-ic">${I.folder}</span><span><b>${esc(f.name || 'This folder')}</b><span class="path">${esc(f.root)}</span></span><span class="chip">this folder</span></li>`]
116
117
  .concat(S.added.map((a) => `<li class="wl-row"><span class="wl-ic">${I.folder}</span><span><b>${esc(a.name)}</b><span class="path">${esc(a.root)}</span></span><span></span></li>`)).join('');
117
118
  if (S.busy === 'scan') {
118
- return `<h1 id="wlH" tabindex="-1">Reading ${esc(f.name || 'your folder')}</h1><p class="wl-lede">A large folder can take a minute or two. The rest of PMOS keeps working.</p>
119
+ return `<div class="wl-ad">${adlerScene('think', 'thinking', { label: false })}</div><h1 id="wlH" tabindex="-1">Reading ${esc(f.name || 'your folder')}</h1><p class="wl-lede">A large folder can take a minute or two. The rest of PMOS keeps working.</p>
119
120
  <div class="wl-scan" role="status"><div>${spin('Starting the tools you ticked, then reading the folder')}</div></div>`;
120
121
  }
121
122
  return `<h1 id="wlH" tabindex="-1">Where does your work live?</h1><p class="wl-lede">PMOS reads your folders and the tools you tick, then shows you your initiatives, your documents and what needs you first.</p>
@@ -2682,3 +2682,6 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2682
2682
  .askfoot{margin:8px 0 0;font-size:var(--fs-2);color:var(--ink-3)}
2683
2683
  /* chat-open-in-terminal: the header's terminal icon shows only while the dialog has a session to open or resume */
2684
2684
  #dTerm[hidden]{display:none}
2685
+ /* Adler on the Welcome page (batch 16 item 2, canvas AdH6): the scene once, over the first step */
2686
+ .wl-ad{max-width:420px;margin:0 0 12px}
2687
+ .wl-hi{margin:0 0 6px;font-weight:600;color:var(--ink)}
@@ -64,6 +64,13 @@ export function milestoneStep(row, m) {
64
64
  return s ? { key: s.key, label: s.name, at: -1, date: day } : { key: 'deliver', label: 'Deliver', at: DELIVER, date: day };
65
65
  }
66
66
 
67
+ /** A Board model's rows without its cancelled and archived initiatives. The model's `rows` carries those too (the search and the
68
+ * "Cancelled and archived" panel read them there), so a program read from it showed them as live members (batch 16 item 9). */
69
+ export function liveRows(model) {
70
+ const G = (model && model.initiatives && model.initiatives.gone) || {};
71
+ const gone = new Set([...(G.cancelled || []), ...(G.archived || [])].map((r) => r && r.id).filter(Boolean));
72
+ return ((model && model.rows) || []).filter((r) => r && !gone.has(r.id));
73
+ }
67
74
  export function programOf(programs, ws, ini) {
68
75
  return (programs || []).find((p) => (p.members || []).some((m) => m.initiative === ini && (!m.ws || !ws || m.ws === ws))) || null;
69
76
  }
@@ -18,6 +18,7 @@
18
18
  * selected and opened; after a merge the one that stays is. Both toasts carry Undo (POST /api/initiatives/sm-undo), which puts both back.
19
19
  * On a phone the Viewer is the full-screen sheet, so the card and both views are the phone sheet too. CSS: pm/split-merge.css, loaded here. */
20
20
  import * as VW from './cozy-viewer.js';
21
+ import { adler } from './cozy-adler.js'; // Adler holds the suggestion (batch 16 item 2, canvas AdU2, AdM2)
21
22
 
22
23
  const CSS = new URL('./split-merge.css', import.meta.url).href;
23
24
  if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
@@ -58,7 +59,7 @@ export function cardHtml(sg, title) {
58
59
  ? [[ICON.scissors, sg.name, countText(sg.counts || {})], [ICON.stay, 'Stays here', sg.stays || '']]
59
60
  : [[ICON.stay, sg.intoTitle + ' stays', sg.reason ? 'Because ' + sg.reason : ''], [ICON.merge, (title || 'This one') + ' closes', 'Its work moves; its chats, run log and history stay']];
60
61
  const ok = split ? 'Split as suggested' : 'Merge as suggested';
61
- return `<section class="sm-card" role="region" aria-label="${esc('Claude suggests: ' + sg.title)}"><div class="sm-h">${SVG(ICON.spark, 15)}<b>${esc(sg.title)}</b></div>`
62
+ return `<section class="sm-card" role="region" aria-label="${esc('Claude suggests: ' + sg.title)}"><div class="sm-h">${adler('needs-you', 36, { label: false })}<b>${esc(sg.title)}</b></div>`
62
63
  + (sg.why ? `<p class="sm-why">${esc(sg.why)}</p>` : '')
63
64
  + lines.map(([d, b, t]) => `<div class="sm-pl">${SVG(d, 15)}<span><b>${esc(b)}</b>${t ? ' · ' + esc(t) : ''}</span></div>`).join('')
64
65
  + `<div class="sm-acts"><button type="button" class="sm-ib" data-sm="no" aria-label="Not now" title="Not now">${SVG(ICON.x, 16)}</button>`
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
 
51
51
  <!-- 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 -->
52
- <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></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="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z"/></svg>Ask why</a><span class="ins-pg" id="insPg"></span></div>
52
+ <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="M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z"/></svg>Ask why</a><span class="ins-pg" id="insPg"></span></div>
53
53
  <!-- the North Star and its inputs (Iq8Overview): drawn only when a KR metric record has role north-star -->
54
54
  <section class="ins-ns" id="nsRow" aria-label="North Star" hidden></section>
55
55
  <!-- what Claude drafted for this product (Iq8Suggest, Iq9Draft): shown only while a draft is running or waits for your ✓ -->
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "Batch 16 item 1 (client): the ✦ strip's drafted move with ✓, Done and Undo; the weekly report proposal from page opens; a metric draft edited in place on Intelligence and on the program card; the type scale and the phone. The write routes are stubbed.",
3
+ "panels": ["intelligence-gaps-ui-test.js"],
4
+ "seconds": { "intelligence-gaps-ui-test.js": 20 }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "_comment": "Batch 16 item 1: the three 0.429.0 Intelligence gaps in process: the ✦ strip's drafted move (chase, anchor, date) and its apply/undo routes, the inline edit of a metric draft, page opens and the weekly report proposal.",
3
+ "modules": ["intelligence-gaps.test.js"],
4
+ "seconds": { "intelligence-gaps.test.js": 3 }
5
+ }