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
@@ -120,8 +120,8 @@ const INITIATIVE = () => ({
120
120
  ok('P Built from: Now and Target, a drafted ticket as a pill', !!c && c.built.join(' / ') === 'idpf · sign-ins on CIAM | 15% | 100% by Feb 27 / Microsites · sign-ins on CIAM | — | Ticket MS-212 drafted'
121
121
  && await p.evaluate(() => !!document.querySelector('#czViewer .md-card .md-ru .md-pill')), c && c.built.join(' / '));
122
122
  ok('P one line of why, in Claude\'s words', !!c && c.why === 'idpf is 80% of all sign-ins, so it carries the goal. I check it every morning once you keep it.', c && c.why);
123
- ok('P Discuss in Home, Edit and a solid ✓ Keep this goal: icon-only, each with a label and a title', !!c && c.presses.map((x) => x.label).join() === 'Discuss the proposed goal in Home,Edit the proposed goal in Home,Keep this goal'
124
- && c.presses.every((x) => x.title && !x.text && x.svg) && c.presses[2].solid && /ask=program%3Aproject-ascent/.test(c.presses[0].href) && /^\/premium\.html\?ws=idpf/.test(c.presses[1].href), JSON.stringify(c && c.presses));
123
+ ok('P Discuss in Home, Edit (in place, batch 16) and a solid ✓ Keep this goal: icon-only, each with a label and a title', !!c && c.presses.map((x) => x.label).join() === 'Discuss the proposed goal in Home,Edit the proposed goal,Keep this goal'
124
+ && c.presses.every((x) => x.title && !x.text && x.svg) && c.presses[2].solid && /ask=program%3Aproject-ascent/.test(c.presses[0].href) && !c.presses[1].href, JSON.stringify(c && c.presses));
125
125
  ok('P the read names the program and its product', D.gets.some((g) => g.scope === 'program' && g.id === 'project-ascent' && g.ws === 'idpf'), JSON.stringify(D.gets));
126
126
  const ps = await sizes(p, '#czViewer .md-card');
127
127
  ok('S the card uses the type scale only', ps.length && ps.every((x) => SCALE.has(x)), ps.join());
@@ -157,8 +157,8 @@ const INITIATIVE = () => ({
157
157
  ok('I the proposed success measure sits under the stage card, with where it came from', !!ic && ic.after && ic.hd === 'Proposed success measure' && ic.src === 'from the PRD and the desktop launch', JSON.stringify(ic));
158
158
  ok('I three groups in order, each Now → Target', !!ic && ic.rows.join(' / ') === 'Proves it worked · 4 weeks after release | Mobile checkout login drop-off | Moves your key result “drop-off under 15%” | 27% | 19% / Early signal · shows in days | Inline form completion | Ticket ESHOP-981 drafted | — | 80% week 1 / Guardrail | Checkout conversion | A faster login must not cost orders | 3.1% | ≥ 3.1%', ic && ic.rows.join(' / '));
159
159
  ok('I one line of why', !!ic && /^Desktop fell 7 points/.test(ic.why));
160
- ok('I Edit and a solid ✓ Keep this success measure: icon-only, each with a label and a title', !!ic && ic.presses.map((x) => x.label).join() === 'Edit the proposed success measure in Home,Keep this success measure'
161
- && ic.presses.every((x) => x.title && !x.text) && ic.presses[1].solid && /ask=descope-parity/.test(ic.presses[0].href), JSON.stringify(ic && ic.presses));
160
+ ok('I Edit (in place, batch 16) and a solid ✓ Keep this success measure: icon-only, each with a label and a title', !!ic && ic.presses.map((x) => x.label).join() === 'Edit the proposed success measure,Keep this success measure'
161
+ && ic.presses.every((x) => x.title && !x.text) && ic.presses[1].solid && !ic.presses[0].href, JSON.stringify(ic && ic.presses));
162
162
  const is = await sizes(p, '#czViewer .iv .md-card');
163
163
  ok('S the initiative card uses the type scale only', is.length && is.every((x) => SCALE.has(x)), is.join());
164
164
  await shot(p, 'Iq9Initiative-proposed-built');
@@ -142,7 +142,7 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
142
142
 
143
143
  /* ── M: Home's Your move ── */
144
144
  const M = await open({ home: true });
145
- // the program's milestone changes lead its card on Home (batch 14 item 4: a desktop has no Your day; the greeting opens the calendar)
145
+ // the program's milestone changes lead its card on Home (batch 14 item 4)
146
146
  await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 10000);
147
147
  const hm = await until(() => M.page.evaluate(() => { const b = document.querySelector('[data-hm-sel="ms:project-ascent"]'); return b ? [...b.querySelectorAll('b, em')].map((x) => x.textContent.trim()).join(' · ') : null; }), 10000);
148
148
  ok('M Home\'s program card has one line for its milestone changes, first', hm === '3 milestone changes · Pilot live to Dec 2', String(hm));
@@ -150,11 +150,11 @@ const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empt
150
150
  await M.page.click('[data-hm-sel="ms:project-ascent"]');
151
151
  ok('M a tap opens the program, where the changes lead Waits on you', !!(await until(() => M.page.evaluate(() => !!document.querySelector('#czViewer [data-czs-id="needs"] .msg-r')), 8000)));
152
152
  }
153
- // batch 14 item 4: on a desktop the greeting opens the calendar in the Viewer, not Your day
153
+ // batch 16: on a desktop the greeting opens Your day in the Viewer, as on a phone; the calendar is under ⋯
154
154
  if (await M.page.$('[data-hm-day]')) {
155
155
  await M.page.click('[data-hm-day]');
156
- const vw = await until(() => M.page.evaluate(() => { const v = document.querySelector('#czViewer'); const t = v && !v.hidden ? v.textContent.replace(/\s+/g, ' ') : ''; return /Calendar|Your move/.test(t) ? t : null; }), 8000);
157
- ok('D on a desktop the greeting opens the calendar in the Viewer; there is no Your day', vw && /Calendar/.test(vw) && !/Your move/.test(vw), String(vw).slice(0, 200));
156
+ const vw = await until(() => M.page.evaluate(() => { const v = document.querySelector('#czViewer'); const t = v && !v.hidden ? v.textContent.replace(/\s+/g, ' ') : ''; return /Your day/.test(t) ? t : null; }), 8000);
157
+ ok('D on a desktop the greeting opens Your day in the Viewer, as on a phone', !!vw, String(vw).slice(0, 200));
158
158
  }
159
159
  ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
160
160
  await M.ctx.close();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.429.0",
3
+ "version": "0.430.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.429.0",
9
+ "version": "0.430.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.429.0",
3
+ "version": "0.430.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",
@@ -76,7 +76,7 @@ const SHOTS = process.env.PMOS_SHOTS || '';
76
76
  await page.evaluate(() => {
77
77
  window.__rise = 0; window.__loads = 0; window.__frame = document.querySelector('#czViewer .obody.vw iframe.vwframe');
78
78
  window.__turns = [...document.querySelectorAll('#hmLog .hm-u, #hmLog .hm-a')];
79
- document.querySelector('#hmLog').addEventListener('animationstart', () => { window.__rise++; }); // any entrance a turn plays again
79
+ document.querySelector('#hmLog').addEventListener('animationstart', (e) => { if (!e.target.closest('.ad-svg')) window.__rise++; }); // any entrance a turn plays again (Adler's own idle motion on the latest reply is not an entrance)
80
80
  if (window.__frame) window.__frame.addEventListener('load', () => { window.__loads++; });
81
81
  });
82
82
  await sleep(7000); // three conversation reads and two list reads
@@ -29,7 +29,7 @@
29
29
  * shows) and its PMOS tasks (GET /api/boards/items). A part whose read failed is left out, never guessed. Every fold is kept in this browser. */
30
30
  import { pmPost } from './http.js';
31
31
  import { esc, store } from './premium-shell.js';
32
- import { programState, milestoneTrack, milestoneGroups, goalsByPeriod, shortDay, toJira, milestoneStep } from './program-model.js';
32
+ import { programState, liveRows, milestoneTrack, milestoneGroups, goalsByPeriod, shortDay, toJira, milestoneStep } from './program-model.js';
33
33
  import { STEPS } from './premium-initiative-head.js';
34
34
  import * as VW from './cozy-viewer.js';
35
35
  import * as Pop from './bd-pop.js';
@@ -69,7 +69,7 @@ function rowsOf(ws) {
69
69
  const M = O.M(); if (!M) return null;
70
70
  const steps = M.steps || [];
71
71
  const shape = (rows) => (rows || []).filter((r) => r.id).map((r) => ({ ...r, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage }));
72
- if (!ws || !board().ws || ws === board().ws) return { name: board().product || board().name || '', rows: shape(M.rows), here: true };
72
+ if (!ws || !board().ws || ws === board().ws) return { name: board().product || board().name || '', rows: shape(liveRows(M)), here: true };
73
73
  const a = AWAY.get(ws);
74
74
  return a && a !== 'reading' ? { name: a.name, rows: shape(a.rows) } : null;
75
75
  }
@@ -85,7 +85,7 @@ function readAway(p) {
85
85
  // still reading (a cold board answers before its model is ready), or refused: ask again a few times, then the next open asks again,
86
86
  // so a member does not stay "not read" until the panel is opened again
87
87
  if (!r || !r.ok || !r.model) { AWAY.delete(ws); const n = (TRIES.get(ws) || 0) + 1; TRIES.set(ws, n); if (n < 4 && cur && cur.id === p.id) setTimeout(() => { if (cur && cur.id === p.id) { readAway(p); draw(); } }, 1500 * n); return; }
88
- AWAY.set(ws, { name: (r.model.board && (r.model.board.product || r.model.board.name)) || ws, board: (r.model.board && r.model.board.id) || ws, rows: r.model.rows || [] });
88
+ AWAY.set(ws, { name: (r.model.board && (r.model.board.product || r.model.board.name)) || ws, board: (r.model.board && r.model.board.id) || ws, rows: liveRows(r.model) });
89
89
  if (cur && cur.id === p.id) draw();
90
90
  });
91
91
  }
@@ -17,7 +17,7 @@
17
17
  * A program has no stage of its own (PM, 2026-10-23): the band shows only what its initiatives say. With one product picked, the program shows
18
18
  * that product's initiatives (PRD decision 5); its other products count in its line and its readiness, and their initiatives are not drawn here.
19
19
  * With All products picked, the program holds a sub-row per product with that product's initiatives, then one group per product follows. */
20
- import { programState, groupRows, mergeClose } from './program-model.js';
20
+ import { programState, groupRows, mergeClose, liveRows } from './program-model.js';
21
21
  import { goalsOf } from './home-list.js';
22
22
 
23
23
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -55,7 +55,7 @@ export function groupsOf(programs, rows, M, byProduct) {
55
55
  export function stateOf(p, M, XR, now = Date.now()) {
56
56
  const ws = (M && M.board && M.board.ws) || '';
57
57
  const steps = (M && M.steps) || [];
58
- const rows = ((M && M.rows) || []).filter((r) => r.id).map((r) => ({ id: r.id, title: r.title, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage, anchor: r.anchor, ws: r.ws, product: r.product, start: r.start || null, end: r.end || null })); // the dates: Claude's order (prog-order.js)
58
+ const rows = liveRows(M).filter((r) => r.id).map((r) => ({ id: r.id, title: r.title, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage, anchor: r.anchor, ws: r.ws, product: r.product, start: r.start || null, end: r.end || null })); // the dates: Claude's order (prog-order.js)
59
59
  // All products: every product's rows are on this board, each with its own workspace
60
60
  if (M && M.board && M.board.all) return programState(p, (w) => { const R = rows.filter((r) => r.ws === w); return R.length ? { name: R[0].product, rows: R } : null; }, now);
61
61
  return programState(p, (w) => (!w || !ws || w === ws ? { name: prodName(M), rows } : (XR && XR[w]) || null), now);
@@ -0,0 +1,82 @@
1
+ /* cozy-adler.css — Adler, Claude's face in PMOS (feedback batch 16 item 2; pm/cozy-adler.js adds this sheet). The art's colours are the --ad-*
2
+ * tokens in cozy.css; the classes below give them to the SVG (adf- a fill, ads- a stroke, adg- a gradient stop). Then the sizes' boxes, the
3
+ * toast face, the scenes, dark mode (the scene dims, Adler stays warm) and the slow motion of AdMotion. All motion stops under
4
+ * prefers-reduced-motion and under Settings > Adler > Motion: Still (html.ad-still). Motion is on Adler and his scene only, never on data
5
+ * (design principle 12, the Adler exception). */
6
+
7
+ .ad-svg .adf-pink,.ad-scene .adf-pink{fill:var(--ad-pink)} .ad-svg .adf-blush,.ad-scene .adf-blush{fill:var(--ad-blush)} .ad-svg .adf-ink,.ad-scene .adf-ink{fill:var(--ad-ink)} .ad-svg .adf-mouth,.ad-scene .adf-mouth{fill:var(--ad-mouth)} .ad-svg .adf-tongue,.ad-scene .adf-tongue{fill:var(--ad-tongue)} .ad-svg .adf-white,.ad-scene .adf-white{fill:var(--ad-white)} .ad-svg .adf-shade,.ad-scene .adf-shade{fill:var(--ad-shade)} .ad-svg .adf-shadow,.ad-scene .adf-shadow{fill:var(--ad-shadow)} .ad-svg .adf-hoodd,.ad-scene .adf-hoodd{fill:var(--ad-hoodd)} .ad-svg .adf-hoodl,.ad-scene .adf-hoodl{fill:var(--ad-hoodl)} .ad-svg .adf-mug,.ad-scene .adf-mug{fill:var(--ad-mug)} .ad-svg .adf-mugleaf,.ad-scene .adf-mugleaf{fill:var(--ad-mugleaf)} .ad-svg .adf-gold,.ad-scene .adf-gold{fill:var(--ad-gold)} .ad-svg .adf-hp,.ad-scene .adf-hp{fill:var(--ad-hp)} .ad-svg .adf-lens,.ad-scene .adf-lens{fill:var(--ad-lens)} .ad-svg .adf-sun,.ad-scene .adf-sun{fill:var(--ad-sun)} .ad-svg .adf-sunglow,.ad-scene .adf-sunglow{fill:var(--ad-sunglow)} .ad-svg .adf-moon,.ad-scene .adf-moon{fill:var(--ad-moon)} .ad-svg .adf-firefly,.ad-scene .adf-firefly{fill:var(--ad-firefly)} .ad-svg .adf-raincloud,.ad-scene .adf-raincloud{fill:var(--ad-raincloud)} .ad-svg .adf-ground,.ad-scene .adf-ground{fill:var(--ad-ground)} .ad-svg .adf-groundn,.ad-scene .adf-groundn{fill:var(--ad-groundn)} .ad-svg .adf-leaf2,.ad-scene .adf-leaf2{fill:var(--ad-leaf2)} .ad-svg .adf-thinkdot,.ad-scene .adf-thinkdot{fill:var(--ad-thinkdot)} .ad-svg .adf-night0,.ad-scene .adf-night0{fill:var(--ad-night0)}
8
+ .ad-svg .ads-cream,.ad-scene .ads-cream{stroke:var(--ad-c1)} .ad-svg .ads-ink,.ad-scene .ads-ink{stroke:var(--ad-ink)} .ad-svg .ads-glass,.ad-scene .ads-glass{stroke:var(--ad-glass)} .ad-svg .ads-creamhi,.ad-scene .ads-creamhi{stroke:var(--ad-creamhi)} .ad-svg .ads-hp,.ad-scene .ads-hp{stroke:var(--ad-hp)} .ad-svg .ads-grass,.ad-scene .ads-grass{stroke:var(--ad-grass)} .ad-svg .ads-drop,.ad-scene .ads-drop{stroke:var(--ad-drop)} .ad-svg .ads-white,.ad-scene .ads-white{stroke:var(--ad-white)} .ad-svg .ads-cardline,.ad-scene .ads-cardline{stroke:var(--ad-cardline)} .ad-svg .ads-tick,.ad-scene .ads-tick{stroke:var(--ad-tick)}
9
+ .adg-f0{stop-color:var(--ad-f0)} .adg-f1{stop-color:var(--ad-f1)} .adg-f2{stop-color:var(--ad-f2)} .adg-c0{stop-color:var(--ad-c0)} .adg-c1{stop-color:var(--ad-c1)} .adg-c2{stop-color:var(--ad-c2)} .adg-h0{stop-color:var(--ad-h0)} .adg-h1{stop-color:var(--ad-h1)} .adg-h2{stop-color:var(--ad-h2)} .adg-l0{stop-color:var(--ad-l0)} .adg-l1{stop-color:var(--ad-l1)} .adg-morning0{stop-color:var(--ad-morning0)} .adg-morning1{stop-color:var(--ad-morning1)} .adg-tea0{stop-color:var(--ad-tea0)} .adg-tea1{stop-color:var(--ad-tea1)} .adg-win0{stop-color:var(--ad-win0)} .adg-win1{stop-color:var(--ad-win1)} .adg-think0{stop-color:var(--ad-think0)} .adg-think1{stop-color:var(--ad-think1)} .adg-rain0{stop-color:var(--ad-rain0)} .adg-rain1{stop-color:var(--ad-rain1)} .adg-night0{stop-color:var(--ad-night0)} .adg-night1{stop-color:var(--ad-night1)} .adg-plain0{stop-color:var(--ad-plain0)} .adg-plain1{stop-color:var(--ad-plain1)}
10
+
11
+ .ad-svg { display: inline-block; flex: none; vertical-align: middle; }
12
+ .ad-dot { display: inline-block; flex: none; width: var(--ad-px, 12px); height: var(--ad-px, 12px); max-width: 12px; max-height: 12px; border-radius: 50%; background: var(--cz-dot-ok, currentColor); vertical-align: middle; }
13
+ .ad-dot.m-honest { background: var(--cz-dot-red, currentColor); }
14
+ .ad-dot.m-needs-you { background: var(--cz-blue, currentColor); }
15
+ .ad-dot.m-thinking, .ad-dot.m-resting { background: var(--cz-dot-q, currentColor); }
16
+ .ad-dot.m-celebrating { background: var(--cz-dot-risk, currentColor); }
17
+ .ad-scene { display: block; width: 100%; height: auto; border-radius: 18px; }
18
+ .ad-scene .ad-z { font-family: var(--cz-sans, sans-serif); font-weight: 800; }
19
+ .ad-scene .ad-z.z0 { font-size: var(--fs-3); } .ad-scene .ad-z.z1 { font-size: var(--fs-4); } .ad-scene .ad-z.z2 { font-size: var(--fs-5); }
20
+ .ad-scene-face { display: flex; justify-content: center; padding: 12px 0; }
21
+ .ad-peek { display: block; }
22
+ /* every toast (AdM1-4): the S face before the words */
23
+ .ad-tf { display: inline-flex; align-items: center; margin-right: 8px; vertical-align: middle; }
24
+ .ad-toast { display: inline-flex; align-items: center; }
25
+ /* dark mode (AdU8): the scene's sky and ground dim; Adler keeps his own warm colours */
26
+ :root[data-theme="dark"] .ad-env, .cz.dark .ad-env { filter: brightness(.55) saturate(.85); }
27
+
28
+ .am .ad-br { animation: adBr 4.6s ease-in-out infinite; transform-origin: 100px 250px; }
29
+ @keyframes adBr { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.008, 1.018); } }
30
+ .am .ad-sp { animation: adSp 5.2s ease-in-out infinite; transform-origin: 100px 38px; }
31
+ @keyframes adSp { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
32
+ .am .ad-ey { animation: adBl 5.6s infinite; transform-box: fill-box; transform-origin: center; }
33
+ @keyframes adBl { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.12); } }
34
+ .am .ad-tl { animation: adTl 3.2s ease-in-out infinite; transform-origin: 146px 214px; }
35
+ @keyframes adTl { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(7deg); } }
36
+ .am.m-joy .ad-tl { animation-duration: 1s; }
37
+ .am.m-joy .ad-br { animation: adHop 2.6s ease-in-out infinite; }
38
+ @keyframes adHop { 0%, 60%, 100% { transform: translateY(0); } 72% { transform: translateY(-6px); } 84% { transform: translateY(0); } }
39
+ .am.m-joy .ad-ey, .am.m-rest .ad-ey { animation: none; }
40
+ .am.m-worry .ad-tl, .am.m-rest .ad-tl { animation: none; }
41
+ .am.m-worry .ad-sp { animation-duration: 9s; }
42
+ .am.m-rest .ad-br { animation-duration: 6.5s; }
43
+ /* the S face in a toast or a chip only blinks: a 24 px face that breathes reads as jitter */
44
+ .ad-tf .am *, .ad-svg[width="24"] .ad-sp { animation: none; }
45
+ .env-glow { animation: enGl 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
46
+ @keyframes enGl { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .85; transform: scale(1.08); } }
47
+ .env-cloud { animation: enCl 26s ease-in-out infinite alternate; }
48
+ @keyframes enCl { from { transform: translateX(-14px); } to { transform: translateX(18px); } }
49
+ .env-steam { animation: enSt 3.6s ease-out infinite; opacity: 0; }
50
+ .env-steam.d2 { animation-delay: 1.2s; } .env-steam.d3 { animation-delay: 2.4s; }
51
+ @keyframes enSt { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: .6; } 100% { opacity: 0; transform: translateY(-22px); } }
52
+ .env-leaf { animation: enLf 7s ease-in 1 forwards; opacity: 0; }
53
+ .env-leaf.d2 { animation-delay: .5s; } .env-leaf.d3 { animation-delay: 1s; } .env-leaf.d4 { animation-delay: 1.4s; } .env-leaf.d5 { animation-delay: .8s; }
54
+ @keyframes enLf { 0% { opacity: 0; transform: translate(0, -10px) rotate(0); } 6% { opacity: 1; } 40% { opacity: 1; transform: translate(14px, 120px) rotate(200deg); } 48%, 100% { opacity: 0; transform: translate(16px, 140px) rotate(240deg); } }
55
+ .env-tw { animation: enTw 3.4s ease-in-out infinite; }
56
+ .env-tw.d2 { animation-delay: 1.1s; } .env-tw.d3 { animation-delay: 2.2s; }
57
+ @keyframes enTw { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
58
+ .env-ff { animation: enFf 9s ease-in-out infinite alternate; }
59
+ .env-ff.d2 { animation-duration: 11s; animation-delay: -3s; }
60
+ @keyframes enFf { 0% { transform: translate(0, 0); opacity: .3; } 50% { transform: translate(18px, -14px); opacity: 1; } 100% { transform: translate(-10px, -24px); opacity: .4; } }
61
+ .env-z { animation: enZ 4.5s ease-out infinite; opacity: 0; }
62
+ .env-z.d2 { animation-delay: 1.5s; } .env-z.d3 { animation-delay: 3s; }
63
+ @keyframes enZ { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 25% { opacity: .8; } 100% { opacity: 0; transform: translate(14px, -34px) scale(1.15); } }
64
+ .env-dot { animation: enDt 1.5s ease-in-out infinite; }
65
+ .env-dot.d2 { animation-delay: .25s; } .env-dot.d3 { animation-delay: .5s; }
66
+ @keyframes enDt { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
67
+ .env-sway { animation: enSw 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom center; }
68
+ .env-sway.d2 { animation-delay: -1.5s; }
69
+ @keyframes enSw { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
70
+ .env-drop { animation: enDr 2.2s linear infinite; opacity: 0; }
71
+ .env-drop.d2 { animation-delay: .7s; } .env-drop.d3 { animation-delay: 1.4s; }
72
+ @keyframes enDr { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: .6; } 100% { opacity: 0; transform: translateY(26px); } }
73
+ /* still: the OS asks for less motion, or Settings > Adler > Motion is Still. A leaf that would fall once is simply not drawn. */
74
+ html.ad-still .am *, html.ad-still .ad-scene * { animation: none !important; }
75
+ html.ad-still .env-steam, html.ad-still .env-z, html.ad-still .env-drop { opacity: .6; }
76
+ html.ad-still .env-leaf { opacity: 0; }
77
+ @media (prefers-reduced-motion: reduce) {
78
+ .am *, .ad-scene * { animation: none !important; }
79
+ .env-steam, .env-z, .env-drop { opacity: .6; }
80
+ .env-leaf { opacity: 0; }
81
+ }
82
+ svg.ad-svg.am { stroke: none; }
@@ -0,0 +1,270 @@
1
+ /* pm/cozy-adler.js — Adler, Claude's face in PMOS (feedback batch 16 item 2; canvas "Adler · Claude's face in PMOS", frames AdSystem, AdSheet,
2
+ * AdSoft, AdMotion, AdB1-3, AdP1-6, AdH1-8, AdU1-9, AdM1-5; spec adler-character/ADLER-SYSTEM.md). Wawan's own art: a Shiba in a green hoodie
3
+ * with a sprout, drawn soft 3D (SVG gradients) with slow, small motion.
4
+ *
5
+ * One module draws him everywhere, so every surface shows the same Adler:
6
+ * adler(mood, size, o) the S face (24 px), the M face (36-48 px, default 40) or the L figure (110-170 px, default 140) as inline SVG
7
+ * adlerScene(kind, mood, o) the XL scene: morning, tea, win, think, rain, night (first run, after 22:00, start-up, errors)
8
+ * adlerPeek() his ears over the floating button when one call needs the PM (AdP6)
9
+ * moodOfText(t) the mood of a sentence Claude already says: honest when it failed, handled otherwise (AdM1-4 toasts)
10
+ * mountToastFaces(doc) every #toast gets the S face in the mood of its words
11
+ * prefs(), loadPrefs(), savePref(key, value) Settings > Adler (AdM5): adler.amount, adler.motion, adler.celebrate, adler.quiet
12
+ * asleep(now), mayCelebrate(now), celebrated(now) the after-22:00 rule and "celebrate at most once a week"
13
+ *
14
+ * The binding rules (design-principles.md, "The Adler rule"): the mood comes from real state only, and no trigger means resting or handled;
15
+ * one Adler per screen; never inside data (rows, bars, charts, KR rows, reports, connector lists); he never replaces a row's dot or box;
16
+ * Adlerian words (thanks for contribution, no praise, no points, no streaks, no blame); the mood is never happier than the data. All motion
17
+ * stops under prefers-reduced-motion and under Settings > Adler > Motion: Still. Off draws the plain mood dot; Face only drops the figures
18
+ * and scenes. Colours are the --ad-* tokens in cozy.css: this file names classes, never a colour. Each drawing has its own id prefix, so
19
+ * two Adlers on one page never share a gradient. Pure string builders, so a unit test can read them. */
20
+
21
+ const CSS = new URL('./cozy-adler.css', import.meta.url).href;
22
+ const TOKENS = new URL('./cozy.css', import.meta.url).href;
23
+ export const MOODS = Object.freeze(['handled', 'celebrating', 'thinking', 'needs-you', 'honest', 'resting']);
24
+ const INNER = { handled: 'calm', celebrating: 'joy', thinking: 'think', 'needs-you': 'ask', honest: 'worry', resting: 'rest' };
25
+ const WORDS = { handled: 'handled', celebrating: 'celebrating', thinking: 'thinking', 'needs-you': 'needs you', honest: 'honest, something is not right', resting: 'resting' };
26
+ export const SIZES = Object.freeze({ s: 24, m: 40, l: 140 });
27
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
28
+ const moodOf = (m) => (INNER[m] ? m : 'handled');
29
+ let seq = 0;
30
+ const nextId = () => 'ad' + (++seq).toString(36);
31
+
32
+ /* ── the art (ported from adler-character/adler.py and soft.py) ── */
33
+ const F = (k) => `adf-${k}`, S = (k) => `ads-${k}`;
34
+ const L_FUR = 'rgba(170,100,30,.22)', L_CREAM = 'rgba(170,130,80,.18)', L_HOOD = 'rgba(50,75,25,.35)', L_LEAF = 'rgba(80,120,40,.35)';
35
+
36
+ function defs(p) {
37
+ const rg = (id, cx, cy, r, stops) => `<radialGradient id="${p}${id}" gradientUnits="userSpaceOnUse" cx="${cx}" cy="${cy}" r="${r}">${stops.map(([o, k]) => `<stop offset="${o}" class="adg-${k}"/>`).join('')}</radialGradient>`;
38
+ return '<defs>' + rg('f', 78, 58, 190, [[0, 'f0'], [0.45, 'f1'], [1, 'f2']]) + rg('c', 86, 104, 80, [[0, 'c0'], [0.7, 'c1'], [1, 'c2']])
39
+ + rg('h', 78, 166, 100, [[0, 'h0'], [0.55, 'h1'], [1, 'h2']]) + rg('l', 96, 4, 44, [[0, 'l0'], [1, 'l1']])
40
+ + `<filter id="${p}b" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="3.5"/></filter></defs>`;
41
+ }
42
+ function sprout(m, p) {
43
+ const rot = { calm: 0, joy: -8, think: 10, ask: -4, worry: 30, rest: 16 }[m];
44
+ let l1 = 'M100 22 C 88 6, 70 8, 66 18 C 74 26, 90 28, 100 22Z', l2 = 'M100 22 C 112 4, 132 6, 136 16 C 128 26, 110 28, 100 22Z';
45
+ if (m === 'worry') { l1 = 'M100 22 C 90 12, 74 14, 70 24 C 80 30, 94 30, 100 22Z'; l2 = 'M100 22 C 106 30, 118 40, 130 38 C 130 28, 116 18, 100 22Z'; }
46
+ const leaf = (d) => `<path d="${d}" fill="url(#${p}l)" stroke="${L_LEAF}" stroke-width="2" stroke-linejoin="round"/>`;
47
+ return `<g class="ad-sp"><g transform="rotate(${rot} 100 36)"><path d="M100 38 L100 22" fill="none" stroke="${L_LEAF}" stroke-width="4" stroke-linecap="round"/>${leaf(l1)}${leaf(l2)}`
48
+ + `<path d="M100 22 C 92 18, 82 17, 74 18" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/><path d="M100 22 C 110 17, 120 15, 128 16" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/></g></g>`;
49
+ }
50
+ const mirror = (d) => { let x = true; return d.replace(/[MCZ]|-?\d+\.?\d*/g, (t) => { if (/[MCZ]/.test(t)) { x = true; return t; } const v = Number(t); const o = x ? String(200 - v) : String(v); x = !x; return ' ' + o; }); };
51
+ function ears(m, p) {
52
+ const down = m === 'worry' || m === 'rest';
53
+ const L = down ? 'M46 70 C 34 50, 34 34, 40 26 C 56 30, 72 44, 82 56Z' : 'M44 66 C 38 44, 40 24, 50 12 C 64 20, 78 36, 86 50Z';
54
+ const Li = down ? 'M50 64 C 44 50, 44 40, 47 35 C 58 40, 66 48, 72 55Z' : 'M50 60 C 46 44, 48 32, 53 24 C 62 32, 70 40, 76 50Z';
55
+ return [[L, Li], [mirror(L), mirror(Li)]].map(([a, b]) => `<path d="${a}" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="${b}" class="${F('pink')}"/>`).join('');
56
+ }
57
+ function face(m, p) {
58
+ let s = '';
59
+ const brow = (x) => `<ellipse cx="${x}" cy="${m === 'ask' ? 66 : 72}" rx="8" ry="5" fill="url(#${p}c)"/>`;
60
+ s += m === 'worry' ? `<path d="M66 72 L82 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/><path d="M134 72 L118 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/>` : brow(76) + brow(124);
61
+ s += '<g class="ad-ey">';
62
+ if (m === 'joy') s += `<path d="M66 96 Q76 84 86 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/><path d="M114 96 Q124 84 134 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/>`;
63
+ else if (m === 'rest') s += `<path d="M67 94 Q76 100 85 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/><path d="M115 94 Q124 100 133 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/>`;
64
+ else {
65
+ const [dx, dy] = { think: [3, -3], worry: [0, 1] }[m] || [0, 0], r = m === 'worry' ? 10 : 11;
66
+ for (const cx of [76, 124]) s += `<circle cx="${cx + dx}" cy="${93 + dy}" r="${r}" class="${F('ink')}"/><circle cx="${cx + dx + 3}" cy="${89 + dy}" r="3.6" class="${F('white')}"/><circle cx="${cx + dx - 3}" cy="${97 + dy}" r="1.6" class="${F('white')}" opacity=".8"/>`;
67
+ }
68
+ if (m === 'think') s += `<circle cx="78" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><circle cx="122" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><path d="M95 92 Q100 88 105 92" fill="none" class="${S('glass')}" stroke-width="3"/>`;
69
+ s += '</g>';
70
+ const op = m === 'worry' ? '.35' : '.75';
71
+ s += `<ellipse cx="58" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/><ellipse cx="142" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/>`;
72
+ s += `<path d="M93 106 Q100 102 107 106 Q106 112 100 113 Q94 112 93 106Z" class="${F('ink')}"/>`;
73
+ if (m === 'joy') s += `<path d="M88 117 Q100 113 112 117 Q112 134 100 135 Q88 134 88 117Z" class="${F('mouth')}"/><path d="M92 128 Q100 122 108 128 Q106 135 100 135 Q94 135 92 128Z" class="${F('tongue')}"/>`;
74
+ else if (m === 'ask') s += `<path d="M91 117 Q100 115 109 117 Q108 128 100 129 Q92 128 91 117Z" class="${F('mouth')}"/><path d="M94 125 Q100 121 106 125 Q104 129 100 129 Q96 129 94 125Z" class="${F('tongue')}"/>`;
75
+ else if (m === 'think') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><ellipse cx="100" cy="122" rx="3.5" ry="3" class="${F('mouth')}"/>`;
76
+ else if (m === 'worry') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><path d="M89 125 Q100 119 111 125" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round"/>`;
77
+ else s += `<path d="M100 113 L100 118 M100 118 Q94 124 88 119 M100 118 Q106 124 112 119" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>`;
78
+ return s;
79
+ }
80
+ function head(m, p, prop) {
81
+ let h = sprout(m, p) + ears(m, p);
82
+ h += `<path d="M28 98 C 28 54, 60 32, 100 32 C 140 32, 172 54, 172 98 C 172 138, 140 156, 100 156 C 60 156, 28 138, 28 98Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/>`;
83
+ h += `<ellipse cx="74" cy="56" rx="30" ry="14" class="${F('white')}" opacity=".35" filter="url(#${p}b)"/><path d="M40 120 C 50 150, 150 150, 160 120 C 150 160, 50 160, 40 120Z" class="${F('shade')}" opacity=".12" filter="url(#${p}b)"/>`;
84
+ h += `<path d="M36 108 C 44 92, 70 92, 100 102 C 130 92, 156 92, 164 108 C 162 140, 136 154, 100 154 C 64 154, 38 140, 36 108Z" fill="url(#${p}c)"/>`;
85
+ h += face(m, p);
86
+ // AdH5: headphones while a meeting records
87
+ if (prop === 'headphones') h += `<path d="M34 96 C 30 36, 170 36, 166 96" fill="none" class="${S('hp')}" stroke-width="8" stroke-linecap="round"/><rect x="20" y="82" width="20" height="34" rx="9" class="${F('hp')}"/><rect x="160" y="82" width="20" height="34" rx="9" class="${F('hp')}"/>`;
88
+ return h;
89
+ }
90
+ const capsule = (x1, y1, x2, y2, w, p) => `<path d="M${x1} ${y1} L${x2} ${y2}" stroke="${L_HOOD}" stroke-width="${w + 5}" stroke-linecap="round" fill="none"/><path d="M${x1} ${y1} L${x2} ${y2}" stroke="url(#${p}h)" stroke-width="${w}" stroke-linecap="round" fill="none"/>`;
91
+ const paw = (x, y, p, r = 12) => `<circle cx="${x}" cy="${y}" r="${r}" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
92
+ const POSES = {
93
+ joy: [[[62, 172], [30, 124]], [[138, 172], [170, 124]]], think: [[[62, 176], [54, 214]], [[136, 174], [118, 140]]],
94
+ ask: [[[62, 176], [54, 214]], [[138, 172], [162, 128]]], worry: [[[64, 178], [86, 206]], [[136, 178], [114, 206]]],
95
+ };
96
+ function body(p) {
97
+ let s = `<g class="ad-tl"><path d="M140 222 C 172 226, 186 196, 172 182 C 160 172, 146 186, 156 196 C 164 204, 152 214, 140 210Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="M168 186 C 176 194, 172 206, 164 210" fill="none" class="${S('creamhi')}" stroke-width="6" stroke-linecap="round"/></g>`;
98
+ for (const x of [78, 122]) s += `<rect x="${x - 14}" y="214" width="28" height="26" rx="12" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/><ellipse cx="${x}" cy="240" rx="17" ry="8" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
99
+ s += `<path d="M58 160 C 50 182, 50 210, 56 224 C 70 232, 130 232, 144 224 C 150 210, 150 182, 142 160 Z" fill="url(#${p}h)" stroke="${L_HOOD}" stroke-width="3" stroke-linejoin="round"/>`;
100
+ s += `<path d="M74 198 C 74 192, 126 192, 126 198 L 128 218 C 110 222, 90 222, 72 218Z" class="${F('hoodd')}" opacity=".45"/><path d="M100 186 C 94 180, 94 172, 100 168 C 106 172, 106 180, 100 186Z" class="${F('hoodl')}"/>`;
101
+ s += `<path d="M50 150 C 60 170, 140 170, 150 150 C 140 160, 60 160, 50 150Z" class="${F('hoodd')}"/>`;
102
+ return s;
103
+ }
104
+ const strings = (p) => `<path d="M90 160 L88 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="88" cy="184" r="3" fill="url(#${p}c)"/><path d="M110 160 L112 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="112" cy="184" r="3" fill="url(#${p}c)"/>`;
105
+ const mug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${F('mug')}" stroke="${L_HOOD}" stroke-width="2.5"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" stroke="${L_HOOD}" stroke-width="3"/><path d="M101 198 C 95 204, 97 212, 101 214 C 105 212, 107 204, 101 198Z" class="${F('mugleaf')}"/>`;
106
+ const sparkles = () => [[26, 60, 7], [176, 52, 6], [20, 150, 5], [182, 150, 5]].map(([x, y, r]) => `<path d="M${x} ${y - r} L${x + r * 0.3} ${y - r * 0.3} L${x + r} ${y} L${x + r * 0.3} ${y + r * 0.3} L${x} ${y + r} L${x - r * 0.3} ${y + r * 0.3} L${x - r} ${y} L${x - r * 0.3} ${y - r * 0.3}Z" class="${F('gold')}"/>`).join('');
107
+ function full(m, p, prop) {
108
+ let g = body(p);
109
+ if (m === 'calm' || m === 'rest') {
110
+ g += head(m, p, prop) + strings(p) + capsule(64, 176, 80, 206, 22, p) + capsule(136, 176, 122, 206, 22, p) + paw(82, 210, p, 9) + paw(120, 210, p, 9) + mug();
111
+ return g;
112
+ }
113
+ if (m === 'joy') g += sparkles();
114
+ g += head(m, p, prop) + strings(p) + POSES[m].map(([a, b]) => capsule(a[0], a[1], b[0], b[1], 22, p) + paw(b[0], b[1], p)).join('');
115
+ // AdU4: a magnifier in the raised paw when nothing is found; otherwise "needs you" holds up one card with a tick
116
+ if (m === 'ask' && prop === 'magnifier') g += `<path d="M150 118 L140 132" class="${S('glass')}" stroke-width="6" stroke-linecap="round"/><circle cx="162" cy="104" r="17" class="${F('lens')} ${S('glass')}" stroke-width="5"/>` + paw(146, 128, p);
117
+ else if (m === 'ask') g += `<g transform="rotate(10 168 110)"><rect x="152" y="88" width="34" height="40" rx="6" class="${F('white')} ${S('cardline')}" stroke-width="2"/><path d="M160 106 l5 5 l10 -11" fill="none" class="${S('tick')}" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/></g>` + paw(162, 128, p);
118
+ return g;
119
+ }
120
+
121
+ /* ── Settings > Adler (AdM5): this computer's settings, kept in localStorage for the first paint and read from /api/settings ── */
122
+ const PREF_DEF = Object.freeze({ 'adler.amount': 'full', 'adler.motion': 'system', 'adler.celebrate': 'real', 'adler.quiet': '22' });
123
+ export const PREF_OPTIONS = Object.freeze({ 'adler.amount': ['full', 'face', 'off'], 'adler.motion': ['system', 'still'], 'adler.celebrate': ['real', 'never'], 'adler.quiet': ['22', 'never'] });
124
+ const PREF_KEY = 'pmos.adler';
125
+ const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* no storage */ } } };
126
+ let P = (() => { try { return { ...PREF_DEF, ...(JSON.parse(store.get(PREF_KEY) || '{}') || {}) }; } catch { return { ...PREF_DEF }; } })();
127
+ const clean = (o) => { const out = { ...PREF_DEF }; for (const k of Object.keys(PREF_DEF)) if (o && PREF_OPTIONS[k].includes(o[k])) out[k] = o[k]; return out; };
128
+ P = clean(P);
129
+ /** The Adler settings now: { 'adler.amount': full|face|off, 'adler.motion': system|still, 'adler.celebrate': real|never, 'adler.quiet': 22|never } */
130
+ export const prefs = () => ({ ...P });
131
+ function applyPrefs() {
132
+ if (typeof document === 'undefined' || !document.documentElement) return;
133
+ document.documentElement.classList.toggle('ad-still', P['adler.motion'] === 'still');
134
+ }
135
+ export function setPrefs(o) { P = clean({ ...P, ...o }); store.set(PREF_KEY, JSON.stringify(P)); applyPrefs(); if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('adler:prefs', { detail: prefs() })); return prefs(); }
136
+ /** Reads the four settings from GET /api/settings (lib/settings-store.js keeps them for this computer). */
137
+ export async function loadPrefs(get) {
138
+ try {
139
+ const r = get ? await get('/api/settings') : await fetch('/api/settings', { credentials: 'same-origin' }).then((x) => x.json());
140
+ if (r && r.ok && Array.isArray(r.settings)) { const o = {}; for (const s of r.settings) if (s && s.key in PREF_DEF) o[s.key] = s.value; setPrefs(o); }
141
+ } catch { /* the kept copy stands */ }
142
+ return prefs();
143
+ }
144
+ /** One press in Settings > Adler: POST /api/settings, then the page follows at once. → the server's answer */
145
+ export async function savePref(post, key, value) {
146
+ if (!(key in PREF_DEF) || !PREF_OPTIONS[key].includes(value)) return { ok: false, error: 'That is not an Adler setting.' };
147
+ const r = await post('/api/settings', { key, value });
148
+ if (r && r.ok) setPrefs({ [key]: value });
149
+ return r || { ok: false, error: 'Not saved.' };
150
+ }
151
+
152
+ /** After 22:00 (until 05:00) with Quiet after: 22:00, PMOS opens on Adler asleep (AdP4). */
153
+ export const asleep = (now = Date.now()) => { const h = new Date(now).getHours(); return P['adler.quiet'] === '22' && P['adler.amount'] !== 'off' && (h >= 22 || h < 5); };
154
+ const weekOf = (now) => { const d = new Date(now); d.setHours(0, 0, 0, 0); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d.toDateString(); };
155
+ /** Celebrating: only for a real event, at most once a week, and never with Celebrations: Never. */
156
+ export const mayCelebrate = (now = Date.now()) => P['adler.celebrate'] === 'real' && store.get('pmos.adler.joy') !== weekOf(now);
157
+ export const celebrated = (now = Date.now()) => store.set('pmos.adler.joy', weekOf(now));
158
+ /** The day's first open of the morning scene (AdP1 vs AdB1: the scene on the first open of the day, the M face after). */
159
+ export function firstOpenToday(key = 'day', now = Date.now()) { const k = 'pmos.adler.first.' + key, d = new Date(now).toDateString(); if (store.get(k) === d) return false; store.set(k, d); return true; }
160
+
161
+ function addCss() {
162
+ if (typeof document === 'undefined' || !document.head) return;
163
+ for (const href of [TOKENS, CSS]) if (!document.querySelector(`link[href="${href}"]`) && !(href === TOKENS && [...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => /\/cozy\.css$/.test(l.getAttribute('href') || '')))) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.append(l); }
164
+ applyPrefs();
165
+ }
166
+
167
+ /* ── the drawings ── */
168
+ const labelAttr = (o, mood, extra) => (o.label === false ? 'aria-hidden="true"' : `role="img" aria-label="${esc(o.label || 'Adler, ' + WORDS[mood] + (extra ? ', ' + extra : ''))}"`);
169
+ /** The plain mood dot Settings > Adler > Off shows where a face would be. */
170
+ const dot = (mood, px, o) => `<span class="ad-dot m-${mood}" style="--ad-px:${px}px" ${labelAttr(o, mood)}></span>`;
171
+
172
+ /**
173
+ * Adler. mood: one of MOODS (anything else is handled). size: 's' | 'm' | 'l' or a number of px (the face's side; the figure's height).
174
+ * o: { label: false (beside words that carry the meaning) | 'text', prop: 'headphones' | 'magnifier', cls, id (a fixed prefix) }. Off → the mood dot;
175
+ * Face only → an L figure is drawn as the M face. → HTML string
176
+ */
177
+ export function adler(mood, size = 'm', o = {}) {
178
+ addCss();
179
+ mood = moodOf(mood);
180
+ const m = INNER[mood], amount = P['adler.amount'];
181
+ let figure = size === 'l' || (typeof size === 'number' && size > 64);
182
+ let px = typeof size === 'number' ? size : SIZES[size] || SIZES.m;
183
+ if (figure && amount !== 'full') { figure = false; px = SIZES.m; }
184
+ if (amount === 'off') return dot(mood, Math.min(px, 24), o);
185
+ // o.id: a fixed prefix for a drawing that is redrawn in place (the chat avatar), so the same state draws the same markup and a
186
+ // redraw that diffs the markup does not replace the node and replay its entrance (premium-viewer-flicker F1)
187
+ const p = o.id ? 'ad' + o.id : nextId(), cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
188
+ const extra = o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '';
189
+ if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop)}</svg>`;
190
+ const w = Math.round(px * 200 / 252);
191
+ return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop)}</g></svg>`;
192
+ }
193
+ /** AdP6: only his ears and the top of his head, peeking over the floating button. */
194
+ export function adlerPeek(o = {}) {
195
+ addCss();
196
+ if (P['adler.amount'] !== 'full') return '';
197
+ const p = nextId();
198
+ return `<svg class="ad-svg am m-ask ad-peek" width="44" height="22" viewBox="22 4 156 78" overflow="hidden" ${labelAttr({ label: o.label || 'Adler, one call is yours' }, 'needs-you')}>${defs(p)}${head('ask', p)}</svg>`;
199
+ }
200
+
201
+ const grass = (x, y, s = 1, d = '') => `<g class="env-sway${d}"><path d="M${x} ${y} q -3 -${14 * s} -9 -${20 * s} M${x} ${y} q 1 -${18 * s} 4 -${24 * s} M${x} ${y} q 4 -${10 * s} 11 -${15 * s}" class="${S('grass')}" stroke-width="2.4" fill="none" stroke-linecap="round"/></g>`;
202
+ const fallLeaf = (x, y, d, k) => `<g class="env-leaf${d}"><path d="M${x} ${y} c 4 -6 12 -6 14 0 c -4 6 -12 6 -14 0z" class="${F(k)}"/></g>`;
203
+ export const SCENES = Object.freeze(['morning', 'tea', 'win', 'think', 'rain', 'night', 'plain']);
204
+ /**
205
+ * The XL scene: Adler in his small world. kind: one of SCENES. o: { w (viewBox width, 400), h (260), label, prop }. It scales to its
206
+ * container's width. Face only → the M face; Off → nothing. → HTML string
207
+ */
208
+ export function adlerScene(kind, mood, o = {}) {
209
+ addCss();
210
+ mood = moodOf(mood);
211
+ if (P['adler.amount'] === 'off') return '';
212
+ if (P['adler.amount'] === 'face') return `<div class="ad-scene-face">${adler(mood, 'm', o)}</div>`;
213
+ if (!SCENES.includes(kind)) kind = 'plain';
214
+ const W = o.w || 400, H = o.h || 260, adh = Math.min(170, H - 60), m = INNER[mood], p = nextId(), gy = H - 34;
215
+ let g = `<svg class="ad-scene env k-${kind}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, kind === 'night' ? 'asleep' : '')}>`;
216
+ g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${kind}0"/><stop offset="1" class="adg-${kind}1"/></linearGradient></defs>`;
217
+ g += `<g class="ad-env"><rect width="${W}" height="${H}" fill="url(#${p}bg)"/>`;
218
+ if (kind === 'morning') g += `<circle class="env-glow ${F('sunglow')}" cx="${W - 80}" cy="62" r="34" opacity=".7"/><circle cx="${W - 80}" cy="62" r="22" class="${F('sun')}"/><g class="env-cloud"><ellipse cx="90" cy="58" rx="34" ry="12" class="${F('white')}" opacity=".9"/><ellipse cx="110" cy="50" rx="20" ry="12" class="${F('white')}" opacity=".9"/></g>`;
219
+ if (kind === 'night') {
220
+ g += `<circle cx="${W - 78}" cy="58" r="22" class="${F('moon')}"/><circle cx="${W - 68}" cy="52" r="20" class="${F('night0')}"/>`;
221
+ [[60, 40], [140, 70], [220, 36], [300, 90], [90, 110]].forEach(([x, y], i) => { g += `<circle class="env-tw${i % 3 ? ' d' + (i % 3 + 1) : ''} ${F('moon')}" cx="${x}" cy="${y}" r="2"/>`; });
222
+ g += `<circle class="env-ff ${F('firefly')}" cx="${W * 0.22}" cy="${gy - 30}" r="3"/><circle class="env-ff d2 ${F('firefly')}" cx="${W * 0.8}" cy="${gy - 50}" r="2.5"/>`;
223
+ }
224
+ if (kind === 'rain') {
225
+ g += `<g class="env-cloud"><ellipse cx="${W / 2 - 8}" cy="40" rx="44" ry="15" class="${F('raincloud')}"/><ellipse cx="${W / 2 + 16}" cy="30" rx="26" ry="16" class="${F('raincloud')}"/></g>`;
226
+ [W / 2 - 30, W / 2, W / 2 + 26].forEach((x, i) => { g += `<path class="env-drop${i ? ' d' + (i + 1) : ''} ${S('drop')}" d="M${x} 56 l0 7" stroke-width="2.4" stroke-linecap="round"/>`; });
227
+ }
228
+ if (kind === 'think') { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; }
229
+ if (kind === 'win') [[W * 0.2, 'leaf2'], [W * 0.35, 'gold'], [W * 0.62, 'leaf2'], [W * 0.78, 'pink'], [W * 0.5, 'gold']].forEach(([x, k], i) => { g += fallLeaf(x, 14, i ? ' d' + (i + 1) : '', k); });
230
+ if (kind !== 'plain') g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${F(kind === 'night' ? 'groundn' : 'ground')}" opacity="${kind === 'night' ? 0.9 : 0.7}"/>` + grass(W * 0.12, gy + 18, 1) + grass(W * 0.86, gy + 14, 0.8, ' d2');
231
+ g += '</g>';
232
+ if (kind === 'night' && m === 'rest') { const zx = W / 2 + adh * 0.25, zy = H - adh + 10; for (let i = 0; i < 3; i++) g += `<text class="env-z${i ? ' d' + (i + 1) : ''} ${F('moon')} ad-z z${i}" x="${zx}" y="${zy}">z</text>`; }
233
+ const aw = Math.round(adh * 200 / 252), x = (W - aw) / 2, y = H - adh - 8, q = nextId();
234
+ g += `<svg x="${x}" y="${y}" width="${aw}" height="${adh}" viewBox="0 0 200 252" overflow="visible" class="am m-${m}" aria-hidden="true">${defs(q)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${q}b)"/><g class="ad-br">${full(m, q, o.prop)}</g></svg>`;
235
+ if (kind === 'tea') { const sc = adh / 252, mx = x + 101 * sc, my = y + 186 * sc; [-6, 0, 6].forEach((dx, i) => { g += `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${mx + dx} ${my} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`; }); }
236
+ return g + '</svg>';
237
+ }
238
+
239
+ /* ── the moods of sentences Claude already says (AdM1-4) ── */
240
+ const HONEST = /\b(not|no longer|couldn[’']?t|could not|can[’']?t|cannot|didn[’']?t|did not|isn[’']?t|wasn[’']?t|won[’']?t|failed|fails|error|broke|stopped|missed|lost|refused|unavailable)\b/i;
241
+ const WORKING = /(…|\.\.\.)\s*$/;
242
+ /** The mood of one sentence: honest when it says something failed, thinking while it runs ("Sending…"), handled otherwise. */
243
+ export function moodOfText(t) {
244
+ const s = String(t || '').trim();
245
+ if (!s) return 'handled';
246
+ if (HONEST.test(s) && !/^(Not now|Undone|No longer at risk)/i.test(s)) return 'honest';
247
+ if (WORKING.test(s)) return 'thinking';
248
+ return 'handled';
249
+ }
250
+
251
+ /** Every toast on the page (#toast, #wfToast) carries the S face in the mood of its words. The face is decoration: the words carry it. */
252
+ export function mountToastFaces(doc = typeof document !== 'undefined' ? document : null) {
253
+ if (!doc || typeof MutationObserver === 'undefined' || mountToastFaces.on) return;
254
+ mountToastFaces.on = true;
255
+ addCss();
256
+ const dress = (el) => {
257
+ if (!el.classList.contains('on') || el.querySelector(':scope > .ad-tf')) return;
258
+ const text = [...el.childNodes].filter((n) => !(n.nodeType === 1 && n.matches('button'))).map((n) => n.textContent).join(' ');
259
+ const f = adler(moodOfText(text), 's', { label: false });
260
+ if (!f) return;
261
+ const s = doc.createElement('span'); s.className = 'ad-tf'; s.innerHTML = f; el.prepend(s); el.classList.add('ad-toast');
262
+ };
263
+ const watch = (el) => { if (!el || el.dataset.adWatched) return; el.dataset.adWatched = '1'; new MutationObserver(() => dress(el)).observe(el, { attributes: true, attributeFilter: ['class'], childList: true }); dress(el); };
264
+ const scan = () => ['toast', 'wfToast'].forEach((id) => watch(doc.getElementById(id)));
265
+ scan();
266
+ // a toast host that a page adds later (the shell's #toast is written by script on some pages)
267
+ new MutationObserver(scan).observe(doc.body, { childList: true });
268
+ }
269
+
270
+ if (typeof document !== 'undefined') addCss();
@@ -226,3 +226,6 @@
226
226
  @media (min-width: 761px) {
227
227
  body.ev-vw-popup .cz-vw:not(.cz-vw-float) { position: fixed; z-index: 70; top: 16px; right: 16px; bottom: 16px; width: min(500px, calc(100vw - 32px)); box-shadow: var(--cz-sheet); }
228
228
  }
229
+ .cz .ev-ad-hd { display: flex; align-items: center; gap: 12px; padding: 4px 4px 10px; }
230
+ .cz .ev-sp-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
231
+ .cz .ev-sp-ad p { margin: 0; }
@@ -763,3 +763,7 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
763
763
  .hm-sugw { color: var(--cz-ink2); font-weight: 700; min-width: 0; }
764
764
  .hm-sugx.ok { color: var(--cz-blueink); }
765
765
  #hmTopTitle .cz-ctx { margin-left: 8px; vertical-align: -2px; }
766
+ /* Adler (batch 16 item 2): Claude's avatar on the latest reply (AdU1) and the resting figure in an empty chat (AdH1) */
767
+ .hm-av.hm-adler { width: 36px; height: 36px; background: none; border-radius: 0; overflow: visible; }
768
+ .hm-empty-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; }
769
+ .hm-empty-ad p { margin: 0; }
@@ -76,7 +76,7 @@ body.cz { padding: 0; }
76
76
  .ins-tr { display: grid; align-items: center; column-gap: 16px; padding: 0 16px; }
77
77
  .ins-cols { grid-template-columns: minmax(210px, 270px) 190px 230px 170px minmax(0, 1fr); }
78
78
  .ins-ocols { grid-template-columns: minmax(200px, 270px) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) 96px; }
79
- .ins-dcols { grid-template-columns: minmax(200px, 270px) 110px 150px minmax(0, 1fr) 150px 96px; }
79
+ .ins-dcols { grid-template-columns: minmax(200px, 270px) 110px 150px minmax(0, 1fr) 150px 112px; }
80
80
  .ins-lcols { grid-template-columns: 40px minmax(0, 1fr) 170px 200px 190px 90px; }
81
81
  .ins-th { background: var(--cz-well); font-size: var(--fs-2); font-weight: 800; color: var(--cz-ink2); min-height: 36px; }
82
82
  .ins-th span { color: var(--cz-ink3); font-weight: 600; }
@@ -374,6 +374,9 @@ p.ins-fl { flex-direction: row; align-items: center; margin: 0 0 6px; flex-wrap:
374
374
  .ins-c1 { margin-top: 8px; }
375
375
  .ins-strip { align-items: flex-start; }
376
376
  .ins-strip .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
377
+ /* a drafted move on a phone: the finding and its move, the reason behind Ask why (summary first) */
378
+ .ins-hero.mv .t { display: block; }
379
+ .ins-hero.mv #insWhy { display: none; }
377
380
  .ins-th, .ins-grp .q { display: none; }
378
381
  .ins-tbl { border: 0; border-radius: 0; background: transparent; gap: 10px; overflow: visible; }
379
382
  .ins-grp { background: transparent; border: 0; padding: 0 4px; min-height: 0; }
@@ -586,6 +589,16 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
586
589
  /* the ✦ strip: the finding in ink, its reason after it; Not now, Ask why and the dots at its end */
587
590
  .ins-hero #brief { font-weight: 800; color: var(--cz-ink); }
588
591
  .ins-hact { display: inline-flex; gap: 2px; flex: none; }
592
+ /* a finding with a drafted move (batch 16 item 1): the strip takes two lines, the move under the finding with its ✦; ✓ makes it, Done + Undo after */
593
+ .ins-hero.mv .t { white-space: normal; }
594
+ .ins-mv { display: flex; align-items: flex-start; gap: 6px; margin-top: 3px; font-size: var(--fs-2); font-weight: 700; color: var(--cz-blueink); }
595
+ .ins-mv[hidden] { display: none; }
596
+ .ins-mv svg { width: 13px; height: 13px; flex: none; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
597
+ .ins-mv.dn { color: var(--cz-ink3); }
598
+ /* a drafted metric edited in place (batch 16 item 1): its name, target and source as quiet fields on the row */
599
+ .ins-dri { width: 100%; min-width: 0; height: 30px; border: 1px solid var(--cz-hair); border-radius: 9px; padding: 0 8px; font: inherit; font-size: var(--fs-3); font-weight: 700; background: var(--cz-card); color: var(--cz-ink); }
600
+ .ins-dri:focus { outline: 2px solid color-mix(in srgb, var(--cz-blueink) 45%, transparent); outline-offset: 0; border-color: var(--cz-blueink); }
601
+ .ins-dred { background: color-mix(in srgb, var(--cz-blueink) 5%, var(--cz-card)); }
589
602
  .ins-hact:empty, .ins-pg:empty { display: none; }
590
603
  .ins-pg { display: inline-flex; gap: 5px; flex: none; padding: 0 6px; }
591
604
  .ins-pg button { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--cz-ink3) 35%, var(--cz-card)); cursor: pointer; position: relative; }
@@ -670,3 +683,4 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
670
683
  /* batch 15 item 1: the ⋯ rows carry an icon, so they lay out side by side (icon, words, count) */
671
684
  .ins-menu#moreMenu [role="menuitem"] { flex-direction: row; align-items: center; gap: 10px; }
672
685
  .ins-menu#moreMenu [role="menuitem"] > span:not(.k) { flex: 1; min-width: 0; }
686
+ .ins-strip .sp.ad svg { width: 40px; height: 40px; fill: initial; stroke: none; } /* Adler in Claude’s line (batch 16 item 2, AdH3) */
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { esc, svg, ICON, wsQ } from './cozy-evui.js';
17
17
  import { fabLabel, staleOf } from './cozy-evmodel.js';
18
+ import { mountToastFaces, loadPrefs } from './cozy-adler.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
18
19
 
19
20
  export const PLACES = [
20
21
  { key: 'home', label: 'Home', href: '/premium.html', d: ICON.home },
@@ -76,6 +77,7 @@ export function mountNav(here, doc = document, opts = {}) {
76
77
  + `<button type="button" class="cz-fab" id="czFab" aria-controls="czMenu" aria-expanded="false" aria-label="${fabLabel(here, false)}">${svg(ICON.menu, 22)}</button>`
77
78
  + '<i class="ev-fd you" id="czFdYou" hidden></i><i class="ev-fd risk" id="czFdRisk" hidden></i>';
78
79
  doc.body.appendChild(w);
80
+ mountToastFaces(doc); loadPrefs();
79
81
  const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
80
82
  const draw = () => {
81
83
  menu.innerHTML = menuHtml(here, { news: N.news, stale: N.stale, more: !!opts.more, theme: themePick() });