Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: preserve namespaced character voices in hosted turns (#5385)

Adam Eivye43bb6def2d4
diff --git a/server/services/fableLoom/hostedSession.js b/server/services/fableLoom/hostedSession.js
index 54583d6373..1557e629e4 100644
--- a/server/services/fableLoom/hostedSession.js
+++ b/server/services/fableLoom/hostedSession.js
@@ -43,6 +43,7 @@ import {
playTurn,
} from './weave.js';
import { getUniverse } from '../universeBuilder.js';
+import { parseVoiceId } from '../pipeline/audio.js';
// Active hosted sessions in memory (ephemeral, machine-local)
const activeSessions = new Map();
@@ -594,12 +595,17 @@ export async function processHostedUtterance(sessionId, {
characterVoiceId: char?.voiceId,
route: 'interactive',
}).catch(() => null);
+ const { engine, voice } = parseVoiceId(resolved?.voiceId);
const synth = await synthesize(narration, {
+ engine: engine || undefined,
profileId: resolved?.profileId || undefined,
route: 'interactive',
- voice: resolved?.voiceId || undefined,
- }).catch(() => null);
+ voice: voice || undefined,
+ }).catch((err) => {
+ console.warn(`[HostedPlay] Protagonist TTS synthesis failed: ${err.message}`);
+ return null;
+ });
if (synth?.wav) {
ttsAudio = synth.wav;
}
diff --git a/server/services/fableLoom/hostedSession.test.js b/server/services/fableLoom/hostedSession.test.js
index 91c9e70cfa..fd398c2e31 100644
--- a/server/services/fableLoom/hostedSession.test.js
+++ b/server/services/fableLoom/hostedSession.test.js
@@ -223,7 +223,7 @@ describe('fableLoom hostedSession', () => {
source: 'profile',
profileId: 'voice-profile-1',
profileRevision: 3,
- voiceId: 'qwen3:character-1',
+ voiceId: 'qwen3-tts:character-1',
degraded: false,
warning: null,
});
@@ -236,9 +236,40 @@ describe('fableLoom hostedSession', () => {
await processHostedUtterance(session.id, { textMessage: 'Can you hear me?' });
expect(tts.synthesize).toHaveBeenCalledWith('The signal is clear.', {
+ engine: 'qwen3-tts',
profileId: 'voice-profile-1',
route: 'interactive',
- voice: 'qwen3:character-1',
+ voice: 'character-1',
+ });
+ });
+
+ it('splits a namespaced character preset before live synthesis', async () => {
+ const { session } = await createHostedSession('loom-1', 'ep-1');
+ await startHostedListening(session.id);
+ vi.spyOn(universeBuilder, 'getUniverse').mockResolvedValue({
+ characters: [{ id: 'character-1', voiceId: 'kokoro:af_heart' }],
+ });
+ vi.spyOn(voiceProfiles, 'resolveCharacterVoice').mockResolvedValue({
+ source: 'character-preset',
+ profileId: null,
+ profileRevision: null,
+ voiceId: 'kokoro:af_heart',
+ degraded: false,
+ warning: null,
+ });
+ vi.spyOn(weave, 'playTurn').mockResolvedValue({
+ action: 'stay',
+ narration: 'Stay on the line.',
+ node: { id: 'node-start' },
+ });
+
+ await processHostedUtterance(session.id, { textMessage: 'Hello?' });
+
+ expect(tts.synthesize).toHaveBeenCalledWith('Stay on the line.', {
+ engine: 'kokoro',
+ profileId: undefined,
+ route: 'interactive',
+ voice: 'af_heart',
});
});