create-pmos 0.437.0 → 0.439.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 (60) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/adler-moments-test.js +121 -0
  7. package/workspace/briefing-premium-board-test.js +2 -1
  8. package/workspace/changelog.json +24 -0
  9. package/workspace/guide/adler.md +12 -1
  10. package/workspace/guide/briefing-premium.md +1 -1
  11. package/workspace/guide/home.md +1 -0
  12. package/workspace/guide/notes.md +5 -2
  13. package/workspace/home-rows-test.js +16 -0
  14. package/workspace/lib/notes-whisper.js +33 -11
  15. package/workspace/lib/notes.js +6 -4
  16. package/workspace/lib/routes-notes.js +94 -13
  17. package/workspace/package-lock.json +2 -2
  18. package/workspace/package.json +1 -1
  19. package/workspace/premium-chat-context-test.js +20 -0
  20. package/workspace/public/pm/bd-asks.js +5 -2
  21. package/workspace/public/pm/bd-deliveries.js +11 -2
  22. package/workspace/public/pm/cozy-adler.css +7 -1
  23. package/workspace/public/pm/cozy-adler.js +17 -0
  24. package/workspace/public/pm/cozy-board.css +5 -0
  25. package/workspace/public/pm/cozy-ev.css +8 -0
  26. package/workspace/public/pm/cozy-home.css +7 -0
  27. package/workspace/public/pm/cozy-live-pill.css +2 -0
  28. package/workspace/public/pm/cozy-live-pill.js +6 -3
  29. package/workspace/public/pm/cozy-nav.js +18 -5
  30. package/workspace/public/pm/cozy-pull.js +62 -0
  31. package/workspace/public/pm/cozy-rec-now.js +3 -1
  32. package/workspace/public/pm/cozy-rec-tab.css +2 -0
  33. package/workspace/public/pm/cozy-rec-tab.js +18 -1
  34. package/workspace/public/pm/cozy-settings.js +14 -5
  35. package/workspace/public/pm/cozy-steps.css +3 -0
  36. package/workspace/public/pm/cozy-steps.js +5 -4
  37. package/workspace/public/pm/cozy-today.css +5 -0
  38. package/workspace/public/pm/home-app.js +33 -2
  39. package/workspace/public/pm/home-day.js +39 -5
  40. package/workspace/public/pm/home-mentions.js +13 -2
  41. package/workspace/public/pm/home-review.js +9 -1
  42. package/workspace/public/pm/home-stage-card.js +9 -3
  43. package/workspace/public/pm/impact.css +1 -0
  44. package/workspace/public/pm/impact.js +5 -2
  45. package/workspace/public/pm/ini-tasks.js +19 -3
  46. package/workspace/public/pm/premium-board.js +12 -4
  47. package/workspace/public/pm/premium-shell.js +12 -4
  48. package/workspace/public/pm/premium-vw-ctx.js +16 -2
  49. package/workspace/public/pm/premium-vw-doc-model.js +11 -0
  50. package/workspace/public/pm/premium-vw-doc.css +2 -0
  51. package/workspace/public/pm/premium-vw-doc.js +8 -2
  52. package/workspace/public/pm/premium-vw-mtg.js +3 -1
  53. package/workspace/public/pm/premium.css +14 -0
  54. package/workspace/public/pm/program-charter.js +2 -1
  55. package/workspace/public/pm/session-rail.js +12 -5
  56. package/workspace/public/premium-rec.html +1 -1
  57. package/workspace/task-views-test.js +10 -1
  58. package/workspace/test-lists/adler-followups.json +9 -0
  59. package/workspace/test-lists/batch17-adler-moments.json +13 -0
  60. package/workspace/test-lists/notes-transcript-recovery.json +9 -0
@@ -0,0 +1,62 @@
1
+ /* pm/cozy-pull.js — pull to refresh with Adler peeking up (feedback batch 17 item 4-B; canvas AdP2Refresh).
2
+ *
3
+ * mountPull(el, { read, label }) once per element: on a touch screen, a pull down from the top of el's scroll lets Adler's head rise
4
+ * over the top edge with his glasses on (thinking: he reads for you). Let go past the line and
5
+ * read() runs; he stays until it answers, then goes. A short pull springs back and reads nothing.
6
+ * read() → Promise what reads again (Home: its own reads and the place menu's sources)
7
+ * label 'Reading your day again' what the line beside him says while read() runs
8
+ * The peek is the M face of pm/cozy-adler.js, so Settings › Adler holds here too: Off draws the plain dot, Still and reduced motion keep
9
+ * him still (the pull itself follows the finger, which is not an animation). A mouse never pulls. Nothing here writes. */
10
+ import { adler } from './cozy-adler.js';
11
+
12
+ const LINE = 64; // px of pull that reads again
13
+ const MAX = 96; // the furthest the peek follows the finger
14
+
15
+ /** The scroll box el sits in: el, or its first ancestor that scrolls; else the page. */
16
+ function scrollerOf(el) {
17
+ for (let n = el; n && n !== document.body; n = n.parentElement) {
18
+ const o = getComputedStyle(n).overflowY;
19
+ if ((o === 'auto' || o === 'scroll') && n.scrollHeight > n.clientHeight) return n;
20
+ }
21
+ return document.scrollingElement || document.documentElement;
22
+ }
23
+ /** How far the peek shows for a pull of dy px: it slows as it goes, and never passes MAX. Pure. */
24
+ export const pullOf = (dy) => (dy <= 0 ? 0 : Math.min(MAX, Math.round(dy * 0.5)));
25
+ /** Whether a pull of dy px reads again. Pure. */
26
+ export const pulled = (dy) => pullOf(dy) >= LINE * 0.75;
27
+
28
+ export function mountPull(el, o = {}) {
29
+ if (!el || el.dataset.czPull) return;
30
+ el.dataset.czPull = '1';
31
+ let y0 = null, dy = 0, busy = false, peek = null;
32
+ const show = (px, reading) => {
33
+ if (!peek || !peek.isConnected) {
34
+ peek = document.createElement('div'); peek.className = 'cz-pull';
35
+ peek.innerHTML = `<span class="cz-pull-ad">${adler('thinking', 44, { label: false })}</span><span class="cz-pull-t" role="status"></span>`;
36
+ el.prepend(peek);
37
+ }
38
+ peek.style.setProperty('--cz-pull', px + 'px');
39
+ peek.classList.toggle('on', !!reading);
40
+ peek.querySelector('.cz-pull-t').textContent = reading ? (o.label || 'Reading again') : '';
41
+ };
42
+ const hide = () => { if (peek) { peek.remove(); peek = null; } };
43
+ el.addEventListener('touchstart', (e) => {
44
+ if (busy || e.touches.length !== 1 || scrollerOf(el).scrollTop > 0) { y0 = null; return; }
45
+ y0 = e.touches[0].clientY; dy = 0;
46
+ }, { passive: true });
47
+ el.addEventListener('touchmove', (e) => {
48
+ if (y0 == null) return;
49
+ dy = e.touches[0].clientY - y0;
50
+ if (dy <= 0) { hide(); return; }
51
+ show(pullOf(dy), false);
52
+ }, { passive: true });
53
+ const end = async () => {
54
+ if (y0 == null) return;
55
+ y0 = null;
56
+ if (!pulled(dy)) { hide(); return; }
57
+ busy = true; show(LINE, true);
58
+ try { await (o.read ? o.read() : null); } catch { /* the page says its own failure */ } finally { busy = false; hide(); }
59
+ };
60
+ el.addEventListener('touchend', end);
61
+ el.addEventListener('touchcancel', () => { y0 = null; if (!busy) hide(); });
62
+ }
@@ -133,7 +133,9 @@ export function transcriptModel(one, { max = 80 } = {}) {
133
133
  if (!n || n.private) return [];
134
134
  const names = n.speakers || {};
135
135
  const who = (src) => names[src] || { mic: 'You', meeting: 'Meeting', speech: 'You', typed: 'You (typed)' }[src] || 'You';
136
- const tr = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && typeof x.text === 'string' && x.text.trim());
136
+ // in meeting-time order: a stretch filled in after the engine caught up is stored after the lines heard later
137
+ const tr = (Array.isArray(n.transcript) ? n.transcript : []).filter((x) => x && !x.dropped && typeof x.text === 'string' && x.text.trim())
138
+ .sort((a, b) => (Number.isFinite(a.t) ? a.t : 0) - (Number.isFinite(b.t) ? b.t : 0));
137
139
  const rows = tr.slice(-max).map((x) => ({ t: Number.isFinite(x.t) ? x.t : null, who: who(x.source), text: x.text.trim(), hl: false, dec: x.cat === 'decision', now: false }));
138
140
  for (const h of Array.isArray(n.highlights) ? n.highlights : []) {
139
141
  const ht = Number(h && (h.t != null ? h.t : h.from));
@@ -18,6 +18,8 @@ body.rt-page { height: 100vh; overflow: hidden; }
18
18
  .rt.late .rt-clock, .rt-past { color: var(--cz-dot-risk); }
19
19
  .rt-title { margin: 0; font-size: var(--fs-4); font-weight: 800; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
20
20
  .rt-past { font-size: var(--fs-3); font-weight: 700; }
21
+ .rt-ad { display: inline-flex; align-items: center; flex: none; } /* Adler with headphones (AdH5) */
22
+ .rt-ad[hidden] { display: none; }
21
23
  @keyframes rt-breathe { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
22
24
  @media (prefers-reduced-motion: reduce) { .rt-dot { animation: none !important; } }
23
25
 
@@ -20,10 +20,13 @@
20
20
  * cozy-rec-now.js mountNow({ stage, side, bar }, ctx) ctx = { ws, note(), mode(), on(evt, fn), focus(), event, rec }
21
21
  * cozy-rec-present.js mountPresent({ stage, side, bar }, ctx) ctx = { ws, note: { id, title }, event, focus() }
22
22
  * bar holds [data-slot="now"] and [data-slot="present"] for their buttons.
23
+ * Adler (batch 17 item 4-B, AdH5): his face with headphones sits after the title while the meeting records: glasses on (listening), honest
24
+ * while the meeting is not heard, resting with the headphones on while paused. Not recording yet, or stopped: no face (no trigger).
23
25
  * Reads: GET /api/notes (recCore), /api/notes/one, /api/meeting-focus. Writes only through the recorder's presses. */
24
26
  import { pmGet, pmPost } from './http.js';
25
27
  import { recCore, STOP_LINE } from './premium-meeting.js';
26
28
  import { post, listen, tabUrl, clockOf, modeOf, endOf, marksOf } from './rec-tab-core.js';
29
+ import { adler } from './cozy-adler.js';
27
30
 
28
31
  const q = new URLSearchParams(location.search);
29
32
  const ID = q.get('note') || '', WS = q.get('ws') || '';
@@ -58,8 +61,22 @@ function drawHead() {
58
61
  const late = past && S.mode !== 'stopped' && Date.now() > past;
59
62
  $('rt').classList.toggle('late', !!late);
60
63
  $('rtPast').hidden = !late; if (late) $('rtPast').textContent = 'Past ' + wall(past) + ' end';
64
+ drawFace();
61
65
  tick();
62
66
  }
67
+ /** AdH5: the mood of the meeting now, or '' when there is nothing to show. Pure on (mode, silent). */
68
+ function recFace(mode, silent) {
69
+ if (mode === 'screen' || mode === 'room') return silent ? 'honest' : 'thinking';
70
+ return mode === 'paused' ? 'resting' : '';
71
+ }
72
+ const FACE_SAYS = { thinking: 'Adler is listening and taking notes', honest: 'Adler cannot hear the meeting', resting: 'Adler waits while the recording is paused' };
73
+ let lastFace = null;
74
+ function drawFace() {
75
+ const m = recFace(S.mode, C.screen().silent), el = $('rtAd');
76
+ if (!el || m === lastFace) return;
77
+ lastFace = m; el.hidden = !m;
78
+ el.innerHTML = m ? adler(m, 32, { prop: 'headphones', label: FACE_SAYS[m], id: 'rth' }) : '';
79
+ }
63
80
  function tick() {
64
81
  const c = clockOf(elapsed());
65
82
  $('rtClock').textContent = c;
@@ -222,7 +239,7 @@ else {
222
239
  }
223
240
  });
224
241
  // the clock, the line and the transcript never wait on a press: a press that hangs must not freeze the meeting (Wawan, 2026-10-27)
225
- setInterval(() => { tick(); drawAlert(); drawLine(); beat(); }, 1000); // beat(): a change (Not hearing the meeting) reaches the snippets within a second
242
+ setInterval(() => { tick(); drawAlert(); drawFace(); drawLine(); beat(); }, 1000); // beat(): a change (Not hearing the meeting) reaches the snippets within a second
226
243
  setInterval(() => { if (!READING) { READING = true; read().catch(() => {}).finally(() => { READING = false; }); } beat(true); }, 5000);
227
244
  setInterval(readFocus, 15000);
228
245
  }
@@ -12,6 +12,9 @@
12
12
  * Workflows a link to its own page, /premium-workflows.html (pm/wf-page.js, D99): the stages each kind of initiative goes through
13
13
  * Updates the versions and Check now, Update, Restart to update (GET /api/kit/status, POST /api/kit/check | update | upgrade-app)
14
14
  * What's new what each published kit changed, newest first (the kit status's changelog lines)
15
+ * Adler's moments (batch 17 item 4-B, AdM4): one face per section, where Claude speaks. Updates: glasses while it checks or installs,
16
+ * holding the card when a version is ready, calm when up to date. General: holding the update card, else the Jira promise (only after
17
+ * Commit). A failure in the status line takes the honest face, and then the section's face steps back (one Adler per screen).
15
18
  * The card at the bottom of General says when an update is ready. While a source is stale, an amber box at the top of every section names
16
19
  * it with ↻ Read again, and the place menu opens Settings at Connectors. Every write is the PM's press (pmPost carries the launch nonce).
17
20
  * PMOS reads the sources and never posts to them.
@@ -35,6 +38,8 @@ const appBehind = () => { const s = home(); return !!(s && s.appBehind && !fromG
35
38
  const ready = () => appBehind() || kitsBehind().length > 0;
36
39
  const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* no storage */ } } };
37
40
  const pad = (n) => String(n).padStart(2, '0');
41
+ /** Adler's face for a section's moment; none while the status line is honest (that line carries his face then). */
42
+ const adFace = (mood, px = 32) => (T.msg && AD.moodOfText(T.msg) === 'honest' ? '' : `<span class="ev-ad">${AD.adler(mood, px, { label: false })}</span>`);
38
43
 
39
44
  function changes() {
40
45
  const s = home(); if (!s) return [];
@@ -53,13 +58,13 @@ function general() {
53
58
  const pname = !P ? 'Reading' : !P.length ? 'No product' : on.length === 1 ? on[0].name : on.length + ' of ' + P.length + ' products';
54
59
  const we = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'time.workEnd') : null, end = we ? Number(we.value) : 18;
55
60
  const hours = []; for (let h = 13; h <= 23; h++) hours.push(h);
56
- const upd = ready() ? `<div class="ev-card ev-upd"><span class="ev-pill y">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="whatsnew">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
61
+ const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="ev-pill y">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="whatsnew">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
57
62
  return trow('Theme', 'Auto follows your computer', seg('Theme', 'theme', theme, [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']]))
58
63
  + trow('Viewer opens as', 'A column beside the chat, or a popup over it', seg('Viewer opens as', 'viewer', vw, [['column', 'Column'], ['popup', 'Popup']]))
59
64
  + trow('Product', 'Which products Home, Board and Intelligence read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
60
65
  + trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
61
66
  + trow('Your impact', 'Adler’s sprout and your impact log. Only you see it. Nothing leaves PMOS.', sw(impactOn(), 'data-ev-impact', 'Your impact'))
62
- + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', '<span class="ev-pill ok">Fixed</span>')
67
+ + trow('Agents write to Jira', 'Only after you press Commit. Never on their own.', (ready() ? '' : adFace('needs-you', 24)) + '<span class="ev-pill ok">Fixed</span>')
63
68
  + upd;
64
69
  }
65
70
  /* Your impact (GmP1Switch): on by default; off hides every impact surface and stops Claude's daily read */
@@ -115,7 +120,8 @@ function updates() {
115
120
  const s = home();
116
121
  if (!s) return '<p class="ev-small ev-mut">Reading the versions.</p>';
117
122
  const app = (s.app && s.app.version) || '?', L = latest();
118
- const head = T.phase === 'busy' ? `<b>Updating to ${esc(L)}</b><p class="ev-small ev-mut" role="status" aria-live="polite">${esc(T.say || 'Working.')}</p>`
123
+ const mood = T.phase === 'busy' || T.checking ? 'thinking' : ready() ? 'needs-you' : L ? 'handled' : '';
124
+ const head = T.checking && T.phase !== 'busy' ? '<b>Checking for a new kit…</b><p class="ev-small ev-mut" role="status" aria-live="polite">Asking for the latest version.</p>' : T.phase === 'busy' ? `<b>Updating to ${esc(L)}</b><p class="ev-small ev-mut" role="status" aria-live="polite">${esc(T.say || 'Working.')}</p>`
119
125
  : ready() ? `<b>PMOS ${esc(L)} is ready</b><p class="ev-small ev-mut">You have ${esc(app)}.${appBehind() ? ' PMOS stops for about a minute while it installs. Open terminals keep running.' : ''}</p>`
120
126
  : L ? `<b>PMOS ${esc(app)} is up to date</b><p class="ev-small ev-mut">${fromGit() && s.appBehind ? esc(L) + ' is published. This PMOS runs from a checkout: update it with git pull.' : 'The newest published kit is ' + esc(L) + '.'}</p>`
121
127
  : `<b>PMOS ${esc(app)}</b><p class="ev-small ev-mut">Press Check now to ask for the latest version.</p>`;
@@ -123,7 +129,7 @@ function updates() {
123
129
  : `<button type="button" class="ev-btn sm" data-ev-upd="check"${T.busy ? ' disabled' : ''}>Check now</button>${ready() ? `<button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button>` : ''}`;
124
130
  const kits = (T.ws || []).map((w) => { const k = T.st[w.id], kit = k && k.kit; return trow(w.label || w.name || w.id, kit && kit.present ? 'kit ' + (kit.version || 'vendored by hand') : 'no kit in this workspace', k && k.kitBehind && L ? `<span class="ev-pill y">${esc(L)} ready</span>` : kit && kit.present && (k.lastCheck || k.latest) ? '<span class="ev-pill ok">Up to date</span>' : ''); }).join('');
125
131
  const last = s.lastCheck ? 'Last checked ' + new Date(s.lastCheck.at).toLocaleString() + '. ' : '';
126
- return `<div class="ev-card ev-upd"><div class="ev-tx ev-grow">${head}</div>${acts}</div>${kits}<p class="ev-small ev-mut">${esc(last)}${s.checkDaily ? 'PMOS checks once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
132
+ return `<div class="ev-card ev-upd">${mood ? adFace(mood) : ''}<div class="ev-tx ev-grow">${head}</div>${acts}</div>${kits}<p class="ev-small ev-mut">${esc(last)}${s.checkDaily ? 'PMOS checks once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
127
133
  }
128
134
  function whatsnew() {
129
135
  const L = changes(), s = home(), mine = s && s.app && !fromGit() ? s.app.version : null;
@@ -141,7 +147,7 @@ function draw() {
141
147
  const label = (SECTIONS.find((x) => x[0] === T.sec) || SECTIONS[0])[1];
142
148
  const all = T.sec === 'connectors' ? `<button type="button" class="ev-ib" data-ev-readall aria-label="Read every source again" title="Read all again"${T.reading ? ' disabled' : ''}>${svg(RD, 18)}</button>` : '';
143
149
  el.querySelector('.ev-st-main').innerHTML = staleHtml() + `<div class="ev-top"><h3 class="ev-h2" id="evStTitle">${esc(label)}</h3>${all}<button type="button" class="ev-ib" data-ev-close aria-label="Close settings" title="Close settings">${svg(ICON.close, 18)}</button></div>`
144
- + BODY[T.sec]() + `<p role="status">${esc(T.msg)}</p>`;
150
+ + BODY[T.sec]() + `<p role="status"${T.msg && AD.moodOfText(T.msg) === 'honest' ? ' class="ev-say honest"' : ''}>${T.msg && AD.moodOfText(T.msg) === 'honest' ? AD.adler('honest', 24, { label: false }) : ''}${esc(T.msg)}</p>`;
145
151
  if (had && !ae.isConnected) { const f = (key && el.querySelector(`[${key.name}="${CSS.escape(key.value)}"]`)) || el.querySelector('[aria-current="page"]'); if (f) f.focus(); }
146
152
  }
147
153
  function mount() {
@@ -203,7 +209,10 @@ async function press(e) {
203
209
  async function upd(a) {
204
210
  if (a === 'cancel') { T.phase = ''; return; }
205
211
  if (a === 'check') {
212
+ T.checking = true; T.msg = ''; draw();
213
+ try {
206
214
  for (const w of T.ws || []) { const r = await pmPost('/api/kit/check', { ws: w.id }); if (r && r.ok) T.st[w.id] = { ...(T.st[w.id] || {}), ...r }; else T.msg = (r && r.error) || 'The check failed.'; }
215
+ } finally { T.checking = false; }
207
216
  if (!T.msg) toast(ready() ? 'PMOS ' + latest() + ' is ready' : 'Checked. PMOS is up to date');
208
217
  return;
209
218
  }
@@ -20,6 +20,9 @@ button.cz-st:focus-visible, .cz-sact:focus-visible, .cz-more:focus-visible, .cz-
20
20
  .cz-nd.risk::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; background: var(--cz-risk); animation: cz-st-warn 3.2s ease-out infinite; }
21
21
  .cz-nd.tl { border: 1.6px dashed var(--cz-sl-line); }
22
22
  .cz-nd.go { background: var(--cz-solid); color: var(--cz-onsolid); }
23
+ /* Adler in the node (batch 17 item 4-A): glasses while a session runs the step; he holds the move when every step is done */
24
+ .cz-nd.cz-ad { width: 26px; height: 26px; margin: -2px; background: none; border: 0; }
25
+ .cz-nd.cz-ad::after { content: none; }
23
26
  .cz-spin { display: inline-flex; color: var(--cz-ink3); }
24
27
  .cz-spin svg { animation: cz-st-spin 1.1s steps(8) infinite; }
25
28
  @keyframes cz-st-spin { to { transform: rotate(360deg); } }
@@ -1,7 +1,7 @@
1
1
  /* pm/cozy-steps.js — the step list, one shared part (canvas Ready for development: stage card D XscD and XscDDesk, the chat progress
2
2
  * line XcbOptions). Pure string builders; the first call in a page adds /pm/cozy-steps.css once.
3
3
  *
4
- * stepsHtml(steps, o) <ol class="cz-sl">. A step: { state, label, note, noteWarn, code, owner, go, attr, aria, jira, act }
4
+ * stepsHtml(steps, o) <ol class="cz-sl">. A step: { state, label, note, noteWarn, code, owner, go, attr, aria, jira, act, node }
5
5
  * state 'done' | 'you' (blue ring, info motion) | 'run' (spinner: only when a record says a session runs) | 'wait' (empty circle)
6
6
  * | 'risk' (amber ring with !, warn motion) | 'skip' (struck through)
7
7
  * note the line under the label; noteWarn draws it amber (a late or blocked step's reason)
@@ -11,8 +11,9 @@
11
11
  * attr makes the whole row a button ('data-x="y"'); aria its label
12
12
  * jira { done, total, read } the ticket bar and "Read from Jira 10 min ago"
13
13
  * act { attr, icon: 'undo' | 'x', label } a trailing icon button (a skipped step's undo, × to skip)
14
+ * node html that stands in for the node (the stage card's Adler while Claude runs, batch 17 item 4-A)
14
15
  * o: { label, cls, fold: { n, names, open, attr }, more: { n, attr, label }, tail } tail: the html of a last node (stepTail)
15
- * stepTail(t) the last node: { name, ms, auto, note, attr, aria, ready: { attr, label } } (ready: every step done, the button
16
+ * stepTail(t) the last node: { name, ms, auto, note, attr, aria, ready: { attr, label }, face } (face: html for the ready node; ready: every step done, the button
16
17
  * "<label> ◆ <name>", label 'Move to' when not given)
17
18
  * nodeHtml(state, size) one node alone (14, 16 or 22); spinHtml(size) the 8-tick spinner, still under reduced motion.
18
19
  * ensureCss() adds the stylesheet now: a page calls it when it mounts, so the first draw is not unstyled. */
@@ -60,7 +61,7 @@ function jiraHtml(j) {
60
61
  function stepHtml(x) {
61
62
  const st = x.state || 'wait';
62
63
  const cls = { done: 'dn', you: 'now', run: 'now', wait: 'wt', risk: 'rk', skip: 'sk' }[st] || 'wt';
63
- const body = `${nodeHtml(st)}<span class="tx"><span class="lb">${esc(x.label)}</span>`
64
+ const body = `${x.node || nodeHtml(st)}<span class="tx"><span class="lb">${esc(x.label)}</span>`
64
65
  + (x.note ? `<small${x.noteWarn ? ' class="warn"' : ''}>${esc(x.note)}</small>` : '')
65
66
  + (x.code ? `<code>${esc(x.code)}</code>` : '')
66
67
  + (x.jira ? jiraHtml(x.jira) : '') + '</span>'
@@ -75,7 +76,7 @@ function stepHtml(x) {
75
76
  /** The last node: the next stage, its payoff and the KR, the "moves on by itself" icon; with every step done, the primary button. */
76
77
  export function stepTail(t) {
77
78
  if (!t) return '';
78
- if (t.ready) return `<li class="cz-sli tail"><div class="cz-st mvr">${'<span class="cz-nd go" aria-hidden="true">' + SVG(P.next, 14, 2.4) + '</span>'}<button type="button" class="cz-mvb" ${t.ready.attr}><span>${esc(t.ready.label || 'Move to')} ${t.ms ? MS : ''}${esc(t.name)}</span>${SVG(P.next, 16, 2.2)}</button></div></li>`;
79
+ if (t.ready) return `<li class="cz-sli tail"><div class="cz-st mvr">${t.face || '<span class="cz-nd go" aria-hidden="true">' + SVG(P.next, 14, 2.4) + '</span>'}<button type="button" class="cz-mvb" ${t.ready.attr}><span>${esc(t.ready.label || 'Move to')} ${t.ms ? MS : ''}${esc(t.name)}</span>${SVG(P.next, 16, 2.2)}</button></div></li>`;
79
80
  const inner = `<span class="cz-nd tl" aria-hidden="true"></span><span class="tx"><span class="nm">${t.ms ? MS : ''}${esc(t.name)}${t.auto && !t.ms ? `<span class="cz-auto" title="Moves on by itself">${SVG(P.auto, 13, 2.2)}</span>` : ''}</span>${t.note ? `<small>${esc(t.note)}</small>` : ''}</span>`
80
81
  + (t.attr ? `<span class="cz-cv">${SVG(P.go, 14, 2.2)}</span>` : '');
81
82
  return `<li class="cz-sli tail">${t.attr ? `<button type="button" class="cz-st mv" ${t.attr} aria-haspopup="dialog" aria-expanded="false"${t.aria ? ` aria-label="${esc(t.aria)}"` : ''}>${inner}</button>` : `<div class="cz-st mv">${inner}</div>`}</li>`;
@@ -479,6 +479,8 @@ body.cz-home .hm-hd.hv-bar { padding: 0; }
479
479
  .yd-chip svg { color: var(--cz-blue); }
480
480
  .yd-miss, .yd-card { display: flex; align-items: center; gap: 12px; }
481
481
  .yd-miss { background: var(--cz-card); border-radius: 14px; padding: 12px; }
482
+ .yd-sync { display: flex; justify-content: flex-end; } /* AdP5: read a failed source again */
483
+ .yd-sync.yd-miss { justify-content: flex-start; }
482
484
  .yd-card { background: var(--cz-card); border-radius: 18px; padding: 14px 12px 14px 16px; }
483
485
  .yd-call + .yd-call { margin-top: 8px; }
484
486
  .yd-call.am .yd-mt b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--cz-late); margin-right: 8px; vertical-align: 2px; }
@@ -515,3 +517,6 @@ body.cz-home .hm-hd.hv-bar { padding: 0; }
515
517
  .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 */
516
518
  .hm-none.hm-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
517
519
  .hm-none.hm-ad p { margin: 0; }
520
+
521
+ /* the weekly review done for the week (batch 17 item 4-B, AdM1): Adler calm beside the words */
522
+ .rv-done { display: flex; align-items: center; gap: 10px; }
@@ -51,7 +51,8 @@ import * as SO from './sort-order.js'; // the sort button and ONE order with t
51
51
  import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
52
52
  import * as IMP from './home-impact.js'; // Your impact: the weekly check in Home's own chat (batch 16 item 7, GmP1Ledger)
53
53
  import * as LPV from './loose-props.js'; // Claude's clean-up of "Not in an initiative": the ✦ on its header and the Viewer (batch 13 item 3)
54
- import * as IM from './impact.js'; // Your impact (batch 16 item 7): Adler's sprout on the greeting, the week in the Viewer, the Friday chapter
54
+ import * as IM from './impact.js';
55
+ import { mountPull } from './cozy-pull.js'; // pull to refresh on Your day, Adler peeking up (batch 17 item 4-B, AdP2) // Your impact (batch 16 item 7): Adler's sprout on the greeting, the week in the Viewer, the Friday chapter
55
56
  import * as DB from './dash-view.js'; // the product page is the product's Dashboard (batch 17 item 1, canvas PbA3, PbG6, PbG8)
56
57
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
57
58
 
@@ -294,6 +295,8 @@ function todayModel() {
294
295
  function homeListHtml() {
295
296
  const M = L.homeList(S.D, { now: NOW(), filter: S.filter });
296
297
  S.M = M;
298
+ // Adler's ears over the floating button (batch 17 item 4-B, AdP6): the place menu hears how many calls are the PM's
299
+ { const n = (M.move || []).filter((r) => r.call).length; if (n !== S.calls) { S.calls = n; document.dispatchEvent(new CustomEvent('cz:calls', { detail: { count: n } })); } }
297
300
  const lg = M.groups.find((g) => g.kind === 'loose'); if (lg) lg.chip = LPV.chipOf();
298
301
  const R = L.reviewModel(S.D, NOW());
299
302
  // a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
@@ -311,7 +314,7 @@ function homeListHtml() {
311
314
  * marks all seen. An item leaves once it is opened or marked seen. */
312
315
  function dayHtml() { return ''; }
313
316
  function dayParts() {
314
- const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW(), { delightOk: !!S.joyOk, news: S.news });
317
+ const Y = YD.dayModel(S.M, S.D, L.reviewModel(S.D, NOW()), NOW(), { delightOk: !!S.joyOk, news: S.news, sources: S.src && S.src.sources, ask: MEN.dayAskOf(S.D) });
315
318
  return { Y, P: YD.dayParts(Y, { moment: !!(isPhone() && PHC), now: NOW(), first: !!S.first }) };
316
319
  }
317
320
  function drawDayBody(body, P) {
@@ -352,11 +355,14 @@ function day(on) {
352
355
  onClose: () => { S.day = false; },
353
356
  render: (body) => {
354
357
  drawDayBody(body, P);
358
+ if (isPhone()) mountPull(body, { read: rereadDay, label: 'Reading your day again' });
355
359
  body.onclick = (e) => { // the rows are the list's own rows: the same presses open them
356
360
  const b = e.target.closest('button'); if (!b) return;
357
361
  if (b.dataset.hmSel) { select(b.dataset.hmSel); return; }
358
362
  if (b.dataset.yd === 'sel') { const c = b.closest('.yd-call'); if (c) select(c.dataset.id); return; }
359
363
  if (b.dataset.yd === 'retry' || b.dataset.yd === 'prep') { dayAct(b); return; }
364
+ if (b.dataset.yd === 'sync') { syncAgain(b); return; }
365
+ if (b.dataset.yd === 'ask') { S.day = false; S.sel = 'mentions'; drawList(); MEN.openMentions(menCtx(), { sel: b.dataset.id }); return; }
360
366
  if (b.dataset.yd === 'news' || b.dataset.yd === 'news-all') { VW.drill(); MORE.openInbox(searchGo, b.dataset.yd === 'news' ? b.dataset.id : ''); return; }
361
367
  if (b.dataset.yd === 'seen') { daySeen(b); return; }
362
368
  if ('hmReview' in b.dataset) { openReviewVw(); return; }
@@ -365,6 +371,31 @@ function day(on) {
365
371
  } });
366
372
  readNews();
367
373
  }
374
+ /** Pull to refresh on Your day (AdP2): Home reads again, the place menu reads New for you and the sources again, then the day redraws. */
375
+ async function rereadDay() {
376
+ await load();
377
+ document.dispatchEvent(new CustomEvent('cz:news'));
378
+ await readNews();
379
+ redrawDay();
380
+ }
381
+ /** The sources' last reads (GET /api/sources), passed on by the place menu and by Settings: a failed one shows on Your day (AdP5). */
382
+ function sourcesIn(d) {
383
+ if (!d || !d.ok) return;
384
+ const was = JSON.stringify((S.src && S.src.sources || []).map((x) => x.id + x.state)), now = JSON.stringify((d.sources || []).map((x) => x.id + x.state));
385
+ S.src = d;
386
+ if (was !== now) redrawDay();
387
+ }
388
+ document.addEventListener('cz:sources', (e) => sourcesIn(e.detail));
389
+ addEventListener('pm:sources', (e) => sourcesIn(e.detail));
390
+ /** ↻ on the failed source in Your day: read it again (the same press as Settings › Connectors), then read the sources once more. */
391
+ async function syncAgain(b) {
392
+ if (b.disabled) return;
393
+ b.disabled = true;
394
+ const r = await pmPost('/api/sources/refresh', { ws: (S.src && S.src.ws) || WS || boardWs() || '', source: b.dataset.id }).catch(() => null);
395
+ toast(r && r.ok ? 'Reading it again.' : 'It did not start: ' + ((r && r.error) || 'the server did not answer') + '.');
396
+ if (!(r && r.ok)) { b.disabled = false; return; }
397
+ setTimeout(() => document.dispatchEvent(new CustomEvent('cz:news')), 4000);
398
+ }
368
399
  /** Your day drawn again in place (a new read of New for you, a seen item), when it is the item shown. */
369
400
  function redrawDay() {
370
401
  const c = VW.current(), body = VW.body(); if (!S.day || !c || c.id !== 'day' || !body || !S.M) return;
@@ -23,7 +23,10 @@
23
23
  * Adler (batch 16 item 2) is the face: the M face on the opening card in the day's mood (ADLER: glad and calm are handled, delighted is
24
24
  * celebrating, concerned is honest, a run still drafting is thinking); the morning scene on the day's first open before noon (AdP1);
25
25
  * the L figure with his tea when nothing needs the PM (AdB2) or celebrating on an earned day (AdB3), and then the small face hides (one
26
- * Adler per screen); after 22:00 the night scene guards the evening (AdP4) unless something is wrong, which is never hidden. */
26
+ * Adler per screen); after 22:00 the night scene guards the evening (AdP4) unless something is wrong, which is never hidden.
27
+ * A source that could not be read (batch 17 item 4-B, AdP5; GET /api/sources state 'failed', passed as o.sources): Claude says it plainly
28
+ * under a small rain cloud, Adler honest, with when PMOS last had it and one icon to read it again. The day turns concerned: the mood is
29
+ * never happier than the data. When Claude's own miss or a stuck call already leads the card, the failed source is one card under it. */
27
30
 
28
31
  import { todayOf, hm } from './home-data.js';
29
32
  import { adler, adlerScene, asleep, firstOpenToday } from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2): AdB1-3, AdP1, AdP4
@@ -35,6 +38,7 @@ const clip = (s, n) => { const t = String(s || '').replace(/\s+/g, ' ').trim();
35
38
  export const DAY_ICON = 'M12 3l1.8 4.6L18 9l-4.2 1.4L12 15l-1.8-4.6L6 9l4.2-1.4z';
36
39
  const CLOCK = 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 8v4l3 2', CAL = 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', CHEV = 'M10 7l5 5-5 5';
37
40
  const CHECK = 'M5 12.5l4.5 4.5L19 7', OPEN = 'M14 4h6v6M20 4l-9 9M18 14v6H4V6h6';
41
+ const AGAIN = 'M4 12a8 8 0 0 1 14-5M20 12a8 8 0 0 1-14 5M18 3v4h-4M6 21v-4h4';
38
42
  const svg = (d, w = 15, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
39
43
 
40
44
  const span = (m) => { const a = Date.parse(m.start); const b = m.end ? Date.parse(m.end) : a + (m.minutes || 30) * 60000; return { a, b }; };
@@ -52,6 +56,23 @@ export function gapsOf(t, now) {
52
56
  return out.filter((g) => g.b - g.a >= 30 * 60000);
53
57
  }
54
58
 
59
+ const SRC_NAMES = { jira: 'Jira', calendar: 'Your calendar', 'my-work': 'Your task list', tracker: 'The tracker', tools: 'Mail and Slack', initiatives: 'The repository' };
60
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
61
+ /** The source that could not be read (AdP5), Jira first: { id, name, from: 'from 08:00' | 'from Sun' | '' } or null. sources: GET /api/sources. */
62
+ export function syncFailOf(sources, now = Date.now()) {
63
+ const L = (Array.isArray(sources) ? sources : []).filter((x) => x && x.state === 'failed' && x.id !== 'repository');
64
+ if (!L.length) return null;
65
+ const f = L.find((x) => x.id === 'jira') || L[0], at = Date.parse(f.as_of || '');
66
+ const from = Number.isNaN(at) ? '' : localDay(at) === localDay(now) ? 'from ' + hm(new Date(at).toISOString()) : 'from ' + DOW[new Date(at).getDay()];
67
+ return { id: f.id, name: SRC_NAMES[f.id] || f.name || f.id, from };
68
+ }
69
+ /** What Claude says about a failed source: the line and why the day still holds. */
70
+ export function failWords(F) {
71
+ const line = F.name + ' isn’t answering.';
72
+ const sub = (F.from ? 'So what I show from ' + (F.id === 'jira' ? 'Jira' : 'it') + ' is ' + F.from + '.' : 'So nothing from it is in your day yet.') + (F.id === 'calendar' ? '' : ' Your plan for today still stands.');
73
+ return { line, sub };
74
+ }
75
+
55
76
  /** A real thank-you to the PM today: the newest mention of today whose words thank them. { quote, who, where, at } or null. */
56
77
  export function thanksOf(D, now) {
57
78
  const L = (D && D.today && Array.isArray(D.today.mentions) ? D.today.mentions : []).filter((m) => m && m.text && THANKS.test(m.text) && (!m.at || localDay(Date.parse(m.at)) === localDay(now)));
@@ -73,7 +94,8 @@ export function tomorrowOf(D, now) {
73
94
  }
74
95
 
75
96
  /** Your day's words. M: homeList's model (move); D: Home's data (today's meetings, phoneDay, the brief page's me and mentions);
76
- * R: reviewModel. o: { delightOk: false when the delighted face showed on another day this week, news: the GET /api/news-for-you answer }.
97
+ * R: reviewModel. o: { delightOk: false when the delighted face showed on another day this week, news: the GET /api/news-for-you answer,
98
+ * ask: home-mentions dayAskOf (the one waiting ask the opening card names) }.
77
99
  * → { mood, line, sub, chips, misses, offer, calls, drafts, wait, done, next, week, thanks, news, tomorrow } */
78
100
  export function dayModel(M, D, R, now = Date.now(), o = {}) {
79
101
  D = D || {};
@@ -127,10 +149,14 @@ export function dayModel(M, D, R, now = Date.now(), o = {}) {
127
149
  } else if (run && run.working) {
128
150
  line = hi + ' I’m still on ' + plural(run.working, 'draft', 'drafts') + '.'; sub = meetText;
129
151
  }
152
+ // a source that could not be read (AdP5): said plainly; it leads the card unless Claude's own miss or a stuck call already does
153
+ const fail = syncFailOf(o.sources, now);
154
+ let failLead = false;
155
+ if (fail && mood !== 'concerned') { const w = failWords(fail); mood = 'concerned'; line = w.line; sub = w.sub; failLead = true; }
130
156
  // no prep run today: say so, and offer it (Prepare my day); never claim work that did not happen
131
157
  if (!run && h < 17) offer = { kind: 'prep', text: 'I haven’t prepared today yet.', sub: 'Shall I prep your meetings and draft what I can?' };
132
158
  return {
133
- mood, face: run && run.working && mood === 'calm' ? 'working' : mood, line, sub, chips, misses, offer, calls, drafts, wait, done, thanks,
159
+ mood, face: run && run.working && mood === 'calm' ? 'working' : mood, line, sub, chips, misses, offer, calls, drafts, wait, done, thanks, fail, failLead, ask: o.ask || null,
134
160
  news: newsOf(o.news), digests: digestsOf(D), tomorrow: tomorrowOf(D, now),
135
161
  next: next ? { meeting: next, now: next.state === 'now', time: hm(next.start), title: next.title || 'A meeting' } : null,
136
162
  week: { sub: un || 'Weekly review' },
@@ -145,10 +171,18 @@ const alt = (act, label, id, icon) => `<button type="button" class="yd-alt" data
145
171
 
146
172
  /** The opening card: face, line, sub, the chips of real work, and Claude's own misses with a ✓ to run them again. */
147
173
  export function openHtml(Y, o = {}) {
148
- const head = o.scene ? `<div class="yd-scene">${adlerScene('morning', 'handled', { label: false })}</div>` : o.big ? '' : faceHtml(Y.face || Y.mood);
174
+ // AdP5: a failed source that leads the card draws the small rain cloud in place of the morning scene (Face only: the honest face)
175
+ const rain = Y.fail && Y.failLead ? adlerScene('rain', 'honest', { label: 'Adler, honest, under a small rain cloud', h: 170 }) : '';
176
+ if (rain) o = { ...o, scene: true };
177
+ const head = rain ? `<div class="yd-scene">${rain}</div>` : o.scene ? `<div class="yd-scene">${adlerScene('morning', 'handled', { label: false })}</div>` : o.big ? '' : faceHtml(Y.face || Y.mood);
149
178
  const chips = Y.chips.length ? `<div class="yd-chips">${Y.chips.map((c) => `<span class="yd-chip">${svg(CHECK, 14, 2.6)}${esc(c)}</span>`).join('')}</div>` : '';
150
179
  const miss = Y.misses.map((m) => `<div class="yd-miss" data-id="${esc(m.id)}"><div class="yd-mt"><b>My miss: ${esc(m.title)}</b>${m.why ? `<em>${esc(m.why)}</em>` : ''}</div>${ok('retry', 'Run it again', m.id)}</div>`).join('');
151
- return `<div class="yd-open ${esc(Y.mood)}${o.scene ? ' has-scene' : ''}">${o.scene ? head : ''}<div class="yd-hd">${o.scene ? '' : head}<div class="yd-ht"><b>${esc(Y.line)}</b>${Y.sub ? `<em>${esc(Y.sub)}</em>` : ''}</div></div>${chips}${miss}</div>`
180
+ // the failed source under Claude's own miss: one card, no second Adler; its icon reads the source again (Settings › Connectors' ↻)
181
+ const sync = Y.fail ? (Y.failLead ? `<div class="yd-sync">${alt('sync', 'Read ' + Y.fail.name + ' again', Y.fail.id, AGAIN)}</div>`
182
+ : (() => { const w = failWords(Y.fail); return `<div class="yd-miss yd-sync" data-id="${esc(Y.fail.id)}"><div class="yd-mt"><b>${esc(w.line)}</b><em>${esc(w.sub)}</em></div>${alt('sync', 'Read ' + Y.fail.name + ' again', Y.fail.id, AGAIN)}</div>`; })()) : '';
183
+ // one ask that waits on the PM in Mentions (batch 17 item 6): who, where, Claude's gist; its icon opens that conversation in Mentions
184
+ const A = Y.ask, ask = A ? `<div class="yd-miss yd-ask" data-id="${esc(A.id)}"><div class="yd-mt"><b>${esc(A.who)} asked you in ${esc(A.where)}${A.more ? ` · ${A.more} more` : ''}</b><em>${esc(A.gist)}</em></div>${alt('ask', 'Open in Mentions', A.id, CHEV)}</div>` : '';
185
+ return `<div class="yd-open ${esc(Y.mood)}${o.scene ? ' has-scene' : ''}">${o.scene ? head : ''}<div class="yd-hd">${o.scene ? '' : head}<div class="yd-ht"><b>${esc(Y.line)}</b>${Y.sub ? `<em>${esc(Y.sub)}</em>` : ''}</div></div>${chips}${miss}${sync}${ask}</div>`
152
186
  + (Y.offer ? `<div class="yd-card yd-offer"><div class="yd-mt"><b>${esc(Y.offer.text)}</b><em>${esc(Y.offer.sub)}</em></div>${ok('prep', 'Prepare my day')}</div>` : '');
153
187
  }
154
188
 
@@ -157,6 +157,15 @@ const heard = () => { try { return new Set(JSON.parse(store.get(HEARD) || '[]'))
157
157
  const landedKey = (x) => x.id + '@' + x.at;
158
158
  const joinOr = (l) => (l.length <= 1 ? l.join('') : l.slice(0, -1).join(', ') + ' or ' + l[l.length - 1]);
159
159
  const joinAnd = (l) => (l.length <= 1 ? l.join('') : l.slice(0, -1).join(', ') + ' and ' + l[l.length - 1]);
160
+ /** The one ask Your day's opening card names (batch 17 item 6): the oldest conversation in Your move, or null. Pure.
161
+ * → { id, who, where, gist, more } */
162
+ export function dayAskOf(D) {
163
+ const L = mentionsOf(D);
164
+ if (!L.loaded || L.failed || !L.waiting.length) return null;
165
+ const m = L.waiting[0];
166
+ return { id: m.id, who: nameOf(m), where: placeOf(m), gist: gistOf(m), more: L.waiting.length - 1 };
167
+ }
168
+
160
169
  /** Adler's opening line: what is handled first, said as plainly as the data. Pure. L: mentionsOf(); o: { heard: Set of landed keys said }.
161
170
  * → { mood, html, go (start on the oldest ask), retry, said: [landed keys this line says] } */
162
171
  export function openingOf(L, now = Date.now(), o = {}) {
@@ -276,10 +285,10 @@ function listHtml(ctx, X) {
276
285
  let LIST = null; // the list Viewer that is open: { body, X, draw }, so a press elsewhere redraws it
277
286
  const SPLIT = 720; // a Viewer this wide shows the list and the conversation side by side (MnA4)
278
287
  const canSplit = (b) => !!b && !(typeof innerWidth === 'number' && innerWidth <= VW.PHONE) && (b.clientWidth || 0) >= SPLIT;
279
- export function openMentions(ctx) {
288
+ export function openMentions(ctx, o = {}) {
280
289
  sheet();
281
290
  store.set(SEEN, Date.now());
282
- const X = { all: false, allRead: false, sel: null, split: false };
291
+ const X = { all: false, allRead: false, sel: o.sel || null, split: false }; // o.sel: Your day's ask opens on its conversation
283
292
  const find = (id) => allOf(mentionsOf(ctx.D())).find((x) => x.id === id) || null;
284
293
  const draw = (b) => {
285
294
  LIST = { body: b, X, draw };
@@ -327,6 +336,8 @@ export function openMentions(ctx) {
327
336
  setTimeout(tick, 5000);
328
337
  // the desktop opens wide, so the list and the conversation sit side by side (MnA4); "Back to the side" keeps the one-column list
329
338
  if (!(typeof innerWidth === 'number' && innerWidth < 1280)) { VW.wide(true); if (LIST && LIST.body === body && canSplit(body) !== X.split) draw(body); }
339
+ // one column: the asked conversation opens over the list, as a press on its row does
340
+ if (o.sel && !X.split) { const m = find(o.sel); if (m) openOne(m, ctx, { back: true }); }
330
341
  // read again on open, so the list is never older than the press that opened it
331
342
  load(ctx).then(() => { const c = VW.current(); if (c && c.id === 'mentions' && LIST && LIST.body === body) draw(body); ctx.redrawList(); });
332
343
  return body;
@@ -6,9 +6,12 @@
6
6
  * POST /api/home-review/keep. The rows' own presses are the routes My work already uses (/api/pm-items/*) and the lifecycle route for
7
7
  * a hold (POST /api/lifecycle, with the reason on the record). Every write is the PM's press. "My work" beside "Weekly review" switches the
8
8
  * Viewer to My work (home-work.js).
9
+ * Done for the week (batch 17 item 4-B, AdM1 "Weekly review done"): Adler's calm face beside the summary's words. Calm, not a cheer: the
10
+ * review is upkeep, not a win. "Nobody owes you anything" only when nothing is owed to the PM.
9
11
  * h: { VW, pmPost, toast, D() (Home's data), reload() (reads Home again), ws(), iniTitle(id), askAbout(stale), openWork(), now() } */
10
12
  import { esc, svg, P } from './home-today.js';
11
13
  import { reviewModel, staleInis } from './home-list.js';
14
+ import { adler } from './cozy-adler.js';
12
15
 
13
16
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
14
17
  const dayLabel = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
@@ -61,13 +64,18 @@ export function openReview(h) {
61
64
  untouched: () => { const n = staleInis(h.D(), h.now()).length; return n ? plural(n, 'initiative has', 'initiatives have') + ' not moved for two weeks. Keep them going, or ask in chat.' : 'Nothing has sat untouched for 14 days.'; },
62
65
  pick: () => "Pick next week's three. Each one becomes P1 on your list.",
63
66
  };
67
+ // AdM1: the week's review is done. The words come from what PMOS holds: owed items are counted from My work's waiting rows
68
+ const doneHtml = () => {
69
+ const owed = (work() && work().waiting ? work().waiting.rows : []).length;
70
+ return `<span class="rv-done">${adler('handled', 36, { label: false })}<span>${owed ? 'Each step kept what you decided.' : 'Nobody owes you anything.'} The next review is on Friday.</span></span>`;
71
+ };
64
72
  const draw = (b) => {
65
73
  const R = reviewModel(h.D(), h.now());
66
74
  const at = R.steps.findIndex((s) => s.now), left = R.steps.filter((s) => !s.done).length;
67
75
  const now = at >= 0 ? R.steps[at] : null;
68
76
  const last = R.last ? 'Last review: ' + dayLabel(R.last.week) + (R.last.minutes ? ' · ' + plural(R.last.minutes, 'minute', 'minutes') : '') : 'This is your first weekly review here.';
69
77
  const sum = h.VW.czSummary({ line: R.done ? 'Done for this week' : now ? 'Step ' + (at + 1) + ' of ' + R.steps.length : '', tone: R.done ? 'ok' : 'you',
70
- text: R.done ? 'Each step kept what you decided.' : now ? (ASK[now.key] || ASK.pick)(R) : 'Four short steps. Each one keeps what you decided.',
78
+ text: R.done ? doneHtml() : now ? (ASK[now.key] || ASK.pick)(R) : 'Four short steps. Each one keeps what you decided.', textHtml: R.done,
71
79
  meta: R.done ? last : 'About ' + plural(left * 3, 'minute', 'minutes') + ' left · ' + last,
72
80
  primary: now ? { label: 'Continue', act: 'step:' + now.key, disabled: st.busy } : null });
73
81
  const secs = h.VW.czSections(R.steps.map((s) => ({ id: s.key, title: s.label, count: s.done ? s.note || 'done' : '', open: !!s.now,
@@ -10,6 +10,12 @@
10
10
  * with the "moves on by itself" icon when that is on. A tap on it opens the move sheet (home-ini.js). Every step done and the next stage
11
11
  * a milestone (or the switch off): the last node is the primary button "Move to ◆ Deliver". */
12
12
  import { stepsHtml, stepTail } from './cozy-steps.js';
13
+ import { adler, prefs as adPrefs } from './cozy-adler.js';
14
+
15
+ /* Adler on the stage card (batch 17 item 4-A, canvas AdM1 "Stage card · Claude works on it", AdU3, AdM2 "Every part is done"): his face wears
16
+ * glasses in the node of the step a session runs, instead of the spinner; with every step done he holds the move. The PM's own steps keep
17
+ * their rings and boxes. Settings > Adler > Off keeps the spinner and the arrow. */
18
+ const adNode = (mood, cls) => (adPrefs()['adler.amount'] === 'off' ? undefined : `<span class="cz-nd ${cls} cz-ad" aria-hidden="true">${adler(mood, 24, { label: false })}</span>`);
13
19
 
14
20
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
15
21
  const CLOCK = '<svg aria-hidden="true" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17"/></svg>';
@@ -32,7 +38,7 @@ export function stepRows(h, o = {}) {
32
38
  let first = true;
33
39
  for (const x of (h && h.rest) || []) {
34
40
  if (x.kind === 'you') { you.push({ state: 'you', label: x.label, note: x.note, go: first ? { attr: 'data-hm-go', label: x.label + '. Open it' } : null, attr: first ? '' : 'data-hm-go', aria: x.label + '. Open it' }); first = false; }
35
- else if (x.kind === 'agent' && o.run && !ran) { ran = true; run.push({ state: 'run', label: x.label, note: runNote(), owner: { kind: 'claude', live: true } }); }
41
+ else if (x.kind === 'agent' && o.run && !ran) { ran = true; run.push({ state: 'run', label: x.label, note: runNote(), owner: { kind: 'claude', live: true }, node: adNode('thinking', 'run') }); }
36
42
  else if (x.kind === 'agent') wait.push({ state: 'wait', label: x.label, note: x.note, owner: { kind: 'claude' },
37
43
  ...(x.task ? { act: { attr: `data-hi-chk="${esc(x.task)}"`, icon: 'check', label: 'Mark done: ' + x.label } } : {}) }); // a stage task closes here (home-ini.js hiChk)
38
44
  else if (x.kind === 'risk') risk.push({ state: 'risk', label: x.label, note: x.note, noteWarn: true });
@@ -40,7 +46,7 @@ export function stepRows(h, o = {}) {
40
46
  else wait.push({ state: 'wait', label: x.label, note: x.note });
41
47
  }
42
48
  // a session works on this initiative but no step names it: its own line, so the spinner is never invented and never hidden
43
- if (o.run && !ran) run.push({ state: 'run', label: o.run.title || 'Claude works on it', note: runNote(), owner: { kind: 'claude', live: true } });
49
+ if (o.run && !ran) run.push({ state: 'run', label: o.run.title || 'Claude works on it', note: runNote(), owner: { kind: 'claude', live: true }, node: adNode('thinking', 'run') });
44
50
  const open = you.concat(run, risk, wait);
45
51
  const shown = o.moreOpen ? open : open.slice(0, OPEN_MAX);
46
52
  const done = ((h && h.done) || []).map((x) => ({ state: 'done', label: x.label }));
@@ -51,7 +57,7 @@ export function stepRows(h, o = {}) {
51
57
  export function tailOf(h, mv) {
52
58
  if (!mv || !mv.next) return mv && mv.why ? `<li class="cz-sli tail"><p class="hm-scwhy">${esc(mv.why)}</p></li>` : '';
53
59
  if (mv.why) return stepTail({ name: mv.next, ms: mv.ms, note: mv.why });
54
- if (mv.canMove && mv.allDone && (mv.ms || !mv.auto || mv.held)) return stepTail({ name: mv.next, ms: mv.ms, ready: { attr: 'data-hi-move', label: 'Move to' } });
60
+ if (mv.canMove && mv.allDone && (mv.ms || !mv.auto || mv.held)) return stepTail({ name: mv.next, ms: mv.ms, ready: { attr: 'data-hi-move', label: 'Move to' }, face: adNode('needs-you', 'go') });
55
61
  const note = nextNote(h, mv);
56
62
  const autoOn = mv.auto && !mv.held && !mv.ms;
57
63
  return stepTail({ name: mv.next, ms: mv.ms, auto: autoOn, note, attr: 'data-hi-next',
@@ -29,6 +29,7 @@ b.im-t { font-weight: 700; }
29
29
  .im-first, .im-mh { display: flex; align-items: center; gap: 12px; }
30
30
  .im-first { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 18px; padding: 14px; }
31
31
  .im-made { margin-top: 18px; }
32
+ .im-win { margin-bottom: 12px; border-radius: 18px; overflow: hidden; }
32
33
  .im-ch { margin: 12px 0; }
33
34
  .im-mt { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: var(--fs-3); color: var(--cz-ink2); }
34
35
  .im-face { width: 40px; height: 44px; border: 0; padding: 0; margin: 0 -4px 0 0; background: none; border-radius: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
@@ -19,7 +19,7 @@
19
19
  * source you can open, so an item whose source has no safe address is not drawn. Pure string builders above the Viewer part. */
20
20
  import { pmGet, pmPost } from './http.js';
21
21
  import { open as vwOpen, current as vwCurrent } from './cozy-viewer.js';
22
- import { adler, prefs as adPrefs } from './cozy-adler.js';
22
+ import { adler, adlerScene, celebrateOnce, prefs as adPrefs } from './cozy-adler.js';
23
23
 
24
24
  const CSS = new URL('./impact.css', import.meta.url).href;
25
25
  function addCss() {
@@ -174,7 +174,10 @@ const initial = (s) => esc(String(s || '?').trim().charAt(0).toUpperCase() || '?
174
174
  export function madeHtml(x, W = W0) {
175
175
  if (!x || !shows(W)) return '';
176
176
  addCss();
177
- return `<section class="im im-made" aria-label="Who made it happen"><div class="im-mh">${adler('celebrating', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
177
+ // AdH2: Adler celebrates once, on the first view of this delivery (and at most once a week), in the small win scene; every later view is calm.
178
+ // The diamond on the timeline stays plain and nothing is sent.
179
+ const joy = celebrateOnce('made.' + x.ms.name + '.' + x.ms.date), scene = joy && adPrefs()['adler.amount'] === 'full';
180
+ return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
178
181
  + `<div class="im-card">${x.people.map((p) => `<div class="im-row"><span class="im-av" aria-hidden="true">${initial(p.who)}</span><span class="im-tx"><b class="im-t">${esc(p.who)}</b><span class="im-s">${esc(p.what)}</span></span>`
179
182
  + `<a class="im-ib" href="${esc(p.url)}"${linkAttrs(p.url)} aria-label="Open ${esc(p.key || p.what)}" title="Open ${esc(p.key || 'the ticket')}">${svg(I.open, 20)}</a></div>`).join('')}</div>${LOCK}</section>`;
180
183
  }