Skip to content

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

Keep recorded voice notes on every turn ending; speak how failed turns ended (#4700)

Milind Soni0f5ca7aea936
diff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjs
index 7a7cc18d72..9c2319c5ef 100644
--- a/scripts/ci-scope.mjs
+++ b/scripts/ci-scope.mjs
@@ -175,6 +175,7 @@ export const SRC_OUTSIDE_RENDERER = [
"src/lib/citations.ts",
"src/lib/composer-attachments.ts",
"src/lib/random-uuid.ts",
+ "src/lib/receipts.ts",
];
export const DOCS = /^(?:[^/]+\.md|docs\/.+\.md|\.github\/FUNDING\.yml)$/;
diff --git a/server/host/reply-voice-notes.test.ts b/server/host/reply-voice-notes.test.ts
index f814a29d39..e1ea021c64 100644
--- a/server/host/reply-voice-notes.test.ts
+++ b/server/host/reply-voice-notes.test.ts
@@ -1,7 +1,8 @@
import { expect, it, vi } from "vitest";
import type { AppConfig } from "../config.ts";
import type { BotRecord, Message } from "../store.ts";
-import { createReplyVoiceNotes, replyNoteWords, wantsReplyVoiceNote, VOICE_NOTE_MAX_CHARS } from "./reply-voice-notes.ts";
+import { failedTurnTool } from "../../shared/failed-turn.ts";
+import { createReplyVoiceNotes, endedTurnNoteWords, replyNoteWords, wantsReplyVoiceNote, VOICE_NOTE_MAX_CHARS } from "./reply-voice-notes.ts";
it("follows the Voice setting unless the bot made its own choice", () => {
const on = { tts: { everyReply: true } } as AppConfig;
@@ -29,6 +30,12 @@ function harness(messages: Message[], cfg: AppConfig = { tts: { everyReply: true
const deps = {
store: {
messagesFor: () => messages,
+ activePath: () => messages,
+ insertMessageAfter: vi.fn((_thread: string, after: string | undefined, message: Omit<Message, "id" | "at">) => {
+ const at = messages.findIndex((m) => m.id === after) + 1;
+ messages.splice(at, 0, { id: `inserted${at}`, at: 0, ...message } as Message);
+ return messages[at]!;
+ }),
patchMessage: vi.fn((_thread: string, id: string, patch: Partial<Message>) => { Object.assign(messages.find((m) => m.id === id)!, patch); return null; }),
appendMessage: vi.fn((_thread: string, message: Omit<Message, "id" | "at">) => { appended.push(message); return message as Message; }),
},
@@ -46,12 +53,12 @@ function harness(messages: Message[], cfg: AppConfig = { tts: { everyReply: true
const bot = { id: "b1", name: "Bot" } as BotRecord;
const reply = (text: string, extra: Partial<Message> = {}): Message => ({ id: "m1", at: 1, role: "bot", kind: "text", text, turnId: "t1", turnTerminal: true, ...extra });
-it("skips a stopped, internal or note-carrying turn and an empty reply", async () => {
+it("skips a turn the person stopped, an internal or note-carrying turn and an empty reply", async () => {
for (const [turn, messages] of [
- [{ stopped: true, internal: false }, [reply("Hi.")]],
- [{ stopped: false, internal: true }, [reply("Hi.")]],
- [{ stopped: false, internal: false }, [reply("Hi.", { attachments: [{ kind: "audio", path: "/a/own.mp3", mime: "audio/mpeg" }] })]],
- [{ stopped: false, internal: false }, [reply(" ")]],
+ [{ stoppedByPerson: true, internal: false, ending: { stop: undefined, cause: "stopped", interrupted: true } }, [reply("Hi.")]],
+ [{ stoppedByPerson: false, internal: true }, [reply("Hi.")]],
+ [{ stoppedByPerson: false, internal: false, ending: { stop: undefined, cause: "the step crashed", interrupted: false } }, [reply("Hi.", { attachments: [{ kind: "audio", path: "/a/own.mp3", mime: "audio/mpeg" }] })]],
+ [{ stoppedByPerson: false, internal: false }, [reply(" ")]],
] as const) {
const { deps, notes } = harness([...messages] as Message[]);
await notes.turnSettled({ bot, threadId: "th", turnId: "t1", ...turn });
@@ -62,7 +69,7 @@ it("skips a stopped, internal or note-carrying turn and an empty reply", async (
it("attaches the spoken reply to the turn's last line, words as its transcript", async () => {
const messages = [reply("Hi there.")];
const { deps, notes } = harness(messages);
- await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stopped: false, internal: false });
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false });
expect(deps.speak).toHaveBeenCalledWith(expect.anything(), "Hi there.", undefined);
expect(messages[0]!.attachments).toEqual([{ kind: "audio", path: "/a/note.mp3", mime: "audio/mpeg", text: "Hi there." }]);
});
@@ -70,9 +77,46 @@ it("attaches the spoken reply to the turn's last line, words as its transcript",
it("tells once, quietly, when the bot has no voice to speak with", async () => {
const { deps, appended, notes } = harness([reply("Hi.")]);
deps.voiceReady.mockReturnValue(false);
- await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stopped: false, internal: false });
- await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stopped: false, internal: false });
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false });
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false });
expect(appended).toHaveLength(1);
expect(appended[0]!.tool?.name).toMatch(/^notice: /);
expect(deps.speak).not.toHaveBeenCalled();
});
+
+it("speaks how a failed or harness-stopped turn ended, from its error, on a line above that error", async () => {
+ const messages: Message[] = [
+ { id: "u1", at: 0, role: "user", kind: "text", text: "Go." },
+ { id: "e1", at: 2, role: "bot", kind: "activity", tool: failedTurnTool("the same call failed 10 times in a row — the turn was stopped") },
+ ];
+ const { deps, notes } = harness(messages);
+ const stop = { turnId: "t1", cause: "the same call failed 10 times in a row — the turn was stopped" };
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false, ending: { stop, cause: "interrupted", interrupted: true } });
+ const words = "I stopped before finishing: the same call failed 10 times in a row — the turn was stopped";
+ expect(deps.speak).toHaveBeenCalledWith(expect.anything(), words, undefined);
+ expect(messages.map((m) => m.id)).toEqual(["u1", "inserted1", "e1"]);
+ expect(messages[1]).toMatchObject({ role: "bot", kind: "text", text: "", turnId: "t1", attachments: [{ kind: "audio", path: "/a/note.mp3", mime: "audio/mpeg", text: words }] });
+});
+
+it("speaks a failed turn's progress first and its ending whole", async () => {
+ const messages = [reply("Half the export is done.")];
+ const { deps, notes } = harness(messages);
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false, ending: { stop: undefined, cause: "Error: the export step crashed", interrupted: false } });
+ expect(deps.speak).toHaveBeenCalledWith(expect.anything(), "Half the export is done. I stopped before finishing: the export step crashed", undefined);
+ expect(messages[0]!.attachments).toHaveLength(1);
+ const ending = "I stopped before finishing: it broke.";
+ const long = endedTurnNoteWords("word ".repeat(400), ending);
+ expect(long.length).toBeLessThanOrEqual(VOICE_NOTE_MAX_CHARS);
+ expect(long.endsWith(ending)).toBe(true);
+});
+
+it("stays quiet about a turn the harness continues, and about one stopped without an error line, and speaks its reply", async () => {
+ for (const ending of [
+ { stop: { handoffPath: "/h/next.json", error: "out of steps" }, cause: "out of steps", interrupted: false },
+ { stop: { cause: "your new message went first" }, cause: "interrupted", interrupted: true },
+ ]) {
+ const { deps, notes } = harness([reply("Working on it.")]);
+ await notes.turnSettled({ bot, threadId: "th", turnId: "t1", stoppedByPerson: false, internal: false, ending });
+ expect(deps.speak).toHaveBeenCalledWith(expect.anything(), "Working on it.", undefined);
+ }
+});
diff --git a/server/host/reply-voice-notes.ts b/server/host/reply-voice-notes.ts
index 7009fd806a..580f6e0317 100644
--- a/server/host/reply-voice-notes.ts
+++ b/server/host/reply-voice-notes.ts
@@ -1,9 +1,13 @@
// "Voice note with every reply": the harness, not the model, speaks a settled reply in the bot's voice and attaches
// it the way a send_voice_note clip lands, so every engine gets it.
+import { failedTurnCause } from "../../shared/failed-turn.ts";
+import { lastNonReceipt } from "../../src/lib/receipts.ts";
import type { AppConfig } from "../config.ts";
import type { BotRecord, Message, Store } from "../store.ts";
+import type { TurnStop } from "../turn-outcome.ts";
import { serverLine, type ServerLineKey } from "../server-lines.ts";
import { speakable } from "../tts/speech-text.ts";
+import { landTurnFiles } from "./turn-attachments.ts";
/** The longest note, the same bound send_voice_note keeps. */
export const VOICE_NOTE_MAX_CHARS = 1000;
@@ -24,8 +28,15 @@ export function replyNoteWords(reply: string, max = VOICE_NOTE_MAX_CHARS): strin
return `${(word >= max / 2 ? head.slice(0, word) : head).trim()}…`;
}
+/** A turn that did not finish: what it said, then how it ended, which always fits whole. */
+export function endedTurnNoteWords(reply: string, ending: string, max = VOICE_NOTE_MAX_CHARS): string {
+ const how = replyNoteWords(ending, max);
+ const said = how.length + 1 < max ? replyNoteWords(reply, max - how.length - 1) : "";
+ return [said, how].filter(Boolean).join(" ");
+}
+
export interface ReplyVoiceNoteDeps {
- store: Pick<Store, "messagesFor" | "patchMessage" | "appendMessage">;
+ store: Pick<Store, "messagesFor" | "activePath" | "patchMessage" | "appendMessage" | "insertMessageAfter">;
config(): AppConfig;
voiceReady(cfg: AppConfig, voice?: string): boolean;
speak(cfg: AppConfig, text: string, voice?: string): Promise<{ bytes: Uint8Array | Buffer; mime: string }>;
@@ -40,8 +51,16 @@ export interface SettledTurn {
bot: BotRecord;
threadId: string;
turnId: string | undefined;
- /** the person stopped it */
- stopped: boolean;
+ /** the person pressed Stop */
+ stoppedByPerson: boolean;
+ /** How a turn that did not finish ended; absent when it finished. */
+ ending?: {
+ stop: TurnStop | undefined;
+ /** the engine's error, or its stop reason in words */
+ cause: string | undefined;
+ /** stopped while it ran, by the harness or anything else */
+ interrupted: boolean;
+ };
/** a teammate's or the coordinator's turn, not one the person reads as a reply */
internal: boolean;
}
@@ -58,15 +77,27 @@ export function createReplyVoiceNotes(deps: ReplyVoiceNoteDeps) {
deps.store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: `notice: ${serverLine(deps.language(threadId), why, params)}`, ok: true } });
};
+ /** Why a turn ended unfinished, when the person should hear it: a turn the harness continues, or one stopped without
+ * an error line (a new message from the person went first), ended on purpose. */
+ const failureWords = ({ threadId, ending }: SettledTurn): string | undefined => {
+ if (!ending || ending.stop?.handoffPath !== undefined) return undefined;
+ if (ending.interrupted && failedTurnCause(lastNonReceipt(deps.store.activePath(threadId))?.tool?.name ?? "") === null) return undefined;
+ return (ending.stop?.cause ?? ending.cause)?.trim().replace(/^error:\s*/i, "") || undefined;
+ };
+
/** Resolves once the note is attached or skipped; never throws. */
async function turnSettled(turn: SettledTurn): Promise<void> {
const cfg = deps.config();
- if (!turn.turnId || turn.stopped || turn.internal || !wantsReplyVoiceNote(turn.bot, cfg)) return;
- const lines = deps.store.messagesFor(turn.threadId).filter((message) => message.role === "bot" && message.kind === "text" && message.turnId === turn.turnId);
- if (lines.some(audio)) return;
- const reply = lines.findLast((message) => message.turnTerminal) ?? lines.at(-1);
- const words = replyNoteWords(reply?.text ?? "");
- if (!reply || !words) return;
+ if (!turn.turnId || turn.stoppedByPerson || turn.internal || !wantsReplyVoiceNote(turn.bot, cfg)) return;
+ const lines = () => deps.store.messagesFor(turn.threadId).filter((message) => message.role === "bot" && message.kind === "text" && message.turnId === turn.turnId);
+ const said = lines();
+ if (said.some(audio)) return;
+ const reply = (said.findLast((message) => message.turnTerminal) ?? said.at(-1))?.text ?? "";
+ const failure = failureWords(turn);
+ const words = failure
+ ? endedTurnNoteWords(reply, serverLine(deps.language(turn.threadId), "server.voice.turnEnded", { reason: deps.redact(failure) }))
+ : replyNoteWords(reply);
+ if (!words) return;
if (!deps.voiceReady(cfg, turn.bot.voice)) return tellOnce(turn.bot, turn.threadId, "server.voice.noNoteNoVoice");
let saved: { path: string; mime: string } | undefined;
try {
@@ -75,11 +106,9 @@ export function createReplyVoiceNotes(deps: ReplyVoiceNoteDeps) {
} catch (error) {
return tellOnce(turn.bot, turn.threadId, "server.voice.noNoteFailed", { reason: (error instanceof Error ? error.message : String(error)).slice(0, 200) });
}
- const current = deps.store.messagesFor(turn.threadId).find((message) => message.id === reply.id);
- if (!current || audio(current)) return deps.remove(saved.path);
- deps.store.patchMessage(turn.threadId, reply.id, {
- attachments: [...(current.attachments ?? []), { kind: "audio", path: saved.path, mime: saved.mime, text: deps.redact(words) }],
- });
+ if (lines().some(audio)) return deps.remove(saved.path);
+ landTurnFiles(deps.store, { threadId: turn.threadId, turnId: turn.turnId }, [{ kind: "audio", path: saved.path, mime: saved.mime, text: deps.redact(words) }],
+ (line) => deps.store.appendMessage(turn.threadId, line));
}
return { turnSettled };
diff --git a/server/host/turn-attachments.test.ts b/server/host/turn-attachments.test.ts
index 759678f854..403283e6cf 100644
--- a/server/host/turn-attachments.test.ts
+++ b/server/host/turn-attachments.test.ts
@@ -1,28 +1,73 @@
-import { expect, it } from "vitest";
-import { settleParkedFiles } from "./turn-attachments.ts";
+import { expect, it, vi } from "vitest";
+import { PERSON_STOPPED_TURN_NAME } from "../../shared/client-cancel.ts";
+import { failedTurnTool } from "../../shared/failed-turn.ts";
+import type { Message } from "../store.ts";
+import { landTurnFiles, settleParkedFiles } from "./turn-attachments.ts";
const image = { kind: "image" as const, path: "/a/one.png", mime: "image/png" };
const note = { kind: "audio" as const, path: "/a/two.mp3", mime: "audio/mpeg", text: " the token is sk-live-abc " };
const redact = (text: string) => text.replace(/sk-live-\w+/, "[redacted]");
-it("lands a failed turn's voice note with its images, its words kept as a redacted transcript", () => {
- expect(settleParkedFiles([image, note], false, redact)).toEqual({
+it("lands every turn's voice notes with its images, their words kept as a redacted transcript", () => {
+ expect(settleParkedFiles([image, note], redact)).toEqual({
land: [image, { kind: "audio", path: "/a/two.mp3", mime: "audio/mpeg", text: "the token is [redacted]" }],
discard: [],
});
});
-it("discards only the voice notes of a stopped turn", () => {
- expect(settleParkedFiles([image, note], true, redact)).toEqual({ land: [image], discard: [note] });
-});
-
it("leaves no transcript on a note recorded without words", () => {
- expect(settleParkedFiles([{ ...note, text: " " }], false, redact).land).toEqual([{ kind: "audio", path: "/a/two.mp3", mime: "audio/mpeg" }]);
+ expect(settleParkedFiles([{ ...note, text: " " }], redact).land).toEqual([{ kind: "audio", path: "/a/two.mp3", mime: "audio/mpeg" }]);
});
it("discards a goal coordinator's images and keeps its voice notes", () => {
- expect(settleParkedFiles([image, note], false, redact, true)).toEqual({
+ expect(settleParkedFiles([image, note], redact, true)).toEqual({
land: [{ kind: "audio", path: "/a/two.mp3", mime: "audio/mpeg", text: "the token is [redacted]" }],
discard: [image],
});
});
+
+function thread(rows: Array<Partial<Message>>) {
+ const path = rows.map((row, index) => ({ id: `m${index}`, at: index, role: "bot", kind: "text", ...row }) as Message);
+ const store = {
+ activePath: () => path,
+ patchMessage: vi.fn((_thread: string, id: string, patch: Partial<Message>) => { Object.assign(path.find((m) => m.id === id)!, patch); return null; }),
+ insertMessageAfter: vi.fn((_thread: string, _after: string | undefined, line: Omit<Message, "id" | "at">) => line as Message),
+ };
+ const append = vi.fn();
+ return { path, store, append };
+}
+
+const audio = { kind: "audio" as const, path: "/a/n.mp3", mime: "audio/mpeg", text: "Half done." };
+
+it("puts the files on the turn's last reply line, above the error it ended on", () => {
+ const { path, store, append } = thread([
+ { role: "user", text: "Go." },
+ { text: "Half done.", turnId: "t1" },
+ { kind: "activity", tool: failedTurnTool("the next step failed") },
+ ]);
+ landTurnFiles(store, { threadId: "th", turnId: "t1" }, [audio], append);
+ expect(path[1]!.attachments).toEqual([audio]);
+ expect(append).not.toHaveBeenCalled();
+ expect(store.insertMessageAfter).not.toHaveBeenCalled();
+});
+
+it("gives a turn without a reply a line of its own, above the error or stop lines it ended on", () => {
+ for (const ending of [failedTurnTool("stopped by the loop guard"), { name: PERSON_STOPPED_TURN_NAME, ok: true }]) {
+ const { store, append } = thread([
+ { role: "user", text: "Go." },
+ { kind: "activity", tool: { name: "agents_send_voice_note", ok: true }, turnId: "t1" },
+ { kind: "activity", tool: ending },
+ ]);
+ landTurnFiles(store, { threadId: "th", turnId: "t1" }, [audio], append);
+ expect(store.insertMessageAfter).toHaveBeenCalledWith("th", "m1", { role: "bot", kind: "text", text: "", attachments: [audio], turnId: "t1" });
+ expect(append).not.toHaveBeenCalled();
+ }
+});
+
+it("appends that line when the turn ended without an error line, and does nothing without files", () => {
+ const { store, append } = thread([{ role: "user", text: "Go." }]);
+ landTurnFiles(store, { threadId: "th", turnId: "t1" }, [], append);
+ expect(append).not.toHaveBeenCalled();
+ landTurnFiles(store, { threadId: "th", turnId: "t1", from: { botId: "b", name: "B", color: "#fff" } }, [audio], append);
+ expect(append).toHaveBeenCalledWith({ role: "bot", kind: "text", text: "", attachments: [audio], turnId: "t1", from: { botId: "b", name: "B", color: "#fff" } });
+});
diff --git a/server/host/turn-attachments.ts b/server/host/turn-attachments.ts
index 2543b1f410..73de2af9ef 100644
--- a/server/host/turn-attachments.ts
+++ b/server/host/turn-attachments.ts
@@ -1,14 +1,15 @@
// The files a turn parked while it ran (generated images, recorded voice notes), and what becomes of them when it settles.
-import type { Message } from "../store.ts";
+import { isStoppedTurnName } from "../../shared/client-cancel.ts";
+import { failedTurnCause } from "../../shared/failed-turn.ts";
+import { isReceipt } from "../../src/lib/receipts.ts";
+import type { Message, Store } from "../store.ts";
export type ParkedTurnAttachment = NonNullable<Message["attachments"]>[number];
-/** A turn the person stopped loses the voice notes it recorded; every other turn, a failed one included, keeps all its
- * files. A goal coordinator's turn loses its images: its artifacts never reach the public room. A note's words stay on
- * it as its transcript, redacted. */
+/** Every turn keeps the files it parked, whether it finished, failed or was stopped. A goal coordinator's turn loses its
+ * images: its artifacts never reach the public room. A note's words stay on it as its transcript, redacted. */
export function settleParkedFiles(
parked: readonly ParkedTurnAttachment[],
- stopped: boolean,
redact: (text: string) => string,
coordinator = false,
): { land: ParkedTurnAttachment[]; discard: ParkedTurnAttachment[] } {
@@ -17,8 +18,38 @@ export function settleParkedFiles(
for (const file of parked) {
if (file.kind === "image" && coordinator) discard.push(file);
else if (file.kind !== "audio") land.push(file);
- else if (stopped) discard.push(file);
else land.push({ kind: "audio", path: file.path, mime: file.mime, ...(file.text?.trim() ? { text: redact(file.text.trim()) } : {}) });
}
return { land, discard };
}
+
+const endsTurn = (message: Message) => message.kind === "activity" && message.tool !== undefined
+ && (failedTurnCause(message.tool.name) !== null || isStoppedTurnName(message.tool.name));
+
+/** Puts files on the turn's last reply line. A turn that wrote none gets a line of its own, placed above the error or
+ * stop lines the turn ended on (receipts such as its digest aside), so they stay last and Retry stays with them. */
+export function landTurnFiles(
+ store: Pick<Store, "activePath" | "patchMessage" | "insertMessageAfter">,
+ turn: { threadId: string; turnId: string | undefined; from?: Message["from"] },
+ files: readonly ParkedTurnAttachment[],
+ /** How a new last line is written, so it carries what the thread's other lines carry. */
+ append: (line: Omit<Message, "id" | "at">) => unknown,
+): void {
+ const { threadId, turnId, from } = turn;
+ if (!files.length) return;
+ const path = store.activePath(threadId);
+ const reply = path.findLast((message) => message.role === "bot" && message.kind === "text" && message.turnId === turnId);
+ if (reply) {
+ store.patchMessage(threadId, reply.id, { attachments: [...(reply.attachments ?? []), ...files] });
+ return;
+ }
+ const line = { role: "bot" as const, kind: "text" as const, text: "", attachments: [...files], turnId, ...(from ? { from } : {}) };
+ let ending: number | undefined;
+ for (let i = path.length - 1; i >= 0; i -= 1) {
+ if (isReceipt(path[i]!)) continue;
+ if (!endsTurn(path[i]!)) break;
+ ending = i;
+ }
+ if (ending === undefined) append(line);
+ else store.insertMessageAfter(threadId, path[ending - 1]?.id, line);
+}
diff --git a/server/index.ts b/server/index.ts
index 6da39a8590..e66544cd19 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -87,7 +87,7 @@ import { emailSignInRoute } from "./routes/email-sign-in.ts";
import { createPersonStop } from "./host/person-stop.ts";
import { createTurnOrder } from "./host/turn-order.ts";
import { createQueuedNotes, createWaitWords } from "./host/wait-words.ts";
-import { settleParkedFiles, type ParkedTurnAttachment } from "./host/turn-attachments.ts";
+import { landTurnFiles, settleParkedFiles, type ParkedTurnAttachment } from "./host/turn-attachments.ts";
import { createReplyVoiceNotes } from "./host/reply-voice-notes.ts";
import { runtimeRequestCardFields } from "./request-card.ts";
import type { DirectSendInput, DirectSendReceipt } from "./direct-send.ts";
@@ -6423,15 +6423,12 @@ bus.subscribe((event: RuntimeEvent) => {
pushMessage({ role: "bot", kind: "text", text: spoken.text, turnId });
lastReply.set(event.threadId, spoken.text);
};
- const landParkedFiles = (stopped: boolean) => {
+ const landParkedFiles = () => {
const key = turnAttachmentKey(event.threadId, event.turnId);
- const { land, discard } = settleParkedFiles(turnAttachmentsByTurn.get(key) ?? [], stopped, redactSecretsInText, Boolean(goalCoordinatorTurn || ambiguousCoordinatorText));
+ const { land, discard } = settleParkedFiles(turnAttachmentsByTurn.get(key) ?? [], redactSecretsInText, Boolean(goalCoordinatorTurn || ambiguousCoordinatorText));
turnAttachmentsByTurn.delete(key);
for (const file of discard) deleteAttachment(file.path);
- if (!land.length) return;
- const response = store.messagesFor(event.threadId).findLast((message) => message.role === "bot" && message.kind === "text" && message.turnId === completedTurnId);
- if (response) store.patchMessage(event.threadId, response.id, { attachments: [...(response.attachments ?? []), ...land] });
- else pushMessage({ role: "bot", kind: "text", text: "", attachments: land, turnId: completedTurnId });
+ landTurnFiles(store, { threadId: event.threadId, turnId: completedTurnId, ...(speaker ? { from: speaker } : {}) }, land, pushMessage);
};
if (coordinatorVisibleText) pushAssistantText(coordinatorVisibleText, completedTurnId);
@@ -6706,7 +6703,7 @@ bus.subscribe((event: RuntimeEvent) => {
pushStoppedTurn(event.turnId);
break;
}
- landParkedFiles(false); // above the failure row, which stays the last, retryable line
+ landParkedFiles(); // above the failure row, which stays the last, retryable line
pushMessage({ role: "bot", kind: "activity", tool: failedTurnTool(event.message, event) });
if (event.setup && bot) store.setTaskActivity(bot.id, event.threadId, "dead");
break;
@@ -6725,7 +6722,7 @@ bus.subscribe((event: RuntimeEvent) => {
const clientStopped = personStops.stopped(event.threadId, completedTurnId) || (stoppedTurns.has(event.threadId)
&& (stoppedTurnId === undefined || completedTurnId === undefined || stoppedTurnId === completedTurnId));
const stopped = event.stopReason === "interrupted" || clientStopped;
- landParkedFiles(!event.ok && stopped);
+ landParkedFiles();
if (completedTurnId) {
const terminal = store.markTerminalAssistantMessage(event.threadId, completedTurnId);
if (terminal) store.patchMessage(event.threadId, terminal.id, { turnSucceeded: event.ok });
@@ -6733,7 +6730,7 @@ bus.subscribe((event: RuntimeEvent) => {
.filter((message) => message.role === "bot" && message.kind === "text" && message.turnId === completedTurnId)
.map((message) => message.text ?? "").join("\n"));
}
- if (bot) void replyVoiceNotes.turnSettled({ bot, threadId: event.threadId, turnId: completedTurnId, stopped, internal });
+ if (bot) void replyVoiceNotes.turnSettled({ bot, threadId: event.threadId, turnId: completedTurnId, stoppedByPerson: personStops.stopped(event.threadId, completedTurnId), internal, ...(event.ok ? {} : { ending: { stop: turnStops.read(event.threadId, completedTurnId), cause: turnStops.failureCause(event), interrupted: event.stopReason === "interrupted" } }) });
const reply = lastReply.get(event.threadId) ?? "";
if (personStops.stopped(event.threadId, completedTurnId)) pushStoppedTurn(completedTurnId);
personStops.turnEnded(event.threadId, completedTurnId);
diff --git a/server/voice-notes-chat.e2e.test.ts b/server/voice-notes-chat.e2e.test.ts
new file mode 100644
index 0000000000..ea39a5f6a1
--- /dev/null
+++ b/server/voice-notes-chat.e2e.test.ts
@@ -0,0 +1,231 @@
+// Voice notes on OpenMausBot's own chat runtime (an API-key provider): a loopback provider scripts the model, and a
+// loopback speech stub stands in for the voice provider, so no external service is reached.
+import { createServer, type Server } from "node:http";
+import { existsSync, readdirSync } from "node:fs";
+import { join } from "node:path";
+import { expect, it } from "vitest";
+import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";
+import { lastNonReceipt } from "../src/lib/receipts.ts";
+
+const MP3 = Buffer.from("ID3 fake mp3 for the chat voice note fixture");
+
+type ChatMessage = { role: string; content?: unknown; tool_call_id?: string };
+type ChatRequest = { messages: ChatMessage[]; tools?: unknown[] };
+/** The provider's answer to one request; null holds the response open until the turn is stopped. */
+type Script = (request: ChatRequest, user: string) => string | null;
+
+const frame = (delta: unknown, finish: string | null) => `data: ${JSON.stringify({ choices: [{ index: 0, delta, finish_reason: finish }] })}\n\n`;
+const say = (text: string) => frame({ content: text }, "stop") + "data: [DONE]\n\n";
+const callTool = (id: string, name: string, args: unknown) =>
+ frame({ tool_calls: [{ index: 0, id, type: "function", function: { name, arguments: JSON.stringify(args) } }] }, "tool_calls") + "data: [DONE]\n\n";
+const toolResults = (request: ChatRequest) => request.messages.filter((message) => message.role === "tool").map((message) => String(message.content));
+const lastUser = (request: ChatRequest) => {
+ const content = request.messages.filter((message) => message.role === "user").at(-1)?.content;
+ return typeof content === "string" ? content : JSON.stringify(content ?? "");
+};
+
+async function listen(server: Server): Promise<string> {
+ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
+ const address = server.address();
+ if (!address || typeof address === "string") throw new Error("no loopback port");
+ return `http://127.0.0.1:${address.port}`;
+}
+
+async function close(server: Server) {
+ server.closeAllConnections();
+ await new Promise<void>((resolve) => server.close(() => resolve()));
+}
+
+async function withChatVoice(test: (f: {
+ script(next: Script): void;
+ requests: ChatRequest[];
+ spoken: string[];
+ failSpeech(on: boolean): void;
+ api(method: string, path: string, body?: unknown): Promise<any>;
+ control(args: string[]): Promise<any>;
+ messages(threadId: string): Promise<any[]>;
+ audioFiles(): string[];
+ newBot(name: string): Promise<any>;
+ settle(bot: any, text: string): Promise<void>;
+}) => Promise<void>) {
+ let script: Script = () => say("Done.");
+ const requests: ChatRequest[] = [];
+ const spoken: string[] = [];
+ let speechFails = false;
+ const provider = createServer(async (req, res) => {
+ if (req.url === "/v1/models") {
+ res.setHeader("content-type", "application/json");
+ res.end(JSON.stringify({ data: [{ id: "fixture-model" }] }));
+ return;
+ }
+ if (req.method === "GET") { res.statusCode = 404; res.end(); return; }
+ let body = "";
+ for await (const chunk of req) body += chunk;
+ const request = JSON.parse(body) as ChatRequest;
+ requests.push(request);
+ // A side job (the conversation summary) offers no tools.
+ const answer = request.tools?.length ? script(request, lastUser(request)) : say("Earlier the person asked for voice notes.");
+ if (answer?.startsWith("HTTP ")) {
+ res.writeHead(Number(answer.slice(5, 8)), { "content-type": "application/json" });
+ res.end(JSON.stringify({ error: { message: answer.slice(9) } }));
+ return;
+ }
+ res.writeHead(200, { "content-type": "text/event-stream" });
+ if (answer === null) { res.write(": held\n\n"); return; }
+ res.end(answer);
+ });
+ const speech = createServer(async (req, res) => {
+ let body = "";
+ for await (const chunk of req) body += chunk;
+ if (!(req.url ?? "").includes("/audio/speech")) { res.writeHead(404); res.end(); return; }
+ spoken.push(String(JSON.parse(body).input ?? ""));
+ if (speechFails) { res.writeHead(500, { "content-type": "application/json" }); res.end(JSON.stringify({ error: "speech stub is down" })); return; }
+ res.writeHead(200, { "content-type": "audio/mpeg", "content-length": String(MP3.byteLength) });
+ res.end(MP3);
+ });
+ const providerUrl = await listen(provider);
+ const speechUrl = await listen(speech);
+ const fixture = await launchVerificationServer().catch(async (error) => {
+ await close(provider);
+ await close(speech);
+ throw error;
+ });
+ const control = (args: string[]) => runControlOmb([...args, "--url", fixture.info.url]) as Promise<any>;
+ const api = async (method: string, path: string, body?: unknown) => {
+ const response = await fetch(`${fixture.info.url}${path}`, {
+ method, headers: { "content-type": "application/json", origin: fixture.info.url },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ });
+ const result = await response.json() as any;
+ expect(response.ok, JSON.stringify(result)).toBe(true);
+ return result;
+ };
+ const attachments = join(fixture.info.dataDir, "attachments");
+ try {
+ await api("PATCH", "/api/config", { openaiCompat: { key: "synthetic-fixture-key", url: `${providerUrl}/v1`, model: "fixture-model" } });
+ await api("PUT", "/api/config", { tts: { provider: "chatterbox", baseUrl: speechUrl, voice: "voice-a" } });
+ await test({
+ script: (next) => { script = next; },
+ requests,
+ spoken,
+ failSpeech: (on) => { speechFails = on; },
+ api,
+ control,
+ messages: async (threadId) => inOrder((await api("GET", `/api/threads/${threadId}/messages?limit=200`)).messages),
+ audioFiles: () => existsSync(attachments) ? readdirSync(attachments).filter((name) => name.endsWith(".mp3")) : [],
+ newBot: async (name) => {
+ const { bot } = await control(["new-bot", "--name", name]);
+ await control(["set-model", "--bot", bot.id, "--instance", "openaiCompat", "--model", "fixture-model"]);
+ return bot;
+ },
+ settle: async (bot, text) => {
+ await control(["send", "--bot", bot.id, "--task", bot.activeTaskId, "--text", text]);
+ await control(["wait", "--bot", bot.id, "--task", bot.activeTaskId, "--timeout", "40"]);
+ },
+ });
+ } finally {
+ await fixture.close();
+ await close(provider);
+ await close(speech);
+ }
+}
+
+const audioOf = (messages: any[]) => messages.flatMap((message) => (message.attachments ?? []).filter((file: any) => file.kind === "audio").map((file: any) => ({ message, file })));
+/** The thread as the chat reads it: from its newest line back along each line's parent. */
+const inOrder = (messages: any[]) => {
+ const byId = new Map(messages.map((message) => [message.id, message]));
+ const parents = new Set(messages.map((message) => message.parentId));
+ const path: any[] = [];
+ for (let at = messages.findLast((message) => !parents.has(message.id)); at; at = byId.get(at.parentId)) path.unshift(at);
+ return path;
+};
+const failureRow = (message: any) => message.kind === "activity" && String(message.tool?.name ?? "").startsWith("error:");
+const stoppedRow = (message: any) => message.kind === "activity" && String(message.tool?.name ?? "").startsWith("stopped:");
+
+/** One voice note, then a closing reply once the tool's result is back. */
+const noteThenReply = (note: string, reply: string): Script => (request) =>
+ toolResults(request).length ? say(reply) : callTool("note-1", "agents_send_voice_note", { text: note });
+
+it("records a voice note on the chat runtime only with its audio, and attaches it to the reply, after a compaction too", async () => withChatVoice(async (f) => {
+ const bot = await f.newBot("Chat voice bot");
+ f.script(noteThenReply("The export finished.", "Here is the summary."));
+ await f.settle(bot, "Send me a voice note.");
+ expect(toolResults(f.requests.at(-1)!).join("\n")).toContain("Voice note recorded");
+ let notes = audioOf(await f.messages(bot.activeTaskId));
+ expect(notes.map((note) => [note.message.text, note.file.text])).toEqual([["Here is the summary.", "The export finished."]]);
+ expect(f.audioFiles()).toHaveLength(1);
+
+ // Every turn from here folds the conversation before it runs, as a long chat does.
+ await f.api("PATCH", "/api/config", { context: { compactAt: 1 } });
+ f.script((request) => say(toolResults(request).length ? "unused" : "Noted."));
+ for (const line of ["First older request.", "Second older request.", "Third older request."]) await f.settle(bot, line);
+ f.script(noteThenReply("Second note after the summary.", "Second reply."));
+ await f.settle(bot, "Another voice note, please.");
+ const messages = await f.messages(bot.activeTaskId);
+ expect(messages.filter((message) => message.kind === "compaction").length).toBeGreaterThan(0);
+ expect(toolResults(f.requests.at(-1)!).join("\n")).toContain("Voice note recorded");
+ notes = audioOf(messages);
+ expect(notes.map((note) => [note.message.text, note.file.text])).toEqual([
+ ["Here is the summary.", "The export finished."],
+ ["Second reply.", "Second note after the summary."],
+ ]);
+ expect(f.audioFiles()).toHaveLength(2);
+}), 120_000);
+
+it("says the note was not sent, and keeps no file, when the voice provider fails", async () => withChatVoice(async (f) => {
+ const bot = await f.newBot("Failing voice bot");
+ f.failSpeech(true);
+ f.script(noteThenReply("This note cannot be spoken.", "Reply without a note."));
+ await f.settle(bot, "Send me a voice note.");
+ const result = toolResults(f.requests.at(-1)!).join("\n");
+ expect(result).toContain("Voice note not sent");
+ expect(result).not.toContain("Voice note recorded");
+ expect(JSON.parse(result).ok).toBe(false);
+ expect(f.spoken).toEqual(["This note cannot be spoken."]);
+ expect(audioOf(await f.messages(bot.activeTaskId))).toEqual([]);
+ expect(f.audioFiles()).toEqual([]);
+}), 90_000);
+
+it("delivers a recorded note with the error a turn ends on, above that error", async () => withChatVoice(async (f) => {
+ const bot = await f.newBot("Erroring voice bot");
+ f.script((request) => toolResults(request).length ? "HTTP 400 the provider refused the next step" : callTool("note-1", "agents_send_voice_note", { text: "Half of it is done." }));
+ await f.settle(bot, "Do it and tell me by voice.");
+ const messages = await f.messages(bot.activeTaskId);
+ const notes = audioOf(messages);
+ expect(notes.map((note) => note.file.text)).toEqual(["Half of it is done."]);
+ const failed = messages.findIndex(failureRow);
+ expect(failed).toBeGreaterThan(messages.indexOf(notes[0]!.message));
+ expect(messages.slice(failed + 1).filter((message) => message.kind === "text")).toEqual([]);
+ expect(f.audioFiles()).toHaveLength(1);
+}), 90_000);
+
+it("delivers a recorded note when the person stops the turn after it", async () => withChatVoice(async (f) => {
+ const bot = await f.newBot("Stopped voice bot");
+ f.script((request) => toolResults(request).length ? null : callTool("note-1", "agents_send_voice_note", { text: "Starting the long job." }));
+ await f.control(["send", "--bot", bot.id, "--task", bot.activeTaskId, "--text", "Start the long job."]);
+ await expect.poll(() => f.audioFiles().length, { timeout: 30_000 }).toBe(1);
+ await expect.poll(() => f.requests.filter((request) => toolResults(request).length).length, { timeout: 30_000 }).toBe(1);
+ await f.api("POST", `/api/bots/${bot.id}/interrupt`, { threadId: bot.activeTaskId });
+ await f.control(["wait", "--bot", bot.id, "--task", bot.activeTaskId, "--timeout", "40"]);
+ const messages = await f.messages(bot.activeTaskId);
+ expect(audioOf(messages).map((note) => note.file.text)).toEqual(["Starting the long job."]);
+ expect(stoppedRow(lastNonReceipt(messages))).toBe(true);
+ expect(f.audioFiles()).toHaveLength(1);
+}), 90_000);
+
+it("with a voice note on every reply, says by voice how a failed turn ended", async () => withChatVoice(async (f) => {
+ const bot = await f.newBot("Every reply bot");
+ await f.api("PATCH", `/api/bots/${bot.id}`, { voiceNoteEveryReply: true });
+ f.script(() => "HTTP 400 the model is not available");
+ await f.settle(bot, "Try something.");
+ let notes: ReturnType<typeof audioOf> = [];
+ await expect.poll(async () => (notes = audioOf(await f.messages(bot.activeTaskId))).length, { timeout: 30_000 }).toBe(1);
+ expect(notes[0]!.file.text).toContain("the model is not available");
+ expect(notes[0]!.message.role).toBe("bot");
+ const messages = await f.messages(bot.activeTaskId);
+ expect(failureRow(lastNonReceipt(messages))).toBe(true);
+
+ f.script(() => say("All good now."));
+ await f.settle(bot, "Again.");
+ await expect.poll(async () => audioOf(await f.messages(bot.activeTaskId)).map((note) => note.file.text).at(-1), { timeout: 30_000 }).toBe("All good now.");
+}), 90_000);
diff --git a/server/voice-notes-loop-guard.e2e.test.ts b/server/voice-notes-loop-guard.e2e.test.ts
new file mode 100644
index 0000000000..4218f98655
--- /dev/null
+++ b/server/voice-notes-loop-guard.e2e.test.ts
@@ -0,0 +1,127 @@
+// A voice note on a turn the loop guard stops, through a real harness server and the fake Claude engine: its first
+// call holds while this test records a note through the agents server the engine was launched with, then one shell
+// command fails the same way ten times in a row and the guard stops the turn. A loopback speech stub stands in for the
+// voice provider, so no external service is reached.
+import { spawn } from "node:child_process";
+import { createServer, type Server } from "node:http";
+import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { expect, it } from "vitest";
+import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";
+import { failedTurnCause } from "../shared/failed-turn.ts";
+import { lastNonReceipt } from "../src/lib/receipts.ts";
+import { waitForExit } from "./testing/cleanup.ts";
+import { childEnv } from "./testing/omb-env.ts";
+
+type McpServer = { command: string; args: string[]; env: Record<string, string> };
+const STOPPED = "the same call failed the same way 10 times in a row: “Bash: git status” — the turn was stopped";
+const MP3 = Buffer.from("ID3 fake mp3 for the loop guard voice fixture");
+
+/** One tools/call to the agents server exactly as the engine was told to start it. */
+async function callAgentsTool(server: McpServer, name: string, args: unknown): Promise<{ text: string; isError?: boolean }> {
+ const child = spawn(server.command, server.args, { env: childEnv(server.env), stdio: ["pipe", "pipe", "inherit"] });
+ try {
+ const answer = await new Promise<any>((resolve, reject) => {
+ let buffer = "";
+ child.stdout.setEncoding("utf8");
+ child.stdout.on("data", (chunk: string) => {
+ buffer += chunk;
+ const newline = buffer.indexOf("\n");
+ if (newline !== -1) resolve(JSON.parse(buffer.slice(0, newline)));
+ });
+ child.on("exit", (code) => reject(new Error(`the agents server exited (${code}) before answering`)));
+ child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name, arguments: args } })}\n`);
+ });
+ return { text: answer.result.content[0].text, isError: answer.result.isError };
+ } finally {
+ await waitForExit(child, { signal: "SIGTERM" });
+ }
+}
+
+/** The thread as the chat reads it: from its newest line back along each line's parent. */
+const inOrder = (messages: any[]) => {
+ const byId = new Map(messages.map((message) => [message.id, message]));
+ const parents = new Set(messages.map((message) => message.parentId));
+ const path: any[] = [];
+ for (let at = messages.findLast((message) => !parents.has(message.id)); at; at = byId.get(at.parentId)) path.unshift(at);
+ return path;
+};
+const audioOf = (messages: any[]) => messages.flatMap((message) => (message.attachments ?? []).filter((file: any) => file.kind === "audio").map((file: any) => ({ message, file })));
+
+it("keeps a recorded note when the loop guard stops the turn, and with every reply on, says why it stopped", async () => {
+ const scratch = mkdtempSync(join(tmpdir(), "omb-voice-loop-"));
+ const release = join(scratch, "release");
+ const spoken: string[] = [];
+ const speech: Server = createServer(async (req, res) => {
+ let body = "";
+ for await (const chunk of req) body += chunk;
+ spoken.push(String(JSON.parse(body || "{}").input ?? ""));
+ res.writeHead(200, { "content-type": "audio/mpeg", "content-length": String(MP3.byteLength) });
+ res.end(MP3);
+ });
+ await new Promise<void>((resolve) => speech.listen(0, "127.0.0.1", resolve));
+ const port = (speech.address() as { port: number }).port;
+ const fixture = await launchVerificationServer({
+ ...process.env,
+ FAKE_CLAUDE_MODE: "slow",
+ FAKE_CLAUDE_SLOW_FINISH_GATE: join(scratch, "never"),
+ FAKE_CLAUDE_RELEASE: release,
+ FAKE_CLAUDE_TOOL_CALLS: JSON.stringify([
+ { name: "Bash", input: { command: "sleep 600" }, ok: true, hold: true },
+ ...Array.from({ length: 10 }, () => ({ name: "Bash", input: { command: "git status" }, ok: false, output: "fatal: not a git repository" })),
+ ]),
+ }).catch(async (error) => {
+ speech.close();
+ rmSync(scratch, { recursive: true, force: true });
+ throw error;
+ });
+ const control = (args: string[]) => runControlOmb([...args, "--url", fixture.info.url]) as Promise<any>;
+ const api = async (method: string, path: string, body?: unknown) => {
+ const response = await fetch(`${fixture.info.url}${path}`, {
+ method, headers: { "content-type": "application/json", origin: fixture.info.url },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ });
+ const result = await response.json() as any;
+ expect(response.ok, JSON.stringify(result)).toBe(true);
+ return result;
+ };
+ const messages = async (threadId: string) => inOrder((await api("GET", `/api/threads/${threadId}/messages?limit=200`)).messages);
+ const audioFiles = () => {
+ const dir = join(fixture.info.dataDir, "attachments");
+ return existsSync(dir) ? readdirSync(dir).filter((name) => name.endsWith(".mp3")) : [];
+ };
+ try {
+ await api("PUT", "/api/config", { tts: { provider: "chatterbox", baseUrl: `http://127.0.0.1:${port}`, voice: "voice-a" } });
+ await api("PATCH", "/api/config", { loopGuard: { enabled: true, stopAt: 10 } });
+
+ const { bot } = await control(["new-bot", "--name", "Looping voice bot"]);
+ await control(["send", "--bot", bot.id, "--task", bot.activeTaskId, "--text", "go"]);
+ await expect.poll(() => existsSync(fixture.fixtureDumpPath), { timeout: 30_000 }).toBe(true);
+ const launched = JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8")) as { mcpConfig: { mcpServers: Record<string, McpServer> } };
+ const recorded = await callAgentsTool(launched.mcpConfig.mcpServers.agents!, "send_voice_note", { text: "Checking the repository now." });
+ expect(recorded.isError).toBeFalsy();
+ expect(recorded.text).toContain("Voice note recorded");
+ writeFileSync(release, "go");
+ await control(["wait", "--bot", bot.id, "--task", bot.activeTaskId, "--timeout", "60"]);
+ let rows = await messages(bot.activeTaskId);
+ expect(failedTurnCause(lastNonReceipt(rows)?.tool?.name ?? "")).toBe(STOPPED);
+ expect(audioOf(rows).map((note) => note.file.text)).toEqual(["Checking the repository now."]);
+ expect(audioFiles()).toHaveLength(1);
+
+ const { bot: voiced } = await control(["new-bot", "--name", "Every reply looping bot"]);
+ await api("PATCH", `/api/bots/${voiced.id}`, { voiceNoteEveryReply: true });
+ await control(["send", "--bot", voiced.id, "--task", voiced.activeTaskId, "--text", "go"]);
+ await control(["wait", "--bot", voiced.id, "--task", voiced.activeTaskId, "--timeout", "60"]);
+ let notes: ReturnType<typeof audioOf> = [];
+ await expect.poll(async () => (notes = audioOf(rows = await messages(voiced.activeTaskId))).length, { timeout: 30_000 }).toBe(1);
+ expect(notes[0]!.file.text).toContain("I stopped before finishing: the same call failed the same way 10 times in a row");
+ expect(spoken.at(-1)).toBe(notes[0]!.file.text);
+ expect(failedTurnCause(lastNonReceipt(rows)?.tool?.name ?? "")).toBe(STOPPED);
+ } finally {
+ await fixture.close();
+ speech.closeAllConnections();
+ await new Promise<void>((resolve) => speech.close(() => resolve()));
+ rmSync(scratch, { recursive: true, force: true });
+ }
+}, 240_000);
diff --git a/server/voice-notes.e2e.test.ts b/server/voice-notes.e2e.test.ts
index 47608c3ceb..4a575575c5 100644
--- a/server/voice-notes.e2e.test.ts
+++ b/server/voice-notes.e2e.test.ts
@@ -7,6 +7,7 @@ import { promisify } from "node:util";
import { expect, it } from "vitest";
import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";
import { request } from "../scripts/mcp-server.ts";
+import { lastNonReceipt } from "../src/lib/receipts.ts";
import { listSystemVoices } from "./tts/system-voices.ts";
const execFileAsync = promisify(execFile);
@@ -340,7 +341,7 @@ it("keeps the parked note when the room-post append fails, so a retry can attach
expect(audio.path.endsWith(f.mp3Files()[0])).toBe(true);
}, { failFirstAudioAppend: true }), 60_000);
-it("keeps a failed turn's voice note above its failure row, and still deletes a stopped turn's", async () => withVoiceFixture(async (f) => {
+it("keeps a failed turn's voice note above its failure row, and a stopped turn's above its stop line", async () => withVoiceFixture(async (f) => {
const baseUrl = await f.serveTts();
await f.api("/api/config", { tts: { provider: "chatterbox", baseUrl, voice: "voice-a" } }, "PUT");
const replying = (await f.cli("new-bot", "--name", "Failing reply bot")).bot;
@@ -381,29 +382,16 @@ it("keeps a failed turn's voice note above its failure row, and still deletes a
await f.cli("send", "--bot", stopped.id, "--task", stopped.activeTaskId, "--text", "Send a note, then hold.");
await expect.poll(() => f.mp3Files().length, { timeout: 20_000 }).toBe(3);
await f.api("/api/bots/" + stopped.id + "/interrupt", { threadId: stopped.activeTaskId });
- await expect.poll(() => f.mp3Files().length, { timeout: 20_000 }).toBe(2);
await f.cli("wait", "--bot", stopped.id, "--task", stopped.activeTaskId, "--timeout", "30");
- expect((await f.messages(stopped.activeTaskId)).some((m: any) => (m.attachments ?? []).some((a: any) => a.kind === "audio"))).toBe(false);
+ const afterStop: any[] = await f.messages(stopped.activeTaskId);
+ const kept = afterStop.findIndex((m: any) => (m.attachments ?? []).some((a: any) => a.kind === "audio"));
+ expect(afterStop[kept].attachments[0].text).toBe("This note is stopped.");
+ const last = lastNonReceipt<any>(afterStop);
+ expect(last.tool.name).toMatch(/^stopped:/);
+ expect(afterStop.indexOf(last)).toBeGreaterThan(kept);
+ expect(f.mp3Files()).toHaveLength(3);
}), 120_000);
-it("deletes a parked voice note when the turn is cancelled mid-flight", async () => withVoiceFixture(async (f) => {
- const baseUrl = await f.serveTts();
- await f.api("/api/config", { tts: { provider: "chatterbox", baseUrl, voice: "voice-a" } }, "PUT");
- const bot = (await f.cli("new-bot", "--name", "Cancelled note bot")).bot;
- const gate = join(f.dataDir, "voice-note-gate");
- f.savePlan({
- [bot.id]: {
- steps: [{ tool: "send_voice_note", arguments: { text: "This note will be cancelled." } }],
- gateFile: gate,
- reply: "Never reached.",
- },
- });
- await f.cli("send", "--bot", bot.id, "--task", bot.activeTaskId, "--text", "Send a note, then hold.");
- await expect.poll(() => f.mp3Files().length, { timeout: 20_000 }).toBe(1);
- await f.api("/api/bots/" + bot.id + "/interrupt", { threadId: bot.activeTaskId });
- await expect.poll(() => f.mp3Files(), { timeout: 20_000 }).toEqual([]);
-}), 90_000);
-
it("leaves no file and no later-turn attachment when the turn dies mid-synthesis", async () => withVoiceFixture(async (f) => {
const hold = join(f.dataDir, "tts-hold");
const baseUrl = await f.serveTts({ holdUntil: hold });
@@ -443,7 +431,7 @@ const settle = async (f: any, bot: any, text = "Go ahead.") => {
await f.cli("wait", "--bot", bot.id, "--task", bot.activeTaskId, "--timeout", "30");
};
-it("speaks every reply when the Voice setting is on: failed turns too, never a stopped one, a bot's own note, or a bot switched off", async () => withVoiceFixture(async (f) => {
+it("speaks every reply when the Voice setting is on: failed turns too with how they ended, never one the person stopped, a bot's own note, or a bot switched off", async () => withVoiceFixture(async (f) => {
const baseUrl = await f.serveTts();
await f.api("/api/config", { tts: { provider: "chatterbox", baseUrl, voice: "voice-a", everyReply: true } }, "PUT");
expect((await f.api("/api/config", undefined, "GET")).tts.everyReply).toBe(true);
@@ -473,7 +461,8 @@ it("speaks every reply when the Voice setting is on: failed turns too, never a s
expect(await spokenNote(f, own.activeTaskId, "Reply next to my own note.")).toEqual([expect.objectContaining({ text: "My own note." })]);
await f.cli("send", "--bot", failing.id, "--task", failing.activeTaskId, "--text", "Export it.");
- expect(await spokenNote(f, failing.activeTaskId, "Half the export is done.")).toEqual([expect.objectContaining({ text: "Half the export is done." })]);
+ const failedNote = "Half the export is done. I stopped before finishing: the export step crashed";
+ expect(await spokenNote(f, failing.activeTaskId, "Half the export is done.")).toEqual([expect.objectContaining({ text: failedNote })]);
expect((await f.messages(failing.activeTaskId)).some((m: any) => String(m.tool?.name ?? "").startsWith("error:"))).toBe(true);
await f.cli("send", "--bot", stopped.id, "--task", stopped.activeTaskId, "--text", "Start the long job.");
@@ -484,7 +473,7 @@ it("speaks every reply when the Voice setting is on: failed turns too, never a s
await expect.poll(() => f.seen.filter((call: any) => call.input === "The report is ready.").length, { timeout: 20_000 }).toBe(2);
const spoken = f.seen.map((call: any) => call.input);
for (const never of ["Muted reply.", "Reply next to my own note.", "Starting the long job."]) expect(spoken).not.toContain(never);
- for (const once of ["Half the export is done.", "My own note."]) expect(spoken.filter((input: string) => input === once)).toHaveLength(1);
+ for (const once of [failedNote, "My own note."]) expect(spoken.filter((input: string) => input === once)).toHaveLength(1);
}), 180_000);
it("with the Voice setting off, speaks only for a bot switched on, and says once, quietly, why a bot without a voice cannot", async () => withVoiceFixture(async (f) => {
diff --git a/src/locales/de.json b/src/locales/de.json
index ce0feeb1d9..ad1bd78cce 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -2993,6 +2993,7 @@
"voice.usesOwn": "Dieser Bot spricht mit seiner eigenen Stimme.",
"server.voice.noNoteNoVoice": "Keine Sprachnachricht zu dieser Antwort: Für diesen Bot ist noch keine Stimme eingerichtet.",
"server.voice.noNoteFailed": "Keine Sprachnachricht zu dieser Antwort: Die Stimme konnte nicht erzeugt werden ({reason}).",
+ "server.voice.turnEnded": "Ich habe aufgehört, bevor ich fertig war: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Apps mit diesem Bot sprechen lassen",
"botApi.hint": "Apps und Skripte schicken {name} mit einem Schlüssel eine Nachricht und bekommen eine Antwort. {name} antwortet aus seinen Anweisungen und seinem Gedächtnis und nutzt dafür keine Tools.",
diff --git a/src/locales/en.json b/src/locales/en.json
index 0a82e9976a..ab7f2c05f1 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -9623,6 +9623,7 @@
"imageGen.key.openrouter": "OpenRouter API key",
"server.voice.noNoteNoVoice": "No voice note with this reply: this bot has no voice set up yet.",
"server.voice.noNoteFailed": "No voice note with this reply: the voice couldn't be made ({reason}).",
+ "server.voice.turnEnded": "I stopped before finishing: {reason}",
"phone.code.e2e.scan": "Open the {app} app on your phone and scan.",
"phone.code.e2e.wifi": "This Wi-Fi",
"phone.code.e2e.tailscale": "Tailscale",
diff --git a/src/locales/es.json b/src/locales/es.json
index fa92a31ba1..1181377a4d 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -5821,6 +5821,7 @@
"voice.usesOwn": "Este bot habla con su propia voz.",
"server.voice.noNoteNoVoice": "Sin nota de voz en esta respuesta: este bot todavía no tiene una voz configurada.",
"server.voice.noNoteFailed": "Sin nota de voz en esta respuesta: no se pudo generar la voz ({reason}).",
+ "server.voice.turnEnded": "Me detuve antes de terminar: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Permitir que las apps hablen con este bot",
"botApi.hint": "Las apps y los scripts envían un mensaje a {name} con una clave y reciben una respuesta. {name} responde a partir de sus instrucciones y su memoria, sin usar herramientas.",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 5bc414006a..a5a6553f2d 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -2873,6 +2873,7 @@
"voice.usesOwn": "Ce bot parle avec sa propre voix.",
"server.voice.noNoteNoVoice": "Pas de note vocale pour cette réponse : ce bot n’a pas encore de voix configurée.",
"server.voice.noNoteFailed": "Pas de note vocale pour cette réponse : la voix n’a pas pu être générée ({reason}).",
+ "server.voice.turnEnded": "Je me suis arrêté avant d’avoir fini : {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Laisser des apps parler à ce bot",
"botApi.hint": "Des apps et des scripts envoient un message à {name} avec une clé et reçoivent une réponse. {name} répond à partir de ses instructions et de sa mémoire, sans utiliser d’outils.",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index a8793ce0df..50c60f5811 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -2873,6 +2873,7 @@
"voice.usesOwn": "यह बॉट अपनी आवाज़ में बोलता है।",
"server.voice.noNoteNoVoice": "इस जवाब के साथ वॉइस नोट नहीं: इस बॉट के लिए अभी कोई आवाज़ सेट नहीं है।",
"server.voice.noNoteFailed": "इस जवाब के साथ वॉइस नोट नहीं: आवाज़ नहीं बन सकी ({reason})।",
+ "server.voice.turnEnded": "मैं पूरा करने से पहले रुक गया: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "ऐप्स को इस बॉट से बात करने दें",
"botApi.hint": "ऐप्स और स्क्रिप्ट एक कुंजी के साथ {name} को संदेश भेजते हैं और जवाब पाते हैं। {name} अपने निर्देशों और मेमोरी से जवाब देता है और उनके लिए कोई टूल इस्तेमाल नहीं करता।",
diff --git a/src/locales/it.json b/src/locales/it.json
index 417feced31..0235a95a11 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -6443,6 +6443,7 @@
"settings.threads.starter": "Starter esegue un thread alla volta per bot, un piano più grande ne esegue di più. Il lavoro che un bot avvia da solo viene comunque eseguito, e ogni bot ha il suo.",
"server.voice.noNoteNoVoice": "Nessuna nota vocale con questa risposta: questo bot non ha ancora una voce impostata.",
"server.voice.noNoteFailed": "Nessuna nota vocale con questa risposta: non è stato possibile creare la voce ({reason}).",
+ "server.voice.turnEnded": "Mi sono fermato prima di finire: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Lascia che le app parlino con questo bot",
"botApi.hint": "App e script inviano a {name} un messaggio con una chiave e ricevono una risposta. {name} risponde in base alle sue istruzioni e alla sua memoria, senza usare strumenti.",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index f9979d34cb..edd4f74d59 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -7460,6 +7460,7 @@
"settings.threads.starter": "Starter はボットごとに一度に 1 つのスレッドを実行し、より大きなプランではもっと実行できます。ボットが自分で始めた作業はそのまま実行され、ボットごとに 1 つずつ使えます。",
"server.voice.noNoteNoVoice": "この返信にはボイスノートがありません:このボットにはまだ音声が設定されていません。",
"server.voice.noNoteFailed": "この返信にはボイスノートがありません:音声を作成できませんでした({reason})。",
+ "server.voice.turnEnded": "終わる前に止まりました:{reason}",
"grokMove.intro": "Grok Bot にはエクスポートのボタンがないため、ボットごとに自分の設定を書き出してもらいます。Grok Bot 側は何も変わりません。",
"grokMove.step1": "1. ボットにこのメッセージを送る",
"grokMove.step1Hint": "コピーして、ボットのチャットで送ってください。ボットごとに 1 回ずつ行います。",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 9d56c7d142..0a2770d92b 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7168,6 +7168,7 @@
"settings.threads.starter": "Starter는 봇당 한 번에 스레드 하나를 실행하고, 더 큰 요금제는 더 많이 실행합니다. 봇이 스스로 시작한 작업은 그대로 실행되며, 봇마다 하나씩 쓸 수 있습니다.",
"server.voice.noNoteNoVoice": "이 답변에는 음성 메모가 없어요: 이 봇에 아직 목소리가 설정되지 않았어요.",
"server.voice.noNoteFailed": "이 답변에는 음성 메모가 없어요: 목소리를 만들지 못했어요 ({reason}).",
+ "server.voice.turnEnded": "끝내기 전에 멈췄어요: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "앱이 이 봇과 대화하도록 허용",
"botApi.hint": "앱과 스크립트가 키를 사용해 {name}에게 메시지를 보내고 답을 받습니다. {name}은(는) 지침과 메모리를 바탕으로 답하며 도구는 사용하지 않습니다.",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 691c3f42e5..6ec1fadc11 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -6583,6 +6583,7 @@
"settings.threads.starter": "Starter uruchamia jeden wątek naraz na bota, a większy plan więcej. Praca, którą bot zaczyna sam, i tak się wykonuje, a każdy bot ma swój wątek.",
"server.voice.noNoteNoVoice": "Brak notatki głosowej do tej odpowiedzi: ten bot nie ma jeszcze ustawionego głosu.",
"server.voice.noNoteFailed": "Brak notatki głosowej do tej odpowiedzi: nie udało się wygenerować głosu ({reason}).",
+ "server.voice.turnEnded": "Zatrzymałem się przed końcem: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Pozwól aplikacjom rozmawiać z tym botem",
"botApi.hint": "Aplikacje i skrypty wysyłają do {name} wiadomość z kluczem i otrzymują odpowiedź. {name} odpowiada na podstawie swoich instrukcji i pamięci, bez użycia narzędzi.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 1bde528338..52cea2c1a1 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -7624,6 +7624,7 @@
"settings.threads.starter": "O Starter permite uma conversa por vez em cada bot; planos maiores permitem mais. Cada bot tem sua própria vaga. O trabalho que o bot inicia por conta própria continua rodando.",
"server.voice.noNoteNoVoice": "Sem nota de voz nesta resposta: este bot ainda não tem uma voz configurada.",
"server.voice.noNoteFailed": "Sem nota de voz nesta resposta: não foi possível gerar a voz ({reason}).",
+ "server.voice.turnEnded": "Parei antes de terminar: {reason}",
"botApi.title": "API do bot",
"botApi.switch": "Permitir que apps conversem com este bot",
"botApi.hint": "Apps e scripts usam uma chave para enviar uma mensagem a {name} e receber uma resposta. {name} responde com base nas próprias instruções e na memória, sem usar ferramentas para esses pedidos.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 7dbf8a800c..f633d21ae8 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -6645,6 +6645,7 @@
"settings.threads.starter": "Starter запускает по одному потоку за раз на бота, а более крупный план запускает больше. Работа, которую бот начинает сам, всё равно выполняется, и у каждого бота свой поток.",
"server.voice.noNoteNoVoice": "Без голосовой заметки к этому ответу: у этого бота ещё не настроен голос.",
"server.voice.noNoteFailed": "Без голосовой заметки к этому ответу: не удалось создать голос ({reason}).",
+ "server.voice.turnEnded": "Я остановился, не закончив: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Разрешить приложениям общаться с этим ботом",
"botApi.hint": "Приложения и скрипты отправляют {name} сообщение с ключом и получают ответ. {name} отвечает на основе своих инструкций и памяти, не используя инструменты.",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 4e278e0f2b..ea1ab3985a 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -2839,6 +2839,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -8943,6 +8944,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.label": "7c178541b31b3154d22ec1c9948bde70b01522216b10642e738bad7bf8c84725",
"mapComposer.placeholder": "715aef017b23153206b6af1538c56c3559220f651ce0be386429b5b73ded4533",
@@ -11889,6 +11891,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -14974,6 +14977,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"server.memory.wait": "e1fd6ee64c4bc4ea9d890801de899209932b13eaaae60934b477981a8fd2ecbd",
"server.memory.still": "625014d9b0b289c26cf7144a9bca85151ef9bfccf4ae87f2c7c2cb43b2cac98c",
@@ -21707,6 +21711,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -30292,6 +30297,7 @@
"settings.threads.starter": "8837e4531b35bb772dcbdd6067cf3a494bca815a6620e7319bd01d9af0e1574f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"botApi.title": "b5b9a30456382cbc64dcd0eaeafa131023151f5d5d8993a67b4fe8ca7d44cf50",
"botApi.switch": "3126c449eed1b18d8603739a23d2ceac8a4e978d2f5094a240a95a1668a3c8bb",
"botApi.hint": "2ce35d62ef01f72041f4110a89386684c3f2dd0011d050fb3ce08b9573c3d403",
@@ -39605,6 +39611,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -44386,6 +44393,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"server.memory.wait": "e1fd6ee64c4bc4ea9d890801de899209932b13eaaae60934b477981a8fd2ecbd",
"server.memory.still": "625014d9b0b289c26cf7144a9bca85151ef9bfccf4ae87f2c7c2cb43b2cac98c",
@@ -47762,6 +47770,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"server.memory.wait": "e1fd6ee64c4bc4ea9d890801de899209932b13eaaae60934b477981a8fd2ecbd",
"server.memory.still": "625014d9b0b289c26cf7144a9bca85151ef9bfccf4ae87f2c7c2cb43b2cac98c",
@@ -53132,6 +53141,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"server.memory.wait": "e1fd6ee64c4bc4ea9d890801de899209932b13eaaae60934b477981a8fd2ecbd",
"server.memory.still": "625014d9b0b289c26cf7144a9bca85151ef9bfccf4ae87f2c7c2cb43b2cac98c",
@@ -58500,6 +58510,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"server.memory.wait": "e1fd6ee64c4bc4ea9d890801de899209932b13eaaae60934b477981a8fd2ecbd",
"server.memory.still": "625014d9b0b289c26cf7144a9bca85151ef9bfccf4ae87f2c7c2cb43b2cac98c",
@@ -65148,6 +65159,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -71857,6 +71869,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -78364,6 +78377,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
@@ -85596,6 +85610,7 @@
"voice.usesOwn": "805f5a74876e0cc769993734566d59f1d984bb861651419d9765ae458b4da91f",
"server.voice.noNoteNoVoice": "1fb14aae422d7adc8da5c5b630687004182e41df6a9b542c34ed4dc9c6ec5843",
"server.voice.noNoteFailed": "08294ebbdaa0d2d5bd7c479e6d8619c8d11b6d4a5e967ceace37f9df860a4c87",
+ "server.voice.turnEnded": "a4352f041fcd9ecea431e204ed8efbac8447f745ef86e3f2d269cb62a2d43bd9",
"server.stop.nothingRunning": "8cbd379640801817f0cfa32bc247147eaaa69428cb572512971e7091f4ca7d0c",
"mapComposer.willSendViaChief": "002eb9ef4efe4459e760b645a541b65592a3c706eb9f1fe606bd88a601270f92",
"mapComposer.sentViaChief": "d041c2b20ba17c607f7195d1a40a4dfbac05e9749aa2471de3341e70d7f0aae1",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index a3ea664493..74c8956f6a 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -5304,6 +5304,7 @@
"voice.usesOwn": "Bu bot kendi sesiyle konuşur.",
"server.voice.noNoteNoVoice": "Bu yanıt için sesli not yok: bu botun henüz ayarlanmış bir sesi yok.",
"server.voice.noNoteFailed": "Bu yanıt için sesli not yok: ses oluşturulamadı ({reason}).",
+ "server.voice.turnEnded": "Bitirmeden durdum: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Uygulamaların bu botla konuşmasına izin ver",
"botApi.hint": "Uygulamalar ve betikler bir anahtarla {name} adlı bota mesaj gönderir ve yanıt alır. {name} talimatlarına ve belleğine göre yanıtlar, bunun için araç kullanmaz.",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 03fff1a441..bcc5cbc489 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -3314,6 +3314,7 @@
"voice.usesOwn": "Цей бот говорить власним голосом.",
"server.voice.noNoteNoVoice": "Без голосової нотатки до цієї відповіді: цей бот ще не має налаштованого голосу.",
"server.voice.noNoteFailed": "Без голосової нотатки до цієї відповіді: не вдалося створити голос ({reason}).",
+ "server.voice.turnEnded": "Я зупинився, не завершивши: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Дозволити застосункам говорити з цим ботом",
"botApi.hint": "Застосунки та скрипти надсилають {name} повідомлення з ключем і отримують відповідь. {name} відповідає на основі своїх інструкцій і пам’яті, не використовуючи інструменти.",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 4e5c090946..5ba95abdc0 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -5304,6 +5304,7 @@
"voice.usesOwn": "Bot này nói bằng giọng riêng.",
"server.voice.noNoteNoVoice": "Không có ghi chú thoại cho câu trả lời này: bot này chưa được thiết lập giọng nói.",
"server.voice.noNoteFailed": "Không có ghi chú thoại cho câu trả lời này: không tạo được giọng nói ({reason}).",
+ "server.voice.turnEnded": "Tôi đã dừng trước khi xong: {reason}",
"botApi.title": "Bot API",
"botApi.switch": "Cho ứng dụng trò chuyện với bot này",
"botApi.hint": "Ứng dụng và script gửi tin nhắn cho {name} kèm một khóa và nhận câu trả lời. {name} trả lời dựa trên hướng dẫn và bộ nhớ của mình, không dùng công cụ.",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index bd76d0bb2c..9c23a0378e 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -4696,6 +4696,7 @@
"voice.usesOwn": "這個機器人用自己的聲音說話。",
"server.voice.noNoteNoVoice": "這則回覆沒有語音留言:這個機器人還沒有設定聲音。",
"server.voice.noNoteFailed": "這則回覆沒有語音留言:無法產生聲音({reason})。",
+ "server.voice.turnEnded": "我在完成前停下了:{reason}",
"botApi.title": "Bot API",
"botApi.switch": "允許應用程式與此機器人對話",
"botApi.hint": "應用程式和指令碼憑金鑰向{name}傳送訊息並取得回覆。{name}根據自己的指示和記憶回答,不使用任何工具。",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index f5172a9403..a3021fa449 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -7388,6 +7388,7 @@
"settings.threads.starter": "Starter 每个机器人一次运行一个对话,更大的方案可以运行更多。机器人自己发起的工作仍会运行,每个机器人各有一个。",
"server.voice.noNoteNoVoice": "这条回复没有语音留言:这个机器人还没有设置声音。",
"server.voice.noNoteFailed": "这条回复没有语音留言:无法生成声音({reason})。",
+ "server.voice.turnEnded": "我在完成前停下了:{reason}",
"botApi.title": "Bot API",
"botApi.switch": "允许应用与此机器人对话",
"botApi.hint": "应用和脚本凭密钥向{name}发送消息并获得回复。{name}根据自己的指示和记忆回答,不使用任何工具。",