@double_geste/agent-standup 1.41.0 → 1.41.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@double_geste/agent-standup",
3
- "version": "1.41.0",
3
+ "version": "1.41.2",
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
@@ -504,10 +504,10 @@ const Q = new URLSearchParams(location.search);
504
504
  const EMBED = Q.get('embed') === '1' || window.parent !== window;
505
505
  const APP = window.AS_APP && typeof window.AS_APP === 'object' && typeof window.AS_APP.rate === 'string' ? window.AS_APP : { kind: '', rate: 'https://github.com/Atoll92/agent-standup' }; // where this page runs (appKind in server.js)
506
506
 
507
- let prefs = { lang: 'en', voice: true, roster: true, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'kokoro', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true, visits: true, askCard: false, followTab: true, files: true, callTr: true, voiceVol: 1 };
507
+ let prefs = { lang: 'en', voice: true, roster: false, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'kokoro', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true, visits: true, askCard: false, followTab: true, files: true, callTr: true, voiceVol: 1 };
508
508
  const PREF_DEFAULTS = { ...prefs }; // for ⚙ → All settings → Reset to defaults
509
509
  { let loc = {}; try { loc = JSON.parse(localStorage.getItem('cc.prefs') || '{}') || {}; } catch {} // the settings file (shared by every window) and this origin's copy: the more recent one wins
510
- const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; Object.assign(prefs, (sv._t || 0) > (loc._t || 0) ? sv : loc);
510
+ const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; const won = (sv._t || 0) > (loc._t || 0) ? sv : loc; Object.assign(prefs, won); if (Object.keys(won).length && !('roster' in won)) prefs.roster = true; /* settings saved before the list could be turned off: it stays as they had it, on */
511
511
  if ((+sv.shareUsageT || 0) > (+prefs.shareUsageT || 0)) { prefs.shareUsage = sv.shareUsage; prefs.shareUsageT = sv.shareUsageT; prefs.usageAsked = sv.usageAsked; } } // the usage answer: the newest one, as the server keeps it (this origin's copy may hold an older one)
512
512
  const HAD_PREFS = !!prefs._t; // someone who used the app before this page: shown once where the settings went
513
513
  if (!HAD_PREFS) prefs.menuTipSeen = true; // a first visit: the menu was never anywhere else for this person, so the tip is not shown on the next visits either
@@ -2353,20 +2353,20 @@ function rateTip() {
2353
2353
  $('#rateYes').onclick = rateGo; $('#rateNo').onclick = rateEnd;
2354
2354
  $('#rateLater').onclick = () => { if (prefs.rateLater) return rateEnd(); prefs.rateLater = new Date(Date.parse(utcDay()) + 7 * 864e5).toISOString().slice(0, 10); savePrefs(); $('#rateTip').style.display = 'none'; };
2355
2355
  document.addEventListener('visibilitychange', rateDay); setInterval(rateDay, 3600e3); // the desktop window can stay open for days
2356
- // ☕ Once, at the end of a long run the call followed live (the lead at work for 10 minutes, or 3 agents at work in that turn), from the second day the call has been in view.
2356
+ // ☕ Once, at the end of a run the call followed live (the lead at work for 3 minutes, or 3 agents at work in that turn, and the turn closed by its end mark), from the second day the call has been in view.
2357
2357
  // Never twice ("No thanks", the coffee or nothing at all end it), never the day the star is asked, never in a demo. The days are kept in the settings file; nothing is sent.
2358
2358
  function coffeeDay() { if (document.hidden || !SUPPORT.url || prefs.coffeeAsked || prefs.useFirst) return; prefs.useFirst = utcDay(); savePrefs(); } /* one write, ever: the first day the call is in view (a window left open overnight must not write its old settings over newer ones) */
2359
2359
  function coffeeAsk(busyAt) {
2360
- if (!SUPPORT.url || prefs.coffeeAsked || Q.get('demo') || firstDay() || askedToday('coffee') || !prefs.useFirst || prefs.useFirst >= utcDay() || document.hidden) return;
2360
+ if (!SUPPORT.url || prefs.coffeeAsked || Q.get('demo') || firstDay() || askedToday('coffee') || !prefs.useFirst || prefs.useFirst >= utcDay() || document.hidden || !S.turnOver) return; /* the mark that closes the lead's turn: a long silence mid-turn also shows the lead done */
2361
2361
  const now = Date.now(), team = Object.keys(S.agents).filter((id) => id !== 'main' && id !== 'user' && S.lastAct[id] >= busyAt).length;
2362
- if (!(now - busyAt >= 10 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
2362
+ if (!(now - busyAt >= 3 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
2363
2363
  if ($('#rateTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || rateTip.seen === utcDay() || prefs.rateDone === utcDay() || (RATE_ASKS && !prefs.rateDone && prefs.rateLast === utcDay() && (+prefs.rateDays || 0) >= 3)) return; /* the star shown, given or declined today */
2364
- clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
2364
+ clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || !S.turnOver || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
2365
2365
  }
2366
2366
  function coffeeTip() {
2367
2367
  const at = [$('#bCoffee'), $('#bMenu')].find((b) => b.getBoundingClientRect().width), t = $('#coffeeTip'); if (!at) return;
2368
2368
  prefs.coffeeAsked = utcDay(); noteAsk('coffee'); savePrefs(); const r = at.getBoundingClientRect();
2369
- $('#coffeeTipT').textContent = L('{0} et l’équipe ont fini. Si l’appel vous a aidé à suivre ce long travail, un café aide Agent Standup à continuer. (On ne le demande qu’une fois.)', '{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)').replace('{0}', () => nameOf('main'));
2369
+ $('#coffeeTipT').textContent = L('{0} et l’équipe ont fini. Si l’appel vous a aidé à suivre ce travail, un café aide Agent Standup à continuer. (On ne le demande qu’une fois.)', '{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)').replace('{0}', () => nameOf('main'));
2370
2370
  $('#coffeeYes').textContent = L('☕ Offrir un café', '☕ Buy a coffee'); $('#coffeeNo').textContent = L('Non merci', 'No thanks');
2371
2371
  t.style.display = ''; t.style.top = Math.round(r.bottom + 10) + 'px'; t.style.right = Math.max(8, Math.round(innerWidth - r.right - 6)) + 'px'; t.style.setProperty('--ax', Math.max(8, Math.round(r.width / 2 - 2)) + 'px');
2372
2372
  clearTimeout(coffeeTip.t); coffeeTip.t = setTimeout(() => (t.style.display = 'none'), 60000);
@@ -2928,7 +2928,8 @@ setInterval(async () => {
2928
2928
  S.seq = d.seq; if (d.marks) S.sawEnd = true; if (d.cost && (!S.cost || d.cost.usd !== S.cost.usd || d.cost.final !== S.cost.final)) { S.cost = d.cost; later('tok', renderTokens, 300); } if (!d.events || !d.events.length) return;
2929
2929
  for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(twinOf(a)); addTile(S.agents[a.id]); }
2930
2930
  const from = S.events.length, fresh = [], changed = []; // the session is not written in order: what is new goes at the end (the order the call got it in), what the server corrected is corrected in place
2931
- for (const e of d.events) { const old = S.byK.get(e.k); if (old) { changed.push([old, { kind: old.kind, n: old.tools ? old.tools.length : 0, end: old.end }]); Object.assign(old, e); } else { S.byK.set(e.k, e); fresh.push(e); } }
2931
+ 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 */
2932
+ 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); } }
2932
2933
  if (fresh.some((e) => e.end)) S.sawEnd = true;
2933
2934
  if (fresh.length) { S.events = S.events.concat(fresh); stampT(from); $('#seek').max = S.events.length - 1; trNew(from); warmTTS(from); renderLog(false); }
2934
2935
  if (S.playing && !S.recomputing) for (const e of fresh) if (e.kind === 'order' && !S.status[e.to]) { S.status[e.to] = 'working'; S.orderTs[e.to] = e.ts || 0; S.gone.delete(e.to); } // a new sub-agent shows up now, while the previous line is still being read
@@ -3564,7 +3565,7 @@ if (EMBED) $('#mBrowser').style.display = $('#mFollowTab').style.display = '';
3564
3565
  (async function init() {
3565
3566
  if (!prefs.firstDay) { prefs.firstDay = HAD_PREFS ? '2000-01-01' : new Date().toISOString().slice(0, 10); savePrefs(); } // the first day the call is in view asks nothing (see firstDay); someone who used the app before has had theirs
3566
3567
  if (!LANGS.some((l) => l[0] === prefs.lang)) prefs.lang = 'en'; await loadLocale(prefs.lang); voiceOffer(); kokoroUI(); await loadChars();
3567
- document.body.classList.toggle('rost', prefs.roster !== false); document.body.classList.toggle('react', !!prefs.reactions); document.body.classList.toggle('focusl', !!prefs.focusLayout); setView(prefs.view); menuInit(); addEventListener('click', () => { try { if (prefs.notify && !EMBED && 'Notification' in window && Notification.permission === 'default') Notification.requestPermission(); } catch {} }, { once: true }); applyLang(); applyMute(); TTS.init().then(updateHint);
3568
+ document.body.classList.toggle('rost', !!prefs.roster); document.body.classList.toggle('react', !!prefs.reactions); document.body.classList.toggle('focusl', !!prefs.focusLayout); setView(prefs.view); menuInit(); addEventListener('click', () => { try { if (prefs.notify && !EMBED && 'Notification' in window && Notification.permission === 'default') Notification.requestPermission(); } catch {} }, { once: true }); applyLang(); applyMute(); TTS.init().then(updateHint);
3568
3569
  loadHealth().then(() => { // French by default only if translation can actually work; otherwise stay in English without a warning
3569
3570
  const h = S.health || {};
3570
3571
  if (!prefs.langChosen && FR() && h.claude === null && !h.apiKey) { prefs.lang = 'en'; applyLang(); }
@@ -342,7 +342,7 @@
342
342
  "same search as {0}: {1}": "samme søgning som {0}: {1}",
343
343
  "reran a failing command: {0}": "kørte en fejlet kommando igen: {0}",
344
344
  "☕ Buy a coffee": "☕ Giv en kop kaffe",
345
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} og holdet er færdige. Hvis opkaldet hjalp dig med at følge dette lange stykke arbejde, holder en kop kaffe Agent Standup i gang. (Vi spørger kun én gang.)",
345
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} og holdet er færdige. Hvis opkaldet hjalp dig med at følge dette stykke arbejde, holder en kop kaffe Agent Standup i gang. (Vi spørger kun én gang.)",
346
346
  "Failed calls": "Mislykkede kald",
347
347
  "+ {0} earlier": "+ {0} tidligere",
348
348
  "Spotted in the session itself, with no model call.": "Fundet i selve sessionen, uden kald til modellen.",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "gleiche Suche wie {0}: {1}",
344
344
  "reran a failing command: {0}": "fehlgeschlagenen Befehl wiederholt: {0}",
345
345
  "☕ Buy a coffee": "☕ Einen Kaffee spendieren",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} und das Team sind fertig. Wenn dir der Call geholfen hat, diesen langen Lauf zu verfolgen, hält ein Kaffee Agent Standup am Laufen. (Wir fragen nur einmal.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} und das Team sind fertig. Wenn dir der Call geholfen hat, diesen Lauf zu verfolgen, hält ein Kaffee Agent Standup am Laufen. (Wir fragen nur einmal.)",
347
347
  "Failed calls": "Fehlgeschlagene Aufrufe",
348
348
  "+ {0} earlier": "+ {0} frühere",
349
349
  "Spotted in the session itself, with no model call.": "In der Sitzung selbst erkannt, ohne Modellaufruf.",
@@ -2,7 +2,7 @@
2
2
  " full — compaction soon": " full — compaction soon",
3
3
  " on ": " on ",
4
4
  "”": "”",
5
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)",
5
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)",
6
6
  "{0} failures in a row": "{0} failures in a row",
7
7
  "{0} MB": "{0} MB",
8
8
  "{0} times in a row": "{0} times in a row",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "misma búsqueda que {0}: {1}",
344
344
  "reran a failing command: {0}": "repitió un comando que falló: {0}",
345
345
  "☕ Buy a coffee": "☕ Invitar a un café",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} y el equipo han terminado. Si la llamada te ayudó a seguir este trabajo largo, un café ayuda a que Agent Standup siga adelante. (Solo lo pedimos una vez.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} y el equipo han terminado. Si la llamada te ayudó a seguir este trabajo, un café ayuda a que Agent Standup siga adelante. (Solo lo pedimos una vez.)",
347
347
  "Failed calls": "Llamadas fallidas",
348
348
  "+ {0} earlier": "+ {0} anteriores",
349
349
  "Spotted in the session itself, with no model call.": "Detectado en la propia sesión, sin llamar al modelo.",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "{0} と同じ検索: {1}",
344
344
  "reran a failing command: {0}": "失敗したコマンドを再実行: {0}",
345
345
  "☕ Buy a coffee": "☕ コーヒーをおごる",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}とチームの作業が終わりました。この長い作業を追うのに通話が役立ったなら、コーヒー1杯で Agent Standup の開発を支えられます。(お願いするのはこの一度だけです)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}とチームの作業が終わりました。この作業を追うのに通話が役立ったなら、コーヒー1杯で Agent Standup の開発を支えられます。(お願いするのはこの一度だけです)",
347
347
  "Failed calls": "失敗した呼び出し",
348
348
  "+ {0} earlier": "さらに前に {0} 件",
349
349
  "Spotted in the session itself, with no model call.": "セッションそのものから検出。モデルは呼び出していません。",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "{0}와(과) 같은 검색: {1}",
344
344
  "reran a failing command: {0}": "실패한 명령을 다시 실행: {0}",
345
345
  "☕ Buy a coffee": "☕ 커피 한 잔 사기",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}와 팀이 작업을 마쳤어요. 이 긴 작업을 따라가는 데 통화가 도움이 됐다면, 커피 한 잔이 Agent Standup을 계속 이어가게 해요. (딱 한 번만 여쭤볼게요.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0}와 팀이 작업을 마쳤어요. 이 작업을 따라가는 데 통화가 도움이 됐다면, 커피 한 잔이 Agent Standup을 계속 이어가게 해요. (딱 한 번만 여쭤볼게요.)",
347
347
  "Failed calls": "실패한 호출",
348
348
  "+ {0} earlier": "이전 {0}개 더",
349
349
  "Spotted in the session itself, with no model call.": "세션 자체에서 찾았어요. 모델 호출은 없어요.",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "mesma busca que {0}: {1}",
344
344
  "reran a failing command: {0}": "repetiu um comando que falhou: {0}",
345
345
  "☕ Buy a coffee": "☕ Pagar um café",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} e a equipe terminaram. Se a chamada ajudou você a acompanhar esse trabalho longo, um café ajuda o Agent Standup a continuar. (Só pedimos uma vez.)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} e a equipe terminaram. Se a chamada ajudou você a acompanhar esse trabalho, um café ajuda o Agent Standup a continuar. (Só pedimos uma vez.)",
347
347
  "Failed calls": "Chamadas com falha",
348
348
  "+ {0} earlier": "+ {0} anteriores",
349
349
  "Spotted in the session itself, with no model call.": "Encontrado na própria sessão, sem chamar o modelo.",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "与 {0} 相同的搜索:{1}",
344
344
  "reran a failing command: {0}": "重新运行失败的命令:{0}",
345
345
  "☕ Buy a coffee": "☕ 请喝杯咖啡",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和团队已经完成。如果这次通话帮你跟上了这段长时间的工作,一杯咖啡能让 Agent Standup 继续下去。(我们只问这一次。)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和团队已经完成。如果这次通话帮你跟上了这段工作,一杯咖啡能让 Agent Standup 继续下去。(我们只问这一次。)",
347
347
  "Failed calls": "失败的调用",
348
348
  "+ {0} earlier": "还有更早的 {0} 条",
349
349
  "Spotted in the session itself, with no model call.": "直接从会话中发现,没有调用模型。",
@@ -343,7 +343,7 @@
343
343
  "same search as {0}: {1}": "與 {0} 相同的搜尋:{1}",
344
344
  "reran a failing command: {0}": "重新執行失敗的指令:{0}",
345
345
  "☕ Buy a coffee": "☕ 請喝杯咖啡",
346
- "{0} and the team are done. If the call helped you follow this long run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和團隊已經完成。如果這次通話幫你跟上了這段長時間的工作,一杯咖啡能讓 Agent Standup 繼續下去。(我們只問這一次。)",
346
+ "{0} and the team are done. If the call helped you follow this run, a coffee keeps Agent Standup going. (We only ask once.)": "{0} 和團隊已經完成。如果這次通話幫你跟上了這段工作,一杯咖啡能讓 Agent Standup 繼續下去。(我們只問這一次。)",
347
347
  "Failed calls": "失敗的呼叫",
348
348
  "+ {0} earlier": "還有更早的 {0} 筆",
349
349
  "Spotted in the session itself, with no model call.": "直接從工作階段中發現,沒有呼叫模型。",
package/server.js CHANGED
@@ -478,7 +478,7 @@ function timelineEntry(proj, id) {
478
478
  // ---- Live feed. The timeline is sorted again at each build and events already sent can change (an order typed mid-turn is stamped at typing time and lands before what the page has; a sub-agent's last line becomes its report; a tool call joins an earlier beat),
479
479
  // so a page cannot ask for "what comes after index n". Every event has a key `k` that never changes, each build that changes something gets the next sequence number, and a page asks for the events that are new or different since the number it holds.
480
480
  // `ep` names this memory: it is a new one after a restart, after the session left the cache, or when a transcript was rewritten, and the page then loads the whole session again.
481
- const sigOf = (e) => e.kind + '|' + e.agent + '|' + (e.to || '') + '|' + (e.end || '') + '|' + (e.kind === 'tools' ? e.tools.length + ':' + e.tools[e.tools.length - 1].id : e.kind === 'usage' ? e.u.i + ',' + e.u.o + ',' + e.u.r + ',' + e.u.w + ',' + e.model : e.kind === 'order' ? e.toolId + ',' + e.bg + ',' + e.title : e.kind === 'finish' ? e.ts : ''); // everything about an event that can differ from one build to the next. Its text, its tool calls, its results and its time never do: they come from one transcript record (same key = same record); and `t` moves only when time zero does, which feedStep looks at once for all
481
+ const sigOf = (e) => e.kind + '|' + e.agent + '|' + (e.to || '') + '|' + (e.end || '') + '|' + (e.kind === 'tools' ? e.tools.length + ':' + e.tools[e.tools.length - 1].id + ':' + e.tools.map((t) => (t.d && t.d.kind === 'plan' ? (t.d.text || '').length + (t.d.text || '').slice(-24) : '')).join(',') : e.kind === 'usage' ? e.u.i + ',' + e.u.o + ',' + e.u.r + ',' + e.u.w + ',' + e.model : e.kind === 'order' ? e.toolId + ',' + e.bg + ',' + e.title : e.kind === 'finish' ? e.ts : ''); // everything about an event that can differ from one build to the next (a plan's text too: its answer names the plan approved). Its text, its tool calls, its results and its time never do: they come from one transcript record (same key = same record); and `t` moves only when time zero does, which feedStep looks at once for all
482
482
  function feedStep(prev, tl, files) {
483
483
  let f = prev && files.every((x) => { const was = prev.gens.get(x); return was === undefined || was === (fileStates.get(x) || {}).gen; }) ? prev : null; // a transcript read again from its start numbers its events again: the keys no longer mean the same thing
484
484
  for (let pass = 0; ; pass++) {
@@ -532,6 +532,7 @@ const askOf = (b) => { const q = b.name === 'AskUserQuestion' && b.input && Arra
532
532
  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
533
  const PLAN_FILE = /[\\/]\.claude[\\/]plans[\\/][^\\/]+\.md$/, PLAN_DIR = process.env.CLAUDE_CONFIG_DIR ? path.join(process.env.CLAUDE_CONFIG_DIR, 'plans') + path.sep : '';
534
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
535
+ 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
535
536
  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 ''; } };
536
537
  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
537
538
  const i = b.input || {}, t = (x, n) => (typeof x === 'string' ? clip(x.trim(), n) : '');
@@ -993,6 +994,7 @@ function parseRecord(st, r) {
993
994
  for (const b of blocks(r)) if (b.type === 'tool_result' && wf) push({ ts, agent, kind: 'wfrun', toolId: b.tool_use_id, run: wf }); // the answer to a Workflow call names the run it started: its agents are in subagents/workflows/<run>/
994
995
  for (const b of blocks(r)) if (b.type === 'tool_result' && (st.toolName[b.tool_use_id] === 'Agent' || st.toolName[b.tool_use_id] === 'Task') && !(st.bg && st.bg[b.tool_use_id]) && !/^\s*Async agent launched/i.test(resultText(b.content))) push({ ts, agent, kind: 'agentdone', toolId: b.tool_use_id }); // a synchronous call: the lead got the sub-agent's answer back, so it has finished (async launches answer immediately and are not a completion)
995
996
  const one = blocks(r).filter((b) => b.type === 'tool_result').length === 1; // what Claude Code noted about the call (toolUseResult) is that call's when the record answers one call
997
+ if (one && st.plans && r.toolUseResult && typeof r.toolUseResult.plan === 'string' && r.toolUseResult.plan.trim()) for (const b of blocks(r)) if (b.type === 'tool_result' && st.plans.has(b.tool_use_id)) st.plans.get(b.tool_use_id).d.text = clip(r.toolUseResult.plan.trim(), 4000); // the answer names the plan exactly: the plan file holds only the latest one
996
998
  for (const b of blocks(r)) if (b.type === 'tool_result' && st.toolName[b.tool_use_id] && !NO_RESULT.has(st.toolName[b.tool_use_id])) {
997
999
  const n = st.toolName[b.tool_use_id], text = resultText(b.content), img = resultImages(b.content).length, files = n === 'Bash' && !b.is_error ? docPaths(text, false).map((f) => absPath(f, r.cwd)) : [], art = !b.is_error && st.pubs && st.pubs.has(b.tool_use_id) ? artOf(st, st.pubs.get(b.tool_use_id), r.toolUseResult, text) : null;
998
1000
  items.push({ id: b.tool_use_id, err: !!b.is_error, out: clipOut(text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '').trimEnd(), RESULT_MAX[n] || (/^mcp__/.test(n) ? 900 : 600)), ...(img ? { img } : {}), ...(files.length ? { files } : {}), ...(art ? { art } : {}), ...(BROWSER_MCP.test(n) && !b.is_error ? browserSeen(text, n) : {}), ...resultMore(n, text, one ? r.toolUseResult : null) }); // img: how many pictures came back; the page fetches them from /api/media · files: the documents a command says it made
@@ -1019,7 +1021,7 @@ function parseRecord(st, r) {
1019
1021
  else if (b.type === 'tool_use') {
1020
1022
  st.toolName[b.id] = b.name; if (b.name === 'TaskCreate') st.tasks = 1; (st.out = st.out || new Set()).add(b.id); if (b.input && b.input.run_in_background) (st.bg = st.bg || {})[b.id] = true; // out: the calls that have no answer yet
1021
1023
  if (b.name === 'Agent' || b.name === 'Task') push({ ts, agent, kind: 'agentcall', toolId: b.id, bg: !!(b.input && b.input.run_in_background), text: (b.input && b.input.prompt) || '', title: (b.input && b.input.description) || '', ...(b.input && typeof b.input.name === 'string' && b.input.name.trim() ? { nm: b.input.name.trim() } : {}) });
1022
- else { const tool = toolLabel(b, ts); if (tool.d && tool.d.outs) tool.d.outs = tool.d.outs.map((f) => absPath(f, r.cwd)); if (tool.d && tool.d.kind === 'artifact') (st.pubs = st.pubs || new Map()).set(b.id, tool.d.open ? 'open' : tool.d.doc ? 'doc' : 'pub'); push({ ts, agent, kind: 'tool', tool, ...th() }); st.act = st.raw.length - 1; }
1024
+ else { const tool = toolLabel(b, ts); if (tool.d && tool.d.outs) tool.d.outs = tool.d.outs.map((f) => absPath(f, r.cwd)); if (/^(Write|Edit|MultiEdit)$/.test(b.name) && b.input && planFile(String(b.input.file_path || ''))) { st.planF = String(b.input.file_path); st.planW = b.name === 'Write' && typeof b.input.content === 'string' ? { mid: m.id, text: clip(b.input.content.trim(), 4000) } : null; } if (tool.d && tool.d.kind === 'plan') { (st.plans = st.plans || new Map()).set(b.id, tool); if (st.planW && st.planW.mid && st.planW.mid === m.id) tool.d.text = st.planW.text; else if (!tool.d.text && st.planF) tool.d.text = (st.planW && st.planW.text) || planDoc(st.planF); } /* a plan written in the same message as its call: the call carries the one before, or none */ /* Claude Code 2.1.30x sends ExitPlanMode with no plan: the plan is the file the session just wrote in ~/.claude/plans */ if (tool.d && tool.d.kind === 'artifact') (st.pubs = st.pubs || new Map()).set(b.id, tool.d.open ? 'open' : tool.d.doc ? 'doc' : 'pub'); push({ ts, agent, kind: 'tool', tool, ...th() }); st.act = st.raw.length - 1; }
1023
1025
  }
1024
1026
  }
1025
1027
  if (agent === 'main' && (m.stop_reason === 'end_turn' || ((r.isApiErrorMessage || (m.model === '<synthetic>' && m.stop_reason === 'stop_sequence')) && !(st.out && st.out.size)))) { // also a turn that ends on a message Claude Code writes itself, in the place of the model's: the API is down, the limit is reached, the request was refused, or there was nothing to answer. Nothing follows it, unless a call of the lead is still out: the connection dropped while its agents worked, and it goes on when they answer. (A message of the model that a safety check cuts is not the end either: Claude Code tells the model, which goes on.) The lead's turn is over: Claude Code writes one record per content block, each with the message's stop reason, so the mark goes on the line this record carries (a thinking block carries none)