@double_geste/agent-standup 1.41.1 → 1.42.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/codex.js CHANGED
@@ -61,7 +61,12 @@ function headOf(text, capped) {
61
61
  let out = { ok: false, cwd: '', dir: '', child: false };
62
62
  if (!text) return out; // not written yet: looked at again next time
63
63
  let p = null; try { const r = JSON.parse(text); if (r && r.type === 'session_meta' && r.payload && typeof r.payload === 'object') p = r.payload; } catch {}
64
- if (p) out = { ok: true, cwd: typeof p.cwd === 'string' ? p.cwd : '', child: !!p.parent_thread_id || !!(p.source && typeof p.source === 'object' && p.source.subagent) };
64
+ if (p) {
65
+ const sub = p.source && typeof p.source === 'object' && p.source.subagent, spawn = sub && typeof sub.thread_spawn === 'object' && sub.thread_spawn;
66
+ out = { ok: true, cwd: typeof p.cwd === 'string' ? p.cwd : '', child: !!p.parent_thread_id || !!sub };
67
+ if (spawn) Object.assign(out, { parent: String(spawn.parent_thread_id || p.parent_thread_id || '').toLowerCase(), born: Date.parse(p.timestamp) || 0,
68
+ name: String(p.agent_nickname || spawn.agent_nickname || ''), role: String(p.agent_role || spawn.agent_role || 'agent'), task: String(spawn.agent_path || '').split('/').pop() || '' });
69
+ }
65
70
  else if (capped && /^\{"timestamp":"[^"]*","(?:ordinal":\d+,")?type":"session_meta"/.test(text)) { // a first line longer than what was read: the two facts, without the rest
66
71
  const cwd = text.match(/"cwd":"((?:[^"\\]|\\.)*)"/); let c = ''; try { c = cwd ? JSON.parse('"' + cwd[1] + '"') : ''; } catch {}
67
72
  out = { ok: true, cwd: c, child: /"parent_thread_id":"[^"]+"/.test(text) || /"source":\{"subagent"/.test(text) };
@@ -69,9 +74,45 @@ function headOf(text, capped) {
69
74
  out.dir = dirKey(out.cwd);
70
75
  return out;
71
76
  }
77
+ // Only explicit thread_spawn relationships are team members. Guardian/approval reviews and unrelated sessions never join a call.
78
+ const kinCache = new Map(); // file → { top, parent }: a file's place in its family, from its first line, which never changes. Kept whatever the size of headCache, so that a poll does not read every first line again
79
+ function kin(r) {
80
+ const was = kinCache.get(r.file); if (was) return was;
81
+ const h = head(r.file), k = { top: h.ok && !h.child, parent: h.parent && h.parent !== r.id ? h.parent : '' };
82
+ if (headCache.get(r.file) === h) kinCache.set(r.file, k); // a first line still being written is read again next time
83
+ return k;
84
+ }
85
+ let familyMemo = { scan: null, children: new Map() };
86
+ function descendants(id) {
87
+ const s = scan();
88
+ if (familyMemo.scan !== s) {
89
+ const children = new Map();
90
+ for (const r of s.rows) { const k = kin(r); if (!k.parent) continue; const list = children.get(k.parent) || []; list.push(r); children.set(k.parent, list); }
91
+ if (kinCache.size > s.rows.length * 2 + 100) { const live = new Set(s.rows.map((r) => r.file)); for (const f of kinCache.keys()) if (!live.has(f)) kinCache.delete(f); } // files gone or compressed under another name
92
+ familyMemo = { scan: s, children };
93
+ }
94
+ const out = [], seen = new Set([id]), pending = [id];
95
+ for (let i = 0; i < pending.length; i++) for (const r of familyMemo.children.get(pending[i]) || []) {
96
+ if (seen.has(r.id)) continue; seen.add(r.id); pending.push(r.id); out.push({ ...r, h: head(r.file) });
97
+ }
98
+ return out.sort((a, b) => a.h.born - b.h.born || a.id.localeCompare(b.id));
99
+ }
100
+ function subFiles(id) { // a compressed child is read whole only when the timeline is built (state, called by server.js), not each time its files are listed
101
+ const out = descendants(id).map((r) => ({ file: r.file, aid: r.id, mtime: r.mtime,
102
+ meta: { agentType: r.h.role, description: r.h.task || r.h.role, name: r.h.name || r.h.task, parent: r.h.parent === id ? 'main' : r.h.parent, startedAt: r.h.born },
103
+ ...(r.zst ? { zst: true } : {}) }));
104
+ out.dirs = []; out.journals = []; return out;
105
+ }
106
+ const subCount = (id) => descendants(id).length;
72
107
  // The threads a person started, newest first. A thread started by another thread (Codex's review of a command before it runs, a sub-agent) is not a session of its own.
108
+ // A thread with sub-agents is as recent as the newest of them: the rows come newest first, so the first one met of a family places the whole family, and the list stops at limit.
73
109
  function sessions(limit = 80) {
74
- const out = []; for (const r of scan().rows) { const h = head(r.file); if (!h.ok || h.child) continue; out.push({ ...r, cwd: h.cwd, dir: h.dir }); if (out.length >= limit) break; }
110
+ const s = scan(), out = [], seen = new Set();
111
+ for (const r of s.rows) {
112
+ let top = r, k = kin(r); for (let n = 0; k.parent && n < 32; n++) { const p = s.byId.get(k.parent); if (!p) break; top = p; k = kin(p); } // up to the thread the person started
113
+ if (!k.top || seen.has(top.id)) continue; seen.add(top.id);
114
+ const h = head(top.file); out.push({ ...top, mtime: r.mtime, cwd: h.cwd, dir: h.dir }); if (out.length >= limit) break;
115
+ }
75
116
  return out;
76
117
  }
77
118
  const under = (cwd, key) => { for (let d = String(cwd || ''); d;) { if (dirKey(d) === key) return true; const up = path.dirname(d); if (up === d) return false; d = up; } return false; }; // key is the folder itself or one above it: a dashed name alone cannot tell app/old (inside app) from app-old (beside it)
@@ -132,7 +173,7 @@ const title = (r) => threadNames().get(r.id) || firstPrompt(r) || r.id;
132
173
 
133
174
  // ---- the board: is the agent in the middle of a turn, or is it the person's turn? Read from the end of the file.
134
175
  const tailCache = new Map();
135
- function boardRow(r, now) {
176
+ function tailState(r) {
136
177
  const sig = r.mtime + ':' + r.size; let t = r.zst ? zFacts(r.file) || { turn: 'closed', asked: 0 } : tailCache.get(r.file); // a compressed thread not read yet: Codex compresses only a thread nobody uses
137
178
  if (!r.zst && (!t || t.sig !== sig)) {
138
179
  t = { sig, turn: '', asked: (t && t.asked) || 0 }; // asked: when the person last typed something there, which is what moves the live call (see currentSession in server.js)
@@ -142,8 +183,12 @@ function boardRow(r, now) {
142
183
  } catch {}
143
184
  if (tailCache.size > 200) tailCache.delete(tailCache.keys().next().value); tailCache.set(r.file, t);
144
185
  }
145
- const age = now - r.mtime, state = age >= 30 * 60e3 ? 'idle' : t.turn === 'closed' ? 'turn' : age < 10 * 60e3 ? 'working' : 'idle';
146
- return { proj: PROJ, id: r.id, title: title(r), mtime: r.mtime, state, tool: '', ageMs: age, subActive: 0, subTotal: 0, asked: t.asked, dir: r.dir, source: 'codex' };
186
+ return t;
187
+ }
188
+ function boardRow(r, now) {
189
+ const t = tailState(r), kids = descendants(r.id), subActive = kids.filter((k) => now - k.mtime < 10 * 60e3 && tailState(k).turn !== 'closed').length;
190
+ const mtime = Math.max(r.mtime, ...kids.map((k) => k.mtime)), age = now - mtime, state = subActive ? 'working' : age >= 30 * 60e3 ? 'idle' : t.turn === 'closed' ? 'turn' : age < 10 * 60e3 ? 'working' : 'idle';
191
+ return { proj: PROJ, id: r.id, title: title(r), mtime, state, tool: '', ageMs: age, subActive, subTotal: kids.length, asked: t.asked, dir: r.dir, source: 'codex' };
147
192
  }
148
193
  function tailOf(text, t) { // the end of a file: whether the last turn is open or over (t.turn), and when the person last typed something (t.asked)
149
194
  for (const l of text.split('\n')) { const m = /"type":"(task_started|task_complete|turn_started|turn_complete|turn_aborted)"/.exec(l.slice(0, 400)); if (m && l.includes('"event_msg"')) t.turn = /started/.test(m[1]) ? 'open' : 'closed';
@@ -185,18 +230,19 @@ function zNext() { // one file at a time
185
230
  src.pipe(z);
186
231
  }
187
232
  let made = null; // the record reader server.js made with parser(): a compressed thread goes through it here, whole
188
- const zStates = new Map(); // compressed file → { sig, st }: the events of the last two threads read
189
- function state(id) { // null: a plain file, which server.js reads line by line itself
233
+ const zStates = new Map(); // compressed file and agent → { sig, st, size }: the events of the threads read last; a call with several compressed workers keeps them all, within about 64 MB of compressed files
234
+ function state(id, agent = 'main') { // null: a plain file, which server.js reads line by line itself
190
235
  const r = row(id); if (!r || !r.zst || !made) return null;
191
- const sig = r.mtime + ':' + r.size, hit = zStates.get(r.file); if (hit && hit.sig === sig) { zStates.delete(r.file); zStates.set(r.file, hit); return hit.st; }
192
- const st = { agent: 'main', file: r.file, journal: false, raw: [], toolName: {}, msgUsage: new Map() }; // what server.js's own reader would make of the plain file
236
+ const sig = r.mtime + ':' + r.size, key = r.file + ':' + agent, hit = zStates.get(key); if (hit && hit.sig === sig) { zStates.delete(key); zStates.set(key, hit); return hit.st; }
237
+ const st = { agent, file: r.file, journal: false, raw: [], toolName: {}, msgUsage: new Map() }; // what server.js's own reader would make of the plain file
193
238
  let buf = null; try { buf = unzst(r.file); } catch {} if (!buf) return st; // unreadable for now: an empty session, never the compressed bytes taken for lines
194
239
  for (let at = 0; at < buf.length;) {
195
240
  let nl = buf.indexOf(10, at); if (nl < 0) nl = buf.length;
196
241
  if (nl > at) { let j = null; try { j = JSON.parse(buf.toString('utf8', at, nl)); } catch {} if (j && typeof j === 'object') { try { made(st, j); } catch {} } } // one odd record must not take the whole timeline down
197
242
  at = nl + 1;
198
243
  }
199
- zStates.set(r.file, { sig, st }); while (zStates.size > 2) zStates.delete(zStates.keys().next().value);
244
+ zStates.set(key, { sig, st, size: r.size }); let total = 0; for (const v of zStates.values()) total += v.size || 0;
245
+ while (zStates.size > 2 && (zStates.size > 12 || total > 64 * 1024 * 1024)) { const k0 = zStates.keys().next().value; total -= zStates.get(k0).size || 0; zStates.delete(k0); }
200
246
  return st;
201
247
  }
202
248
 
@@ -215,13 +261,15 @@ function parser({ toolLabel, clip, clipOut = clip, testsOf = () => null, diffOf
215
261
  };
216
262
  const NO_RESULT = new Set(['TodoWrite']);
217
263
  return (made = function record(st, r) {
264
+ if (r.type === 'session_meta') { const h = headOf(JSON.stringify(r)); if (st.agent !== 'main' && h.parent && !st.birth) st.birth = h.born; return; } // the child's own first line: a fork of a fork may carry its parent's session_meta further down
218
265
  if (r.type !== 'event_msg' && r.type !== 'response_item' && r.type !== 'turn_context' && r.type !== 'compacted') return;
266
+ if (st.birth && Date.parse(r.timestamp) < st.birth) return; // a fork may include its parent's earlier history: it is not work this child did
219
267
  const agent = st.agent, p = r.payload && typeof r.payload === 'object' ? r.payload : {}, cx = st.cx || (st.cx = { items: false, model: '', n: 0, tot: null, last: 0, userAt: -1 });
220
268
  const ts = Math.max(Date.parse(r.timestamp) || 0, st.lastTs || 0); st.lastTs = ts; // the lines of one file are in order; a line without a time takes the last one
221
269
  const push = (e) => { e.k = agent + ':' + st.raw.length; st.raw.push(e); if (e.ts > cx.last) cx.last = e.ts; return e; };
222
270
  const th = () => { const t = st.th; st.th = ''; return t ? { th: t } : {}; };
223
271
  const say = (text, final) => { const t = String(text == null ? '' : text).trim(); if (!t) return; const e = push({ ts, agent, kind: 'say', text: t, ...th() }); st.act = st.raw.length - 1; if (final && agent === 'main') e.end = 1; };
224
- const user = (text, img, iid) => { const t = typed(text); if (!t) return; push({ ts, agent: 'user', kind: 'user', text: t, ...(img > 0 && typeof iid === 'string' && /^[\w.\-]{6,200}$/.test(iid) ? { img, iid } : {}) }); cx.userAt = st.raw.length - 1; };
272
+ const user = (text, img, iid) => { const t = typed(text); if (!t) return; if (agent !== 'main') { if (!/^gAAAAA[\w=-]+$/.test(t)) { if (!st.prompt) st.prompt = { ts, text: t }; else (st.prompts || (st.prompts = [])).push({ ts, text: t }); } return; } push({ ts, agent: 'user', kind: 'user', text: t, ...(img > 0 && typeof iid === 'string' && /^[\w.\-]{6,200}$/.test(iid) ? { img, iid } : {}) }); cx.userAt = st.raw.length - 1; };
225
273
  const call = (id, name, input, at) => { const when = Math.max(Math.min(at || ts, ts), cx.last); st.toolName[id] = name; push({ ts: when, agent, kind: 'tool', tool: toolLabel({ id, name, input: input || {} }, when), ...th() }); st.act = st.raw.length - 1; }; // a command is placed when it started, never before what the file already said
226
274
  const result = (id, out, err, more) => { const n = st.toolName[id]; if (!n || NO_RESULT.has(n)) return; push({ ts, agent, kind: 'results', items: [{ id, err: !!err, out: clipOut(String(out == null ? '' : out).trimEnd(), resultMax[n] || (/^mcp__/.test(n) ? 900 : 600)), ...more }] }); }; // more: what else the screen shows of it (img, tests, diff, search)
227
275
  const views = () => { const v = cx.views || []; cx.views = []; return v; }; // the pictures looked at (ImageView) whose output has not come yet
@@ -231,6 +279,7 @@ function parser({ toolLabel, clip, clipOut = clip, testsOf = () => null, diffOf
231
279
  if (r.type === 'turn_context') { if (typeof p.model === 'string') cx.model = p.model; return; }
232
280
  if (r.type === 'compacted') { push({ ts, agent, kind: 'compact' }); return; }
233
281
  if (r.type === 'event_msg') {
282
+ if (p.type === 'task_started' || p.type === 'turn_started') { st.completed = false; return; }
234
283
  if (p.type === 'item_completed' && p.item && typeof p.item === 'object') {
235
284
  const it = p.item, id = String(it.id || 'cx' + st.raw.length), at = +p.started_at_ms || 0; cx.items = true;
236
285
  if (it.type === 'UserMessage') { viewed(null); user(partsText(it.content), localImages(it.content), it.id); }
@@ -262,7 +311,7 @@ function parser({ toolLabel, clip, clipOut = clip, testsOf = () => null, diffOf
262
311
  st.msgUsage.set('t' + cx.n++, { ts, u: { i: Math.max(0, (u.input_tokens || 0) - cached - w), o: u.output_tokens || 0, r: cached, w }, model: cx.model || 'codex', ...(info.model_context_window > 0 ? { cw: info.model_context_window } : {}) }); // cw: the size of the context window, which Codex states
263
312
  return;
264
313
  }
265
- if (p.type === 'task_complete' || p.type === 'turn_complete' || p.type === 'turn_aborted') { viewed(null); endTurn(); }
314
+ if (p.type === 'task_complete' || p.type === 'turn_complete' || p.type === 'turn_aborted') { viewed(null); endTurn(); st.completed = true; st.completedAt = ts; }
266
315
  return;
267
316
  }
268
317
  // response_item: what the model sent, raw
@@ -330,7 +379,8 @@ function findImage(buf, toolId, n, user) { // { type, data } or null
330
379
  }
331
380
  const sniff = (b, type) => (b[0] === 0x89 && b[1] === 0x50 ? 'image/png' : b[0] === 0xff && b[1] === 0xd8 ? 'image/jpeg' : b.toString('latin1', 0, 4) === 'GIF8' ? 'image/gif' : b.toString('latin1', 8, 12) === 'WEBP' ? 'image/webp' : type); // the bytes say what they are: a computer-use screenshot written image/png is often a JPEG
332
381
  const imgMemo = new Map();
333
- function image(id, toolId, n, user) { // { type, buf } or null
382
+ function image(id, toolId, n, user, agent = 'main') { // { type, buf } or null
383
+ if (agent !== 'main' && agent !== 'user') { if (!descendants(id).some((r) => r.id === agent)) return null; id = agent; }
334
384
  const r = row(id); if (!r || typeof toolId !== 'string' || toolId.length < 4 || !(n >= 0)) return null;
335
385
  const key = r.file + '|' + r.mtime + '|' + toolId + '|' + n + (user ? '|u' : ''); if (imgMemo.has(key)) return imgMemo.get(key);
336
386
  let found = null; try { const buf = rollout(r); found = buf ? findImage(buf, toolId, n, !!user) : null; } catch {}
@@ -338,4 +388,4 @@ function image(id, toolId, n, user) { // { type, buf } or null
338
388
  imgMemo.set(key, out); if (imgMemo.size > 12) imgMemo.delete(imgMemo.keys().next().value);
339
389
  return out;
340
390
  }
341
- module.exports = { PROJ, SOURCE, home, dirKey, sessions, row, fileOf, cwd, inProject, projectLabel, title, boardRow, state, parser, image };
391
+ module.exports = { PROJ, SOURCE, home, dirKey, sessions, row, fileOf, cwd, inProject, projectLabel, title, boardRow, subFiles, subCount, state, parser, image };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@double_geste/agent-standup",
3
- "version": "1.41.1",
3
+ "version": "1.42.0",
4
4
  "description": "Your Claude Code, Codex and Mistral Vibe agents as a live video call, from the terminal: a local page in your browser, plus one-line status for status bars. Free, open source, zero token cost.",
5
5
  "bin": {
6
6
  "agent-standup": "bin/agent-standup.js"
package/public/index.html CHANGED
@@ -236,6 +236,7 @@
236
236
  .tag { position:absolute; left:6px; bottom:6px; right:6px; display:flex; gap:5px; pointer-events:none }
237
237
  .tag b, .tag span { background:rgba(14,15,24,.78); backdrop-filter:blur(6px); padding:2px 9px; border-radius:99px; font-size:11.5px; white-space:nowrap }
238
238
  .tag span { color:#e3e6f0; font-size:10.5px; overflow:hidden; text-overflow:ellipsis; min-width:0 }
239
+ #t-main .tag b { min-width:0; overflow:hidden; text-overflow:ellipsis } #t-main .tag b + span { flex-shrink:0 } /* a long name for the lead (⚙ → Lead agent name) is cut, not its Lead badge */
239
240
  .status { position:absolute; top:6px; right:6px; font-size:11.5px; font-weight:600; padding:2px 9px; border-radius:99px; background:rgba(14,15,24,.8); backdrop-filter:blur(6px) }
240
241
  #stage .tile .status { white-space:normal; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.3; border-radius:10px } #stage .tile .status:empty { display:none } /* what a tile is doing: two lines before it is cut */
241
242
  .status.working { color:var(--gold) } .status.done { color:var(--ok) } .status.turn { color:#0b1020; background:var(--accent) }
@@ -300,7 +301,7 @@
300
301
  .coffee-btn { color:#ffd24a !important; background:rgba(255,210,74,.12); box-shadow:inset 0 0 0 1px rgba(255,210,74,.35) } .coffee-btn:hover { background:rgba(255,210,74,.22) !important }
301
302
  .glink { color:var(--dim); font-size:12.5px; text-decoration:underline; text-underline-offset:3px } .glink:hover { color:#ffd24a }
302
303
  #mCoffee { background:rgba(255,210,74,.10); box-shadow:inset 0 0 0 1px rgba(255,210,74,.3); margin-top:4px } #mCoffee:hover { background:rgba(255,210,74,.2) }
303
- #menuQ, #logQ { background:var(--bg); color:var(--text); border:1px solid var(--line); border-radius:8px; padding:6px 9px; font:inherit; font-size:12.5px; outline:none } #menuQ:focus, #logQ:focus { border-color:var(--accent) }
304
+ #menuQ, #logQ, #leadName { background:var(--bg); color:var(--text); border:1px solid var(--line); border-radius:8px; padding:6px 9px; font:inherit; font-size:12.5px; outline:none } #menuQ:focus, #logQ:focus, #leadName:focus { border-color:var(--accent) } #leadName { width:100%; margin:2px 0 6px } #leadName:disabled { opacity:.6 } #leadHint { font-size:11.5px; margin:-2px 0 6px }
304
305
  #switcher { position:fixed; inset:0; z-index:20; background:rgba(5,6,12,.7); display:flex; align-items:flex-start; justify-content:center; padding-top:12vh } #switcher .sbox { width:min(560px,92vw); background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.6); overflow:hidden }
305
306
  #swq { width:100%; border:0; border-bottom:1px solid var(--line); background:transparent; color:var(--text); font:inherit; font-size:15px; padding:14px 16px; outline:none } #swl { max-height:50vh; overflow:auto } .swr { display:grid; grid-template-columns:auto 1fr; gap:2px 10px; padding:9px 14px; cursor:pointer; align-items:center } .swr.on, .swr:hover { background:var(--panel2) } .swr b { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap } .swr i { grid-column:2; font-style:normal; font-size:11px; color:var(--dim) }
306
307
  #sps { display:none; gap:2px; flex:none } body.replay #sps { display:inline-flex } #sps button { background:var(--panel2); color:var(--dim); border:1px solid var(--line); border-radius:6px; padding:1px 6px; font:inherit; font-size:11px; cursor:pointer } #sps button.on { color:var(--text); border-color:var(--accent) }
@@ -400,7 +401,7 @@
400
401
  <div class="box" id="menuShop"></div>
401
402
  <h4 data-fr="Source" data-en="Source">Source</h4>
402
403
  <div class="box"><div class="seg" style="width:100%" id="modeSeg"><button data-m="live" style="flex:1" data-fr="Live" data-en="Live">Live</button><button data-m="replay" style="flex:1" data-fr="Replay" data-en="Replay">Replay</button><button data-m="demo" style="flex:1" data-fr="Démo" data-en="Demo">Demo</button></div>
403
- <select id="liveProj" style="display:none;margin-top:6px" title="Project to follow"></select>
404
+ <label id="liveProjBox" style="display:none;margin-top:6px"><span class="dim" style="display:block;font-size:11.5px;margin:0 0 3px 2px" data-fr="Projet à suivre" data-en="Project to follow">Projet à suivre</span><select id="liveProj" style="width:100%" title="Project to follow"></select></label>
404
405
  <select id="sessions" style="display:none"></select></div>
405
406
  <h4 data-fr="Plus" data-en="More">Plus</h4>
406
407
  <button class="mi" id="mPrefs"><span data-fr="⚙ Tous les réglages (affichage, alertes…)" data-en="⚙ All settings (display, alerts…)">⚙ Tous les réglages (affichage, alertes…)</span><span class="dim" aria-hidden="true">›</span></button>
@@ -435,6 +436,7 @@
435
436
  <h4 data-fr="Personnages" data-en="Characters">Personnages</h4>
436
437
  <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>
437
438
  <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>
439
+ <div class="box" id="leadBox"><div class="lbl"><span data-fr="Nom de l’agent principal" data-en="Lead agent name">Nom de l’agent principal</span></div><input id="leadName" type="text" maxlength="48" placeholder="Margot" autocomplete="off" spellcheck="false" aria-label="Lead agent name"><div class="dim" id="leadHint" style="display:none"></div></div>
438
440
  </div><div class="pcol">
439
441
  <h4 data-fr="Affichage" data-en="Display">Affichage</h4>
440
442
  <button class="mi" data-t="roster"><span data-fr="Liste des agents (à gauche)" data-en="Agents list (left)">Liste des agents (à gauche)</span><i class="sw"></i></button>
@@ -506,8 +508,9 @@ const APP = window.AS_APP && typeof window.AS_APP === 'object' && typeof window.
506
508
 
507
509
  let prefs = { lang: 'en', voice: true, roster: false, 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 };
508
510
  const PREF_DEFAULTS = { ...prefs }; // for ⚙ → All settings → Reset to defaults
511
+ let prefsBase = {}; // the settings file as this page last knew it: a save sends only what changed since (prefsPatch), so another window's newer choices are not written over
509
512
  { 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
510
- const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; const won = (sv._t || 0) > (loc._t || 0) ? sv : loc; Object.assign(prefs, won); if (Object.keys(won).length && !('roster' in won)) prefs.roster = true; /* settings saved before the list could be turned off: it stays as they had it, on */
513
+ const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; prefsBase = JSON.parse(JSON.stringify(sv)); const won = (sv._t || 0) >= (loc._t || 0) && Object.keys(sv).length ? sv : loc; Object.assign(prefs, won); delete prefs._patch; /* a tie: this window saved last, and the file holds that save merged with what the other windows changed */ if (Object.keys(won).length && !('roster' in won)) prefs.roster = true; /* settings saved before the list could be turned off: it stays as they had it, on */
511
514
  if ((+sv.shareUsageT || 0) > (+prefs.shareUsageT || 0)) { prefs.shareUsage = sv.shareUsage; prefs.shareUsageT = sv.shareUsageT; prefs.usageAsked = sv.usageAsked; } } // the usage answer: the newest one, as the server keeps it (this origin's copy may hold an older one)
512
515
  const HAD_PREFS = !!prefs._t; // someone who used the app before this page: shown once where the settings went
513
516
  if (!HAD_PREFS) prefs.menuTipSeen = true; // a first visit: the menu was never anywhere else for this person, so the tip is not shown on the next visits either
@@ -522,7 +525,9 @@ let prefsTimer = null;
522
525
  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
526
  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
527
  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); };
528
+ const prefsPatch = () => { const now = JSON.parse(prefsOut()), set = {}, del = []; for (const k in now) if (JSON.stringify(now[k]) !== JSON.stringify(prefsBase[k])) set[k] = now[k]; for (const k in prefsBase) if (!(k in now)) del.push(k); prefsBase = now; return JSON.stringify({ ...now, _patch: { set, del } }); }; // what changed (the server merges it into the file), with the whole settings beside it for a server from before 1.42, which writes them as it always did
529
+ const putPrefs = () => { const prev = prefsBase; return fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: prefsPatch() }).then((r) => { if (!r.ok) throw new Error(r.status); return r; }).catch((e) => { prefsBase = prev; throw e; }); }; // not saved: the next save sends these changes again, and only these
530
+ 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(() => { putPrefs().catch(() => {}); }, 400); };
526
531
  // 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.
527
532
  // A missing string falls back to English, so a half-translated language still works. See public/locales/README.md to add one.
528
533
  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']];
@@ -564,10 +569,16 @@ async function setLang(code, save) {
564
569
  // =====================================================================
565
570
  const NAMES = ['Ada','Linus','Grace','Alan','Margaret','Dennis','Barbara','Ken','Radia','Tim','Hedy','Guido','Frances','Bjarne','Katherine','Brian','Sophie','Niklaus','Annie','Donald','Joan','Edsger','Lynn','Vint','Mae','Rob','Zoe','Ivan','Nina','Otto','Lena','Hugo','Ines','Théo','Maya','Jules','Alma','Remy','Cleo','Noah','Iris','Leo','Mira','Axel','Nora','Eli','Lou','Gaby'];
566
571
  const nameBook = {}; // agent id → unique first name within the session
572
+ // The lead's name: Margot, or the one chosen in ⚙ → All settings (prefs.leadName) or in the editor (agentStandup.leadName, which wins: AS_APP.lead, see appKind in server.js). Plain text of 24 characters at most: it is written into the page in many places.
573
+ // typeof: the landing page reuses this section and has neither prefs nor APP
574
+ const LEAD_NAME = 'Margot', cleanLead = (v) => Array.from(String(v == null ? '' : v).replace(/'/g, '’').replace(/[\u0000-\u001f\u007f-\u009f<>&"`\\]/g, '').replace(/\s+/g, ' ').trim()).slice(0, 24).join('').trim();
575
+ const leadName = () => (typeof APP === 'object' && APP && cleanLead(APP.lead)) || (typeof prefs === 'object' && prefs && cleanLead(prefs.leadName)) || LEAD_NAME;
576
+ const isLeadName = (n) => { const l = leadName().toLocaleLowerCase(), s = String(n || '').toLocaleLowerCase(); return !!n && (s === l || (s.startsWith(l + ' ') && /^\d+$/.test(s.slice(l.length + 1)))); }; // whatever the capitals: Ivan and ivan would read as one agent, and Ivan 2 as a fork of the lead
567
577
  function uniqueName(id, h) {
568
- if (nameBook[id]) return nameBook[id]; const taken = new Set(Object.values(nameBook));
569
- for (let k = 0; k < NAMES.length; k++) { const n = NAMES[(h + k) % NAMES.length]; if (!taken.has(n)) return (nameBook[id] = n); }
570
- return (nameBook[id] = NAMES[h % NAMES.length] + ' ' + (taken.size + 1));
578
+ if (nameBook[id]) return nameBook[id]; const taken = new Set(Object.values(nameBook).map((n) => n.toLocaleLowerCase())), n0 = taken.size; taken.add(leadName().toLocaleLowerCase()); // never the lead's own name: one may be chosen from this list
579
+ for (let k = 0; k < NAMES.length; k++) { const n = NAMES[(h + k) % NAMES.length]; if (!taken.has(n.toLocaleLowerCase())) return (nameBook[id] = n); }
580
+ let b = h % NAMES.length; if (isLeadName(NAMES[b])) b = (b + 1) % NAMES.length; // every name taken: a number after it, but never after the lead's name ("Ivan 48" would read as a fork of a lead called Ivan)
581
+ return (nameBook[id] = NAMES[b] + ' ' + (n0 + 1));
571
582
  }
572
583
  const PAL = ['#ff7a6b','#ffb347','#ffd84a','#4fd1a5','#4cc3ff','#7c8cff','#b583ff','#ff7eb6'];
573
584
  const hexRGB = (h) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
@@ -693,25 +704,27 @@ function renderFolder(el, mine) { // one's own pictures: where they are, a but
693
704
  el.querySelectorAll('[data-rm]').forEach((b) => (b.onclick = async () => { await post('/api/characters/remove', { file: b.dataset.rm }); await reloadChars(); }));
694
705
  $('#charReload').onclick = () => reloadChars(); if ($('#charOpen')) $('#charOpen').onclick = () => window.parent.postMessage({ agentStandup: 'openCharacters' }, '*');
695
706
  }
696
- function packNote() { // the Halloween pack, to someone without it, twice a season at most: one line in October (the vampire's before the 19th, to the vampire only; from the 19th, to everyone), one on the 30th or 31st if the first was 5 days before or more. Never on a first day, nor the first day the usage question shows (usagePending); shown, it stays until ✕ or the button, also after a reload that day
707
+ function packNote() { // the Halloween pack, to someone without it, twice a season at most: one line in October (the vampire's before the 19th, to the vampire only; from the 19th, to everyone), one on the 30th or 31st if the first was 3 days before or more. Never on a first day, nor the first day the usage question shows (usagePending); shown, it stays until ✕ or the button, also after a reload that day
697
708
  const d = new Date(), m = d.getMonth(), dd = d.getDate(), phase = dd >= 30 ? 2 : 1, seen = +prefs.packSeen || (prefs.vampSeen ? 1 : 0), el = $('#packNote'); if (!el) return; // vampSeen: the vampire's line, closed in 1.33 to 1.38, counts as the first
698
- const early = dd < 19 && CHARS.youFrom !== 'vampire', open = prefs.packOpen && prefs.packDay === utcDay(), due = !early && seen < phase && !askedToday('pack') && !firstDay() && !(usagePending() && (!prefs.usageDay || prefs.usageDay >= utcDay())) && $('#usageTip').style.display === 'none' && (!prefs.packDay || Date.parse(utcDay()) - Date.parse(prefs.packDay) >= 5 * 864e5);
709
+ const early = dd < 19 && CHARS.youFrom !== 'vampire', open = prefs.packOpen && prefs.packDay === utcDay(), due = !early && seen < phase && !askedToday('pack') && !firstDay() && !(usagePending() && (!prefs.usageDay || prefs.usageDay >= utcDay())) && $('#usageTip').style.display === 'none' && (!prefs.packDay || Date.parse(utcDay()) - Date.parse(prefs.packDay) >= 3 * 864e5);
699
710
  const on = m === 9 && (open || due) && !Q.get('demo') && !(SHOP.halloween && SHOP.halloween.n) && !voiceOffer.busy; el.style.display = on ? '' : 'none'; if (!on) return; // busy: the voices are downloading, and their line says so
700
711
  if (due && !open) { prefs.packSeen = phase; prefs.packDay = utcDay(); prefs.packOpen = true; savePrefs(); } noteAsk('pack'); $('#vOffer').style.display = 'none'; // one offer at a time: the voices' line comes back when this one is closed
701
712
  const price = (SHOP.halloween && SHOP.halloween.price) || '2 €';
702
- $('#packNoteT').textContent = dd === 31 ? L('Joyeux Halloween ! Vos agents peuvent venir à l’appel déguisés.', 'Happy Halloween! Your agents can come to the call in costume.') : dd === 30 ? L('Halloween, c’est demain : vos agents peuvent venir à l’appel déguisés.', 'Halloween is tomorrow: your agents can come to the call in costume.')
713
+ $('#packNoteT').textContent = dd === 31 ? L('Joyeux Halloween ! Vos agents ont sorti les citrouilles. Les costumes complets sont dans le pack, dessinés à la main.', 'Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.') : dd === 30 ? L('Halloween, c’est demain : vos agents ont sorti les citrouilles. Les costumes complets sont dans le pack, dessinés à la main.', 'Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.')
703
714
  : 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.');
704
715
  $('#packNoteB').textContent = L('Voir le pack', 'See the pack') + ' · ' + price;
705
716
  }
706
717
  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
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
708
- function renameAll() { // ⚙ → own names on or off: every sub-agent is named again, in the order it arrived
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));
710
- buildStage(); paintStatus(); renderLog(true); syncUI();
718
+ const subName = (a, h) => (a.own && prefs.ownNames && !isLeadName(a.own) ? (nameBook[a.id] = a.own) : ((a.twinN || !isLeadName(a.given)) && a.given) || uniqueName(a.id, h)); /* a fork is the one agent named after the lead */ // 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
719
+ function renameAll(lead) { // ⚙ → own names on or off, or a new name for the lead: every sub-agent is named again, in the order it arrived, as a reload would name them
720
+ const names = () => Object.values(S.agents).map((p) => p.name).join('\n'), was = names();
721
+ if (lead) for (const p of Object.values(S.agents)) if (p.id === 'main' || p.twinN) { const q = persona(p); p.name = q.name; p.given = q.given; } // the lead and its forks first: the others then keep clear of the lead's name
722
+ 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 = p.twinN && !(p.own && prefs.ownNames && !isLeadName(p.own)) ? p.given : subName(p, hash(p.id)); // a fork is the lead's twin unless it has a name of its own to keep
723
+ if (!lead || names() !== was) { buildStage(); renderTokens(); renderCtx(); paintStatus(); renderLog(true); syncUI(); } // the new tiles get their tokens and context at once, not at the next usage
711
724
  }
712
725
  function persona0(a) {
713
- const h = hash(a.id), base = { ...a, given: 'given' in a ? a.given : a.name };
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' };
726
+ const h = hash(a.id), base = { ...a, given: a.twinN ? leadName() + ' ' + a.twinN : 'given' in a ? a.given : a.name }; // twinN: a fork, named after the lead whatever the lead is called now
727
+ if (a.id === 'main') return { ...base, name: leadName(), 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' };
715
728
  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
729
  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
717
730
  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,
@@ -777,6 +790,8 @@ const ACC = [
777
790
  (t, c) => `<g transform="translate(60 ${t + 3}) rotate(14)"><path d="M0 0L-9-5V5z" fill="${c}"/><path d="M0 0L9-5V5z" fill="${c}"/><circle r="2.6" fill="${mix(c, '#000000', .18)}"/></g>`,
778
791
  (t, c) => `<path d="M44 ${t + 2}L40 ${t - 8}M56 ${t + 2}L60 ${t - 8}" stroke="#2c2f40" stroke-width="1.2" stroke-linecap="round"/><circle cx="40" cy="${t - 9}" r="2.4" fill="${c}"/><circle cx="60" cy="${t - 9}" r="2.4" fill="${c}"/>`,
779
792
  ];
793
+ const pumpkinDay = () => { const d = new Date(); return d.getMonth() === 9 && d.getDate() >= 30; }; // Halloween and its eve: the drawn characters bring a pumpkin (mine, not the pack's art)
794
+ const pumpkin = (x) => `<g class="pumpkin"><ellipse cx="${x}" cy="58.3" rx="6.2" ry="4.4" fill="#f28c28"/><path d="M${x - 2.3} 54.2q-1.7 4.1 0 8.3M${x + 2.3} 54.2q1.7 4.1 0 8.3" fill="none" stroke="#c8650f" stroke-width=".7"/><path d="M${x} 54.3q.2-2 1.7-2.7" fill="none" stroke="#4f8a3a" stroke-width="1.3" stroke-linecap="round"/><path d="M${x - 3.5} 57.7l1.3-2 1.3 2zM${x + .9} 57.7l1.3-2 1.3 2z" fill="#ffd84a"/><path d="M${x - 3.3} 59.5q3.3 2.5 6.6 0l-1 1.5-1.1-.8-1.1.9-1.1-.9-1.1.8z" fill="#ffd84a"/></g>`;
780
795
  function avatarSVG(p, o, uid = '') { // uid keeps SVG ids unique per instance: duplicate ids made gradients vanish when the first copy was in a hidden element
781
796
  const st = !!o, sh = SHAPES[p.shape], fy = sh.fy, top = sh.top, bot = p.shape === 4, c = p.shirt, c1 = mix(c, '#ffffff', .3), c2 = mix(c, '#000000', .2);
782
797
  const ink = bot ? '#8ff0ff' : '#2a2233', gid = uid + 'b' + p.gid, sc = SCENES[p.scene], eg = EYES[p.eye], ex = p.shape === 1 ? [43, 57] : [41.5, 58.5];
@@ -796,7 +811,7 @@ function avatarSVG(p, o, uid = '') { // uid keeps SVG ids unique per instance:
796
811
  const arm = (side) => `<g class="arm ${side}"><ellipse cx="${side === 'l' ? 25 : 75}" cy="56" rx="4.6" ry="9" fill="${c2}" transform="rotate(${side === 'l' ? 12 : -12} ${side === 'l' ? 25 : 75} 56)"/></g>`;
797
812
  const prop = [`<path d="M11 62.4l1.6-7.4h7.2l1.6 7.4z" fill="#e07a5f"/><path d="M16 55q-6-8-2-12q5 4 2 12z" fill="#3fbf7f"/><path d="M16 55q6-7 10-5q-1 6-10 5z" fill="#53c98a"/>`,
798
813
  `<rect x="79" y="55.6" width="7.4" height="6.8" rx="1.6" fill="#f6f2ea"/><path d="M86.2 57q3.2 0 3.2 2.2t-3.2 2.2" fill="none" stroke="#f6f2ea" stroke-width="1.3"/><g class="steam" fill="none" stroke="#fff" stroke-width=".8" stroke-linecap="round" opacity=".7"><path d="M81.5 53q-1.4-1.8 0-3.4M84.3 53q-1.4-1.8 0-3.4"/></g>`,
799
- `<rect x="76" y="58.2" width="14" height="4.2" rx="1" fill="#ff7a6b"/><rect x="77.5" y="54.4" width="12" height="3.8" rx="1" fill="#4cc3ff"/><rect x="76.5" y="50.8" width="11" height="3.6" rx="1" fill="#ffd84a"/>`][p.prop];
814
+ `<rect x="76" y="58.2" width="14" height="4.2" rx="1" fill="#ff7a6b"/><rect x="77.5" y="54.4" width="12" height="3.8" rx="1" fill="#4cc3ff"/><rect x="76.5" y="50.8" width="11" height="3.6" rx="1" fill="#ffd84a"/>`][p.prop] + (pumpkinDay() ? pumpkin(p.prop === 0 ? 83 : 17) : ''); /* on the 30th and 31st of October, a carved pumpkin on the other side of the desk */
800
815
  const lap = `<rect x="33" y="46" width="34" height="18" rx="2.8" fill="#d3d8e6"/><rect x="33" y="46" width="34" height="18" rx="2.8" fill="url(#${uid}lg)" opacity=".5"/><circle cx="50" cy="55" r="2.3" fill="${c1}"/><rect x="29.5" y="63.4" width="41" height="3" rx="1.5" fill="#aab1c2"/>`;
801
816
  const lapDark = `<rect x="33" y="46" width="34" height="18" rx="2.8" fill="#3b4152"/><rect x="33" y="46" width="34" height="18" rx="2.8" fill="url(#${uid}lg)" opacity=".18"/><circle cx="50" cy="55" r="2.3" fill="${c1}"/><rect x="29.5" y="63.4" width="41" height="3" rx="1.5" fill="#262a36"/>`; // for custom characters: darker, so it still shows under a white or cream sprite
802
817
  const hands = `<circle class="hand l" cx="38" cy="65.6" r="3.1" fill="${c2}"/><circle class="hand r" cx="62" cy="65.6" r="3.1" fill="${c2}"/>`;
@@ -847,7 +862,7 @@ const caughtUp = () => !S.live || lagMs() < 6000;
847
862
  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
848
863
  const spd = () => (S.live ? 1.12 * lagFactor() : +$('#speed').value) * (S.boost || 1);
849
864
  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…
865
+ const twinOf = (a) => (/^fork$/i.test(a.type || '') && !('given' in a) && !(a.own && prefs.ownNames) ? { ...a, twinN: 2 + Object.values(S.agents).filter((p) => p.twin).length } : a); // a fork is named after the lead: Margot 2, Margot 3… (persona0 writes the name from twinN)
851
866
 
852
867
  // ---------- text prep ----------
853
868
  const plain = (t) => String(t).replace(/```[\s\S]*?```/g, ' ').replace(/`([^`]*)`/g, '$1').replace(/https?:\/\/\S+/g, 'link').replace(/[#*_>|~\[\]]/g, ' ').replace(/\s+/g, ' ').trim();
@@ -2272,6 +2287,7 @@ const IDLE = {
2272
2287
  ['✓', 'Écrit « s’il te plaît » dans un prompt', '1 s', 'au cas où', 'Rester poli avec nos futurs maîtres'], ['✗', 'Cherché quelque chose à faire', '9 min', 'le backlog', 'Le backlog est vide. Les agents l’ont vidé.']] },
2273
2288
  };
2274
2289
  const shuffle = (a) => { const b = [...a]; for (let i = b.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [b[i], b[j]] = [b[j], b[i]]; } return b; };
2290
+ const costumeHtml = () => (CHARS.youFrom === 'vampire' && SHOP.halloween && !SHOP.halloween.n ? `<h3>${esc(L('Costume', 'Costume'))}</h3><div>${esc(L('Votre vampire vient du pack Halloween, dessiné à la main par Fabien Coupas. Le reste de l’équipe y est aussi.', 'Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.'))}</div><button class="btn" data-hwpack style="margin:6px 0 2px">🎃 ${esc(L('Voir le pack', 'See the pack'))} · ${esc(SHOP.halloween.price || '2 €')}</button>` : ''); // in the panel you open on yourself: information, not an ask
2275
2291
  function idleHtml() { // the human's Tools and Recent activity, made up: 5 to 7 tools, 6 to 8 moments
2276
2292
  const I = FR() ? IDLE.fr : IDLE.en, tools = shuffle(I.tools).slice(0, 5 + Math.floor(Math.random() * 3)).map((n) => [n, 1 + Math.floor(Math.random() * (/Ctrl|Coffee|Café|Slack|Sigh|Soupirer/.test(n) ? 40 : 9))]);
2277
2293
  return `<h3>${L('Outils', 'Tools')} (${tools.reduce((a, t) => a + t[1], 0)})</h3><div>${tools.map(([n, c]) => `${esc(n)} ×${c}`).join(' · ')}</div>` +
@@ -2283,9 +2299,10 @@ function renderDetail() {
2283
2299
  const counts = {}; tools.forEach((t) => (counts[t.name] = (counts[t.name] || 0) + 1));
2284
2300
  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>` : '';
2285
2301
  $('#dbody').innerHTML = tokHtml + (order ? `<h3>${L('Consigne de', 'Prompt from')} ${esc(nameOf(order.agent))}</h3><pre>${esc(order.text)}</pre>` : '') +
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>` +
2302
+ (id === 'user' ? costumeHtml() + (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>` +
2287
2303
  `<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('')) +
2288
2304
  evs.filter((e) => e.agent === id && (e.kind === 'say' || e.kind === 'report')).map((e) => `<h3>${e.kind === 'report' ? L('Rapport final', 'Final report') : L('A dit', 'Said')}</h3><pre>${esc(e.text)}</pre>`).join('');
2305
+ const hw = $('#dbody [data-hwpack]'); if (hw) hw.onclick = () => { CHPICK.more = 'halloween'; openChars(); };
2289
2306
  }
2290
2307
  $('#dclose').onclick = () => { S.detail = null; $('#detail').classList.remove('on'); };
2291
2308
 
@@ -2353,20 +2370,20 @@ function rateTip() {
2353
2370
  $('#rateYes').onclick = rateGo; $('#rateNo').onclick = rateEnd;
2354
2371
  $('#rateLater').onclick = () => { if (prefs.rateLater) return rateEnd(); prefs.rateLater = new Date(Date.parse(utcDay()) + 7 * 864e5).toISOString().slice(0, 10); savePrefs(); $('#rateTip').style.display = 'none'; };
2355
2372
  document.addEventListener('visibilitychange', rateDay); setInterval(rateDay, 3600e3); // the desktop window can stay open for days
2356
- // ☕ Once, at the end of a long run the call followed live (the lead at work for 10 minutes, or 3 agents at work in that turn), from the second day the call has been in view.
2373
+ // ☕ Once, at the end of a run the call followed live (the lead at work for 3 minutes, or 3 agents at work in that turn, and the turn closed by its end mark), from the second day the call has been in view.
2357
2374
  // Never twice ("No thanks", the coffee or nothing at all end it), never the day the star is asked, never in a demo. The days are kept in the settings file; nothing is sent.
2358
2375
  function coffeeDay() { if (document.hidden || !SUPPORT.url || prefs.coffeeAsked || prefs.useFirst) return; prefs.useFirst = utcDay(); savePrefs(); } /* one write, ever: the first day the call is in view (a window left open overnight must not write its old settings over newer ones) */
2359
2376
  function coffeeAsk(busyAt) {
2360
- if (!SUPPORT.url || prefs.coffeeAsked || Q.get('demo') || firstDay() || askedToday('coffee') || !prefs.useFirst || prefs.useFirst >= utcDay() || document.hidden) return;
2377
+ if (!SUPPORT.url || prefs.coffeeAsked || Q.get('demo') || firstDay() || askedToday('coffee') || !prefs.useFirst || prefs.useFirst >= utcDay() || document.hidden || !S.turnOver) return; /* the mark that closes the lead's turn: a long silence mid-turn also shows the lead done */
2361
2378
  const now = Date.now(), team = Object.keys(S.agents).filter((id) => id !== 'main' && id !== 'user' && S.lastAct[id] >= busyAt).length;
2362
- if (!(now - busyAt >= 10 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
2379
+ if (!(now - busyAt >= 3 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
2363
2380
  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 */
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 */
2381
+ clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || !S.turnOver || $('#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 */
2365
2382
  }
2366
2383
  function coffeeTip() {
2367
2384
  const at = [$('#bCoffee'), $('#bMenu')].find((b) => b.getBoundingClientRect().width), t = $('#coffeeTip'); if (!at) return;
2368
2385
  prefs.coffeeAsked = utcDay(); noteAsk('coffee'); savePrefs(); const r = at.getBoundingClientRect();
2369
- $('#coffeeTipT').textContent = L('{0} et l’équipe ont fini. Si l’appel vous a aidé à suivre ce long travail, un café aide Agent Standup à continuer. (On ne le demande qu’une fois.)', '{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)').replace('{0}', () => nameOf('main'));
2386
+ $('#coffeeTipT').textContent = L('{0} et l’équipe ont fini. Si l’appel vous a aidé à suivre ce travail, un café aide Agent Standup à continuer. (On ne le demande qu’une fois.)', '{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)').replace('{0}', () => nameOf('main'));
2370
2387
  $('#coffeeYes').textContent = L('☕ Offrir un café', '☕ Buy a coffee'); $('#coffeeNo').textContent = L('Non merci', 'No thanks');
2371
2388
  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');
2372
2389
  clearTimeout(coffeeTip.t); coffeeTip.t = setTimeout(() => (t.style.display = 'none'), 60000);
@@ -2377,7 +2394,7 @@ document.addEventListener('visibilitychange', coffeeDay); setInterval(coffeeDay,
2377
2394
  // 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
2378
2395
  // 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.
2379
2396
  const USAGE_ASKS = ['desktop', 'cli', 'plugin'].includes(APP.kind) && APP.track !== false && !EMBED && !Q.get('demo');
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) */
2397
+ function usageOpened(fresh) { if (USAGE_ASKS && prefs.shareUsage === true && !document.hidden) (fresh ? putPrefs() : 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) */
2381
2398
  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
2382
2399
  function usageStart() {
2383
2400
  if (!USAGE_ASKS) return; $('#mShare').style.display = ''; usageOpened();
@@ -2880,7 +2897,7 @@ const niceProj = (p) => (p === '_demo' ? '' : p === '_codex' ? 'Codex' : p === '
2880
2897
  async function fillProjects() { // live view: follow the latest activity anywhere, or pin one project
2881
2898
  const sel = $('#liveProj'); let rows = []; try { rows = await (await fetch('/api/projects')).json(); } catch {}
2882
2899
  sel.innerHTML = `<option value="">${L('Tous les projets (le plus récent)', 'All projects (most recent)')}</option>` + rows.map((r) => `<option value="${esc(r.proj)}">${esc(niceProj(r.proj))}</option>`).join('');
2883
- sel.value = prefs.proj && rows.some((r) => r.proj === prefs.proj) ? prefs.proj : ''; sel.style.display = rows.length > 1 ? '' : 'none';
2900
+ sel.value = prefs.proj && rows.some((r) => r.proj === prefs.proj) ? prefs.proj : ''; $('#liveProjBox').style.display = rows.length > 1 ? 'block' : 'none'; // with its label: a list alone did not say what it chooses
2884
2901
  }
2885
2902
  $('#liveProj').onchange = () => { Q.delete('proj'); prefs.proj = $('#liveProj').value; S.pick = null; savePrefs(); S.cur = null; followCurrent(); };
2886
2903
  async function followCurrent() {
@@ -2940,7 +2957,8 @@ setInterval(async () => {
2940
2957
 
2941
2958
 
2942
2959
  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)
2943
- 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)
2960
+ const d = e.data; if (EMBED && e.source === window.parent && d && d.agentStandup === 'lead' && typeof d.name === 'string') { APP.lead = d.name.slice(0, 100); leadField(); renameLead(); return; } // agentStandup.leadName changed in the editor
2961
+ 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)
2944
2962
  if (!EMBED || e.source !== window.parent || !d || d.agentStandup !== 'pin' || typeof d.id !== 'string') return;
2945
2963
  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
2946
2964
  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');
@@ -3132,7 +3150,7 @@ async function setMode(m) {
3132
3150
  document.querySelectorAll('#modeSeg button').forEach((b) => b.classList.toggle('on', b.dataset.m === m)); $('#sessions').style.display = live ? 'none' : '';
3133
3151
  S.cur = null; syncUI();
3134
3152
  if (live) { S.since = 0; fillProjects(); await followCurrent(); return; }
3135
- $('#liveProj').style.display = 'none';
3153
+ $('#liveProjBox').style.display = 'none';
3136
3154
  const rows = await (await fetch('/api/sessions')).json();
3137
3155
  $('#sessions').innerHTML = rows.map((r) => { const d = new Date(r.mtime).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
3138
3156
  return `<option value="${esc(r.proj)}|${esc(r.id)}" data-title="${esc(r.title)}">${r.agents ? '👥' + r.agents + ' · ' : ''}${esc(r.title.slice(0, 40))} (${d})</option>`; }).join('');
@@ -3236,7 +3254,8 @@ function applyLang() {
3236
3254
  document.querySelectorAll('#viewSeg button').forEach((b) => { b.title = b.textContent; }); // in a narrow window they are icons: the name stays as a tooltip
3237
3255
  $('#callTrMi').style.display = CALL_LANG[prefs.lang] && !FR() ? '' : 'none';
3238
3256
  const sel = $('#langSel'); if (!sel.options.length) sel.innerHTML = LANGS.map(([c, n]) => `<option value="${c}">${n}</option>`).join(''); sel.value = prefs.lang;
3239
- [['#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));
3257
+ [['#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')], ['#leadName', L('Nom de l’agent principal', 'Lead agent name')]].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));
3258
+ leadField();
3240
3259
  $('#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');
3241
3260
  $('#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.'));
3242
3261
  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; } }
@@ -3301,11 +3320,11 @@ function openPrefs(target) { // ⚙ → All settings; target: one of its setti
3301
3320
  $('#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]));
3302
3321
  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();
3303
3322
  }
3304
- 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
3323
+ const PANEL_KEYS = ['office', 'officeVol', 'music', 'station', 'musicVol', 'voiceVol', 'notify', 'customLaptop', 'ownNames', 'roster', 'reactions', 'banter', 'chat', 'vanish', 'epi', 'files', 'artNet', 'visits', 'askCard', 'followTab', 'leadName']; // what the panel holds, and so what Reset puts back
3305
3324
  $('#prefsReset').onclick = async () => {
3306
3325
  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
3307
3326
  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
3308
- 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 {}
3327
+ prefs._t = Date.now(); try { localStorage.setItem('cc.prefs', prefsOut()); } catch {} for (const k of [...PANEL_KEYS, 'notifyChosen']) prefsBase[k] = { reset: true }; try { await putPrefs(); } catch {} /* marked as changed: reset too what another window changed after this one loaded */
3309
3328
  location.reload(); // every part of the page starts again from them
3310
3329
  };
3311
3330
  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
@@ -3326,6 +3345,16 @@ $('#station').innerHTML = STATIONS.map((s) => `<option value="${s.id}">📻 ${s.
3326
3345
  $('#station').value = prefs.station; $('#musicVol').value = prefs.musicVol; $('#musicBox').style.display = prefs.music ? '' : 'none';
3327
3346
  $('#station').onchange = (e) => { prefs.station = e.target.value; savePrefs(); AUD.init(); RADIO.sync(); };
3328
3347
  $('#chatSel').value = ['quiet', 'normal', 'lively'].includes(prefs.chat) ? prefs.chat : 'normal'; $('#chatSel').onchange = () => { prefs.chat = $('#chatSel').value; savePrefs(); };
3348
+ // ⚙ → All settings → Lead agent name (empty: Margot). The editor's agentStandup.leadName wins over it: the field then shows that name, greyed, and says where it is set
3349
+ function leadField() {
3350
+ const f = $('#leadName'), ed = cleanLead(APP.lead); f.disabled = !!ed; if (document.activeElement !== f || ed) f.value = ed || cleanLead(prefs.leadName);
3351
+ const h = $('#leadHint'); h.style.display = ed ? '' : 'none'; h.textContent = ed ? L('Choisi dans les réglages de l’éditeur (agentStandup.leadName)', 'Set in the editor’s settings (agentStandup.leadName)') : '';
3352
+ }
3353
+ function renameLead() { renameAll(true); } // the lead and its forks take the new name at once, in the call, the list and the transcript, and a sub-agent that had that name gets another
3354
+ let leadTimer = null;
3355
+ $('#leadName').oninput = () => { prefs.leadName = cleanLead($('#leadName').value); if (!prefs.leadName) delete prefs.leadName; savePrefs(); clearTimeout(leadTimer); leadTimer = setTimeout(renameLead, 250); };
3356
+ $('#leadName').onchange = () => { clearTimeout(leadTimer); renameLead(); leadField(); };
3357
+ leadField();
3329
3358
  $('#vstyle').innerHTML = [['animal', 'Animal Crossing (babillage)', 'Animal Crossing (babble)'], ['kokoro', 'Voix naturelles (à installer)', 'Natural voices (installs on demand)']].map(([v, fr, en]) => `<option value="${v}" data-fr="${fr}" data-en="${en}">${L(fr, en)}</option>`).join(''); $('#vstyle').value = prefs.vstyle; $('#vstyle').onchange = () => { prefs.vstyle = $('#vstyle').value; prefs.vstyleChosen = true; savePrefs(); TTS.init().then(kokoroUI); kokoroUI(); };
3330
3359
  // ---- ⚙ → very natural voices (Kokoro): install box and status, polled while installing
3331
3360
  let kokoroTimer = null;
@@ -342,7 +342,7 @@
342
342
  "same search as {0}: {1}": "samme søgning som {0}: {1}",
343
343
  "reran a failing command: {0}": "kørte en fejlet kommando igen: {0}",
344
344
  "☕ Buy a coffee": "☕ Giv en kop kaffe",
345
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} og holdet er færdige. Hvis opkaldet hjalp dig med at følge dette lange stykke arbejde, holder en kop kaffe Agent Standup i gang. (Vi spørger kun én gang.)",
345
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} og holdet er færdige. Hvis opkaldet hjalp dig med at følge dette stykke arbejde, holder en kop kaffe Agent Standup i gang. (Vi spørger kun én gang.)",
346
346
  "Failed calls": "Mislykkede kald",
347
347
  "+ {0} earlier": "+ {0} tidligere",
348
348
  "Spotted in the session itself, with no model call.": "Fundet i selve sessionen, uden kald til modellen.",
@@ -387,8 +387,8 @@
387
387
  "Privacy policy": "Privatlivspolitik",
388
388
  "Help count users (1 request a week)": "Hjælp med at tælle brugere (1 forespørgsel om ugen)",
389
389
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "Halloween nærmer sig: klæd dine agenter ud som græskar, spøgelse, heks eller skelet, tegnet i hånden af Fabien Coupas.",
390
- "Happy Halloween! Your agents can come to the call in costume.": "Glædelig Halloween! Dine agenter kan komme til opkaldet i kostume.",
391
- "Halloween is tomorrow: your agents can come to the call in costume.": "Det er Halloween i morgen: dine agenter kan komme til opkaldet i kostume.",
390
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Glædelig halloween! Dine agenter har taget græskar med. De hele kostumer er i pakken, tegnet i hånden.",
391
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Det er halloween i morgen: dine agenter har taget græskar med. De hele kostumer er i pakken, tegnet i hånden.",
392
392
  "advised by": "rådgivet af",
393
393
  "At least: work went on after it last counted.": "Mindst: arbejdet fortsatte efter den sidste optælling.",
394
394
  "cost": "omkostning",
@@ -425,5 +425,9 @@
425
425
  "Claude usage limit: {0} sessions stopped": "Claudes forbrugsgrænse: {0} sessioner stoppet",
426
426
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code er åben i {0}, men gemmer ingen historik (CLAUDE_CODE_SKIP_PROMPT_HISTORY er sat), så Agent Standup kan ikke følge den.",
427
427
  "Why?": "Hvorfor?",
428
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Fjern CLAUDE_CODE_SKIP_PROMPT_HISTORY fra din shell-profil, og start derefter Claude Code igen."
428
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Fjern CLAUDE_CODE_SKIP_PROMPT_HISTORY fra din shell-profil, og start derefter Claude Code igen.",
429
+ "Lead agent name": "Lederagentens navn",
430
+ "Set in the editor’s settings (agentStandup.leadName)": "Valgt i editorens indstillinger (agentStandup.leadName)",
431
+ "Costume": "Kostume",
432
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "Din vampyr kommer fra halloween-pakken, tegnet i hånden af Fabien Coupas. Resten af holdet er også med."
429
433
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "gleiche Suche wie {0}: {1}",
344
344
  "reran a failing command: {0}": "fehlgeschlagenen Befehl wiederholt: {0}",
345
345
  "☕ Buy a coffee": "☕ Einen Kaffee spendieren",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} und das Team sind fertig. Wenn dir der Call geholfen hat, diesen langen Lauf zu verfolgen, hält ein Kaffee Agent Standup am Laufen. (Wir fragen nur einmal.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} und das Team sind fertig. Wenn dir der Call geholfen hat, diesen Lauf zu verfolgen, hält ein Kaffee Agent Standup am Laufen. (Wir fragen nur einmal.)",
347
347
  "Failed calls": "Fehlgeschlagene Aufrufe",
348
348
  "+ {0} earlier": "+ {0} frühere",
349
349
  "Spotted in the session itself, with no model call.": "In der Sitzung selbst erkannt, ohne Modellaufruf.",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "Datenschutzerklärung",
389
389
  "Help count users (1 request a week)": "Beim Zählen der Nutzer helfen (1 Anfrage pro Woche)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "Halloween steht vor der Tür: Verkleide deine Agenten als Kürbis, Geist, Hexe oder Skelett, von Hand gezeichnet von Fabien Coupas.",
391
- "Happy Halloween! Your agents can come to the call in costume.": "Fröhliches Halloween! Deine Agenten können verkleidet zum Call kommen.",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "Morgen ist Halloween: Deine Agenten können verkleidet zum Call kommen.",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Fröhliches Halloween! Deine Agenten haben Kürbisse mitgebracht. Die ganzen Kostüme sind im Paket, von Hand gezeichnet.",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Morgen ist Halloween: Deine Agenten haben Kürbisse mitgebracht. Die ganzen Kostüme sind im Paket, von Hand gezeichnet.",
393
393
  "advised by": "beraten von",
394
394
  "At least: work went on after it last counted.": "Mindestens: Nach der letzten Zählung ging die Arbeit weiter.",
395
395
  "cost": "Kosten",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Claude-Nutzungslimit: {0} Sitzungen gestoppt",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code ist in {0} geöffnet, speichert aber keinen Verlauf (CLAUDE_CODE_SKIP_PROMPT_HISTORY ist gesetzt), daher kann Agent Standup es nicht verfolgen.",
428
428
  "Why?": "Warum?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Entferne CLAUDE_CODE_SKIP_PROMPT_HISTORY aus deinem Shell-Profil und starte Claude Code dann neu."
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Entferne CLAUDE_CODE_SKIP_PROMPT_HISTORY aus deinem Shell-Profil und starte Claude Code dann neu.",
430
+ "Lead agent name": "Name des Hauptagenten",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "In den Einstellungen des Editors festgelegt (agentStandup.leadName)",
432
+ "Costume": "Kostüm",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "Dein Vampir stammt aus dem Halloween-Paket, von Hand gezeichnet von Fabien Coupas. Der Rest der Besetzung ist auch darin."
430
434
  }
@@ -2,7 +2,7 @@
2
2
  " full — compaction soon": " full — compaction soon",
3
3
  " on ": " on ",
4
4
  "”": "”",
5
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)",
5
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)",
6
6
  "{0} failures in a row": "{0} failures in a row",
7
7
  "{0} MB": "{0} MB",
8
8
  "{0} times in a row": "{0} times in a row",
@@ -89,6 +89,7 @@
89
89
  "Copy as Markdown": "Copy as Markdown",
90
90
  "Copy failed": "Copy failed",
91
91
  "cost": "cost",
92
+ "Costume": "Costume",
92
93
  "Could not open the folder": "Could not open the folder",
93
94
  "Count me in": "Count me in",
94
95
  "Counted by Claude Code, sub-agents included": "Counted by Claude Code, sub-agents included",
@@ -144,11 +145,11 @@
144
145
  "Good-quality local voices, in this language and in English. Free, nothing leaves your machine.": "Good-quality local voices, in this language and in English. Free, nothing leaves your machine.",
145
146
  "Got it": "Got it",
146
147
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by 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.",
147
- "Halloween is tomorrow: your agents can come to the call in costume.": "Halloween is tomorrow: your agents can come to the call in costume.",
148
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.",
148
149
  "Halloween pack": "Halloween pack",
149
150
  "Hand-drawn Halloween characters, each in its own room.": "Hand-drawn Halloween characters, each in its own room.",
150
151
  "Hand-drawn, each in its own room": "Hand-drawn, each in its own room",
151
- "Happy Halloween! Your agents can come to the call in costume.": "Happy Halloween! Your agents can come to the call in costume.",
152
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.",
152
153
  "has a question for you": "has a question for you",
153
154
  "has several questions for you": "has several questions for you",
154
155
  "Help count how many people use Agent Standup? When you open the call, at most once a week, the app would load an empty 1-pixel file from GitHub: no identifier, nothing about you or your sessions. GitHub sees your IP address, as with any download. You can turn it off any time in ⚙ › All settings.": "Help count how many people use Agent Standup? When you open the call, at most once a week, the app would load an empty 1-pixel file from GitHub: no identifier, nothing about you or your sessions. GitHub sees your IP address, as with any download. You can turn it off any time in ⚙ › All settings.",
@@ -173,6 +174,7 @@
173
174
  "Laptop in front of your own characters": "Laptop in front of your own characters",
174
175
  "Later": "Later",
175
176
  "Lead": "Lead",
177
+ "Lead agent name": "Lead agent name",
176
178
  "Lead context": "Lead context",
177
179
  "lead.png = the lead · you.png = you · others = the sub-agents · name-talk.png = open mouth": "lead.png = the lead · you.png = you · others = the sub-agents · name-talk.png = open mouth",
178
180
  "left the call": "left the call",
@@ -311,6 +313,7 @@
311
313
  "Select the command": "Select the command",
312
314
  "session": "session",
313
315
  "Sessions": "Sessions",
316
+ "Set in the editor’s settings (agentStandup.leadName)": "Set in the editor’s settings (agentStandup.leadName)",
314
317
  "Settings": "Settings",
315
318
  "Showing ": "Showing ",
316
319
  "skipped": "skipped",
@@ -421,5 +424,6 @@
421
424
  "Your purchase code, to install the pack on another computer:": "Your purchase code, to install the pack on another computer:",
422
425
  "Your settings moved: the everyday ones are here, the rest in “All settings”.": "Your settings moved: the everyday ones are here, the rest in “All settings”.",
423
426
  "your turn": "your turn",
427
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.",
424
428
  "Yours": "Yours"
425
429
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "misma búsqueda que {0}: {1}",
344
344
  "reran a failing command: {0}": "repitió un comando que falló: {0}",
345
345
  "☕ Buy a coffee": "☕ Invitar a un café",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} y el equipo han terminado. Si la llamada te ayudó a seguir este trabajo largo, un café ayuda a que Agent Standup siga adelante. (Solo lo pedimos una vez.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} y el equipo han terminado. Si la llamada te ayudó a seguir este trabajo, un café ayuda a que Agent Standup siga adelante. (Solo lo pedimos una vez.)",
347
347
  "Failed calls": "Llamadas fallidas",
348
348
  "+ {0} earlier": "+ {0} anteriores",
349
349
  "Spotted in the session itself, with no model call.": "Detectado en la propia sesión, sin llamar al modelo.",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "Política de privacidad",
389
389
  "Help count users (1 request a week)": "Ayudar a contar usuarios (1 petición por semana)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "Se acerca Halloween: disfraza a tus agentes de calabaza, fantasma, bruja o esqueleto, dibujados a mano por Fabien Coupas.",
391
- "Happy Halloween! Your agents can come to the call in costume.": "¡Feliz Halloween! Tus agentes pueden venir disfrazados a la llamada.",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "Mañana es Halloween: tus agentes pueden venir disfrazados a la llamada.",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "¡Feliz Halloween! Tus agentes han traído calabazas. Los disfraces completos están en el pack, dibujados a mano.",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Mañana es Halloween: tus agentes han traído calabazas. Los disfraces completos están en el pack, dibujados a mano.",
393
393
  "advised by": "asesorado por",
394
394
  "At least: work went on after it last counted.": "Como mínimo: el trabajo continuó después de su último recuento.",
395
395
  "cost": "coste",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Límite de uso de Claude: {0} sesiones detenidas",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code está abierto en {0}, pero no guarda historial (CLAUDE_CODE_SKIP_PROMPT_HISTORY está definida), así que Agent Standup no puede seguirlo.",
428
428
  "Why?": "¿Por qué?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Quita CLAUDE_CODE_SKIP_PROMPT_HISTORY de tu perfil de shell y vuelve a iniciar Claude Code."
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Quita CLAUDE_CODE_SKIP_PROMPT_HISTORY de tu perfil de shell y vuelve a iniciar Claude Code.",
430
+ "Lead agent name": "Nombre del agente principal",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "Elegido en los ajustes del editor (agentStandup.leadName)",
432
+ "Costume": "Disfraz",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "Tu vampiro viene del pack de Halloween, dibujado a mano por Fabien Coupas. El resto del reparto también está en él."
430
434
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "{0} と同じ検索: {1}",
344
344
  "reran a failing command: {0}": "失敗したコマンドを再実行: {0}",
345
345
  "☕ Buy a coffee": "☕ コーヒーをおごる",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}とチームの作業が終わりました。この長い作業を追うのに通話が役立ったなら、コーヒー1杯で Agent Standup の開発を支えられます。(お願いするのはこの一度だけです)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}とチームの作業が終わりました。この作業を追うのに通話が役立ったなら、コーヒー1杯で Agent Standup の開発を支えられます。(お願いするのはこの一度だけです)",
347
347
  "Failed calls": "失敗した呼び出し",
348
348
  "+ {0} earlier": "さらに前に {0} 件",
349
349
  "Spotted in the session itself, with no model call.": "セッションそのものから検出。モデルは呼び出していません。",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "プライバシーポリシー",
389
389
  "Help count users (1 request a week)": "利用者数のカウントに協力する(週に1回のリクエスト)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "もうすぐハロウィン:エージェントをかぼちゃ、おばけ、魔女、がいこつに仮装させましょう。Fabien Coupas による手描きです。",
391
- "Happy Halloween! Your agents can come to the call in costume.": "ハッピーハロウィン!エージェントは仮装して通話に参加できます。",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "明日はハロウィン:エージェントは仮装して通話に参加できます。",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "ハッピーハロウィン!エージェントたちがかぼちゃを持ってきました。衣装一式は手描きのパックにあります。",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "明日はハロウィン:エージェントたちがかぼちゃを持ってきました。衣装一式は手描きのパックにあります。",
393
393
  "advised by": "助言役",
394
394
  "At least: work went on after it last counted.": "最低額です:最後の集計の後も作業が続きました。",
395
395
  "cost": "コスト",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Claude の使用量上限:{0} 件のセッションが停止",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code は {0} で開いていますが、履歴を保存していません(CLAUDE_CODE_SKIP_PROMPT_HISTORY が設定されています)。そのため Agent Standup は追跡できません。",
428
428
  "Why?": "なぜ?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "シェルのプロファイルから CLAUDE_CODE_SKIP_PROMPT_HISTORY を削除し、Claude Code を起動し直してください。"
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "シェルのプロファイルから CLAUDE_CODE_SKIP_PROMPT_HISTORY を削除し、Claude Code を起動し直してください。",
430
+ "Lead agent name": "メインエージェントの名前",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "エディターの設定で指定されています(agentStandup.leadName)",
432
+ "Costume": "衣装",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "あなたのヴァンパイアは、Fabien Coupas が手描きしたハロウィンパックのキャラクターです。ほかのメンバーもパックに入っています。"
430
434
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "{0}와(과) 같은 검색: {1}",
344
344
  "reran a failing command: {0}": "실패한 명령을 다시 실행: {0}",
345
345
  "☕ Buy a coffee": "☕ 커피 한 잔 사기",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}와 팀이 작업을 마쳤어요. 이 긴 작업을 따라가는 데 통화가 도움이 됐다면, 커피 한 잔이 Agent Standup을 계속 이어가게 해요. (딱 한 번만 여쭤볼게요.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}와 팀이 작업을 마쳤어요. 이 작업을 따라가는 데 통화가 도움이 됐다면, 커피 한 잔이 Agent Standup을 계속 이어가게 해요. (딱 한 번만 여쭤볼게요.)",
347
347
  "Failed calls": "실패한 호출",
348
348
  "+ {0} earlier": "이전 {0}개 더",
349
349
  "Spotted in the session itself, with no model call.": "세션 자체에서 찾았어요. 모델 호출은 없어요.",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "개인정보 처리방침",
389
389
  "Help count users (1 request a week)": "사용자 수 세기 돕기 (일주일에 요청 1번)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "핼러윈이 다가옵니다: 에이전트에게 호박, 유령, 마녀, 해골 분장을 해 보세요. Fabien Coupas가 손으로 그렸습니다.",
391
- "Happy Halloween! Your agents can come to the call in costume.": "해피 핼러윈! 에이전트가 분장하고 통화에 올 수 있어요.",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "내일은 핼러윈: 에이전트가 분장하고 통화에 올 수 있어요.",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "해피 핼러윈! 에이전트들이 호박을 가져왔어요. 의상 전체는 손으로 그린 팩에 있어요.",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "내일은 핼러윈: 에이전트들이 호박을 가져왔어요. 의상 전체는 손으로 그린 팩에 있어요.",
393
393
  "advised by": "조언자",
394
394
  "At least: work went on after it last counted.": "최소 금액입니다: 마지막 집계 이후에도 작업이 계속되었습니다.",
395
395
  "cost": "비용",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Claude 사용 한도: 세션 {0}개 중지됨",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code가 {0}에서 열려 있지만 기록을 저장하지 않으므로(CLAUDE_CODE_SKIP_PROMPT_HISTORY가 설정됨) Agent Standup이 따라갈 수 없습니다.",
428
428
  "Why?": "왜?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "셸 프로필에서 CLAUDE_CODE_SKIP_PROMPT_HISTORY를 지운 다음 Claude Code를 다시 시작하세요."
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "셸 프로필에서 CLAUDE_CODE_SKIP_PROMPT_HISTORY를 지운 다음 Claude Code를 다시 시작하세요.",
430
+ "Lead agent name": "메인 에이전트 이름",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "에디터 설정에서 지정됨 (agentStandup.leadName)",
432
+ "Costume": "의상",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "당신의 뱀파이어는 Fabien Coupas가 손으로 그린 핼러윈 팩에서 왔어요. 나머지 캐스트도 팩에 있어요."
430
434
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "mesma busca que {0}: {1}",
344
344
  "reran a failing command: {0}": "repetiu um comando que falhou: {0}",
345
345
  "☕ Buy a coffee": "☕ Pagar um café",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} e a equipe terminaram. Se a chamada ajudou você a acompanhar esse trabalho longo, um café ajuda o Agent Standup a continuar. (Só pedimos uma vez.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} e a equipe terminaram. Se a chamada ajudou você a acompanhar esse trabalho, um café ajuda o Agent Standup a continuar. (Só pedimos uma vez.)",
347
347
  "Failed calls": "Chamadas com falha",
348
348
  "+ {0} earlier": "+ {0} anteriores",
349
349
  "Spotted in the session itself, with no model call.": "Encontrado na própria sessão, sem chamar o modelo.",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "Política de privacidade",
389
389
  "Help count users (1 request a week)": "Ajudar a contar usuários (1 solicitação por semana)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "O Halloween está chegando: fantasie seus agentes de abóbora, fantasma, bruxa ou esqueleto, desenhados à mão por Fabien Coupas.",
391
- "Happy Halloween! Your agents can come to the call in costume.": "Feliz Halloween! Seus agentes podem vir fantasiados para a chamada.",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "Amanhã é Halloween: seus agentes podem vir fantasiados para a chamada.",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Feliz Halloween! Seus agentes trouxeram abóboras. As fantasias completas estão no pacote, desenhadas à mão.",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "Amanhã é Halloween: seus agentes trouxeram abóboras. As fantasias completas estão no pacote, desenhadas à mão.",
393
393
  "advised by": "aconselhado por",
394
394
  "At least: work went on after it last counted.": "No mínimo: o trabalho continuou depois da última contagem.",
395
395
  "cost": "custo",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Limite de uso do Claude: {0} sessões paradas",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "O Claude Code está aberto em {0}, mas não salva histórico (CLAUDE_CODE_SKIP_PROMPT_HISTORY está definida), então o Agent Standup não consegue acompanhá-lo.",
428
428
  "Why?": "Por quê?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Remova CLAUDE_CODE_SKIP_PROMPT_HISTORY do seu perfil do shell e inicie o Claude Code de novo."
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Remova CLAUDE_CODE_SKIP_PROMPT_HISTORY do seu perfil do shell e inicie o Claude Code de novo.",
430
+ "Lead agent name": "Nome do agente principal",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "Definido nas configurações do editor (agentStandup.leadName)",
432
+ "Costume": "Fantasia",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "Seu vampiro vem do pacote de Halloween, desenhado à mão por Fabien Coupas. O resto do elenco também está nele."
430
434
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "与 {0} 相同的搜索:{1}",
344
344
  "reran a failing command: {0}": "重新运行失败的命令:{0}",
345
345
  "☕ Buy a coffee": "☕ 请喝杯咖啡",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和团队已经完成。如果这次通话帮你跟上了这段长时间的工作,一杯咖啡能让 Agent Standup 继续下去。(我们只问这一次。)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和团队已经完成。如果这次通话帮你跟上了这段工作,一杯咖啡能让 Agent Standup 继续下去。(我们只问这一次。)",
347
347
  "Failed calls": "失败的调用",
348
348
  "+ {0} earlier": "还有更早的 {0} 条",
349
349
  "Spotted in the session itself, with no model call.": "直接从会话中发现,没有调用模型。",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "隐私政策",
389
389
  "Help count users (1 request a week)": "帮忙统计用户(每周 1 次请求)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "万圣节快到了:把你的智能体打扮成南瓜、幽灵、女巫或骷髅,均由 Fabien Coupas 手绘。",
391
- "Happy Halloween! Your agents can come to the call in costume.": "万圣节快乐!你的智能体可以穿着装扮来开会。",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "明天就是万圣节:你的智能体可以穿着装扮来开会。",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "万圣节快乐!你的智能体带来了南瓜。完整的装扮在手绘礼包里。",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "明天就是万圣节:你的智能体带来了南瓜。完整的装扮在手绘礼包里。",
393
393
  "advised by": "顾问",
394
394
  "At least: work went on after it last counted.": "这是最低值:上次统计之后工作仍在继续。",
395
395
  "cost": "费用",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Claude 用量上限:{0} 个会话已停止",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code 在 {0} 中打开,但不保存历史记录(设置了 CLAUDE_CODE_SKIP_PROMPT_HISTORY),因此 Agent Standup 无法跟踪它。",
428
428
  "Why?": "为什么?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "从你的 shell 配置文件中删除 CLAUDE_CODE_SKIP_PROMPT_HISTORY,然后重新启动 Claude Code。"
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "从你的 shell 配置文件中删除 CLAUDE_CODE_SKIP_PROMPT_HISTORY,然后重新启动 Claude Code。",
430
+ "Lead agent name": "主代理的名字",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "已在编辑器设置中指定(agentStandup.leadName)",
432
+ "Costume": "装扮",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "你的吸血鬼来自万圣节礼包,由 Fabien Coupas 手绘。其余角色也在礼包里。"
430
434
  }
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "與 {0} 相同的搜尋:{1}",
344
344
  "reran a failing command: {0}": "重新執行失敗的指令:{0}",
345
345
  "☕ Buy a coffee": "☕ 請喝杯咖啡",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和團隊已經完成。如果這次通話幫你跟上了這段長時間的工作,一杯咖啡能讓 Agent Standup 繼續下去。(我們只問這一次。)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和團隊已經完成。如果這次通話幫你跟上了這段工作,一杯咖啡能讓 Agent Standup 繼續下去。(我們只問這一次。)",
347
347
  "Failed calls": "失敗的呼叫",
348
348
  "+ {0} earlier": "還有更早的 {0} 筆",
349
349
  "Spotted in the session itself, with no model call.": "直接從工作階段中發現,沒有呼叫模型。",
@@ -388,8 +388,8 @@
388
388
  "Privacy policy": "隱私權政策",
389
389
  "Help count users (1 request a week)": "幫忙統計使用者(每週 1 次請求)",
390
390
  "Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.": "萬聖節快到了:把你的智慧體打扮成南瓜、幽靈、女巫或骷髏,皆由 Fabien Coupas 手繪。",
391
- "Happy Halloween! Your agents can come to the call in costume.": "萬聖節快樂!你的智慧體可以穿著裝扮來開會。",
392
- "Halloween is tomorrow: your agents can come to the call in costume.": "明天就是萬聖節:你的智慧體可以穿著裝扮來開會。",
391
+ "Happy Halloween! Your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "萬聖節快樂!你的智能體帶來了南瓜。完整的裝扮在手繪禮包裡。",
392
+ "Halloween is tomorrow: your agents brought pumpkins. The full costumes are in the pack, drawn by hand.": "明天就是萬聖節:你的智能體帶來了南瓜。完整的裝扮在手繪禮包裡。",
393
393
  "advised by": "顧問",
394
394
  "At least: work went on after it last counted.": "這是最低值:上次統計之後工作仍在繼續。",
395
395
  "cost": "費用",
@@ -426,5 +426,9 @@
426
426
  "Claude usage limit: {0} sessions stopped": "Claude 用量上限:{0} 個工作階段已停止",
427
427
  "Claude Code is open in {0} but saves no history (CLAUDE_CODE_SKIP_PROMPT_HISTORY is set), so Agent Standup cannot follow it.": "Claude Code 在 {0} 中開啟,但不儲存歷史記錄(已設定 CLAUDE_CODE_SKIP_PROMPT_HISTORY),因此 Agent Standup 無法追蹤它。",
428
428
  "Why?": "為什麼?",
429
- "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "從你的 shell 設定檔中移除 CLAUDE_CODE_SKIP_PROMPT_HISTORY,然後重新啟動 Claude Code。"
429
+ "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "從你的 shell 設定檔中移除 CLAUDE_CODE_SKIP_PROMPT_HISTORY,然後重新啟動 Claude Code。",
430
+ "Lead agent name": "主代理的名字",
431
+ "Set in the editor’s settings (agentStandup.leadName)": "已在編輯器設定中指定(agentStandup.leadName)",
432
+ "Costume": "裝扮",
433
+ "Your vampire comes from the Halloween pack, drawn by hand by Fabien Coupas. The rest of the cast is in it too.": "你的吸血鬼來自萬聖節禮包,由 Fabien Coupas 手繪。其餘角色也在禮包裡。"
430
434
  }
package/server.js CHANGED
@@ -478,7 +478,7 @@ function timelineEntry(proj, id) {
478
478
  // ---- Live feed. The timeline is sorted again at each build and events already sent can change (an order typed mid-turn is stamped at typing time and lands before what the page has; a sub-agent's last line becomes its report; a tool call joins an earlier beat),
479
479
  // so a page cannot ask for "what comes after index n". Every event has a key `k` that never changes, each build that changes something gets the next sequence number, and a page asks for the events that are new or different since the number it holds.
480
480
  // `ep` names this memory: it is a new one after a restart, after the session left the cache, or when a transcript was rewritten, and the page then loads the whole session again.
481
- const sigOf = (e) => e.kind + '|' + e.agent + '|' + (e.to || '') + '|' + (e.end || '') + '|' + (e.kind === 'tools' ? e.tools.length + ':' + e.tools[e.tools.length - 1].id + ':' + e.tools.map((t) => (t.d && t.d.kind === 'plan' ? (t.d.text || '').length + (t.d.text || '').slice(-24) : '')).join(',') : e.kind === 'usage' ? e.u.i + ',' + e.u.o + ',' + e.u.r + ',' + e.u.w + ',' + e.model : e.kind === 'order' ? e.toolId + ',' + e.bg + ',' + e.title : e.kind === 'finish' ? e.ts : ''); // everything about an event that can differ from one build to the next (a plan's text too: its answer names the plan approved). Its text, its tool calls, its results and its time never do: they come from one transcript record (same key = same record); and `t` moves only when time zero does, which feedStep looks at once for all
481
+ const sigOf = (e) => e.kind + '|' + e.agent + '|' + (e.to || '') + '|' + (e.end || '') + '|' + (e.kind === 'tools' ? e.tools.length + ':' + e.tools[e.tools.length - 1].id + ':' + e.tools.map((t) => (t.d && t.d.kind === 'plan' ? (t.d.text || '').length + (t.d.text || '').slice(-24) : '')).join(',') : e.kind === 'usage' ? e.u.i + ',' + e.u.o + ',' + e.u.r + ',' + e.u.w + ',' + e.model : e.kind === 'order' ? e.toolId + ',' + e.bg + ',' + e.title + ',' + e.text : e.kind === 'finish' ? e.ts : ''); // everything about an event that can differ from one build to the next (a plan's text too: its answer names the plan approved). Except for an order's late-arriving prompt, its text, its tool calls, its results and its time never do: they come from one transcript record (same key = same record); and `t` moves only when time zero does, which feedStep looks at once for all
482
482
  function feedStep(prev, tl, files) {
483
483
  let f = prev && files.every((x) => { const was = prev.gens.get(x); return was === undefined || was === (fileStates.get(x) || {}).gen; }) ? prev : null; // a transcript read again from its start numbers its events again: the keys no longer mean the same thing
484
484
  for (let pass = 0; ; pass++) {
@@ -808,9 +808,9 @@ function logError(where, e) {
808
808
  // (a star on GitHub: they have no store). Only the desktop app and the command line ask on their own, on the third day: the extension asks in its own way (extension.js, noteUse).
809
809
  const RATE_STORES = /^https:\/\/(marketplace\.visualstudio\.com|open-vsx\.org)\//, GITHUB_REPO = 'https://github.com/Atoll92/agent-standup';
810
810
  function appKind() {
811
- const h = String(process.env.AGENT_STANDUP_HOST || ''), rate = String(process.env.AGENT_STANDUP_RATE || '');
811
+ const h = String(process.env.AGENT_STANDUP_HOST || ''), rate = String(process.env.AGENT_STANDUP_RATE || ''), lead = String(process.env.AGENT_STANDUP_LEAD_NAME || '').trim().slice(0, 100);
812
812
  const kind = h === 'desktop app' ? 'desktop' : h === 'command line' ? 'cli' : h === 'claude code plugin' ? 'plugin' : h ? 'editor' : '';
813
- return { kind, rate: kind === 'editor' && RATE_STORES.test(rate) ? rate : GITHUB_REPO, track: !noTrack(), updates: !noUpdate() }; // track: false when DO_NOT_TRACK is set, and the page does not ask about usage
813
+ return { kind, rate: kind === 'editor' && RATE_STORES.test(rate) ? rate : GITHUB_REPO, track: !noTrack(), updates: !noUpdate(), ...(lead ? { lead } : {}) }; // track: false when DO_NOT_TRACK is set, and the page does not ask about usage. lead: the lead's name set in the editor (agentStandup.leadName), which the page cleans and prefers to its own setting
814
814
  }
815
815
  // Usage, counted only for those who said yes, in the desktop app, the command line and the Claude Code plugin (the editor counts itself: extension.js, pingWeek). The page asks once
816
816
  // (prefs.shareUsage, which this server reads again in the settings file before it sends anything); when the call is opened it asks this server, which sends at most one empty request a week (weeks from Monday, UTC) for the 1-pixel file of its kind in the "stats"
@@ -947,7 +947,7 @@ function readNew(file, agent, journal, record = parseRecord) {
947
947
  let size, mtime; try { const s = fs.statSync(file); size = s.size; mtime = s.mtimeMs; } catch { fileStates.delete(file); return null; }
948
948
  let st = fileStates.get(file);
949
949
  if (st && size >= st.offset && mtime !== st.mtime && st.fp.length && !sameBytes(file, st)) st = null; // rewritten in place and not shorter: checked only when the file was written to, with one small read
950
- if (!st || size < st.offset) { st = { agent, file, journal: !!journal, gen: ++fileGen, offset: 0, mtime: 0, fp: Buffer.alloc(0), tail: Buffer.alloc(0), raw: [], toolName: {}, msgUsage: new Map() }; fileStates.set(file, st); }
950
+ if (!st || st.agent !== agent || size < st.offset) { st = { agent, file, journal: !!journal, gen: ++fileGen, offset: 0, mtime: 0, fp: Buffer.alloc(0), tail: Buffer.alloc(0), raw: [], toolName: {}, msgUsage: new Map() }; fileStates.set(file, st); }
951
951
  st.mtime = mtime;
952
952
  while (size > st.offset) { // read in chunks of at most 16 MB so a huge transcript never needs one giant buffer
953
953
  const fd = fs.openSync(file, 'r'); let buf;
@@ -1047,35 +1047,45 @@ function readMeta(f) {
1047
1047
  }
1048
1048
 
1049
1049
  function buildTimeline(proj, id, files = []) {
1050
- const sx = sourceOf(proj), rec = recordOf(sx), base = projDir(proj, id), mainFile = sx ? sx.fileOf(id) || '' : path.join(base, id + '.jsonl'); // a Codex or Vibe session is kept somewhere else, in another format (rec); from here on it is a session like any other (Codex without sub-agents)
1050
+ const sx = sourceOf(proj), rec = recordOf(sx), base = projDir(proj, id), mainFile = sx ? sx.fileOf(id) || '' : path.join(base, id + '.jsonl'); // source readers supply their own session and child files; the timeline and page are shared
1051
1051
  if (!fs.existsSync(mainFile)) throw new Error('session not found');
1052
1052
  const agents = { main: { id: 'main', role: 'Lead', type: 'main' } }; // the lead has the same name whatever tool runs the session: the page gives it
1053
1053
  const states = [(sx && sx.state && guard(() => sx.state(id), null)) || readNew(mainFile, 'main', false, rec)], subs = subFilesOf(proj, id), runs = {}; files.push(mainFile); // sx.state: a format that is not read line by line hands over the events of the session whole // runs: workflow run → { agents (file name → agent id), by (who launched it), toolId, done }
1054
1054
  for (const x of subs) {
1055
1055
  const aid = x.aid, m = x.meta || readMeta(x.file.replace(/\.jsonl$/, '.meta.json'));
1056
1056
  agents[aid] = { id: aid, role: m.description || m.workflowPhase || m.agentType || 'Agent', type: m.agentType || 'agent', toolUseId: m.toolUseId };
1057
+ if (m.parent) Object.assign(agents[aid], { parent: m.parent, name: m.name, startedAt: m.startedAt }); // Codex records the parent explicitly, even when its spawn prompt is encrypted
1057
1058
  if (x.run) { agents[aid].wf = x.run; if (m.workflowPhase) agents[aid].phase = m.workflowPhase; (runs[x.run] = runs[x.run] || { agents: {}, done: new Set() }).agents[x.id0] = aid; } // launched by a workflow: no Agent call of the lead points at it
1058
1059
  agents[aid].mtime = x.mtime || mtimeOf(x.file) || undefined;
1059
- const st = x.st || readNew(x.file, aid, false, rec); if (st) states.push(st); files.push(x.file);
1060
+ const st = x.st || (x.zst ? sx && sx.state && guard(() => sx.state(aid, aid), null) : readNew(x.file, aid, false, rec)); if (st) states.push(st); files.push(x.file); // x.zst: a compressed Codex child, read whole here only
1060
1061
  }
1061
1062
  for (const j of subs.journals) { const st = readNew(j.file, 'wf:' + j.run, true), run = runs[j.run]; files.push(j.file); if (st && run) for (const e of st.raw) if (run.agents[e.child]) run.done.add(run.agents[e.child]); }
1062
1063
  const childByTool = {}; // Agent tool_use id → the sub-agent it created, so we know who ordered whom
1063
1064
  for (const a of Object.values(agents)) if (a.toolUseId) childByTool[a.toolUseId] = a.id;
1064
1065
  const called = {}, born = {}; for (const st of states) if (st) { if (st.raw.length) born[st.agent] = st.raw[0].ts; for (const e of st.raw) if (e.kind === 'agentcall' && e.nm && childByTool[e.toolId]) called[childByTool[e.toolId]] = e.nm; }
1065
1066
  const sameName = {}; for (const a of Object.values(agents).filter((x) => x.id !== 'main').sort((x, y) => (born[x.id] || Infinity) - (born[y.id] || Infinity) || (x.id < y.id ? -1 : 1))) { // in the order they started, so that a second agent of the same name is the one numbered 2 and stays so
1066
- const n = ownName(called[a.id]) || ownName(a.type, true); if (n) { const k = n.toLowerCase(); sameName[k] = (sameName[k] || 0) + 1; a.own = sameName[k] > 1 ? n + ' ' + sameName[k] : n; }
1067
+ const n = ownName(called[a.id]) || ownName(a.name) || ownName(a.type, true); if (n) { const k = n.toLowerCase(); sameName[k] = (sameName[k] || 0) + 1; a.own = sameName[k] > 1 ? n + ' ' + sameName[k] : n; }
1067
1068
  }
1068
1069
  const runByTool = {}; for (const st of states) if (st) for (const e of st.raw) if (e.kind === 'wfrun' && runs[e.run] && !runs[e.run].by) { runs[e.run].by = e.agent; runs[e.run].toolId = e.toolId; runByTool[e.toolId] = runs[e.run]; } // Workflow tool_use id → the run it started
1069
1070
 
1070
1071
  const finished = new Set(), now0 = Date.now(); for (const st of states) if (st) for (const e of st.raw) if (e.kind === 'agentdone') { if (childByTool[e.toolId]) finished.add(childByTool[e.toolId]); else if (runByTool[e.toolId]) for (const a of Object.values(runByTool[e.toolId].agents)) finished.add(a); } // a run that stopped: so did every agent in it
1071
1072
  for (const run of Object.values(runs)) for (const a of run.done) finished.add(a);
1073
+ for (const st of states) if (st && st.agent !== 'main' && st.completed) finished.add(st.agent);
1072
1074
  let recentUntil = 0; for (const a of Object.values(agents)) if (a.id !== 'main' && a.mtime && now0 - a.mtime <= 240000) recentUntil = Math.max(recentUntil, a.mtime + 241000);
1073
1075
  for (const a of Object.values(agents)) if (a.id !== 'main' && now0 - (a.mtime || 0) > 240000) finished.add(a.id); // old transcripts without a completion record: silent for 4 min counts as finished
1074
1076
  const events = [], parent = {}, doneSeen = new Set(), lastTs = {}; for (const st of states) if (st) lastTs[st.agent] = st.lastTs || 0;
1077
+ for (const a of Object.values(agents)) if (a.parent && a.parent !== a.id && agents[a.parent]) parent[a.id] = a.parent;
1075
1078
  const usageBy = new Map(); for (const st of states) if (st) for (const [mid, mu] of st.msgUsage) { if (!/^msg_/.test(mid)) continue; const o = usageBy.get(mid); if (!o || mu.ts < o.msgUsage.get(mid).ts || (mu.ts === o.msgUsage.get(mid).ts && st.agent === 'main')) usageBy.set(mid, st); } // a fork (on by default since Claude Code 2.1.302) starts its file with a copy of the message that launched it: its tokens count once, for the agent that wrote it first. Only the API's own message ids (msg_…) name one message across files: Codex and Vibe number theirs in each agent (t0, v1…), the same name in two agents is two messages
1076
1079
  const finish = (to, ts, by) => { if (!doneSeen.has(to)) { doneSeen.add(to); events.push({ ts, agent: to, kind: 'finish', to: by, k: 'f/' + to }); } }; // one per agent, whichever record says it first: the key is the agent, not the record
1077
1080
  for (const st of states) {
1078
1081
  if (!st) continue;
1082
+ const a = agents[st.agent];
1083
+ if (a && a.parent && parent[st.agent]) {
1084
+ events.push({ ts: a.startedAt || (st.prompt && st.prompt.ts) || born[st.agent] || 0, agent: parent[st.agent], to: st.agent, kind: 'order', bg: true,
1085
+ text: st.prompt ? st.prompt.text : a.role, title: a.role, k: 'o/' + st.agent });
1086
+ for (const [n, q] of (st.prompts || []).entries()) events.push({ ts: q.ts, agent: parent[st.agent], to: st.agent, kind: 'order', bg: true, text: q.text, title: a.role, k: 'o/' + st.agent + '/' + (n + 1) }); // more work for a worker that had finished
1087
+ if (st.completedAt) finish(st.agent, st.completedAt, parent[st.agent]); // kept while it works again (its time moves to the next end): an event that vanished would make the page load the call again
1088
+ }
1079
1089
  let lastSay = -1; // the last thing a sub-agent says is its report back to the lead
1080
1090
  if (st.agent !== 'main' && finished.has(st.agent)) for (let i = st.raw.length - 1; i >= 0; i--) if (st.raw[i].kind === 'say') { lastSay = i; break; }
1081
1091
  const run = agents[st.agent] && agents[st.agent].wf ? runs[agents[st.agent].wf] : null;
@@ -1464,7 +1474,7 @@ function start(port = PORT) {
1464
1474
  .catch((e) => json({ error: String(e.message) }, 400));
1465
1475
  }
1466
1476
  if (url.pathname === '/api/prefs.js') { res.writeHead(200, { 'content-type': 'application/javascript', 'cache-control': 'no-store' }); return res.end('window.SAVED_PREFS = ' + JSON.stringify(readPrefs()).replace(/</g, '\\u003c') + '; window.AS_APP = ' + JSON.stringify(appKind()).replace(/</g, '\\u003c') + ';'); }
1467
- if (url.pathname === '/api/prefs' && req.method === 'PUT') return readBody((body) => { try { const v = JSON.parse(body); if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('prefs must be an object'); const cur = readPrefs() || {}; if ((+cur.shareUsageT || 0) > (+v.shareUsageT || 0)) { v.shareUsage = cur.shareUsage; v.shareUsageT = cur.shareUsageT; v.usageAsked = cur.usageAsked; } if ((+cur.updateNoticeT || 0) > (+v.updateNoticeT || 0)) { v.updateNotice = cur.updateNotice; v.updateNoticeT = cur.updateNoticeT; v.updateAsked = cur.updateAsked; } writePrefs(v); /* the usage answer: a page opened before it was changed elsewhere (another tab, the desktop app) writes back its old settings, not its old answer */ json({ ok: true }); } catch (e) { json({ error: String(e.message || e) }, 400); } });
1477
+ if (url.pathname === '/api/prefs' && req.method === 'PUT') return readBody((body) => { try { let v = JSON.parse(body); if (!v || typeof v !== 'object' || Array.isArray(v)) throw new Error('prefs must be an object'); const cur = readPrefs() || {}; const pt = v._patch && typeof v._patch === 'object' && !Array.isArray(v._patch) ? v._patch : null, set = pt && pt.set && typeof pt.set === 'object' && !Array.isArray(pt.set) ? pt.set : {}; if (pt && (!('_t' in set) || !('_t' in v) || +set._t === +v._t)) { const del = Array.isArray(pt.del) ? pt.del : []; v = { ...cur, ...set }; for (const k of del) if (typeof k === 'string' && !(k in set)) delete v[k]; } delete v._patch; /* a patch dated otherwise than the settings it came with is a stale copy (a page before 1.42 that read one from the file): those settings are written whole */ /* a page sends what it changed, merged into the file as it is now: a window opened earlier no longer puts back what another one changed. A whole object (an older page) still replaces the file */ if ((+cur.shareUsageT || 0) > (+v.shareUsageT || 0)) { v.shareUsage = cur.shareUsage; v.shareUsageT = cur.shareUsageT; v.usageAsked = cur.usageAsked; } if ((+cur.updateNoticeT || 0) > (+v.updateNoticeT || 0)) { v.updateNotice = cur.updateNotice; v.updateNoticeT = cur.updateNoticeT; v.updateAsked = cur.updateAsked; } writePrefs(v); /* the usage answer: a page opened before it was changed elsewhere (another tab, the desktop app) writes back its old settings, not its old answer */ json({ ok: true }); } catch (e) { json({ error: String(e.message || e) }, 400); } });
1468
1478
  if (url.pathname === '/api/prefs') return json(readPrefs() || {});
1469
1479
  if (url.pathname === '/api/answer' && req.method === 'POST') return readBody((body) => { let v = {}; try { v = JSON.parse(body); } catch {} json(answerIn(String((v && v.id) || ''))); }); /* a click on what needs you: open it where it can be answered (answerIn) */
1470
1480
  if (url.pathname === '/api/done' && req.method === 'POST') return readBody((body) => { try { const v = JSON.parse(body); json({ ok: setDone(String(v.proj || ''), String(v.id || ''), v.on !== false) }); } catch (e) { logError('done', e); json({ error: String(e.message || e) }, 400); } });
@@ -1495,7 +1505,7 @@ function start(port = PORT) {
1495
1505
  if (url.pathname === '/api/media') {
1496
1506
  const q = (k) => url.searchParams.get(k) || '', SAFE = /^[\w.\-]+$/, n = +q('n') || 0, bad = [q('proj'), q('id'), q('agent'), q('tool')].some((v) => !SAFE.test(v) || v === '..' || v.length > 200) || q('tool').length < 6; // no tool call has an id that short, and looking for one meant reading the whole transcript
1497
1507
  const sx = sourceOf(q('proj')), user = q('agent') === 'user', ok = !bad && Number.isInteger(n) && n >= 0 && n <= 9, file = ok && !sx ? mediaFile(q('proj'), q('id'), q('agent')) : null;
1498
- const im = !ok ? null : q('proj') === '_demo' ? require('./demo.js').picture(q('tool'), n) : sx ? (sx.image ? guard(() => sx.image(q('id'), q('tool'), n, user), null) : null) : file && toolImage(file, q('tool'), n, user); // a Codex session: from its rollout, plain or compressed (codex.js)
1508
+ const im = !ok ? null : q('proj') === '_demo' ? require('./demo.js').picture(q('tool'), n) : sx ? (sx.image ? guard(() => sx.image(q('id'), q('tool'), n, user, q('agent') || 'main'), null) : null) : file && toolImage(file, q('tool'), n, user); // a Codex session: from the lead or the specified child rollout, plain or compressed
1499
1509
  if (!im) { res.writeHead(bad ? 400 : 404); return res.end(bad ? 'bad request' : 'not found'); }
1500
1510
  res.writeHead(200, { 'content-type': im.type, 'content-length': im.buf.length, 'cache-control': 'private, max-age=3600', 'x-content-type-options': 'nosniff' }); return res.end(im.buf);
1501
1511
  }