create-pmos 0.442.0 → 0.443.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 (49) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/changelog.json +12 -0
  7. package/workspace/goals-clear-ui-test.js +249 -0
  8. package/workspace/guide/home.md +7 -2
  9. package/workspace/guide/metric-drafts.md +8 -2
  10. package/workspace/home-railcard-test.js +193 -0
  11. package/workspace/intelligence-gaps-ui-test.js +16 -14
  12. package/workspace/lib/engine/records/index.js +9 -2
  13. package/workspace/lib/initiative-layout.js +3 -1
  14. package/workspace/lib/insights-premium.js +22 -1
  15. package/workspace/lib/metric-drafts.js +37 -10
  16. package/workspace/lib/metric-read-runs.js +20 -13
  17. package/workspace/lib/metric-reads.js +208 -23
  18. package/workspace/lib/metrics-cli.js +62 -5
  19. package/workspace/lib/routes-goal-status.js +89 -6
  20. package/workspace/lib/routes-insights-premium.js +1 -1
  21. package/workspace/lib/routes-metric-drafts.js +26 -3
  22. package/workspace/metric-drafts-ui-test.js +5 -2
  23. package/workspace/okr-goals-ui-test.js +7 -5
  24. package/workspace/package-lock.json +2 -2
  25. package/workspace/package.json +1 -1
  26. package/workspace/premium-board-actions-test.js +2 -2
  27. package/workspace/public/pm/cozy-insights.css +82 -0
  28. package/workspace/public/pm/cozy-live-pill.css +5 -0
  29. package/workspace/public/pm/cozy-today.css +15 -0
  30. package/workspace/public/pm/cozy-viewer.js +42 -14
  31. package/workspace/public/pm/cozy-vw-shell.css +4 -0
  32. package/workspace/public/pm/goals-clear.js +258 -0
  33. package/workspace/public/pm/home-app.js +51 -3
  34. package/workspace/public/pm/home-today.js +51 -10
  35. package/workspace/public/pm/ini-groups.js +14 -8
  36. package/workspace/public/pm/ini-tasks.js +47 -13
  37. package/workspace/public/pm/ini-view-model.js +37 -14
  38. package/workspace/public/pm/ini-view.css +29 -4
  39. package/workspace/public/pm/ini-view.js +9 -6
  40. package/workspace/public/pm/metric-drafts.js +4 -1
  41. package/workspace/public/pm/mission.js +11 -7
  42. package/workspace/public/pm/premium-insights.js +178 -24
  43. package/workspace/server.js +6 -2
  44. package/workspace/skills/metric-read.skill +7 -5
  45. package/workspace/stage-card-test.js +11 -3
  46. package/workspace/task-views-test.js +190 -1
  47. package/workspace/test-lists/goals-clear.json +15 -0
  48. package/workspace/test-lists/home-railcard.json +9 -0
  49. package/workspace/tk-tasks-test.js +2 -2
@@ -39,6 +39,7 @@ import * as AD from './cozy-adler.js'; // Adler in Claude's ✦ line only, nev
39
39
  import * as RL from './ready-lib.js'; // the ready-made reports of every program, product and initiative (batch 17 item 1, PbA6, PbG4)
40
40
  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
41
41
  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
42
+ import * as GC from './goals-clear.js'; // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
42
43
 
43
44
  let M = null; // the model
44
45
  let BM = null, bmErr = ''; // the Board measures (Delivery trends)
@@ -386,8 +387,14 @@ const listGoals = () => (PF ? [] : M.goals.filter((g) => isOwnKr(g) && (g.role =
386
387
  /** The ✦ line (GsM1–M5): the one thing that matters this week, from lib/goal-status.js (model.okr.line) or said from the goals and drafts. It is
387
388
  * the strip's first item; the findings and the reports Claude proposes follow it. It never says "There is no insight yet". */
388
389
  function okrLine() {
389
- const run = DR && DR.run;
390
- return OK.lineOf({ okr: M.okr, goals: listGoals(), budgets: M.budgets || [], drafts: drAll(), running: !!(run && run.state === 'running'), failed: run && run.state === 'failed' ? (run.error || 'The run failed') : null, product: M.board.name });
390
+ const run = DR && DR.run, running = !!(run && run.state === 'running');
391
+ const base = OK.lineOf({ okr: M.okr, goals: listGoals(), budgets: M.budgets || [], drafts: drAll(), running, failed: run && run.state === 'failed' ? (run.error || 'The run failed') : null, product: M.board.name });
392
+ if (running || base.tone === 'crit') return base;
393
+ // batch 18 item 11 (GcJ1aTable, GcJ2FirstMonday, GcR4Failed, GcR5Held): a held reading, a failed read or the first readings are the news; else
394
+ // the drafted metrics in the table say what Claude drafted. ✓✓ still keeps every open draft.
395
+ // A goal behind its line stays the news over the drafts; the drafts line replaces only a line about drafts or a calm one.
396
+ const news = GC.lineOf(listGoals(), M.board.name) || (base.tone === 'drafts' || base.tone === 'calm' ? GC.draftsLine(tableRows(), M.board.name) : null);
397
+ return news ? Object.assign({}, news, { keepAll: Math.max(news.keepAll || 0, base.keepAll || 0) }) : base;
391
398
  }
392
399
  function stripList() {
393
400
  const I0 = M.insight || { none: true, text: '' };
@@ -461,6 +468,7 @@ const nsGoal = () => (PF ? null : M.goals.find((g) => g.role === 'north-star' &&
461
468
  * chart is in the Viewer and its inputs are in the more menu, Metrics, as a tree. A drafted North Star (or a drafted input or guardrail) that is not a
462
469
  * record yet is a hollow row with its keep press. Nothing to show: the card is not drawn (zero is silence). */
463
470
  function nsMeta(g) {
471
+ const lk = rowLook(g); if (lk.meta) return lk.meta;
464
472
  if (g.reading && g.reading.txt) return OK.metaOf(g, today());
465
473
  const S = g.series || [];
466
474
  if (!S.length) return OK.metaOf(g, today());
@@ -471,10 +479,10 @@ function nsMeta(g) {
471
479
  function drawNs() {
472
480
  const box = $('#nsRow');
473
481
  if (!M || PF) { box.hidden = true; box.innerHTML = ''; return; }
474
- const g = nsGoal(), loose = looseDrafts().filter((r) => r.kind === 'metric' && (r.group === 'North Star' || r.group === 'Inputs' || r.group === 'Guardrails'));
475
- if (!g && !loose.length) { box.hidden = true; box.innerHTML = ''; return; }
476
- const rows = (g ? OK.rowHtml(g, { meta: nsMeta(g), drafts: draftsFor(g.id), drawDraft: drHtml, noOwner: !OK.whoOf(g), today: today() }) : '')
477
- + loose.map((r) => (drEdit === r.id ? `<div class="okr-row">${drEditHtml(r)}</div>` : OK.draftRowHtml(r))).join('');
482
+ // batch 18 item 11: a drafted North Star is a row of the drafts table, never a second North Star row here
483
+ const g = nsGoal();
484
+ if (!g) { box.hidden = true; box.innerHTML = ''; return; }
485
+ const rows = OK.rowHtml(g, Object.assign({ meta: nsMeta(g), drafts: draftsFor(g.id), drawDraft: drHtml, noOwner: !OK.whoOf(g), today: today() }, rowLook(g)));
478
486
  box.innerHTML = `<div class="okr-sec"><h2 class="okr-h">North Star</h2></div><div class="okr-card">${rows}</div>`;
479
487
  box.hidden = false; box.classList.add('okr-ns');
480
488
  }
@@ -497,7 +505,10 @@ async function draftsLoad() {
497
505
  }
498
506
  const drAll = () => OK.draftsOf(DR);
499
507
  /** The drafts under one goal row. */
500
- const draftsFor = (id) => drAll().filter((r) => r.goal === id);
508
+ // a held reading's drafted ticket (GcR5Held) and a failed read's reconnect (GcR4Failed) are said in the goal's panel, with the reading they
509
+ // are about: not again under the row
510
+ const draftsFor = (id) => { const g = M && M.goals.find((x) => x.id === id), H = g && (g.held || [])[0]; const fx = g && g.failed && g.failed.fix && g.failed.fix.row;
511
+ return drAll().filter((r) => r.goal === id && !(H && r.kind === 'ticket' && (!H.ticket || H.ticket === r.id)) && !(fx && r.id === fx)); };
501
512
  /** A draft with no goal on the list: a drafted North Star or key result is drawn as its own hollow row; inputs and guardrails sit in the North
502
513
  * Star card; anything else in the loose box under the ✦ line. */
503
514
  const looseDrafts = () => { const ids = new Set(M.goals.map((g) => g.id).concat((M.budgets || []).map((b) => b.id))); return drAll().filter((r) => !r.goal || !ids.has(r.goal)); };
@@ -520,9 +531,14 @@ function drawDrafts() {
520
531
  if (!M || PF) { box.hidden = true; box.innerHTML = ''; return; }
521
532
  const placed = new Set(['North Star', 'Inputs', 'Guardrails', 'Key results']);
522
533
  const L = looseDrafts().filter((r) => !(r.kind === 'metric' && placed.has(r.group)));
523
- box.innerHTML = L.length ? `<div class="okr-card">${L.map((r) => `<div class="okr-row">${drHtml(r)}</div>`).join('')}</div>` : '';
524
- box.hidden = !L.length;
534
+ // 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
535
+ // drafts follow it as before
536
+ const T = GC.tableHtml(tableRows(), { busy: tblBusy, sel: CHK && CHK.id });
537
+ box.innerHTML = T + (L.length ? `<div class="okr-card">${L.map((r) => `<div class="okr-row">${drHtml(r)}</div>`).join('')}</div>` : '');
538
+ box.hidden = !T && !L.length;
539
+ box.classList.toggle('gc-on', !!T);
525
540
  if (M) { drawStrip(); drawNs(); drawGoals(); }
541
+ if (CHK) CHK.draw();
526
542
  }
527
543
  /** One press on a draft: keep (its act), drop, edit, save, cancel or undo; keep-all from the ✦ line; start asks Claude to draft the goals. */
528
544
  async function draftPress(k, row, b) {
@@ -549,8 +565,9 @@ async function draftPress(k, row, b) {
549
565
  const name = r0 ? r0.text : 'it';
550
566
  // batch 18 item 4: say only what the server started. The run is in Sessions; the ✦ line follows it and says when it ends, or why it failed.
551
567
  const said = k === 'start' ? (res.already ? 'I am already drafting them. The drafts show here when I finish.' : 'Drafting now. Follow it in Sessions; the drafts show here when I finish.')
552
- : k === 'keep-all' ? 'Kept ' + (res.kept || 'them all') + '. I read them from now on.'
553
- : k === 'keep' ? (res.outbox ? (r0 && r0.kind === 'ticket' ? 'In the outbox for Jira.' : 'In the outbox. It goes as you.') : res.open === 'settings:connectors' ? 'Opening Connectors.' : 'Kept. I read it from now on.')
568
+ // batch 18 item 11: "Kept" names the goal's own rhythm (the server's rhythm.txt, else the recipe), never "every morning"
569
+ : k === 'keep-all' ? (res.rhythm && res.rhythm.txt ? 'Kept ' + (res.kept || 'them all') + '. I read them ' + res.rhythm.txt + '.' : GC.keptSay(tableRows()).replace(/^Kept\. I read it /, 'Kept. I read them '))
570
+ : k === 'keep' ? (res.outbox ? (r0 && r0.kind === 'ticket' ? 'In the outbox for Jira.' : 'In the outbox. It goes as you.') : res.open === 'settings:connectors' ? 'Opening Connectors.' : GC.keptSay(r0 && r0.kind === 'metric' ? [r0] : [], res.rhythm && res.rhythm.txt ? 'Kept. I read it ' + res.rhythm.txt + '.' : null))
554
571
  : k === 'drop' ? 'Not now: ' + name + '.' : k === 'undo' ? 'Undone.' : 'Done.';
555
572
  toast(said, k === 'keep' || k === 'drop' ? { label: 'Undo', fn: async () => { await pmPost('/api/metric-drafts/undo', Object.assign({ row }, base)); await load(); await draftsLoad(); } } : undefined);
556
573
  if (res.open === 'settings:connectors') import('./cozy-settings.js').then((S) => S.openSettings('connectors')).catch(() => {});
@@ -568,6 +585,114 @@ document.addEventListener('keydown', (e) => {
568
585
  if (e.key === 'Escape') { e.preventDefault(); drEdit = null; drawDrafts(); }
569
586
  });
570
587
 
588
+ /* ── goals made clear (batch 18 item 11, 11-B; frames Gc* on In development) ─────────────────────────────────────────────────────────
589
+ * The drafted metrics are one table (GcJ1aTable); a row opens its check panel in the Viewer card (GcJ1Drafts): how it is counted, the live read,
590
+ * Claude's checks, your number to compare (GcS3Differs), how often and the query, then ↗ ✎ ↻ and Keep. A kept goal with fewer than 3 readings says
591
+ * its reading with source and time and no pace yet (GcJ2FirstMonday); a read that failed or a reading that was held never shows as progress: the row
592
+ * keeps the last good reading and says what happened (GcR4Failed, GcR5Held). The reads are GET /api/metric-drafts and GET /api/insights-premium;
593
+ * the writes POST /api/goal-status/test, /read, /compare, /compare-pick and /file-held (lib/routes-goal-status.js), and the draft routes. */
594
+ const tableRows = () => (PF || !M ? [] : looseDrafts().filter((r) => r.kind === 'metric' && r.state === 'open' && ['North Star', 'Inputs', 'Guardrails', 'Key results'].includes(r.group)));
595
+ const tblBusy = new Set();
596
+ let CHK = null; // the check panel shown: { id, st, draw }
597
+ /** A goal row's look while its reading is not ordinary: a read that failed, a held reading, or the first readings (no pace, a grey dot). */
598
+ function rowLook(g) {
599
+ const base = () => OK.metaOf(g, today());
600
+ if (g.failed) return { meta: [base(), 'not read ' + GC.dayTxt(g.failed.at)].filter(Boolean).join(' · ') };
601
+ const H = (g.held || []).length; if (H) return { meta: [base(), H === 1 ? '1 reading held' : H + ' readings held'].join(' · ') };
602
+ if (GC.firstOf(g) && OK.dotOf(g) !== 'broken') return { meta: GC.firstMeta(g), dot: 'q' };
603
+ return {};
604
+ }
605
+ $('#draftBox').addEventListener('click', (e) => {
606
+ const b = e.target.closest('[data-gc]');
607
+ if (b) { e.stopPropagation(); if (!b.disabled) tablePress(b.dataset.gc, b.dataset.row, b); return; }
608
+ const r = e.target.closest('[data-gc-row]'); if (r) openCheck(r.dataset.gcRow);
609
+ });
610
+ $('#draftBox').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-gc-row]')) { e.preventDefault(); openCheck(e.target.dataset.gcRow); } });
611
+ async function tablePress(k, row, b) {
612
+ if (k !== 'keep' && k !== 'drop') return;
613
+ tblBusy.add(row); drawDrafts();
614
+ await draftPress(k, row, null);
615
+ tblBusy.delete(row); drawDrafts();
616
+ if (CHK && CHK.id === row && !drAll().some((x) => x.id === row && x.state === 'open')) closeViewer();
617
+ }
618
+ /** Reads the drafts again every 3 s until `until()` holds, at most `n` times: a live read or a compare is a run that ends on its own. */
619
+ async function followDrafts(until, n = 20) {
620
+ for (let i = 0; i < n; i++) { await new Promise((ok) => setTimeout(ok, 3000)); if (!CHK) return false; await draftsLoad(); if (until()) return true; }
621
+ return false;
622
+ }
623
+ /** The number the PM typed: "39k", "44,100", "94.1", "1.2m". NaN when it is not one. */
624
+ const typedNum = (raw) => { const m = /^([\d.,]+)\s*([kKmM%]?)$/.exec(String(raw || '').replace(/\s+/g, '')); return m ? Number(m[1].replace(/,/g, '')) * ({ k: 1e3, K: 1e3, m: 1e6, M: 1e6 }[m[2]] || 1) : NaN; };
625
+ /** The check panel of one drafted metric (GcJ1Drafts; GcS3Differs once a number was typed). */
626
+ function openCheck(id) {
627
+ const r0 = drAll().find((x) => x.id === id); if (!r0 || !M.board.ws) return;
628
+ const st = { compare: '', busy: false, msg: '', back: false, edit: false };
629
+ const rowOf = () => drAll().find((x) => x.id === id) || r0;
630
+ const base = { ws: M.board.ws, scope: 'product', id: M.board.ws };
631
+ let el = null;
632
+ const editHtml = (r) => `<form class="gc-ed" data-gc-ed><label class="ins-fl">Name<input class="ins-inp" name="name" maxlength="120" value="${esc(r.name)}"></label>`
633
+ + (r.raw && r.raw.type !== 'Done or not' ? `<label class="ins-fl">Target<input class="ins-inp" name="target" inputmode="decimal" maxlength="20" value="${esc(r.raw && r.raw.target != null ? String(r.raw.target) : '')}"></label>` : '')
634
+ + `<label class="ins-fl">Measured by<input class="ins-inp" name="source" maxlength="40" value="${esc(r.source || '')}"></label><div class="gc-foot"><a class="cz-ib sm" href="${esc(homeAsk('insights', 'Change how ' + r.name + ' is counted: '))}" aria-label="Ask Claude in Home to change how it is counted" title="Ask in Home">${SV('M4 5h16v11H9l-5 4z')}</a><span class="gc-sp"></span>`
635
+ + `<button type="button" class="cz-ib sm" data-gc="edit-x" aria-label="Cancel the edit" title="Cancel">${SV(I.x)}</button><button type="submit" class="cz-ib sm solid" aria-label="Save" title="Save">${SV(I.chk)}</button></div></form>`;
636
+ const draw = () => { if (!el || !document.contains(el)) return; const r = rowOf(), top = el.scrollTop; el.innerHTML = st.edit ? editHtml(r) : GC.checkHtml(r, st); el.scrollTop = top; };
637
+ CHK = { id, st, draw };
638
+ const post = (path, body) => pmPost(path, Object.assign({ ws: M.board.ws }, body)).catch(() => null);
639
+ const live = () => { const r = rowOf(); return r.raw && r.raw.live; };
640
+ const press = async (k) => {
641
+ const r = rowOf();
642
+ if (k === 'edit') { st.edit = true; draw(); const f = el.querySelector('[name="name"]'); if (f) f.focus(); return; }
643
+ if (k === 'edit-x') { st.edit = false; draw(); return; }
644
+ if (k === 'keep') { st.busy = true; draw(); await draftPress('keep', id, null); st.busy = false; if (!drAll().some((x) => x.id === id && x.state === 'open')) closeViewer(); else draw(); return; }
645
+ if (k === 'test') {
646
+ st.busy = true; st.msg = 'Reading it now. Nothing is kept until you keep it.'; draw();
647
+ const was = live() ? live().at : null, res = await post('/api/goal-status/test', { rows: [id] });
648
+ st.busy = false;
649
+ if (!res || res.ok !== true) { st.msg = (res && res.error) || 'It could not be read. Nothing changed.'; draw(); return; }
650
+ draw();
651
+ const got = await followDrafts(() => !!(live() && live().at && live().at !== was));
652
+ st.msg = got ? '' : 'Still reading. Follow it in Sessions; the number shows here when it lands.'; draw(); return;
653
+ }
654
+ if (k === 'pick' || k === 'pick-other') {
655
+ const sg = r.raw && r.raw.compare && r.raw.compare.suggest, want = sg && sg.keep === 'yours' ? 'yours' : 'mine';
656
+ const pick = k === 'pick' ? want : want === 'yours' ? 'mine' : 'yours';
657
+ st.busy = true; draw();
658
+ const res = await post('/api/goal-status/compare-pick', { goal: id, pick });
659
+ st.busy = false;
660
+ if (!res || res.ok !== true) { st.msg = (res && res.error) || 'It could not be saved. Nothing changed.'; draw(); return; }
661
+ st.back = true; st.compare = ''; st.msg = '';
662
+ toast(pick === 'yours' ? 'Done. “How it is counted” says it your way now.' : 'Done. I keep counting it my way.'); await draftsLoad();
663
+ }
664
+ };
665
+ const wire = (body) => {
666
+ el = body; el.classList.add('ins-vbody', 'gc-panel'); draw();
667
+ el.onclick = (e) => { const b = e.target.closest('[data-gc]'); if (b && !b.disabled) { e.preventDefault(); press(b.dataset.gc); } };
668
+ el.onsubmit = async (e) => {
669
+ e.preventDefault(); const f = e.target;
670
+ if (f.matches('[data-gc-ed]')) {
671
+ const body = { row: id, name: f.name.value, source: f.source.value }; if (f.target) body.target = f.target.value;
672
+ st.busy = true; const res = await pmPost('/api/metric-drafts/edit', Object.assign({}, base, body)).catch(() => null); st.busy = false;
673
+ if (!res || res.ok !== true) { toast((res && res.error) || 'It could not be saved. Nothing changed.'); return; }
674
+ st.edit = false; toast(res.changed === false ? 'Nothing changed.' : 'Saved. Keep it to read it as you wrote it.'); await draftsLoad(); return;
675
+ }
676
+ if (!f.matches('[data-gc-cmp]')) return;
677
+ const raw = String(f.v.value || '').trim(), v = typedNum(raw);
678
+ if (!Number.isFinite(v)) { st.msg = 'Type a number, for example 39k or 94.1.'; draw(); return; }
679
+ st.compare = raw; st.busy = true; st.back = false; st.msg = ''; draw();
680
+ const L = live();
681
+ const res = await post('/api/goal-status/compare', { goal: id, value: v, period: (L && L.period) || undefined });
682
+ st.busy = false;
683
+ if (!res || res.ok !== true) { st.msg = (res && res.error) || 'It could not be compared. Nothing changed.'; draw(); return; }
684
+ await draftsLoad();
685
+ const c = rowOf().raw && rowOf().raw.compare;
686
+ if (c && c.differs && !c.why) await followDrafts(() => { const x = rowOf().raw && rowOf().raw.compare; return !!(x && x.why); }, 10);
687
+ };
688
+ };
689
+ const body = vwOpen({ kind: 'Drafted metric', title: r0.name, sub: 'Check it before you keep it', icon: 'goal', id: 'draft:' + id,
690
+ more: [{ label: 'Not now', note: 'drop this draft', on: () => tablePress('drop', id, null) }],
691
+ onClose: () => { if (CHK && CHK.id === id) { CHK = null; drawDrafts(); } }, render: wire });
692
+ if (!body) { openSide({ kind: 'view', eye: 'Check it before you keep it', title: r0.name, body: '', note: '', go: null }); wire($('#sideBody')); }
693
+ drawDrafts();
694
+ }
695
+
571
696
  /* ── Reports and dashboards (⋯; the old Library tab) in a side panel: Found in your work, requests from Home, the reports, then the dashboards ── */
572
697
  let libBack = null;
573
698
  function openLib() {
@@ -639,7 +764,7 @@ function bandSvg(pts, lim, ceil, tone, label, w = 210, h = 40) {
639
764
  /* the goal list (GsM1–M5): Key results, then Health budgets, one row per goal: the dot, the outcome, the reading with its age, and the owner. No
640
765
  * sparkline and no initiative status on a row: the chart and what moves it are in the Viewer. The same list on a phone and a desktop. */
641
766
  const okrRow = (g, o = {}) => OK.rowHtml(g, Object.assign({ today: today(), drafts: PF ? [] : draftsFor(g.id), drawDraft: drHtml, mark: markHtml,
642
- selecting, sel: selecting && picked.includes(g.id), meta: PF ? [g.prod, OK.metaOf(g, today())].filter(Boolean).join(' · ') : undefined }, o));
767
+ selecting, sel: selecting && picked.includes(g.id), meta: PF ? [g.prod, OK.metaOf(g, today())].filter(Boolean).join(' · ') : undefined }, PF ? {} : rowLook(g), o));
643
768
  const budgetOkr = (b) => OK.rowHtml(Object.assign({}, b, { title: b.outcome || b.title }), { budget: true, today: today(), meta: OK.budgetMeta(b, today()), dot: OK.dotOf(Object.assign({ anchor: b.anchor }, b)), drafts: draftsFor(b.id), drawDraft: drHtml, mark: markHtml });
644
769
  function drawGoals() {
645
770
  const G = goalsShown(), T = $('#goalTbl');
@@ -648,11 +773,12 @@ function drawGoals() {
648
773
  $('#goalCards').innerHTML = '';
649
774
  if (dash === TRENDS) { T.innerHTML = bmHtml(true); return; }
650
775
  const D = curDash();
651
- const krDrafts = PF ? [] : looseDrafts().filter((r) => r.kind === 'metric' && r.group === 'Key results');
776
+ const krDrafts = []; // batch 18 item 11: a drafted key result is a row of the drafts table
652
777
  const sub = per ? per.label : '';
653
778
  const head = `<div class="okr-sec"><h2 class="okr-h">Key results</h2><span class="note">${esc(sub)}</span></div>`;
654
779
  if (!M.goals.filter(isKr).length && !krDrafts.length) {
655
- T.innerHTML = head + '<div class="okr-card"><p class="okr-none">No key result is recorded for this workspace.</p></div>' + budgetsHtml(D);
780
+ // the drafts table above says what is drafted: no empty card under it (zero is silence)
781
+ T.innerHTML = PF || !tableRows().length ? head + '<div class="okr-card"><p class="okr-none">No key result is recorded for this workspace.</p></div>' + budgetsHtml(D) : budgetsHtml(D);
656
782
  return;
657
783
  }
658
784
  /* by objective when there is more than one; Portfolio groups by product */
@@ -784,23 +910,32 @@ const historyHtml = (g) => ((g.history || []).length ? (g.history || []).slice()
784
910
  * folds: How I read it, What it counts and History. On dashboards folds under them when the PM keeps a saved dashboard. */
785
911
  function goalBodyHtml(g, o) {
786
912
  const c = g.key ? byKey(g.key) : null, phone = isPhone(), steps = g.type === 'Done or not' && g.steps && g.steps.length;
787
- const chart = steps ? stepsHtml(g) : c ? detailSvg(g, c, phone ? 330 : 470, phone ? 140 : 160) : emptyTrend(g, o.own);
788
- const d = OK.dotOf(g), R = g.reading || {}, prog = R.txt || OK.progressOf(g);
789
- const line = R.line || (d === 'behind' && g.pace && g.pace.sub ? g.pace.sub : '');
913
+ // batch 18 item 11 (GcJ2FirstMonday): one reading is a starting point: the chart waits for the 2nd, and no pace is said before the 3rd
914
+ const first = GC.firstOf(g), wait = first ? GC.firstChart(g) : '';
915
+ const chart = steps ? stepsHtml(g) : c ? detailSvg(g, c, phone ? 330 : 470, phone ? 140 : 160) : wait || emptyTrend(g, o.own);
916
+ const lk = PF ? {} : rowLook(g), d = lk.dot || OK.dotOf(g), R = g.reading || {}, prog = R.txt || OK.progressOf(g);
917
+ // a failed read or a held reading (GcR4Failed, GcR5Held): the number is the last good one, and it says so
918
+ const good = GC.lastGoodSay(g);
919
+ const line = good || (first && d === 'q' ? [first.source, GC.atTxt(first.at)].filter(Boolean).join(' · ') + ' · pace known after 3 readings' : R.line || (d === 'behind' && g.pace && g.pace.sub ? g.pace.sub : ''));
790
920
  const head = `<div class="okr-vh">${OK.dotHtml(d)}<b>${esc(prog || OK.DOT_SAY[d])}</b>${line ? `<span class="note">${esc(line)}</span>` : ''}${PF && g.prod ? `<span class="note">${esc(g.prod)}</span>` : ''}<span class="okr-sp"></span>${OK.avHtml(OK.whoOf(g))}</div>`;
791
921
  const form = !steps && o.adding ? `<form class="ins-mf ins-box" data-rdf><div class="ins-2"><label class="ins-fl">Date<input class="ins-inp" type="date" name="at" value="${esc(M.today || '')}"></label><label class="ins-fl">Value${g.unit ? ' (' + esc(g.unit) + ')' : ''}<input class="ins-inp" name="v" inputmode="decimal" maxlength="16"></label></div><div class="ins-mact"><button type="submit" class="ins-btn sm dark">Add reading</button><button type="button" class="ins-btn sm ghost" data-gx="cancel">Cancel</button><span class="note" data-msg role="status"></span></div></form>` : '';
792
922
  const why = whyOf(g), moves = g.moves || [];
793
923
  const whyCard = why || moves.length ? `<div class="okr-why"><span class="sp" aria-hidden="true">${SV(I.spark)}</span><div>${why ? `<p>${esc(why)}</p>` : ''}${moves.length ? `<div class="ins-mvl">${moves.map(moveRow).join('')}</div>` : ''}</div></div>` : '';
794
924
  const onDash = savedDash().filter((D) => D.charts.includes(g.id)).length;
795
925
  const R0 = g.recipe;
926
+ // batch 18 item 11 (GcR3Goal): how it is counted, where it is read from, how often and the last read are said ONCE, above the chart; the
927
+ // Readings fold keeps the list, and What it counts folds away when the counts say it
928
+ const kr = PF ? '' : GC.krHtml(g, { ticket: heldTicket(g) }), said = !!kr && !!(R0 && R0.connector);
796
929
  const rows = [
797
- { id: 'read', title: 'How I read it', count: R0 && R0.connector ? R0.connector : srcOf(g) === 'Recorded' ? 'typed in' : srcOf(g), open: o.open === 'read', render: () => readHtml(g, o) },
798
- { id: 'counts', title: 'What it counts', count: g.defn ? '' : 'not written yet', render: () => `<p class="note">${esc(g.defn || 'No definition is written for it yet. I write one with how I read it, and you keep it with ✓.')}</p>` },
930
+ said ? { id: 'read', title: 'Readings', count: (g.series || []).length || '', open: o.open === 'read', render: () => readingsHtml(g, o) }
931
+ : { id: 'read', title: 'How I read it', count: R0 && R0.connector ? R0.connector : srcOf(g) === 'Recorded' ? 'typed in' : srcOf(g), open: o.open === 'read', render: () => readHtml(g, o) },
932
+ g.counts && (g.counts.what || g.counts.num_label) ? null : { id: 'counts', title: 'What it counts', count: g.defn ? '' : 'not written yet', render: () => `<p class="note">${esc(g.defn || 'No definition is written for it yet. I write one with how I read it, and you keep it.')}</p>` },
799
933
  { id: 'hist', title: 'History', count: (g.history || []).length || '', render: () => historyHtml(g) },
800
934
  o.own && savedDash().length ? { id: 'dash', title: 'On dashboards', count: onDash, render: () => dashSwitches(g) } : null,
801
935
  ];
802
936
  const ask = `<form class="ins-askf" data-askf><input name="q" maxlength="300" autocomplete="off" placeholder="Ask about this goal" aria-label="Ask about this goal"><button type="submit" class="cz-ib sm solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.up)}</button></form>`;
803
- return head + form + `<div class="ins-gbig">${chart}</div>` + whyCard + window.czViewer.czSections(rows, { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
937
+ const failedOrHeld = !!(g.failed || (g.held || []).length);
938
+ return head + form + (failedOrHeld ? kr : '') + `<div class="ins-gbig">${chart}</div>` + (failedOrHeld ? '' : kr) + whyCard + window.czViewer.czSections(rows.filter(Boolean), { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
804
939
  }
805
940
  /** The goal as plain text, for Copy as text. */
806
941
  function goalText(g) {
@@ -819,6 +954,8 @@ async function setNotify(g, k) {
819
954
  toast(say, { label: 'Undo', fn: async () => { await pmPost('/api/goals/notify', { ws: goalWs(g), id: goalRid(g), notify: was }); await load(); } });
820
955
  await load();
821
956
  }
957
+ /** The drafted Jira ticket of a goal's held reading (GcR5Held): the row the reading engine named, else an open ticket draft under the goal. */
958
+ const heldTicket = (g) => { const H = (g.held || [])[0]; if (!H) return null; const D = drAll(); return (H.ticket && D.find((r) => r.id === H.ticket)) || D.find((r) => r.goal === g.id && r.kind === 'ticket' && r.state === 'open') || null; };
822
959
  let ovCss = false;
823
960
  function openGoalDetail(id, open0) {
824
961
  let g = goalById(id); if (!g) return;
@@ -826,10 +963,12 @@ function openGoalDetail(id, open0) {
826
963
  const own = goalWs(g) === M.board.ws, st = { open: open0 || '', more: false, adding: false, own };
827
964
  const kr = krId(g);
828
965
  const more = [], stepsGoal = g.type === 'Done or not' && g.steps && g.steps.length;
829
- if (own && g.recipe) more.push({ label: 'Read it now', note: g.recipe.connector || '', on: async () => {
966
+ // ↻ Read now (batch 18 item 11, GcR3Goal): in the header, any time; it files a normal reading and does not move the next scheduled read
967
+ const readNow = async () => {
830
968
  const r = await pmPost('/api/goal-status/read', { ws: goalWs(g), id: goalRid(g) });
831
- toast(r && r.ok === true ? 'Read. The goal shows the new reading.' : (r && r.error) || 'It could not be read. Nothing changed.'); if (r && r.ok === true) await load();
832
- } });
969
+ toast(r && r.ok === true ? 'Reading it now. The goal shows the new reading when it lands; the next read stays ' + ((GC.rhythmOf(g) || {}).long || 'as it was') + '.' : (r && r.error) || 'It could not be read. Nothing changed.');
970
+ if (r && r.ok === true) setTimeout(() => { load(); }, 4000);
971
+ };
833
972
  if (own && !stepsGoal) more.push({ label: 'Add a reading', on: () => { const el = window.czViewer && window.czViewer.body(); st.adding = true; if (el) { el.innerHTML = goalBodyHtml(g, st); const f = el.querySelector('[data-rdf] [name="v"]'); if (f) f.focus(); } } });
834
973
  if (own && M.goals.some((x) => x.id === g.id)) more.push({ label: 'Edit chart', on: () => openChartEdit(g.id) });
835
974
  if (more.length) more.push({ sep: true });
@@ -841,14 +980,29 @@ function openGoalDetail(id, open0) {
841
980
  const moreOf = () => notifyItems().concat(more);
842
981
  const rp = own && !PF ? RI.viewerPress('goal:' + id) : null; // RfA1: a key result's panel makes a report too
843
982
  const subOf = () => [kr, g.targetTxt ? g.targetTxt + (g.byAt ? ' by ' + md(day(g.byAt)) : '') : ''].filter(Boolean).join(' · ');
983
+ const presses = (own && g.recipe && g.recipe.connector ? [{ act: 'gc-read', label: 'Read it now', icon: 'M20 12a8 8 0 1 1-2.3-5.6M20 4v5h-5' }] : []).concat(rp ? [rp] : []);
844
984
  const body = vwOpen({ kind: 'Goal', title: g.title, sub: subOf(), icon: 'goal', id: 'goal:' + id, more: moreOf,
845
- discuss: true, presses: rp ? [rp] : null, onPress: (act) => { if (rp && act === rp.act) rp.run(); },
985
+ discuss: true, presses: presses.length ? presses : null, onPress: (act) => { if (act === 'gc-read') readNow(); else if (rp && act === rp.act) rp.run(); },
846
986
  render: (el) => {
847
987
  el.classList.add('ins-vbody', 'ins-xv');
848
988
  const draw = () => { const top = el.scrollTop; el.innerHTML = goalBodyHtml(g, st); el.scrollTop = top; };
849
989
  const fresh = async (said) => { toast(said); await load(); if (PF) await openPortfolio(); g = goalById(id); if (g) draw(); };
850
990
  draw();
851
991
  el.onclick = async (e) => {
992
+ // batch 18 item 11: a failed read's one fix (reconnect), a held reading's (file it, or its drafted ticket)
993
+ const gx = e.target.closest('[data-gc], [data-okd]');
994
+ if (gx && !gx.disabled) {
995
+ const k = gx.dataset.gc || gx.dataset.okd;
996
+ if (k === 'reconnect') { if (gx.dataset.row) await draftPress('keep', gx.dataset.row, gx); else import('./cozy-settings.js').then((S) => S.openSettings('connectors')).catch(() => {}); return; }
997
+ if (k === 'file-held') {
998
+ gx.disabled = true;
999
+ const r = await pmPost('/api/goal-status/file-held', { ws: goalWs(g), id: goalRid(g), held: gx.dataset.row });
1000
+ if (!r || r.ok !== true) { gx.disabled = false; toast((r && r.error) || 'It could not be filed. Nothing changed.'); return; }
1001
+ await fresh('Filed. It counts as a reading now.'); return;
1002
+ }
1003
+ if (k === 'keep') { await draftPress('keep', gx.dataset.row, gx); g = goalById(id); if (g) draw(); return; }
1004
+ if (k === 'edit') { const t = heldTicket(g); location.assign(homeAsk('goal', 'Change the drafted ticket for ' + g.title + (t ? ' (“' + t.text + '”)' : '') + ': ')); return; }
1005
+ }
852
1006
  const x = e.target.closest('[data-gx], [data-czs-act]'); if (!x || x.disabled) return;
853
1007
  const k = x.dataset.gx || x.dataset.czsAct, msg = el.querySelector('[data-gmsg]');
854
1008
  if (k === 'all') { st.more = true; st.open = 'read'; draw(); }
@@ -2970,6 +2970,8 @@ const impactTick = () => { try { impactRuns.tick({}); } catch (e) { warnWriteFai
2970
2970
  // the goal's notify is push. At most 2 runs at once, one per product. PMOS_METRIC_READ=off.
2971
2971
  const krMetricsOf = (w) => require(require('./lib/repo-script.js').repoScript('records/index.js')).list(require('./lib/records-dir.js').recordsDirFor(metricDraftCtx(), w.id), 'kr-metrics');
2972
2972
  const goalAlertTell = (w, rec, reading) => tellNeed(w.id, 'goal-alert-' + rec.rid + '-' + reading.at, String(rec.metric || rec.rid), String(rec.metric || rec.rid) + ' broke its limit: ' + reading.txt + ' against its ' + reading.line + ' on ' + reading.at + '. The rollback ticket is drafted on Intelligence.');
2973
+ /** The working hours an hourly goal is read in: the day-check window of Settings (batch 18 item 11). */
2974
+ const metricReadHours = () => { try { const dc = proSettings().dayCheck || {}; return dc.start && dc.end ? { start: dc.start, end: dc.end } : undefined; } catch { return undefined; } };
2973
2975
  const metricReadRuns = require('./lib/metric-read-runs.js').create({
2974
2976
  workspaces: () => [...workspaces.values()],
2975
2977
  isLead: (w) => isPlanNeedsTree(w),
@@ -2980,10 +2982,12 @@ const metricReadRuns = require('./lib/metric-read-runs.js').create({
2980
2982
  testItems: (w, rids) => {
2981
2983
  const d = stateDirFor(w); if (!d) return [];
2982
2984
  const MDx = require('./lib/metric-drafts.js'), S = MDx.read(d).scopes.get(MDx.keyOf('product', w.id));
2983
- return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.text, unit: (r.metric && r.metric.unit) || '', recipe: r.recipe }));
2985
+ return (rids || []).map((id) => S && S.rows.get(id)).filter((r) => r && r.recipe).map((r) => ({ rid: r.id, title: (r.metric && r.metric.name) || r.name || r.text, unit: (r.metric && r.metric.unit) || r.unit || '', recipe: r.recipe }));
2984
2986
  },
2985
2987
  afterRead: (w, rids, now) => require('./lib/routes-goal-status.js').afterRead({ getWs, stateDirFor, workspaceList: () => [...workspaces.values()], runtimeDir: STATE, tellGoalAlert: goalAlertTell }, w, rids, now),
2986
2988
  open: deepOpenNow, // batch 18 item 9: deep work runs at night or when the PM is idle (lib/driver-run.js deepOpen)
2989
+ workOpen: (now) => require('./lib/driver-run.js').dayCheckOpen(proSettings(), now, (n, q) => proactiveLib.inQuietHours(n, q)), // batch 18 item 11: hourly goals
2990
+ hours: () => metricReadHours(),
2987
2991
  headlessOff: () => headlessLib.switchedOff(process.env),
2988
2992
  env: process.env,
2989
2993
  promptFor: (skillId) => { const h = homeWorkspace(); const t = taskById(skillId, h ? h.root : SELF_ROOT); return t && t.prompt ? t.prompt : null; },
@@ -10289,7 +10293,7 @@ async function handleRequest(req, res) {
10289
10293
  // pm-os-absorb Runs 2–5 — the planning layer's routes, one file per run (lib/route-modules.js). Last, so none shadows a route above.
10290
10294
  // meeting-notes Run 1: the Notes routes keep notes in the per-user runtime directory and start the agent-summary session.
10291
10295
  if (req.method === 'POST' && !(req.headers && req.headers['x-pmos-session'])) orchGate.touch(); // agent-orchestrator: a page press by the PM
10292
- if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, metricReadRuns, tellGoalAlert: goalAlertTell, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
10296
+ if (await routeModules.dispatch(req, res, url, { orchestrator: { gate: orchGate, running: () => orchSpawn.running(), health: orchHealth, keepRate: orchKeepRate }, proposalRuns, metricDraftRuns, metricReadRuns, metricReadHours, tellGoalAlert: goalAlertTell, json, readBody, getWs, invalidateNeedsAgg, boardCache, consoleState, stateDirFor, sessionList, initiativeIndex,
10293
10297
  runtimeDir: STATE, homeRoot: HOME_ENABLED ? SELF_ROOT : null, spawnSession, jevModelOpts, sendToSession, endSupersededRuns, proSettings,
10294
10298
  // premium-chat-session: every premium chat panel is an interactive Claude Code session the PM talks to (text as typed, `/` kept)
10295
10299
  chatSessions,
@@ -22,11 +22,13 @@ Rules that always hold:
22
22
 
23
23
  Procedure:
24
24
  1. Run `pmos metrics reading list` to see the goals of this run.
25
- 2. For each goal, read its recipe's query through its connector. Take the value for the latest complete period of its cadence (yesterday for daily, last week for weekly, last month for monthly).
26
- 3. File it: `pmos metrics reading <rid> <value> --source "<connector> · <what you read, one line>" [--day YYYY-MM-DD]`. --day is the last day of the period the value counts, when it is not today.
27
- 4. A goal you cannot read: `pmos metrics reading <rid> --cant "<why, one line>"` with its fix (rule 6).
28
- 5. Stop when every goal of the run is read or said.
25
+ 2. For each goal, read its recipe's query through its connector. Take the value for the latest complete period of its cadence (the last full hour for hourly, yesterday for daily, last week for weekly, last month for monthly).
26
+ 3. File it: `pmos metrics reading <rid> <value> --source "<connector> · <what you read, one line>" [--day YYYY-MM-DD] [--num N --den D] [--segments "<part>=<num>/<den>,…"] [--period "<week of 19 Oct>"]`. --day is the last day of the period the value counts, when it is not today. When the goal is a rate, give its two counts with --num and --den, and its parts (for example web and app) with --segments when the source splits them. A goal that says how it is counted ("counted as") is read exactly that way.
27
+ 4. PMOS checks every value before it is drawn (a part that reads 0, a jump of more than 3 times, too small a count, a value it cannot be). A value a check fails on is HELD: it is said, not drawn. File the value the source gives anyway; never change it to pass a check.
28
+ 5. A goal you cannot read: `pmos metrics reading <rid> --cant "<why, one line>"` with its fix (rule 6).
29
+ 6. A COMPARE run (the line says the PM's number differs from yours): read the goal your way and the PM's likely way, find why they differ, and file once: `pmos metrics reading <rid> --why "<why, one or two sentences>" --suggest mine|yours --suggest-text "<which to keep and why, one line>" --yours-what "<how the PM counts it, one sentence>" --yours-query "<a query that counts it that way>"`. File no value in a compare run.
30
+ 7. Stop when every goal of the run is read or said.
29
31
 
30
32
  Output contract: produce EXACTLY these sections in your final message:
31
- - Read (each goal, its value and its source)
33
+ - Read (each goal, its value and its source; say a held value as held)
32
34
  - Not read (each goal you could not read, why, and the fix you drafted)
@@ -122,7 +122,9 @@ async function pure() {
122
122
  /* re-pointed (batch 18 item 1, the card and the mission): the card's head names the stage; the mission draws a strip part a stage with the
123
123
  * current one marked; a tap on the picture opens in place "N of M done", ⋯ (the stage picker) and → the next stage, then the stages and
124
124
  * milestones with their dates. The steps are said once, in Tasks */
125
- const openMi = async (p) => { if (!(await p.evaluate((v) => !!document.querySelector(v + ' .iv-mio'), V))) await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await until(() => p.evaluate((v) => !!document.querySelector(v + ' .iv-mio'), V)); };
125
+ // the dates line shows when it is drawn: always on a desktop (Wawan 11:58), after the picture's tap on a phone
126
+ const miShown = (p) => p.evaluate((v) => { const m = document.querySelector(v + ' .iv-mio'); return !!m && getComputedStyle(m).display !== 'none'; }, V);
127
+ const openMi = async (p) => { if (!(await miShown(p))) await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await until(() => miShown(p)); };
126
128
  const card = (p) => p.evaluate((v) => {
127
129
  const c = document.querySelector(v + ' .iv-sc'); const t = (n) => (n ? n.textContent.replace(/\s+/g, ' ').trim() : '');
128
130
  const go = c.querySelector('.iv-scgo');
@@ -139,7 +141,7 @@ async function pure() {
139
141
  const c0 = await card(p);
140
142
  ok('D1 the header names the stage', c0.stage === 'Build', JSON.stringify(c0));
141
143
  ok('D1 the mission\'s strip holds one part a stage of the workflow, the current one marked', c0.bars === 8 && c0.now === 1, JSON.stringify(c0));
142
- ok('D1 the next stage waits in place until the picture is tapped (one primary: the ask\'s)', !c0.next, JSON.stringify(c0));
144
+ ok('D1 the next stage waits in place until the picture is tapped while the Viewer is one column (one primary: the ask\'s)', !(await miShown(p)), JSON.stringify(c0));
143
145
  await openMi(p);
144
146
  const c = await card(p);
145
147
  ok('D1 a tap on the picture opens in place: ⋯ for the stage and the next stage; no list of the stages, the picture shows them (Wawan 10:59)', c.more && c.stageRows === 0, JSON.stringify(c));
@@ -191,6 +193,12 @@ async function pure() {
191
193
  ok('D1b the Milestones card sits under the card: "Milestones 1 of 3 done", the done one ticked', !!mc && mc.after && /^Milestones ?1 of 3 done$/.test(mc.head) && mc.tick === 1 && /^dn:Brief signed off/.test(mc.rows[0]), JSON.stringify(mc));
192
194
  ok('D1b the next one is marked with "in N days", and the release says so', !!mc && /^up:Rollout to all workspacesDec 1 · in \d+ days · release$/.test(mc.rows[1]) && /^:Did it work\?Feb 1/.test(mc.rows[2]), JSON.stringify(mc && mc.rows));
193
195
  ok('D1b each row is a press for its task', !!mc && mc.press, JSON.stringify(mc));
196
+ // Wawan 11:58 (0.442.0 hotfix): in two columns the dates line, ⋯ and the next stage show under the picture without a tap, and the
197
+ // milestones are said once, in this card; a tap on the picture does not list them again
198
+ ok('D1b in two columns the dates line and the next stage show under the picture at once', await miShown(p) && await p.evaluate((v) => { const n = document.querySelector(v + ' .iv-sc [data-iv-next]'); return !!n && !!n.offsetParent; }, V));
199
+ const once = () => p.evaluate((v) => [...document.querySelectorAll(v + ' .iv-msl')].filter((l) => l.offsetParent).length, V);
200
+ const n0 = await once(); await p.click(V + ' [data-iv-mi]', { position: { x: 8, y: 8 } }); await sleep(300);
201
+ ok('D1b in two columns the milestones are listed once, before and after a tap on the picture', n0 === 1 && await once() === 1, String(n0));
194
202
  await shot(p, 'desk-milestones');
195
203
  // the phone: the same list behind a tap on the mission, under the stage's dates, ⋯ and the next stage (XvpE2Stages, Wawan 10:59)
196
204
  const Q = await open({ w: 390, h: 844, board: B }), q = Q.page;
@@ -255,7 +263,7 @@ async function pure() {
255
263
  /* D5 every step done, a milestone next: the next stage is ◆ Deliver; its sheet moves it with nothing open, and says so with Undo */
256
264
  {
257
265
  const A = await open({ model: SCEN.ready() }), p = A.page;
258
- if (!(await card(p)).next) await openMi(p);
266
+ if (!(await p.evaluate((v) => { const n = document.querySelector(v + ' [data-iv-next]'); return !!(n && n.offsetParent); }, V))) await openMi(p); // the next stage shows: in the head, or under the picture once it is open
259
267
  const c = await card(p);
260
268
  ok('D5 every step done: the → names ◆ Deliver', A.up && /^Next: ◆ Deliver/.test(c.tail) && c.ms, JSON.stringify(c));
261
269
  await shot(p, 'desk-ready', V + ' .iv-sc');