@double_geste/agent-standup 1.39.2 → 1.41.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.
package/public/index.html CHANGED
@@ -91,6 +91,8 @@
91
91
  .rr.k-blocked { border-left-color:#ff5252; background:rgba(192,57,43,.28) } .rr.k-blocked .st { color:#fff; font-weight:700 } .rr.k-stalled { border-left-color:#ffb347 } .rr.k-stalled .st { color:#ffb347; font-weight:700 }
92
92
  .rr.k-done { opacity:.82 } .rr.k-done .st { color:var(--ok) } .rr.turn { opacity:1; border-left-color:var(--accent) } .rr.turn .st { color:var(--accent); font-weight:700 } .rr.turn.gave { border-left-color:#ffb347 } .rr.turn.gave .st { color:#ffb347 } .rr.k-idle .st { color:var(--dim) } .rr.speaking { box-shadow:0 0 0 2px rgba(124,156,255,.5) }
93
93
  #boardv { flex:1; overflow:auto; padding:16px 18px; display:none }
94
+ .bnote, .miss { margin:0 0 12px; padding:7px 12px; border-radius:10px; font-size:12.5px; background:rgba(255,179,71,.09); border:1px solid rgba(255,179,71,.45); color:var(--text); text-align:left; overflow-wrap:anywhere } /* amber, not the red of "needs you"; the long names of variables wrap in a narrow window */
95
+ .miss summary { cursor:pointer; list-style:none } .miss summary::-webkit-details-marker { display:none } .miss u { color:var(--accent); text-decoration:none; white-space:nowrap } .miss ul { margin:6px 0 2px; padding-left:18px; color:var(--dim) } .miss .mv { font:11.5px ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere } #eMiss:empty { display:none } #eMiss .miss { max-width:460px; margin:0 } .bcard .bab { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
94
96
  .bsum { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; font-size:12.5px } .bsum span { padding:3px 10px; border-radius:99px; background:var(--panel2); border:1px solid var(--line) }
95
97
  .bgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:10px }
96
98
  .bcard { text-align:left; background:var(--panel2); border:1px solid var(--line); border-radius:12px; padding:11px 13px; display:flex; flex-direction:column; gap:5px; cursor:pointer }
@@ -150,6 +152,13 @@
150
152
  .pweb { flex:1; min-height:0; position:relative; overflow:hidden; background:#fff } .pweb iframe { position:absolute; left:0; top:0; border:0; width:calc(100% / var(--z,1)); height:calc(100% / var(--z,1)); transform:scale(var(--z,1)); transform-origin:0 0; background:#fff }
151
153
  .pzoom { position:absolute; inset:0; width:100%; cursor:zoom-in }
152
154
  .pcard { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; padding:14px; text-align:center; background:#0d1117; color:#d6dae6 } .pcard i { font-style:normal; font-size:30px } .pcard b { font-size:16px } .pcard p { margin:0; max-width:520px; color:#9aa0b4; font-size:12.5px } .pcard em { font-style:normal; color:#6b7089; font-size:11.5px }
155
+ /* a browser the agent drives (Claude in Chrome): its last screenshot in a frame of the page's shape, and a pointer that goes where it clicks */
156
+ .pwin.browser { flex-basis:1100px } .pwin.browser #pbody { display:flex; flex-direction:column; padding:0; background:#0b0c11; font:12px -apple-system,system-ui,sans-serif }
157
+ .pbr { flex:1; min-height:0; position:relative; container-type:size; display:flex; align-items:center; justify-content:center; padding:6px } .pbr.none .pfr { display:none } .pbr:not(.none) .pnone { display:none }
158
+ .pfr { position:relative; flex:none; width:min(100cqw, 100cqh * var(--ar,1.36)); aspect-ratio:var(--ar,1.36) } .pfr img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; border-radius:3px; background:#fff }
159
+ .pptr { position:absolute; left:50%; top:50%; width:17px; height:23px; margin:-1px 0 0 -1px; z-index:1; pointer-events:none; background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 23'%3E%3Cpath d='M1.5 1.5v17l4.3-4.1 3 6.6 2.7-1.2-3-6.5h6z' fill='%23fff' stroke='%23111' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat; filter:drop-shadow(0 2px 3px rgba(0,0,0,.45)); transition:left .6s cubic-bezier(.3,.7,.3,1), top .6s cubic-bezier(.3,.7,.3,1) }
160
+ .pptr::after { content:''; position:absolute; left:-13px; top:-13px; width:28px; height:28px; box-sizing:border-box; border-radius:50%; border:3px solid #f0a020; opacity:0 } .pptr.clk::after { animation:pclk .6s ease-out .55s } @keyframes pclk { from { opacity:1; transform:scale(.3) } to { opacity:0; transform:scale(1.5) } }
161
+ .pkey { position:absolute; z-index:1; margin:24px 0 0 12px; max-width:60%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; background:rgba(10,11,16,.88); color:#fff; padding:2px 8px; border-radius:6px; font:12px ui-monospace,Menlo,monospace; transition:left .6s, top .6s } .pkey:empty { display:none }
153
162
  #present.pin { height:clamp(240px,74vh,1000px) } #present.pin #pcam, #present.pin #pcap, #present.pin #pbadge { display:none } #present:has(.pwin.web) #pcam { width:110px; height:82px }
154
163
  body.narrow #present.pin { height:clamp(220px,70vh,900px) } #present.pin:has(.pcard), body.narrow #present.pin:has(.pcard) { height:clamp(190px,34vh,300px) } /* nothing to read there but a title and a link */
155
164
  .ptab { display:flex; align-items:center; gap:10px; background:#16161e; padding:5px 12px; border-bottom:1px solid #2a2b3d; font:11.5px -apple-system,system-ui,sans-serif } .ptab span { background:#1a1b26; padding:3px 10px; border-radius:6px 6px 0 0; color:#e9eaf0 } .ptab em { color:#6b7089; font-style:normal }
@@ -157,6 +166,32 @@
157
166
  .tl { white-space:pre-wrap; word-break:break-word } .tl .ps { color:#7ee787 } .tl.cmd { color:#e6edf3 } .tl.tool { color:#8b95b0 } .dotg { color:#58a6ff }
158
167
  .tl.new { animation:lineIn .28s ease-out } @keyframes lineIn { from { opacity:0; transform:translateY(5px) } }
159
168
  .cursor { display:inline-block; width:7px; height:14px; background:#c9d1d9; vertical-align:-2px; animation:blinkc 1s steps(1) infinite } @keyframes blinkc { 50% { opacity:0 } }
169
+ /* the other screens an agent shares: its task board, a test run, a web search or a page it read (reader mode), the plan it presents, a diff with its line numbers, a background command streaming in */
170
+ .pwin.board #pbody, .pwin.test #pbody { overflow-y:auto; scrollbar-width:thin; overscroll-behavior:contain; padding-bottom:16px }
171
+ .pbd { font:13.5px/1.45 -apple-system,system-ui,sans-serif; max-width:780px } .pbd h4 { display:flex; align-items:center; gap:10px; margin:2px 0 8px; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:#8b95b0 } .pbd h4 b { font-size:15px; letter-spacing:0; color:#e6edf3 }
172
+ .pbar2 { flex:1; display:flex; height:6px; min-width:60px; border-radius:99px; overflow:hidden; background:#262a3a } .pbar2 i { display:block; height:100%; transition:width .6s ease-out } .pbar2 .ok { background:#3fb950 } .pbar2 .bad { background:#f85149 } .pbar2 .skip { background:#6b7089 }
173
+ .bt { display:flex; gap:10px; padding:5px 10px; margin:1px 0; border-radius:8px; color:#c3c6d4 } .bt > i { flex:none; width:16px; text-align:center; font-style:normal; color:#6b7089 } .bt em { display:block; font-style:normal; font-size:12px; color:#ffd24a }
174
+ .bt.completed { color:#6b7089 } .bt.completed span { text-decoration:line-through; text-decoration-color:rgba(139,149,176,.6) } .bt.completed > i { color:#3fb950 } .bt.in_progress { color:#fff; background:rgba(240,160,32,.13); box-shadow:inset 3px 0 0 #f0a020 } .bt.in_progress > i { color:#f0a020 }
175
+ .bt.just { animation:tdone 1s ease-out var(--jd, 0s) both } .bt.just > i { animation:tpop .55s ease-out var(--jd, 0s) both } @keyframes tdone { 0% { background:rgba(63,185,80,.4) } } @keyframes tpop { 0% { transform:scale(.2) } 60% { transform:scale(1.7) } }
176
+ .ptst { margin-top:10px; padding:12px 14px; border-radius:10px; background:#141824; border:1px solid #262a3a; font:13px -apple-system,system-ui,sans-serif; max-width:780px } .ptst.ok { border-color:rgba(63,185,80,.55) } .ptst.bad { border-color:rgba(248,81,73,.6) }
177
+ .ptst.flash.ok { animation:tflashok 1.1s ease-out } .ptst.flash.bad { animation:tflashbad 1.1s ease-out } @keyframes tflashok { 0% { background:rgba(63,185,80,.45) } } @keyframes tflashbad { 0% { background:rgba(248,81,73,.45) } }
178
+ .ptr { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 18px; margin-bottom:10px } .prun { align-self:center; padding:1px 8px; border-radius:6px; background:#262a3a; color:#9aa0b4; font:11.5px ui-monospace,Menlo,monospace } .pc { color:#9aa0b4; white-space:nowrap } .pc b { font-size:26px; line-height:1; margin-right:3px } .pc.ok b { color:#3fb950 } .pc.bad b { color:#f85149 } .pc.zero b { color:#4b5069 } .pc.skip b { color:#8b95b0 }
179
+ .ptst .pbar2 { height:8px } .pfail { margin:10px 0 0; padding:0; list-style:none; font:12px/1.5 ui-monospace,Menlo,monospace; color:#ff7b72 } .pfail li { white-space:nowrap; overflow:hidden; text-overflow:ellipsis } .pfail .dim { color:#6b7089 }
180
+ .pwin.search, .pwin.fetch, .pwin.plan { flex-basis:1000px } .pwin.search #pbody, .pwin.fetch #pbody, .pwin.plan #pbody { display:flex; flex-direction:column; padding:0; font:13px/1.5 -apple-system,system-ui,sans-serif }
181
+ .ppage { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; background:#fff; color:#1f2328 } .pwin.plan .ppage { background:#f7f6f2 } .psq { color:#d6dae6 } .pnn b.ok { color:#3fb950 } .pnn b.bad { color:#f85149 }
182
+ .psr { padding:10px 18px 24px } .sr { padding:5px 0; max-width:660px } .sr em { display:block; font-style:normal; font-size:11.5px; color:#1a7f37; white-space:nowrap; overflow:hidden; text-overflow:ellipsis } .sr b { display:block; font-weight:500; font-size:15px; color:#1a0dab; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
183
+ .pwait { padding:26px; text-align:center; color:#57606a } .pwait .spin { border-color:#57606a; border-top-color:transparent }
184
+ .pread, .pdoc { max-width:720px; margin:0 auto; padding:14px 22px 40px; font:14px/1.6 Georgia,'Iowan Old Style',serif; color:#24292f; overflow-wrap:anywhere } .pdoc { font:13.5px/1.55 -apple-system,system-ui,sans-serif } .pread p, .pdoc p { margin:0 0 8px } .pread .bad { color:#cf222e; font:12.5px ui-monospace,Menlo,monospace }
185
+ .pread h3, .pread h4, .pread h5, .pdoc h3, .pdoc h4, .pdoc h5 { font-family:-apple-system,system-ui,sans-serif; margin:14px 0 6px; line-height:1.3 } .pread h3, .pdoc h3 { font-size:20px; margin-top:4px } .pread h4, .pdoc h4 { font-size:16px } .pread h5, .pdoc h5 { font-size:14px }
186
+ .pread ul, .pdoc ul { margin:0 0 8px; padding-left:20px } .pread li.sub, .pdoc li.sub { margin-left:18px } .pread code, .pdoc code { font:12.5px ui-monospace,Menlo,monospace; background:rgba(175,184,193,.25); padding:1px 4px; border-radius:4px } .pread pre, .pdoc pre { margin:0 0 8px; font:12px/1.45 ui-monospace,Menlo,monospace; background:#eceae4; padding:8px 10px; border-radius:6px; white-space:pre-wrap } .pread u, .pdoc u { color:#0969da; text-decoration:none }
187
+ .ln.dn b { width:34px; text-align:right; color:#4b5069 } .ln i { flex:none; width:8px; margin-left:-4px; font-style:normal; opacity:.85 } .ln.hunk { color:#79c0ff; background:rgba(56,139,253,.1); margin:3px 0 1px } .ptab .pmf { color:#c3c6d4; background:#262a3a; padding:1px 8px; border-radius:99px }
188
+ .tl.add { color:#7ee787 } .tl.del { color:#ff7b72 } .tl.hunk { color:#79c0ff } .tl.ok { color:#7ee787 }
189
+ #plive { flex:none; margin-left:10px; color:#ff6b62; font-weight:700; font-size:10.5px; letter-spacing:.08em; white-space:nowrap } #plive:empty { display:none } #plive b { animation:pulse 1.4s ease-in-out infinite }
190
+ .pdev { flex:none; max-height:6.4em; overflow:hidden; padding:4px 10px; background:#11131b; border-top:1px solid #232637; font:11px/1.45 ui-monospace,Menlo,monospace; color:#9aa0b4 } .pdev div { white-space:nowrap; overflow:hidden; text-overflow:ellipsis } .pdev .e { color:#ff7b72 } .pdev .w { color:#ffd24a }
191
+ .pwin.board #pbody, .pwin.test #pbody { padding-right:calc(14px + var(--camx, 0px)); padding-bottom:calc(16px + var(--camy, 0px)) } .ppage { padding-right:var(--camx, 0px) } .ppage::after { content:''; display:block; height:var(--camy, 0px) } /* room for the camera and the caption (camRoom) */
192
+ #present.has-todo.camr #pcam { right:28px } #present.has-todo.camr #pcap { right:200px } body.narrow #present.doc #pcap { right:14px }
193
+ body.narrow .pdev { display:none } body.narrow .pread h3, body.narrow .pdoc h3 { font-size:16px } body.narrow .pread h4, body.narrow .pdoc h4 { font-size:14px }
194
+ body.narrow .bt { padding:3px 8px; font-size:12.5px } body.narrow .pc b { font-size:20px } body.narrow .ptst { padding:9px 10px } body.narrow .pread, body.narrow .pdoc { padding:10px 12px 30px; font-size:12.5px } body.narrow .sr b { font-size:13px } body.narrow .psr { padding:8px 12px 20px }
160
195
  #pstat { flex:none; padding:4px 12px; background:#161925; color:#8b95b0; font:11.5px ui-monospace,Menlo,monospace; border-top:1px solid #232637; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
161
196
  #ptodo { flex:0 0 230px; margin-left:12px; align-self:flex-start; position:relative; max-height:100%; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; background:rgba(20,22,32,.92); border:1px solid #2a2d3d; border-radius:10px; padding:8px 10px; font-size:12px }
162
197
  #ptodo h5 { margin:0 0 6px; font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--dim) } .td { display:flex; gap:7px; padding:2px 0; color:#c3c6d4 } .td i { font-style:normal; flex:none } .td.completed { color:#6b7089; text-decoration:line-through } .td.completed i { color:var(--ok) } .td.in_progress { color:#fff } .td.in_progress i { color:var(--gold) }
@@ -166,10 +201,10 @@
166
201
  .ticker em { font-style:normal; color:#9aa3bd; font-size:10px } .ticker em.ok { color:#58d68d } .ticker em.bad { color:#ff7b72 }
167
202
  .status { max-width:84%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
168
203
  #pbadge { margin-left:auto; flex:none; background:rgba(240,160,32,.94); color:#201400; font-weight:600; font-size:11px; padding:1px 10px; border-radius:99px; white-space:nowrap }
169
- #present.has-todo #pcam { right:270px } #pcam { position:absolute; right:28px; bottom:22px; width:158px; height:118px; z-index:2; cursor:default; box-shadow:0 8px 24px rgba(0,0,0,.6) }
204
+ #present.has-todo #pcam { right:270px } #present.has-todo #pcap { right:442px } /* the caption ends before the camera, which the task list pushes left */ #pcam { position:absolute; right:28px; bottom:22px; width:158px; height:118px; z-index:2; cursor:default; box-shadow:0 8px 24px rgba(0,0,0,.6) }
170
205
  #pcap { display:none; position:absolute; left:24px; right:200px; bottom:20px; z-index:2; background:rgba(10,11,16,.84); backdrop-filter:blur(6px); border-radius:10px; padding:6px 12px; font-size:13px; max-height:calc(100% - 34px); overflow-y:auto; scrollbar-width:thin } #pcap:not(:empty) { display:block }
171
- body.narrow #present { height:clamp(150px,36vh,260px) } body.narrow #pcam { width:110px; height:82px } body.narrow #pcap { left:14px; right:146px; font-size:12.5px }
172
- body.narrow #ptodo { display:none } body.narrow #present.has-todo #pcam { right:28px } /* too narrow for a terminal and a task list side by side: the terminal keeps the room */
206
+ body.narrow #present { height:clamp(150px,36vh,260px) } body.narrow #pcam { display:none } body.narrow #pcap { left:14px; right:14px; font-size:12.5px } /* in a narrow sidebar the window keeps its whole width: the badge says who shares, and their tile is lit just below */
207
+ body.narrow #ptodo { display:none } body.narrow #present.has-todo #pcap { right:14px } /* too narrow for a terminal and a task list side by side: the terminal keeps the room */
173
208
  #gantt { display:none; flex:none; width:100%; background:#0f1118; border-top:1px solid var(--line); cursor:pointer }
174
209
  body.replay #gantt { display:block }
175
210
  aside { display:none; width:320px; flex:none; border-left:1px solid var(--line); background:var(--panel); flex-direction:column; min-height:0 }
@@ -305,6 +340,7 @@
305
340
  #prefs .pfoot { display:flex; justify-content:flex-end; padding:12px 10px 0; margin-top:8px; border-top:1px solid var(--line) } #prefsReset.sure { border-color:#ff7a6b; color:#ffb4a8 }
306
341
  #menuTip { position:fixed; z-index:13; max-width:260px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #menuTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #menuTip .btn { display:block; margin:8px 0 0 auto } /* once, after the menu moved */
307
342
  #rateTip, #coffeeTip, #usageTip { position:fixed; z-index:13; max-width:280px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #rateTip::before, #coffeeTip::before, #usageTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #rateTip .rtb, #coffeeTip .rtb, #usageTip .rtb { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:8px } #usageTip { max-width:360px } #rateYes, #coffeeYes, #usageYes { border-color:var(--accent) } /* once, on the third day: a star (desktop app, command line) */
343
+ #updTip { position:fixed; z-index:13; max-width:340px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #updTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #updTip .rtb { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:8px } #updCmd { display:block; margin-top:6px; padding:5px 7px; border-radius:6px; background:rgba(0,0,0,.28); font:11.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap:anywhere; user-select:all } #updGo { border-color:var(--accent) } /* a newer version, once per version (desktop app, command line, plugin) */
308
344
  a.artist { color:#f5c04a; text-underline-offset:2px } #menuShop:empty { display:none } #menuShop { margin:2px 0 8px; font-size:12px; line-height:1.5; color:#c3c6d4 } /* the Halloween pack, for those who do not have it */
309
345
  #recap { position:fixed; inset:0; z-index:15; background:rgba(5,6,12,.88); display:none; overflow:auto; padding:28px 16px } #recap.on { display:block }
310
346
  #recap .box { max-width:860px; margin:0 auto; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:22px 26px }
@@ -316,6 +352,7 @@
316
352
  .kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px } .kpi { background:var(--bg); border-radius:10px; padding:10px 12px } .kpi b { display:block; font-size:22px } .kpi span { color:var(--dim); font-size:11.5px }
317
353
  .coffee { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:20px; padding:12px 14px; background:var(--bg); border:1px dashed #4a4f66; border-radius:10px; font-size:13px; color:#c3c6d4 }
318
354
  #recap table { width:100%; border-collapse:collapse; font-size:12.5px } #recap td, #recap th { padding:4px 8px; border-bottom:1px solid var(--line); text-align:left } #recap th { color:var(--dim); font-weight:500 } #recap .f { font:12px ui-monospace,Menlo,monospace; word-break:break-all }
355
+ @media (max-width:600px) { #recap .box { padding:18px 14px } #recap table { display:block; overflow-x:auto; max-width:100% } } /* a narrow window: a wide table scrolls sideways instead of being cut */
319
356
 
320
357
  /* ---------- tree ---------- */
321
358
  #tree ul { list-style:none; margin:0; padding-left:26px; position:relative } #tree > ul { padding-left:0 } #tree li { position:relative; padding:3px 0 }
@@ -355,6 +392,7 @@
355
392
  <div class="hint" id="trHint" style="display:none"></div>
356
393
  <h4 data-fr="Son" data-en="Sound">Son</h4>
357
394
  <button class="mi" data-t="voice"><span data-fr="Voix des agents" data-en="Agent voices">Voix des agents</span><i class="sw"></i></button>
395
+ <div class="box" id="voiceVolBox" style="display:none"><input id="voiceVol" type="range" min="0.05" max="1" step="0.05" style="width:100%" aria-label="Voice volume"></div>
358
396
  <div class="box" id="vstyleBox"><label class="lbl" for="vstyle" data-fr="Style des voix" data-en="Voice style">Style des voix</label><select id="vstyle"></select><div class="hint" id="vstyleTip" style="padding:6px 0 0;display:none" data-fr="Pour la meilleure expérience, choisissez les voix naturelles." data-en="For the best experience, pick the natural voices.">Pour la meilleure expérience, choisissez les voix naturelles.</div></div>
359
397
  <div class="box" id="kokoroBox" style="display:none"><button class="btn" id="kokoroInstall" style="width:100%"></button><div class="hint" id="kokoroHint" style="padding:2px 0 6px"></div></div>
360
398
  <h4 data-fr="Personnages" data-en="Characters">Personnages</h4>
@@ -382,6 +420,7 @@
382
420
  <div id="usageTip" role="dialog" aria-live="polite" style="display:none"><span id="usageTipT"></span><div class="rtb"><button class="btn" id="usageRead"></button><button class="btn" id="usageNo"></button><button class="btn" id="usageYes"></button></div></div>
383
421
  <div id="coffeeTip" role="status" style="display:none"><span id="coffeeTipT"></span><div class="rtb"><button class="btn" id="coffeeNo"></button><button class="btn" id="coffeeYes"></button></div></div>
384
422
  <div id="rateTip" role="status" style="display:none"><span id="rateTipT"></span><div class="rtb"><button class="btn" id="rateNo"></button><button class="btn" id="rateLater"></button><button class="btn" id="rateYes"></button></div></div>
423
+ <div id="updTip" role="status" style="display:none"><span id="updTipT"></span><code id="updCmd" style="display:none"></code><div class="rtb"><button class="btn" id="updNotes"></button><button class="btn" id="updLater"></button><button class="btn" id="updGo"></button></div></div>
385
424
  <div id="prefs" role="dialog" aria-modal="true" aria-labelledby="prefsT"><div class="pbox">
386
425
  <div class="phead"><h2 id="prefsT" data-fr="Réglages" data-en="Settings">Réglages</h2><button class="btn" id="prefsX" data-fr="Fermer" data-en="Close">Fermer</button></div>
387
426
  <div class="pcols"><div class="pcol">
@@ -390,7 +429,9 @@
390
429
  <div class="box" id="officeBox" style="display:none"><input id="officeVol" type="range" min="0.1" max="1" step="0.05" style="width:100%" aria-label="Ambience volume"></div>
391
430
  <button class="mi" data-t="music"><span data-fr="Musique d’ambiance (radio FIP)" data-en="Office music (FIP radio)">Musique d’ambiance (radio FIP)</span><i class="sw"></i></button>
392
431
  <div class="box" id="musicBox" style="display:none"><select id="station"></select><input id="musicVol" type="range" min="0" max="1" step="0.05" style="width:100%" aria-label="Music volume"></div>
393
- <button class="mi" data-t="shareUsage" id="mShare" style="display:none"><span data-fr="Aider à compter les utilisateurs (1 requête par semaine)" data-en="Help count users (1 request a week)">Aider à compter les utilisateurs (1 requête par semaine)</span><i class="sw"></i></button> <button class="mi" data-t="notify"><span data-fr="Me prévenir quand les agents ont fini" data-en="Notify me when agents finish">Me prévenir quand les agents ont fini</span><i class="sw"></i></button>
432
+ <button class="mi" data-t="shareUsage" id="mShare" style="display:none"><span data-fr="Aider à compter les utilisateurs (1 requête par semaine)" data-en="Help count users (1 request a week)">Aider à compter les utilisateurs (1 requête par semaine)</span><i class="sw"></i></button>
433
+ <button class="mi" data-t="updateNotice" id="mUpd" style="display:none"><span data-fr="Me dire quand une nouvelle version sort (1 requête par jour)" data-en="Tell me when a new version is out (1 request a day)">Me dire quand une nouvelle version sort (1 requête par jour)</span><i class="sw"></i></button>
434
+ <button class="mi" data-t="notify"><span data-fr="Me prévenir quand les agents ont fini" data-en="Notify me when agents finish">Me prévenir quand les agents ont fini</span><i class="sw"></i></button>
394
435
  <h4 data-fr="Personnages" data-en="Characters">Personnages</h4>
395
436
  <button class="mi" data-t="customLaptop"><span data-fr="Ordinateur devant vos personnages" data-en="Laptop in front of your own characters">Ordinateur devant vos personnages</span><i class="sw"></i></button>
396
437
  <button class="mi" data-t="ownNames"><span data-fr="Garder les noms de mes agents" data-en="Keep my agents’ own names">Garder les noms de mes agents</span><i class="sw"></i></button>
@@ -415,18 +456,18 @@
415
456
  <main>
416
457
  <nav id="roster" aria-label="Agents"></nav>
417
458
  <section id="center">
418
- <div id="present"><div class="pwin term"><div class="pbar"><i class="r"></i><i class="y"></i><i class="g"></i><span id="ptitle"></span><span id="pbadge"></span></div><div id="pbody"></div><div id="pstat"></div></div><div id="ptodo" style="display:none"></div><div id="pcap"></div><div id="pcam" class="tile working"></div></div>
459
+ <div id="present"><div class="pwin term"><div class="pbar"><i class="r"></i><i class="y"></i><i class="g"></i><span id="ptitle"></span><span id="plive"></span><span id="pbadge"></span></div><div id="pbody"></div><div id="pstat"></div></div><div id="ptodo" style="display:none"></div><div id="pcap"></div><div id="pcam" class="tile working"></div></div>
419
460
  <div id="stage"></div><div id="tree"></div><div id="boardv"></div>
420
461
  <div id="reactBar" aria-label="Reactions"><button data-e="👍">👍</button><button data-e="👏">👏</button><button data-e="☕">☕</button><button data-e="🔥">🔥</button><button data-e="🙌">🙌</button></div>
421
462
  <div id="files"></div>
422
463
  <div id="hl"></div>
423
464
  <canvas id="gantt" height="90"></canvas>
424
465
  <div id="toasts" role="status" aria-live="polite"><div class="toast offer" id="vOffer" style="display:none"><span id="vOfferT"></span><button class="btn" id="vOfferB"></button><button class="ic" id="vOfferX" aria-label="Close">✕</button></div><div class="toast offer" id="packNote" style="display:none"><img id="packNoteI" src="pack-halloween.jpg" alt="" width="48" height="36"><span id="packNoteT"></span><button class="btn" id="packNoteB"></button><button class="ic" id="packNoteX" aria-label="Close">✕</button></div><div class="toast offer" id="trNote" style="display:none"><span id="trNoteT"></span><button class="btn" id="trNoteOk"></button><button class="btn" id="trNoteOff"></button></div></div><div id="visit" role="status" aria-live="polite"></div><div id="askc" role="region" aria-live="polite"></div>
425
- <div id="empty"><h2 id="eT"></h2><p id="eP"></p><button class="cta" id="eDemo"></button></div>
466
+ <div id="empty"><h2 id="eT"></h2><p id="eP"></p><div id="eMiss"></div><button class="cta" id="eDemo"></button></div>
426
467
  <div id="gate"><button class="cta" id="gB"></button></div>
427
468
  <div id="detail"><div class="hd"><b id="dname"></b><button class="ic" id="dclose">✕</button></div><div id="dbody"></div></div>
428
469
  </section>
429
- <aside><h2 id="logH">Transcript</h2><input id="logQ" type="search" placeholder="Search…" aria-label="Search the transcript" style="margin:8px 10px;width:calc(100% - 20px)"><div id="log"></div></aside>
470
+ <aside><h2 id="logH" data-fr="Transcription" data-en="Transcript">Transcript</h2><input id="logQ" type="search" placeholder="Search…" aria-label="Search the transcript" style="margin:8px 10px;width:calc(100% - 20px)"><div id="log"></div></aside>
430
471
  </main>
431
472
  <footer>
432
473
  <input id="seek" type="range" min="0" max="0" value="0"><span class="dim" id="pos">0 / 0</span>
@@ -463,7 +504,7 @@ const Q = new URLSearchParams(location.search);
463
504
  const EMBED = Q.get('embed') === '1' || window.parent !== window;
464
505
  const APP = window.AS_APP && typeof window.AS_APP === 'object' && typeof window.AS_APP.rate === 'string' ? window.AS_APP : { kind: '', rate: 'https://github.com/Atoll92/agent-standup' }; // where this page runs (appKind in server.js)
465
506
 
466
- let prefs = { lang: 'en', voice: true, roster: true, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'kokoro', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true, visits: true, askCard: false, followTab: true, files: true, callTr: true };
507
+ let prefs = { lang: 'en', voice: true, roster: true, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'kokoro', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true, visits: true, askCard: false, followTab: true, files: true, callTr: true, voiceVol: 1 };
467
508
  const PREF_DEFAULTS = { ...prefs }; // for ⚙ → All settings → Reset to defaults
468
509
  { let loc = {}; try { loc = JSON.parse(localStorage.getItem('cc.prefs') || '{}') || {}; } catch {} // the settings file (shared by every window) and this origin's copy: the more recent one wins
469
510
  const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; Object.assign(prefs, (sv._t || 0) > (loc._t || 0) ? sv : loc);
@@ -478,8 +519,10 @@ if (prefs.vstyle === 'sims' && prefs.vstyleChosen) prefs.vstyle = 'animal';
478
519
  if (prefs.vstyle !== 'animal' || !prefs.vstyleChosen) prefs.vstyle = 'kokoro';
479
520
  if (!prefs.notifyChosen) prefs.notify = true; // “tell me when the agents are done” is on unless the person chose otherwise
480
521
  let prefsTimer = null;
481
- let shareWas = prefs.shareUsage; // the usage answer as last saved: when it changes, savePrefs dates it, and the server keeps the newest (another page may write older settings)
482
- const savePrefs = () => { prefs._t = Date.now(); if (prefs.shareUsage !== shareWas) { shareWas = prefs.shareUsage; prefs.shareUsageT = Date.now(); } try { localStorage.setItem('cc.prefs', JSON.stringify(prefs)); } catch {} clearTimeout(prefsTimer); prefsTimer = setTimeout(() => { fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(prefs) }).catch(() => {}); }, 400); };
522
+ let shareWas = prefs.shareUsage, updWas = prefs.updateNotice; // the usage answer as last saved: when it changes, savePrefs dates it, and the server keeps the newest (another page may write older settings)
523
+ let langKeep = null; // ?lang=xx shows the page in that language for this visit only: the saved language stays the one the person chose
524
+ const prefsOut = () => JSON.stringify(langKeep == null ? prefs : { ...prefs, lang: langKeep });
525
+ const savePrefs = () => { prefs._t = Date.now(); if (prefs.shareUsage !== shareWas) { shareWas = prefs.shareUsage; prefs.shareUsageT = Date.now(); } if (prefs.updateNotice !== updWas) { updWas = prefs.updateNotice; prefs.updateNoticeT = Date.now(); } try { localStorage.setItem('cc.prefs', prefsOut()); } catch {} clearTimeout(prefsTimer); prefsTimer = setTimeout(() => { fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: prefsOut() }).catch(() => {}); }, 400); };
483
526
  // Languages: French and English live in the code as pairs L(french, english); every other language is a catalogue public/locales/<code>.json mapping the English text to its translation.
484
527
  // A missing string falls back to English, so a half-translated language still works. See public/locales/README.md to add one.
485
528
  const LANGS = [['en', 'English', 'en'], ['fr', 'Français', 'fr'], ['zh-TW', '繁體中文', 'zh-Hant-TW'], ['zh-CN', '简体中文', 'zh-Hans-CN'], ['es', 'Español', 'es'], ['de', 'Deutsch', 'de'], ['da', 'Dansk', 'da'], ['pt-BR', 'Português (Brasil)', 'pt-BR'], ['ja', '日本語', 'ja'], ['ko', '한국어', 'ko']];
@@ -512,8 +555,8 @@ const tr = (en) => (prefs.lang === 'en' || prefs.lang === 'fr' ? en : LOC[en] ||
512
555
  const L = (fr, en) => (FR() ? fr : tr(en));
513
556
  async function loadLocale(code) { LOC = {}; if (code === 'en' || code === 'fr') return; try { const r = await fetch('/locales/' + encodeURIComponent(code) + '.json'); if (r.ok) LOC = await r.json(); } catch {} }
514
557
  async function setLang(code, save) {
515
- if (!LANGS.some((l) => l[0] === code)) code = 'en'; prefs.lang = code; await loadLocale(code); if (save) { prefs.langChosen = true; savePrefs(); }
516
- if (TRL()) fetch('/api/warm?lang=' + CALL()).catch(() => {}); AUD.stopAll(); synth && synth.cancel(); applyLang(); if (TRL()) prefetchTr(S.idx); kokoroUI(); voiceOffer(); callNote(); /* its texts, and the offer to add the voices of this language */
558
+ if (!LANGS.some((l) => l[0] === code)) code = 'en'; prefs.lang = code; await loadLocale(code); if (save) { langKeep = null; prefs.langChosen = true; savePrefs(); }
559
+ if (TRL()) fetch('/api/warm?lang=' + CALL()).catch(() => {}); AUD.stopAll(); synth && synth.cancel(); applyLang(); if (TRL()) prefetchTr(S.idx); kokoroUI(); voiceOffer(); callNote(); paintMissing(); /* its texts, and the offer to add the voices of this language */
517
560
  }
518
561
 
519
562
  // =====================================================================
@@ -660,7 +703,7 @@ function packNote() { // the Halloween pack, to someone without it, twice a se
660
703
  : dd >= 19 ? L('Halloween approche : déguisez vos agents en citrouille, fantôme, sorcière ou squelette, dessinés à la main par Fabien Coupas.', 'Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.') : L('Pour Halloween, vous êtes le vampire. Le reste de l’équipe est dans le pack Halloween.', 'This Halloween, you are the vampire. The rest of the cast is in the Halloween pack.');
661
704
  $('#packNoteB').textContent = L('Voir le pack', 'See the pack') + ' · ' + price;
662
705
  }
663
- function persona(a) { const p = persona0(a); p.custom = customFor(a.id); return p; }
706
+ function persona(a) { const p = persona0(a); p.custom = customFor(p.twin ? 'main' : a.id); return p; } // a fork wears the lead's own picture too
664
707
  const subName = (a, h) => (a.own && prefs.ownNames ? (nameBook[a.id] = a.own) : a.given || uniqueName(a.id, h)); // own: the name the person gave this agent (see ownName in server.js); otherwise a first name from the list. a.own is tested first: the landing page reuses this section and has no settings
665
708
  function renameAll() { // ⚙ → own names on or off: every sub-agent is named again, in the order it arrived
666
709
  for (const k in nameBook) delete nameBook[k]; for (const p of Object.values(S.agents)) if (p.id !== 'main' && p.id !== 'user') p.name = subName(p, hash(p.id));
@@ -670,6 +713,7 @@ function persona0(a) {
670
713
  const h = hash(a.id), base = { ...a, given: 'given' in a ? a.given : a.name };
671
714
  if (a.id === 'main') return { ...base, name: a.name || 'Margot', role: L('Chef', 'Lead'), shirt: '#e8845f', shape: 0, acc: 1, eye: 0, glasses: false, scene: 6, prop: 1, acc2: '#f5c04a', lead: true, vi: 0, gid: 'main' };
672
715
  if (a.id === 'user') return { ...base, name: L('Vous', 'You'), role: L('Humain', 'Human'), shirt: '#8a94c9', shape: 1, acc: 2, eye: 1, glasses: false, scene: 7, prop: 1, acc2: '#ff7a6b', vi: 3, gid: 'user' };
716
+ if (/^fork$/i.test(a.type || '')) return { ...base, name: subName(base, h), roleEn: a.roleEn || a.role, role: (FR() && a.roleFr) || a.roleEn || a.role, shirt: '#e8845f', shape: 0, acc: 1, eye: 0, glasses: true, scene: (h >>> 18) % 6, prop: 1, acc2: '#f5c04a', vi: 0, twin: true, gid: h.toString(36) }; // a fork (Claude Code's subagent_type "fork", on by default since 2.1.302) starts as a copy of the lead: the lead's face, shirt and voice, glasses and a room of its own to tell them apart
673
717
  return { ...base, name: subName(base, h), roleEn: a.roleEn || a.role, role: (FR() && a.roleFr) || a.roleEn || a.role, shirt: PAL[(h >>> 6) % 8], shape: (h >>> 3) % 5, acc: (h >>> 9) % 6, eye: (h >>> 12) % 3, glasses: ((h >>> 15) % 4) === 0,
674
718
  scene: (h >>> 18) % 6, prop: (h >>> 21) % 3, acc2: PAL[(h >>> 24) % 8], vi: h >>> 4, gid: h.toString(36) };
675
719
  }
@@ -803,6 +847,7 @@ const caughtUp = () => !S.live || lagMs() < 6000;
803
847
  const nearLive = () => !S.live || lagMs() < 30000; // an answer to what was just said (a word after an order, a thank-you after a report) still fits here: reading the line took longer than 6 s and the session went on meanwhile
804
848
  const spd = () => (S.live ? 1.12 * lagFactor() : +$('#speed').value) * (S.boost || 1);
805
849
  const nameOf = (id) => (S.agents[id] || {}).name || id;
850
+ const twinOf = (a) => (/^fork$/i.test(a.type || '') && !('given' in a) && !(a.own && prefs.ownNames) ? { ...a, given: nameOf('main') + ' ' + (2 + Object.values(S.agents).filter((p) => p.twin).length) } : a); // a fork is named after the lead: Margot 2, Margot 3…
806
851
 
807
852
  // ---------- text prep ----------
808
853
  const plain = (t) => String(t).replace(/```[\s\S]*?```/g, ' ').replace(/`([^`]*)`/g, '$1').replace(/https?:\/\/\S+/g, 'link').replace(/[#*_>|~\[\]]/g, ' ').replace(/\s+/g, ' ').trim();
@@ -914,7 +959,7 @@ const AUD = {
914
959
  const src = c.createBufferSource(); src.buffer = buf; src.loop = true; const lp = c.createBiquadFilter(); lp.type = 'lowpass'; lp.frequency.value = 500;
915
960
  const g = c.createGain(); g.gain.value = 0.3; src.connect(lp).connect(g).connect(this.sfx); src.start(); this.apply(); OFFICE.start();
916
961
  },
917
- apply() { if (!this.ctx) return; this.sfx.gain.value = prefs.office && !this.off() ? 1 : 0; this.voice.gain.value = prefs.voice && !this.off() ? 1 : 0; this.applyMusic(); RADIO.sync(); },
962
+ apply() { if (!this.ctx) return; this.sfx.gain.value = prefs.office && !this.off() ? 1 : 0; this.voice.gain.value = prefs.voice && !this.off() ? (prefs.voiceVol ?? 1) : 0; this.applyMusic(); RADIO.sync(); },
918
963
  // Music fades down quickly when an agent starts talking and comes back slowly once the room is quiet.
919
964
  applyMusic() { if (!this.ctx) return; this.amb.gain.setTargetAtTime((this.ducked ? 0.35 : 1) * (prefs.officeVol ?? 0.8), this.ctx.currentTime, 0.25); const v = prefs.music && !this.off() ? (prefs.musicVol ?? 0.35) * (this.ducked ? 0.16 : 1) : 0; this.music.gain.setTargetAtTime(v, this.ctx.currentTime, this.ducked ? 0.12 : 0.7); },
920
965
  blip(f) { if (!this.ctx || this.off()) return; const c = this.ctx, t = c.currentTime, o = c.createOscillator(), g = c.createGain(); o.type = 'sine'; o.frequency.setValueAtTime(f, t); o.frequency.exponentialRampToValueAtTime(f * 1.5, t + 0.1); g.gain.setValueAtTime(0.0001, t); g.gain.exponentialRampToValueAtTime(0.12, t + 0.015); g.gain.exponentialRampToValueAtTime(0.0001, t + 0.22); o.connect(g).connect(c.destination); o.start(t); o.stop(t + 0.25); },
@@ -1091,7 +1136,7 @@ function warmTTS(i) { // called by run() before each line (i is that line) and
1091
1136
  const e = S.events[k]; if (quiet(e)) { k++; continue; }
1092
1137
  if (S.live && len - k > 300) break; // a backlog that run() skips
1093
1138
  const group = [e]; let j = k + 1;
1094
- if (e.kind === 'order') { while (j < Math.min(len, k + 40) && group.length < 8) { const e2 = S.events[j]; if (e2.kind === 'usage' || e2.kind === 'compact') j++; else if (e2.kind === 'order' && e2.agent === e.agent) { group.push(e2); j++; } else break; } }
1139
+ if (e.kind === 'order') { while (j < Math.min(len, k + 40) && group.length < 8) { const e2 = S.events[j]; if (e2.kind === 'usage' || e2.kind === 'compact' || e2.kind === 'tasks') j++; else if (e2.kind === 'order' && e2.agent === e.agent) { group.push(e2); j++; } else break; } }
1095
1140
  else if (isSub(e.agent)) { while (j < Math.min(len, k + 28) && group.length < 3) { const e2 = S.events[j]; if (quiet(e2)) j++; else if (e2.kind !== 'order' && isSub(e2.agent) && !group.some((g) => g.agent === e2.agent)) { group.push(e2); j++; } else break; } }
1096
1141
  const pl = paceAt(k), many = e.kind === 'order' && group.length > 1, rate = TTS.rateAt(many || !S.live ? k : j - 1, pl.boost);
1097
1142
  for (const g of many ? [e] : group) { // orders in a row: only the first is read out
@@ -1193,7 +1238,7 @@ function speakBrowser(text, p, token, lo = CALL()) { // the browser's own voic
1193
1238
  if (i >= parts.length || done || token !== S.token) return fin(true);
1194
1239
  if (t0 && said >= 20) { const el = performance.now() - t0; captionRun(p.id, text, el * all / said, el); } // the length of the audio is not known in advance here: the subtitles are set again on the pace the voice really has, after each sentence
1195
1240
  said += parts[i].length; const part = parts[i++].trim(); if (!part) return next();
1196
- const u = new SpeechSynthesisUtterance(part); u.lang = lo === 'en' ? 'en-US' : homeOf(lo).replace('_', '-'); u.voice = voice; u.pitch = prefs.vstyle !== 'cartoon' ? 0.95 + ((p.vi >>> 5) % 5) * 0.03 : p.id === 'main' ? 0.8 : [1.5, 0.6, 1.2, 1.7, 0.9, 0.5, 1.35][(p.vi >>> 3) % 7]; u.rate = Math.min(1.7, 0.97 * spd());
1241
+ const u = new SpeechSynthesisUtterance(part); u.lang = lo === 'en' ? 'en-US' : homeOf(lo).replace('_', '-'); u.voice = voice; u.pitch = prefs.vstyle !== 'cartoon' ? 0.95 + ((p.vi >>> 5) % 5) * 0.03 : p.id === 'main' ? 0.8 : [1.5, 0.6, 1.2, 1.7, 0.9, 0.5, 1.35][(p.vi >>> 3) % 7]; u.rate = Math.min(1.7, 0.97 * spd()); u.volume = Math.max(0, Math.min(1, prefs.voiceVol ?? 1));
1197
1242
  u.onstart = () => { started = true; if (!t0) { t0 = performance.now(); captionRun(p.id, text, estMs(text)); } }; u.onend = () => setTimeout(next, 120); u.onerror = () => fin(started); synth.speak(u);
1198
1243
  };
1199
1244
  next();
@@ -1303,7 +1348,7 @@ function renderLog(full) {
1303
1348
  if (full || S.logTo < from || S.logTo > S.events.length) { log.innerHTML = ''; S.logTo = from; }
1304
1349
  const html = [];
1305
1350
  for (let i = S.logTo; i < S.events.length; i++) {
1306
- if (S.events[i].kind === 'results' || S.events[i].kind === 'usage' || S.events[i].kind === 'finish' || S.events[i].kind === 'compact') continue;
1351
+ if (S.events[i].kind === 'results' || S.events[i].kind === 'usage' || S.events[i].kind === 'finish' || S.events[i].kind === 'compact' || S.events[i].kind === 'tasks') continue;
1307
1352
  html.push(logRow(i));
1308
1353
  }
1309
1354
  log.insertAdjacentHTML('beforeend', html.join('')); S.logTo = S.events.length;
@@ -1332,7 +1377,7 @@ const applyStatus = (ev) => {
1332
1377
  };
1333
1378
  function recomputeStatus(upTo) {
1334
1379
  S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = ''; S.arts = new Map(); S.artCalls = new Map();
1335
- S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.lastTool = {}; S.mainBusyAt = 0; S.turnOver = false; S.th = {}; S.ctx = {}; S.model = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.recomputing = true; document.querySelectorAll('.tile').forEach((t) => { clearTimeout(t._byeT); t.classList.remove('bye'); }); hidePresent();
1380
+ S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.lastTool = {}; S.mainBusyAt = 0; S.turnOver = false; S.th = {}; S.ctx = {}; S.model = {}; S.effort = {}; S.adv = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.recomputing = true; document.querySelectorAll('.tile').forEach((t) => { clearTimeout(t._byeT); t.classList.remove('bye'); }); hidePresent();
1336
1381
  S.status = {}; S.tc = {}; S.doneAt = {}; S.gone.clear(); S.leaving.clear(); document.querySelectorAll('.tile.vanishing').forEach((t) => t.classList.remove('vanishing')); const doneIdx = {}; document.querySelectorAll('.ticker').forEach((x) => { x.classList.remove('on'); x.innerHTML = ''; });
1337
1382
  for (let i = 0; i < upTo; i++) {
1338
1383
  const e = S.events[i]; applyStatus(e); tally(e); if (e.kind === 'tools') S.tc[e.agent] = (S.tc[e.agent] || 0) + e.tools.length;
@@ -1351,7 +1396,7 @@ function syncUI() {
1351
1396
 
1352
1397
  // ---------- tool ticker, shared screen, flying messages ----------
1353
1398
  // ---------- what each agent is doing: tool calls with their real outputs ----------
1354
- S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.ctx = {}; S.model = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.present = null; S.camFor = null; let presentTimer = null;
1399
+ S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.ctx = {}; S.model = {}; S.effort = {}; S.adv = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.present = null; S.camFor = null; let presentTimer = null;
1355
1400
  S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = ''; S.fgone = new Set(); S.fmade = new Map(); S.arts = new Map(); S.artCalls = new Map(); S.artOk = new Map(); S.artPin = null; S.artWhole = null; S.wholeSeen = new Set(); // files: path → the Write call that created it, in the order they were written · cands: the documents the commands name (see candFile) · turnN: how many orders you gave so far · turnSaid: what you and the lead said in this turn · fgone: the files found missing on a click · fmade: what the server answered about a document a command names
1356
1401
  const later = (k, fn, ms = 160) => { later.p = later.p || {}; if (later.p[k]) return; later.p[k] = setTimeout(() => { later.p[k] = 0; fn(); }, ms); }; // coalesce bursts of repaints
1357
1402
  const fmtTok = (n) => (n < 1000 ? String(n) : n < 1e6 ? (n / 1000).toFixed(n < 1e4 ? 1 : 0) + 'k' : (n / 1e6).toFixed(n < 1e7 ? 2 : 1) + 'M');
@@ -1432,9 +1477,10 @@ document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && BT.el) h
1432
1477
  function tally(ev) { // numbers that pile up over a session: token usage, errors, last sign of life, the files it created
1433
1478
  noteFiles(ev);
1434
1479
  if (ev.kind === 'compact') { S.compacts[ev.agent] = (S.compacts[ev.agent] || 0) + 1; delete S.ctxWarned[ev.agent]; }
1480
+ if (ev.kind === 'tasks') applyTasks(ev);
1435
1481
  noteCalls(ev); if (wasteStep(S.wst, ev)) later('badges', renderBadges, 300);
1436
1482
  const det = loopStep(S.rep, ev); if (det) { S.loops[ev.agent] = det; later('badges', renderBadges, 300); } else if (S.loops[ev.agent] && (ev.kind === 'results' ? (S.loops[ev.agent].kind === 'errors' && ev.items.every((it) => !it.err)) : (ev.kind === 'tools' && S.rep[ev.agent].n < 2))) { delete S.loops[ev.agent]; later('badges', renderBadges, 300); }
1437
- if (ev.kind === 'usage') { const c = ev.u.i + ev.u.r + ev.u.w; if (c > 0 && ev.model !== '<synthetic>') { S.ctx[ev.agent] = c; S.model[ev.agent] = ev.model; if (ev.cw) S.cw[ev.agent] = ev.cw; } const u = (S.usage[ev.agent] = S.usage[ev.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += ev.u.i; u.o += ev.u.o; u.r += ev.u.r; u.w += ev.u.w; later('tok', renderTokens, 300); } // which also redraws the context chips. Asking for those first, under the same name, left this one unasked: the counts on the tiles and in the header stood still during a live call
1483
+ if (ev.kind === 'usage') { const c = ev.u.i + ev.u.r + ev.u.w; if (c > 0 && ev.model !== '<synthetic>') { S.ctx[ev.agent] = c; S.model[ev.agent] = ev.model; if (ev.cw) S.cw[ev.agent] = ev.cw; if (ev.ef) S.effort[ev.agent] = ev.ef; if (ev.adv) S.adv[ev.agent] = ev.adv; } const u = (S.usage[ev.agent] = S.usage[ev.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += ev.u.i; u.o += ev.u.o; u.r += ev.u.r; u.w += ev.u.w; later('tok', renderTokens, 300); } // which also redraws the context chips. Asking for those first, under the same name, left this one unasked: the counts on the tiles and in the header stood still during a live call
1438
1484
  else if (ev.kind === 'results') ev.items.forEach((it) => { if (it.err) { S.errs[ev.agent] = (S.errs[ev.agent] || 0) + 1; later('badges', renderBadges, 300); oops(ev.agent); noteTrouble(ev.agent, false); } else noteTrouble(ev.agent, true); });
1439
1485
  else if (ev.kind === 'tools' || ev.kind === 'say') S.lastAct[ev.agent] = ev.ts;
1440
1486
  if (ev.th) S.th[ev.agent] = { text: ev.th, ts: ev.ts }; else if (ev.kind === 'user') delete S.th.main; // your order starts a new chain of thought: what the lead thought before is no longer what it is on
@@ -1453,8 +1499,8 @@ function renderTokens() {
1453
1499
  renderCtx(); const mix = mixedModels();
1454
1500
  const all = { i: 0, o: 0, r: 0, w: 0 }; for (const id in S.usage) for (const k in all) all[k] += S.usage[id][k];
1455
1501
  const b = $('#tok'), tot = tokTotal(all); b.style.display = tot ? '' : 'none';
1456
- if (tot) { b.textContent = `⚡ ${fmtTok(tot)} ${L('jetons', 'tokens')}`; b.title = tokTip(all) + '\n' + Object.keys(S.usage).filter((id) => S.agents[id] && tokTotal(S.usage[id])).sort((x, y) => tokTotal(S.usage[y]) - tokTotal(S.usage[x])).slice(0, 14).map((id) => `\n${nameOf(id)} ⚡${fmtTok(tokTotal(S.usage[id]))}${modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]) : ''}`).join(''); } // and who used what, the biggest first
1457
- for (const id in S.agents) { const t = $('#t-' + id); if (!t) continue; const u = S.usage[id], el = t.querySelector('.tk'); el.textContent = u && tokTotal(u) ? `⚡${fmtTok(tokTotal(u))}${mix && modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]).split(' ')[0] : ''}` : ''; el.dataset.w = L('jetons', 'tokens'); if (u) t.title = tokTip(u) + modelTip(id); }
1502
+ if (tot) { b.textContent = `⚡ ${fmtTok(tot)} ${L('jetons', 'tokens')}`; b.title = tokTip(all) + '\n' + Object.keys(S.usage).filter((id) => S.agents[id] && tokTotal(S.usage[id])).sort((x, y) => tokTotal(S.usage[y]) - tokTotal(S.usage[x])).slice(0, 14).map((id) => `\n${nameOf(id)} ⚡${fmtTok(tokTotal(S.usage[id]))}${modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]) + effortOf(id) : ''}`).join('') + (S.cost ? `\n\n💵 ${costStr(S.cost)} · ${costTip()}` : ''); } // and who used what, the biggest first
1503
+ for (const id in S.agents) { const t = $('#t-' + id); if (!t) continue; const u = S.usage[id], el = t.querySelector('.tk'); el.textContent = u && tokTotal(u) ? `⚡${fmtTok(tokTotal(u))}${mix && modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]).split(' ')[0] : ''}${/^(xhigh|max)$/.test(S.effort[id] || '') ? ' · ' + effortWord(S.effort[id]) : ''}` : ''; el.dataset.w = L('jetons', 'tokens'); if (u) t.title = tokTip(u) + modelTip(id); }
1458
1504
  camTok(); if (S.events.length && document.body.classList.contains('rost')) paintStates(); // the list of agents carries the counts too
1459
1505
  }
1460
1506
  function camTok() { // the one who shares a screen: what it has used so far, next to its name in the camera, as on its tile
@@ -1467,16 +1513,19 @@ const atTail = () => S.idx >= S.events.length - 3; // only trust wall-clock ag
1467
1513
  function gaveOf(la) { // the turn of the followed session ended on "I couldn't…" or on an error (the server's gave): its first sentence, unless the session moved since that answer
1468
1514
  const row = S.live && atTail() ? rowOf(S.cur) : null; return row && row.state === 'turn' && row.gave && !(la > S.rowsAt) ? row.gave : '';
1469
1515
  }
1516
+ // Claude Code stopped on its usage limit or on a login error (the server's limit and auth): not a gave-up, nothing the session itself could do. Said in amber, with no sound and no visitor
1517
+ const limitTxt = (r, short) => !r ? '' : r.limit ? '⏳ ' + L('limite d’usage', 'usage limit') + (r.limit.resets && !short ? ' · ' + L('reprise à {0}', 'resets {0}').replace('{0}', () => r.limit.resets) : '') : r.auth ? '⚠ ' + L('déconnecté : lancez /login', 'logged out: run /login') : '';
1518
+ function stopOf(la) { const row = S.live && atTail() ? rowOf(S.cur) : null; return row && row.state === 'turn' && !(la > S.rowsAt) ? limitTxt(row) : ''; } // the followed session's, unless it moved since that answer
1470
1519
  function agentState(id, now) {
1471
1520
  let s = S.status[id]; const r = S.run[id], w = S.waitOn[id], la = S.lastAct[id];
1472
- if (id === 'main' && S.live && atTail()) { const row = rowOf(S.cur); if (row && row.state === 'blocked' && row.since && !(la > S.rowsAt)) return { k: 'blocked', txt: '✋ ' + (row.sure ? L('vous attend ', 'needs you ') : L('attend vous ? ', 'needs you? ')) + fmtShort(Math.max(0, now - row.since)), ask: row.ask || '', sure: !!row.sure, since: row.since }; } // what the server knows: a menu open in the session (a Bash approval looks like a running command here), and the question or command it waits on; unless the session moved since that answer. Before "your turn": a menu left open for longer than the lead's quiet time still needs you
1521
+ if (id === 'main' && S.live && atTail()) { const row = rowOf(S.cur); if (row && row.state === 'blocked' && row.since && !(la > S.rowsAt)) return { k: 'blocked', txt: '✋ ' + (row.sure ? L('vous attend ', 'needs you ') : L('vous attend ? ', 'needs you? ')) + fmtShort(Math.max(0, now - row.since)), ask: row.ask || '', sure: !!row.sure, since: row.since }; } // what the server knows: a menu open in the session (a Bash approval looks like a running command here), and the question or command it waits on; unless the session moved since that answer. Before "your turn": a menu left open for longer than the lead's quiet time still needs you
1473
1522
  if (id === 'main' && !s) { // the lead is at work until the message that closes its turn, even while it thinks, and from its first turn on (the server says which transcripts carry that mark); one without it falls back on "quiet for 25 s", and a turn cut short on 3 minutes of silence
1474
1523
  const open = S.live && la && (S.sawEnd ? !S.turnOver && now - la < 180000 : now - la < 25000);
1475
- if (r || (w && w.size) || open) s = 'working'; else if (S.live && la) { const g = gaveOf(la); return { k: 'done', txt: (g ? '⚠ ' + L('a abandonné ?', 'gave up?') : '✓ ' + L('à vous', 'your turn')) + ' · ' + fmtShort(Math.max(0, now - la)), ...(g ? { gave: g } : {}) }; }
1524
+ if (r || (w && w.size) || open) s = 'working'; else if (S.live && la) { const g = gaveOf(la), stop = g ? '' : stopOf(la); return { k: 'done', txt: (stop || (g ? '⚠ ' + L('a abandonné ?', 'gave up?') : '✓ ' + L('à vous', 'your turn'))) + ' · ' + fmtShort(Math.max(0, now - la)), ...(g ? { gave: g } : stop ? { stop } : {}) }; }
1476
1525
  }
1477
1526
  if (s === 'done') return { k: 'done', txt: '✓ ' + L('terminé', 'done') };
1478
1527
  if (!s) return { k: 'idle', txt: '' };
1479
- if (S.live && atTail() && r && r.ts && r.name && NEEDS_OK.test(r.name)) { const age = now - r.ts; if (age > (ASKS.test(r.name) ? 4000 : 15000)) return { k: 'blocked', txt: '✋ ' + L('attend vous ? ', 'needs you? ') + fmtShort(age), since: r.ts }; }
1528
+ if (S.live && atTail() && r && r.ts && r.name && NEEDS_OK.test(r.name) && !(rowOf(S.cur) || {}).known) { const age = now - r.ts; if (age > (ASKS.test(r.name) ? 4000 : 15000)) return { k: 'blocked', txt: '✋ ' + L('vous attend ? ', 'needs you? ') + fmtShort(age), since: r.ts }; } /* a guess, on the tile only (not sure: no red line, no sound), and only where Claude Code does not say whether a menu is open (known): there, its word is believed */
1480
1529
  if (w && w.size) { // really waiting only while the lead has a sub-agent call pending, or while those agents are still active (background agents never block the lead)
1481
1530
  const pendingSub = r && /^(Task|Agent)$/.test(r.name), open = [...w].filter((c) => S.status[c] !== 'done' && (pendingSub || !S.live || now - Math.max(S.lastAct[c] || 0, S.orderTs[c] || 0) < 120000));
1482
1531
  if (open.length) {
@@ -1511,16 +1560,16 @@ function paintAsk(now) {
1511
1560
  if (el.dataset.k !== m.id) { el.dataset.k = m.id; el.className = 'on'; el.setAttribute('aria-label', L('Ce que la session attend de vous', 'What the session is waiting for from you')); el.innerHTML = askHtml(m, p); } // built once per menu, so it is announced once
1512
1561
  const t = el.querySelector('.ak-t'); if (t) t.textContent = fmtShort(Math.max(0, now - (row.since || now)));
1513
1562
  }
1514
- $('#askc').onclick = (e) => { if (e.target.closest('.ax')) { ASKC.off = $('#askc').dataset.k; paintAsk(Date.now()); } };
1563
+ $('#askc').onclick = (e) => { if (e.target.closest('.ax')) { ASKC.off = $('#askc').dataset.k; paintAsk(Date.now()); } else if (!String(getSelection() || '')) answerAt(S.cur); }; /* not while you select its text to copy it */
1515
1564
  function paintStates() {
1516
1565
  const now = Date.now(), n = { working: 0, waiting: 0, blocked: 0, stalled: 0, done: 0 }, ros = [], attn = [];
1517
1566
  for (const p of Object.values(S.agents)) {
1518
1567
  if (p.id === 'user') continue; const t = $('#t-' + p.id); if (!t) continue;
1519
1568
  const st = agentState(p.id, now), shown = t.style.display !== 'none'; if (shown && n[st.k] !== undefined && !S.gone.has(p.id)) { n[st.k]++; if (st.k === 'blocked' || st.k === 'stalled') attn.push(p.id); }
1520
- STATE_CLASSES.forEach((c) => t.classList.toggle(c, st.k === c));
1521
- const el = t.querySelector('.status'); if (el.textContent !== st.txt) { el.textContent = st.txt; const tb = t.querySelector('.tbadge'); if (tb) tb.style.top = el.offsetHeight > 26 ? el.offsetTop + el.offsetHeight + 4 + 'px' : ''; } /* a status on two lines: the badges under it move down */ const sc = 'status ' + st.k + (isTurn(p.id, st) ? ' turn' : '') + (st.gave ? ' gave' : ''); if (el.className !== sc) el.className = sc;
1569
+ STATE_CLASSES.forEach((c) => t.classList.toggle(c, st.k === c && !(c === 'done' && st.stop))); /* stopped by the usage limit or a logout: resting, not the happy face and sparkles of done */
1570
+ const el = t.querySelector('.status'); if (el.textContent !== st.txt) { el.textContent = st.txt; const tb = t.querySelector('.tbadge'); if (tb) tb.style.top = el.offsetHeight > 26 ? el.offsetTop + el.offsetHeight + 4 + 'px' : ''; } /* a status on two lines: the badges under it move down */ const sc = 'status ' + st.k + (isTurn(p.id, st) ? ' turn' : '') + (st.gave || st.stop ? ' gave' : ''); if (el.className !== sc) el.className = sc;
1522
1571
  const pr = t.querySelector('.prop'), want = { blocked: '✋', stalled: '😰', waiting: '⌛' }[st.k] || '', was = S.prevState[p.id]; // a raised hand, a sweat drop, an hourglass: the call metaphor for "needs you / stuck / waiting"
1523
- const spot = S.spotted || (S.spotted = new Set()); if (st.k !== 'blocked') spot.delete(p.id); else if (!spot.has(p.id) && shown && !S.gone.has(p.id) && !S.speakers.size && !(S.focusLock > Date.now())) { spot.add(p.id); setFocus(p.id); } // one that waits on you takes the spotlight once per wait, as soon as nobody talks (the speaker has it until then)
1572
+ const spot = S.spotted || (S.spotted = new Set()); if (st.k !== 'blocked' || !st.sure) spot.delete(p.id); else if (!spot.has(p.id) && shown && !S.gone.has(p.id) && !S.speakers.size && !(S.focusLock > Date.now())) { spot.add(p.id); setFocus(p.id); } // one that waits on you takes the spotlight once per wait, as soon as nobody talks (the speaker has it until then)
1524
1573
  if (st.k === 'done' && was && was !== 'done' && was !== 'idle') { pr.textContent = '🎉'; pr.className = 'prop cheer'; setTimeout(() => { if (pr.classList.contains('cheer')) { pr.textContent = ''; pr.className = 'prop'; } }, 1200); }
1525
1574
  else if (!pr.classList.contains('cheer')) { if (pr.textContent !== want) pr.textContent = want; const pc = 'prop ' + (want ? st.k : ''); if (pr.className !== pc) pr.className = pc; }
1526
1575
  if (shown && !S.gone.has(p.id)) ros.push({ p, st });
@@ -1531,7 +1580,7 @@ function paintStates() {
1531
1580
  paintPill();
1532
1581
  const b = $('#board'), parts = [['working', '⚙', L('au travail', 'working')], ['waiting', '🔗', L('attendent leurs sous-agents', 'on sub-agents')], ['blocked', '✋', L('vous attendent', 'need you')], ['stalled', '⚠', L('bloqués', 'stalled')], ['done', '✓', L('terminés', 'done')]]
1533
1582
  .filter(([k]) => n[k] && !S.pillSess).map(([k, i, l]) => `<span class="${k}" title="${n[k]} ${l}">${i} ${n[k]}<em> ${l}</em></span>`).join('');
1534
- if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked = n.blocked + n.stalled; S.attn = attn; paintRoster(ros); paintFiles(); paintAsk(now); paintAttn(now); return n;
1583
+ if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked = ros.filter((x) => x.st.k === 'blocked' && x.st.sure).length; /* the sound, the red icon and the title: only a menu really open, not a guess nor a stalled hand-off */ S.attn = attn; paintRoster(ros); paintFiles(); paintAsk(now); paintAttn(now); return n;
1535
1584
  }
1536
1585
  function fitBoard(force) { // the chips lose their words when they do not all fit (a long language, a narrower window): a chip is never cut mid-word. Tried again with the words only when the window or the texts around have changed
1537
1586
  const b = $('#board'), key = innerWidth + '|' + b.textContent.length + '|' + $('#pill').textContent.length + '|' + $('#subtitle').textContent.length;
@@ -1543,12 +1592,17 @@ const RORDER = { blocked: 0, stalled: 1, working: 2, waiting: 3, idle: 4, done:
1543
1592
  const TOOL = { _codex: 'Codex', _vibe: 'Vibe', _cowork: 'Cowork' }, leadTool = (p) => (p.id === 'main' && S.cur && TOOL[S.cur.proj] ? ' · ' + TOOL[S.cur.proj] : ''); // a session that is not a Claude Code one says which tool runs it: on its tab, and next to its lead, who has the same name in every call
1544
1593
  const modelShort = (m) => { const v = String(m || ''); if (!v || v[0] === '<') return ''; const c = /(opus|sonnet|haiku|fable)[-_ ]?(\d{1,2})(?:[-.](\d{1,2})(?!\d))?(?!\d)/i.exec(v); const o = /claude-(\d)(?:-(\d))?-(opus|sonnet|haiku)/i.exec(v), cap = (w) => w[0].toUpperCase() + w.slice(1).toLowerCase(); if (o) return cap(o[3]) + ' ' + o[1] + (o[2] ? '.' + o[2] : ''); const g = /^gpt-(\d+(?:\.\d+)?[a-z]?)(?:-(.+))?$/i.exec(v.replace(/^.*\//, '').replace(/-\d{4}-?\d{2}-?\d{2}$/, '')); if (g) return ('GPT-' + g[1].toLowerCase() + (g[2] ? ' ' + g[2].split('-').map((w) => (/^(mini|nano)$/i.test(w) ? w.toLowerCase() : cap(w))).join(' ') : '')).slice(0, 24); /* Codex: gpt-6-pro → GPT-6 Pro, gpt-5.1-codex-max → GPT-5.1 Codex Max, gpt-5-mini → GPT-5 mini */ return c ? cap(c[1]) + ' ' + c[2] + (c[3] ? '.' + c[3] : '') : v.replace(/^.*\//, '').replace(/-\d{8}$/, '').slice(0, 24); }; /* older ids put the version first: claude-3-5-sonnet → Sonnet 3.5 */ // claude-haiku-4-5-20251001 → Haiku 4.5
1545
1594
  const mixedModels = () => new Set(Object.keys(S.usage).filter((id) => S.agents[id] && S.model[id] && tokTotal(S.usage[id])).map((id) => modelShort(S.model[id])).filter(Boolean)).size > 1; // only then is the model worth a place next to the count
1546
- const modelTip = (id) => (S.model[id] && modelShort(S.model[id]) ? '\n' + L('Modèle', 'Model') + ' · ' + S.model[id] : '');
1595
+ const effortWord = (e) => ({ low: L('faible', 'low'), medium: L('moyen', 'medium'), high: L('élevé', 'high'), xhigh: L('très élevé', 'extra high'), max: L('maximal', 'max') }[e] || e); // the effort Claude Code says it worked at (written since 2.1.275; nothing from older versions)
1596
+ const effortOf = (id) => (S.effort && S.effort[id] ? ' · ' + L('effort', 'effort') + ' ' + effortWord(S.effort[id]) : '');
1597
+ const advisorOf = (id) => (S.adv && S.adv[id] && modelShort(S.adv[id]) ? L('conseillé par', 'advised by') + ' ' + modelShort(S.adv[id]) : ''); // the model it may ask for advice, when not itself
1598
+ const modelTip = (id) => (S.model[id] && modelShort(S.model[id]) ? '\n' + L('Modèle', 'Model') + ' · ' + S.model[id] + effortOf(id) + (advisorOf(id) ? '\n' + advisorOf(id) : '') : '');
1599
+ const costStr = (c) => (c.final ? '' : '≥ ') + '$' + (c.usd < 0.01 ? '0.01' : c.usd.toFixed(2)); // Claude Code's own count (cost-state, 2.1.300 on), sub-agents included; ≥ when work went on after it counted
1600
+ const costTip = () => L('Compté par Claude Code, sous-agents compris', 'Counted by Claude Code, sub-agents included') + (S.cost && !S.cost.final ? '. ' + L('Au moins : le travail a continué depuis son dernier compte.', 'At least: work went on after it last counted.') : '');
1547
1601
  const rosTok = (id) => { const u = S.usage[id]; return u && tokTotal(u) ? `<span class="rt" title="${esc(tokTip(u) + modelTip(id))}">⚡${fmtTok(tokTotal(u))}${mixedModels() && modelShort(S.model[id]) ? ' · ' + esc(modelShort(S.model[id])) : ''}</span>` : ''; };
1548
1602
  function paintRoster(ros) { // a fixed list beside the call: who is doing what, urgent first, readable even with dozens of agents
1549
1603
  const box = $('#roster'); if (!box || !document.body.classList.contains('rost')) return;
1550
1604
  ros.sort((a, b) => (a.p.id === 'main' ? -1 : b.p.id === 'main' ? 1 : (RORDER[a.st.k] - RORDER[b.st.k]) || (S.lastAct[b.p.id] || 0) - (S.lastAct[a.p.id] || 0)));
1551
- const rows = ros.slice(0, 60).map(({ p, st }) => `<div class="rr k-${st.k}${isTurn(p.id, st) ? ' turn' : ''}${st.gave ? ' gave' : ''}${S.focus === p.id ? ' sel' : ''}${S.speakers.has(p.id) ? ' speaking' : ''}" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}, ${esc(st.txt || '')}" title="${esc(p.name + ' — ' + p.role + leadTool(p) + (st.txt ? '\n' + st.txt : '') + (S.lastTool[p.id] ? '\n' + S.lastTool[p.id] : ''))}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role + leadTool(p))}</span>${rosTok(p.id)}</div><div class="st">${esc(st.txt || L('en veille', 'standing by'))}${S.loops[p.id] ? ' 🔁' : ''}${S.wst.items && S.wst.items[p.id] && S.wst.items[p.id].length ? ' ♻' + S.wst.items[p.id].length : ''}</div></div>`).join('');
1605
+ const rows = ros.slice(0, 60).map(({ p, st }) => `<div class="rr k-${st.k}${isTurn(p.id, st) ? ' turn' : ''}${st.gave || st.stop ? ' gave' : ''}${S.focus === p.id ? ' sel' : ''}${S.speakers.has(p.id) ? ' speaking' : ''}" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}, ${esc(st.txt || '')}" title="${esc(p.name + ' — ' + p.role + leadTool(p) + (st.txt ? '\n' + st.txt : '') + (S.lastTool[p.id] ? '\n' + S.lastTool[p.id] : ''))}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role + leadTool(p))}</span>${rosTok(p.id)}</div><div class="st">${esc(st.txt || L('en veille', 'standing by'))}${S.loops[p.id] ? ' 🔁' : ''}${S.wst.items && S.wst.items[p.id] && S.wst.items[p.id].length ? ' ♻' + S.wst.items[p.id].length : ''}</div></div>`).join('');
1552
1606
  const left = Object.values(S.agents).filter((p) => S.gone.has(p.id) && p.id !== 'main' && p.id !== 'user').sort((a, b) => (S.lastAct[b.id] || 0) - (S.lastAct[a.id] || 0)); // a finished agent's tile leaves the stage: its line stays here, with what it used
1553
1607
  const gone = left.slice(0, 40).map((p) => `<div class="rr left" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role)}</span>${rosTok(p.id)}</div></div>`).join('');
1554
1608
  const html = `<h3>${L('Agents', 'Agents')} · ${ros.length}</h3>${rows}${ros.length > 60 ? `<div class="ro" style="padding:4px 8px">+${ros.length - 60}</div>` : ''}${left.length ? `<h3 style="margin-top:8px">${L('terminés', 'done')} · ${left.length}</h3>${gone}` : ''}`;
@@ -1573,13 +1627,13 @@ function renderBadges() { // per tile: failed tool calls, a command that has b
1573
1627
  }
1574
1628
  if (BT && BT.el) refreshTip();
1575
1629
  }
1576
- const fmtShort = (ms) => { const s = Math.round(ms / 1000); return s < 90 ? `${s}s` : `${Math.round(s / 60)} min`; };
1630
+ const fmtShort = (ms) => { const s = Math.round(ms / 1000); return s < 90 ? `${s}s` : s < 7200 ? `${Math.round(s / 60)} min` : `${Math.floor(s / 3600)} h`; }; // whole hours from two hours on, as agoStr: it only counts up
1577
1631
  function askNotify() { try { if (!EMBED && 'Notification' in window && Notification.permission === 'default') Notification.requestPermission(); } catch {} AUD.init(); AUD.alert(); }
1578
1632
  function watchDone(n) { // live: the team was busy for a while and has now been quiet for a few seconds → tell the person
1579
1633
  if (!S.live || !S.playing) { S.busySince = S.idleAt = 0; return; }
1580
1634
  const now = Date.now(); if (n > 0) { S.busySince = S.busySince || now; S.idleAt = 0; return; } if (!S.busySince) return;
1581
1635
  S.idleAt = S.idleAt || now; if (now - S.idleAt < 6000) return;
1582
- const long = S.idleAt - S.busySince >= 20000; S.busySince = S.idleAt = 0; if (!long || !prefs.notify) return;
1636
+ const long = S.idleAt - S.busySince >= 20000; S.busySince = S.idleAt = 0; if (!long || !prefs.notify || agentState('main', now).stop) return; // stopped by the usage limit or a logout: no chime, the status says it
1583
1637
  const msg = L('Les agents ont fini 🎉', 'Your agents are done 🎉'); S.doneUntil = now + 60000; AUD.alert();
1584
1638
  if (EMBED) window.parent.postMessage({ agentStandup: 'notify', text: msg }, '*');
1585
1639
  else { try { if (document.hidden && 'Notification' in window && Notification.permission === 'granted') new Notification('Agent Standup', { body: msg }); } catch {} }
@@ -1594,8 +1648,9 @@ function updateTitle() {
1594
1648
  paintStates(); if (S.live && S.nBlocked && !S.wasBlocked && prefs.notify) { AUD.alert(); const msg = L('Un agent attend peut-être votre feu vert ✋', 'An agent may be waiting for you ✋'); if (EMBED) window.parent.postMessage({ agentStandup: 'notify', text: msg }, '*'); else { try { if (document.hidden && 'Notification' in window && Notification.permission === 'granted') new Notification('Agent Standup', { body: msg }); } catch {} } } S.wasBlocked = S.nBlocked > 0;
1595
1649
  let n = 0; for (const id in S.status) if (S.status[id] === 'working' && !S.gone.has(id)) n++;
1596
1650
  if (S.live && S.agents.main && /^(working|waiting)$/.test(agentState('main', Date.now()).k)) n++; // the lead counts too: a session without sub-agents also ends
1597
- watchDone(n); setFav(S.live && S.nBlocked ? '#ff4d4d' : null);
1598
- document.title = S.live && S.nBlocked ? `✋ ${S.nBlocked} ${L('à voir', 'need you')} · Agent Standup` : S.doneUntil > Date.now() && !n ? '✓ ' + L('Terminé', 'Done') + ' · Agent Standup' : S.live && S.playing && n ? `● ${n} ${L('au travail', 'working')} · Agent Standup` : 'Agent Standup';
1651
+ const need = S.live ? Math.max(S.nBlocked || 0, attnItems(Date.now()).filter((x) => x.sure).length) : 0; // the tab counts every session that needs you, not only this one's agents (a menu really open, as the red icon always did)
1652
+ watchDone(n); setFav(need ? '#ff4d4d' : null);
1653
+ document.title = need ? `✋ ${need} ${L('à voir', 'need you')} · Agent Standup` : S.doneUntil > Date.now() && !n ? '✓ ' + L('Terminé', 'Done') + ' · Agent Standup' : S.live && S.playing && n ? `● ${n} ${L('au travail', 'working')} · Agent Standup` : 'Agent Standup';
1599
1654
  }
1600
1655
  /* The endless little motions (breathing, blinking, typing, twinkling, steam, the spinner, a raised hand, the hourglass of an agent that waits) are moved by this one clock, 25 times a second, instead of 60 times a second by the browser:
1601
1656
  every redraw of the call goes through VS Code's own window, which flickered. They all move on the same tick, so together they cost one redraw, not one each. */
@@ -1611,7 +1666,7 @@ setInterval(() => {
1611
1666
  setInterval(() => { if (!S.agents || !S.live) return; renderBadges(); updateTitle(); if (document.body.classList.contains('tree')) renderTree(); }, 2000);
1612
1667
  const base = (f) => String(f || '').split('/').pop();
1613
1668
  const fmtDur = (ms) => (ms < 950 ? `${Math.max(1, Math.round(ms))} ms` : ms < 60000 ? `${(ms / 1000).toFixed(1)} s` : `${Math.floor(ms / 60000)} min ${Math.round((ms % 60000) / 1000)} s`);
1614
- const quiet = (e) => e.kind === 'tools' || e.kind === 'results' || e.kind === 'usage' || e.kind === 'finish' || e.kind === 'compact';
1669
+ const quiet = (e) => e.kind === 'tools' || e.kind === 'results' || e.kind === 'usage' || e.kind === 'finish' || e.kind === 'compact' || e.kind === 'tasks';
1615
1670
  function activityLabel(t) { // the short "what is on their screen" tag
1616
1671
  const d = t.d || {}, f = base(d.file || t.arg);
1617
1672
  switch (d.kind) {
@@ -1621,8 +1676,10 @@ function activityLabel(t) { // the short "what is on their screen" tag
1621
1676
  case 'cmd': { const n = (d.note || '').trim(), w = d.text.trim().split(/\s+/); if (n) return n.length > 36 ? n.slice(0, 36).replace(/\s+\S*$/, '') + '…' : n; return L('Exécute ', 'Running ') + w.slice(0, 2).join(' ').slice(0, 26) + (w.length > 2 ? '…' : ''); } /* cut at a word, and said to be cut */
1622
1677
  case 'grep': return L('Cherche « ', 'Searching “') + String(d.pattern || '').slice(0, 22) + L(' »', '”');
1623
1678
  case 'glob': return L('Liste ', 'Listing ') + String(d.pattern || '').slice(0, 24);
1624
- case 'todo': return L('Met à jour sa todo', 'Updating todo list');
1679
+ case 'todo': case 'task': return L('Met à jour sa todo', 'Updating todo list');
1680
+ case 'plan': return L('Présente le plan', 'Presenting the plan');
1625
1681
  case 'artifact': return (d.open ? L('Montre ', 'Showing ') : d.doc ? L('Crée ', 'Writing ') : L('Publie ', 'Publishing ')) + (d.title || (d.open ? 'Artifact' : f)).slice(0, 30);
1682
+ case 'browser': { const s = (d.steps || []).slice(-1)[0] || {}, n = (s.n || '').trim(), h = hostOf(s.u); if (n) return n.length > 36 ? n.slice(0, 36).replace(/\s+\S*$/, '') + '…' : n; if (!h && PREVIEW.test(t.name)) return 'Preview · ' + String(s.a || '').replace(/_/g, ' '); return h ? L('Navigue sur ', 'Browsing ') + h : L('Navigue sur le web', 'Browsing the web'); }
1626
1683
  case 'web': return d.url ? L('Consulte ', 'Fetching ') + d.url.replace(/^https?:\/\//, '').slice(0, 26) : L('Recherche sur le web', 'Web search');
1627
1684
  case 'text': { const w = d.what; if (w === 'question') return L('Pose une question', 'Asking a question'); if (w === 'skill') return L('Utilise ', 'Using skill ') + (d.v || ''); if (w === 'mcp') return d.v || t.name; if (w === 'toolsearch') return L('Cherche un outil', 'Looking for a tool'); return t.name; }
1628
1685
  default: return t.name;
@@ -1631,20 +1688,33 @@ function activityLabel(t) { // the short "what is on their screen" tag
1631
1688
  function pushTerm(id, tool) {
1632
1689
  const d = tool.d || {}, buf = (S.term[id] = S.term[id] || []);
1633
1690
  buf.push({ k: d.kind === 'text' ? 'tool' : d.kind, id: tool.id, ts: tool.ts, tool, out: null, err: false, end: null });
1634
- if (d.kind === 'todo') S.todos[id] = d.items;
1691
+ if (d.kind === 'todo') S.todos[id] = d.items; else if (d.kind === 'task') taskOp(id, tool);
1635
1692
  if (buf.length > 80) buf.shift();
1636
1693
  S.act[id] = activityLabel(tool);
1637
1694
  }
1695
+ // The task list (TaskCreate / TaskUpdate, and the snapshot Claude Code reminds the agent of): kept as TodoWrite's is, { c: subject, s: status, a: what it says while on it }. Copied, never changed in place: a TodoWrite list is the event's own
1696
+ function taskOp(id, tool) {
1697
+ const d = tool.d || {}, td = (S.todos[id] || []).map((x) => ({ ...x }));
1698
+ if (d.op === 'create') td.push({ c: String(d.subject || ''), s: 'pending', a: d.active || '', tid: null, call: tool.id });
1699
+ else if (d.op === 'update') {
1700
+ const k = String(d.taskId == null ? '' : d.taskId); let j = td.findIndex((x) => x.tid === k); if (j < 0) j = td.findIndex((x, n) => x.tid == null && String(n + 1) === k); /* an id the answer has not given yet: Claude Code counts them from 1 */
1701
+ if (j >= 0) { if (d.status === 'deleted') td.splice(j, 1); else { if (d.status) td[j].s = d.status; if (d.subject) td[j].c = String(d.subject); } }
1702
+ }
1703
+ S.todos[id] = td;
1704
+ }
1705
+ function applyTasks(ev) { if (!Array.isArray(ev.items)) return; S.todos[ev.agent] = ev.items.filter((x) => x && x.s !== 'deleted').map((x) => ({ c: String(x.c || ''), s: x.s || 'pending', a: x.a || '', tid: String(x.id == null ? '' : x.id) })); if (S.present === ev.agent && !S.recomputing) renderPresent(); } // the whole list, as Claude Code last showed it to the agent
1706
+ const reduced = () => !!(window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches);
1707
+ const revealOK = () => S.boost <= 1 && spd() <= 2 && (S.live || spd() <= 1.3) && !reduced() && !S.hold; // a command typed and its output coming in line by line: live or at 1×, never while catching up, fast, or with less motion asked
1638
1708
  function applyResults(ev, silent) { // the output of a tool call arrives
1639
- const buf = S.term[ev.agent] || []; let last = null;
1640
- for (const it of ev.items) for (let i = buf.length - 1; i >= 0; i--) if (buf[i].id === it.id) { Object.assign(buf[i], { out: it.out, err: it.err, end: ev.ts, img: it.img || 0, picAt: it.img && !silent ? performance.now() : 0, art: it.art || null }); last = buf[i]; break; }
1709
+ const buf = S.term[ev.agent] || []; let last = null; const rv = !silent && revealOK() ? performance.now() : 0;
1710
+ for (const it of ev.items) for (let i = buf.length - 1; i >= 0; i--) if (buf[i].id === it.id) { Object.assign(buf[i], { out: it.out, err: it.err, end: ev.ts, img: it.img || 0, picAt: it.img && !silent ? performance.now() : 0, art: it.art || null, web: it.web || null, diff: it.diff || null, tests: it.tests || null, search: it.search || null, fetch: it.fetch || null, bg: it.bg || null, rv }); if (it.task && it.task.id != null) { const td = S.todos[ev.agent] || [], x = td.find((y) => y.call === it.id); if (x) x.tid = String(it.task.id); } last = buf[i]; break; }
1641
1711
  if (S.run[ev.agent] && ev.items.some((it) => it.id === S.run[ev.agent].id)) delete S.run[ev.agent];
1642
1712
  if (silent || !last) return;
1643
- setTicker(ev.agent, last); if (S.present === ev.agent) { renderPresent(); armPresent(); }
1713
+ setTicker(ev.agent, last); if (S.present === ev.agent) { renderPresent(); armPresent(); if (rv) revealRun(); }
1644
1714
  }
1645
1715
  function setTicker(id, e) { // the strip on the tile: spinner while running, then ✓/✗ and the real duration
1646
1716
  const t = $('#t-' + id); if (!t) return; const tk = t.querySelector('.ticker'), tool = e.tool, running = e.end == null;
1647
- tk.innerHTML = `${running ? '<span class="spin"></span>' : ''}<i>${esc(tool.name)}</i> ${esc(tool.arg || '')}${running ? ' <em class="el"></em>' : ` <em class="${e.err ? 'bad' : 'ok'}">${e.err ? '✗' : '✓'} ${fmtDur(e.end - e.ts)}</em>`}`;
1717
+ tk.innerHTML = `${running ? '<span class="spin"></span>' : ''}<i>${esc(e.k === 'browser' ? (PREVIEW.test(tool.name) ? 'Preview' : 'Chrome') : tool.name)}</i> ${esc(tool.arg || '')}${running ? ' <em class="el"></em>' : ` <em class="${e.err ? 'bad' : 'ok'}">${e.err ? '✗' : '✓'} ${fmtDur(e.end - e.ts)}</em>`}`;
1648
1718
  tk.classList.add('on'); if (running) { tk.classList.remove('flash'); void tk.offsetWidth; tk.classList.add('flash'); }
1649
1719
  }
1650
1720
  function tickTools(ev) {
@@ -1652,7 +1722,7 @@ function tickTools(ev) {
1652
1722
  ev.tools.forEach((tool) => pushTerm(ev.agent, tool));
1653
1723
  const buf = S.term[ev.agent], k = ev.tools[ev.tools.length - 1];
1654
1724
  S.tc[ev.agent] = (S.tc[ev.agent] || 0) + ev.tools.length; S.lastTool[ev.agent] = k.name + ' ' + (k.arg || '').slice(-38);
1655
- S.run[ev.agent] = { id: k.id, start: performance.now(), ts: k.ts, name: k.name }; setTicker(ev.agent, buf[buf.length - 1]); showPresent(ev.agent);
1725
+ S.run[ev.agent] = { id: k.id, start: performance.now(), ts: k.ts, name: k.name }; const le = buf[buf.length - 1]; if (le.k === 'cmd' && revealOK()) le.ty = performance.now(); setTicker(ev.agent, le); showPresent(ev.agent); if (le.ty && S.present === ev.agent) revealRun(); /* ty: the command is typed in */
1656
1726
  }
1657
1727
  setInterval(() => { // live "running…" counters
1658
1728
  if (!S.playing) return;
@@ -1671,7 +1741,13 @@ function termModel(id) {
1671
1741
  const buf = S.term[id] || [], last = buf[buf.length - 1], lines = [], more = (n) => ({ c: 'dim', t: `… +${n} ${L('lignes', 'lines')}` });
1672
1742
  const pic = S.cur && buf.slice(-12).reverse().find((e) => e.img), fresh = pic && performance.now() - pic.picAt < (S.live ? 8000 : 2500 / spd()); // a picture a tool returned (screenshot, image file) stays up for a few seconds whatever comes next, then for the next few calls: a screenshot is usually followed by a click or two
1673
1743
  const web = last && last.k === 'artifact' && last.art ? S.arts.get(last.art.url) : null; if (web) return artModel(web, id); // a page that was just published: the browser window, until the agent does something else
1674
- if (pic && (fresh || (buf.length - buf.indexOf(pic) <= 4 && (pic === last || !/^(edit|write|read)$/.test(last.k))))) return { view: 'image', title: pic.k === 'read' ? base(pic.tool.d.file) : pic.tool.name.split('__').pop(), imgs: Array.from({ length: Math.min(pic.img, 3) }, (_, n) => mediaUrl(id, pic.id, n)), more: pic.img - 3, lines, stat: statOf(last, id) };
1744
+ if (last && last.k === 'browser') return browserModel(buf, last, id);
1745
+ if (last && last.k === 'upic') return { view: 'image', title: `${nameOf('user')} — ${last.img} 🖼`, imgs: Array.from({ length: Math.min(last.img, 3) }, (_, n) => mediaUrl('user', last.id, n)), more: last.img - 3, lines, stat: last.say }; // the pictures you pasted in your message, shared from your own camera
1746
+ if (last && last.k === 'plan' && String((last.tool.d && last.tool.d.text) || '').trim()) return planModel(last, id); /* a plan with no text: the terminal, not a blank page */
1747
+ const sv = last && screenModel(buf, last, id); // a board, a page, a test run or a diff takes the place of a picture once its first seconds are over
1748
+ const streams = S.live && !S.demo && pic && buf.slice(buf.indexOf(pic) + 1).some((e) => e.bg && !e.bgDone); /* a command started after the picture still writes in the background: its live output takes the screen */
1749
+ if (pic && !streams && (fresh || (!sv && buf.length - buf.indexOf(pic) <= 4 && (pic === last || !/^(edit|write|read)$/.test(last.k))))) return { view: 'image', title: pic.k === 'read' ? base(pic.tool.d.file) : pic.tool.name.split('__').pop(), imgs: Array.from({ length: Math.min(pic.img, 3) }, (_, n) => mediaUrl(id, pic.id, n)), more: pic.img - 3, lines, stat: statOf(last, id) };
1750
+ if (sv) return sv;
1675
1751
  if (last && (last.k === 'edit' || last.k === 'write' || last.k === 'read')) {
1676
1752
  const d = last.tool.d, rows = (txt, c) => String(txt || '').split('\n').slice(0, 14).map((t) => ({ c, t }));
1677
1753
  if (last.k === 'read') {
@@ -1683,37 +1759,166 @@ function termModel(id) {
1683
1759
  }
1684
1760
  return { view: 'editor', title: `${base(d.file)} — ${last.k === 'read' ? L('lecture', 'read-only') : L('Éditeur', 'Editor')}`, tab: { file: base(d.file), path: (d.file || '').split('/').slice(-4, -1).join(' › ') }, lines, stat: statOf(last, id) };
1685
1761
  }
1762
+ let live = false, liveE = null; const now = performance.now();
1686
1763
  for (const e of buf.slice(-10)) {
1687
- const d = e.tool.d || {}, out = (n) => { if (e.out == null) return; const r = e.out.split('\n'); r.slice(0, n).forEach((t) => lines.push({ c: e.err ? 'err' : 'out', t })); if (r.length > n) lines.push(more(r.length - n)); };
1688
- if (e.k === 'cmd') { lines.push({ c: 'cmd', t: d.text.split('\n').slice(0, 3).join('\n') }); if (d.note) lines.push({ c: 'dim', t: '# ' + d.note }); out(12); if (e.end == null) lines.push({ c: 'run', t: L('en cours…', 'running…') }); }
1689
- else { lines.push({ c: 'tool', t: `${e.tool.name}(${e.k === 'read' || e.k === 'edit' || e.k === 'write' ? base(d.file) : (e.tool.arg || '').slice(-70)})` }); if (e.k === 'grep' || e.k === 'glob' || e.k === 'web') out(6); if (e.end == null && e.k !== 'todo') lines.push({ c: 'run', t: '…' }); }
1764
+ const d = e.tool.d || {}, git = e.k === 'cmd' && /\bgit\s+(diff|show|log\s+-p)\b/.test(d.text || ''), out = (n) => { if (e.out == null) return; const r = e.out.split('\n'), k = Math.min(n, revealed(e, r.length, now)); r.slice(0, k).forEach((t) => lines.push({ c: e.err ? 'err' : git ? gitClass(t) : 'out', t })); if (k < Math.min(n, r.length)) return; if (r.length > n) lines.push(more(r.length - n)); }; // git diff / git show: its + − @@ lines in colour
1765
+ if (e.k === 'cmd') { const c = d.text.split('\n').slice(0, 3).join('\n'), ty = typed(e, c, now); lines.push({ c: 'cmd', t: ty, typing: ty.length < c.length }); if (ty.length < c.length) continue; if (d.note) lines.push({ c: 'dim', t: '# ' + d.note }); if (!(e.bg && e.bgOut)) out(git ? 30 : 12); /* in the background: its own output takes the place of Claude Code's 'running in background' notice */ if (e.end == null) lines.push({ c: 'run', t: L('en cours…', 'running…') }); }
1766
+ else { lines.push({ c: 'tool', t: `${e.tool.name}(${e.k === 'read' || e.k === 'edit' || e.k === 'write' ? base(d.file) : (e.tool.arg || '').slice(-70)})` }); if (e.k === 'grep' || e.k === 'glob' || e.k === 'web') out(6); if (e.end == null && e.k !== 'todo' && e.k !== 'task') lines.push({ c: 'run', t: '…' }); }
1767
+ if (e.bg) { const b = e.bgOut, on = S.live && !S.demo && !e.bgDone; live = live || on; if (on && b) liveE = e; // a command that went on in the background: what it has written since, streamed while it is on screen (see the poll below)
1768
+ if (b) { const r = String(b.text || '').replace(/\n?\[exited with code -?\d+\]\s*$/, '').split('\n').filter((x, i, a) => x || i < a.length - 1).slice(-12); r.forEach((t) => lines.push({ c: 'out', t })); if (b.done && b.code != null) lines.push({ c: b.code === 0 ? 'ok' : 'err', t: (b.code === 0 ? '✓ ' : '✗ ') + L('terminé avec le code {0}', 'exited with code {0}').replace('{0}', b.code) }); } }
1769
+ }
1770
+ return { view: 'term', lines: lines.slice(-60), stat: liveE ? `⠋ ${liveE.tool.name} · ${L('en cours', 'running')} ${fmtDur(Math.max(0, Date.now() - liveE.ts))}` : statOf(last, id), live };
1771
+ }
1772
+ const gitClass = (t) => (/^@@ /.test(t) ? 'hunk' : /^(\+\+\+|---) /.test(t) ? 'dim' : t[0] === '+' ? 'add' : t[0] === '-' ? 'del' : 'out');
1773
+ // Progressive reveal (live, or a replay at 1×): a command is typed in, then what came back appears line by line; a second at most, and only the first time it is shown (ty and rv are set once, when it happens)
1774
+ const TYPE_MS = (c) => Math.min(400, 8 * c.length), REV_MS = (n) => Math.min(600, 45 * n);
1775
+ const typed = (e, c, now) => { if (!e.ty) return c; const t = now - e.ty, D = TYPE_MS(c); return t >= D ? c : c.slice(0, Math.max(1, Math.ceil(c.length * t / D))); };
1776
+ function revealed(e, n, now) { // how many lines of an output are on screen yet
1777
+ if (!e.rv) return n; const c = e.k === 'cmd' && e.tool.d ? e.tool.d.text.split('\n').slice(0, 3).join('\n') : '', from = Math.max(e.rv, e.ty ? e.ty + TYPE_MS(c) : 0), t = now - from, D = REV_MS(Math.min(n, 14));
1778
+ return t >= D ? n : t <= 0 ? 0 : Math.max(1, Math.ceil(Math.min(n, 14) * t / D));
1779
+ }
1780
+ let revT = 0, revEnd = 0;
1781
+ function revealRun() { // a bounded timer, 25 a second for about a second, that draws the lines as they come; it stops by itself
1782
+ revEnd = performance.now() + 1150; if (revT) return;
1783
+ revT = setInterval(() => { const done = performance.now() > revEnd; if (S.present && !document.hidden) renderPresent(true); if (done || !S.present) { clearInterval(revT); revT = 0; } }, 40);
1784
+ }
1785
+ // The other screens an agent shares: its task board, the plan it presents, a web search or a page it read, a test run, a diff. Each is a window of its own; null: the terminal or the editor as before
1786
+ function screenModel(buf, last, id) {
1787
+ const d = last.tool.d || {};
1788
+ if ((last.k === 'todo' || last.k === 'task') && (S.todos[id] || []).length) return boardModel(id, last);
1789
+ if (last.search || (last.k === 'web' && d.query && !d.url && !last.fetch)) return searchModel(last, id);
1790
+ if (last.fetch || (last.k === 'web' && d.url)) return fetchModel(last, id);
1791
+ if (last.tests && last.k === 'cmd') return testModel(last, id);
1792
+ if (last.diff && Array.isArray(last.diff.files) && last.diff.files.length && /^(edit|write|cmd)$/.test(last.k)) return diffModel(last, id);
1793
+ return null;
1794
+ }
1795
+ function boardModel(id, last) {
1796
+ const td = S.todos[id], n = td.filter((x) => x.s === 'completed').length, cur = td.find((x) => x.s === 'in_progress');
1797
+ const html = `<div class="pbd"><h4><span>${esc(L('Tâches', 'Tasks'))}</span><b>${n}/${td.length}</b><span class="pbar2"><i class="ok" style="width:${(n / td.length * 100).toFixed(1)}%"></i></span></h4>` + td.map((x, i) => `<div class="bt ${esc(x.s)}" data-k="${i}|${esc(x.c.slice(0, 60))}"><i>${x.s === 'completed' ? '✓' : x.s === 'in_progress' ? '◐' : '○'}</i><span>${esc(x.c)}${x.s === 'in_progress' && x.a ? `<em>${esc(x.a)}…</em>` : ''}</span></div>`).join('') + '</div>';
1798
+ return { view: 'board', title: `${L('Tâches', 'Tasks')} — ${nameOf(id)}`, html, key: 'board|' + prefs.lang + '|' + td.map((x) => x.s + ' ' + x.c + ' ' + (x.a || '')).join('\n'), lines: td.map((x) => ({ c: x.s === 'completed' ? 'dim' : x.s === 'in_progress' ? 'run' : 'out', t: (x.s === 'completed' ? '✓ ' : x.s === 'in_progress' ? '◐ ' : '○ ') + x.c })), stat: cur ? '◐ ' + (cur.a || cur.c) : statOf(last, id), shape: td.length > 6 ? 'pic' : '' };
1799
+ }
1800
+ function planModel(e, id) {
1801
+ const t = String((e.tool.d || {}).text || ''), h = (t.match(/^#{1,3}\s+(.+)$/m) || [])[1];
1802
+ return { view: 'plan', title: 'plan.md', html: `<div class="ppage"><article class="pdoc">${mdLite(t)}</article></div>`, key: 'plan|' + e.id + '|' + t.length, lines: t.split('\n').slice(0, 40).map((x) => ({ c: 'out', t: x })), stat: '📋 ' + L('Présente le plan', 'Presenting the plan') + (h ? ' · ' + h.replace(/[*`]/g, '').slice(0, 80) : ''), shape: 'pic', badge: '📋 ' + nameOf(id) + ' · ' + L('Présente le plan', 'Presenting the plan') };
1803
+ }
1804
+ function searchModel(e, id) {
1805
+ const d = e.tool.d || {}, q = d.query || e.tool.arg || '', rs = Array.isArray(e.search) ? e.search : [];
1806
+ const body = rs.length ? rs.map((r) => `<div class="sr"><em>${esc(hostOf(r.u) || r.u || '')}</em><b>${esc(r.t || r.u || '')}</b></div>`).join('') : e.end == null ? '<div class="pwait"><span class="spin"></span></div>' : `<div class="pwait">${esc(e.err && e.out ? e.out.split('\n')[0].slice(0, 160) : L('Aucun résultat', 'No results'))}</div>`;
1807
+ return { view: 'search', title: q, html: `<div class="pnav"><span class="purl psq">🔎 ${esc(q)}</span></div><div class="ppage psr">${body}</div>`, key: 'search|' + e.id + '|' + (e.end == null ? 'run' : rs.length) + '|' + prefs.lang, lines: [{ c: 'tool', t: `${e.tool.name}(${q})` }, ...rs.map((r) => ({ c: 'out', t: (r.t || '') + ' — ' + hostOf(r.u) }))], stat: statOf(e, id), shape: 'pic' };
1808
+ }
1809
+ const fmtBytes = (b) => (b < 1024 ? b + ' B' : b < 1048576 ? (b / 1024).toFixed(b < 10240 ? 1 : 0) + ' KB' : (b / 1048576).toFixed(1) + ' MB');
1810
+ function fetchModel(e, id) {
1811
+ const d = e.tool.d || {}, f = e.fetch || {}, u = f.u || d.url || e.tool.arg || '', meta = [f.code ? `<b class="${f.code >= 400 ? 'bad' : 'ok'}">${+f.code}</b>` : '', f.bytes ? fmtBytes(+f.bytes) : '', f.ms ? fmtDur(+f.ms) : ''].filter(Boolean).join(' · ');
1812
+ const body = e.end == null ? '<div class="pwait"><span class="spin"></span></div>' : e.err ? `<div class="pread"><p class="bad">${esc(String(e.out || '').slice(0, 600))}</p></div>` : `<article class="pread">${mdLite(String(e.out || '').slice(0, 4000))}</article>`;
1813
+ return { view: 'fetch', title: hostOf(u) || u, html: `<div class="pnav"><span class="purl">${/^https:/.test(u) ? '🔒 ' : ''}${esc(u.replace(/^https?:\/\//, ''))}</span>${meta ? `<span class="pnn">${meta}</span>` : ''}</div><div class="ppage">${body}</div>`, key: 'fetch|' + e.id + '|' + (e.end == null ? 'run' : 'end') + '|' + prefs.lang, lines: [{ c: 'tool', t: `${e.tool.name}(${u})` }, ...String(e.out || '').split('\n').slice(0, 12).map((t) => ({ c: 'out', t }))], stat: statOf(e, id), shape: 'pic' };
1814
+ }
1815
+ function testModel(e, id) {
1816
+ const t = e.tests, d = e.tool.d || {}, pass = +t.pass || 0, fail = +t.fail || 0, skip = +t.skip || 0, tot = +t.total || pass + fail + skip || 1, ok = !fail && !e.err, pc = (x) => (x / tot * 100).toFixed(1) + '%', failed = Array.isArray(t.failed) ? t.failed : [];
1817
+ const html = `<div class="tl cmd"><span class="ps">❯</span> ${esc(d.text.split('\n')[0])}</div><div class="ptst ${ok ? 'ok' : 'bad'}${performance.now() - (e.rv || e.seenAt || 0) < 1500 ? ' flash' : ''}"><div class="ptr"><span class="prun">${esc(t.runner || 'tests')}</span><span class="pc ok"><b>${pass}</b> ${esc(L('réussis', 'passed'))}</span><span class="pc bad${fail ? '' : ' zero'}"><b>${fail}</b> ${esc(L('en échec', 'failed'))}</span>${skip ? `<span class="pc skip"><b>${skip}</b> ${esc(L('ignorés', 'skipped'))}</span>` : ''}</div><div class="pbar2"><i class="ok" style="width:${pc(pass)}"></i><i class="bad" style="width:${pc(fail)}"></i><i class="skip" style="width:${pc(skip)}"></i></div>${failed.length ? `<ul class="pfail">${failed.map((x) => `<li>✗ ${esc(x)}</li>`).join('')}${fail > failed.length ? `<li class="dim">… +${fail - failed.length}</li>` : ''}</ul>` : ''}</div>`;
1818
+ return { view: 'test', title: `${t.runner || 'tests'} — ${nameOf(id)} — zsh`, html, key: 'test|' + e.id + '|' + prefs.lang, lines: [{ c: 'cmd', t: d.text.split('\n')[0] }, { c: ok ? 'out' : 'err', t: `${ok ? '✓' : '✗'} ${pass} ${L('réussis', 'passed')} · ${fail} ${L('en échec', 'failed')}${skip ? ` · ${skip} ${L('ignorés', 'skipped')}` : ''}` }, ...failed.map((x) => ({ c: 'err', t: '✗ ' + x }))], stat: statOf(e, id), shape: failed.length > 2 ? 'pic' : '' };
1819
+ }
1820
+ function diffModel(e, id) { // the change as git shows it: its real line numbers, the lines around it, + and − in colour; the first file, the others named in the tab
1821
+ const df = e.diff, f = df.files[0] || {}, lines = [], d = e.tool.d || {}, extra = df.files.length - 1 + (+df.more || 0);
1822
+ for (const h of (f.hunks || []).slice(0, 4)) {
1823
+ let o = +h.o || 0, n = +h.n || 0; lines.push({ c: 'hunk', g: ' ', n: '', t: `@@ -${o} +${n} @@` });
1824
+ for (const x of h.lines || []) { const s = String(x), g = s[0], t = s.slice(1); if (g === '+') lines.push({ c: 'add', n: n++, g: '+', t }); else if (g === '-') lines.push({ c: 'del', n: o++, g: '−', t }); else if (g === '\\') lines.push({ c: 'dim', g: ' ', n: '', t: s }); else { lines.push({ c: 'ctx', n: n, g: ' ', t: g === ' ' ? t : s }); o++; n++; } }
1825
+ }
1826
+ const k = revealed(e, lines.length, performance.now()), shown = k < lines.length ? lines.slice(0, k) : lines, file = f.file || d.file || '';
1827
+ return { view: 'editor', title: `${base(file)} — ${L('Éditeur', 'Editor')}`, tab: { file: base(file), path: e.k === 'cmd' ? '❯ ' + String(d.text || '').split('\n')[0].slice(0, 90) : file.split('/').slice(-4, -1).join(' › '), more: extra > 0 ? `+${extra} ${L('fichiers', 'files')}` : '' }, lines: shown, stat: statOf(e, id) };
1828
+ }
1829
+ // Markdown, a little of it, for a plan or a page read in reader mode: headings, lists, code blocks, `code` and **bold**. Everything is escaped first; only these few tags are added
1830
+ function mdLite(src) {
1831
+ const out = []; let code = null, list = false; const inl = (s) => esc(s).replace(/`([^`]+)`/g, '<code>$1</code>').replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>').replace(/\[([^\]]+)\]\([^)]*\)/g, '<u>$1</u>');
1832
+ const endList = () => { if (list) { out.push('</ul>'); list = false; } };
1833
+ for (const ln of String(src).split('\n').slice(0, 400)) {
1834
+ if (/^\s*```/.test(ln)) { if (code) { out.push(`<pre>${esc(code.join('\n'))}</pre>`); code = null; } else { endList(); code = []; } continue; }
1835
+ if (code) { code.push(ln); continue; }
1836
+ const h = ln.match(/^(#{1,6})\s+(.*)$/), li = ln.match(/^(\s*)(?:[-*+]|\d+[.)])\s+(.*)$/);
1837
+ if (h) { endList(); const lv = Math.min(5, h[1].length + 2); out.push(`<h${lv}>${inl(h[2])}</h${lv}>`); }
1838
+ else if (li) { if (!list) { out.push('<ul>'); list = true; } out.push(`<li${li[1].length >= 2 ? ' class="sub"' : ''}>${inl(li[2].replace(/^\[( |x)\]\s*/i, (m, c) => (c === ' ' ? '☐ ' : '☑ ')))}</li>`); }
1839
+ else if (!ln.trim()) endList();
1840
+ else { endList(); out.push(`<p>${inl(ln)}</p>`); }
1690
1841
  }
1691
- return { view: 'term', lines: lines.slice(-60), stat: statOf(last, id) };
1842
+ if (code) out.push(`<pre>${esc(code.join('\n'))}</pre>`); endList(); return out.join('');
1843
+ }
1844
+ // An agent driving a browser (Claude in Chrome, the desktop app's browser): the window as it last saw it, the address it is on, and the pointer where it last clicked, which glides to the next click as that call starts.
1845
+ // The picture is the last screenshot, unless the agent has gone to another address since: an old page is not shown as the new one.
1846
+ const hostOf = (u) => { try { return u ? new URL(u).host : ''; } catch { return ''; } };
1847
+ function browserModel(buf, last, id) {
1848
+ let pic = null, url = '', title = '', frame = null, ptr = null, gone = false, log = null, seen = 0, fi = -1, pi = -1;
1849
+ for (let i = buf.length - 1; i >= 0; i--) {
1850
+ const e = buf[i]; if (e.k !== 'browser') continue; const w = e.web || {}, st = (e.tool.d && e.tool.d.steps) || [], rs = st.filter((s) => s.a === 'resize').pop(); seen++;
1851
+ if (!url) url = w.u || (st.filter((s) => s.u).pop() || {}).u || ''; if (!title && w.t) title = w.t; if (!frame && w.f) { frame = w.f; fi = i; } if (!frame && rs) { frame = rs.w > 0 && rs.h > 0 ? [+rs.w, +rs.h] : PRESETS[rs.preset] || null; fi = i; } // Claude Preview: a window resized to a size, or to a device
1852
+ if (!log && seen <= 6 && Array.isArray(w.log)) log = w.log; // what its console said lately: the dev-tools strip (none when its last answer was "No console logs.")
1853
+ if (!ptr) for (let j = st.length - 1, ask = true; j >= 0; j--) { const at = st[j].x != null ? [st[j].x, st[j].y] : ask && w.p; if (/click|move|drag|hover/.test(st[j].a)) { if (at) { ptr = { x: at[0], y: at[1], k: e.id + ':' + j, clk: /click/.test(st[j].a) }; break; } ask = false; } } // a click on an element has its point in the answer (w.p, of the last click only); without one, the pointer stays where it last was
1854
+ if (!pic && e.img) { pic = e; pi = i; } if (!pic && st.some((s) => s.u)) gone = true;
1855
+ if (pic && url && title && frame && ptr) break;
1856
+ }
1857
+ if (PREVIEW.test(last.tool.name) && pic && pi > fi) frame = null; /* Claude Preview: a screenshot taken since the last resize has the window's shape itself */
1858
+ const s = ((last.tool.d && last.tool.d.steps) || []).slice(-1)[0] || {}, host = hostOf(url), app = PREVIEW.test(last.tool.name) ? 'Preview' : 'Chrome', say = s.n || (s.a === 'eval' && s.q ? '› ' + s.q : s.q ? '🔎 ' + s.q : s.u ? '→ ' + s.u.replace(/^https?:\/\//, '') : s.a === 'resize' && frame ? `${app} · ${frame[0]}×${frame[1]}` : s.a ? app + ' · ' + s.a.replace(/_/g, ' ') : ''), stat = statOf(last, id); // an eval step says the expression it ran
1859
+ return { view: 'browser', title: title || host || app, app, url, host, img: pic && !gone ? mediaUrl(id, pic.id, Math.min(pic.img - 1, 9)) : '', frame, ptr, typed: s.t || '', log: log || [], lines: [], stat: say ? stat.replace(last.tool.name, say) : stat };
1860
+ }
1861
+ const PREVIEW = /(^|__)Claude_Preview__|^mcp__(?:[^_]+__)?Claude_Browser__preview_/, PRESETS = { mobile: [375, 812], tablet: [768, 1024], desktop: [1280, 800] };
1862
+ const BROWSER_HTML = '<div class="pnav"><span class="purl"></span></div><div class="pbr"><div class="pfr"><img alt=""><i class="pptr"></i><span class="pkey"></span></div><div class="pcard pnone"><i>🌐</i><b></b><em></em></div></div><div class="pdev" hidden></div>';
1863
+ function paintBrowser(pb, m) { // the window stays from one step to the next: the address changes, the pointer glides, the picture is swapped when a new one comes back
1864
+ const q = (s) => pb.querySelector(s), fr = q('.pfr'), img = q('.pfr img'), ptr = q('.pptr'), key = q('.pkey'); if (!fr) return;
1865
+ q('.purl').textContent = m.url ? (/^https:/.test(m.url) ? '🔒 ' : '') + m.url.replace(/^https?:\/\//, '') : '';
1866
+ q('.pbr').classList.toggle('none', !m.img); q('.pnone b').textContent = m.host || m.app || 'Chrome';
1867
+ const dev = q('.pdev'), dk = (m.log || []).join('\n'); if (dev && dev.dataset.k !== dk) { dev.dataset.k = dk; dev.hidden = !dk; dev.innerHTML = (m.log || []).slice(-4).map((x) => `<div class="${/error|uncaught|failed|✗/i.test(x) ? 'e' : /warn/i.test(x) ? 'w' : ''}">› ${esc(String(x).slice(0, 200))}</div>`).join(''); } /* the console of a Claude Preview page, its last lines */ q('.pnone em').textContent = m.typed ? '⌨ ' + m.typed : L('Pas encore d’image de cette page', 'No picture of this page yet');
1868
+ if (m.img && img.getAttribute('src') !== m.img) { img.onload = () => { if (S.present) renderPresent(); }; img.src = m.img; }
1869
+ const W = m.frame ? m.frame[0] : img.naturalWidth, H = m.frame ? m.frame[1] : img.naturalHeight, on = !!(m.ptr && W && H); if (W && H) fr.style.setProperty('--ar', (W / H).toFixed(4));
1870
+ const pos = (el) => { el.style.left = Math.min(100, Math.max(0, m.ptr.x / W * 100)) + '%'; el.style.top = Math.min(100, Math.max(0, m.ptr.y / H * 100)) + '%'; };
1871
+ ptr.hidden = !on; if (on) { pos(ptr); pos(key); if (m.ptr.clk && ptr.dataset.k !== m.ptr.k) { ptr.classList.remove('clk'); void ptr.offsetWidth; ptr.classList.add('clk'); } ptr.dataset.k = m.ptr.k; }
1872
+ key.textContent = on && m.typed ? '⌨ ' + m.typed : '';
1692
1873
  }
1693
1874
  const lineHtml = (l, view) => view === 'editor'
1694
- ? `<div class="ln ${l.c}"><b>${esc(l.n != null ? l.n : l.c === 'add' ? '+' : l.c === 'del' ? '−' : '')}</b>${esc(l.t) || ' '}</div>`
1695
- : `<div class="tl ${l.c}">${l.c === 'cmd' ? '<span class="ps">❯</span> ' : l.c === 'tool' ? '<span class="dotg">●</span> ' : l.c === 'run' ? '<span class="spin"></span>' : ''}${esc(l.t)}</div>`;
1875
+ ? `<div class="ln ${l.c}${l.g ? ' dn' : ''}"><b>${esc(l.n != null ? l.n : l.c === 'add' ? '+' : l.c === 'del' ? '−' : '')}</b>${l.g ? `<i>${esc(l.g)}</i>` : ''}${esc(l.t) || ' '}</div>`
1876
+ : `<div class="tl ${l.c}">${l.c === 'cmd' ? '<span class="ps">❯</span> ' : l.c === 'tool' ? '<span class="dotg">●</span> ' : l.c === 'run' ? '<span class="spin"></span>' : ''}${esc(l.t)}${l.typing ? '<span class="cursor"></span>' : ''}</div>`;
1696
1877
 
1697
1878
  // ---------- screen sharing: a real video-call presentation (window + presenter camera) ----------
1698
- function renderPresent() {
1879
+ function renderPresent(tick) { // tick: a frame of the progressive reveal, the window's content only
1699
1880
  const id = S.present, p = S.agents[id]; if (!p) return; if (S.artPin && !S.arts.has(S.artPin)) { S.artPin = null; armPresent(); }
1700
- const pinned = S.artPin ? S.arts.get(S.artPin) : null, whole = !pinned && S.artWhole ? S.arts.get(S.artWhole) : null, m = pinned ? artModel(pinned, id) : whole ? artModel(whole, id) : termModel(id), shape = m.view === 'web' && pinned ? 'pin' : m.view === 'web' || m.view === 'image' ? 'pic' : '';
1701
- $('#present .pwin').className = 'pwin ' + (m.view === 'term' ? 'term' : m.view); $('#present').classList.toggle('pic', shape === 'pic'); $('#present').classList.toggle('pin', shape === 'pin'); if (shape !== S.picUp) { S.picUp = shape; layout(); } // a picture or a page gets a taller window, a pinned page the tallest
1881
+ const pinned = S.artPin ? S.arts.get(S.artPin) : null, whole = !pinned && S.artWhole ? S.arts.get(S.artWhole) : null, m = pinned ? artModel(pinned, id) : whole ? artModel(whole, id) : termModel(id), shape = m.view === 'web' && pinned ? 'pin' : m.view === 'web' || m.view === 'image' || m.view === 'browser' ? 'pic' : m.shape || '';
1882
+ $('#present .pwin').className = 'pwin ' + (m.view === 'term' ? 'term' : m.view) + (m.live ? ' bglive' : ''); const lv = m.live ? `<b>●</b> ${esc(L('EN DIRECT', 'LIVE'))}` : ''; if ($('#plive').innerHTML !== lv) $('#plive').innerHTML = lv; $('#present').classList.toggle('pic', shape === 'pic'); $('#present').classList.toggle('pin', shape === 'pin'); if (shape !== S.picUp) { S.picUp = shape; layout(); } // a picture or a page gets a taller window, a pinned page the tallest
1702
1883
  $('#ptitle').textContent = m.view === 'term' ? `${p.name} — zsh — 96×24` : m.title;
1703
- const pb = $('#pbody'), shown = m.view === 'image' ? m.imgs.join(' ') : m.view === 'web' ? m.key : ''; pb.dataset.art = m.view === 'web' ? m.a.url : '';
1704
- if (shown) { if (pb.dataset.img !== shown) pb.innerHTML = m.view === 'web' ? artHtml(m) : m.imgs.map((u) => `<img src="${esc(u)}" alt="">`).join('') + (m.more > 0 ? `<span class="pmore">+${m.more}</span>` : ''); } // the same pictures are left in place: redrawing them would make them blink
1705
- else pb.innerHTML = (m.view === 'editor' ? `<div class="ptab"><span>${esc(m.tab.file)}</span><em>${esc(m.tab.path)}</em></div>` : '') + m.lines.map((l) => lineHtml(l, m.view)).join('') + (m.view === 'term' ? '<div class="tl"><span class="ps">❯</span> <span class="cursor"></span></div>' : '');
1706
- pb.dataset.img = shown; pb.scrollTop = m.view === 'term' ? pb.scrollHeight : 0; $('#pstat').textContent = m.stat; if (m.view === 'web') fitArt();
1707
- const td = S.todos[id], el = $('#ptodo'), tk = m.view !== 'web' && td && td.length ? prefs.lang + '\n' + td.map((x) => x.s + ' ' + x.c).join('\n') : ''; el.style.display = tk ? '' : 'none'; $('#present').classList.toggle('has-todo', !!tk);
1884
+ const pb = $('#pbody'), shown = m.html != null ? m.key : m.view === 'image' ? m.imgs.join(' ') : m.view === 'web' ? m.key : m.view === 'browser' ? 'browser' : '', fresh = pb.dataset.img !== shown; pb.dataset.art = m.view === 'web' ? m.a.url : '';
1885
+ let same = false, tail = true; /* same: the window already shows exactly this (a reveal frame with nothing new) · tail: you had not scrolled up */
1886
+ if (shown) { pb.dataset.h = ''; if (fresh) pb.innerHTML = m.html != null ? m.html : m.view === 'web' ? artHtml(m) : m.view === 'browser' ? BROWSER_HTML : m.imgs.map((u) => `<img src="${esc(u)}" alt="">`).join('') + (m.more > 0 ? `<span class="pmore">+${m.more}</span>` : ''); } // the same pictures are left in place: redrawing them would make them blink
1887
+ else { const h = (m.view === 'editor' ? `<div class="ptab"><span>${esc(m.tab.file)}</span>${m.tab.more ? `<em class="pmf">${esc(m.tab.more)}</em>` : ''}<em>${esc(m.tab.path)}</em></div>` : '') + m.lines.map((l) => lineHtml(l, m.view)).join('') + (m.view === 'term' ? '<div class="tl"><span class="ps">❯</span> <span class="cursor"></span></div>' : ''); same = pb.dataset.h === h; if (!same) { tail = pb.scrollHeight - pb.scrollTop - pb.clientHeight < 48; pb.innerHTML = h; pb.dataset.h = h; } }
1888
+ if (m.view === 'browser') paintBrowser(pb, m);
1889
+ if (m.view === 'board' && fresh) checkOff(pb, id);
1890
+ pb.dataset.img = shown; if (!same && (m.html == null || fresh)) { const cur = m.view === 'board' && pb.querySelector('.bt.in_progress'); pb.scrollTop = m.view === 'term' ? (tail || fresh ? pb.scrollHeight : pb.scrollTop) : cur ? Math.max(0, cur.offsetTop - (pb.clientHeight - (parseFloat($('#present').style.getPropertyValue('--camy')) || 0)) / 2) : 0; } $('#pstat').textContent = m.stat; if (m.view === 'web') fitArt(); // a board, a plan or a page keeps where you scrolled it until it changes
1891
+ const td = S.todos[id], el = $('#ptodo'), tk = m.view !== 'web' && m.view !== 'board' && td && td.length ? prefs.lang + '\n' + td.map((x) => x.s + ' ' + x.c).join('\n') : ''; el.style.display = tk ? '' : 'none'; $('#present').classList.toggle('has-todo', !!tk);
1708
1892
  if (tk && el.dataset.k !== tk) { // redrawn only when it changes, so it stays where you scrolled it; the task in progress is brought into view
1709
1893
  el.innerHTML = `<h5>${L('Tâches', 'Tasks')} · ${td.filter((x) => x.s === 'completed').length}/${td.length}</h5>` + td.map((x) => `<div class="td ${x.s}"><i>${x.s === 'completed' ? '☑' : x.s === 'in_progress' ? '◐' : '☐'}</i>${esc(x.c)}</div>`).join('');
1710
1894
  const cur = el.querySelector('.in_progress'); el.scrollTop = cur ? Math.max(0, cur.offsetTop - el.clientHeight / 2) : 0;
1711
1895
  }
1712
1896
  el.dataset.k = tk;
1713
- $('#pbadge').textContent = `🖥 ${p.name} ${L('partage son écran', 'is sharing their screen')}`;
1897
+ $('#pbadge').textContent = m.badge || (id === 'user' ? '🖥 ' + L('Vous partagez votre écran', 'You are sharing your screen') : `🖥 ${p.name} ${L('partage son écran', 'is sharing their screen')}`);
1714
1898
  if (S.camFor !== id) { $('#pcam').innerHTML = avatarSVG(p, undefined, 'c' + p.gid + '_') + `<div class="tag"><b>${esc(p.name)}</b><span class="tk"></span></div>`; S.camFor = id; }
1715
- camTok();
1899
+ if (!tick) camTok(); /* the camera's count changes with the tile's (renderTokens), not 25 times a second */
1716
1900
  $('#pcam').classList.toggle('speaking', S.speakers.has(id));
1901
+ $('#present').classList.toggle('doc', m.html != null); camRoom();
1902
+ }
1903
+ function camRoom() { // the presenter's camera and the caption sit over the bottom right of the window: a board, a page, a plan or a test run leaves them room, beside it when the window is wide enough, else under its last line
1904
+ const pr = $('#present'), doc = pr.classList.contains('doc') && pr.classList.contains('on'); let x = 0, y = 0; pr.classList.remove('camr');
1905
+ if (doc) {
1906
+ const td = $('#ptodo'), cam = $('#pcam'); if (pr.classList.contains('has-todo') && td.offsetHeight) { const t = td.getBoundingClientRect(), p = pr.getBoundingClientRect(); if (t.bottom + 10 < p.bottom - 22 - cam.offsetHeight) pr.classList.add('camr'); } /* a short task list leaves the camera its usual corner */
1907
+ const b = $('#pbody').getBoundingClientRect(), c = cam.getBoundingClientRect(), cap = $('#pcap'), k = cap.textContent ? cap.getBoundingClientRect() : null;
1908
+ if (c.width && c.left < b.right && c.top < b.bottom && c.right > b.left) { const over = b.right - c.left + 10; if (b.width - over >= 300) x = over; else y = b.bottom - c.top + 8; }
1909
+ if (k && k.width && k.top < b.bottom && k.right > b.left) y = Math.max(y, b.bottom - k.top + 8);
1910
+ }
1911
+ const vx = Math.round(x) + 'px', vy = Math.round(y) + 'px'; if (pr.style.getPropertyValue('--camx') !== vx) pr.style.setProperty('--camx', vx); if (pr.style.getPropertyValue('--camy') !== vy) pr.style.setProperty('--camy', vy);
1912
+ }
1913
+ new ResizeObserver(() => camRoom()).observe($('#present')); new ResizeObserver(() => camRoom()).observe($('#pcap'));
1914
+ function checkOff(pb, id) { // a task that has just been done is ticked off before your eyes (once: the board remembers what it showed last)
1915
+ const was = (S.boardWas = S.boardWas || {})[id] || {}, at = ((S.boardJust = S.boardJust || {})[id] = S.boardJust[id] || {}), now = {}, t = performance.now();
1916
+ pb.querySelectorAll('.bt').forEach((el) => {
1917
+ const k = el.dataset.k.replace(/^\d+\|/, ''), s = el.classList.contains('completed') ? 'completed' : el.classList.contains('in_progress') ? 'in_progress' : 'pending'; now[k] = s;
1918
+ if (s === 'completed' && was[k] && was[k] !== 'completed') at[k] = t; const dt = s === 'completed' && at[k] ? t - at[k] : 1e9;
1919
+ if (dt < 1000) { el.classList.add('just'); el.style.setProperty('--jd', -Math.round(dt) + 'ms'); } /* redrawn in the meantime (the next call came in): the tick goes on where it was */
1920
+ });
1921
+ S.boardWas[id] = now;
1717
1922
  }
1718
1923
  function armPresent() { // stays up while a command is still running, then ~4 s after the last action (~9 s when it shows a picture, ~20 s for the page of an artifact; a pinned page stays until it is closed)
1719
1924
  clearTimeout(presentTimer); if (S.hold || S.artPin) return;
@@ -1721,6 +1926,7 @@ function armPresent() { // stays up while a command is still running, then ~4
1721
1926
  }
1722
1927
  function showPresent(id, keep) { // keep: the whole document that is being shown (see shareWhole); anything else the agent does takes its place
1723
1928
  if (!keep) S.artWhole = null; if (S.artPin || S.boost > 1 || (S.speakers.size && !S.speakers.has(id))) return; // a page you pinned stays up · catching up, or someone else has the floor
1929
+ if (S.present === 'user' && id !== 'user' && performance.now() < (S.youUntil || 0)) return; /* the pictures you pasted stay up a few seconds, whatever the lead starts on */
1724
1930
  const first = S.present !== id; S.present = id; $('#present').classList.add('on'); document.body.classList.add('presenting'); document.querySelectorAll('.tile.presenter').forEach((t) => t.classList.remove('presenter')); const pt = $('#t-' + id); if (pt) pt.classList.add('presenter'); renderPresent(); if (first) { layout(); AUD.tone(880, .12, 'sine', .05); }
1725
1931
  armPresent();
1726
1932
  }
@@ -1728,6 +1934,27 @@ function hidePresent() {
1728
1934
  clearTimeout(presentTimer); if (!S.present || S.artPin) return; S.artWhole = null; if ($('#pbody').dataset.art) { $('#pbody').innerHTML = ''; $('#pbody').dataset.img = $('#pbody').dataset.art = ''; } /* the page of an artifact does not go on running behind a closed window */
1729
1935
  S.present = null; $('#present').classList.remove('on'); document.body.classList.remove('presenting'); document.querySelectorAll('.tile.presenter').forEach((t) => t.classList.remove('presenter')); $('#pcap').textContent = ''; layout();
1730
1936
  }
1937
+ // The pictures you pasted in a message: shared from your own camera while your line is said, for a few seconds (the server serves them as /api/media of agent "user")
1938
+ function showYourPics(g) {
1939
+ if (!S.cur || S.demo || S.boost > 1) return; const buf = (S.term.user = S.term.user || []);
1940
+ if (!buf.some((x) => x.id === g.iid)) { buf.push({ k: 'upic', id: g.iid, ts: g.ts, tool: { name: nameOf('user'), d: {} }, out: '', err: false, end: g.ts, img: Math.min(+g.img, 9), picAt: performance.now(), say: plain(String(g.text || '')).slice(0, 160) }); if (buf.length > 10) buf.shift(); }
1941
+ S.youUntil = 0; showPresent('user'); if (S.present === 'user') S.youUntil = performance.now() + 8000 / Math.max(1, spd());
1942
+ }
1943
+ // A command that went on in the background (run_in_background, Monitor): while its agent's terminal is on screen, live, what it writes is read every second from the server (GET /api/taskout, the file Claude Code writes it to on this computer), until it ends
1944
+ let taskPollBusy = false;
1945
+ setInterval(async () => {
1946
+ if (!S.live || S.demo || !S.cur || document.hidden || taskPollBusy || (S.present && !$('#present .pwin').classList.contains('term'))) return;
1947
+ let who = S.present, e = who && (S.term[who] || []).slice(-10).reverse().find((x) => x.bg && !x.bgDone);
1948
+ if (!who) { if (S.speakers.size || S.boost > 1 || S.artPin) return; for (const id in S.term) { e = S.term[id].slice(-10).reverse().find((x) => x.bg && !x.bgDone && !x.bgSeen); if (e) { who = id; break; } } } /* nobody shares: a command still at work in the background (started before the page opened, or after the turn ended) is shared once, if it still writes */
1949
+ if (!e) return; const cur = S.cur, share = S.present !== who; taskPollBusy = true;
1950
+ try {
1951
+ const r = await fetch(`/api/taskout?proj=${encodeURIComponent(cur.proj)}&id=${encodeURIComponent(cur.id)}&task=${encodeURIComponent(e.bg)}`); if (S.cur !== cur) return;
1952
+ if (!r.ok) { e.bgDone = true; if (S.present === who) renderPresent(); return; } // 404: no such output here (another computer, cleaned up): nothing to stream
1953
+ e.bgFail = 0; const j = await r.json(), was = e.bgOut ? e.bgOut.text + '|' + e.bgOut.done : ''; e.bgOut = { text: String(j.text || ''), done: !!j.done, code: j.code == null ? null : +j.code }; if (j.done) e.bgDone = true;
1954
+ if (share) { e.bgSeen = true; if (j.done || !(Date.now() - (+j.mtime || 0) < 20000) || S.present) return; showPresent(who); if (S.present !== who) return; } /* still writing, and still nobody else on screen */
1955
+ if (was !== e.bgOut.text + '|' + e.bgOut.done && S.present === who) { renderPresent(); if (!e.bgAt) e.bgAt = Date.now(); if (Date.now() - e.bgAt < 60000) armPresent(); } // new lines keep the window up, for a minute at most
1956
+ } catch { e.bgFail = (e.bgFail || 0) + 1; if (e.bgFail >= 3) e.bgDone = true; } finally { taskPollBusy = false; } /* three failures in a row: given up */
1957
+ }, 1000);
1731
1958
  // ---------- artifacts: the pages the session published on claude.ai, shown the way a call shows a browser window someone shares ----------
1732
1959
  // When a publish succeeds its author shares the page for a moment; afterwards it is in the line of files, and a click there pins it: the window takes the room, stays until you close it (✕, Esc),
1733
1960
  // follows the next versions and steps through the other artifacts of the session (‹ ›). The page itself comes from the server, which puts it together from the session file (claude.ai lets nobody frame it):
@@ -1805,8 +2032,10 @@ function candFile(file, id, agent) {
1805
2032
  function askMade(c) { // once per file and per turn in which it is named: a command that runs in the background may write it after the first time it is named
1806
2033
  const key = c.want + '|' + c.file, ok = S.fmade.get(key), cur = S.cur; if (ok === true) { S.files.set(c.file, { file: c.file, name: c.name, id: c.id, agent: c.agent, turn: c.want, named: true, cmd: true }); return; }
1807
2034
  if (ok !== undefined || S.demo || !cur) return; S.fmade.set(key, null);
1808
- fetch('/api/reveal', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: cur.proj, id: cur.id, file: c.file, check: true }) }).then((r) => { if (S.cur !== cur) return; S.fmade.set(key, r.ok); if (r.ok) paintFiles(); }).catch(() => { if (S.cur === cur) S.fmade.delete(key); });
2035
+ fetch('/api/reveal', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: cur.proj, id: cur.id, file: c.file, check: true }) }).then(revealAns).then((a) => { if (S.cur !== cur) return; S.fmade.set(key, a.ok); if (a.ok) paintFiles(); }).catch(() => { if (S.cur === cur) S.fmade.delete(key); });
1809
2036
  }
2037
+ // What /api/reveal answered: 200 { ok } when the file is there; for one that is not, an older server says 404 (not made by this session) or 410 (made, and gone), a newer one 200 { exists: false, reason }, which the browser does not log as an error
2038
+ const revealAns = async (r) => { if (!r) return { ok: false }; let b = null; try { b = await r.json(); } catch {} return b && b.exists === false ? { ok: false, gone: /gone|removed|deleted|no longer/i.test(String(b.reason || '')) } : { ok: r.ok, gone: r.status === 410 }; };
1810
2039
  const turnDone = () => S.events.length > 0 && !S.locked && (S.live ? agentState('main', Date.now()).k === 'done' : !!S.turnOver || S.idx >= S.events.length - 1); // replay: the mark that closes the lead's turn, or the end of a session that has none
1811
2040
  const fileTip = (f) => `${f.file}\n${f.agent !== 'main' && S.agents[f.agent] ? nameOf(f.agent) + ' · ' : ''}${S.fgone.has(f.file) ? L('Ce fichier n’existe plus', 'This file is no longer there') : L('Cliquer pour l’afficher dans son dossier', 'Click to show it in its folder')}`;
1812
2041
  const fileCls = (f) => (f.turn === S.turnN ? ' new' : '') + (S.fgone.has(f.file) ? ' gone' : '');
@@ -1828,8 +2057,8 @@ function filesPop(open) { // the whole list, above the line: every file with t
1828
2057
  async function revealFile(file) {
1829
2058
  if (S.demo || !S.cur) { toast(L('Fichier de la démo : rien à ouvrir', 'A file of the demo: nothing to open')); return; }
1830
2059
  let r = null; try { r = await fetch('/api/reveal', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: S.cur.proj, id: S.cur.id, file }) }); } catch {}
1831
- if (r && r.ok) { if (S.fgone.delete(file)) paintFiles(); return; }
1832
- if (r && r.status === 410) { S.fgone.add(file); paintFiles(); toast(L('Ce fichier n’existe plus', 'This file is no longer there')); } else toast(L('Impossible d’ouvrir le dossier', 'Could not open the folder'));
2060
+ const a = await revealAns(r); if (a.ok) { if (S.fgone.delete(file)) paintFiles(); return; }
2061
+ if (a.gone) { S.fgone.add(file); paintFiles(); toast(L('Ce fichier n’existe plus', 'This file is no longer there')); } else toast(L('Impossible d’ouvrir le dossier', 'Could not open the folder'));
1833
2062
  }
1834
2063
  function filesClick(e) { const a = e.target.closest('[data-a]'), f = e.target.closest('[data-f]'); if (a) pinArt(a.dataset.a); else if (f) revealFile(f.dataset.f); else if (e.target.closest('.sfh, .more')) filesPop(!$('#fpop')); }
1835
2064
  $('#files').onclick = filesClick;
@@ -2052,7 +2281,7 @@ function renderDetail() {
2052
2281
  if (!S.detail) return; const id = S.detail, evs = S.events.slice(0, S.idx + 1).filter((e) => e.agent === id || e.to === id);
2053
2282
  const order = evs.find((e) => e.kind === 'order' && e.to === id), tools = evs.filter((e) => e.agent === id && e.kind === 'tools').flatMap((e) => e.tools);
2054
2283
  const counts = {}; tools.forEach((t) => (counts[t.name] = (counts[t.name] || 0) + 1));
2055
- const u = S.usage[id], tokHtml = u && tokTotal(u) ? `<h3>${L('Jetons', 'Tokens')} · ⚡ ${fmtTok(tokTotal(u))}</h3><div class="dim">${L('entrée', 'input')} ${fmtTok(u.i)} · ${L('sortie', 'output')} ${fmtTok(u.o)} · ${L('écriture cache', 'cache write')} ${fmtTok(u.w)} · ${L('lecture cache', 'cache read')} ${fmtTok(u.r)}${modelShort(S.model[id]) ? ` · ${L('Modèle', 'Model')} ${esc(S.model[id])}` : ''}</div>` : '';
2284
+ const u = S.usage[id], tokHtml = u && tokTotal(u) ? `<h3>${L('Jetons', 'Tokens')} · ⚡ ${fmtTok(tokTotal(u))}</h3><div class="dim">${L('entrée', 'input')} ${fmtTok(u.i)} · ${L('sortie', 'output')} ${fmtTok(u.o)} · ${L('écriture cache', 'cache write')} ${fmtTok(u.w)} · ${L('lecture cache', 'cache read')} ${fmtTok(u.r)}${modelShort(S.model[id]) ? ` · ${L('Modèle', 'Model')} ${esc(S.model[id])}${esc(effortOf(id))}${advisorOf(id) ? ' · ' + esc(advisorOf(id)) : ''}` : ''}</div>` : '';
2056
2285
  $('#dbody').innerHTML = tokHtml + (order ? `<h3>${L('Consigne de', 'Prompt from')} ${esc(nameOf(order.agent))}</h3><pre>${esc(order.text)}</pre>` : '') +
2057
2286
  (id === 'user' ? (S.idleHtml = (S.idleFor === S.detailOpen && S.idleHtml) || idleHtml(), S.idleFor = S.detailOpen, S.idleHtml) : `<h3>${L('Outils', 'Tools')} (${tools.length})</h3><div>${Object.entries(counts).map(([n, c]) => `${esc(n)} ×${c}`).join(' · ') || '—'}</div>` +
2058
2287
  `<h3>${L('Activité récente', 'Recent activity')}</h3>` + (S.term[id] || []).slice(-30).reverse().map((e) => `<details><summary>${e.end == null ? '⠋' : e.err ? '✗' : '✓'} ${esc(e.tool.name)} <span class="dim">${e.end != null ? fmtDur(e.end - e.ts) : L('en cours', 'running')}</span> — ${esc((e.tool.arg || '').slice(-60))}</summary><pre>${esc((e.tool.d && e.tool.d.kind === 'cmd' ? '$ ' + e.tool.d.text + '\n' : '') + (e.out || ''))}</pre>${e.img && S.cur ? `<img class="dimg" src="${esc(mediaUrl(id, e.id, 0))}" alt="" loading="lazy">` : ''}</details>`).join('')) +
@@ -2115,7 +2344,7 @@ function rateDay() { // a day of use: the page in view that day
2115
2344
  rateTip();
2116
2345
  }
2117
2346
  function rateTip() {
2118
- const t = $('#rateTip'); if (!RATE_ASKS || prefs.rateDone || firstDay() || askedToday('rate') || (+prefs.rateDays || 0) < 3 || (prefs.rateLater && utcDay() < prefs.rateLater) || $('#menuTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; }
2347
+ const t = $('#rateTip'); if (!RATE_ASKS || prefs.rateDone || firstDay() || askedToday('rate') || (+prefs.rateDays || 0) < 3 || (prefs.rateLater && utcDay() < prefs.rateLater) || $('#menuTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; }
2119
2348
  const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
2120
2349
  $('#rateTipT').textContent = L('Agent Standup vous plaît ? Une étoile sur GitHub aide d’autres personnes à le trouver.', 'Enjoying Agent Standup? A star on GitHub helps other people find it.');
2121
2350
  $('#rateYes').textContent = L('⭐ Mettre une étoile', '⭐ Star it'); $('#rateLater').textContent = L('Plus tard', 'Later'); $('#rateNo').textContent = L('Non merci', 'No thanks');
@@ -2132,7 +2361,7 @@ function coffeeAsk(busyAt) {
2132
2361
  const now = Date.now(), team = Object.keys(S.agents).filter((id) => id !== 'main' && id !== 'user' && S.lastAct[id] >= busyAt).length;
2133
2362
  if (!(now - busyAt >= 10 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
2134
2363
  if ($('#rateTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || rateTip.seen === utcDay() || prefs.rateDone === utcDay() || (RATE_ASKS && !prefs.rateDone && prefs.rateLast === utcDay() && (+prefs.rateDays || 0) >= 3)) return; /* the star shown, given or declined today */
2135
- clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
2364
+ clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
2136
2365
  }
2137
2366
  function coffeeTip() {
2138
2367
  const at = [$('#bCoffee'), $('#bMenu')].find((b) => b.getBoundingClientRect().width), t = $('#coffeeTip'); if (!at) return;
@@ -2148,7 +2377,7 @@ document.addEventListener('visibilitychange', coffeeDay); setInterval(coffeeDay,
2148
2377
  // it? "Count me in" turns prefs.shareUsage on; then, each time the call is opened, the server sends at most one empty request a week (server.js, usageWeek). Any other answer leaves it
2149
2378
  // off and it is not asked again; ⚙ › All settings turns it on or off. Never asked, and nothing sent, with DO_NOT_TRACK set (APP.track), in a demo or embedded.
2150
2379
  const USAGE_ASKS = ['desktop', 'cli', 'plugin'].includes(APP.kind) && APP.track !== false && !EMBED && !Q.get('demo');
2151
- function usageOpened(fresh) { if (USAGE_ASKS && prefs.shareUsage === true && !document.hidden) (fresh ? fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(prefs) }) : Promise.resolve()).then(() => fetch('/api/usage', { method: 'POST' })).catch(() => {}); } /* the server sends it once a week at most, and only once the settings file says yes: fresh, just answered, writes it there first (savePrefs waits 400 ms) */
2380
+ function usageOpened(fresh) { if (USAGE_ASKS && prefs.shareUsage === true && !document.hidden) (fresh ? fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: prefsOut() }) : Promise.resolve()).then(() => fetch('/api/usage', { method: 'POST' })).catch(() => {}); } /* the server sends it once a week at most, and only once the settings file says yes: fresh, just answered, writes it there first (savePrefs waits 400 ms) */
2152
2381
  function usagePending() { return USAGE_ASKS && !prefs.usageAsked && prefs.shareUsage !== true; } // the usage question, not answered yet: it has its first day to itself, then takes turns with the Halloween pack's line
2153
2382
  function usageStart() {
2154
2383
  if (!USAGE_ASKS) return; $('#mShare').style.display = ''; usageOpened();
@@ -2156,7 +2385,7 @@ function usageStart() {
2156
2385
  }
2157
2386
  function usageTip() {
2158
2387
  const t = $('#usageTip'); if (!USAGE_ASKS || prefs.usageAsked || prefs.shareUsage === true || firstDay() || document.hidden || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; } /* firstDay: like every ask, not the first day the app is used */
2159
- if ($('#menuTip').style.display !== 'none') { usageStart.t = setTimeout(usageTip, 4000); return; } /* after the tip about the moved menu */
2388
+ if ($('#menuTip').style.display !== 'none' || $('#updTip').style.display !== 'none') { usageStart.t = setTimeout(usageTip, 4000); return; } /* after the tip about the moved menu, or about a new version */
2160
2389
  if (prefs.askDay === utcDay() && prefs.askWhat === 'pack') { t.style.display = 'none'; return; } /* the Halloween pack's day: one ask at a time, this one comes back on the next */
2161
2390
  const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
2162
2391
  $('#rateTip').style.display = 'none'; $('#coffeeTip').style.display = 'none'; noteAsk('usage'); if (!prefs.usageDay) { prefs.usageDay = utcDay(); savePrefs(); }
@@ -2167,6 +2396,49 @@ function usageTip() {
2167
2396
  const usageAnswer = (yes) => { prefs.shareUsage = yes; prefs.usageAsked = true; savePrefs(); $('#usageTip').style.display = 'none'; syncSwitches(); document.querySelectorAll('.mi[data-t="shareUsage"] .sw').forEach((x) => x.classList.toggle('on', yes)); if (yes) usageOpened(true); };
2168
2397
  $('#usageYes').onclick = () => usageAnswer(true); $('#usageNo').onclick = () => usageAnswer(false); $('#usageRead').onclick = () => openExternal('https://agent-standup.com/privacy/');
2169
2398
  document.addEventListener('visibilitychange', () => { if (!document.hidden) { usageOpened(); if (USAGE_ASKS && !prefs.usageAsked && prefs.shareUsage !== true && $('#usageTip').style.display === 'none') usageStart(); } });
2399
+ // A newer version, in the desktop app, the command line and the Claude Code plugin (the editor updates itself from its store). Off until the person says yes: the page asks once, by the menu,
2400
+ // from the second day and on a day nothing else was asked, once the usage question is answered ("Yes, tell me" turns prefs.updateNotice on; any other answer leaves it off and it is not asked
2401
+ // again; ⚙ › All settings turns it on or off). Then the server asks npm at most once a day which version is the latest (server.js, updateInfo, which reads the answer again in the settings
2402
+ // file) and this page shows it once per version, with the step that updates this app: download the desktop app again, update the plugin, or the npx / npm command to copy. "Later" hides it
2403
+ // until the next version. One tip at a time by the menu; never asked with DO_NOT_TRACK or NO_UPDATE_NOTIFIER set (APP.updates), in a demo or embedded.
2404
+ const UPD_SHOWS = ['desktop', 'cli', 'plugin'].includes(APP.kind) && APP.updates !== false && APP.track !== false && !EMBED && !Q.get('demo');
2405
+ const tipsBusy = () => document.hidden || $('#menu').classList.contains('on') || ['#menuTip', '#usageTip', '#rateTip', '#coffeeTip'].some((s) => $(s).style.display !== 'none');
2406
+ function updStart() {
2407
+ if (!UPD_SHOWS) return; $('#mUpd').style.display = '';
2408
+ if (prefs.updateNotice !== true) { clearTimeout(updAsk.t); if (!prefs.updateAsked) updAsk.t = setTimeout(updAsk, 6000); return; } /* after the usage question, which waits 2.5 s */
2409
+ if (updStart.u) return updTip(0); /* known already: shown again in the language just chosen */
2410
+ if (document.hidden || Date.now() - (updStart.at || 0) < 3600e3) return; updStart.at = Date.now();
2411
+ clearTimeout(updStart.t); updStart.t = setTimeout(() => fetch('/api/update').then((r) => r.json()).then((u) => { if (u && u.newer && typeof u.latest === 'string') { updStart.u = u; updTip(0); } }).catch(() => {}), 3000);
2412
+ }
2413
+ function updAsk() {
2414
+ const t = $('#updTip'); if (!UPD_SHOWS || prefs.updateNotice === true || prefs.updateAsked || firstDay() || usagePending() || askedToday('update') || tipsBusy()) return; /* like every ask: not the first day, one ask a day; it comes back with the next day the page is in view */
2415
+ const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
2416
+ noteAsk('update'); updTip.mode = 'ask';
2417
+ $('#updTipT').textContent = L('Être prévenu quand une nouvelle version d’Agent Standup sort ? Au plus une fois par jour, l’app demanderait à npm le numéro de la dernière version : rien sur vous ni sur vos sessions. npm voit votre adresse IP, comme pour tout téléchargement. Vous pouvez l’arrêter quand vous voulez dans ⚙ › Tous les réglages.', 'Get told when a new version of Agent Standup is out? At most once a day, the app would ask npm for the number of the latest version: nothing about you or your sessions. npm sees your IP address, as with any download. You can turn it off any time in ⚙ › All settings.');
2418
+ $('#updCmd').style.display = 'none'; $('#updNotes').textContent = L('Confidentialité', 'Privacy policy'); $('#updLater').textContent = L('Non merci', 'No thanks'); $('#updGo').textContent = L('Oui, prévenez-moi', 'Yes, tell me');
2419
+ updPlace(t, r);
2420
+ }
2421
+ const updPlace = (t, r) => { t.style.display = ''; t.style.top = Math.round(r.bottom + 10) + 'px'; t.style.right = Math.max(8, Math.round(innerWidth - r.right - 6)) + 'px'; t.style.setProperty('--ax', Math.max(8, Math.round(r.width / 2 - 2)) + 'px'); };
2422
+ function updTip(n) {
2423
+ const t = $('#updTip'), u = updStart.u; clearTimeout(updTip.t); if (!u || prefs.updateNotice !== true || prefs.updSeen === u.latest) { t.style.display = 'none'; return; }
2424
+ if (tipsBusy()) { t.style.display = 'none'; if (n < 40) updTip.t = setTimeout(() => updTip(n + 1), 15000); return; } /* after the other tips by the menu */
2425
+ const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return; updTip.mode = 'tell';
2426
+ const step = u.how === 'download' ? L('Téléchargez la nouvelle app sur GitHub.', 'Download the new app from GitHub.') : u.how === 'plugin' ? L('Mettez le plugin à jour dans un terminal, puis redémarrez Claude Code :', 'Update the plugin in a terminal, then restart Claude Code:') : u.how === 'npx' ? L('La prochaine fois, lancez-le avec :', 'Next time, start it with:') : L('Mettez-le à jour avec :', 'Update it with:');
2427
+ $('#updTipT').textContent = L('Agent Standup {0} est sorti (vous avez la {1}).', 'Agent Standup {0} is out (you have {1}).').replace('{0}', () => u.latest).replace('{1}', () => u.current) + ' ' + step;
2428
+ $('#updCmd').textContent = u.cmd || ''; $('#updCmd').style.display = u.cmd ? '' : 'none';
2429
+ $('#updNotes').textContent = L('Nouveautés', 'What’s new'); $('#updLater').textContent = L('Plus tard', 'Later'); $('#updGo').textContent = u.how === 'download' ? L('Télécharger', 'Download') : L('Copier', 'Copy');
2430
+ updPlace(t, r);
2431
+ }
2432
+ const updEnd = () => { if (updStart.u) prefs.updSeen = updStart.u.latest; savePrefs(); $('#updTip').style.display = 'none'; };
2433
+ const updAnswer = (yes) => { prefs.updateNotice = yes; prefs.updateAsked = true; savePrefs(); $('#updTip').style.display = 'none'; syncSwitches(); document.querySelectorAll('.mi[data-t="updateNotice"] .sw').forEach((x) => x.classList.toggle('on', yes)); if (yes) { updStart.at = 0; setTimeout(updStart, 600); } }; /* yes: asked once the settings file says so (savePrefs waits 400 ms) */
2434
+ $('#updLater').onclick = () => (updTip.mode === 'ask' ? updAnswer(false) : updEnd()); $('#updNotes').onclick = () => (updTip.mode === 'ask' ? openExternal('https://agent-standup.com/privacy/') : updStart.u && openExternal(updStart.u.notes));
2435
+ $('#updGo').onclick = async () => {
2436
+ if (updTip.mode === 'ask') return updAnswer(true);
2437
+ const u = updStart.u; if (!u) return; if (u.how === 'download') { openExternal(u.url); return updEnd(); }
2438
+ let ok = false; try { await navigator.clipboard.writeText(u.cmd); ok = true; } catch { try { const ta = document.createElement('textarea'); ta.value = u.cmd; ta.style.cssText = 'position:fixed;opacity:0'; document.body.appendChild(ta); ta.select(); ok = document.execCommand('copy'); ta.remove(); } catch {} }
2439
+ $('#updGo').textContent = ok ? L('Copié', 'Copied') : L('Sélectionnez la commande', 'Select the command'); if (ok) setTimeout(updEnd, 1500);
2440
+ };
2441
+ document.addEventListener('visibilitychange', () => { if (!document.hidden && UPD_SHOWS && !updStart.u) updStart(); }); setInterval(() => { if (UPD_SHOWS && !updStart.u) updStart(); }, 6 * 3600e3); // the desktop window can stay open for days
2170
2442
 
2171
2443
  // =====================================================================
2172
2444
  // recap
@@ -2177,7 +2449,7 @@ const fmt = (ms) => { const s = Math.round(ms / 1000), m = Math.floor(s / 60), h
2177
2449
  function computeHighlights() {
2178
2450
  const out = [], ev = S.events; let firstErr = -1, gap = { ms: 0, i: -1 }, prevT = null, comp = [], R = {}, loops = [];
2179
2451
  ev.forEach((e, i) => {
2180
- if (e.kind === 'usage' || e.kind === 'finish') return;
2452
+ if (e.kind === 'usage' || e.kind === 'finish' || e.kind === 'tasks') return;
2181
2453
  if (e.kind === 'results' && firstErr < 0 && e.items.some((it) => it.err)) firstErr = i;
2182
2454
  if (e.kind === 'compact') comp.push(i);
2183
2455
  if (prevT != null && e.kind !== 'user' && e.t - prevT <= 3600000 && e.t - prevT > gap.ms) gap = { ms: e.t - prevT, i }; // a wait for the human (the next event is their prompt) is not an agent wait
@@ -2202,9 +2474,9 @@ function renderHighlights() {
2202
2474
  }
2203
2475
  $('#hl').onclick = (e) => { const b = e.target.closest('.hlc'); if (b && !S.live) seekTo(+b.dataset.i); };
2204
2476
  function openRecap() {
2205
- const per = {}, files = {}, mdl = {}; let tools = 0, cmds = 0, errs = 0; const tk = {}, A = (id) => (per[id] = per[id] || { id, tools: 0, files: new Set(), t0: null, t1: null });
2477
+ const per = {}, files = {}, mdl = {}, eff = {}; let tools = 0, cmds = 0, errs = 0; const tk = {}, A = (id) => (per[id] = per[id] || { id, tools: 0, files: new Set(), t0: null, t1: null });
2206
2478
  S.events.forEach((e) => {
2207
- if (e.kind === 'usage' && e.model && e.model[0] !== '<') mdl[e.agent] = e.model; /* not <synthetic>, as in tally */
2479
+ if (e.kind === 'usage' && e.model && e.model[0] !== '<') { mdl[e.agent] = e.model; if (e.ef) eff[e.agent] = e.ef; } /* not <synthetic>, as in tally */
2208
2480
  if (e.kind === 'usage') { const u = (tk[e.agent] = tk[e.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += e.u.i; u.o += e.u.o; u.r += e.u.r; u.w += e.u.w; }
2209
2481
  if (e.kind === 'results') e.items.forEach((it) => { if (it.err) errs++; });
2210
2482
  if (e.kind === 'order') A(e.to).t0 = e.t; if (e.kind === 'report') A(e.agent).t1 = e.t;
@@ -2215,14 +2487,14 @@ function openRecap() {
2215
2487
  const k = (v, l) => `<div class="kpi"><b>${v}</b><span>${l}</span></div>`, totTok = Object.values(tk).reduce((n, u) => n + tokTotal(u), 0);
2216
2488
  const RW = {}; S.events.forEach((e) => wasteStep(RW, e)); const wl = Object.entries(RW.items || {}).filter(([id]) => S.agents[id]).flatMap(([id, l]) => l.map((it) => [id, it]));
2217
2489
  $('#recap .box').innerHTML = `<h1>${L('Récap de l’épisode', 'Episode recap')}</h1>
2218
- <div class="kpis">${k(Math.max(0, Object.keys(S.agents).length - 2), 'agents')}${k(tools, L('appels d’outils', 'tool calls'))}${k(cmds, L('commandes', 'commands'))}${k(errs, L('outils en erreur', 'tool errors'))}${wl.length ? k('♻ ' + wl.length, L('travail répété', 'repeated work')) : ''}${totTok ? k('⚡ ' + fmtTok(totTok), L('jetons', 'tokens')) : ''}${k(Object.keys(files).length, L('fichiers modifiés', 'files changed'))}${k(fmt(last), L('durée', 'duration'))}</div>
2490
+ <div class="kpis">${k(Math.max(0, Object.keys(S.agents).length - 2), L('agents', 'agents'))}${k(tools, L('appels d’outils', 'tool calls'))}${k(cmds, L('commandes', 'commands'))}${k(errs, L('outils en erreur', 'tool errors'))}${wl.length ? k('♻ ' + wl.length, L('travail répété', 'repeated work')) : ''}${totTok ? k('⚡ ' + fmtTok(totTok), L('jetons', 'tokens')) : ''}${S.cost ? `<div class="kpi" title="${esc(costTip())}"><b>💵 ${esc(costStr(S.cost))}</b><span>${L('coût', 'cost')}</span></div>` : ''}${k(Object.keys(files).length, L('fichiers modifiés', 'files changed'))}${k(fmt(last), L('durée', 'duration'))}</div>
2219
2491
  <h3>${L('Agents les plus actifs', 'Busiest agents')}</h3><table><tr><th></th><th>${L('Rôle', 'Role')}</th><th>${L('Outils', 'Tools')}</th><th>${L('Fichiers', 'Files')}</th><th>${L('Jetons', 'Tokens')}</th><th>${L('Modèle', 'Model')}</th><th>${L('Durée', 'Time')}</th></tr>
2220
- ${rows.map((a) => `<tr><td><b>${esc(nameOf(a.id))}</b></td><td>${esc(S.agents[a.id].role)}</td><td>${a.tools}</td><td>${a.files.size || ''}</td><td title="${tk[a.id] ? esc(tokTip(tk[a.id])) : ''}">${tk[a.id] ? '⚡ ' + fmtTok(tokTotal(tk[a.id])) : ''}</td><td>${esc(modelShort(mdl[a.id]))}</td><td>${a.t0 != null && a.t1 != null ? fmt(a.t1 - a.t0) : ''}</td></tr>`).join('')}</table>
2492
+ ${rows.map((a) => `<tr><td><b>${esc(nameOf(a.id))}</b></td><td>${esc(S.agents[a.id].role)}</td><td>${a.tools}</td><td>${a.files.size || ''}</td><td title="${tk[a.id] ? esc(tokTip(tk[a.id])) : ''}">${tk[a.id] ? '⚡ ' + fmtTok(tokTotal(tk[a.id])) : ''}</td><td>${esc(modelShort(mdl[a.id]))}${modelShort(mdl[a.id]) && eff[a.id] ? ' · ' + esc(effortWord(eff[a.id])) : ''}</td><td>${a.t0 != null && a.t1 != null ? fmt(a.t1 - a.t0) : ''}</td></tr>`).join('')}</table>
2221
2493
  <h3>${L('Fichiers touchés', 'Files touched')}</h3>${fl.length ? `<table>${fl.map(([f, v]) => `<tr><td class="f">${esc(f)}</td><td>×${v.n}</td><td>${esc([...v.who].join(', '))}</td></tr>`).join('')}</table>` : `<div class="dim">${L('Aucune modification.', 'No edits.')}</div>`}
2222
2494
  ${wl.length ? `<h3>${L('Travail répété', 'Repeated work')}</h3><table>${wl.slice(0, 30).map(([id, it]) => `<tr><td><b>${esc(nameOf(id))}</b></td><td>${esc(wasteLine(it))}</td></tr>`).join('')}</table>` : ''}
2223
2495
  ${SUPPORT.url ? `<div class="coffee"><span>${esc(coffeeMsg())}</span><button class="btn" id="recapCoffee">☕ ${L('Offrir un café', 'Buy a coffee')}</button></div>` : ''}
2224
2496
  <p style="text-align:right;margin:18px 0 0"><button class="btn" id="recapMd">📋 ${L('Copier en Markdown', 'Copy as Markdown')}</button> <button class="cta" id="recapx">${L('Fermer', 'Close')}</button></p>`;
2225
- const md = [`# Agent Standup — ${S.title || L('épisode', 'session')}`, `_${new Date().toLocaleString()}_ · ${Math.max(0, Object.keys(S.agents).length - 2)} agents · ${tools} ${L('appels d’outils', 'tool calls')} · ${cmds} ${L('commandes', 'commands')} · ${errs} ${L('erreurs', 'errors')}${totTok ? ' · ⚡ ' + fmtTok(totTok) + ' tokens' : ''}`, '', '## Standup'];
2497
+ const md = [`# Agent Standup — ${S.title || L('épisode', 'session')}`, `_${new Date().toLocaleString()}_ · ${Math.max(0, Object.keys(S.agents).length - 2)} agents · ${tools} ${L('appels d’outils', 'tool calls')} · ${cmds} ${L('commandes', 'commands')} · ${errs} ${L('erreurs', 'errors')}${totTok ? ' · ⚡ ' + fmtTok(totTok) + ' tokens' : ''}${S.cost ? ' · 💵 ' + costStr(S.cost) : ''}`, '', '## Standup'];
2226
2498
  rows.forEach((a) => { let rep = ''; for (let i = S.events.length - 1; i >= 0; i--) { const e = S.events[i]; if (e.agent === a.id && (e.kind === 'report' || (a.id === 'main' && e.kind === 'say'))) { rep = spoken(e).replace(/\s+/g, ' ').trim().slice(0, 240); break; } }
2227
2499
  md.push(`- **${nameOf(a.id)}** (${S.agents[a.id].role}) — ${a.tools} ${L('outils', 'tools')}${a.files.size ? `, ${a.files.size} ${L('fichiers', 'files')}` : ''}${tk[a.id] ? `, ⚡ ${fmtTok(tokTotal(tk[a.id]))}` : ''}${rep ? `\n > ${rep}` : ''}`); });
2228
2500
  if (fl.length) { md.push('', '## ' + L('Fichiers touchés', 'Files touched')); fl.forEach(([f, v]) => md.push(`- \`${f}\` ×${v.n} (${[...v.who].join(', ')})`)); }
@@ -2429,7 +2701,7 @@ const TALK = {
2429
2701
  function varied(kind, seed) { const P = TALK[CALL()][kind]; let line = P[seed % P.length]; if (line === S.lastTalk) line = P[(seed + 1) % P.length]; return (S.lastTalk = line); } // never the same line twice in a row
2430
2702
  // Who is thinking once this event has happened: the agent whose tool just answered, the lead after your message or a report, a sub-agent that just got its order. After a line or a tool call, nobody is.
2431
2703
  const thinkerOf = (e) => (e.kind === 'results' ? e.agent : e.kind === 'user' ? 'main' : e.kind === 'report' || e.kind === 'finish' || e.kind === 'order' ? e.to : null);
2432
- const before = (i) => { let k = i - 1; while (k >= 0 && (S.events[k].kind === 'usage' || S.events[k].kind === 'compact')) k--; return S.events[k]; };
2704
+ const before = (i) => { let k = i - 1; while (k >= 0 && (S.events[k].kind === 'usage' || S.events[k].kind === 'compact' || S.events[k].kind === 'tasks')) k--; return S.events[k]; };
2433
2705
  async function ponder(i, token) { // replay: an agent that really took a long time (40 s or more) before this line or call says so first, about every other time
2434
2706
  const ev = S.events[i], p = before(i); if (!prefs.banter || prefs.chat === 'quiet' || S.boost > 1 || S.hurry || !p || !S.agents[ev.agent] || thinkerOf(p) !== ev.agent || ev.ts - p.ts < 40000 || hash('t' + ev.ts) % 100 > 55) return;
2435
2707
  const line = varied('think', hash(String(ev.ts))); await sayLine(ev.agent, line, '💭', token);
@@ -2519,7 +2791,7 @@ async function run(i) {
2519
2791
  S.boost = S.hurry || (S.live && S.events.length - i > 60) ? 3 : 1;
2520
2792
  const ev = S.events[i]; S.idx = i; tally(ev); if (S.live && ev.ts > S.since) S.since = ev.ts; // said once: a reload or a return to this session does not read it again
2521
2793
  if (!S.live && (ev.kind === 'say' || ev.kind === 'report' || ev.kind === 'order' || ev.kind === 'tools')) { await ponder(i, token); if (token !== S.token) return; }
2522
- if (ev.kind === 'usage' || ev.kind === 'compact') { if (ev.kind === 'compact' && S.live && prefs.banter) toast(`${nameOf(ev.agent)}: ${L('contexte compacté 🗜', 'context compacted 🗜')}`); i++; continue; }
2794
+ if (ev.kind === 'usage' || ev.kind === 'compact' || ev.kind === 'tasks') { if (ev.kind === 'compact' && S.live && prefs.banter) toast(`${nameOf(ev.agent)}: ${L('contexte compacté 🗜', 'context compacted 🗜')}`); i++; continue; }
2523
2795
  if (ev.kind === 'finish') { applyStatus(ev); paintStatus(); i++; continue; }
2524
2796
  const backlog = S.live ? S.events.length - i : 0, quick = S.live ? Math.min(1, 40 / Math.max(1, backlog)) : 1; // live: hundreds of tool events from parallel sub-agents must not take minutes to scroll past
2525
2797
  if (ev.kind === 'results') { applyResults(ev, S.boost > 1); await sleep((S.boost === 1 && S.present === ev.agent && ev.items.some((it) => it.img) ? (S.live ? 900 : 1800) : S.boost === 1 && S.present === ev.agent && ev.items.some((it) => it.art && (S.artCalls.get(it.id) || {}).pub) ? (S.live ? 2500 : 4000) : S.demo ? 900 : S.live ? 30 * quick : 80) / spd()); i++; continue; } // a picture gets a moment on screen
@@ -2527,13 +2799,13 @@ async function run(i) {
2527
2799
  if (ev.kind === 'say' && ev.end && ev.agent === 'main' && S.boost <= 1) shareWhole(); // the lead says it is done: the whole document it made, if it has several pages
2528
2800
  const group = [ev]; let j = i + 1; // sub-agents talking back-to-back were running in parallel: their lines are taken together and said one after the other
2529
2801
  if (ev.kind === 'order') { // several orders in a row (a parallel launch): the new agents all appear now, the first order is read, the others are named in one line
2530
- while (j < Math.min(S.events.length, i + 40) && group.length < 8) { const e2 = S.events[j]; if (e2.kind === 'usage' || e2.kind === 'compact') { tally(e2); j++; continue; } if (e2.kind === 'order' && e2.agent === ev.agent) { group.push(e2); j++; } else break; }
2802
+ while (j < Math.min(S.events.length, i + 40) && group.length < 8) { const e2 = S.events[j]; if (e2.kind === 'usage' || e2.kind === 'compact' || e2.kind === 'tasks') { tally(e2); j++; continue; } if (e2.kind === 'order' && e2.agent === ev.agent) { group.push(e2); j++; } else break; }
2531
2803
  if (group.length > 1) { for (const g of group) applyStatus(g); paintStatus(); }
2532
2804
  }
2533
2805
  else if (isSub(ev.agent) && ev.kind !== 'order') {
2534
2806
  while (j < Math.min(S.events.length, i + 28) && group.length < 3) {
2535
2807
  const e2 = S.events[j];
2536
- if (e2.kind === 'usage' || e2.kind === 'compact') { tally(e2); j++; continue; }
2808
+ if (e2.kind === 'usage' || e2.kind === 'compact' || e2.kind === 'tasks') { tally(e2); j++; continue; }
2537
2809
  if (e2.kind === 'finish') { applyStatus(e2); j++; continue; }
2538
2810
  if (e2.kind === 'tools') { tally(e2); tickTools(e2); applyStatus(e2); j++; continue; }
2539
2811
  if (e2.kind === 'results') { tally(e2); applyResults(e2, true); j++; continue; }
@@ -2545,7 +2817,7 @@ async function run(i) {
2545
2817
  const playOne = (g) => {
2546
2818
  applyStatus(g); if (g.end) paintStates(); g._as = g.kind; if (g.agent === 'user') S.owed = true; else if (g.agent === 'main') S.owed = false; // your order waits for a word from the lead
2547
2819
  const label = g.kind === 'order' ? `${L('pour', 'to')} ${nameOf(g.to)}` : g.kind === 'report' ? `${L('rapport à', 'report to')} ${nameOf(g.to)}` : '', line = talkLine(g);
2548
- startTalk(g.agent, line, label);
2820
+ startTalk(g.agent, line, label); if (g.kind === 'user' && g.img > 0 && g.iid) showYourPics(g);
2549
2821
  if (g.kind === 'order') { S.status[g.to] = 'working'; AUD.join(); setTimeout(() => { paintStatus(); fly(g.agent, g.to, '📨'); popTile(g.to); }, 30); }
2550
2822
  if (g.kind === 'report') { AUD.ding(); setTimeout(() => { fly(g.agent, g.to, '✅'); popTile(g.agent); }, 30); }
2551
2823
  const said = clipSpeech(line, S.pace); if (g.agent === 'main' && g.kind === 'say') { const full = plain(g.text), key = said.replace(/…$/, '').trim().slice(-30), pos = key ? full.indexOf(key) : -1, n = pos >= 0 ? pos + key.length : said.length; S.mainSaid = { ev: g, said: n, full: n >= full.length - 5 }; }
@@ -2598,7 +2870,7 @@ async function loadSession(proj, id) {
2598
2870
  pause(); const mine = (S.loadN = (S.loadN || 0) + 1);
2599
2871
  const data = await (await fetch(`/api/session?proj=${encodeURIComponent(proj)}&id=${id}`)).json();
2600
2872
  if (mine !== S.loadN || data.error) return false;
2601
- S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; for (const k in nameBook) delete nameBook[k]; [{ id: 'user' }, ...data.agents].forEach((a) => (S.agents[a.id] = persona(a)));
2873
+ S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; S.cost = data.cost || null; for (const k in nameBook) delete nameBook[k]; [{ id: 'user' }, ...data.agents].forEach((a) => (S.agents[a.id] = persona(twinOf(a))));
2602
2874
  clearThoughts(); Object.assign(TH, { since: {}, next: {}, said: {}, last: 0 }); S.events = data.events; stampT(0); S.byK = new Map(data.events.map((e) => [e.k, e])); S.seq = data.seq || 0; S.ep = data.ep || ''; S.sawEnd = !!data.marks || data.events.some((e) => e.end); S.late = []; S.pos = 0; S.joinAt = Date.now(); S.idx = 0; S.status = {}; S.tc = {}; S.cur = { proj, id }; S.logTo = 0; S.detail = null; $('#detail').classList.remove('on'); S.fgone = new Set(); S.fmade = new Map(); S.artOk = new Map(); S.artPin = null; S.artWhole = null; S.wholeSeen = new Set();
2603
2875
  const opt = $('#sessions').selectedOptions[0]; S.title = (S.live ? niceProj(proj) : opt && opt.dataset.title) || '';
2604
2876
  if (proj === '_demo') S.events.forEach((e) => { if (e.fr) trMem.set(baseText(e), e.fr, 'fr'); }); // the demo ships its own French
@@ -2627,7 +2899,7 @@ async function followCurrent() {
2627
2899
  // the end of a session that was already over is on screen (states, transcript) but is not read again. Joining while the agents are at work, the last few seconds are said too, to know what they are on
2628
2900
  const JOIN_BACK_MS = 10000;
2629
2901
  function midWork() { // someone is in the middle of something: the session does not end on a message of the lead (its turn is over then, or about to be)
2630
- let k = S.events.length - 1; while (k >= 0 && (S.events[k].kind === 'usage' || S.events[k].kind === 'compact')) k--; const e = S.events[k]; return !!e && !(e.agent === 'main' && e.kind === 'say');
2902
+ let k = S.events.length - 1; while (k >= 0 && (S.events[k].kind === 'usage' || S.events[k].kind === 'compact' || S.events[k].kind === 'tasks')) k--; const e = S.events[k]; return !!e && !(e.agent === 'main' && e.kind === 'say');
2631
2903
  }
2632
2904
  function liveStart() {
2633
2905
  const n = S.events.length; if (!S.locked && !S.since) S.since = Date.now() - (midWork() ? JOIN_BACK_MS : 0); // S.since 0: joining now
@@ -2653,8 +2925,8 @@ setInterval(async () => {
2653
2925
  if (switched || !S.cur) return;
2654
2926
  const cur = S.cur, d = await (await fetch(`/api/session?proj=${encodeURIComponent(cur.proj)}&id=${cur.id}&after=${S.seq}&ep=${encodeURIComponent(S.ep)}`)).json();
2655
2927
  if (d.error || cur !== S.cur) return; if (d.resync) { S.cur = null; return; } // the server no longer has our place (restarted, transcript rewritten): reload next tick
2656
- S.seq = d.seq; if (d.marks) S.sawEnd = true; if (!d.events || !d.events.length) return;
2657
- for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(a); addTile(S.agents[a.id]); }
2928
+ S.seq = d.seq; if (d.marks) S.sawEnd = true; if (d.cost && (!S.cost || d.cost.usd !== S.cost.usd || d.cost.final !== S.cost.final)) { S.cost = d.cost; later('tok', renderTokens, 300); } if (!d.events || !d.events.length) return;
2929
+ for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(twinOf(a)); addTile(S.agents[a.id]); }
2658
2930
  const from = S.events.length, fresh = [], changed = []; // the session is not written in order: what is new goes at the end (the order the call got it in), what the server corrected is corrected in place
2659
2931
  for (const e of d.events) { const old = S.byK.get(e.k); if (old) { changed.push([old, { kind: old.kind, n: old.tools ? old.tools.length : 0, end: old.end }]); Object.assign(old, e); } else { S.byK.set(e.k, e); fresh.push(e); } }
2660
2932
  if (fresh.some((e) => e.end)) S.sawEnd = true;
@@ -2667,7 +2939,8 @@ setInterval(async () => {
2667
2939
 
2668
2940
 
2669
2941
  window.addEventListener('message', (e) => { // VS Code asks for a given session: the one the status bar was clicked for, or the one of the Claude Code tab you went to (the message is named 'pin' on both sides, from when the call was pinned there)
2670
- const d = e.data; if (!EMBED || e.source !== window.parent || !d || d.agentStandup !== 'pin' || typeof d.id !== 'string') return;
2942
+ const d = e.data; if (EMBED && e.source === window.parent && d && d.agentStandup === 'answered' && d.how === 'app' && typeof d.app === 'string') { toast('✋ ' + L('Elle vous attend dans ', 'Waiting for you in ') + d.app.slice(0, 40)); return; } // the extension opened the terminal or app the session runs in (answerAt)
2943
+ if (!EMBED || e.source !== window.parent || !d || d.agentStandup !== 'pin' || typeof d.id !== 'string') return;
2671
2944
  if (d.tab) { if (prefs.followTab !== false && S.live && !S.demo && typeof d.proj === 'string' && !(S.pick && S.pick.pin)) goSession(d.proj, d.id); return; } // the Claude Code tab you went to: the call goes with you (followTab in extension.js; off in ⚙), unless you pinned a call (📌): that one stays while you go through your tabs
2672
2945
  const dp = typeof d.proj === 'string' ? d.proj : ''; if (!TOOL[dp]) prefs.proj = dp; S.pick = { proj: dp, id: d.id }; S.cur = null; setView('call'); if (S.live) { fillProjects(); followCurrent(); } else setMode('live');
2673
2946
  });
@@ -2690,20 +2963,21 @@ $('#reactBar').onclick = (e) => {
2690
2963
  };
2691
2964
 
2692
2965
  // ---------- board: every recent session at a glance ----------
2693
- const BSTATE = { blocked: ['✋', 'needs you?', 'attend vous ?'], working: ['⚙', 'working', 'au travail'], waiting: ['🔗', 'waiting on sub-agents', 'attend ses sous-agents'], turn: ['✓', 'your turn', 'à vous'], idle: ['💤', 'idle', 'inactif'] };
2966
+ const BSTATE = { blocked: ['✋', 'needs you', 'vous attend'], working: ['⚙', 'working', 'au travail'], waiting: ['🔗', 'waiting on sub-agents', 'attend ses sous-agents'], turn: ['✓', 'your turn', 'à vous'], idle: ['💤', 'idle', 'inactif'] };
2694
2967
  const BORDER = ['blocked', 'working', 'waiting', 'turn', 'idle'];
2695
- const agoStr = (ms) => (ms < 90e3 ? Math.max(1, Math.round(ms / 1000)) + 's' : ms < 5400e3 ? Math.round(ms / 60e3) + ' min' : Math.round(ms / 3600e3) + ' h');
2968
+ const agoStr = (ms) => (ms < 90e3 ? Math.max(1, Math.round(ms / 1000)) + 's' : ms < 7200e3 ? Math.round(ms / 60e3) + ' min' : Math.floor(ms / 3600e3) + ' h');
2696
2969
  const BGROUP = ['blocked', 'turn', 'working', 'waiting', 'idle']; // the board is in sections, what waits for you first
2697
2970
  let boardBusy = false, boardAll = null, boardDoneOpen = false, boardIdleOpen = false;
2698
2971
  const BTOOLS = [['claude', 'Claude Code'], ['_codex', 'Codex'], ['_vibe', 'Mistral Vibe'], ['_cowork', 'Cowork']], toolOf = (r) => (BTOOLS.some(([k]) => k === r.proj) ? r.proj : 'claude'); // the filter at the top of the board, shown when sessions of two tools or more are listed
2699
2972
  const isDone = (r) => !!r.done; // put away by you, until the session moves again: the server says so, to every window
2700
2973
  function bcard(r, now, done) {
2701
- const g = r.state === 'turn' && r.gave ? r.gave : '', [ic, en0, fr0] = g ? ['⚠', 'gave up?', 'a abandonné ?'] : BSTATE[r.state], [en, fr] = r.state === 'blocked' && r.sure ? ['needs you', 'vous attend'] : [en0, fr0], waited = r.since ? now - r.since : r.state === 'blocked' ? r.ageMs : now - r.mtime, mine = r.state === 'blocked' || r.state === 'turn'; // how long it has waited on you
2974
+ const g = r.state === 'turn' && r.gave ? r.gave : '', stop = r.state === 'turn' && !g ? limitTxt(r, true) : '', [ic, en0, fr0] = g ? ['⚠', 'gave up?', 'a abandonné ?'] : BSTATE[r.state], [en, fr] = [en0, fr0], waited = r.since ? now - r.since : r.state === 'blocked' ? r.ageMs : now - r.mtime, mine = r.state === 'blocked' || r.state === 'turn'; // how long it has waited on you
2702
2975
  const head = r.state === 'blocked' ? [r.ask ? '' : esc(r.tool), r.ran ? '' : agoStr(waited)].filter(Boolean).join(' ') : r.state === 'working' && r.tool ? esc(r.tool) : r.state === 'idle' || (r.state === 'turn' && !r.ran) ? agoStr(waited) : '', extra = head ? ' · ' + head : '';
2703
2976
  const took = mine && r.ran ? `⏱ ${L('a travaillé', 'worked')} ${agoStr(r.ran)} · ${L('vous attend depuis', 'waiting on you for')} ${agoStr(waited)}` : r.state === 'working' && r.asked ? `⏱ ${L('au travail depuis', 'working for')} ${agoStr(Math.max(0, now - r.asked))}` : ''; // the time it worked, apart from the time it has waited on you
2704
2977
  const pr = r.pr ? `<button class="bpr" data-url="${esc(r.pr.url)}" title="${esc(L('Ouvrir la pull request', 'Open the pull request'))}">PR #${+r.pr.n} ↗</button>` : '';
2705
2978
  const put = done ? `<button class="bdo" data-undo="1" title="${esc(L('Rouvrir', 'Reopen'))}" aria-label="${esc(L('Rouvrir', 'Reopen'))}">↩</button>` : r.state === 'turn' || r.state === 'idle' ? `<button class="bdo" title="${esc(L('Marquer comme traitée', 'Mark as done'))}" aria-label="${esc(L('Marquer comme traitée', 'Mark as done'))}">✓</button>` : '';
2706
- return `<div class="bcard ${r.state}${g ? ' gave' : ''}" tabindex="0" role="button" data-p="${esc(r.proj)}" data-i="${esc(r.id)}"><div class="bh"><span class="stc ${g ? 'stalled' : r.state}">${ic} ${L(fr, en)}${extra}</span>${pr}${put}</div><div class="bt">${esc(/^[0-9a-f]{8}-[0-9a-f-]{27}$/.test(r.title) ? L('Session sans titre', 'Untitled session') : r.title)}</div>${r.ask || g ? `<div class="bq">${esc(r.ask || g)}</div>` : ''}<div class="bp">${esc(niceProj(r.proj))}</div>${took ? `<div class="bm">${took}</div>` : ''}${r.subTotal ? `<div class="bm">👥 ${r.subActive}/${r.subTotal} ${L('sous-agents actifs', 'sub-agents active')}</div>` : ''}</div>`;
2979
+ const about = r.menu && r.menu.about && r.state === 'blocked' ? `<div class="bm bab" title="${esc(r.menu.cmd || r.menu.about)}">${esc(r.menu.about)}</div>` : '', reset = stop && r.limit && r.limit.resets ? L('reprise à {0}', 'resets {0}').replace('{0}', () => r.limit.resets) : ''; // what the waiting command is for, as Claude Code wrote it; when a usage limit ends
2980
+ return `<div class="bcard ${r.state}${g || stop ? ' gave' : ''}" tabindex="0" role="button" data-p="${esc(r.proj)}" data-i="${esc(r.id)}"><div class="bh"><span class="stc ${g || stop ? 'stalled' : r.state}">${stop ? esc(stop) : ic + ' ' + L(fr, en)}${extra}</span>${pr}${put}</div><div class="bt">${esc(/^[0-9a-f]{8}-[0-9a-f-]{27}$/.test(r.title) ? L('Session sans titre', 'Untitled session') : r.title)}</div>${r.ask || g || reset ? `<div class="bq">${esc(r.ask || g || reset)}</div>` : ''}${about}<div class="bp">${esc(niceProj(r.proj))}</div>${took ? `<div class="bm">${took}</div>` : ''}${r.subTotal ? `<div class="bm">👥 ${r.subActive}/${r.subTotal} ${L('sous-agents actifs', 'sub-agents active')}</div>` : ''}</div>`;
2707
2981
  }
2708
2982
  function paintBoard() {
2709
2983
  if (!boardAll || !document.body.classList.contains('board')) return; const now = Date.now(), recent = (a, b) => b.mtime - a.mtime;
@@ -2713,8 +2987,10 @@ function paintBoard() {
2713
2987
  const secs = filt + BGROUP.map((k) => [k, live.filter((r) => r.state === k).sort(recent)]).filter(([, rs]) => rs.length).map(([k, rs]) => k === 'idle' /* idle: folded into one line, opened on demand (and kept open while the board is painted again) */
2714
2988
  ? `<details class="bsec bidle"${boardIdleOpen ? ' open' : ''}><summary class="bhd ${k}">${head(k, L(BSTATE[k][2], BSTATE[k][1]), rs.length)}</summary><div class="bgrid">${rs.map((r) => bcard(r, now, false)).join('')}</div></details>`
2715
2989
  : `<section class="bsec"><h3 class="bhd ${k}">${head(k, L(BSTATE[k][2], BSTATE[k][1]), rs.length)}</h3><div class="bgrid">${rs.map((r) => bcard(r, now, false)).join('')}</div></section>`).join('');
2990
+ const lim = live.filter((r) => r.state === 'turn' && r.limit).sort(recent), rsAll = new Set(lim.map((r) => r.limit.resets || '')), rs0 = rsAll.size === 1 ? [...rsAll][0] : ''; // several sessions stopped by the same usage limit: said once, above them, with its reset time only when they all share it
2991
+ const limLine = lim.length < 2 ? '' : `<div class="bnote">⏳ ${esc(L('Limite d’usage de Claude : {0} sessions arrêtées', 'Claude usage limit: {0} sessions stopped').replace('{0}', lim.length))}${rs0 ? ' · ' + esc(L('reprise à {0}', 'resets {0}').replace('{0}', () => rs0)) : ''}</div>`;
2716
2992
  const put = done.length ? `<details class="bsec bdone"${boardDoneOpen ? ' open' : ''}><summary class="bhd">${head('', L('Traitées', 'Done'), done.length)}</summary><div class="bgrid">${done.map((r) => bcard(r, now, true)).join('')}</div></details>` : '';
2717
- $('#boardv').innerHTML = secs + put || `<div class="bsum"><span>${L('Aucune session récente', 'No recent session')}</span></div>`;
2993
+ $('#boardv').innerHTML = missHtml('b') + limLine + (secs + put || `<div class="bsum"><span>${L('Aucune session récente', 'No recent session')}</span></div>`);
2718
2994
  }
2719
2995
  async function renderBoardView() {
2720
2996
  if (!document.body.classList.contains('board') || boardBusy) return; boardBusy = true;
@@ -2755,7 +3031,20 @@ async function openSwitcher() {
2755
3031
  draw(); $('#swq').focus();
2756
3032
  }
2757
3033
  function closeSwitcher() { const sw = $('#switcher'); if (sw) sw.remove(); }
2758
- setInterval(() => { if (!document.hidden) renderBoardView(); }, 2500);
3034
+ setInterval(() => { if (!document.hidden) { renderBoardView(); pollMissing(); } }, 2500);
3035
+ // ---------- Claude Code open in a folder, with no session file the app can find (GET /api/missing, server.js): one line in the Sessions view and on the empty call, with why ----------
3036
+ let MISSING = [], missOpen = false;
3037
+ function missHtml(w) {
3038
+ if (!MISSING.length) return ''; const names = [...new Set(MISSING.map((m) => String(m.name || m.cwd || '?')))], n = names.slice(0, 3).join(', ') + (names.length > 3 ? ' +' + (names.length - 3) : '');
3039
+ const why = L('Retirez CLAUDE_CODE_SKIP_PROMPT_HISTORY de votre profil de shell, puis relancez Claude Code.', 'Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.'), v = (t) => esc(t).replace('CLAUDE_CODE_SKIP_PROMPT_HISTORY', '<code class="mv">CLAUDE_<wbr>CODE_<wbr>SKIP_<wbr>PROMPT_<wbr>HISTORY</code>'); // the one cause the app can see: Claude Code writes its status there but no transcript (an inherited CLAUDE_CODE_CHILD_SESSION writes neither; another CLAUDE_CONFIG_DIR writes its status elsewhere)
3040
+ return `<details class="miss" data-w="${w}"${missOpen ? ' open' : ''}><summary>${v(L('Claude Code est ouvert dans {0} mais n’enregistre aucun historique (CLAUDE_CODE_SKIP_PROMPT_HISTORY est défini) : Agent Standup ne peut pas le suivre.', 'Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.').replace('{0}', () => n))} <u title="${esc(why)}">${esc(L('Pourquoi ?', 'Why?'))}</u></summary><ul><li>${v(why)}</li></ul></details>`;
3041
+ }
3042
+ function paintMissing() { paintBoard(); const el = $('#eMiss'), h = missHtml('e'); if (el && el.dataset.k !== h) { el.dataset.k = h; el.innerHTML = h; } }
3043
+ async function pollMissing() { // live only: the demo, a replay and an older server (no such address) ask nothing. Local, and the server looks at most every 10 s
3044
+ if (!S.live || S.demo || pollMissing.off || pollMissing.busy) { if (MISSING.length && (!S.live || S.demo)) { MISSING = []; paintMissing(); } return; } pollMissing.busy = true;
3045
+ try { const r = await fetch('/api/missing'); if (r.status === 404) pollMissing.off = true; const a = r.ok ? await r.json() : [], next = Array.isArray(a) ? a.filter((m) => m && typeof m === 'object') : []; if (JSON.stringify(next) !== JSON.stringify(MISSING)) { MISSING = next; paintMissing(); } } catch {} finally { pollMissing.busy = false; }
3046
+ }
3047
+ document.addEventListener('toggle', (e) => { if (e.target.classList && e.target.classList.contains('miss')) missOpen = e.target.open; }, true);
2759
3048
  // ---------- several sessions at once (live): the sessions of the moment as tabs under the header, and a visitor when another one needs you ----------
2760
3049
  // The row is there only when there is something to tell apart: a second session at work or waiting for you. With a single session the header is as it always was.
2761
3050
  // The tabs keep the order in which the sessions showed up, so the one the call is in stays where it was. The call is in the session you last touched: the one you typed in or started,
@@ -2763,7 +3052,8 @@ setInterval(() => { if (!document.hidden) renderBoardView(); }, 2500);
2763
3052
  // the next thing you type, wherever it is, takes the call there. The rule itself is in server.js (currentSession).
2764
3053
  S.rows = []; S.tabOrder = []; S.knockAt = {}; S.left = {}; S.visit = S.knock = null; S.pick = S.pick || null;
2765
3054
  const UNTITLED = /^[0-9a-f]{8}-[0-9a-f-]{27}$/, sessKey = (r) => r.proj + '/' + r.id, tabName = (r) => (r.title && !UNTITLED.test(r.title) ? r.title : r.title ? L('Session sans titre', 'Untitled session') : niceProj(r.proj) || L('Session sans titre', 'Untitled session'));
2766
- const inWatch = (r) => { const k = Q.get('proj') || prefs.proj || ''; return !k || S.wide ? !r.tmp : [r.proj, r.dir || ''].some((d) => d === k || d.startsWith(k + '-')); }; // the folder the live view follows, when it follows one and that folder has sessions (S.wide: it has none, see followCurrent). Looking everywhere, not the sessions started in the temporary folder (tmp, see tmpKey in server.js)
3055
+ const drive = (d) => /^[a-zA-Z]--/.test(d) ? d[0].toUpperCase() + d.slice(1) : d; /* a Windows folder's drive letter, whatever its case: the extension sends C--…, a terminal may write c--… */
3056
+ const inWatch = (r) => { const k = drive(Q.get('proj') || prefs.proj || ''); return !k || S.wide ? !r.tmp : [r.proj, r.dir || ''].map(drive).some((d) => d === k || d.startsWith(k + '-')); }; // the folder the live view follows, when it follows one and that folder has sessions (S.wide: it has none, see followCurrent). Looking everywhere, not the sessions started in the temporary folder (tmp, see tmpKey in server.js)
2767
3057
  const rowOf = (c) => (c && S.rows.find((r) => r.proj === c.proj && r.id === c.id)) || null;
2768
3058
  function paintTabs() {
2769
3059
  const el = $('#tabs'), cur = S.cur; if (!S.live || S.demo) { if (paintTabs.html) el.innerHTML = paintTabs.html = ''; if (S.visit) hideVisit(); return; } if (!cur) return; // between two sessions the tabs stay as they are: the row does not come and go
@@ -2771,8 +3061,8 @@ function paintTabs() {
2771
3061
  for (const k of by.keys()) if (!S.tabOrder.includes(k)) S.tabOrder.push(k); // a session keeps its place while it has no tab: the call now goes by itself to a session that is started, sometimes before the list has the one it leaves, which then came back second
2772
3062
  const ks = S.tabOrder.filter((k) => by.has(k)).slice(0, 8); if (!ks.includes(ck)) ks[ks.length - 1] = ck; // the others are in ⋯
2773
3063
  const html = by.size < 2 ? '' : ks.map((k) => { const r = by.get(k), on = k === ck, st = BSTATE[r.state]; // one session: no row, there is nothing to tell apart
2774
- const pinned = on && !!S.pick && !!S.pick.pin && sessKey(S.pick) === k, tip = tabName(r) + '\n' + niceProj(r.proj) + (r.state === 'turn' && r.gave ? ' · ⚠ ' + L('a abandonné ?', 'gave up?') + '\n' + r.gave : st ? ' · ' + L(st[2], st[1]) : '') + (pinned ? '\n' + L('Épinglé : cliquez pour désépingler', 'Pinned: click to unpin') : '');
2775
- return `<button class="stab ${r.state}${r.state === 'turn' && r.gave ? ' gave' : ''}${on ? ' on' : ''}" role="tab" aria-selected="${on}" data-k="${esc(k)}" title="${esc(tip)}">${st ? st[0] : ''}${TOOL[r.proj] ? `<i>${TOOL[r.proj]}</i>` : ''}<span>${esc(tabName(r))}</span>${pinned ? '📌' : ''}</button>`; }).join('')
3064
+ const pinned = on && !!S.pick && !!S.pick.pin && sessKey(S.pick) === k, tip = tabName(r) + '\n' + niceProj(r.proj) + (r.state === 'turn' && r.gave ? ' · ⚠ ' + L('a abandonné ?', 'gave up?') + '\n' + r.gave : r.state === 'turn' && limitTxt(r) ? ' · ' + limitTxt(r) : st ? ' · ' + L(st[2], st[1]) : '') + (pinned ? '\n' + L('Épinglé : cliquez pour désépingler', 'Pinned: click to unpin') : '');
3065
+ return `<button class="stab ${r.state}${r.state === 'turn' && (r.gave || r.limit || r.auth) ? ' gave' : ''}${on ? ' on' : ''}" role="tab" aria-selected="${on}" data-k="${esc(k)}" title="${esc(tip)}">${st ? st[0] : ''}${TOOL[r.proj] ? `<i>${TOOL[r.proj]}</i>` : ''}<span>${esc(tabName(r))}</span>${pinned ? '📌' : ''}</button>`; }).join('')
2776
3066
  + `<button class="stab all" title="${esc(L('Aller à une session', 'Go to a session'))} (Cmd / Ctrl + K)" aria-label="${esc(L('Aller à une session', 'Go to a session'))}">⋯</button>` + (by.size < 2 ? '' : whyTag());
2777
3067
  if (html === paintTabs.html) return; if (!html) paintTabs.cur = ''; el.innerHTML = paintTabs.html = html;
2778
3068
  if (paintTabs.cur !== ck) { paintTabs.cur = ck; const on = el.querySelector('.on'); if (on) on.scrollIntoView({ block: 'nearest', inline: 'nearest' }); }
@@ -2804,7 +3094,7 @@ function knocks() {
2804
3094
  const now = Date.now(), first = !knocks.seen, seen = knocks.seen || (knocks.seen = {}), ck = S.cur ? sessKey(S.cur) : ''; let best = null;
2805
3095
  for (const r of S.rows) {
2806
3096
  const k = sessKey(r), was = seen[k], st = r.state === 'turn' && now - r.mtime < 6000 ? 'working' : r.state; // a session that does not mark the end of its turns: a line less than 6 s old may only be a pause before the next call
2807
- const kind = first || !was || was === st || k === ck || !inWatch(r) ? '' : st === 'blocked' ? (/^AskUserQuestion/.test(r.tool) ? 'ask' : 'ok') : st === 'turn' && !r.cut && /^(working|waiting|blocked)$/.test(was) ? 'turn' : ''; // cut: you stopped that session yourself (Esc), which is no news
3097
+ const kind = first || !was || was === st || k === ck || !inWatch(r) ? '' : st === 'blocked' ? (/^AskUserQuestion/.test(r.tool) ? 'ask' : 'ok') : st === 'turn' && !r.cut && !r.limit && !r.auth && /^(working|waiting|blocked)$/.test(was) ? 'turn' : ''; // cut: you stopped that session yourself (Esc), which is no news; nor is a usage limit or a logout, said in amber on its tab and card
2808
3098
  if (kind && now - (S.knockAt[k] || 0) < 20000) continue; // a stop less than 20 s after the last visit for that session is not noted yet: it is told when the 20 s are over, if it still holds
2809
3099
  seen[k] = st; if (kind && (!best || (kind !== 'turn' && best.kind === 'turn'))) best = { r, kind, k };
2810
3100
  }
@@ -2823,7 +3113,7 @@ async function visitSay(v, token) {
2823
3113
  if (S.visit !== v || AUD.off() || !prefs.voice) return; const el = $('#visit'); el.classList.add('speaking'); AUD.duck(true);
2824
3114
  await speakLine(v.line, v.p, true, token); el.classList.remove('speaking'); if (!S.speakers.size) AUD.duck(false);
2825
3115
  }
2826
- $('#visit').onclick = (e) => { const v = S.visit; if (!v) return; if (e.target.closest('.vx')) hideVisit(); else goSession(v.r.proj, v.r.id); };
3116
+ $('#visit').onclick = (e) => { const v = S.visit; if (!v) return; if (e.target.closest('.vx')) hideVisit(); else { goSession(v.r.proj, v.r.id); answerAt(v.r); } };
2827
3117
  async function sessPoll() {
2828
3118
  if (!S.live || S.demo || document.hidden || sessPoll.busy) return; sessPoll.busy = true;
2829
3119
  try { const t0 = Date.now(), rows = await (await fetch('/api/board')).json(); if (Array.isArray(rows) && S.live && !S.demo) { S.rows = rows; S.rowsAt = t0; knocks(); paintTabs(); paintAttn(); } } catch {} finally { sessPoll.busy = false; }
@@ -2938,14 +3228,14 @@ async function exportVideo(from = 0, to = 0, clip = 0) { // clip: length in ms
2938
3228
  // UI wiring
2939
3229
  // =====================================================================
2940
3230
  function applyLang() {
2941
- renderCharInfo(); packNote(); menuTip(); rateDay(); coffeeDay(); usageStart();
3231
+ renderCharInfo(); packNote(); menuTip(); rateDay(); coffeeDay(); usageStart(); updStart();
2942
3232
  try { for (const id in S.act) { const b = S.term[id], t = b && b[b.length - 1]; if (t && t.tool) S.act[id] = activityLabel(t.tool); } if (S.live) fillProjects(); } catch {} // what each agent is doing, and the list of projects, were written in the language before
2943
3233
  document.documentElement.lang = (LANGS.find((l) => l[0] === prefs.lang) || LANGS[0])[2];
2944
3234
  document.querySelectorAll('[data-fr]').forEach((el) => (el.textContent = FR() ? el.dataset.fr : tr(el.dataset.en)));
2945
3235
  document.querySelectorAll('#viewSeg button').forEach((b) => { b.title = b.textContent; }); // in a narrow window they are icons: the name stays as a tooltip
2946
3236
  $('#callTrMi').style.display = CALL_LANG[prefs.lang] && !FR() ? '' : 'none';
2947
3237
  const sel = $('#langSel'); if (!sel.options.length) sel.innerHTML = LANGS.map(([c, n]) => `<option value="${c}">${n}</option>`).join(''); sel.value = prefs.lang;
2948
- [['#bPlay', L('Pause / Lecture (espace)', 'Pause / Play (space)')], ['#bLog', 'Transcript'], ['#bMute', L('Son (touche M)', 'Sound (M key)')], ['#bMenu', L('Réglages', 'Settings')], ['#dclose', L('Fermer', 'Close')], ['#officeVol', L('Volume de l’ambiance', 'Ambience volume')], ['#musicVol', L('Volume de la musique', 'Music volume')], ['#liveProj', L('Projet à suivre', 'Project to follow')], ['#reactBar', L('Réactions', 'Reactions')], ['#logQ', L('Rechercher dans la transcription', 'Search the transcript')], ['#roster', L('Agents', 'Agents')]].forEach(([q, t]) => { const el = $(q); if (!el) return; el.title = t; el.setAttribute('aria-label', t); }); $('#logQ').placeholder = L('Rechercher…', 'Search…'); $('#menuQ').placeholder = L('Chercher un réglage…', 'Search settings…'); $('#menuQ').setAttribute('aria-label', $('#menuQ').placeholder); $('#sps').setAttribute('aria-label', L('Vitesses prédéfinies', 'Speed presets')); document.querySelectorAll('#reactBar button').forEach((b) => b.setAttribute('aria-label', b.dataset.e));
3238
+ [['#bPlay', L('Pause / Lecture (espace)', 'Pause / Play (space)')], ['#bLog', L('Transcription', 'Transcript')], ['#bMute', L('Son (touche M)', 'Sound (M key)')], ['#bMenu', L('Réglages', 'Settings')], ['#dclose', L('Fermer', 'Close')], ['#officeVol', L('Volume de l’ambiance', 'Ambience volume')], ['#voiceVol', L('Volume des voix', 'Voice volume')], ['#musicVol', L('Volume de la musique', 'Music volume')], ['#liveProj', L('Projet à suivre', 'Project to follow')], ['#reactBar', L('Réactions', 'Reactions')], ['#logQ', L('Rechercher dans la transcription', 'Search the transcript')], ['#roster', L('Agents', 'Agents')]].forEach(([q, t]) => { const el = $(q); if (!el) return; el.title = t; el.setAttribute('aria-label', t); }); $('#logQ').placeholder = L('Rechercher…', 'Search…'); $('#menuQ').placeholder = L('Chercher un réglage…', 'Search settings…'); $('#menuQ').setAttribute('aria-label', $('#menuQ').placeholder); $('#sps').setAttribute('aria-label', L('Vitesses prédéfinies', 'Speed presets')); document.querySelectorAll('#reactBar button').forEach((b) => b.setAttribute('aria-label', b.dataset.e));
2949
3239
  $('#gB').textContent = L('🔊 Activer le son', '🔊 Turn on sound'); $('#gB').title = L('Ou cliquez n’importe où dans l’appel', 'Or click anywhere in the call');
2950
3240
  $('#eDemo').textContent = L('▶ Voir la démo', '▶ Watch the demo'); $('#eT').textContent = L('En attente d’une session', 'Waiting for a session'); $('#eP').innerHTML = watched() ? esc(L('Aucune session pour l’instant. Lancez Claude Code, Codex ou Mistral Vibe dans {0} : l’appel démarrera tout seul.', 'No session yet. Start Claude Code, Codex or Mistral Vibe in {0}: the call will start by itself.')).replace('{0}', () => `<b>${esc(watched())}</b>`) : esc(L('Aucune session sur cet ordinateur pour l’instant. Lancez Claude Code, Codex ou Mistral Vibe (ou une tâche Cowork) : l’appel démarrera tout seul.', 'No session on this computer yet. Start Claude Code, Codex or Mistral Vibe (or a Cowork task): the call will start by itself.'));
2951
3241
  for (const id in S.agents) { const p = persona(S.agents[id]); Object.assign(S.agents[id], { name: p.name, role: p.role }); const t = $('#t-' + id); if (t) { t.querySelector('.tag span').textContent = p.role; t.querySelector('.tag b').textContent = p.name; if (id === 'main' || id === 'user') t.querySelector('.tag span').textContent = p.role; } }
@@ -3001,19 +3291,20 @@ function menuInit() {
3001
3291
  $('#menuNone').style.display = q && !far.length && !secs.some((sc) => sc.items.some((e) => !e.classList.contains('mhide'))) ? '' : 'none';
3002
3292
  };
3003
3293
  }
3004
- const onSwitch = (e) => { const b = e.target.closest('.mi[data-t]'); if (!b) return; prefs[b.dataset.t] = !prefs[b.dataset.t]; savePrefs(); if (prefs[b.dataset.t] && ['voice', 'office', 'music', 'notify'].includes(b.dataset.t)) claimAudio(); b.querySelector('.sw').classList.toggle('on', prefs[b.dataset.t]); AUD.apply(); if (b.dataset.t === 'shareUsage') { prefs.usageAsked = true; savePrefs(); usageOpened(true); } if (b.dataset.t === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'callTr') { prefs.callTrSeen = true; savePrefs(); setLang(prefs.lang); } if (b.dataset.t === 'voice') voiceOffer(); if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'files') paintFiles(); if (b.dataset.t === 'artNet' && S.present) renderPresent(); if (b.dataset.t === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); if (b.dataset.t === 'focusLayout') { document.body.classList.toggle('focusl', !!prefs.focusLayout); layout(); } if (b.dataset.t === 'roster') { document.body.classList.toggle('rost', prefs.roster); paintStates(); } if (b.dataset.t === 'notify') { prefs.notifyChosen = true; savePrefs(); } if (b.dataset.t === 'notify' && prefs.notify) askNotify(); if (b.dataset.t === 'vanish' && !prefs.vanish) { S.gone.clear(); paintStatus(); }
3294
+ const onSwitch = (e) => { const b = e.target.closest('.mi[data-t]'); if (!b) return; prefs[b.dataset.t] = !prefs[b.dataset.t]; savePrefs(); if (prefs[b.dataset.t] && ['voice', 'office', 'music', 'notify'].includes(b.dataset.t)) claimAudio(); b.querySelector('.sw').classList.toggle('on', prefs[b.dataset.t]); AUD.apply(); if (b.dataset.t === 'shareUsage') { prefs.usageAsked = true; savePrefs(); usageOpened(true); } if (b.dataset.t === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'callTr') { prefs.callTrSeen = true; savePrefs(); setLang(prefs.lang); } if (b.dataset.t === 'voice') { voiceOffer(); $('#voiceVolBox').style.display = prefs.voice ? '' : 'none'; } if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'files') paintFiles(); if (b.dataset.t === 'artNet' && S.present) renderPresent(); if (b.dataset.t === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); if (b.dataset.t === 'focusLayout') { document.body.classList.toggle('focusl', !!prefs.focusLayout); layout(); } if (b.dataset.t === 'roster') { document.body.classList.toggle('rost', prefs.roster); paintStates(); } if (b.dataset.t === 'notify') { prefs.notifyChosen = true; savePrefs(); } if (b.dataset.t === 'notify' && prefs.notify) askNotify(); if (b.dataset.t === 'vanish' && !prefs.vanish) { S.gone.clear(); paintStatus(); }
3005
3295
  if (b.dataset.t === 'askCard') paintAsk(Date.now());
3296
+ if (b.dataset.t === 'updateNotice') { prefs.updateAsked = true; savePrefs(); $('#updTip').style.display = 'none'; if (prefs.updateNotice) { updStart.at = 0; setTimeout(updStart, 600); } } /* an answer too; on: asked once the settings file says so (savePrefs waits 400 ms) */
3006
3297
  if (b.dataset.t === 'music') { $('#musicBox').style.display = prefs.music ? '' : 'none'; if (prefs.music) { AUD.init(); AUD.apply(); } } };
3007
3298
  $('#menu').onclick = onSwitch; $('#prefs').onclick = (e) => { if (e.target === $('#prefs')) return closePrefs(); onSwitch(e); setTimeout(syncSwitches); };
3008
3299
  function openPrefs(target) { // ⚙ → All settings; target: one of its settings, found by the search of the menu, shown and lit up
3009
3300
  $('#menu').classList.remove('on'); $('#prefs').classList.add('on'); syncSwitches(); document.querySelectorAll('#prefs .mi[data-t]').forEach((b) => b.querySelector('.sw').classList.toggle('on', !!prefs[b.dataset.t]));
3010
3301
  if (target) { target.scrollIntoView({ block: 'center' }); target.classList.remove('flash'); void target.offsetWidth; target.classList.add('flash'); (target.matches('.mi') ? target : target.querySelector('select, input, button') || target).focus(); } else $('#prefsX').focus();
3011
3302
  }
3012
- const PANEL_KEYS = ['office', 'officeVol', 'music', 'station', 'musicVol', 'notify', 'customLaptop', 'ownNames', 'roster', 'reactions', 'banter', 'chat', 'vanish', 'epi', 'files', 'artNet', 'visits', 'askCard', 'followTab']; // what the panel holds, and so what Reset puts back
3303
+ const PANEL_KEYS = ['office', 'officeVol', 'music', 'station', 'musicVol', 'voiceVol', 'notify', 'customLaptop', 'ownNames', 'roster', 'reactions', 'banter', 'chat', 'vanish', 'epi', 'files', 'artNet', 'visits', 'askCard', 'followTab']; // what the panel holds, and so what Reset puts back
3013
3304
  $('#prefsReset').onclick = async () => {
3014
3305
  const b = $('#prefsReset'); if (!b.classList.contains('sure')) { b.classList.add('sure'); b.textContent = L('Cliquez encore pour tout remettre', 'Click again to reset them all'); setTimeout(() => { b.classList.remove('sure'); b.textContent = L('Réglages par défaut', 'Reset to defaults'); }, 4000); return; } // two clicks: nothing is lost by a stray one
3015
3306
  for (const k of PANEL_KEYS) { if (k in PREF_DEFAULTS) prefs[k] = PREF_DEFAULTS[k]; else delete prefs[k]; } delete prefs.notifyChosen; // notifyChosen too: the default of notifications is decided at start-up from it
3016
- prefs._t = Date.now(); try { localStorage.setItem('cc.prefs', JSON.stringify(prefs)); } catch {} try { await fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(prefs) }); } catch {}
3307
+ prefs._t = Date.now(); try { localStorage.setItem('cc.prefs', prefsOut()); } catch {} try { await fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: prefsOut() }); } catch {}
3017
3308
  location.reload(); // every part of the page starts again from them
3018
3309
  };
3019
3310
  function menuTip() { // once, to someone who used the app before: where the settings went. Gone with its button, or as soon as the menu is opened
@@ -3041,7 +3332,7 @@ async function kokoroUI() {
3041
3332
  const box = $('#kokoroBox'), on = prefs.vstyle === 'kokoro'; box.style.display = on ? '' : 'none'; $('#vstyleTip').style.display = on ? 'none' : ''; if (!on) { clearInterval(kokoroTimer); kokoroTimer = null; return; }
3042
3333
  let st; try { st = await (await fetch('/api/kokoro')).json(); } catch { return; }
3043
3334
  const b = $('#kokoroInstall'), h = $('#kokoroHint'), addFr = st.installed && !st.g2p && !!CALL_LANG[prefs.lang]; b.style.display = st.installed && !addFr ? 'none' : ''; /* addFr: installed before French, Spanish and Portuguese were added, which is one small package more. Offered where one of them is the interface language: a session in that language is then read by these voices, translated or not */
3044
- b.disabled = st.installing || !st.npm; b.textContent = st.installing ? L('Installation…', 'Installing…') : addFr ? L('Ajouter les voix françaises', 'Add the voices of this language') + L(` (${st.g2pMb} Mo)`, ` (${st.g2pMb} MB)`) : L(`Installer (${st.sizeMb} Mo)`, `Install (${st.sizeMb} MB)`);
3335
+ b.disabled = st.installing || !st.npm; b.textContent = st.installing ? L('Installation…', 'Installing…') : addFr ? L('Ajouter les voix françaises', 'Add the voices of this language') + ' (' + L('{0} Mo', '{0} MB').replace('{0}', st.g2pMb) + ')' : L('Installer ({0} Mo)', 'Install ({0} MB)').replace('{0}', st.sizeMb);
3045
3336
  h.textContent = st.installing ? L('Téléchargement en cours, vous pouvez continuer : les agents babillent en attendant.', 'Downloading, you can carry on: the agents babble meanwhile.')
3046
3337
  : st.error ? st.error : !st.npm && !st.installed ? L('npm est introuvable : installez Node.js pour activer cette option.', 'npm not found: install Node.js to enable this option.')
3047
3338
  : st.installed ? (st.gaveUp ? L('Le moteur s’est arrêté : les agents babillent à la place.', 'The engine stopped: the agents babble instead.') : st.ready ? (addFr ? L('Voix prêtes en anglais. Le français est encore lu par les voix du système.', 'Voices ready in English. This language is still read by the system voices.') : L('Voix prêtes.', 'Voices ready.')) : L('Chargement du modèle (téléchargé au premier usage, environ 305 Mo)…', 'Loading the model (downloaded on first use, about 305 MB)…'))
@@ -3080,6 +3371,8 @@ $('#trNoteOk').onclick = () => { prefs.callTrSeen = true; savePrefs(); callNote(
3080
3371
  $('#trNoteOff').onclick = () => { prefs.callTrSeen = true; prefs.callTr = false; savePrefs(); setLang(prefs.lang); };
3081
3372
  $('#officeVol').value = prefs.officeVol; $('#officeBox').style.display = prefs.office ? '' : 'none';
3082
3373
  $('#officeVol').oninput = (e) => { prefs.officeVol = +e.target.value; savePrefs(); AUD.applyMusic(); };
3374
+ $('#voiceVol').value = prefs.voiceVol ?? 1; $('#voiceVolBox').style.display = prefs.voice ? '' : 'none';
3375
+ $('#voiceVol').oninput = (e) => { prefs.voiceVol = +e.target.value; savePrefs(); AUD.apply(); };
3083
3376
  $('#musicVol').oninput = (e) => { prefs.musicVol = +e.target.value; savePrefs(); AUD.applyMusic(); };
3084
3377
  $('#tok').onclick = () => openRecap();
3085
3378
  $('#bMenu').onclick = (e) => { e.stopPropagation(); $('#menu').classList.toggle('on'); };
@@ -3111,18 +3404,26 @@ function attnItems(now) {
3111
3404
  return out;
3112
3405
  }
3113
3406
  function paintAttn(now = Date.now()) {
3114
- const el = $('#attn'), a = attnItems(now), f = a[0];
3407
+ const el = $('#attn'), a = attnItems(now).filter((x) => x.r), f = a[0]; /* the other sessions only: the call's own agents are already on the status line above (G still goes to them) */
3115
3408
  const html = f ? `<span class="aw">✋ <b>${esc(f.who)}</b> ${esc(f.sure ? L('vous attend', 'needs you') : L('vous attend peut-être', 'may need you'))}${f.what ? ' · ' + esc(f.what.replace(/\s+/g, ' ').slice(0, 120)) : ''}${f.since ? ' · ' + agoStr(Math.max(0, now - f.since)) : ''}</span>${a.length > 1 ? `<span class="am">+${a.length - 1}</span>` : ''}<span class="ak">G</span>` : '';
3116
- if (html !== paintAttn.html) { paintAttn.html = html; el.innerHTML = html; el.hidden = !f; el.title = a.map((x) => x.who + (x.what ? ' · ' + x.what : '')).join('\n'); }
3409
+ if (html !== paintAttn.html) { paintAttn.html = html; el.innerHTML = html; el.hidden = !f; el.title = L('Cliquez pour aller répondre', 'Click to go and answer') + '\n' + a.map((x) => x.who + (x.what ? ' · ' + x.what : '') + (x.r.menu && x.r.menu.about ? '\n ' + x.r.menu.about : '')).join('\n'); } /* and what the command is for */
3410
+ }
3411
+ // A click on what needs you also opens that session where it can be answered: its Claude Code tab in the editor window that runs it, or the terminal or app it runs in (server.js, answerIn).
3412
+ // Nothing to open (another tool, an older Claude Code, a session a program runs): the call alone goes there, as before.
3413
+ function answerAt(c) {
3414
+ if (!S.live || S.demo || !c || !c.id || (answerAt.k === c.id && Date.now() - answerAt.at < 2000)) return; answerAt.k = c.id; answerAt.at = Date.now(); // one opening per click, not per repeated click
3415
+ if (EMBED && APP.kind === 'editor') { window.parent.postMessage({ agentStandup: 'answer', proj: c.proj, id: c.id }, '*'); return; } // in the editor: the extension opens a session of its own window itself, with no link
3416
+ fetch('/api/answer', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: c.proj, id: c.id }) }).then((r) => r.json()).then((a) => { if (a && a.how === 'app' && a.app) toast('✋ ' + L('Elle vous attend dans ', 'Waiting for you in ') + a.app); }).catch(() => {});
3117
3417
  }
3118
- function goAttn() { // the next thing that needs you: an agent of this session, or another session (which the call goes to)
3119
- const a = attnItems(Date.now()); if (!a.length) { toast(L('Personne n’a besoin de vous pour le moment', 'Nobody needs you right now')); return; }
3418
+ function goAttn(others, open) { // the next thing that needs you: an agent of this session, or another session (which the call goes to); others: only the other sessions (the red line shows those); open: a click, which also opens it where it can be answered (G only moves, so that it can be pressed again)
3419
+ const a = attnItems(Date.now()).filter((x) => !others || x.r); if (!a.length) { toast(L('Personne n’a besoin de vous pour le moment', 'Nobody needs you right now')); return; }
3120
3420
  goAttn.i = ((goAttn.i || 0) + (goAttn.at && Date.now() - goAttn.at < 30000 ? 1 : 0)) % a.length; goAttn.at = Date.now(); const x = a[goAttn.i];
3121
- if (x.r) { goAttn.i = 0; setView('call'); goSession(x.r.proj, x.r.id); return; }
3421
+ if (x.r) { goAttn.i = 0; setView('call'); goSession(x.r.proj, x.r.id); if (open) answerAt(x.r); return; }
3422
+ if (open && x.sure) answerAt(S.cur);
3122
3423
  if (document.body.classList.contains('tree') || document.body.classList.contains('board')) setView('call');
3123
3424
  S.focusLock = Date.now() + 25000; setFocus(x.id); const t = $('#t-' + x.id); if (t) { t.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); popTile(x.id); }
3124
3425
  }
3125
- $('#attn').onclick = goAttn;
3426
+ $('#attn').onclick = () => goAttn(true, true);
3126
3427
  // J / K (or a click on the “need you” chip) jump to the agents that need you or are stalled, one after the other
3127
3428
  function jumpAttn(dir = 1) {
3128
3429
  const a = (S.attn || []).filter((id) => $('#t-' + id));
@@ -3152,7 +3453,7 @@ function paintPill() {
3152
3453
  else if (!S.playing) txt = L('PAUSE', 'PAUSED');
3153
3454
  else {
3154
3455
  sess = true; const st = {}, by = { working: [], waiting: [], blocked: [], stalled: [], done: [], idle: [] };
3155
- for (const id in S.agents) if (id !== 'user' && !S.gone.has(id) && (id === 'main' || S.status[id])) { st[id] = agentState(id, now); by[st[id].k].push(id); }
3456
+ for (const id in S.agents) if (id !== 'user' && !S.gone.has(id) && (id === 'main' || S.status[id])) { st[id] = agentState(id, now); by[st[id].k === 'blocked' && !st[id].sure ? 'working' : st[id].k].push(id); } /* red only when sure: a guess reads as work, its tile says the rest */
3156
3457
  const what = (id) => `${nameOf(id)} — ${st[id].txt.replace(/^\S+\s/, '')}`, more = (a) => (a.length > 1 ? ` +${a.length - 1}` : ''), lead = st.main || { k: 'idle' };
3157
3458
  if (by.blocked.length) { cls = 'blocked'; to = by.blocked[0]; const q = st[to].ask || ''; txt = '✋ ' + what(to) + more(by.blocked) + (q ? ' · ' + (q.length > 110 ? q.slice(0, 108).replace(/\s+\S*$/, '') + '…' : q) : ''); if (q) tip = q; } // the question or the command it waits on, next to its timer
3158
3459
  else if (by.stalled.length) { cls = 'stalled'; to = by.stalled[0]; txt = '⚠ ' + what(to) + more(by.stalled); }
@@ -3160,6 +3461,7 @@ function paintPill() {
3160
3461
  const w = by.working, wt = lead.k === 'waiting' ? 'main' : w.length ? '' : by.waiting[0]; cls = 'working'; to = wt || (w.length === 1 ? w[0] : 'main');
3161
3462
  txt = (w.length === 1 && !wt ? '⚙ ' + what(w[0]) : w.length ? `⚙ ${w.length} ${L('au travail', 'working')}` : '') + (wt ? (w.length ? ' · ' : '🔗 ') + what(wt) : '');
3162
3463
  }
3464
+ else if (isTurn('main', lead) && lead.stop) { cls = 'stalled'; to = 'main'; txt = lead.stop; } // the usage limit or a logout: what to know, not the last word
3163
3465
  else if (isTurn('main', lead)) { const g = lead.gave, last = g || lastWord(); cls = g ? 'stalled' : 'turn'; to = 'main'; txt = (g ? '⚠ ' + L('a abandonné ?', 'gave up?') : '👉 ' + L('à vous', 'your turn')) + (last ? ' · ' + (last.length > 110 ? last.slice(0, 108).replace(/\s+\S*$/, '') + '…' : last) : ''); tip = last; } // gave: what it says it could not do, in its own first sentence
3164
3466
  else { cls = 'idle'; to = 'main'; txt = '💤 ' + L('inactif', 'idle'); }
3165
3467
  }
@@ -3171,7 +3473,8 @@ function paintPill() {
3171
3473
  S.pillTo = to; S.pillSess = sess;
3172
3474
  }
3173
3475
  function pillGo() { // to the agent the status is about; several need you: one after the other (as J does)
3174
- const id = S.pillTo, t = id && $('#t-' + id); if (!t) return; if ((S.attn || []).includes(id)) { jumpAttn(1); return; }
3476
+ const id = S.pillTo, t = id && $('#t-' + id); if (!t) return; const st = agentState(id, Date.now()); if (st.k === 'blocked' && st.sure) answerAt(S.cur); /* it asks: where it can be answered too */
3477
+ if ((S.attn || []).includes(id)) { jumpAttn(1); return; }
3175
3478
  if (document.body.classList.contains('tree') || document.body.classList.contains('board')) setView('call');
3176
3479
  S.focusLock = Date.now() + 25000; setFocus(id); paintStates(); t.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); popTile(id);
3177
3480
  }
@@ -3203,7 +3506,7 @@ new MutationObserver((ms) => {
3203
3506
  }
3204
3507
  }).observe($('#stage'), { subtree: true, childList: true });
3205
3508
  // Replay: arrow keys step through the call, N jumps between highlights, speed presets, and the position of each session is remembered
3206
- const stepKind = (e) => !['usage', 'results', 'finish', 'compact'].includes(e.kind);
3509
+ const stepKind = (e) => !['usage', 'results', 'finish', 'compact', 'tasks'].includes(e.kind);
3207
3510
  function stepEvent(dir) {
3208
3511
  if (S.live || !S.events.length) return; let i = S.idx + dir; while (i > 0 && i < S.events.length - 1 && !stepKind(S.events[i])) i += dir;
3209
3512
  seekTo(Math.max(0, Math.min(S.events.length - 1, i)));
@@ -3267,7 +3570,7 @@ if (EMBED) $('#mBrowser').style.display = $('#mFollowTab').style.display = '';
3267
3570
  if (!prefs.langChosen && FR() && h.claude === null && !h.apiKey) { prefs.lang = 'en'; applyLang(); }
3268
3571
  if (TRL()) { fetch('/api/warm?lang=' + CALL()).catch(() => {}); prefetchTr(S.idx); } callNote();
3269
3572
  });
3270
- if (Q.get('lang')) { await setLang(Q.get('lang'), false); }
3573
+ if (Q.get('lang')) { langKeep = prefs.lang; await setLang(Q.get('lang'), false); }
3271
3574
  if (Q.get('demo')) {
3272
3575
  if (Q.get('view') === 'tree') setView('tree');
3273
3576
  await setMode('demo'); if (Q.get('speed')) $('#speed').value = Q.get('speed');