create-pmos 0.429.0 → 0.431.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 (70) hide show
  1. package/package.json +25 -25
  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 +24 -0
  10. package/workspace/guide/adler.md +45 -0
  11. package/workspace/guide/briefing-premium.md +2 -0
  12. package/workspace/guide/home.md +4 -4
  13. package/workspace/guide/index.md +1 -0
  14. package/workspace/guide/metric-drafts.md +2 -1
  15. package/workspace/guide/programs.md +4 -2
  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/bd-span.js +17 -14
  39. package/workspace/public/pm/cozy-adler.css +82 -0
  40. package/workspace/public/pm/cozy-adler.js +270 -0
  41. package/workspace/public/pm/cozy-ev.css +3 -0
  42. package/workspace/public/pm/cozy-home.css +4 -0
  43. package/workspace/public/pm/cozy-insights.css +15 -1
  44. package/workspace/public/pm/cozy-nav.js +2 -0
  45. package/workspace/public/pm/cozy-search.js +4 -2
  46. package/workspace/public/pm/cozy-settings.js +15 -2
  47. package/workspace/public/pm/cozy-today.css +15 -0
  48. package/workspace/public/pm/cozy.css +16 -0
  49. package/workspace/public/pm/home-app.js +7 -9
  50. package/workspace/public/pm/home-chat.js +10 -2
  51. package/workspace/public/pm/home-day.js +39 -16
  52. package/workspace/public/pm/home-today.js +5 -3
  53. package/workspace/public/pm/ini-view-model.js +1 -1
  54. package/workspace/public/pm/ini-view.css +6 -0
  55. package/workspace/public/pm/ini-view.js +13 -0
  56. package/workspace/public/pm/metric-drafts.css +7 -0
  57. package/workspace/public/pm/metric-drafts.js +46 -7
  58. package/workspace/public/pm/ms-suggest.js +2 -1
  59. package/workspace/public/pm/premium-board.js +2 -2
  60. package/workspace/public/pm/premium-insights.js +76 -10
  61. package/workspace/public/pm/premium-vw-cal.js +1 -1
  62. package/workspace/public/pm/premium-welcome.js +3 -2
  63. package/workspace/public/pm/premium.css +3 -0
  64. package/workspace/public/pm/program-model.js +7 -0
  65. package/workspace/public/pm/split-merge.js +2 -1
  66. package/workspace/public/pm/stage-line.js +7 -5
  67. package/workspace/public/premium-intelligence.html +1 -1
  68. package/workspace/test-lists/intelligence-gaps-ui.json +5 -0
  69. package/workspace/test-lists/intelligence-gaps.json +5 -0
  70. package/workspace/test-lists/milestone-label.json +5 -0
@@ -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() });
@@ -12,7 +12,8 @@ import { esc, svg, ICON, wsParam, wsQ, skelRows, cantRead, failedItem } from './
12
12
  const ARROW = { up: 'M12 19V5M6 11l6-6 6 6', down: 'M12 5v14M6 13l6 6 6-6', enter: 'M20 5v7a3 3 0 0 1-3 3H5M9 11l-4 4 4 4' }; // the footer's keys, drawn (R28-13: no glyph as a control)
13
13
  import { SEARCH_KINDS, PHONE_KINDS, searchGroups, resultSub, resultTag, wtChip } from './cozy-evmodel.js';
14
14
  import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
15
- import { nameOf as sessionName } from './home-data.js'; // session names A: the PM's name wins, then Claude's
15
+ import { nameOf as sessionName } from './home-data.js';
16
+ import { adler } from './cozy-adler.js'; // session names A: the PM's name wins, then Claude's
16
17
 
17
18
  const PHONE = 760;
18
19
  const isPhone = () => innerWidth <= PHONE;
@@ -132,7 +133,8 @@ function drawList() {
132
133
  if (q.length < 2) h = '<p class="ev-sp-empty">Type two letters or more. Search reads the initiatives, the documents, slides and reports, the artifacts and designs, and the meetings, in the repository and every worktree.</p>';
133
134
  else if (S.err) h = cantRead({ what: 'Search', why: S.err, sources: false });
134
135
  else if (S.busy && !groups.length) h = skelRows(3);
135
- else if (!groups.length) h = `<p class="ev-sp-empty" role="status">Nothing matches “${esc(q)}”${S.kind !== 'all' ? ' in this kind' : ''}.</p>`;
136
+ // nothing found: Adler with his magnifier (canvas AdU4); the words stay the same
137
+ else if (!groups.length) h = `<div class="ev-sp-empty ev-sp-ad" role="status">${adler('needs-you', 'l', { label: false, prop: 'magnifier' })}<p>Nothing matches “${esc(q)}”${S.kind !== 'all' ? ' in this kind' : ''}.</p></div>`;
136
138
  groups.forEach((g, gi) => {
137
139
  h += `<p class="ev-mlbl">${esc(g.label)}</p>` + g.rows.map((r) => rowHtml(r, i++)).join('');
138
140
  if (gi === 0 && isPhone() && g.key === 'initiative') h += '<div class="ev-sp-chips ev-phchips" aria-hidden="true"></div>';
@@ -1,6 +1,7 @@
1
1
  /* pm/cozy-settings.js — Settings (initiative premium-uncovered-features, E3; canvas EvSettings). A dialog over the page, its sections on the left:
2
2
  * General Theme (this device), Viewer opens as a column or a popup (this device), Product (which products Home reads: the Products card),
3
3
  * Your day (when the end-of-day card shows: time.workEnd, POST /api/settings), Agents write to Jira (fixed: only after Commit)
4
+ * Adler how much of Claude's face shows, Motion, Celebrations, Quiet after (adler.*, POST /api/settings; canvas AdM5, batch 16 item 2)
4
5
  * Connectors what PMOS reads on its own, and the connectors your sessions have (GET and POST /api/proactive/settings)
5
6
  * Workspaces the repositories PMOS works in (GET and POST /api/workspaces, POST /api/workspaces/forget; the folder is never touched)
6
7
  * Workflows a link to its own page, /premium-workflows.html (pm/wf-page.js, D99): the stages each kind of initiative goes through
@@ -10,8 +11,9 @@
10
11
  * openSettings(section?) */
11
12
  import { pmGet, pmPost } from './http.js';
12
13
  import { esc, svg, ICON, toast } from './cozy-evui.js';
14
+ import * as AD from './cozy-adler.js';
13
15
 
14
- const SECTIONS = [['general', 'General'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates'], ['whatsnew', "What's new"]];
16
+ const SECTIONS = [['general', 'General'], ['adler', 'Adler'], ['connectors', 'Connectors'], ['workspaces', 'Workspaces'], ['workflows', 'Workflows'], ['updates', 'Updates'], ['whatsnew', "What's new"]];
15
17
  const PAGE_LINKS = { workflows: '/premium-workflows.html' }; // a section that is a page of its own: the row goes there
16
18
  const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
17
19
  const VIEWER_KEY = 'pmos.cz.viewer';
@@ -51,6 +53,15 @@ function general() {
51
53
  + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', '<span class="ev-pill ok">Fixed</span>')
52
54
  + upd;
53
55
  }
56
+ /* Settings > Adler (AdM5): four choices, each saved for this computer the moment it is pressed */
57
+ function adlerSec() {
58
+ const P = AD.prefs();
59
+ return `<div class="ev-ad-hd">${AD.adler('handled', 48)}<p class="ev-small ev-mut">Adler is how Claude shows its mood in PMOS. You choose how much of him you see.</p></div>`
60
+ + trow('How much Adler', 'Face only keeps his face where Claude speaks and drops the scenes. Off shows the plain mood dot.', seg('How much Adler', 'adler.amount', P['adler.amount'], [['full', 'Full'], ['face', 'Face only'], ['off', 'Off']]))
61
+ + trow('Motion', 'Still stops every animation. Reduced motion on your computer always stops it.', seg('Motion', 'adler.motion', P['adler.motion'], [['system', 'Follow my computer'], ['still', 'Still']]))
62
+ + trow('Celebrations', 'At most once a week, and only for a real event.', seg('Celebrations', 'adler.celebrate', P['adler.celebrate'], [['real', 'Real wins only'], ['never', 'Never']]))
63
+ + trow('Quiet after', 'After this time, opening PMOS shows Adler asleep and nothing urgent.', seg('Quiet after', 'adler.quiet', P['adler.quiet'], [['22', '22:00'], ['never', 'Never']]));
64
+ }
54
65
  const firstLine = () => { const c = changes().find((e) => e.v === latest()); const p = c && c.prs && c.prs[0]; return p ? (p.t || p.s || '') : ''; };
55
66
  function connectors() {
56
67
  if (T.src === null) return '<p class="ev-small ev-mut">Reading the connectors.</p>';
@@ -83,7 +94,7 @@ function whatsnew() {
83
94
  if (!L.length) return '<p class="ev-small ev-mut">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
84
95
  return `<ul class="ev-kv">${L.slice(0, 40).map((e) => `<li><b>${esc(e.v)}</b><div class="ev-tx">${mine && e.v === mine ? '<span class="ev-pill">Yours</span> ' : mine && cmpVer(e.v, mine) > 0 ? '<span class="ev-pill y">Newer</span> ' : ''}${(e.prs || []).map((p) => `<p>${esc(p.t && p.t !== p.s ? p.t + ': ' + p.s : p.s)}${p.n ? ' <span class="ev-mut">#' + esc(p.n) + '</span>' : ''}</p>`).join('') || '<p class="ev-mut">No summary was recorded for this kit.</p>'}</div></li>`).join('')}</ul>`;
85
96
  }
86
- const BODY = { general, connectors, workspaces, updates, whatsnew };
97
+ const BODY = { general, adler: adlerSec, connectors, workspaces, updates, whatsnew };
87
98
  function draw() {
88
99
  const el = T.el; if (!el || el.hidden) return;
89
100
  // a redraw replaces the nodes: keep focus on the same control (by its data-ev-* key), else on the open section, never on the body
@@ -121,6 +132,7 @@ async function press(e) {
121
132
  if ('evClose' in t.dataset) { closeSettings(); return; }
122
133
  if (t.dataset.evGo) { T.sec = t.dataset.evGo; draw(); return; }
123
134
  if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
135
+ if (t.dataset.evSeg && t.dataset.evSeg.startsWith('adler.')) { const r = await AD.savePref(pmPost, t.dataset.evSeg, t.dataset.v); T.msg = r && r.ok ? 'Saved.' : (r && r.error) || 'Not saved.'; draw(); return; }
124
136
  if (t.dataset.evSeg === 'viewer') { store.set(VIEWER_KEY, t.dataset.v); document.body.classList.toggle('ev-vw-popup', t.dataset.v === 'popup'); draw(); return; }
125
137
  // the one product pick (batch 12 item 5): the same list as the chip on Home, Board and Insights, under this row
126
138
  if ('evProducts' in t.dataset) {
@@ -183,6 +195,7 @@ async function load() {
183
195
  T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
184
196
  T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
185
197
  T.set = s && s.ok ? s : null;
198
+ if (T.set) await AD.loadPrefs(async () => T.set);
186
199
  T.prods = b && b.ok && b.model && b.model.products ? b.model.products.available || [] : [];
187
200
  if (!w || !Array.isArray(w.workspaces)) T.msg = 'The repositories could not be read.'; else if (!p || !p.ok) T.msg = 'The connectors could not be read.';
188
201
  draw();
@@ -461,6 +461,18 @@ body.cz-home .hm-hd.hv-bar { padding: 0; }
461
461
  .yd-face { width: 48px; height: 48px; border-radius: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink); background: var(--cz-riskbg); }
462
462
  .yd-face.calm { background: var(--cz-bluebg); }
463
463
  .yd-face.concerned { background: color-mix(in srgb, var(--cz-late) 22%, var(--cz-card)); }
464
+ /* Adler (batch 16 item 2): his M face replaces the tinted disc; the morning scene on the day's first open (AdP1); the L figure in Your move
465
+ when nothing needs the PM (AdB2, AdB3); the night scene after 22:00 (AdP4) */
466
+ .yd-face.ad, .yd-face.ad.calm, .yd-face.ad.concerned { background: none; border-radius: 0; }
467
+ .yd-open.has-scene { padding-top: 0; overflow: hidden; }
468
+ .yd-scene { margin: 0 -16px; }
469
+ .yd-scene .ad-scene { border-radius: 18px 18px 0 0; max-height: 150px; }
470
+ .yd-big, .yd-night { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 20px 12px 12px; }
471
+ .yd-big b, .yd-night b { font-size: var(--fs-5); font-weight: 800; color: var(--cz-ink); margin-top: 8px; }
472
+ .yd-big em, .yd-night em { font-style: normal; font-size: var(--fs-3); color: var(--cz-ink3); max-width: 280px; }
473
+ .yd-night { padding: 0 0 12px; }
474
+ .yd-night .ad-scene { max-height: 320px; }
475
+ .yd-awake { margin-top: 12px; min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-weight: 700; cursor: pointer; }
464
476
  .yd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
465
477
  .yd-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 12px; background: color-mix(in srgb, var(--cz-card) 70%, transparent); font-size: var(--fs-3); font-weight: 700; color: var(--cz-ink); }
466
478
  .yd-chip svg { color: var(--cz-blue); }
@@ -482,3 +494,6 @@ body.cz-home .hm-hd.hv-bar { padding: 0; }
482
494
  .hm-phc .phrow b { width: 48px; flex: none; font-size: var(--fs-3); font-weight: 700; color: var(--cz-ink3); }
483
495
  .hm-phc .phty { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--cz-bluebg); }
484
496
  .hm-phc .phty .phl { font-size: var(--fs-4); color: var(--cz-ink); }
497
+ .hv-hi .ad-svg.hv-ad { width: 36px; height: 36px; margin-right: 2px; } /* Adler greets (batch 16 item 2, AdH1): the chevron rule above sizes svg to 16 px */
498
+ .hm-none.hm-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
499
+ .hm-none.hm-ad p { margin: 0; }
@@ -5,6 +5,9 @@
5
5
 
6
6
  @font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/vendor/nunito-var.woff2) format('woff2'); }
7
7
 
8
+ /* iOS Safari inflates text it thinks is too small to read ("text autosizing"), unevenly: a wide title or sub-line grows and a narrow time
9
+ column does not, so the calendar rows broke the scale on a phone (batch 16 item 4). The sizes are the scale's; the browser keeps them. */
10
+ html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
8
11
  :root{
9
12
  /* The type scale (R27; feedback batch 15 item 2): every font size in the cozy sheets is one of these six. Hierarchy comes from weight and
10
13
  colour, never from a half pixel. 11 marks and badges · 12 meta · 14 body and rows · 16 group heads and phone rows · 20 page titles · 28 display. */
@@ -107,6 +110,19 @@
107
110
  --cz-c-3a3018: #3A3018; --cz-c-e3c46a: #E3C46A; --cz-c-3a1f1d: #3A1F1D; --cz-c-f09a92: #F09A92;
108
111
  /* the report's title slide (ReportPanel.dc.html): its gradient and the accent of its second line */
109
112
  --cz-c-2546b8: #2546B8; --cz-c-1b3a9e: #1B3A9E; --cz-c-cfe88a: #CFE88A; --cz-c-9ab53c: #9AB53C;
113
+ /* Adler, Claude's face (feedback batch 16 item 2; pm/cozy-adler.js and cozy-adler.css name these, never a colour): Wawan's art. Fur, cream,
114
+ hoodie and sprout gradients, then the face, the props, and the scenes' skies and grounds. */
115
+ --ad-f0: #FFD995; --ad-f1: #F0B05A; --ad-f2: #C98030; --ad-c0: #FFFFFA; --ad-c1: #FCEFD8; --ad-c2: #EBD3AE;
116
+ --ad-h0: #93B163; --ad-h1: #6A8A44; --ad-h2: #4A682C; --ad-l0: #C7E37A; --ad-l1: #78A93A;
117
+ --ad-pink: #F4B3A2; --ad-blush: #F49C8C; --ad-ink: #2A2018; --ad-mouth: #7A2E2E; --ad-tongue: #E8737A; --ad-white: #FFFFFF;
118
+ --ad-creamhi: #FFF8EA; --ad-shade: #8A5A20; --ad-shadow: #5A3A10; --ad-hoodd: #46652C; --ad-hoodl: #7A9C55;
119
+ --ad-mug: #6E8E4B; --ad-mugleaf: #CFE0B0; --ad-gold: #E9B949; --ad-glass: #3A2E22; --ad-cardline: #C9C3B6; --ad-tick: #2B55C9;
120
+ --ad-hp: #3A4466; --ad-lens: #EAF4FA;
121
+ --ad-morning0: #FFF4E2; --ad-morning1: #FBE6C4; --ad-tea0: #F6F3EA; --ad-tea1: #EEE9DC; --ad-win0: #FFF5E3; --ad-win1: #F6E9D0;
122
+ --ad-think0: #F1F2EE; --ad-think1: #E6E9E0; --ad-rain0: #EEF0F2; --ad-rain1: #E2E5E9; --ad-night0: #2D3550; --ad-night1: #1E2438;
123
+ --ad-plain0: #F7F6F3; --ad-plain1: #F7F6F3; --ad-sun: #FFC85A; --ad-sunglow: #FFD27A; --ad-moon: #F4E9C6; --ad-firefly: #E9F59A;
124
+ --ad-raincloud: #C9CED6; --ad-drop: #9AA6B8; --ad-ground: #E4D8BC; --ad-groundn: #3A4466; --ad-grass: #8DB05A; --ad-leaf2: #9CC25A;
125
+ --ad-thinkdot: #A9B39A;
110
126
  }
111
127
  .cz {
112
128
  --cz-ink: var(--cz-c-2a2e35); --cz-ink2: var(--cz-c-4a4f58); --cz-ink3: var(--cz-c-646a74);
@@ -36,7 +36,8 @@ import { mountPhoneCard } from './home-phone-card.js';
36
36
  import { mountFirst } from './premium-first.js';
37
37
  import * as L from './home-list.js';
38
38
  import * as TD from './home-today.js';
39
- import * as YD from './home-day.js'; // Your day in the Viewer (XvAPhDay)
39
+ import * as YD from './home-day.js';
40
+ import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2) // Your day in the Viewer (XvAPhDay)
40
41
  import { canDictate, dictate } from './home-dictate.js';
41
42
  import { mountIni, iniList, iniOverview, iniPage, iniAddTask } from './home-ini.js'; // the initiative's page, its stage move, Tasks and Core documents (premium-uncovered-features, HbC)
42
43
  import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
@@ -294,20 +295,17 @@ function homeListHtml() {
294
295
  pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, top: S.ready ? RECROW.html() + MEN.rowHtml(S.D, { sel: S.sel }) : '',
295
296
  });
296
297
  }
297
- /** Your day (XvAPhDay, was the HvAOpen sheet), a phone only: "Good morning" opens it in the Viewer, full screen; the moment card (TfPhone) is
298
- * its Now section, and the calendar is under ⋯. On a desktop "Good morning" opens the calendar (batch 14 item 4). */
298
+ /** Your day (XvAPhDay, was the HvAOpen sheet): "Good morning" opens it in the Viewer on a phone and a desktop alike (batch 16, Wawan: the same
299
+ * press must lead to the same place); the calendar is under ⋯. A phone also draws the moment card (TfPhone) as its Now section. */
299
300
  function dayHtml() { return ''; }
300
301
  function day(on) {
301
302
  S.day = !!on;
302
303
  if (!on) { const c = VW.current(); if (c && c.id === 'day') VW.close(); return; }
303
304
  if (!S.M) return;
304
- // a desktop has no Your day any more (batch 14 item 4): the greeting opens the calendar in the Viewer; the list already holds every next step.
305
- // A phone keeps Your day: its moment card (TfPhone) lives there
306
- if (!isPhone()) { S.day = false; openCalendar(); return; }
307
- const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW(), { delightOk: delightOk() });
308
- if (Y.mood === 'delighted') { try { localStorage.setItem(DELIGHT_KEY, new Date(NOW()).toDateString()); } catch { /* the face still shows */ } }
305
+ const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW(), { delightOk: delightOk() && AD.mayCelebrate(NOW()) });
306
+ if (Y.mood === 'delighted') { try { localStorage.setItem(DELIGHT_KEY, new Date(NOW()).toDateString()); } catch { /* the face still shows */ } AD.celebrated(NOW()); }
309
307
  const ph = isPhone() && PHC;
310
- const P = YD.dayParts(Y, { moment: !!ph });
308
+ const P = YD.dayParts(Y, { moment: !!ph, now: NOW(), first: YD.firstOpenToday('day', NOW()) });
311
309
  VW.open({ id: 'day', kind: 'Your day', title: 'Your day', icon: YD.DAY_ICON, more: [{ label: 'Open the calendar', on: () => openCalendar() }],
312
310
  onClose: () => { S.day = false; },
313
311
  render: (body) => {
@@ -32,6 +32,7 @@ import { splitChase, runStop, sweepLine, stopText } from './home-sweep.js';
32
32
  import { splitFiles, filesHtml, sizeText, MAX_BYTES, MAX_FILES, setAttachSink } from './premium-attach.js';
33
33
  import * as VWC from './cozy-viewer.js';
34
34
  import { canDictate, dictate } from './home-dictate.js';
35
+ import { adler } from './cozy-adler.js';
35
36
  /* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
36
37
  const views = {
37
38
  ctx: () => import('./premium-vw-ctx.js'), file: () => import('./premium-vw-file.js'), attach: () => import('./premium-attach.js'),
@@ -50,6 +51,11 @@ export function avHtml(role, size = 28, cls = '') {
50
51
  return `<span class="hm-av t-${tintOf(k)} s${size}${k.length > 1 ? ' two' : ''}${cls ? ' ' + cls : ''}" aria-hidden="true">${k}</span>`;
51
52
  }
52
53
 
54
+ /** Adler is Claude's avatar once, on the latest reply, in that reply's mood (batch 16 item 2, canvas AdU1): needs you while it asks,
55
+ * honest when the run stopped, thinking while it runs, handled otherwise. Another role keeps its letter. */
56
+ const isClaude = (r) => !r || !r.key || r.key === 'claude';
57
+ export const adlerAvHtml = (mood) => `<span class="hm-av hm-adler" aria-hidden="true">${adler(mood, 36, { label: false, id: 'chat' })}</span>`;
58
+
53
59
  export function mountChat(el, host) {
54
60
  const esc = host.esc;
55
61
  const C = { t: null, th: null, conv: null, timer: null, show: 12, plOpen: false, plAll: false, open: new Set(), seq: 0, sending: false, files: [], seenAt: null, lastKey: null, picked: {}, auto: { key: null, ctx: new Set(), rep: null, goal: null }, slashAt: 0 };
@@ -117,7 +123,8 @@ export function mountChat(el, host) {
117
123
  const go = GU.blockOpts(it.mi, g.block, gl); // home-goal.js: the newest plan, the method menu, the editor in place
118
124
  // a run that stopped: the divider sits where it finished, over Claude's last message, and the fix sits under it (canvas XcbOptions, Routine)
119
125
  const stopAt = R.stop && i === R.lastAgent;
120
- return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}">${avHtml(R.role)}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? mdHtml(rp.text) : ''}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
126
+ const av = last && isClaude(R.role) ? adlerAvHtml(asking || ak.block ? 'needs-you' : stopAt ? 'honest' : running() ? 'thinking' : 'handled') : avHtml(R.role);
127
+ return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? mdHtml(rp.text) : ''}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
121
128
  + (asking ? '' : `<div class="hm-tools" role="group" aria-label="Message actions"><button type="button" data-hm-copy="${i}">Copy</button>${last && !running() && !(stopAt && R.stop.actions.length) ? `<button type="button" data-hm-retry>Retry</button>` : ''}<button type="button" data-hm-wi="${i}">Make a work-item</button></div>`) + '</div></div>'
122
129
  + (stopAt && R.stop.actions.length ? `<div class="hm-fix" role="group" aria-label="What to do next">${R.stop.actions.map((a, k) => iconBtn({ icon: a.icon, label: a.label, attr: a.data, pri: k === 0 })).join('')}</div>` : '')
123
130
  + blockAskHtml(ak.block, it, R);
@@ -190,7 +197,8 @@ export function mountChat(el, host) {
190
197
  html += GU.choiceHtml(); // /goal while a goal works here: In a new chat, or Here instead
191
198
  if (C.th && C.th.working) html += `<p class="hm-note" role="status">The agent is answering. You can write again when it has.</p>`;
192
199
  if (C.conv && C.conv.state === 'ended') html += '<p class="hm-note">This session has ended. Your conversation is kept here, and your next message picks it up.</p>';
193
- if (!html) html = `<p class="hm-empty">${esc(t.empty || 'Ask anything. It works in a real Claude Code session.')}</p>`;
200
+ // an empty chat: Adler resting, because nothing runs here yet (canvas AdH1)
201
+ if (!html) html = `<div class="hm-empty hm-empty-ad">${adler('resting', 'l', { id: 'chatempty' })}<p>${esc(t.empty || 'Ask anything. It works in a real Claude Code session.')}</p></div>`;
194
202
  put(log, html);
195
203
  C.items = items;
196
204
  GU.afterDraw(log);