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
@@ -52,7 +52,26 @@ function wsFor(ctx, ws, scope, id) {
52
52
  return w;
53
53
  }
54
54
  const offNow = (ctx) => Runs.off(ctx.env || process.env);
55
- const viewFor = (ctx, w, scope, id) => { const dir = dirOf(ctx, w); return MD.viewOf(dir ? MD.read(dir) : null, scope, id, { off: offNow(ctx) }); };
55
+ const viewFor = (ctx, w, scope, id) => { const dir = dirOf(ctx, w); return liveRows(MD.viewOf(dir ? MD.read(dir) : null, scope, id, { off: offNow(ctx) }), dir); };
56
+ /** Batch 18 item 11 (contract next18/11-okr-clarity/api-contract.md §2, §5): a drafted row with a recipe says how it is counted, how often it is
57
+ * read, its live read with Claude's checks, and the PM's own number against it. */
58
+ function liveRows(view, dir) {
59
+ let F = null; try { F = dir ? require('./metric-reads.js').read(dir) : null; } catch { F = null; }
60
+ const MR = require('./metric-reads.js');
61
+ for (const r of view.rows || []) {
62
+ if (!r.recipe) continue;
63
+ const u = (r.metric && r.metric.unit) || r.unit || '';
64
+ r.counts = r.recipe.counts || null; r.rhythm = MR.rhythmOf(r.recipe);
65
+ const t = F && F.rids.get(r.id) && F.rids.get(r.id).test;
66
+ if (t) {
67
+ r.live = t.ok ? { at: t.at, ok: true, value: t.value, txt: MR.fmt(t.value, u), source: t.source || '', ...(Number.isFinite(t.num) ? { num: t.num } : {}), ...(Number.isFinite(t.den) ? { den: t.den } : {}), ...(t.period ? { period: t.period } : {}), ...(t.held ? { held: true } : {}) }
68
+ : { at: t.at, ok: false, error: t.error };
69
+ if (t.checks) { r.checks = t.checks; r.live.checks = t.checks; }
70
+ }
71
+ const c = F ? MR.compareView(F, r.id, u) : null; if (c) r.compare = c;
72
+ }
73
+ return view;
74
+ }
56
75
 
57
76
  async function handle(req, res, url, ctx) {
58
77
  const send = (r) => { ctx.json(res, r.body, r.status); return true; };
@@ -126,7 +145,7 @@ async function handle(req, res, url, ctx) {
126
145
  let r; try { r = records().add(root, 'kr-metrics', kf.fields, UI(), k === 'outcome' ? 'Kept the outcome Claude drafted for a project-shaped goal' : 'Kept next quarter\'s goal Claude drafted'); } catch (e) { return { error: 'The record could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
127
146
  if (!r.ok) return { error: r.reasons.join('; ') };
128
147
  // the test read (lib/metric-reads.js), else the reading it was drafted from, is the first reading, with its source
129
- let test = null; try { const x = require('./metric-reads.js').read(dir).rids.get(row.id); test = x && x.test && x.test.ok ? x.test : null; } catch { test = null; }
148
+ let test = null; try { const x = require('./metric-reads.js').read(dir).rids.get(row.id); test = x && x.test && x.test.ok && !x.test.held ? x.test : null; } catch { test = null; }
130
149
  const first = test ? { at: test.day, value: test.value, source: test.source, via: 'run', read_at: test.at } : kf.reading;
131
150
  if (first) { try { records().addReading(root, r.rid, first, UI(), test ? 'The test read before you kept it' : 'The reading Claude drafted it from'); } catch { /* the record stands */ } }
132
151
  return done({ rid: r.rid });
@@ -147,7 +166,10 @@ async function handle(req, res, url, ctx) {
147
166
  let r;
148
167
  try { r = records().add(root, 'kr-metrics', k.fields, UI(), 'Kept a metric Claude drafted'); } catch (e) { return { error: 'The record could not be written: ' + String((e && e.message) || e).slice(0, 160) }; }
149
168
  if (!r.ok) return { error: r.reasons.join('; ') };
150
- if (k.reading) { try { records().addReading(root, r.rid, k.reading, UI(), 'The reading Claude drafted it from'); } catch { /* the record stands; the next reading fills it */ } }
169
+ // batch 18 item 11: a good live read (not held) is the first reading, with its counts; else the reading it was drafted from
170
+ let live = null; try { const x = require('./metric-reads.js').read(dir).rids.get(row.id); live = x && x.test && x.test.ok && !x.test.held ? x.test : null; } catch { live = null; }
171
+ const first = live ? { at: live.day, value: live.value, source: live.source, via: 'run', read_at: live.at, ...(Number.isFinite(live.num) ? { num: live.num } : {}), ...(Number.isFinite(live.den) ? { den: live.den } : {}), ...(live.period ? { period: live.period } : {}) } : k.reading;
172
+ if (first) { try { records().addReading(root, r.rid, first, UI(), live ? 'The live read before you kept it' : 'The reading Claude drafted it from'); } catch { /* the record stands; the next reading fills it */ } }
151
173
  MD.append(dir, g.actor, { kind: 'keep', scope, id, row: row.id, rid: r.rid }, at());
152
174
  return { rid: r.rid };
153
175
  };
@@ -165,6 +187,7 @@ async function handle(req, res, url, ctx) {
165
187
  const r = keepOne(row);
166
188
  if (r.error) return send(bad(400, r.error));
167
189
  const out = { ok: true, rid: r.rid || null }; for (const k of ['outbox', 'open', 'connector']) if (r[k]) out[k] = r[k];
190
+ if (row.recipe) out.rhythm = require('./metric-reads.js').rhythmOf(row.recipe); // batch 18 item 11: the Kept toast names the goal's own rhythm
168
191
  return send({ status: 200, body: out });
169
192
  }
170
193
  if (what === 'edit') {
@@ -40,7 +40,8 @@ const PROGRAM = () => ({
40
40
  rows: [
41
41
  { id: 'g', group: 'Program goal', name: 'Sign-ins on CIAM, all products', type: 'Percentage', now: 12, nowTxt: '12%', target: 100, targetTxt: '100%', by: '2028-06-30',
42
42
  why: 'idpf is 80% of all sign-ins, so it carries the goal. I check it every morning once you keep it.', source: 'Amplitude', ticket: null,
43
- checkpoints: [{ by: '2027-02-27', target: 40, label: 'Legacy IdP off' }, { by: '2027-03-20', target: 85, label: 'All microsites' }], state: 'open' },
43
+ checkpoints: [{ by: '2027-02-27', target: 40, label: 'Legacy IdP off' }, { by: '2027-03-20', target: 85, label: 'All microsites' }], state: 'open',
44
+ recipe: { connector: 'Amplitude', query: 'sign-ins on CIAM ÷ all sign-ins', cadence: 'weekly', at: '07:00', day: 'mon' } },
44
45
  { id: 'r1', group: 'Rolls up from', name: 'idpf · sign-ins on CIAM', type: 'Percentage', now: 15, nowTxt: '15%', target: 100, targetTxt: '100%', by: '2027-02-27', why: '', source: 'Amplitude', ticket: null, state: 'open' },
45
46
  { id: 'r2', group: 'Rolls up from', name: 'Microsites · sign-ins on CIAM', type: 'Percentage', now: null, nowTxt: '', target: 100, targetTxt: '100%', by: '2027-03-20', why: 'No event counts it yet.', source: '', ticket: { key: 'MS-212', text: 'MS-212 drafted' }, state: 'open' },
46
47
  { id: 'gr', group: 'Guardrail', name: 'Sign-in success', type: 'Stay within', now: 99.6, nowTxt: '99.6%', target: 99, targetTxt: 'stays above 99%', by: null, why: '', source: 'Amplitude', ticket: null, state: 'open' },
@@ -138,7 +139,9 @@ const INITIATIVE = () => ({
138
139
  ok('K the Goal row of chips, each with a dot: ok with a reading, off while it waits on a ticket', !!kept && kept.first && kept.per === 'Goal' && !kept.card
139
140
  && kept.chips.join(' / ') === 'ok:Sign-ins on CIAM, all products12% of 100% · Jun 2028 / ok:idpf · sign-ins on CIAM15% of 100% · Feb 27 / off:Microsites · sign-ins on CIAMwaits on MS-212 / ok:Sign-in successstays above 99%', JSON.stringify(kept));
140
141
  ok('K Undo is beside it, icon-only', !!kept && kept.undo === 'Undo');
141
- ok('K the toast says what happens next, in first person', /I check the goal every morning/.test(await p.evaluate(() => (document.querySelector('#bdToast') || {}).textContent || '')));
142
+ // batch 18 item 11: the toast names the goal's own rhythm, never "every morning"
143
+ const kt = await p.evaluate(() => (document.querySelector('#bdToast') || {}).textContent || '');
144
+ ok('K the toast says what happens next, in first person, with the goal\'s own rhythm', kt.includes('Kept. I read the goal every Monday 07:00.') && !/every morning/.test(kt), kt);
142
145
  await shot(p, 'Iq9Program-kept-built');
143
146
 
144
147
  /* ── U: Undo ── */
@@ -105,9 +105,10 @@ const ROWS = [
105
105
  await shot(p, 'okr-desktop-light');
106
106
 
107
107
  /* D · drafts */
108
- const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-goal="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-goal="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
108
+ const under = await p.evaluate(() => ({ chase: !!document.querySelector('[data-goal="krm-act"] [data-draft="d-chase"]'), out: !!document.querySelector('[data-goal="krm-ttfc"] [data-draft="d-out"]'), kr: !!document.querySelector('#draftBox [data-gc-row="d-kr"]') && !document.querySelector('#goalTbl [data-draft-row="d-kr"]'),
109
109
  acts: [...document.querySelectorAll('[data-draft="d-chase"] .acts button')].map((b) => b.getAttribute('aria-label').split(':')[0]), old: (document.querySelector('[data-draft="d-out"] .okr-old') || {}).textContent || '' }));
110
- ok('D1 each draft sits under the row it repairs; a drafted key result is a hollow row of its own', under.chase && under.out && under.kr, JSON.stringify(under));
110
+ // batch 18 item 11 (GcJ1aTable): a drafted key result is a row of the drafts table, no longer a hollow row in the list
111
+ ok('D1 each draft sits under the row it repairs; a drafted key result is a row of the drafts table', under.chase && under.out && under.kr, JSON.stringify(under));
111
112
  ok('D2 a draft has ✕ / ✎ / ✓, and ✓ says its act (Send)', under.acts.join('|') === 'Not now|Edit|Send', under.acts.join('|'));
112
113
  ok('D3 an outcome draft says what it was', under.old === 'Was “Time to first call”', under.old);
113
114
  const line = await p.evaluate(() => ({ t: document.querySelector('#brief').textContent + ' ' + document.querySelector('#insWhy').textContent, all: !!document.querySelector('#insAct [data-okl="keep-all"]') }));
@@ -128,9 +129,10 @@ const ROWS = [
128
129
  const v = await until(() => p.evaluate(() => { const V = document.querySelector('#czViewer'); if (!V || V.hidden) return null; return { title: (V.querySelector('.cz-vw-title') || {}).textContent || '', head: (V.querySelector('.okr-vh') || {}).textContent || '', chart: !!V.querySelector('.ins-gbig svg'), why: (V.querySelector('.okr-why') || {}).textContent || '', folds: [...V.querySelectorAll('.czs-row b')].map((b) => b.textContent) }; }), 5000);
129
130
  ok('V1 the Viewer opens on the goal with its reading against its line and the owner', v && /Partner activation/.test(v.title) && /\+8 of \+30 points/.test(v.head) && /its line says \+18/.test(v.head) && /RP/.test(v.head), JSON.stringify(v));
130
131
  ok('V2 then the chart and why it moved', v && v.chart && /catches up about 3 weeks/.test(v.why), JSON.stringify(v));
131
- ok('V3 then three folds: How I read it, What it counts, History', v && v.folds.slice(0, 3).join('|') === 'How I read it|What it counts|History', v && v.folds.join('|'));
132
- await p.click('#czViewer [data-czs-fold="read"]'); await sleep(120);
133
- ok('V4 How I read it says the source, what is read and how often', /Amplitude/.test(await txt(p, '#czViewer [data-czs-id="read"]')) && /partners active ÷ partners signed/.test(await txt(p, '#czViewer [data-czs-id="read"]')) && /Weekly/.test(await txt(p, '#czViewer [data-czs-id="read"]')));
132
+ // batch 18 item 11 (GcR3Goal): where it is read from, how often and the query are said once above the chart; the first fold is its Readings
133
+ ok('V3 then three folds: Readings, What it counts, History', v && v.folds.slice(0, 3).join('|') === 'Readings|What it counts|History', v && v.folds.join('|'));
134
+ const how = await txt(p, '#czViewer .gc-kr');
135
+ ok('V4 it says once where it is read from, how often and what is read', /From Amplitude, every Monday\. Last /.test(how) && /partners active ÷ partners signed/.test(how), how);
134
136
  await shot(p, 'okr-viewer-desktop');
135
137
 
136
138
  /* N · notify */
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.442.0",
3
+ "version": "0.443.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.442.0",
9
+ "version": "0.443.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.442.0",
3
+ "version": "0.443.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -239,8 +239,8 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
239
239
  await ip.click('#czViewer [data-cz-vw="back"]'); // ← from Stage: the initiative's page again (canvas HbCDrill)
240
240
  // the card (stage card D): its last node, the next stage, opens the move popover with Move now and Back; Back always asks for a reason,
241
241
  // and the move line carries it (InStage)
242
- const openNext = async () => { if (!(await ip.evaluate(() => !!document.querySelector('.iv-sc [data-iv-next]')))) await ip.click('.iv-sc [data-iv-mi]'); // the next stage sits under the picture until it is the main step (XvpE2Stages)
243
- await until(() => ip.evaluate(() => !!document.querySelector('.iv-sc [data-iv-next]')), 30000); await ip.click('.iv-sc [data-iv-next]'); return until(() => ip.evaluate(() => !!document.querySelector('.hi-pop [data-hi-goback]'))); };
242
+ const openNext = async () => { if (!(await ip.evaluate(() => { const n = document.querySelector('.iv-sc [data-iv-next]'); return !!(n && n.offsetParent); }))) await ip.click('.iv-sc [data-iv-mi]'); // the next stage sits under the picture until it is the main step (XvpE2Stages)
243
+ await until(() => ip.evaluate(() => { const n = document.querySelector('.iv-sc [data-iv-next]'); return !!(n && n.offsetParent); }), 30000); await ip.click('.iv-sc [data-iv-next]'); return until(() => ip.evaluate(() => !!document.querySelector('.hi-pop [data-hi-goback]'))); };
244
244
  const back = await openNext();
245
245
  ok('I4 the card\'s next stage opens Move to the next stage now and Back', back && await ip.evaluate(() => /^Move to .+ now$/.test(((document.querySelector('.hi-pop [data-hi-go]') || {}).textContent || '').trim())));
246
246
  if (back) {
@@ -768,3 +768,85 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
768
768
  .okr-pld .okr-dot { margin-top: 0; width: 8px; height: 8px; }
769
769
  @media (prefers-reduced-motion: reduce) { .okr-dot.m-crit::after { animation: none; } }
770
770
  textarea.ins-dri { height: auto; padding: 6px 8px; font-weight: 500; resize: vertical; }
771
+ /* ── goals made clear (batch 18 item 11, 11-B; frames Gc*): the drafts table, the check panel, first readings, failed and held ── */
772
+ .ins-dr .gc-tbl + .okr-card { margin-top: 12px; }
773
+ .gc-tbl { border: 1px solid var(--cz-hair); border-radius: 18px; overflow: hidden; background: var(--cz-card); }
774
+ .gc-th, .gc-tr { display: grid; grid-template-columns: minmax(150px, 1.25fr) minmax(170px, 1.9fr) minmax(70px, .6fr) minmax(90px, .75fr) minmax(120px, .95fr) 84px; gap: 14px; align-items: center; padding: 0 14px 0 16px; }
775
+ .gc-th { background: var(--cz-well); min-height: 38px; font-size: var(--fs-2); font-weight: 800; color: var(--cz-ink2); }
776
+ .gc-th .note { font-weight: 600; color: var(--cz-ink3); }
777
+ .gc-grp { padding: 8px 16px; background: var(--cz-well); border-top: 1px solid var(--cz-hair); font-size: var(--fs-2); }
778
+ .gc-grp b { font-weight: 800; color: var(--cz-ink2); }
779
+ .gc-grp .note { color: var(--cz-ink3); }
780
+ .gc-tr { border-top: 1px solid var(--cz-hair); min-height: 60px; padding-top: 8px; padding-bottom: 8px; cursor: pointer; }
781
+ .gc-tr:hover { background: var(--cz-well); }
782
+ .gc-tr.sel, .gc-tr.sel:hover { background: var(--cz-bluebg); }
783
+ .gc-tr:focus-visible { outline: 2px solid var(--cz-blueink); outline-offset: -2px; }
784
+ .gc-nm { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
785
+ .gc-nm b { font-size: var(--fs-3); font-weight: 800; line-height: 1.25; }
786
+ .gc-type { font-size: var(--fs-1); font-weight: 700; color: var(--cz-ink2); background: var(--cz-well2); border-radius: 8px; padding: 1px 7px; }
787
+ .gc-hw { font-size: var(--fs-2); color: var(--cz-ink2); line-height: 1.4; min-width: 0; }
788
+ .gc-now b { font-size: var(--fs-4); font-weight: 800; }
789
+ .gc-tg b { font-size: var(--fs-3); font-weight: 800; }
790
+ .gc-from { display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-2); min-width: 0; }
791
+ .gc-src { display: inline-flex; align-items: center; gap: 6px; }
792
+ .gc-src b { font-weight: 700; }
793
+ .gc-src .cz-dot { width: 7px; height: 7px; }
794
+ .gc-from .note { color: var(--cz-ink2); font-weight: 600; }
795
+ .gc-acts { display: flex; gap: 4px; justify-content: flex-end; }
796
+ .gc-acts .cz-ib svg, .gc-panel svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
797
+ @media (max-width: 760px) {
798
+ .gc-th { display: none; }
799
+ .gc-tr { grid-template-columns: 1fr auto; grid-template-areas: "nm now" "hw hw" "tg from" "acts acts"; gap: 6px 12px; padding: 12px 14px; }
800
+ .gc-nm { grid-area: nm; } .gc-hw { grid-area: hw; } .gc-now { grid-area: now; text-align: right; } .gc-tg { grid-area: tg; } .gc-from { grid-area: from; text-align: right; align-items: flex-end; } .gc-acts { grid-area: acts; }
801
+ .gc-tg::before { content: 'Target '; font-size: var(--fs-2); color: var(--cz-ink3); }
802
+ }
803
+ /* the check panel and the key result's part of the goal Viewer */
804
+ .gc-panel { display: flex; flex-direction: column; gap: 12px; }
805
+ .gc-kr { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
806
+ .gc-box { background: var(--cz-well); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
807
+ .gc-k { font-size: var(--fs-2); font-weight: 800; color: var(--cz-ink2); }
808
+ .gc-what { margin: 0; font-size: var(--fs-3); font-weight: 700; line-height: 1.45; color: var(--cz-ink); }
809
+ .gc-big { margin: 2px 0 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
810
+ .gc-big b { font-size: var(--fs-6); font-weight: 800; letter-spacing: -.01em; }
811
+ .gc-frac { display: flex; flex-direction: column; font-size: var(--fs-3); }
812
+ .gc-frac > div { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
813
+ .gc-frac b { font-weight: 800; min-width: 3ch; }
814
+ .gc-frac .n { border-bottom: 1.5px solid var(--cz-ink3); }
815
+ .gc-frac .r { font-weight: 800; }
816
+ .gc-sec { display: flex; flex-direction: column; gap: 6px; }
817
+ .gc-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-3); }
818
+ .gc-checks li { display: flex; gap: 8px; align-items: flex-start; }
819
+ .gc-checks li svg { flex: none; margin-top: 2px; width: 16px; height: 16px; padding: 1px; border-radius: 50%; box-sizing: border-box; }
820
+ .gc-checks li.ok svg { color: var(--cz-ok); background: var(--cz-okbg); }
821
+ .gc-checks li.warn svg { color: var(--cz-risk); }
822
+ .gc-cmp { display: flex; align-items: center; gap: 8px; border: 1px solid var(--cz-hair); border-radius: 14px; padding: 6px 6px 6px 14px; background: var(--cz-card); }
823
+ .gc-cmp input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: var(--fs-3); color: var(--cz-ink); outline: none; }
824
+ .gc-line, .gc-fl { margin: 0; font-size: var(--fs-3); color: var(--cz-ink2); line-height: 1.45; }
825
+ .gc-line b { color: var(--cz-ink); font-weight: 800; margin-right: 4px; }
826
+ .gc-fl b { color: var(--cz-ink); }
827
+ .gc-q { background: var(--cz-well); border-radius: 16px; padding: 10px 14px; }
828
+ .gc-q summary { cursor: pointer; font-size: var(--fs-3); list-style: none; }
829
+ .gc-q summary::-webkit-details-marker { display: none; }
830
+ .gc-q summary b { font-weight: 800; }
831
+ .gc-q pre { margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--cz-card); font-family: var(--cz-mono); font-size: var(--fs-2); white-space: pre-wrap; word-break: break-word; }
832
+ .gc-foot { display: flex; align-items: center; gap: 4px; }
833
+ .gc-sp { flex: 1; }
834
+ .gc-msg:empty { display: none; }
835
+ .gc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
836
+ .gc-card { background: var(--cz-well); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
837
+ .gc-card b { font-size: var(--fs-6); font-weight: 800; }
838
+ .gc-say { margin: 0; font-size: var(--fs-3); line-height: 1.5; }
839
+ .gc-sg { display: flex; flex-wrap: wrap; gap: 8px 10px; background: var(--cz-well); border-radius: 16px; padding: 12px 14px; }
840
+ .gc-sg .sp { color: var(--cz-blueink); display: inline-flex; margin-top: 2px; }
841
+ .gc-sg p { flex: 1; margin: 0; font-size: var(--fs-3); line-height: 1.45; min-width: 0; }
842
+ .gc-sg .acts { display: flex; gap: 4px; width: 100%; justify-content: flex-end; }
843
+ .gc-warnbox { background: var(--cz-riskbg); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-3); }
844
+ .gc-warnbox > b:first-child { color: var(--cz-risk); font-size: var(--fs-2); font-weight: 800; }
845
+ .gc-warnbox p { margin: 0; line-height: 1.45; }
846
+ .gc-fix { display: flex; align-items: center; gap: 10px; }
847
+ .gc-fix > b { flex: 1; font-weight: 800; }
848
+ .gc-fix .acts { display: flex; gap: 4px; }
849
+ .gc-file { display: flex; justify-content: flex-end; }
850
+ .gc-wait { border: 1.5px dashed var(--cz-hair); border-color: var(--cz-dot-q); border-radius: 14px; min-height: 120px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px; font-size: var(--fs-3); color: var(--cz-ink2); }
851
+ .gc-ed { display: flex; flex-direction: column; gap: 10px; }
852
+ .ins-dr.gc-on { border: 0; padding: 0; background: none; gap: 12px; }
@@ -45,6 +45,11 @@
45
45
  @media (min-width: 761px) {
46
46
  body.cz-home .cz-live { left: 8px; bottom: 68px; }
47
47
  body.cz-home .lv-tray { bottom: 116px; }
48
+ /* the list folded to its rail (Wawan 12:09): the pill stacks its marks in a column as wide as the menu button, so it never reaches
49
+ into the page beside the rail */
50
+ body.cz-home.hm-folded .cz-live { flex-direction: column; height: auto; min-width: 40px; padding: 10px 6px; gap: 8px; border-radius: 20px; }
51
+ body.cz-home.hm-folded .cz-live .lv-ms, body.cz-home.hm-folded .cz-live .lv-g { flex-direction: column; }
52
+ body.cz-home.hm-folded .cz-live .lv-sp { width: 16px; height: 1px; }
48
53
  }
49
54
  /* a phone: the menu button is bottom right, so the pill sits to its left, and the list is a short sheet */
50
55
  @media (max-width: 760px) {
@@ -525,3 +525,18 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
525
525
 
526
526
  /* the weekly review done for the week (batch 17 item 4-B, AdM1): Adler calm beside the words */
527
527
  .rv-done { display: flex; align-items: center; gap: 10px; }
528
+
529
+ /* The folded rail's card (batch 18 item 14, FlA1–FlA5): beside the pressed tile, Home's popover look, Home's own rows inside. The pill's
530
+ * sessions open in place under the row (.hv-rcs), not as a second popover. Its left and top are set from the tile (home-app.js). */
531
+ .hv-rc { position: fixed; z-index: 60; width: 372px; max-width: calc(100vw - 96px); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--cz-card); border-radius: 20px; padding: 6px; box-shadow: 0 24px 50px -20px rgba(42,46,53,.4), 0 0 0 1px var(--cz-hair); box-sizing: border-box; text-align: left; }
532
+ .hv-rch { display: flex; align-items: center; gap: 6px; min-height: 44px; }
533
+ .hv-rch .hv-pt { flex: 0 1 auto; gap: 8px; }
534
+ .hv-rch .hv-pt .hv-tl { width: 26px; height: 26px; border-radius: 8px; }
535
+ .hv-rch .hv-pt > svg { color: var(--cz-ink3); flex: none; }
536
+ .hv-rch .hv-msd { margin-left: auto; }
537
+ .hv-rch .hv-ib { margin-left: auto; flex: none; }
538
+ .hv-rch .hv-msd + .hv-ib { margin-left: 2px; }
539
+ .hv-rcb .hm-none { margin: 6px 10px 10px; }
540
+ .hv-rcs { margin: 0 0 4px; padding: 4px; background: color-mix(in srgb, var(--cz-well) 55%, var(--cz-card)); border-radius: 14px; }
541
+ .hv-rcs .hv-r::before { display: none; }
542
+ .hv-rcs .hv-r.safe { background: var(--cz-bluebg); border-radius: 14px; }
@@ -67,7 +67,8 @@
67
67
  * word press, only where a decision has two answers (Return it | Keep it as is).
68
68
  * czSections([{ id, title, count, open, render | html, tail? }], { key }) → the folding rows. A row folds and unfolds in place, and the fold
69
69
  * is remembered per key and id (localStorage, a private window forgets it). render(): a string of markup, called once when drawn.
70
- * widthOf(kind) · setWidth(px) · wide(on?) · railOn() for the page and the tests.
70
+ * widthOf(kind) · setWidth(px) · wide(on?) · railOn() for the page and the tests; railCard(fn) · railSync(key?) · keepWide() for a page
71
+ * that draws a card for a rail tile (Home).
71
72
  * The look is in cozy-vw-shell.css (loaded here once) over cozy.css (.cz-vw…). The old #dlg path (premium-viewer.js) is separate. */
72
73
  import { czPlaceholder } from './cozy-placeholder.js';
73
74
 
@@ -112,7 +113,7 @@ const isPhone = () => typeof innerWidth === 'number' && innerWidth <= PHONE;
112
113
  const onHome = () => typeof document !== 'undefined' && !!document.body && document.body.classList.contains('cz-home');
113
114
  const kindKey = (k) => String(k || 'item').trim().toLowerCase().replace(/^file · .*/, 'file').replace(/[^a-z0-9]+/g, '-').slice(0, 40) || 'item';
114
115
 
115
- const V = { el: null, cur: null, back: null, subs: [], stack: [], fwd: [], wide: false, rail: false, w: 0, drill: false, over: false };
116
+ const V = { el: null, cur: null, back: null, subs: [], stack: [], fwd: [], wide: false, rail: false, w: 0, drill: false, over: false, card: null, railKey: null, hold: 0 };
116
117
 
117
118
  /** "PRD" over "PRD", or "File · plans/x.md" over "x.md": the kind is left out when it only repeats the title */
118
119
  const sameAs = (kind, title) => { const k = String(kind || '').trim().toLowerCase().replace(/^file · /, ''), t = String(title || '').trim().toLowerCase(); return !!t && (k === t || k.split('/').pop() === t || k.split('/').pop().replace(/\.[a-z]+$/, '') === t); };
@@ -231,8 +232,11 @@ function setRail(on) {
231
232
  const list = listEl();
232
233
  if (!on && !V.rail) return;
233
234
  if (on && !V.rail && list) V.lw = list.offsetWidth;
235
+ const was = V.rail;
234
236
  V.rail = !!on && !!list;
235
237
  document.body.classList.toggle('cz-vw-rail', V.rail);
238
+ if (!V.rail) V.railKey = null;
239
+ if (was !== V.rail) document.dispatchEvent(new CustomEvent('cz:vw-rail', { detail: { on: V.rail } })); // a page's rail card closes with the rail
236
240
  if (!list) return;
237
241
  let bar = list.querySelector(':scope > .cz-vw-railbar');
238
242
  if (!V.rail) { if (bar) bar.remove(); return; }
@@ -242,23 +246,46 @@ function setRail(on) {
242
246
  bar.addEventListener('click', (e) => {
243
247
  const b = e.target.closest('[data-cz-vw-rail]'); if (!b) return;
244
248
  if (b.dataset.czVwRail === 'show') { V.wide = false; apply(Math.min(V.w, sideMax())); redraw(); return; }
245
- // a group's tile: the list comes back, at that group
249
+ // a group's tile: the page's card of that group's rows, beside the tile (batch 18 item 14, FlA1); the rail and the Viewer stay
250
+ if (V.card) { V.card(b.dataset.czVwRail, b, e.detail === 0); return; }
251
+ // a page without a card: the list comes back, at that group
246
252
  const src = list.querySelector('[data-cz-rail-tile="' + CSS.escape(b.dataset.czVwRail) + '"]');
247
253
  V.wide = false; apply(Math.min(V.w, sideMax())); redraw();
248
254
  if (src && src.scrollIntoView) src.scrollIntoView({ block: 'nearest' });
249
255
  });
250
256
  list.prepend(bar);
251
257
  }
252
- // the groups of the list mark their tile with data-cz-rail-tile="<id>" and data-cz-rail-name: the rail shows those tiles, nothing else
253
- const tiles = [...list.querySelectorAll('[data-cz-rail-tile]')].slice(0, 8);
254
- const box = bar.querySelector('.cz-vw-railtiles'); box.innerHTML = '';
255
- tiles.forEach((t) => { // a copy of the tile itself (its tint, initials and dot), in a press that names the group
256
- const nm = t.dataset.czRailName || t.textContent.trim();
257
- const btn = document.createElement('button'); btn.type = 'button'; btn.className = 'cz-vw-railtile'; btn.dataset.czVwRail = t.dataset.czRailTile;
258
- btn.setAttribute('aria-label', 'Show the list at ' + nm); btn.title = nm;
259
- const c = t.cloneNode(true); c.removeAttribute('data-cz-rail-tile'); c.removeAttribute('data-cz-rail-name'); btn.appendChild(c); box.appendChild(btn);
260
- });
258
+ railTiles(list, bar);
261
259
  }
260
+ /** The rail's tiles: the groups of the list mark their tile with data-cz-rail-tile="<id>" and data-cz-rail-name, and the rail shows those
261
+ * tiles, nothing else. data-cz-rail-here: that group holds what is open, and its tile gets a blue bar (batch 18 item 14, FlA4After). */
262
+ function railTiles(list, bar) {
263
+ const tiles = [...list.querySelectorAll('[data-cz-rail-tile]')].slice(0, 8);
264
+ const box = bar.querySelector('.cz-vw-railtiles');
265
+ const sig = tiles.map((t) => t.outerHTML).join('') + '|' + !!V.card;
266
+ if (box.__sig !== sig) {
267
+ box.__sig = sig; box.innerHTML = '';
268
+ tiles.forEach((t) => { // a copy of the tile itself (its tint, initials and dot), in a press that names the group
269
+ const nm = t.dataset.czRailName || t.textContent.trim(), here = t.hasAttribute('data-cz-rail-here');
270
+ const btn = document.createElement('button'); btn.type = 'button'; btn.className = 'cz-vw-railtile' + (here ? ' here' : ''); btn.dataset.czVwRail = t.dataset.czRailTile;
271
+ btn.setAttribute('aria-label', (V.card ? nm + (here ? ' (open)' : '') + '. Show its initiatives' : 'Show the list at ' + nm)); btn.title = nm;
272
+ if (V.card) btn.setAttribute('aria-haspopup', 'dialog');
273
+ const c = t.cloneNode(true); c.removeAttribute('data-cz-rail-tile'); c.removeAttribute('data-cz-rail-name'); c.removeAttribute('data-cz-rail-here'); btn.appendChild(c); box.appendChild(btn);
274
+ });
275
+ }
276
+ box.querySelectorAll('.cz-vw-railtile').forEach((b) => { const on = b.dataset.czVwRail === V.railKey; b.classList.toggle('on', on); if (V.card) b.setAttribute('aria-expanded', String(on)); });
277
+ }
278
+ /** A page that draws a card for a rail tile (Home): fn(key, tile, byKey) on a tile's press, in place of bringing the list back. */
279
+ export function railCard(fn) { V.card = typeof fn === 'function' ? fn : null; railSync(); }
280
+ /** The tile whose card is open (null: none): its ring and aria-expanded. The page calls it after a redraw of its list, so the rail's tiles
281
+ * follow the list (a new "here" bar, a dot). */
282
+ export function railSync(key) {
283
+ if (key !== undefined) V.railKey = key || null;
284
+ const list = listEl(), bar = V.rail && list && list.querySelector(':scope > .cz-vw-railbar');
285
+ if (bar) railTiles(list, bar);
286
+ }
287
+ /** The next open() keeps the Viewer as wide as it is and the rail folded (a pick from the rail's card, FlA4After). */
288
+ export function keepWide() { V.hold = Date.now() + 2000; }
262
289
  const sideMax = () => { const r = room(); return r.float ? r.side : Math.max(MIN, r.side); };
263
290
  /** Set the width in px: past what the chat leaves, the list folds to a rail first; never under 420 or over about 70%. */
264
291
  function apply(px) {
@@ -506,7 +533,8 @@ export function open(it) {
506
533
  body.className = 'cz-vw-body'; body.onclick = null; body.oninput = null; body.onchange = null; body.onkeydown = null; // what one item's render added to the body does not reach the next
507
534
  const wasHidden = el.hidden;
508
535
  el.hidden = false;
509
- if (!(sameKind && !wasHidden && (V.wide || V.rail))) { const k = widthOf(o.kind); V.wide = false; apply(k || room().def); redraw(); }
536
+ const hold = V.hold > Date.now() && !wasHidden && (V.wide || V.rail); V.hold = 0;
537
+ if (!hold && !(sameKind && !wasHidden && (V.wide || V.rail))) { const k = widthOf(o.kind); V.wide = false; apply(k || room().def); redraw(); }
510
538
  if (typeof o.render === 'function') o.render(body); else if (o.html) body.innerHTML = o.html;
511
539
  emit();
512
540
  if (isPhone()) el.focus();
@@ -662,4 +690,4 @@ if (typeof window !== 'undefined' && typeof window.addEventListener === 'functio
662
690
  window.addEventListener('popstate', popped);
663
691
  try { H.adopt = !!(history.state && history.state.czvw); } catch { H.adopt = false; } // back here from another page, or a reload: the first open takes this entry
664
692
  }
665
- if (typeof window !== 'undefined') window.czViewer = { open, close, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, ICONS };
693
+ if (typeof window !== 'undefined') window.czViewer = { open, close, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railCard, railSync, keepWide, ICONS };
@@ -222,3 +222,7 @@ body.cz-vw-rail [data-cz-vw-list] > :not(.cz-vw-railbar), body.cz-vw-rail #hmLis
222
222
  .nv-facts dt { color: var(--cz-ink3); font-size: var(--fs-2); }
223
223
  .nv-facts dd { margin: 0; overflow-wrap: anywhere; }
224
224
  .nv-rev .czs-cv { align-self: center; font-size: var(--fs-4); }
225
+ /* a tile whose card is open has a ring; the tile of the group that holds what is open has a blue bar on its left (batch 18 item 14) */
226
+ .cz-vw-railtile { position: relative; }
227
+ .cz-vw-railtile.on { box-shadow: 0 0 0 2px var(--cz-blue); }
228
+ .cz-vw-railtile.here::before { content: ""; position: absolute; left: -10px; top: 50%; width: 4px; height: 20px; margin-top: -10px; border-radius: 2px; background: var(--cz-blue); }