fix(tts): fail fast when no delivery channel is bound

Prevents TTS tool from hanging indefinitely in isolated cron 
sessions where no channel is bound for audio delivery.

Part of #43483
This commit is contained in:
Hiago Silva 2026-03-16 08:44:00 -03:00 committed by GitHub
parent fba394c56b
commit fdc003bb3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,11 +27,25 @@ export function createTtsTool(opts?: {
const params = args as Record<string, unknown>;
const text = readStringParam(params, "text", { required: true });
const channel = readStringParam(params, "channel");
const resolvedChannel = channel ?? opts?.agentChannel;
const cfg = opts?.config ?? loadConfig();
if (!resolvedChannel) {
return {
content: [
{
type: "text",
text: "TTS requires a bound channel for audio delivery. Use sessionTarget: \"main\" or provide a channel parameter.",
},
],
details: { error: "no_channel" },
};
}
const result = await textToSpeech({
text,
cfg,
channel: channel ?? opts?.agentChannel,
channel: resolvedChannel,
});
if (result.success && result.audioPath) {