@double_geste/agent-standup 1.42.0 → 1.43.1

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.
@@ -24,9 +24,11 @@ Usage
24
24
  Options
25
25
  --port N port of the local server (default 4747)
26
26
  --open open the page in your browser
27
- --projects DIR where the session files are (default ~/.claude/projects, or $CLAUDE_CONFIG_DIR/projects); when it is
28
- named projects, the sessions folder beside it is read too (what waits for you)
29
- --config DIR Claude Code's config folder, as CLAUDE_CONFIG_DIR (its projects and sessions folders are read)
27
+ --projects DIR where the session files are (default ~/.claude/projects, or $CLAUDE_CONFIG_DIR/projects, and those of
28
+ each ~/.claude-<name> folder of another account); when it is named projects, the sessions folder
29
+ beside it is read too (what waits for you)
30
+ --config DIR Claude Code's config folder, as CLAUDE_CONFIG_DIR (its projects and sessions folders are read, and
31
+ no other account's)
30
32
  --codex DIR where Codex keeps its files (default ~/.codex, or $CODEX_HOME); "off" to leave Codex sessions out
31
33
  --vibe DIR where Mistral Vibe keeps its files (default ~/.vibe, or $VIBE_HOME); "off" to leave Vibe sessions out
32
34
  --cowork DIR where the Claude desktop app keeps its Cowork sessions (default: its local-agent-mode-sessions folder); "off" to leave them out
@@ -44,7 +46,7 @@ if (flags.projects && path.basename(path.resolve(flags.projects)) === 'projects'
44
46
  if (flags.codex !== undefined) process.env.AGENT_STANDUP_CODEX = /^(0|off|no|false)?$/i.test(String(flags.codex)) ? 'off' : path.resolve(String(flags.codex));
45
47
  if (flags.vibe !== undefined) process.env.AGENT_STANDUP_VIBE = /^(0|off|no|false)?$/i.test(String(flags.vibe)) ? 'off' : path.resolve(String(flags.vibe));
46
48
  if (flags.cowork !== undefined) process.env.AGENT_STANDUP_COWORK = /^(0|off|no|false)?$/i.test(String(flags.cowork)) ? 'off' : path.resolve(String(flags.cowork));
47
- if (flags.config) process.env.CLAUDE_CONFIG_DIR = path.resolve(flags.config);
49
+ if (flags.config) { process.env.CLAUDE_CONFIG_DIR = path.resolve(flags.config); process.env.AGENT_STANDUP_CLAUDE_DIRS = 'off'; } // the one account asked for, not the other Claude Code folders
48
50
  if (flags.characters) process.env.AGENT_STANDUP_CHARACTERS = path.resolve(flags.characters);
49
51
  if (flags.port !== undefined) { // a real port number or nothing: no silent fallback to another port
50
52
  if (!/^\d+$/.test(String(flags.port)) || +flags.port < 1 || +flags.port > 65535) { console.error(`Invalid --port "${flags.port}": use a number between 1 and 65535.`); process.exit(2); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@double_geste/agent-standup",
3
- "version": "1.42.0",
3
+ "version": "1.43.1",
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
@@ -82,6 +82,7 @@
82
82
  @media (min-width:900px) { body.rost:not(.tree):not(.board) #roster { display:flex } }
83
83
  #roster:focus-visible { outline:2px solid var(--accent); outline-offset:-2px } /* the first stop of the Tab key */
84
84
  #roster h3 { margin:2px 6px 4px; font-size:11px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--dim) }
85
+ #roster h3 .rnm { float:right; background:none; border:0; padding:0 3px; border-radius:4px; color:var(--dim); font:inherit; font-size:12px; line-height:1.2; cursor:pointer } #roster h3 .rnm:hover, #roster h3 .rnm:focus-visible { color:var(--accent) } #dren { margin-left:auto; margin-right:4px } /* ✎: rename the agents (⚙ → All settings → Sub-agent names) */
85
86
  .rr { display:flex; flex-direction:column; gap:2px; padding:6px 9px; border-radius:9px; border-left:3px solid transparent; background:var(--panel2); cursor:pointer; min-width:0 }
86
87
  .rr:hover { background:#2a2f45 } .rr.sel { outline:1px solid var(--accent) }
87
88
  .rr .n { display:flex; align-items:center; gap:7px; min-width:0 } .rr .dot { width:9px; height:9px; border-radius:50%; flex:none } .rr b { font-size:12.5px } .rr .ro { color:var(--dim); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0 }
@@ -131,7 +132,7 @@
131
132
  .tile.oops { animation:oops .5s } @keyframes oops { 20% { transform:translateX(-5px) rotate(-1.2deg); box-shadow:0 0 0 3px rgba(255,82,82,.6) } 50% { transform:translateX(5px) rotate(1.2deg) } 80% { transform:translateX(-2px) } }
132
133
  .confetti { position:absolute; top:-12px; width:8px; height:12px; z-index:7; pointer-events:none; animation:fall 2.4s ease-in forwards } @keyframes fall { to { transform:translateY(105vh) rotate(720deg); opacity:.9 } }
133
134
  .prop { position:absolute; top:26px; left:8px; font-size:26px; z-index:3; pointer-events:none; filter:drop-shadow(0 2px 4px rgba(0,0,0,.5)) } .prop:empty { display:none }
134
- .prop.blocked { animation:handup .7s ease-in-out infinite; transform-origin:70% 90% } @keyframes handup { 50% { transform:rotate(-24deg) translateY(-3px) } }
135
+ .prop.blocked { pointer-events:auto; animation:handup .7s ease-in-out infinite; transform-origin:70% 90% } @keyframes handup { 50% { transform:rotate(-24deg) translateY(-3px) } }
135
136
  .prop.stalled { animation:shake .5s ease-in-out infinite } @keyframes shake { 25% { transform:translateX(-3px) } 75% { transform:translateX(3px) } }
136
137
  .prop.waiting { animation:tick 2.4s ease-in-out infinite } @keyframes tick { 50% { transform:rotate(180deg) } }
137
138
  .prop.cheer { animation:cheer 1.1s ease-out both } @keyframes cheer { 0% { transform:scale(.3) translateY(10px); opacity:0 } 40% { transform:scale(1.25); opacity:1 } 100% { transform:translateY(-14px); opacity:0 } }
@@ -301,7 +302,8 @@
301
302
  .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 }
302
303
  .glink { color:var(--dim); font-size:12.5px; text-decoration:underline; text-underline-offset:3px } .glink:hover { color:#ffd24a }
303
304
  #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) }
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 }
305
+ #menuQ, #logQ, #leadName, #projectLeadName { 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, #projectLeadName:focus { border-color:var(--accent) } #leadName, #projectLeadName { width:100%; margin:2px 0 6px } #leadName:disabled, #projectLeadName:disabled { opacity:.6 } #leadHint, #projectLeadHint, #subNamesHint { overflow-wrap:anywhere; font-size:11.5px; margin:-2px 0 6px }
306
+ #subNames { width:100%; min-height:54px; margin:2px 0 6px; resize:vertical; 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 } #subNames:focus { border-color:var(--accent) } #subFill { font-size:11.5px; padding:3px 9px; margin:0 0 6px }
305
307
  #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 }
306
308
  #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) }
307
309
  #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) }
@@ -435,8 +437,10 @@
435
437
  <button class="mi" data-t="notify"><span data-fr="Me prévenir quand les agents ont fini" data-en="Notify me when agents finish">Me prévenir quand les agents ont fini</span><i class="sw"></i></button>
436
438
  <h4 data-fr="Personnages" data-en="Characters">Personnages</h4>
437
439
  <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>
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
440
  <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>
441
+ <div class="box" id="projectLeadBox"><label class="lbl" for="projectLeadName" data-fr="Nom pour ce projet" data-en="Name for this project">Nom pour ce projet</label><input id="projectLeadName" type="text" maxlength="48" autocomplete="off" spellcheck="false" aria-describedby="projectLeadHint"><div class="dim" id="projectLeadHint"></div></div>
442
+ <div class="box" id="subNamesBox"><label class="lbl" for="subNames" data-fr="Noms des sous-agents" data-en="Sub-agent names">Noms des sous-agents</label><textarea id="subNames" rows="2" maxlength="2000" autocomplete="off" spellcheck="false" aria-describedby="subNamesHint"></textarea><button class="btn" id="subFill" type="button" style="display:none" data-fr="Partir des noms de l’appel" data-en="Start from the names in the call">Partir des noms de l’appel</button><div class="dim" id="subNamesHint"></div></div>
443
+ <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>
440
444
  </div><div class="pcol">
441
445
  <h4 data-fr="Affichage" data-en="Display">Affichage</h4>
442
446
  <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>
@@ -467,7 +471,7 @@
467
471
  <div id="toasts" role="status" aria-live="polite"><div class="toast offer" id="vOffer" style="display:none"><span id="vOfferT"></span><button class="btn" id="vOfferB"></button><button class="ic" id="vOfferX" aria-label="Close">✕</button></div><div class="toast offer" id="packNote" style="display:none"><img id="packNoteI" src="pack-halloween.jpg" alt="" width="48" height="36"><span id="packNoteT"></span><button class="btn" id="packNoteB"></button><button class="ic" id="packNoteX" aria-label="Close">✕</button></div><div class="toast offer" id="trNote" style="display:none"><span id="trNoteT"></span><button class="btn" id="trNoteOk"></button><button class="btn" id="trNoteOff"></button></div></div><div id="visit" role="status" aria-live="polite"></div><div id="askc" role="region" aria-live="polite"></div>
468
472
  <div id="empty"><h2 id="eT"></h2><p id="eP"></p><div id="eMiss"></div><button class="cta" id="eDemo"></button></div>
469
473
  <div id="gate"><button class="cta" id="gB"></button></div>
470
- <div id="detail"><div class="hd"><b id="dname"></b><button class="ic" id="dclose">✕</button></div><div id="dbody"></div></div>
474
+ <div id="detail"><div class="hd"><b id="dname"></b><button class="ic" id="dren" type="button">✎</button><button class="ic" id="dclose">✕</button></div><div id="dbody"></div></div>
471
475
  </section>
472
476
  <aside><h2 id="logH" data-fr="Transcription" data-en="Transcript">Transcript</h2><input id="logQ" type="search" placeholder="Search…" aria-label="Search the transcript" style="margin:8px 10px;width:calc(100% - 20px)"><div id="log"></div></aside>
473
477
  </main>
@@ -508,6 +512,7 @@ const APP = window.AS_APP && typeof window.AS_APP === 'object' && typeof window.
508
512
 
509
513
  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 };
510
514
  const PREF_DEFAULTS = { ...prefs }; // for ⚙ → All settings → Reset to defaults
515
+ let leadProject = null; // the project of the loaded live call or replay, supplied by the server before naming its agents
511
516
  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
512
517
  { 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
513
518
  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 */
@@ -569,16 +574,21 @@ async function setLang(code, save) {
569
574
  // =====================================================================
570
575
  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'];
571
576
  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.
577
+ // The lead's name: Margot, the global default, the current project override, or the name 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
578
  // typeof: the landing page reuses this section and has neither prefs nor APP
574
579
  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;
580
+ // One top-level preference per project: the existing prefsPatch merges independent window edits without replacing a shared map.
581
+ const projectLeadKey = () => typeof leadProject === 'object' && leadProject ? 'leadName:' + leadProject.key : '';
582
+ const leadName = () => (typeof APP === 'object' && APP && cleanLead(APP.lead)) || (typeof prefs === 'object' && prefs && (cleanLead(prefs[projectLeadKey()]) || cleanLead(prefs.leadName))) || LEAD_NAME;
576
583
  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
584
+ // Your own names for the sub-agents (⚙ → All settings → Sub-agent names, prefs.subNames: names separated by commas), given in your order instead of the built-in list. Parsed again only when the text changes
585
+ let subListMemo = { text: null, list: [] };
586
+ const subNameList = () => { const t = typeof prefs === 'object' && prefs && typeof prefs.subNames === 'string' ? prefs.subNames : ''; if (t !== subListMemo.text) { const seen = new Set(), list = []; for (const v of t.split(/[,;\n]+/)) { const n = cleanLead(v), k = n.toLocaleLowerCase(); if (n && !seen.has(k) && list.length < 200) { seen.add(k); list.push(n); } } subListMemo = { text: t, list }; } return subListMemo.list; };
577
587
  function uniqueName(id, h) {
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));
588
+ if (nameBook[id]) return nameBook[id]; const taken = new Set(Object.values(nameBook).map((n) => n.toLocaleLowerCase())); taken.add(leadName().toLocaleLowerCase()); // never the lead's own name: one may be chosen from this list
589
+ const own = subNameList().filter((n) => !isLeadName(n)), pool = own.length ? own : NAMES, at = own.length ? 0 : h; // your list: its names in your order; the built-in one: a name drawn from the agent's id
590
+ for (let k = 0; k < pool.length; k++) { const n = pool[(at + k) % pool.length]; if (!taken.has(n.toLocaleLowerCase())) return (nameBook[id] = n); }
591
+ for (let r = 2; ; r++) for (let k = 0; k < pool.length; k++) { const b = pool[(at + k) % pool.length]; if (isLeadName(b)) continue; const n = b + ' ' + r; if (!taken.has(n.toLocaleLowerCase())) return (nameBook[id] = n); } // every name taken: Ada 2, Linus 2… then Ada 3, never after the lead's name ("Ivan 2" would read as a fork of a lead called Ivan); the pool always holds a name that is not the lead's
582
592
  }
583
593
  const PAL = ['#ff7a6b','#ffb347','#ffd84a','#4fd1a5','#4cc3ff','#7c8cff','#b583ff','#ff7eb6'];
584
594
  const hexRGB = (h) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
@@ -715,11 +725,15 @@ function packNote() { // the Halloween pack, to someone without it, twice a se
715
725
  $('#packNoteB').textContent = L('Voir le pack', 'See the pack') + ' · ' + price;
716
726
  }
717
727
  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
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
728
+ // The order agents are named in: the order they started (born, from the server), not the order their files are listed in (by their ids: effectively random). A reload, a replay and the live call then give each agent
729
+ // the same name, a first name of your list the same agent, and a fork the same number. Without born (the demo, a session just started), the order they came in
730
+ const byBorn = (list) => list.map((a, j) => ({ a, j })).sort((x, y) => (x.a.born || Infinity) - (y.a.born || Infinity) || x.j - y.j).map((x) => x.a);
731
+ const ownFree = (a) => { const taken = new Set(Object.keys(nameBook).filter((k) => k !== a.id).map((k) => nameBook[k].toLocaleLowerCase())); let n = a.own; for (let r = 2; taken.has(n.toLocaleLowerCase()); r++) n = a.own + ' ' + r; return n; }; // a name of its own that another agent has already (a first name of your list, or the same name from another tool): a number after it
732
+ const subName = (a, h) => (/^visit:/.test(a.id || '') ? (isLeadName(a.given) ? NAMES[(h + 1) % NAMES.length] : a.given) : a.own && prefs.ownNames && !isLeadName(a.own) ? (nameBook[a.id] = ownFree(a)) : ((a.twinN || (!isLeadName(a.given) && !subNameList().length)) && a.given) || uniqueName(a.id, h)); /* a visitor from another session keeps its built-in name and takes none of the call's names; a fork is the one agent named after the lead; with your own list, the names a tool gave (Codex's nicknames, the demo's) give way to it */ // 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
733
  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
734
  const names = () => Object.values(S.agents).map((p) => p.name).join('\n'), was = names();
721
735
  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
736
+ for (const k in nameBook) delete nameBook[k]; for (const p of byBorn(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
737
  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
724
738
  }
725
739
  function persona0(a) {
@@ -1322,7 +1336,7 @@ async function speakLine(text, p, primary, token, lo = voiceLang(text), always =
1322
1336
  // rendering
1323
1337
  // =====================================================================
1324
1338
  function addTile(p) {
1325
- const d = document.createElement('div'); d.className = 'tile' + (p.lead ? ' lead' : ''); d.id = 't-' + p.id; d.tabIndex = 0; d.setAttribute('role', 'button'); d.setAttribute('aria-label', p.name + ' — ' + p.role); d.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openDetail(p.id); } }; d.style.display = 'none'; d.onclick = () => openDetail(p.id);
1339
+ const d = document.createElement('div'); d.className = 'tile' + (p.lead ? ' lead' : ''); d.id = 't-' + p.id; d.tabIndex = 0; d.setAttribute('role', 'button'); d.setAttribute('aria-label', p.name + ' — ' + p.role); d.onkeydown = (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); openDetail(p.id); } }; d.style.display = 'none'; d.onclick = (e) => { const st = e.target.closest('.bubble, .status, .prop') && !String(getSelection() || '') && agentState(p.id, Date.now()); if (st && st.k === 'blocked' && st.sure) answerAt(S.cur); else openDetail(p.id); }; /* its "needs you" badge, its raised hand or its bubble while it asks you: the tab or terminal where the question or permission waits (answerAt), as the card does */
1326
1340
  d.innerHTML = `${avatarSVG(p, undefined, 't' + p.gid + '_')}<div class="bubble"></div><div class="status"></div><div class="prop"></div><div class="thought"></div><div class="ticker"></div><div class="tbadge"></div><div class="tag"><b>${esc(p.name)}</b><span>${esc(p.role)}</span><span class="tk"></span><span class="cx"></span></div>`;
1327
1341
  $('#stage').appendChild(d);
1328
1342
  }
@@ -1582,7 +1596,7 @@ function paintStates() {
1582
1596
  if (p.id === 'user') continue; const t = $('#t-' + p.id); if (!t) continue;
1583
1597
  const st = agentState(p.id, now), shown = t.style.display !== 'none'; if (shown && n[st.k] !== undefined && !S.gone.has(p.id)) { n[st.k]++; if (st.k === 'blocked' || st.k === 'stalled') attn.push(p.id); }
1584
1598
  STATE_CLASSES.forEach((c) => t.classList.toggle(c, st.k === c && !(c === 'done' && st.stop))); /* stopped by the usage limit or a logout: resting, not the happy face and sparkles of done */
1585
- const el = t.querySelector('.status'); if (el.textContent !== st.txt) { el.textContent = st.txt; const tb = t.querySelector('.tbadge'); if (tb) tb.style.top = el.offsetHeight > 26 ? el.offsetTop + el.offsetHeight + 4 + 'px' : ''; } /* a status on two lines: the badges under it move down */ const sc = 'status ' + st.k + (isTurn(p.id, st) ? ' turn' : '') + (st.gave || st.stop ? ' gave' : ''); if (el.className !== sc) el.className = sc;
1599
+ const el = t.querySelector('.status'); if (el.textContent !== st.txt) { el.textContent = st.txt; const tb = t.querySelector('.tbadge'); if (tb) tb.style.top = el.offsetHeight > 26 ? el.offsetTop + el.offsetHeight + 4 + 'px' : ''; } /* a status on two lines: the badges under it move down */ const go = st.k === 'blocked' && st.sure ? L('Cliquez pour aller répondre', 'Click to go and answer') : ''; if (el.title !== go) el.title = go; const sc = 'status ' + st.k + (isTurn(p.id, st) ? ' turn' : '') + (st.gave || st.stop ? ' gave' : ''); if (el.className !== sc) el.className = sc;
1586
1600
  const pr = t.querySelector('.prop'), want = { blocked: '✋', stalled: '😰', waiting: '⌛' }[st.k] || '', was = S.prevState[p.id]; // a raised hand, a sweat drop, an hourglass: the call metaphor for "needs you / stuck / waiting"
1587
1601
  const spot = S.spotted || (S.spotted = new Set()); if (st.k !== 'blocked' || !st.sure) spot.delete(p.id); else if (!spot.has(p.id) && shown && !S.gone.has(p.id) && !S.speakers.size && !(S.focusLock > Date.now())) { spot.add(p.id); setFocus(p.id); } // one that waits on you takes the spotlight once per wait, as soon as nobody talks (the speaker has it until then)
1588
1602
  if (st.k === 'done' && was && was !== 'done' && was !== 'idle') { pr.textContent = '🎉'; pr.className = 'prop cheer'; setTimeout(() => { if (pr.classList.contains('cheer')) { pr.textContent = ''; pr.className = 'prop'; } }, 1200); }
@@ -1620,10 +1634,10 @@ function paintRoster(ros) { // a fixed list beside the call: who is doing what
1620
1634
  const rows = ros.slice(0, 60).map(({ p, st }) => `<div class="rr k-${st.k}${isTurn(p.id, st) ? ' turn' : ''}${st.gave || st.stop ? ' gave' : ''}${S.focus === p.id ? ' sel' : ''}${S.speakers.has(p.id) ? ' speaking' : ''}" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}, ${esc(st.txt || '')}" title="${esc(p.name + ' — ' + p.role + leadTool(p) + (st.txt ? '\n' + st.txt : '') + (S.lastTool[p.id] ? '\n' + S.lastTool[p.id] : ''))}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role + leadTool(p))}</span>${rosTok(p.id)}</div><div class="st">${esc(st.txt || L('en veille', 'standing by'))}${S.loops[p.id] ? ' 🔁' : ''}${S.wst.items && S.wst.items[p.id] && S.wst.items[p.id].length ? ' ♻' + S.wst.items[p.id].length : ''}</div></div>`).join('');
1621
1635
  const left = Object.values(S.agents).filter((p) => S.gone.has(p.id) && p.id !== 'main' && p.id !== 'user').sort((a, b) => (S.lastAct[b.id] || 0) - (S.lastAct[a.id] || 0)); // a finished agent's tile leaves the stage: its line stays here, with what it used
1622
1636
  const gone = left.slice(0, 40).map((p) => `<div class="rr left" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role)}</span>${rosTok(p.id)}</div></div>`).join('');
1623
- const html = `<h3>${L('Agents', 'Agents')} · ${ros.length}</h3>${rows}${ros.length > 60 ? `<div class="ro" style="padding:4px 8px">+${ros.length - 60}</div>` : ''}${left.length ? `<h3 style="margin-top:8px">${L('terminés', 'done')} · ${left.length}</h3>${gone}` : ''}`;
1637
+ const html = `<h3>${L('Agents', 'Agents')} · ${ros.length}<button class="rnm" type="button" title="${esc(L('Renommer les agents', 'Rename the agents'))}" aria-label="${esc(L('Renommer les agents', 'Rename the agents'))}">✎</button></h3>${rows}${ros.length > 60 ? `<div class="ro" style="padding:4px 8px">+${ros.length - 60}</div>` : ''}${left.length ? `<h3 style="margin-top:8px">${L('terminés', 'done')} · ${left.length}</h3>${gone}` : ''}`;
1624
1638
  if (box.dataset.h !== html) { box.dataset.h = html; box.innerHTML = html; }
1625
1639
  }
1626
- $('#roster').onclick = (e) => { const r = e.target.closest('.rr'); if (!r) return; if (r.classList.contains('left')) { openDetail(r.dataset.id); return; } S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); };
1640
+ $('#roster').onclick = (e) => { if (e.target.closest('.rnm')) return openPrefs($('#subNamesBox')); const r = e.target.closest('.rr'); if (!r) return; if (r.classList.contains('left')) { openDetail(r.dataset.id); return; } S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); };
1627
1641
  $('#roster').onkeydown = (e) => { const r = e.target.closest('.rr'); if (r && r.classList.contains('left') && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); openDetail(r.dataset.id); } else if (r && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); } else if (r && e.key === 'i') openDetail(r.dataset.id); };
1628
1642
  $('#roster').ondblclick = (e) => { const r = e.target.closest('.rr'); if (r) openDetail(r.dataset.id); };
1629
1643
  function renderBadges() { // per tile: failed tool calls, a command that has been running a long time, an agent that went quiet
@@ -2268,7 +2282,8 @@ $('#tree').onclick = (e) => {
2268
2282
 
2269
2283
  // ---------- agent detail ----------
2270
2284
  function openDetail(id) { const p = S.agents[id]; if (!p) return; S.detail = id; S.detailOpen = (S.detailOpen || 0) + 1; // detailOpen: the human's made-up day is drawn again at each opening, and stays put while the panel refreshes
2271
- $('#dname').textContent = `${p.name} · ${p.role}`; renderDetail(); $('#detail').classList.add('on'); }
2285
+ $('#dname').textContent = `${p.name} · ${p.role}`; $('#dren').style.display = id === 'user' ? 'none' : ''; renderDetail(); $('#detail').classList.add('on'); }
2286
+ $('#dren').onclick = () => { const p = S.agents[S.detail]; if (!p || p.id === 'user') return; openPrefs(p.id !== 'main' && !p.twinN ? $('#subNamesBox') : projectLeadKey() && !cleanLead(APP.lead) ? $('#projectLeadBox') : $('#leadBox')); }; // ✎ beside an agent's name: where its name is chosen (the lead and its forks: the lead's name, for this project when there is one)
2272
2287
  // ---------- the human's panel: nothing to do any more, and proud of it. Drawn at random each time it opens; English and French, the other languages get the English ----------
2273
2288
  const IDLE = {
2274
2289
  en: { tools: ['Coffee', 'Approve without reading', 'Refresh the pull request', '“Looks good to me”', 'Stretch', 'Check Slack', 'Rename one variable', 'Explain the plan to the cat', 'Open X “for research”', 'Sigh', 'Snack', 'Water the plant', 'Pretend to review', 'Update LinkedIn', 'Ctrl+C', 'Ctrl+V', 'Close 37 tabs'],
@@ -2887,7 +2902,8 @@ async function loadSession(proj, id) {
2887
2902
  pause(); const mine = (S.loadN = (S.loadN || 0) + 1);
2888
2903
  const data = await (await fetch(`/api/session?proj=${encodeURIComponent(proj)}&id=${id}`)).json();
2889
2904
  if (mine !== S.loadN || data.error) return false;
2890
- S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; S.cost = data.cost || null; for (const k in nameBook) delete nameBook[k]; [{ id: 'user' }, ...data.agents].forEach((a) => (S.agents[a.id] = persona(twinOf(a))));
2905
+ leadProject = data.project || null; clearTimeout(leadTimer); leadField(true);
2906
+ S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; S.cost = data.cost || null; for (const k in nameBook) delete nameBook[k]; const all = [{ id: 'user' }, ...data.agents]; for (const a of byBorn(all)) S.agents[a.id] = persona(twinOf(a)); S.agents = Object.fromEntries(all.map((a) => [a.id, S.agents[a.id]])); // named in the order they started, kept in the server's order
2891
2907
  clearThoughts(); Object.assign(TH, { since: {}, next: {}, said: {}, last: 0 }); S.events = data.events; stampT(0); S.byK = new Map(data.events.map((e) => [e.k, e])); S.seq = data.seq || 0; S.ep = data.ep || ''; S.sawEnd = !!data.marks || data.events.some((e) => e.end); S.late = []; S.pos = 0; S.joinAt = Date.now(); S.idx = 0; S.status = {}; S.tc = {}; S.cur = { proj, id }; S.logTo = 0; S.detail = null; $('#detail').classList.remove('on'); S.fgone = new Set(); S.fmade = new Map(); S.artOk = new Map(); S.artPin = null; S.artWhole = null; S.wholeSeen = new Set();
2892
2908
  const opt = $('#sessions').selectedOptions[0]; S.title = (S.live ? niceProj(proj) : opt && opt.dataset.title) || '';
2893
2909
  if (proj === '_demo') S.events.forEach((e) => { if (e.fr) trMem.set(baseText(e), e.fr, 'fr'); }); // the demo ships its own French
@@ -2942,8 +2958,10 @@ setInterval(async () => {
2942
2958
  if (switched || !S.cur) return;
2943
2959
  const cur = S.cur, d = await (await fetch(`/api/session?proj=${encodeURIComponent(cur.proj)}&id=${cur.id}&after=${S.seq}&ep=${encodeURIComponent(S.ep)}`)).json();
2944
2960
  if (d.error || cur !== S.cur) return; if (d.resync) { S.cur = null; return; } // the server no longer has our place (restarted, transcript rewritten): reload next tick
2961
+ if ('project' in d && (d.project || {}).key !== (leadProject || {}).key) { leadProject = d.project || null; clearTimeout(leadTimer); leadField(true); renameLead(); } // the first cwd can arrive after the call opens, even without a new event
2945
2962
  S.seq = d.seq; if (d.marks) S.sawEnd = true; if (d.cost && (!S.cost || d.cost.usd !== S.cost.usd || d.cost.final !== S.cost.final)) { S.cost = d.cost; later('tok', renderTokens, 300); } if (!d.events || !d.events.length) return;
2946
- for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(twinOf(a)); addTile(S.agents[a.id]); }
2963
+ for (const a of d.agents) if (a.born && S.agents[a.id] && !S.agents[a.id].born) S.agents[a.id].born = a.born; /* seen before its first line was read: its start time now, for the next renaming */
2964
+ for (const a of byBorn(d.agents.filter((x) => !S.agents[x.id]))) { S.agents[a.id] = persona(twinOf(a)); addTile(S.agents[a.id]); } // several new at once: named in the order they started, as a reload names them
2947
2965
  const from = S.events.length, fresh = [], changed = []; // the session is not written in order: what is new goes at the end (the order the call got it in), what the server corrected is corrected in place
2948
2966
  for (const e of d.events) { const old = S.byK.get(e.k); if (old && old.tools && e.tools) e.tools = e.tools.map((t, j) => (old.tools[j] && old.tools[j].id === t.id ? Object.assign(old.tools[j], t) : t)); /* a call sent again (its plan named by the answer): the same object, which the shared screen holds */
2949
2967
  if (old) { changed.push([old, { kind: old.kind, n: old.tools ? old.tools.length : 0, end: old.end }]); Object.assign(old, e); } else { S.byK.set(e.k, e); fresh.push(e); } }
@@ -3254,8 +3272,8 @@ function applyLang() {
3254
3272
  document.querySelectorAll('#viewSeg button').forEach((b) => { b.title = b.textContent; }); // in a narrow window they are icons: the name stays as a tooltip
3255
3273
  $('#callTrMi').style.display = CALL_LANG[prefs.lang] && !FR() ? '' : 'none';
3256
3274
  const sel = $('#langSel'); if (!sel.options.length) sel.innerHTML = LANGS.map(([c, n]) => `<option value="${c}">${n}</option>`).join(''); sel.value = prefs.lang;
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();
3275
+ [['#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')], ['#dren', L('Renommer', 'Rename')]].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));
3276
+ leadField(); subField();
3259
3277
  $('#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');
3260
3278
  $('#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.'));
3261
3279
  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; } }
@@ -3311,20 +3329,21 @@ function menuInit() {
3311
3329
  $('#menuNone').style.display = q && !far.length && !secs.some((sc) => sc.items.some((e) => !e.classList.contains('mhide'))) ? '' : 'none';
3312
3330
  };
3313
3331
  }
3314
- const onSwitch = (e) => { const b = e.target.closest('.mi[data-t]'); if (!b) return; prefs[b.dataset.t] = !prefs[b.dataset.t]; savePrefs(); if (prefs[b.dataset.t] && ['voice', 'office', 'music', 'notify'].includes(b.dataset.t)) claimAudio(); b.querySelector('.sw').classList.toggle('on', prefs[b.dataset.t]); AUD.apply(); if (b.dataset.t === 'shareUsage') { prefs.usageAsked = true; savePrefs(); usageOpened(true); } if (b.dataset.t === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'callTr') { prefs.callTrSeen = true; savePrefs(); setLang(prefs.lang); } if (b.dataset.t === 'voice') { voiceOffer(); $('#voiceVolBox').style.display = prefs.voice ? '' : 'none'; } if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'files') paintFiles(); if (b.dataset.t === 'artNet' && S.present) renderPresent(); if (b.dataset.t === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); if (b.dataset.t === 'focusLayout') { document.body.classList.toggle('focusl', !!prefs.focusLayout); layout(); } if (b.dataset.t === 'roster') { document.body.classList.toggle('rost', prefs.roster); paintStates(); } if (b.dataset.t === 'notify') { prefs.notifyChosen = true; savePrefs(); } if (b.dataset.t === 'notify' && prefs.notify) askNotify(); if (b.dataset.t === 'vanish' && !prefs.vanish) { S.gone.clear(); paintStatus(); }
3332
+ const onSwitch = (e) => { const b = e.target.closest('.mi[data-t]'); if (!b) return; prefs[b.dataset.t] = !prefs[b.dataset.t]; savePrefs(); if (prefs[b.dataset.t] && ['voice', 'office', 'music', 'notify'].includes(b.dataset.t)) claimAudio(); b.querySelector('.sw').classList.toggle('on', prefs[b.dataset.t]); AUD.apply(); if (b.dataset.t === 'shareUsage') { prefs.usageAsked = true; savePrefs(); usageOpened(true); } if (b.dataset.t === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'callTr') { prefs.callTrSeen = true; savePrefs(); setLang(prefs.lang); } if (b.dataset.t === 'voice') { voiceOffer(); $('#voiceVolBox').style.display = prefs.voice ? '' : 'none'; } if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'files') paintFiles(); if (b.dataset.t === 'artNet' && S.present) renderPresent(); if (b.dataset.t === 'ownNames') { renameAll(); subField(); } if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); if (b.dataset.t === 'focusLayout') { document.body.classList.toggle('focusl', !!prefs.focusLayout); layout(); } if (b.dataset.t === 'roster') { document.body.classList.toggle('rost', prefs.roster); paintStates(); } if (b.dataset.t === 'notify') { prefs.notifyChosen = true; savePrefs(); } if (b.dataset.t === 'notify' && prefs.notify) askNotify(); if (b.dataset.t === 'vanish' && !prefs.vanish) { S.gone.clear(); paintStatus(); }
3315
3333
  if (b.dataset.t === 'askCard') paintAsk(Date.now());
3316
3334
  if (b.dataset.t === 'updateNotice') { prefs.updateAsked = true; savePrefs(); $('#updTip').style.display = 'none'; if (prefs.updateNotice) { updStart.at = 0; setTimeout(updStart, 600); } } /* an answer too; on: asked once the settings file says so (savePrefs waits 400 ms) */
3317
3335
  if (b.dataset.t === 'music') { $('#musicBox').style.display = prefs.music ? '' : 'none'; if (prefs.music) { AUD.init(); AUD.apply(); } } };
3318
3336
  $('#menu').onclick = onSwitch; $('#prefs').onclick = (e) => { if (e.target === $('#prefs')) return closePrefs(); onSwitch(e); setTimeout(syncSwitches); };
3319
3337
  function openPrefs(target) { // ⚙ → All settings; target: one of its settings, found by the search of the menu, shown and lit up
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]));
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();
3338
+ $('#menu').classList.remove('on'); $('#prefs').classList.add('on'); syncSwitches(); subField(); document.querySelectorAll('#prefs .mi[data-t]').forEach((b) => b.querySelector('.sw').classList.toggle('on', !!prefs[b.dataset.t]));
3339
+ 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, textarea, button') || target).focus(); } else $('#prefsX').focus();
3322
3340
  }
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
3341
+ const PANEL_KEYS = ['office', 'officeVol', 'music', 'station', 'musicVol', 'voiceVol', 'notify', 'customLaptop', 'ownNames', 'roster', 'reactions', 'banter', 'chat', 'vanish', 'epi', 'files', 'artNet', 'visits', 'askCard', 'followTab', 'leadName', 'subNames']; // what the panel holds, and so what Reset puts back
3324
3342
  $('#prefsReset').onclick = async () => {
3325
3343
  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
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
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 */
3344
+ const keys = [...PANEL_KEYS, ...(projectLeadKey() ? [projectLeadKey()] : [])]; // reset the displayed project override, leaving other projects alone
3345
+ for (const k of 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
3346
+ prefs._t = Date.now(); try { localStorage.setItem('cc.prefs', prefsOut()); } catch {} for (const k of [...keys, 'notifyChosen']) prefsBase[k] = { reset: true }; try { await putPrefs(); } catch {} /* marked as changed: reset too what another window changed after this one loaded */
3328
3347
  location.reload(); // every part of the page starts again from them
3329
3348
  };
3330
3349
  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
@@ -3346,15 +3365,33 @@ $('#station').value = prefs.station; $('#musicVol').value = prefs.musicVol; $('#
3346
3365
  $('#station').onchange = (e) => { prefs.station = e.target.value; savePrefs(); AUD.init(); RADIO.sync(); };
3347
3366
  $('#chatSel').value = ['quiet', 'normal', 'lively'].includes(prefs.chat) ? prefs.chat : 'normal'; $('#chatSel').onchange = () => { prefs.chat = $('#chatSel').value; savePrefs(); };
3348
3367
  // ⚙ → 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() {
3368
+ function leadField(projectChanged = false) {
3350
3369
  const f = $('#leadName'), ed = cleanLead(APP.lead); f.disabled = !!ed; if (document.activeElement !== f || ed) f.value = ed || cleanLead(prefs.leadName);
3370
+ const p = $('#projectLeadName'), key = projectLeadKey(); p.disabled = !!ed || !key; p.placeholder = cleanLead(prefs.leadName) || LEAD_NAME;
3371
+ if (projectChanged || document.activeElement !== p || ed) p.value = ed || (key ? cleanLead(prefs[key]) : '');
3372
+ const ph = $('#projectLeadHint'); ph.textContent = key ? leadProject.label + ' · ' + L('Vide : utiliser le nom par défaut.', 'Empty: use the default name.') : L('Ouvrez un projet pour choisir son nom.', 'Open a project to choose its name.');
3351
3373
  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
3374
  }
3353
3375
  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
3376
  let leadTimer = null;
3355
3377
  $('#leadName').oninput = () => { prefs.leadName = cleanLead($('#leadName').value); if (!prefs.leadName) delete prefs.leadName; savePrefs(); clearTimeout(leadTimer); leadTimer = setTimeout(renameLead, 250); };
3356
3378
  $('#leadName').onchange = () => { clearTimeout(leadTimer); renameLead(); leadField(); };
3379
+ $('#projectLeadName').oninput = () => { const key = projectLeadKey(); if (!key || cleanLead(APP.lead)) return; const name = cleanLead($('#projectLeadName').value); if (name) prefs[key] = name; else delete prefs[key]; savePrefs(); clearTimeout(leadTimer); leadTimer = setTimeout(renameLead, 250); };
3380
+ $('#projectLeadName').onchange = () => { clearTimeout(leadTimer); renameLead(); leadField(); };
3357
3381
  leadField();
3382
+ // ⚙ → All settings → Sub-agent names: your own list, given in its order (empty: the built-in names). "Start from the names in the call" writes in the names the call gave, in the order the agents came:
3383
+ // changing one there renames that agent, since the list is given again in the same order. Agents you named yourself (Keep my agents' own names) and the lead's forks are not in it
3384
+ function listNamed() { return byBorn(Object.values(S.agents)).filter((p) => p.id !== 'main' && p.id !== 'user' && !p.twinN && !(p.own && prefs.ownNames && !isLeadName(p.own))).map((p) => p.name); }
3385
+ function subField() {
3386
+ const f = $('#subNames'); if (document.activeElement !== f) f.value = typeof prefs.subNames === 'string' ? prefs.subNames : ''; f.placeholder = NAMES.slice(0, 5).join(', ') + ', …';
3387
+ $('#subNamesHint').textContent = L('Renommez tous les sous-agents : des prénoms séparés par des virgules, donnés dans l’ordre où les agents arrivent. Vide : les prénoms intégrés.', 'Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.') + ' ' + (prefs.ownNames ? L('Les agents que vous avez nommés vous-même gardent leur nom (réglage ci-dessous).', 'Agents you named yourself keep their names (switch below).') : L('Les agents que vous avez nommés vous-même prennent aussi ces prénoms (réglage ci-dessous).', 'Agents you named yourself take these names too (switch below).'));
3388
+ $('#subFill').style.display = !subNameList().length && listNamed().length ? '' : 'none';
3389
+ }
3390
+ let subTimer = null; const renameSubs = () => renameAll(false);
3391
+ $('#subNames').oninput = () => { const v = $('#subNames').value.slice(0, 2000); if (/[^\s,;]/.test(v)) prefs.subNames = v; else delete prefs.subNames; savePrefs(); clearTimeout(subTimer); subTimer = setTimeout(renameSubs, 400); };
3392
+ $('#subNames').onchange = () => { clearTimeout(subTimer); renameSubs(); subField(); };
3393
+ $('#subFill').onclick = () => { const f = $('#subNames'); f.value = listNamed().join(', '); f.focus(); f.dispatchEvent(new Event('input')); f.setSelectionRange(f.value.length, f.value.length); $('#subFill').style.display = 'none'; };
3394
+ subField();
3358
3395
  $('#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(); };
3359
3396
  // ---- ⚙ → very natural voices (Kokoro): install box and status, polled while installing
3360
3397
  let kokoroTimer = null;
@@ -429,5 +429,15 @@
429
429
  "Lead agent name": "Lederagentens navn",
430
430
  "Set in the editor’s settings (agentStandup.leadName)": "Valgt i editorens indstillinger (agentStandup.leadName)",
431
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."
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.",
433
+ "Name for this project": "Navn til dette projekt",
434
+ "Empty: use the default name.": "Tomt: brug standardnavnet.",
435
+ "Open a project to choose its name.": "Åbn et projekt for at vælge dets navn.",
436
+ "Rename": "Omdøb",
437
+ "Rename the agents": "Omdøb agenterne",
438
+ "Start from the names in the call": "Start med navnene i opkaldet",
439
+ "Sub-agent names": "Navne på underagenter",
440
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Omdøb alle underagenter: navne adskilt af kommaer, givet i den rækkefølge agenterne starter. Tom: de indbyggede navne.",
441
+ "Agents you named yourself keep their names (switch below).": "Agenter, du selv har navngivet, beholder deres navne (kontakten nedenfor).",
442
+ "Agents you named yourself take these names too (switch below).": "Agenter, du selv har navngivet, får også disse navne (kontakten nedenfor)."
433
443
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "Name des Hauptagenten",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "In den Einstellungen des Editors festgelegt (agentStandup.leadName)",
432
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."
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.",
434
+ "Name for this project": "Name für dieses Projekt",
435
+ "Empty: use the default name.": "Leer: Standardnamen verwenden.",
436
+ "Open a project to choose its name.": "Öffne ein Projekt, um seinen Namen zu wählen.",
437
+ "Rename": "Umbenennen",
438
+ "Rename the agents": "Agenten umbenennen",
439
+ "Start from the names in the call": "Mit den Namen im Call beginnen",
440
+ "Sub-agent names": "Namen der Subagenten",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Alle Subagenten umbenennen: Namen durch Kommas getrennt, in der Reihenfolge vergeben, in der die Agenten starten. Leer: die eingebauten Namen.",
442
+ "Agents you named yourself keep their names (switch below).": "Agenten, die du selbst benannt hast, behalten ihre Namen (Schalter unten).",
443
+ "Agents you named yourself take these names too (switch below).": "Agenten, die du selbst benannt hast, bekommen ebenfalls diese Namen (Schalter unten)."
434
444
  }
@@ -35,6 +35,8 @@
35
35
  "agents": "agents",
36
36
  "Agents": "Agents",
37
37
  "Agents list (left)": "Agents list (left)",
38
+ "Agents you named yourself keep their names (switch below).": "Agents you named yourself keep their names (switch below).",
39
+ "Agents you named yourself take these names too (switch below).": "Agents you named yourself take these names too (switch below).",
38
40
  "All": "All",
39
41
  "All projects (most recent)": "All projects (most recent)",
40
42
  "All settings": "All settings",
@@ -109,6 +111,7 @@
109
111
  "Editing ": "Editing ",
110
112
  "Editor": "Editor",
111
113
  "effort": "effort",
114
+ "Empty: use the default name.": "Empty: use the default name.",
112
115
  "Enjoying Agent Standup? A star on GitHub helps other people find it.": "Enjoying Agent Standup? A star on GitHub helps other people find it.",
113
116
  "Entirely optional: the app stays free. It is a way to support the artist and the developer.": "Entirely optional: the app stays free. It is a way to support the artist and the developer.",
114
117
  "EPISODE 1": "EPISODE 1",
@@ -204,6 +207,7 @@
204
207
  "Music volume": "Music volume",
205
208
  "Mute / unmute": "Mute / unmute",
206
209
  "My folder": "My folder",
210
+ "Name for this project": "Name for this project",
207
211
  "Natural voices (installs on demand)": "Natural voices (installs on demand)",
208
212
  "need you": "need you",
209
213
  "needs you": "needs you",
@@ -239,6 +243,7 @@
239
243
  "on sub-agents": "on sub-agents",
240
244
  "one or more": "one or more",
241
245
  "One payment, by card, on a Stripe page. No account.": "One payment, by card, on a Stripe page. No account.",
246
+ "Open a project to choose its name.": "Open a project to choose its name.",
242
247
  "Open folder": "Open folder",
243
248
  "Open mouth (optional)": "Open mouth (optional)",
244
249
  "Open on claude.ai": "Open on claude.ai",
@@ -279,6 +284,9 @@
279
284
  "Remove": "Remove",
280
285
  "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.": "Remove CLAUDE_CODE_SKIP_PROMPT_HISTORY from your shell profile, then start Claude Code again.",
281
286
  "Remove finished agents (2 min)": "Remove finished agents (2 min)",
287
+ "Rename": "Rename",
288
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.",
289
+ "Rename the agents": "Rename the agents",
282
290
  "Reopen": "Reopen",
283
291
  "Repeated failures": "Repeated failures",
284
292
  "repeated work": "repeated work",
@@ -331,7 +339,9 @@
331
339
  "stalled · ": "stalled · ",
332
340
  "stalled: a sub-agent has been silent for a long time": "stalled: a sub-agent has been silent for a long time",
333
341
  "standing by": "standing by",
342
+ "Start from the names in the call": "Start from the names in the call",
334
343
  "Sub-agent": "Sub-agent",
344
+ "Sub-agent names": "Sub-agent names",
335
345
  "Sub-agents": "Sub-agents",
336
346
  "sub-agents active": "sub-agents active",
337
347
  "task": "task",
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "Nombre del agente principal",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "Elegido en los ajustes del editor (agentStandup.leadName)",
432
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."
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.",
434
+ "Name for this project": "Nombre para este proyecto",
435
+ "Empty: use the default name.": "Vacío: usar el nombre predeterminado.",
436
+ "Open a project to choose its name.": "Abre un proyecto para elegir su nombre.",
437
+ "Rename": "Renombrar",
438
+ "Rename the agents": "Renombrar a los agentes",
439
+ "Start from the names in the call": "Partir de los nombres de la llamada",
440
+ "Sub-agent names": "Nombres de los subagentes",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Renombra a todos los subagentes: nombres separados por comas, asignados en el orden en que empiezan los agentes. Vacío: los nombres integrados.",
442
+ "Agents you named yourself keep their names (switch below).": "Los agentes que nombraste tú mantienen su nombre (interruptor de abajo).",
443
+ "Agents you named yourself take these names too (switch below).": "Los agentes que nombraste tú también reciben estos nombres (interruptor de abajo)."
434
444
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "メインエージェントの名前",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "エディターの設定で指定されています(agentStandup.leadName)",
432
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 が手描きしたハロウィンパックのキャラクターです。ほかのメンバーもパックに入っています。"
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 が手描きしたハロウィンパックのキャラクターです。ほかのメンバーもパックに入っています。",
434
+ "Name for this project": "このプロジェクトでの名前",
435
+ "Empty: use the default name.": "空欄の場合はデフォルトの名前を使用します。",
436
+ "Open a project to choose its name.": "プロジェクトを開いて名前を設定してください。",
437
+ "Rename": "名前を変更",
438
+ "Rename the agents": "エージェントの名前を変更",
439
+ "Start from the names in the call": "通話中の名前から始める",
440
+ "Sub-agent names": "サブエージェントの名前",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "すべてのサブエージェントの名前を変更:名前をカンマで区切って入力すると、エージェントが開始した順に割り当てられます。空欄:組み込みの名前。",
442
+ "Agents you named yourself keep their names (switch below).": "自分で名前を付けたエージェントはその名前のままです(下のスイッチ)。",
443
+ "Agents you named yourself take these names too (switch below).": "自分で名前を付けたエージェントにもこれらの名前が付きます(下のスイッチ)。"
434
444
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "메인 에이전트 이름",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "에디터 설정에서 지정됨 (agentStandup.leadName)",
432
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가 손으로 그린 핼러윈 팩에서 왔어요. 나머지 캐스트도 팩에 있어요."
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가 손으로 그린 핼러윈 팩에서 왔어요. 나머지 캐스트도 팩에 있어요.",
434
+ "Name for this project": "이 프로젝트에서 사용할 이름",
435
+ "Empty: use the default name.": "비워 두면 기본 이름을 사용합니다.",
436
+ "Open a project to choose its name.": "프로젝트를 열어 이름을 설정하세요.",
437
+ "Rename": "이름 바꾸기",
438
+ "Rename the agents": "에이전트 이름 바꾸기",
439
+ "Start from the names in the call": "통화 중인 이름에서 시작",
440
+ "Sub-agent names": "하위 에이전트 이름",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "모든 하위 에이전트 이름 바꾸기: 이름을 쉼표로 구분해 입력하면 에이전트가 시작한 순서대로 붙습니다. 비우면 기본 이름을 씁니다.",
442
+ "Agents you named yourself keep their names (switch below).": "직접 이름을 붙인 에이전트는 그 이름을 유지합니다(아래 스위치).",
443
+ "Agents you named yourself take these names too (switch below).": "직접 이름을 붙인 에이전트도 이 이름을 받습니다(아래 스위치)."
434
444
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "Nome do agente principal",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "Definido nas configurações do editor (agentStandup.leadName)",
432
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."
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.",
434
+ "Name for this project": "Nome para este projeto",
435
+ "Empty: use the default name.": "Vazio: usar o nome padrão.",
436
+ "Open a project to choose its name.": "Abra um projeto para escolher seu nome.",
437
+ "Rename": "Renomear",
438
+ "Rename the agents": "Renomear os agentes",
439
+ "Start from the names in the call": "Começar pelos nomes da chamada",
440
+ "Sub-agent names": "Nomes dos subagentes",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Renomeie todos os subagentes: nomes separados por vírgulas, dados na ordem em que os agentes começam. Vazio: os nomes embutidos.",
442
+ "Agents you named yourself keep their names (switch below).": "Os agentes que você mesmo nomeou mantêm seus nomes (chave abaixo).",
443
+ "Agents you named yourself take these names too (switch below).": "Os agentes que você mesmo nomeou também recebem esses nomes (chave abaixo)."
434
444
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "主代理的名字",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "已在编辑器设置中指定(agentStandup.leadName)",
432
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 手绘。其余角色也在礼包里。"
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 手绘。其余角色也在礼包里。",
434
+ "Name for this project": "此项目的名称",
435
+ "Empty: use the default name.": "留空则使用默认名称。",
436
+ "Open a project to choose its name.": "打开项目以设置名称。",
437
+ "Rename": "重命名",
438
+ "Rename the agents": "重命名代理",
439
+ "Start from the names in the call": "从通话中的名字开始",
440
+ "Sub-agent names": "子代理名字",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "重命名所有子代理:用逗号分隔名字,按代理启动的顺序分配。留空:使用内置名字。",
442
+ "Agents you named yourself keep their names (switch below).": "你自己命名的代理保留其名字(见下方开关)。",
443
+ "Agents you named yourself take these names too (switch below).": "你自己命名的代理也会使用这些名字(见下方开关)。"
434
444
  }
@@ -430,5 +430,15 @@
430
430
  "Lead agent name": "主代理的名字",
431
431
  "Set in the editor’s settings (agentStandup.leadName)": "已在編輯器設定中指定(agentStandup.leadName)",
432
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 手繪。其餘角色也在禮包裡。"
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 手繪。其餘角色也在禮包裡。",
434
+ "Name for this project": "此專案的名稱",
435
+ "Empty: use the default name.": "留空則使用預設名稱。",
436
+ "Open a project to choose its name.": "開啟專案以設定名稱。",
437
+ "Rename": "重新命名",
438
+ "Rename the agents": "重新命名代理",
439
+ "Start from the names in the call": "從通話中的名字開始",
440
+ "Sub-agent names": "子代理名字",
441
+ "Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "重新命名所有子代理:以逗號分隔名字,依代理啟動的順序分配。留空:使用內建名字。",
442
+ "Agents you named yourself keep their names (switch below).": "你自己命名的代理保留其名字(見下方開關)。",
443
+ "Agents you named yourself take these names too (switch below).": "你自己命名的代理也會使用這些名字(見下方開關)。"
434
444
  }
package/server.js CHANGED
@@ -15,7 +15,33 @@ const { execFileSync, execFile } = require('child_process');
15
15
 
16
16
  const PORT = process.env.PORT || 4747;
17
17
  // Same place Claude Code writes to: honours CLAUDE_CONFIG_DIR (custom config dirs are common on Linux); AGENT_STANDUP_PROJECTS overrides it.
18
- const ROOT = process.env.AGENT_STANDUP_PROJECTS || path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), 'projects');
18
+ const CLAUDE_HOME = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), ONE_FOLDER = !!process.env.AGENT_STANDUP_PROJECTS, EXTRA_HOMES = String(process.env.AGENT_STANDUP_CLAUDE_DIRS || '');
19
+ const ROOT = process.env.AGENT_STANDUP_PROJECTS || path.join(CLAUDE_HOME, 'projects');
20
+ // Some people keep one Claude Code folder per account, each started with its own CLAUDE_CONFIG_DIR (alias claude-pro="CLAUDE_CONFIG_DIR=~/.claude-pro claude", issue #9): the app is started without it and would read neither.
21
+ // So every such folder is read too: ~/.claude, each ~/.claude-<name> (or .claude_<name>, .claude.<name>) that holds a projects folder, and the ones AGENT_STANDUP_CLAUDE_DIRS names ("off": none of them). The one of this process comes first.
22
+ // A ~/.claude-<name> is an account only if Claude Code was started with it: it then keeps its own .claude.json there (.config.json for one an old Claude Code made, .claude-custom-oauth.json…; the default one is in the home folder, so a copy of ~/.claude has none), and its name does not end like a backup's (.bak, -old, " copy 2", -20251001…).
23
+ // A session id is unique, so a session found in two folders (a copy) is taken from the one whose last record is the latest (resumed there), then the larger, then the first: a copy made with cp -r has fresh file dates, which say nothing. With AGENT_STANDUP_PROJECTS (--projects, the tests) that one folder alone is read, as before.
24
+ const sizeOf = (f) => { try { return fs.statSync(f).size; } catch { return -1; } }; // -1 for a file that is gone: an empty one still counts
25
+ const isFile = (f) => { try { return fs.statSync(f).isFile(); } catch { return false; } };
26
+ const stampMemo = new Map();
27
+ function lastStamp(f) { // the time of a transcript's last record, read from its end (-1: no file); a copy keeps it, where its file date is the copy's. None in the last 64 KB (a huge last record): the file's date
28
+ let st; try { st = fs.statSync(f); } catch { return -1; } const m = stampMemo.get(f); if (m && m.size === st.size && m.mt === st.mtimeMs) return m.t;
29
+ let t = st.mtimeMs; try { const fd = fs.openSync(f, 'r'); try { const n = Math.min(st.size, 65536), buf = Buffer.alloc(n); fs.readSync(fd, buf, 0, n, st.size - n); const all = buf.toString('utf8').match(/"timestamp":\s*"[^"]{10,40}"/g); if (all) t = Date.parse(all[all.length - 1].split('"')[3]) || t; } finally { fs.closeSync(fd); } } catch {}
30
+ stampMemo.delete(f); if (stampMemo.size >= 20000) stampMemo.delete(stampMemo.keys().next().value); stampMemo.set(f, { size: st.size, mt: st.mtimeMs, t }); return t; /* the oldest out, one at a time */
31
+ }
32
+ const fuller = (a, b) => { const sa = sizeOf(a), sb = sizeOf(b); if (sa === sb) return false; const ta = lastStamp(a), tb = lastStamp(b); return ta !== tb ? ta > tb : sa > sb; }; // of two copies of one session, a the one to read: written later, or holding more. The same size: a copy left as it was, b (the first) without reading either
33
+ let homesMemo = { at: 0, list: [] };
34
+ function claudeHomes() { // [CLAUDE_HOME, the other folders that hold sessions]; looked for again every 30 s, for an account added while the app runs
35
+ if (ONE_FOLDER || /^(0|off|no|false)$/i.test(EXTRA_HOMES.trim())) return [CLAUDE_HOME]; // AGENT_STANDUP_CLAUDE_DIRS=off: that one folder (the command line's --config)
36
+ const now = Date.now(); if (now - homesMemo.at < 30e3) return homesMemo.list;
37
+ const home = os.homedir(), real = (d) => { try { return fs.statSync(d).isDirectory() ? fs.realpathSync(d) : ''; } catch { return ''; } };
38
+ let names = []; try { names = fs.readdirSync(home).filter((n) => /^\.claude[-_.][^\\/]+$/.test(n) && !/([-_.~ ](bak|bkp|backup|old|orig|copy|save|saved|prev|archive|snapshot)[\dT_.-]*| \(copy( \d+)?\)| \d+|[-_.]\d{6,}[\dT_.-]*|~)$/i.test(n) && ['.claude.json', '.config.json', '.claude-custom-oauth.json'].some((j) => isFile(path.join(home, n, j)))).sort(); } catch {}
39
+ const extra = EXTRA_HOMES.split(path.delimiter).map((d) => d.trim()).filter(Boolean).map((d) => path.resolve(d.replace(/^~(?=$|[\\/])/, home)));
40
+ const list = [CLAUDE_HOME], seen = new Set([real(path.join(CLAUDE_HOME, 'projects')) || path.join(CLAUDE_HOME, 'projects')]);
41
+ for (const d of [path.join(home, '.claude'), ...names.map((n) => path.join(home, n)), ...extra]) { const r = real(path.join(d, 'projects')); if (r && !seen.has(r)) { seen.add(r); list.push(d); } }
42
+ homesMemo = { at: now, list }; return list;
43
+ }
44
+ const projRoots = () => { const h = claudeHomes(); return h.length < 2 ? [ROOT] : h.map((d) => path.join(d, 'projects')); }; // one folder, as most people have: exactly the one read before
19
45
  const PUBLIC = path.join(__dirname, 'public');
20
46
  // Cowork, a tab of the Claude desktop app, keeps each of its sessions in the app's own folder, in the format of Claude Code: <folder>/<account>/<organisation>/<session>/.claude/projects/<project>/<id>.jsonl.
21
47
  // They are listed under one made-up project, as the sessions of the other tools are, and read like any Claude Code session from there on.
@@ -57,12 +83,31 @@ function coworkTitle(proj, id) { // the name the desktop app gave the session,
57
83
  let title = ''; try { const j = JSON.parse(fs.readFileSync(f, 'utf8')); if (typeof j.title === 'string') title = j.title.trim().slice(0, 200); } catch {}
58
84
  coworkNotes.set(f, { sig, title }); return title;
59
85
  }
60
- const projDir = (proj, id) => (proj === COWORK && coworkMap().get(id)) || path.join(ROOT, proj); // the folder that holds <id>.jsonl and the sub-agents of that session
61
- const projects = () => { let names = []; try { names = fs.readdirSync(ROOT); } catch {} return coworkMap().size ? names.concat(COWORK) : names; };
86
+ const dirOf = new Map(); // with several folders: proj/id → the project folder its transcript was found in (a transcript stays where it was written)
87
+ function projDir(proj, id) { // the folder that holds <id>.jsonl and the sub-agents of that session
88
+ const cw = proj === COWORK && coworkMap().get(id); if (cw) return cw;
89
+ const roots = projRoots(); if (roots.length < 2) return path.join(roots[0], proj);
90
+ const k = proj + '/' + id, known = dirOf.get(k); if (known) return known;
91
+ let best = ''; for (const r of roots) { const d = path.join(r, proj); if (sizeOf(path.join(d, id + '.jsonl')) >= 0 && (!best || fuller(path.join(d, id + '.jsonl'), path.join(best, id + '.jsonl')))) best = d; } // in two folders (one copied from the other, the session resumed in it): the one written later (fuller)
92
+ if (best) { if (dirOf.size > 5000) dirOf.clear(); dirOf.set(k, best); return best; }
93
+ return path.join(roots[0], proj);
94
+ }
95
+ const projects = () => { const roots = projRoots(); let names = []; for (const r of roots) try { names = names.concat(fs.readdirSync(r)); } catch {} if (roots.length > 1) names = [...new Set(names)]; return coworkMap().size ? names.concat(COWORK) : names; };
62
96
  function transcripts(proj) { // the sessions of a project: { id, file }
63
97
  const cw = proj === COWORK ? coworkMap() : null; if (cw && cw.size) return [...cw].map(([id, dir]) => ({ id, file: path.join(dir, id + '.jsonl') }));
64
- const dir = path.join(ROOT, proj); let files; try { files = fs.readdirSync(dir); } catch { return []; }
65
- return files.filter((f) => f.endsWith('.jsonl')).map((f) => ({ id: f.slice(0, -6), file: path.join(dir, f) }));
98
+ const roots = projRoots(), out = [], seen = new Map();
99
+ for (const r of roots) {
100
+ const dir = path.join(r, proj); let files; try { files = fs.readdirSync(dir); } catch { continue; }
101
+ for (const f of files) {
102
+ if (!f.endsWith('.jsonl')) continue; const id = f.slice(0, -6), row = { id, file: path.join(dir, f) };
103
+ if (roots.length > 1) { // a session in two folders is listed once, from the one written later (fuller, see projDir), which dirOf keeps up to date at each look
104
+ const was = seen.get(id); if (was && !fuller(row.file, was.file)) continue;
105
+ if (dirOf.size > 5000) dirOf.clear(); dirOf.set(proj + '/' + id, dir); if (was) { was.file = row.file; continue; } seen.set(id, row);
106
+ }
107
+ out.push(row);
108
+ }
109
+ }
110
+ return out;
66
111
  }
67
112
 
68
113
  const blocks = (rec) => {
@@ -531,7 +576,7 @@ const PR_URL = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/pull\/\d+$/; // noth
531
576
  const askOf = (b) => { const q = b.name === 'AskUserQuestion' && b.input && Array.isArray(b.input.questions) && b.input.questions[0] && b.input.questions[0].question; return typeof q === 'string' ? clip(q.trim(), 200) : ''; }; // the question a session stopped on, for its card
532
577
  const callOf = (b) => { const i = b.input || {}, v = b.name === 'Bash' ? i.command : /^(Edit|Write|MultiEdit|NotebookEdit)$/.test(b.name) ? path.basename(String(i.file_path || i.notebook_path || '')) : b.name === 'WebFetch' ? i.url : ''; return typeof v === 'string' && v.trim() ? b.name + '(' + clip(v.replace(/\s+/g, ' ').trim(), 160) + ')' : ''; }; // what a call waiting for your go-ahead would do, written the way Claude Code shows it: Bash(npm test)
533
578
  const PLAN_FILE = /[\\/]\.claude[\\/]plans[\\/][^\\/]+\.md$/, PLAN_DIR = process.env.CLAUDE_CONFIG_DIR ? path.join(process.env.CLAUDE_CONFIG_DIR, 'plans') + path.sep : '';
534
- const planFile = (f) => PLAN_FILE.test(f) || (!!PLAN_DIR && f.startsWith(PLAN_DIR) && f.endsWith('.md')); // also where a CLAUDE_CONFIG_DIR set elsewhere keeps them
579
+ const planFile = (f) => PLAN_FILE.test(f) || (!!PLAN_DIR && f.startsWith(PLAN_DIR) && f.endsWith('.md')) || (f.endsWith('.md') && claudeHomes().slice(1).some((h) => f.startsWith(path.join(h, 'plans') + path.sep))); // also where a CLAUDE_CONFIG_DIR set elsewhere keeps them, and the other folders read (claudeHomes)
535
580
  const planDoc = (f) => { try { const st = fs.statSync(f); if (!st.isFile() || st.size > 262144) return ''; return clip(fs.readFileSync(f, 'utf8').trim(), 4000); } catch { return ''; } }; // the whole plan, for the shared screen
536
581
  const planText = (f) => { try { const st = fs.statSync(f); if (!st.isFile() || st.size > 262144) return ''; return clip(fs.readFileSync(f, 'utf8').trim(), 1200); } catch { return ''; } };
537
582
  const menuOf = (b) => { // what a menu waiting for you shows, from the call it waits on, word for word: the questions and their options in their order (the terminal numbers them the same way), the command, the file, the plan
@@ -545,31 +590,35 @@ const menuOf = (b) => { // what a menu waiting for you shows, from the call it
545
590
  };
546
591
  // Claude Code also keeps <config>/sessions/<pid>.json for each open session: its status (busy, idle, or waiting while a menu waits for your answer: a permission, a question) and since when.
547
592
  // It is the only sign of a Bash approval: in the transcript, a command waiting for your go-ahead looks just like one that runs. A file whose process has ended is left out.
548
- const CC_SESSIONS = process.env.AGENT_STANDUP_CC_SESSIONS || path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), 'sessions');
593
+ const CC_SESSIONS = process.env.AGENT_STANDUP_CC_SESSIONS || path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), 'sessions'), CC_SESSIONS_SET = !!process.env.AGENT_STANDUP_CC_SESSIONS;
594
+ const statusDirs = () => { const h = CC_SESSIONS_SET ? [] : claudeHomes(); return h.length < 2 ? [CC_SESSIONS] : h.map((d) => path.join(d, 'sessions')); }; // each folder read keeps the status of its own sessions
549
595
  const alive = (pid) => { try { process.kill(pid, 0); return true; } catch (e) { return e.code === 'EPERM'; } };
550
596
  function liveStatus() { // session id → { status, since, pid, ep (where it runs: claude-vscode, cli, claude-desktop, sdk-cli…), and for missingTranscripts: raw (the status as written), cwd, kind, startedAt, version, updatedAt (when the file was last written: a /clear moves it, and the id, but not statusUpdatedAt) }
551
- const out = new Map(); let names = []; try { names = fs.readdirSync(CC_SESSIONS); } catch { return out; }
552
- for (const n of names) { if (!/^\d+\.json$/.test(n)) continue; try { const s = JSON.parse(fs.readFileSync(path.join(CC_SESSIONS, n), 'utf8')); if (s && typeof s.sessionId === 'string' && /^(busy|idle|waiting)$/.test(s.status) && Number.isInteger(s.pid) && s.pid > 0 && alive(s.pid)) out.set(s.sessionId, { status: s.status !== 'waiting' ? s.status : s.waitingFor === 'dialog open' ? 'idle' : s.entrypoint === 'sdk-cli' ? 'busy' : s.status, since: Number(s.statusUpdatedAt) || 0, pid: s.pid, ep: String(s.entrypoint || ''), raw: s.status, cwd: typeof s.cwd === 'string' ? s.cwd : '', kind: typeof s.kind === 'string' ? s.kind : '', startedAt: Number(s.startedAt) || 0, version: typeof s.version === 'string' ? s.version : '', updatedAt: Number(s.updatedAt) || 0 }); } catch {} } /* a dialog you opened yourself (/model, /config, /mcp…) also says waiting: it is not a question for you. Nor is a menu of a session started with claude -p (entrypoint sdk-cli): its question goes to the program that started it. An Agent SDK host (sdk-ts, sdk-py: Zed, a home-made app) may show its menus to a person, so those are kept */
597
+ const out = new Map(), later = (a, b) => Math.max(a.updatedAt, a.since) > Math.max(b.updatedAt, b.since);
598
+ for (const [i, dir] of statusDirs().entries()) { const into = i ? new Map() : out; let names = []; try { names = fs.readdirSync(dir); } catch { continue; }
599
+ for (const n of names) { if (!/^\d+\.json$/.test(n)) continue; try { const s = JSON.parse(fs.readFileSync(path.join(dir, n), 'utf8')); if (s && typeof s.sessionId === 'string' && /^(busy|idle|waiting)$/.test(s.status) && Number.isInteger(s.pid) && s.pid > 0 && alive(s.pid)) into.set(s.sessionId, { status: s.status !== 'waiting' ? s.status : s.waitingFor === 'dialog open' ? 'idle' : s.entrypoint === 'sdk-cli' ? 'busy' : s.status, since: Number(s.statusUpdatedAt) || 0, pid: s.pid, ep: String(s.entrypoint || ''), raw: s.status, cwd: typeof s.cwd === 'string' ? s.cwd : '', kind: typeof s.kind === 'string' ? s.kind : '', startedAt: Number(s.startedAt) || 0, version: typeof s.version === 'string' ? s.version : '', updatedAt: Number(s.updatedAt) || 0 }); } catch {} } /* a dialog you opened yourself (/model, /config, /mcp…) also says waiting: it is not a question for you. Nor is a menu of a session started with claude -p (entrypoint sdk-cli): its question goes to the program that started it. An Agent SDK host (sdk-ts, sdk-py: Zed, a home-made app) may show its menus to a person, so those are kept */
600
+ if (i) { const byPid = new Map([...out].map(([k, v]) => [v.pid, k])); for (const [k, v] of into) { const o = out.get(k), pk = byPid.get(v.pid), p = pk != null && pk !== k ? out.get(pk) : null; if ((o && !later(v, o)) || (p && !later(v, p))) continue; if (p) out.delete(pk); out.set(k, v); byPid.set(v.pid, k); } } // a folder copied while a session ran keeps its status frozen: of two that name the same session, or the same process (its id changed since with /clear), the one written last
601
+ }
553
602
  return out;
554
603
  }
555
604
  // A Claude Code session that is open and has worked, yet whose transcript is nowhere in the projects folder read here. The call cannot show it; the page says so, and why it may be (issue #9). Read from the status files alone, nothing sent.
556
605
  // Only one cause is visible this way (Claude Code 2.1.304, tried): CLAUDE_CODE_SKIP_PROMPT_HISTORY=1 writes the status file (interactive, idle/busy) and shows "Transcript saving is off", but no transcript.
557
- // An inherited CLAUDE_CODE_CHILD_SESSION=1 writes neither, and another CLAUDE_CONFIG_DIR puts the status file in that other folder: neither leaves anything here. What is listed may also be a cause not known yet.
606
+ // An inherited CLAUDE_CODE_CHILD_SESSION=1 writes neither, and another CLAUDE_CONFIG_DIR puts the status file in that other folder: neither leaves anything here (that folder is read too when it is one of claudeHomes). What is listed may also be a cause not known yet.
558
607
  // Listed only once this server has seen the session busy, under its current id, for 5 s: a session just opened, one where you opened /model or /config, and one right after /clear
559
608
  // (a new id and updatedAt, while status and statusUpdatedAt are still those of the id before) have written no transcript yet, and need none.
560
609
  let missingMemo = { at: 0, list: [] }; const transcriptSeen = new Set(), busySeen = new Map(); // transcriptSeen: ids found once are not looked for again, a transcript stays where it was written · busySeen: id → when it was first seen busy (at most 500)
561
610
  function missingTranscripts() { // [{ id, cwd, name, version, ep, since }]: one look every 10 s at most
562
611
  if (process.env.AGENT_STANDUP_PROJECTS && !process.env.AGENT_STANDUP_CC_SESSIONS) return []; // sessions read from another folder than the one these status files belong to: every live session would look as if it wrote nothing
563
612
  const now = Date.now(); if (now - missingMemo.at < 10e3) return missingMemo.list;
564
- const list = []; let dirs = null;
613
+ const list = [], roots = projRoots(); let dirs = null;
565
614
  for (const [id, w] of liveStatus()) {
566
615
  if ((w.kind && w.kind !== 'interactive') || /^sdk-(cli|ts|py)$/.test(w.ep) || transcriptSeen.has(id) || !/^[\w-]+$/.test(id)) continue; // a session a program runs keeps no transcript a person would look for
567
616
  if (w.raw === 'busy' && w.since >= w.updatedAt && !busySeen.has(id)) { if (busySeen.size >= 500) busySeen.delete(busySeen.keys().next().value); busySeen.set(id, Math.min(now, w.since || now)); } // a status written for this id (an older Claude Code writes no updatedAt: 0)
568
617
  if (!(now - (busySeen.get(id) || now) >= 5e3)) continue; // Claude Code writes the transcript with the first message: never busy yet, or only just
569
618
  const name = id + '.jsonl', key = w.cwd.replace(/[^a-zA-Z0-9]/g, '-'); // Claude Code's project folder naming: the folder of its cwd, looked at first
570
- if ((key && mtimeOf(path.join(ROOT, key, name))) || coworkMap().has(id)) { transcriptSeen.add(id); continue; }
571
- if (!dirs) { dirs = []; try { dirs = fs.readdirSync(ROOT); } catch {} } // a long path is shortened in its folder name: every folder, then
572
- if (dirs.some((d) => mtimeOf(path.join(ROOT, d, name)))) { transcriptSeen.add(id); continue; }
619
+ if ((key && roots.some((r) => mtimeOf(path.join(r, key, name)))) || coworkMap().has(id)) { transcriptSeen.add(id); continue; }
620
+ if (!dirs) { dirs = []; for (const r of roots) try { dirs = dirs.concat(fs.readdirSync(r).map((d) => path.join(r, d))); } catch {} } // a long path is shortened in its folder name: every folder, then
621
+ if (dirs.some((d) => mtimeOf(path.join(d, name)))) { transcriptSeen.add(id); continue; }
573
622
  list.push({ id, cwd: w.cwd, name: w.cwd ? path.basename(w.cwd) : '', version: w.version, ep: w.ep, since: w.startedAt || w.since });
574
623
  }
575
624
  missingMemo = { at: now, list }; return list;
@@ -905,7 +954,7 @@ const projCwds = new Map(), dirKey = (d) => String(d || '').replace(/[^a-zA-Z0-9
905
954
  const foldKey = (k) => (process.platform === 'win32' ? String(k).toLowerCase() : k); // Windows: a folder is the same whatever its case (the editor sends C:, Claude Code may have written c:)
906
955
  function projCwd(proj) {
907
956
  if (projCwds.has(proj)) return projCwds.get(proj);
908
- let cwd = ''; for (const { id } of transcripts(proj).slice(0, 3)) { try { const m = /"cwd":"((?:[^"\\]|\\.)*)"/.exec(readHead(path.join(projDir(proj, id), id + '.jsonl'), 64 * 1024)); if (m) { cwd = JSON.parse('"' + m[1] + '"'); break; } } catch {} }
957
+ let cwd = ''; for (const { id } of transcripts(proj).slice(0, 3)) { try { const m = /"cwd":"((?:[^"\\]|\\.)*)"/.exec(readHead(path.join(projDir(proj, id), id + '.jsonl'), 64 * 1024)); if (m) { const c = JSON.parse('"' + m[1] + '"'); if (foldKey(dirKey(c)) === foldKey(proj)) { cwd = c; break; } } } catch {} } /* a session that started elsewhere (a scratch folder) does not hide the others */
909
958
  const sure = !!cwd && foldKey(dirKey(cwd)) === foldKey(proj); if (sure) projCwds.set(proj, cwd); return sure ? cwd : ''; // kept once it is sure: the folder whose name is the project's
910
959
  }
911
960
  const inFolder = (proj, key) => { const p = foldKey(proj), k = foldKey(key); if (p === k) return true; if (!p.startsWith(k + '-')) return false; const cwd = projCwd(proj); if (!cwd) return true; for (let d = cwd; d;) { if (foldKey(dirKey(d)) === k) return true; const up = path.dirname(d); if (up === d) return false; d = up; } return false; };
@@ -967,6 +1016,7 @@ function readNew(file, agent, journal, record = parseRecord) {
967
1016
  return st;
968
1017
  }
969
1018
  function parseRecord(st, r) {
1019
+ if (!st.cwd && typeof r.cwd === 'string' && r.cwd) st.cwd = r.cwd; // the folder the session started in; later cd records do not change its project
970
1020
  const agent = st.agent, ts = Date.parse(r.timestamp) || 0, push = (e) => { e.k = agent + ':' + st.raw.length; st.raw.push(e); return e; }; // k: the event's key in the live feed = whose file + its rank in it. A file is only ever appended to, so the rank never changes (and when it is not, the whole file is read again under a new number, see readNew)
971
1021
  if (ts > (st.lastTs || 0)) st.lastTs = ts;
972
1022
  if (st.journal) { if (r.type === 'result' && r.agentId) push({ ts: 0, agent, kind: 'wfdone', child: String(r.agentId).replace(/[^\w.-]/g, '_') }); return; } // a workflow's journal: one line when an agent starts, one when it hands its result back (no time on them)
@@ -1046,6 +1096,19 @@ function readMeta(f) {
1046
1096
  try { const mt = fs.statSync(f).mtimeMs, c = metaCache.get(f); if (c && c.mtime === mt) return c.value; const v = JSON.parse(fs.readFileSync(f, 'utf8')); if (metaCache.size > 3000) metaCache.clear(); metaCache.set(f, { mtime: mt, value: v }); return v; } catch { return {}; }
1047
1097
  }
1048
1098
 
1099
+ // The actual project behind a session, not the provider bucket (_codex, _vibe).
1100
+ // Keep the full folder: dashed project keys cannot distinguish app/old from app-old.
1101
+ // A Claude Code session is filed under its project's folder: the folder whose name that is comes first (projCwd), so a session that started in a scratch folder, an old transcript without cwd and a live one whose first cwd is not written yet all share their project's name.
1102
+ const leadProjects = new Map(), bareDir = (d) => { const n = path.normalize(d), root = path.parse(n).root; return n.length > root.length ? n.replace(/[\\/]+$/, '') : n; }; // /work/app/ and /work/app are one folder
1103
+ function leadProject(proj, id, recordedCwd) {
1104
+ const memo = proj + '/' + id; if (leadProjects.has(memo)) return leadProjects.get(memo);
1105
+ const sx = sourceOf(proj), cwd = sx ? guard(() => sx.cwd(id), '') : projCwd(proj) || recordedCwd;
1106
+ // Cowork's folders live in separate VMs: identical cwd strings there need not be one project.
1107
+ if (proj === COWORK) return { key: 'cowork:' + projDir(proj, id), label: cwd || coworkTitle(proj, id) || id };
1108
+ if (cwd) { const v = { key: 'cwd:' + foldKey(bareDir(cwd)), label: cwd }; if (leadProjects.size > 3000) leadProjects.clear(); leadProjects.set(memo, v); return v; } // kept once a folder is known: it no longer changes
1109
+ return sx ? null : { key: 'claude:' + proj, label: proj }; // older Claude transcripts without cwd still have a project folder; an unknown provider folder has no override
1110
+ }
1111
+
1049
1112
  function buildTimeline(proj, id, files = []) {
1050
1113
  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
1114
  if (!fs.existsSync(mainFile)) throw new Error('session not found');
@@ -1062,8 +1125,9 @@ function buildTimeline(proj, id, files = []) {
1062
1125
  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]); }
1063
1126
  const childByTool = {}; // Agent tool_use id → the sub-agent it created, so we know who ordered whom
1064
1127
  for (const a of Object.values(agents)) if (a.toolUseId) childByTool[a.toolUseId] = a.id;
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; }
1128
+ const called = {}, born = {}; for (const st of states) if (st) { const b0 = (st.prompt && st.prompt.ts) || (st.raw.length && st.raw[0].ts); if (b0) born[st.agent] = b0; for (const e of st.raw) if (e.kind === 'agentcall' && e.nm && childByTool[e.toolId]) called[childByTool[e.toolId]] = e.nm; }
1066
1129
  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
1130
+ if (born[a.id] || a.startedAt > 0) a.born = born[a.id] || a.startedAt; // when it started (its prompt, its first line, or what Codex recorded): the page names the agents in that order (byBorn in index.html), so that a reload gives each the same name
1067
1131
  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; }
1068
1132
  }
1069
1133
  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
@@ -1114,7 +1178,7 @@ function buildTimeline(proj, id, files = []) {
1114
1178
  const real = merged.find((e) => e.kind !== 'usage' && e.kind !== 'finish' && e.kind !== 'compact' && e.kind !== 'tasks'), first = real ? real.ts : 0, last = merged.length ? merged[merged.length - 1].ts : 0; // time zero = the first thing said or done
1115
1179
  const marks = !sx && states[0] && (states[0].stops || !states[0].lead) ? { marks: 1 } : {}; // a Claude Code session whose turns end with a mark, also before the lead has written anything: a session that has not closed a turn yet is not one without marks, and its lead is not "done" each time it thinks for a while
1116
1180
  const ms = states.find((x) => x && x.agent === 'main'), cost = ms && ms.cost ? { usd: Math.round(ms.cost.usd * 1e4) / 1e4, final: !merged.some((e) => e.kind === 'usage' && e.ts > ms.cost.at) } : null; // final: nothing was spent after Claude Code counted it (else it is a floor)
1117
- return { id, proj, agents: Object.values(agents), events: merged.map((e) => ({ ...e, t: Math.max(0, e.ts - first) })), durationMs: last - first, recentUntil, ...marks, ...(cost ? { cost } : {}) };
1181
+ return { id, proj, project: leadProject(proj, id, ms && ms.cwd), agents: Object.values(agents), events: merged.map((e) => ({ ...e, t: Math.max(0, e.ts - first) })), durationMs: last - first, recentUntil, ...marks, ...(cost ? { cost } : {}) };
1118
1182
  }
1119
1183
 
1120
1184
  // Ask the local `claude` CLI (uses the user's existing login) to map a JSON array of strings to another array. Cached.
@@ -1537,10 +1601,10 @@ function start(port = PORT) {
1537
1601
  res.writeHead(200, { 'content-type': 'application/json', ...(gz ? { 'content-encoding': 'gzip' } : {}), vary: 'accept-encoding' });
1538
1602
  return res.end(gz ? entry.gz : entry.json);
1539
1603
  }
1540
- if (ep == null) return json({ id: tl.id, agents: tl.agents, total: tl.events.length, events: tl.events.slice(+after) }); // a page loaded before 1.25.7 still asks by position
1604
+ if (ep == null) return json({ id: tl.id, project: tl.project, agents: tl.agents, total: tl.events.length, events: tl.events.slice(+after) }); // a page loaded before 1.25.7 still asks by position
1541
1605
  const a = +after; if (ep !== tl.ep || !(a >= 0 && a <= tl.seq)) return json({ resync: true }); // not the feed this page was following (restart, session dropped from memory, transcript rewritten): it loads the session again
1542
- if (a === tl.seq) { if (!entry.idle) entry.idle = JSON.stringify({ id: tl.id, agents: tl.agents, ep: tl.ep, seq: tl.seq, marks: tl.marks, ...(tl.cost ? { cost: tl.cost } : {}), events: [] }); res.writeHead(200, { 'content-type': 'application/json' }); return res.end(entry.idle); } // nothing new, which is the answer to nearly every poll: written once
1543
- return json({ id: tl.id, agents: tl.agents, ep: tl.ep, seq: tl.seq, marks: tl.marks, ...(tl.cost ? { cost: tl.cost } : {}), events: feedSince(entry, a) }); // new events and changed ones alike, whole, under the key they always had
1606
+ if (a === tl.seq) { if (!entry.idle) entry.idle = JSON.stringify({ id: tl.id, project: tl.project, agents: tl.agents, ep: tl.ep, seq: tl.seq, marks: tl.marks, ...(tl.cost ? { cost: tl.cost } : {}), events: [] }); res.writeHead(200, { 'content-type': 'application/json' }); return res.end(entry.idle); } // nothing new, which is the answer to nearly every poll: written once
1607
+ return json({ id: tl.id, project: tl.project, agents: tl.agents, ep: tl.ep, seq: tl.seq, marks: tl.marks, ...(tl.cost ? { cost: tl.cost } : {}), events: feedSince(entry, a) }); // new events and changed ones alike, whole, under the key they always had
1544
1608
  }
1545
1609
  const pk = url.pathname.match(/^\/packs\/([a-z]+)\/(.*)$/);
1546
1610
  if (url.pathname.startsWith('/characters/') || (pk && packDir(pk[1]))) { // only plain image files of the characters folder (or of a built-in pack), by exact name
@@ -1558,7 +1622,7 @@ function start(port = PORT) {
1558
1622
  } catch (e) { logError(req.method + ' ' + url.pathname, e); if (res.headersSent) return res.destroy(); json({ error: String(e.message || e) }, 500); }
1559
1623
  }).listen(port, '127.0.0.1', function () { console.log(`Agent Standup → http://localhost:${this.address().port}`); });
1560
1624
  }
1561
- module.exports = { answerIn, missingTranscripts, noteEditor, forgetEditor, _winArg: winArg, start, currentSession, shutdown, findClaude, bundledClaude, boardRows, sessionRows: listSessions, charactersDir, listCharacters, packsDir, installPack, logError, updateInfo, _reveal: reveal, _scrub: { tidy, homeRe }, _artifact: { page: artifactPage, csp: artifactCsp } };
1625
+ module.exports = { answerIn, missingTranscripts, noteEditor, forgetEditor, _winArg: winArg, start, currentSession, shutdown, findClaude, bundledClaude, boardRows, transcriptFile: (proj, id) => path.join(projDir(proj, id), id + '.jsonl'), sessionRows: listSessions, charactersDir, listCharacters, packsDir, installPack, logError, updateInfo, _reveal: reveal, _scrub: { tidy, homeRe }, _artifact: { page: artifactPage, csp: artifactCsp } };
1562
1626
  if (require.main === module && process.env.AGENT_STANDUP_CHILD === '1' && typeof process.send === 'function') { // started by the VS Code extension in a process of its own (see extension.js): reading a large session no longer stops the editor's extensions. Asked for by name: pm2 and others give any app a channel too
1563
1627
  const srv = start(+process.env.PORT || 0), tell = (m) => { try { process.send(m); } catch {} };
1564
1628
  srv.on('listening', () => tell({ port: srv.address().port })).on('error', (e) => { tell({ error: e.code || String(e) }); process.exit(1); });