@voicethere/agent 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1063,19 +1063,15 @@ function startSwitch(sessionId, state) {
1063
1063
  });
1064
1064
  }
1065
1065
  async function runSwitch(sessionId, state, language, previous) {
1066
- const tts = await setVoiceLanguage(sessionId, {
1067
- scope: "tts",
1068
- language,
1069
- voice: language
1070
- });
1071
- logSwitch(sessionId, "tts", tts);
1072
- const stt = await setVoiceLanguage(sessionId, {
1073
- scope: "stt",
1066
+ const result = await setVoiceLanguage(sessionId, {
1067
+ scope: "both",
1074
1068
  language,
1069
+ voice: language,
1075
1070
  stt: language
1076
1071
  });
1077
- logSwitch(sessionId, "stt", stt);
1078
- if (!tts.ok) {
1072
+ logSwitch(sessionId, "tts", result);
1073
+ logSwitch(sessionId, "stt", result);
1074
+ if (!result.ok) {
1079
1075
  state.suppressNextFinal = false;
1080
1076
  speak(
1081
1077
  sessionId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicethere/agent",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "VoiceThere customer agent SDK — IPC types and runtime helpers for sandboxed child bundles",
5
5
  "type": "module",
6
6
  "exports": {
@@ -225,21 +225,17 @@ async function runSwitch(
225
225
  language: string,
226
226
  previous: string,
227
227
  ): Promise<void> {
228
- const tts = await setVoiceLanguage(sessionId, {
229
- scope: "tts",
228
+ // One call for both sides so the TTS and STT pools resolve in parallel.
229
+ const result = await setVoiceLanguage(sessionId, {
230
+ scope: "both",
230
231
  language,
231
232
  voice: language,
232
- });
233
- logSwitch(sessionId, "tts", tts);
234
-
235
- const stt = await setVoiceLanguage(sessionId, {
236
- scope: "stt",
237
- language,
238
233
  stt: language,
239
234
  });
240
- logSwitch(sessionId, "stt", stt);
235
+ logSwitch(sessionId, "tts", result);
236
+ logSwitch(sessionId, "stt", result);
241
237
 
242
- if (!tts.ok) {
238
+ if (!result.ok) {
243
239
  state.suppressNextFinal = false;
244
240
  // Switch failed (for example a timeout): the voice is unchanged, so
245
241
  // apologise in the old language and stay.