osborn 0.9.33 → 0.9.34
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.
- package/dist/index.js +18 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3081,10 +3081,27 @@ async function main() {
|
|
|
3081
3081
|
clearInterval(readyInterval);
|
|
3082
3082
|
console.log('✅ agent_ready retries complete');
|
|
3083
3083
|
}, 20000);
|
|
3084
|
-
// Stop agent_ready retries on user speech
|
|
3084
|
+
// Stop agent_ready retries on user speech, and interrupt agent TTS at VAD onset.
|
|
3085
|
+
// Previously the interrupt only fired when STT committed a full transcript (chat()
|
|
3086
|
+
// call), which let the agent talk over the user for the full utterance. Firing it
|
|
3087
|
+
// here cuts TTS the moment VAD detects speech.
|
|
3088
|
+
// Realtime providers (OpenAI/Gemini) handle interruption server-side via their own
|
|
3089
|
+
// VAD — calling interrupt() manually for Gemini specifically crashes its state
|
|
3090
|
+
// machine (code 1008, hangs in 'speaking'), so skip those.
|
|
3085
3091
|
session.on('input_speech_started', () => {
|
|
3086
3092
|
readySent = true;
|
|
3087
3093
|
clearInterval(readyInterval);
|
|
3094
|
+
if (agentState !== 'speaking')
|
|
3095
|
+
return;
|
|
3096
|
+
if (sessionVoiceMode === 'realtime')
|
|
3097
|
+
return;
|
|
3098
|
+
try {
|
|
3099
|
+
console.log('🎤 VAD onset → interrupting agent TTS');
|
|
3100
|
+
currentSession?.interrupt();
|
|
3101
|
+
}
|
|
3102
|
+
catch (err) {
|
|
3103
|
+
console.warn('⚠️ VAD-onset interrupt failed:', err instanceof Error ? err.message : err);
|
|
3104
|
+
}
|
|
3088
3105
|
});
|
|
3089
3106
|
// Greet user via TTS (delayed if resume prompt will be shown)
|
|
3090
3107
|
// For realtime mode: use generateReply() since there's no standalone TTS
|