osborn 0.9.117 → 0.9.119
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 +68 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2651,44 +2651,46 @@ async function main() {
|
|
|
2651
2651
|
// Wire up TTS say — bypass LiveKit's BufferedTokenStream, speak directly via session.say()
|
|
2652
2652
|
// Each text block from Claude gets spoken immediately as it arrives, no internal buffering
|
|
2653
2653
|
directLLM.events.on('tts_say', (data) => {
|
|
2654
|
-
// Guard: session must be alive — TTS errors can kill the session while background query runs
|
|
2655
|
-
if (!currentSession) {
|
|
2656
|
-
console.warn(`⚠️ tts_say fired but currentSession is null — text dropped (${data.text?.length || 0} chars): "${data.text || ''}"`);
|
|
2657
|
-
return;
|
|
2658
|
-
}
|
|
2659
2654
|
if (!data.text?.trim()) {
|
|
2660
2655
|
console.log(`🔇 tts_say fired but text is empty — skipping`);
|
|
2661
2656
|
return;
|
|
2662
2657
|
}
|
|
2663
|
-
//
|
|
2664
|
-
//
|
|
2665
|
-
//
|
|
2666
|
-
//
|
|
2658
|
+
// MEETING PATH (fix 2026-08-01) — runs BEFORE the currentSession guard.
|
|
2659
|
+
// A meeting reply routes to the meeting via speakIntoMeeting → Recall
|
|
2660
|
+
// output_audio, which needs NO LiveKit voice session. Keeping this ahead
|
|
2661
|
+
// of the guard is what lets the bot keep replying AFTER the browser voice
|
|
2662
|
+
// session dropped (currentLLM is deliberately kept alive for exactly this;
|
|
2663
|
+
// see handleParticipantDisconnected). Before the fix a participant blip
|
|
2664
|
+
// nulled currentSession and EVERY meeting reply was "text dropped" — the
|
|
2665
|
+
// deaf-bot bug proven live 2026-08-01 via synthetic transcript inject.
|
|
2666
|
+
// Set by PipelineDirectLLM.chat() when the turn is a [MEETING —] chunk.
|
|
2667
2667
|
if (directLLM.suppressMeetingTTS) {
|
|
2668
|
-
//
|
|
2669
|
-
//
|
|
2670
|
-
//
|
|
2671
|
-
|
|
2672
|
-
if (
|
|
2668
|
+
// Parity relay (behind OSBORN_MEETING_AUDIO=parity) speaks via
|
|
2669
|
+
// session.say, so it still needs a live session — it falls through to
|
|
2670
|
+
// the normal browser-TTS path below only when currentSession exists.
|
|
2671
|
+
const parity = process.env.OSBORN_MEETING_AUDIO === 'parity' && meetingCanvasInRoom && activeMeetingBotId && Date.now() < meetingAddressedUntil && !!currentSession;
|
|
2672
|
+
if (parity) {
|
|
2673
2673
|
console.log(`🔊🎼 meeting reply via NATIVE session.say (canvas relays): "${data.text.slice(0, 50)}"`);
|
|
2674
2674
|
markMeetingSpeaking(data.text);
|
|
2675
|
-
//
|
|
2676
|
-
}
|
|
2677
|
-
else
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
if (activeMeetingBotId && Date.now() < meetingAddressedUntil) {
|
|
2682
|
-
// ONE say per reply (2026-08-01 quality directive): chunking created
|
|
2683
|
-
// seams no scheduler fully hid. A single utterance = a single clean
|
|
2684
|
-
// audio file = zero seams — quality over ~1s of latency. (Structural
|
|
2685
|
-
// fix queued: canvas as LiveKit subscriber playing the agent's real
|
|
2686
|
-
// TTS track — the true "same browser experience" reuse.)
|
|
2675
|
+
// fall through to normal browser TTS (currentSession present)
|
|
2676
|
+
}
|
|
2677
|
+
else if (activeMeetingBotId && Date.now() < meetingAddressedUntil) {
|
|
2678
|
+
// NATIVE sink: one clean output_audio push into the meeting, NO
|
|
2679
|
+
// LiveKit session required — this is the path that survives a
|
|
2680
|
+
// voice-session drop.
|
|
2687
2681
|
console.log(`🔊➡️📢 tts_say → meeting (native audio) t=${new Date().toISOString()}: "${data.text.slice(0, 60)}"`);
|
|
2688
2682
|
void speakIntoMeeting(data.text);
|
|
2689
2683
|
return;
|
|
2690
2684
|
}
|
|
2691
|
-
|
|
2685
|
+
else {
|
|
2686
|
+
console.log(`🔇 tts_say suppressed (meeting turn — response goes to /canvas, not browser): "${data.text.slice(0, 60)}"`);
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
// NORMAL BROWSER TTS (and the parity fall-through): needs a live session.
|
|
2691
|
+
// TTS errors can kill the session while a background query still runs.
|
|
2692
|
+
if (!currentSession) {
|
|
2693
|
+
console.warn(`⚠️ tts_say fired but currentSession is null — text dropped (${data.text?.length || 0} chars): "${data.text || ''}"`);
|
|
2692
2694
|
return;
|
|
2693
2695
|
}
|
|
2694
2696
|
// Suppress while the user is mid-utterance. Without this, agent text generated
|
|
@@ -4149,6 +4151,17 @@ async function main() {
|
|
|
4149
4151
|
// Close handler with auto-recovery for crashes (both realtime and direct modes)
|
|
4150
4152
|
sess.on('close', async (ev) => {
|
|
4151
4153
|
console.log('🚪 Session closed:', ev.reason);
|
|
4154
|
+
// ORPHAN-BOT GUARD (fix 2026-08-01): an abrupt AgentSession close
|
|
4155
|
+
// (e.g. a driver tab killed → reason 'user_initiated', with NO clean
|
|
4156
|
+
// ParticipantDisconnected) must not leave the Recall bot stuck in-call
|
|
4157
|
+
// draining credits. Arm the meeting leave-grace so endMeeting() fires
|
|
4158
|
+
// (bot leaves + LLM released) once the room is genuinely empty. A rejoin
|
|
4159
|
+
// cancels it; error/disconnected closes still auto-recover below and the
|
|
4160
|
+
// grace is harmless there (recovery + rejoin cancels it).
|
|
4161
|
+
if (activeMeetingBotId) {
|
|
4162
|
+
console.log('📽️ Meeting active on session close — arming leave-grace (bot leaves if no user returns)');
|
|
4163
|
+
armMeetingLeaveGrace();
|
|
4164
|
+
}
|
|
4152
4165
|
// TTS abort from user interruption — SDK already killed the session internally,
|
|
4153
4166
|
// so we MUST recover (can't just reset state — STT pipeline is dead).
|
|
4154
4167
|
// Log it distinctly so we know it's an interrupt recovery, not a real crash.
|
|
@@ -4533,24 +4546,34 @@ async function main() {
|
|
|
4533
4546
|
})();
|
|
4534
4547
|
}
|
|
4535
4548
|
currentAgent = null;
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4549
|
+
if (activeMeetingBotId) {
|
|
4550
|
+
// MEETING SURVIVES A VOICE-SESSION DROP (fix 2026-08-01). The bot's brain
|
|
4551
|
+
// is the persistent Claude LLM; killing it on every participant blip left
|
|
4552
|
+
// the Recall bot permanently DEAF mid-call ("Addressed" fired but never
|
|
4553
|
+
// "Flushed" — currentLLM was null; proven via synthetic transcript inject).
|
|
4554
|
+
// Keep currentLLM alive so meeting transcripts still flush + reply
|
|
4555
|
+
// (speakIntoMeeting is Recall-direct, needs no LiveKit session). The
|
|
4556
|
+
// leave-grace below owns teardown: if the user is truly gone at 75s,
|
|
4557
|
+
// endMeeting() releases the LLM (its !userPresent branch). A rejoin cancels
|
|
4558
|
+
// the grace. DO NOT arm the 20s fast-leave here — it would destroy the room
|
|
4559
|
+
// before the meeting grace and orphan the bot; the meeting grace is the
|
|
4560
|
+
// single teardown while a meeting is live.
|
|
4561
|
+
console.log('📽️ Meeting active — keeping currentLLM alive across the voice-session drop (leave-grace owns teardown)');
|
|
4562
|
+
armMeetingLeaveGrace();
|
|
4563
|
+
}
|
|
4564
|
+
else {
|
|
4565
|
+
// Kill the Claude SDK subprocess BEFORE dropping the reference, otherwise the
|
|
4566
|
+
// persistent session keeps running tools and pushing TTS into a dead session.
|
|
4567
|
+
killCurrentLLM('participant_disconnected');
|
|
4568
|
+
currentLLM = null;
|
|
4569
|
+
clearFastBrainSession();
|
|
4570
|
+
clearPipelineFastBrainSession();
|
|
4571
|
+
// Auto-leave path for a NON-meeting session. 0.9.83: a real session just
|
|
4572
|
+
// ended → use the FAST leave (~20s), not the 3-min alone grace. Fires even
|
|
4573
|
+
// on an abrupt tab close; cancelled if a user rejoins within the grace.
|
|
4574
|
+
armMeetingLeaveGrace(); // no-op when no meeting, kept for symmetry
|
|
4575
|
+
armFastLeaveTimer();
|
|
4576
|
+
}
|
|
4554
4577
|
console.log('⏳ Waiting for new user...\n');
|
|
4555
4578
|
};
|
|
4556
4579
|
const handleDataReceived = async (payload, participant, kind, topic) => {
|