Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Show "Summarizing earlier messages…" while a long chat is summarized before the answer

AdityaUmaleadf4fd0ebc9d
diff --git a/packages/phone-protocol/src/runtime-events.ts b/packages/phone-protocol/src/runtime-events.ts
index 9c6e1bf2e5..70afef14ad 100644
--- a/packages/phone-protocol/src/runtime-events.ts
+++ b/packages/phone-protocol/src/runtime-events.ts
@@ -206,6 +206,8 @@ export type RuntimeEvent = RuntimeEventBase &
| { type: "runtime.notice"; message: string; text?: ServerText }
/** The engine condensed the conversation into its own summary (Claude Code's compact_boundary); the chat marks it. */
| { type: "context.compacted" }
+ /** The app is summarizing earlier messages (true), or has finished or stopped (false). */
+ | { type: "context.summarizing"; active: boolean }
);
export type RuntimeEventListener = (event: RuntimeEvent) => void;
diff --git a/server/compaction-summary.test.ts b/server/compaction-summary.test.ts
index 5989fef5de..e10da5d408 100644
--- a/server/compaction-summary.test.ts
+++ b/server/compaction-summary.test.ts
@@ -184,3 +184,22 @@ it("falls back to the excerpt summary, without failing the turn, when the helper
expect(aborted).toBe(true);
expect(hanging.booked).toEqual([]);
});
+
+it("says it is summarizing from the start of a summary until it is written, failed or stopped", async () => {
+ const seen: boolean[] = [];
+ const onSummarizing = (active: boolean) => seen.push(active);
+ let finish: (text: string) => void = () => {};
+ const written = draftSummary(history, { signal: new AbortController().signal, onSummarizing, generateText: () => new Promise(resolve => { finish = resolve; }) });
+ await vi.waitFor(() => expect(seen).toEqual([true]));
+ finish("The person cancelled the deployment.");
+ await written;
+ expect(seen).toEqual([true, false]);
+ const controller = new AbortController();
+ const stopped = draftSummary(history, { signal: controller.signal, onSummarizing, generateText: () => new Promise(() => {}) });
+ await vi.waitFor(() => expect(seen).toEqual([true, false, true]));
+ controller.abort();
+ await expect(stopped).rejects.toBeDefined();
+ expect(seen).toEqual([true, false, true, false]);
+ await draftSummary(history, { signal: new AbortController().signal, onSummarizing, generateText: () => Promise.reject(new Error("helper down")) });
+ expect(seen).toEqual([true, false, true, false, true, false]);
+});
diff --git a/server/compaction-summary.ts b/server/compaction-summary.ts
index 966d7bc0c9..dd5266fa25 100644
--- a/server/compaction-summary.ts
+++ b/server/compaction-summary.ts
@@ -40,13 +40,26 @@ export function summaryPrompt(history: readonly ReplayEntry[]): string {
].join("\n\n");
}
-/** Timeout aborts the helper; Stop aborts the whole operation rather than commit a late summary. */
-export async function draftSummary(history: readonly ReplayEntry[], options: {
+interface SummaryOptions {
generateText?: (prompt: string, options?: { signal?: AbortSignal }) => Promise<string>;
signal: AbortSignal;
timeoutMs?: number;
-}): Promise<string> {
+ /** Told true when the summary starts and false once it is written, failed or stopped. */
+ onSummarizing?: (active: boolean) => void;
+}
+
+/** Timeout aborts the helper; Stop aborts the whole operation rather than commit a late summary. */
+export async function draftSummary(history: readonly ReplayEntry[], options: SummaryOptions): Promise<string> {
options.signal.throwIfAborted();
+ options.onSummarizing?.(true);
+ try {
+ return await summarize(history, options);
+ } finally {
+ options.onSummarizing?.(false);
+ }
+}
+
+async function summarize(history: readonly ReplayEntry[], options: SummaryOptions): Promise<string> {
const fallback = deterministicSummary(history);
if (!options.generateText) return fallback;
const timeout = AbortSignal.timeout(options.timeoutMs ?? 20_000);
diff --git a/server/context-compaction.e2e.test.ts b/server/context-compaction.e2e.test.ts
index 9af16773b9..1b6c8d4358 100644
--- a/server/context-compaction.e2e.test.ts
+++ b/server/context-compaction.e2e.test.ts
@@ -46,7 +46,12 @@ async function setup(hang: boolean, fakeEnv: NodeJS.ProcessEnv) {
const turns = () => existsSync(`${plan}.evidence.jsonl`) ? readFileSync(`${plan}.evidence.jsonl`, "utf8")
.trim().split("\n").filter(Boolean).map(line => JSON.parse(line)) : [];
ready = true;
- return { session, api, cli, bot, thread, messages, task, idle, send, turns,
+ const summarizing = () => {
+ const file = join(session.info.dataDir, "events", `${thread}.ndjson`);
+ return existsSync(file) ? readFileSync(file, "utf8").trim().split("\n").filter(Boolean).map(line => JSON.parse(line))
+ .filter(event => event.type === "context.summarizing").map(event => event.active as boolean) : [];
+ };
+ return { session, api, cli, bot, thread, messages, task, idle, send, turns, summarizing,
compact: () => api(`/api/bots/${bot.id}/compact`, { threadId: thread }),
restart: async (beforeLaunch?: () => void) => {
await waitForExit(restarted ?? session.child, { signal: "SIGTERM" });
@@ -130,6 +135,7 @@ it("automatically folds old exchanges while keeping the two latest and the incom
expect(prompt).toContain("THIRD_EXCHANGE correction -5 != 5");
expect(prompt).toContain("INCOMING do not summarize this request");
expect(f.turns().at(-1).resumed).toBe(false);
+ await expect.poll(f.summarizing, { message: "the status line says it is summarizing, then stops saying it" }).toEqual([true, false]);
}), 70_000);
it("Stop cancels a stalled summary without writing a late record or starting an agent", () => fixture(async f => {
@@ -144,9 +150,11 @@ it("Stop cancels a stalled summary without writing a late record or starting an
return typeof dump.prompt === "string" && dump.prompt.startsWith("Summarize this conversation");
}).toBe(true);
await expect(f.compact()).rejects.toThrow(/already working/);
+ await expect.poll(f.summarizing).toEqual([true]);
await f.cli("interrupt", "--bot", f.bot.id, "--task", f.thread);
await f.idle();
expect((await f.messages()).filter(m => m.kind === "compaction")).toHaveLength(0);
+ await expect.poll(f.summarizing, { message: "a stopped summary clears the status line" }).toEqual([true, false]);
expect((await f.messages()).slice(0, before.length)).toEqual(before.map(message =>
message.id === previousRequest.id ? { ...message, requestPending: true } : message));
expect(f.turns()).toHaveLength(count);
diff --git a/server/index.ts b/server/index.ts
index 36d0d7c3b8..b432e4716a 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -7028,7 +7028,7 @@ async function compactConversation(input: {
const controller = new AbortController(); idle?.addEventListener("abort", () => controller.abort(), { once: true }); if (idle?.aborted) controller.abort();
compactionControllers.set(threadId, { generation, controller });
try {
- const summary = await draftSummary(fold.folded, { signal: controller.signal, generateText: sideJobs.text("compaction", bot.id, { instance })?.generateText });
+ const summary = await draftSummary(fold.folded, { signal: controller.signal, generateText: sideJobs.text("compaction", bot.id, { instance })?.generateText, ...(idle ? {} : { onSummarizing: (active: boolean) => bus.publish({ ...waitEventBase(threadId), type: "context.summarizing", active }) }) });
if (!idle && !directTurnClaimIsCurrent(bot.id, generation, threadId)) throw new DirectTurnSetupCancelled("context summarization stopped");
controller.signal.throwIfAborted();
if (prefix !== JSON.stringify(sinceFreshStart(store.activePath(threadId)).slice(0, messages.length))) {
diff --git a/server/thread-events.ts b/server/thread-events.ts
index cd41f78cb2..42fd198aa2 100644
--- a/server/thread-events.ts
+++ b/server/thread-events.ts
@@ -222,6 +222,8 @@ export function isRuntimeEvent(value: unknown): value is RuntimeEvent {
return typeof value.message === "string";
case "context.compacted":
return true;
+ case "context.summarizing":
+ return typeof value.active === "boolean";
case "runtime.error":
return typeof value.message === "string" &&
(value.setup === undefined || typeof value.setup === "boolean") &&
diff --git a/src/lib/friendly-activity.ts b/src/lib/friendly-activity.ts
index 8e40ec4d54..52a79522fb 100644
--- a/src/lib/friendly-activity.ts
+++ b/src/lib/friendly-activity.ts
@@ -15,6 +15,7 @@ const BY_PHASE: Array<[readonly string[], LocaleKey[]]> = [
[["chat.activity.screen", "chat.activity.computer", "chat.activity.openPage"], ["chat.friendly.clicking"]],
[["chat.activity.handoff", "chat.activity.askTeammate", "chat.activity.postRoom", "chat.activity.messagePerson", "chat.activity.rooms", "chat.activity.whosAround"], ["chat.friendly.team"]],
[["chat.activity.publishPage"], ["chat.activity.publishPage"]],
+ [["chat.activity.summarizing"], ["chat.activity.summarizing"]],
];
/** Servers of the app's own tools: their work reads as what it does, never as "Working in …". */
diff --git a/src/lib/live-activity.test.ts b/src/lib/live-activity.test.ts
index 703212d260..005f764ad4 100644
--- a/src/lib/live-activity.test.ts
+++ b/src/lib/live-activity.test.ts
@@ -147,6 +147,8 @@ describe("turnNowPhrases: what the status line says is happening now", () => {
expect(turnNowPhrases({ activity: "web" })?.phrases[0]).toBe("Searching the web");
expect(turnNowPhrases({ activity: "read", file: "notes.md" })?.phrases[0]).toBe("Reading notes.md");
expect(turnNowPhrases({ activity: "thinking" })?.phrases[0]).toBe("Thinking");
+ expect(turnNowPhrases({ activity: "summarizing" })?.phrases[0]).toBe("Summarizing earlier messages…");
+ expect(friendlyNowPhrases({ activity: "summarizing" }).phrases).toEqual(["Summarizing earlier messages…"]);
expect(turnNowPhrases({ activity: "reply" })?.phrases[0]).toBe("Writing a reply");
expect(turnNowPhrases({ activity: "tool", tool: "mcp__agents__publish_page" })?.phrases[0]).toBe("Publishing a page");
});
diff --git a/src/lib/live-activity.ts b/src/lib/live-activity.ts
index 369473cdee..4d86668f91 100644
--- a/src/lib/live-activity.ts
+++ b/src/lib/live-activity.ts
@@ -139,6 +139,8 @@ function liveStatusPhrases(status: LiveStatus): LiveActivityPhrases | null {
return phaseOf("chat.activity.thinking");
case "reply":
return phaseOf("chat.activity.reply");
+ case "summarizing":
+ return phaseOf("chat.activity.summarizing");
case "write":
case "edit": {
const file = status.file ?? status.target;
diff --git a/src/locales/de.json b/src/locales/de.json
index f906a798c5..69d10de059 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -1082,6 +1082,7 @@
"chat.speak.stop": "Vorlesen stoppen",
"chat.speak.read": "Das vorlesen",
"chat.activity.thinking": "Denkt nach",
+ "chat.activity.summarizing": "Fasst frühere Nachrichten zusammen…",
"chat.activity.working": "Arbeitet",
"chat.activity.runCommand": "Führt einen Befehl aus",
"chat.activity.readFile": "Liest eine Datei",
diff --git a/src/locales/en.json b/src/locales/en.json
index e731bc0afc..6b778014dc 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2843,6 +2843,7 @@
"chat.voiceNote.onLiveCall": "Voice notes can't play during a Live call.",
"chat.voiceNote.transcript": "Transcript",
"chat.activity.thinking": "Thinking",
+ "chat.activity.summarizing": "Summarizing earlier messages…",
"chat.activity.working": "Working",
"chat.typing": "Typing…",
"chat.queue.workingFor": "Working on {name}'s request",
diff --git a/src/locales/es.json b/src/locales/es.json
index f5ecc51fc0..7a5b0667cc 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -1984,6 +1984,7 @@
"chat.voiceNote.seek": "Buscar en la nota de voz",
"chat.voiceNote.onLiveCall": "Las notas de voz no se pueden reproducir durante una llamada en vivo.",
"chat.activity.thinking": "Pensando",
+ "chat.activity.summarizing": "Resumiendo mensajes anteriores…",
"chat.activity.working": "Trabajando",
"chat.activity.runCommand": "Ejecutando un comando",
"chat.activity.readFile": "Leyendo un archivo",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index de4cc6a78b..3e2c95b898 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -886,6 +886,7 @@
"chat.speak.stop": "Arrêter la lecture",
"chat.speak.read": "Lire ceci à voix haute",
"chat.activity.thinking": "Réflexion",
+ "chat.activity.summarizing": "Résumé des messages précédents…",
"chat.activity.working": "Au travail",
"chat.activity.runCommand": "Exécute une commande",
"chat.activity.readFile": "Lit un fichier",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 62113454e4..640d67ffdb 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -886,6 +886,7 @@
"chat.speak.stop": "पढ़ना रोकें",
"chat.speak.read": "इसे ज़ोर से पढ़ें",
"chat.activity.thinking": "सोच रहा है",
+ "chat.activity.summarizing": "पिछले संदेशों का सारांश बना रहा है…",
"chat.activity.working": "काम कर रहा है",
"chat.activity.runCommand": "कमांड चला रहा है",
"chat.activity.readFile": "फ़ाइल पढ़ रहा है",
diff --git a/src/locales/it.json b/src/locales/it.json
index 5174abfb09..60fe189e04 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -2075,6 +2075,7 @@
"chat.voiceNote.onLiveCall": "Le note vocali non si possono riprodurre durante una chiamata in diretta.",
"chat.voiceNote.transcript": "Trascrizione",
"chat.activity.thinking": "Pensando",
+ "chat.activity.summarizing": "Riassumendo i messaggi precedenti…",
"chat.activity.working": "Al lavoro",
"chat.activity.runCommand": "Esegue un comando",
"chat.activity.readFile": "Legge un file",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 7ebf8e0ea8..59cae0e5e3 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -2389,6 +2389,7 @@
"chat.voiceNote.onLiveCall": "ライブ通話中は音声メモを再生できません。",
"chat.voiceNote.transcript": "文字起こし",
"chat.activity.thinking": "考え中",
+ "chat.activity.summarizing": "以前のメッセージを要約中…",
"chat.activity.working": "作業中",
"chat.typing": "入力中…",
"chat.teammatesWorking": "チームメイトが作業中",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index cbf8613710..37466bc6eb 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -2277,6 +2277,7 @@
"chat.voiceNote.onLiveCall": "실시간 통화 중에는 음성 메모를 재생할 수 없어요.",
"chat.voiceNote.transcript": "녹취록",
"chat.activity.thinking": "생각 중",
+ "chat.activity.summarizing": "이전 메시지 요약 중…",
"chat.activity.working": "작업 중",
"chat.typing": "입력 중…",
"chat.teammatesWorking": "팀원들이 작업 중",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 091b78c90a..a729f6fda2 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -2116,6 +2116,7 @@
"chat.voiceNote.onLiveCall": "Wiadomości głosowych nie można odtwarzać podczas rozmowy na żywo.",
"chat.voiceNote.transcript": "Transkrypcja",
"chat.activity.thinking": "Myślenie",
+ "chat.activity.summarizing": "Podsumowuje wcześniejsze wiadomości…",
"chat.activity.working": "Praca",
"chat.activity.runCommand": "Uruchamianie polecenia",
"chat.activity.readFile": "Czytanie pliku",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 3ad230d5db..d94f9335be 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -2659,6 +2659,7 @@
"chat.voiceNote.onLiveCall": "Não é possível ouvir mensagens de voz durante uma chamada ao vivo.",
"chat.voiceNote.transcript": "Transcrição",
"chat.activity.thinking": "Pensando",
+ "chat.activity.summarizing": "Resumindo mensagens anteriores…",
"chat.activity.working": "Trabalhando",
"chat.queue.workingFor": "Trabalhando no pedido de {name}",
"chat.queue.workingForYou": "Trabalhando no seu pedido",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 9786e17666..4840bdfe41 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -2149,6 +2149,7 @@
"chat.voiceNote.onLiveCall": "Голосовые сообщения нельзя воспроизводить во время живого звонка.",
"chat.voiceNote.transcript": "Расшифровка",
"chat.activity.thinking": "Думает",
+ "chat.activity.summarizing": "Подводит итог прошлых сообщений…",
"chat.activity.working": "Работает",
"chat.activity.runCommand": "Выполняет команду",
"chat.activity.readFile": "Читает файл",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 55bd53fbf7..60e97291a9 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -586,6 +586,7 @@
"chat.speak.stop": "e0d700234f7e8118772de6ecd7066635730255012ad0d906f1ea9017ebdc986e",
"chat.speak.read": "ebea9b796c8c6f5d9d6f560e3f56f3deb3a1151df1d7659526553f0db5fd20bd",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -5515,6 +5516,7 @@
"chat.voiceNote.seek": "21317953dc2aba2741f44c9db316b7091050c96a279845d63354c341ffd7c04f",
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -10937,6 +10939,7 @@
"chat.speak.stop": "e0d700234f7e8118772de6ecd7066635730255012ad0d906f1ea9017ebdc986e",
"chat.speak.read": "ebea9b796c8c6f5d9d6f560e3f56f3deb3a1151df1d7659526553f0db5fd20bd",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -14751,6 +14754,7 @@
"chat.speak.stop": "e0d700234f7e8118772de6ecd7066635730255012ad0d906f1ea9017ebdc986e",
"chat.speak.read": "ebea9b796c8c6f5d9d6f560e3f56f3deb3a1151df1d7659526553f0db5fd20bd",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -19573,6 +19577,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -28232,6 +28237,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.typing": "d7fee5b783947f061f2673d5d56f508874f221afa1e177adab9147b69c81ee17",
"chat.teammatesWorking": "4e25bf70623bf1d9609089780b49c0bbcfd35b3db71796abe8c16b135c4dd100",
@@ -37796,6 +37802,7 @@
"chat.speak.stop": "e0d700234f7e8118772de6ecd7066635730255012ad0d906f1ea9017ebdc986e",
"chat.speak.read": "ebea9b796c8c6f5d9d6f560e3f56f3deb3a1151df1d7659526553f0db5fd20bd",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -48113,6 +48120,7 @@
"chat.voiceNote.seek": "21317953dc2aba2741f44c9db316b7091050c96a279845d63354c341ffd7c04f",
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -57898,6 +57906,7 @@
"chat.speak.stop": "e0d700234f7e8118772de6ecd7066635730255012ad0d906f1ea9017ebdc986e",
"chat.speak.read": "ebea9b796c8c6f5d9d6f560e3f56f3deb3a1151df1d7659526553f0db5fd20bd",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -62623,6 +62632,7 @@
"chat.voiceNote.seek": "21317953dc2aba2741f44c9db316b7091050c96a279845d63354c341ffd7c04f",
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -68530,6 +68540,7 @@
"chat.voiceNote.seek": "21317953dc2aba2741f44c9db316b7091050c96a279845d63354c341ffd7c04f",
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -74780,6 +74791,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -81905,6 +81917,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -89030,6 +89043,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.activity.runCommand": "1216a55213e64862106f23afd0324829d15ec37e25f894a00a59c47c61cf1484",
"chat.activity.readFile": "2f1b7c53c108ad0ebad0f6da838dc5119fb9ad75457a46d8f2094fb30351f6e2",
@@ -96354,6 +96368,7 @@
"chat.voiceNote.onLiveCall": "6a0b11834850d6f4930052f34f67f73282d9327230595315af72b67a7ec6fb99",
"chat.voiceNote.transcript": "721164f0dc7096a8c09be2069c5c689a56df933fc5798822e8134bd3e76771eb",
"chat.activity.thinking": "a20d12c5e9c428c398b9d25e4dded1d6d3e599184e38b4d37bcb9d2d595ff8f7",
+ "chat.activity.summarizing": "4384adc7fda6a694e126b3a4f113425c911221977a45b406d6012bfc587bc13b",
"chat.activity.working": "a92f0449a9f7235bf69dc2e8ff7070bfae3f00ec8f8f26e5457a9beac53466ac",
"chat.typing": "d7fee5b783947f061f2673d5d56f508874f221afa1e177adab9147b69c81ee17",
"chat.teammatesWorking": "4e25bf70623bf1d9609089780b49c0bbcfd35b3db71796abe8c16b135c4dd100",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 06efd1b2f3..95c524f386 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -1690,6 +1690,7 @@
"chat.voiceNote.seek": "Sesli notu sar",
"chat.voiceNote.onLiveCall": "Canlı arama sırasında sesli notlar oynatılamaz.",
"chat.activity.thinking": "Düşünüyor",
+ "chat.activity.summarizing": "Önceki mesajları özetliyor…",
"chat.activity.working": "Çalışıyor",
"chat.activity.runCommand": "Bir komut çalıştırıyor",
"chat.activity.readFile": "Bir dosya okuyor",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 3a03c726ee..19e676759d 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -1047,6 +1047,7 @@
"chat.speak.stop": "Зупинити озвучення",
"chat.speak.read": "Прочитати вголос",
"chat.activity.thinking": "Думає",
+ "chat.activity.summarizing": "Підсумовує попередні повідомлення…",
"chat.activity.working": "Працює",
"chat.activity.runCommand": "Виконує команду",
"chat.activity.readFile": "Читає файл",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 05f9147a31..1a5f3780da 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -1690,6 +1690,7 @@
"chat.voiceNote.seek": "Tua ghi chú thoại",
"chat.voiceNote.onLiveCall": "Không thể phát tin nhắn thoại trong cuộc gọi trực tiếp.",
"chat.activity.thinking": "Đang suy nghĩ",
+ "chat.activity.summarizing": "Đang tóm tắt các tin nhắn trước…",
"chat.activity.working": "Đang xử lý",
"chat.activity.runCommand": "Đang chạy lệnh",
"chat.activity.readFile": "Đang đọc tệp",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 3d3deab583..24dc5f9d35 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -2566,6 +2566,7 @@
"chat.voiceNote.onLiveCall": "即時通話期間無法播放語音訊息。",
"chat.voiceNote.transcript": "逐字稿",
"chat.activity.thinking": "思考中",
+ "chat.activity.summarizing": "正在摘要先前的訊息…",
"chat.activity.working": "工作中",
"chat.typing": "正在輸入…",
"chat.teammatesWorking": "隊友正在工作",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 81dfa45877..e9aa42fd17 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -2631,6 +2631,7 @@
"chat.voiceNote.onLiveCall": "实时通话期间无法播放语音消息。",
"chat.voiceNote.transcript": "文字记录",
"chat.activity.thinking": "思考中",
+ "chat.activity.summarizing": "正在总结之前的消息…",
"chat.activity.working": "工作中",
"chat.typing": "正在输入…",
"chat.teammatesWorking": "队友正在工作",
diff --git a/src/state/turn-status.test.ts b/src/state/turn-status.test.ts
index e240fdbae4..ef326d9232 100644
--- a/src/state/turn-status.test.ts
+++ b/src/state/turn-status.test.ts
@@ -71,6 +71,20 @@ describe("a thread's live turn", () => {
expect(turnLive("t")).toEqual({ turnId: "turn-2", ended: false, status: null });
});
+ it("says it is summarizing earlier messages until the summary is done, and leaves anything newer on the line", () => {
+ note({ type: "turn.completed", ok: true } as Partial<RuntimeEvent>);
+ note({ type: "context.summarizing", active: true, turnId: undefined } as Partial<RuntimeEvent>);
+ expect(turnLive("t")).toEqual({ turnId: "turn-1", ended: false, status: { activity: "summarizing" } });
+ note({ type: "context.summarizing", active: false, turnId: undefined } as Partial<RuntimeEvent>);
+ expect(turnLive("t").status, "a finished or stopped summary clears the line").toBeNull();
+ note({ type: "context.summarizing", active: true, turnId: undefined } as Partial<RuntimeEvent>);
+ note({ type: "turn.started", turnId: "turn-2" } as Partial<RuntimeEvent>);
+ expect(turnLive("t")).toEqual({ turnId: "turn-2", ended: false, status: null });
+ note({ type: "content.delta", streamKind: "reasoning_text", delta: "x", turnId: "turn-2" } as Partial<RuntimeEvent>);
+ note({ type: "context.summarizing", active: false, turnId: undefined } as Partial<RuntimeEvent>);
+ expect(turnLive("t").status, "a late end leaves the turn's own status").toEqual({ activity: "thinking" });
+ });
+
it("carries what a call works on, how it is doing and its last output, and changes only when one of them does", () => {
note({ type: "item.started", itemType: "tool", itemId: "c", title: "Bash" } as Partial<RuntimeEvent>);
note({ type: "turn.progress", activity: "command", itemId: "c", target: "scrape.py", detail: "python3 scrape.py" } as Partial<RuntimeEvent>);
diff --git a/src/state/turn-status.ts b/src/state/turn-status.ts
index 6882bfe82d..69afc3e3d0 100644
--- a/src/state/turn-status.ts
+++ b/src/state/turn-status.ts
@@ -8,7 +8,7 @@ import { progressKey, type TurnProgressActivity, type TurnProgressFields } from
export type LiveStatus =
| ({ activity: TurnProgressActivity } & Omit<TurnProgressFields, "type" | "activity">)
- | { activity: "thinking" | "reply"; itemId?: undefined };
+ | { activity: "thinking" | "reply" | "summarizing"; itemId?: undefined };
export interface TurnLive {
turnId?: string;
@@ -70,6 +70,9 @@ export function noteTurnEvent(event: RuntimeEvent): void {
case "item.completed":
case "request.opened":
return put(threadId, { ...live, status: null });
+ case "context.summarizing":
+ if (event.active) return put(threadId, { ...live, ended: false, status: { activity: "summarizing" } });
+ return put(threadId, { ...live, status: live.status?.activity === "summarizing" ? null : live.status });
default:
if (live !== current) put(threadId, live);
}