-> Prod#259
Conversation
* abort stream connection when create chat failed * fix tests * add tests * fix pr comments * remove abort checks, fetch abort automatically * fix pr comment, replace set timeout with promise.resolve
* handle livekit datachannel stream events * prettier * CR
* session ready load time * CR * remove log * fix + add test
* add microphone stream tracking option * add mic stream option in agent manager options * Publish the MediaStreamTrack directly * split transribe events from answers * handle case when message role is user - add it to messages if its transcribed do not override last conent of message if its transcirbed * expose publsihMicrophoneStream to give more control to the client when to use the stream instead of passing it and decide for him * prevent issues when Multiple tracks published sumultaneosly or duplocate track publishing * expose in manager * demo adaptations * enable/disable microphone in app expose unpublishMicrophon * default to empty string if not provided * tests
dor-eitan
left a comment
There was a problem hiding this comment.
@ariksfaradi dont forget to bump the version before you merge
…alue of ChatMode.Functional (#261) * Update agent manager options to make 'mode' optional with a default value of ChatMode.Functional * createAgentManager add default * createAgentManager add default
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Comment @cursor review or bugbot run to trigger another review on this PR
| currentMessage = { | ||
| id: data.id || `assistant-${Date.now()}`, | ||
| role: data.role || 'assistant', | ||
| content: data.content || '', |
There was a problem hiding this comment.
Unused variable causes incorrect message content initialization
Medium Severity
The variable initialContent is declared on line 67 to differentiate between Answer and Partial events (setting content to data.content for answers, or empty string for partials), but it's never used. The content field on line 71 is set to data.content || '' directly instead of initialContent. This means when a ChatProgress.Partial event arrives after a transcribed user message, the assistant message is incorrectly initialized with the partial content data instead of an empty string. The content should build up through the chatEventQueue mechanism, but this bug causes potential duplicate or incorrect content display.
| } | ||
| }, [agentManager, connectionState]); | ||
|
|
||
| const publishMicrophoneStream = useCallback( |
There was a problem hiding this comment.
Microphone state not reset on disconnect breaks reconnection
Medium Severity
The disconnect callback resets agentManager, srcObject, connectionState, and messages but does not reset isMicrophonePublished to false. When a user disconnects and later reconnects, isMicrophonePublished remains true from the previous session. This causes the auto-publish effect in app.tsx (which checks !isMicrophonePublished) to skip publishing the microphone stream, breaking automatic microphone activation on reconnection.
|
|
||
| const userMessage: Message = { | ||
| id: data.id || `user-${Date.now()}`, | ||
| role: data.role, |
There was a problem hiding this comment.
Missing role default causes assistant responses to be dropped
High Severity
In handleAudioTranscribedMessage, the role field is set directly from data.role without a default value. If the server sends an audio-transcribed message without a role field, the message is created with role: undefined. Subsequently in processChatEvent, the condition lastMessage?.transcribed && lastMessage.role === 'user' (line 66) fails because undefined !== 'user'. This causes the code to fall through to the early return statement, silently dropping the assistant's response to the transcribed message. The role for audio transcribed messages representing user speech needs to default to 'user'.
…x/sync-prod-to-main * 'prod' of https://github.com/de-id/agents-sdk: main > prod (#256)
Bugfix/sync prod to main
Note
Adds microphone streaming to expressive (LiveKit) sessions, introduces abortable stream API calls, and enhances event/analytics handling, with demo UI updates and broad test coverage.
publishMicrophoneStream/unpublishMicrophoneStreamon streaming manager andAgentManager; demo app UI to enable/disable mic and select audio input; hook exposes mic controls and statecreateStream,startConnection,addIceCandidateacceptAbortSignal; plumbed through factory/WebRTC manager and guarded in initialization withAbortControlleronStreamReadycallback andstreamReadyTimestampTracker; handlechat/audio-transcribedover data channel; improved message queue to support transcribed user messages; enrich analytics with stream versionmodenow optional with default; improved error mapping for insufficient credits; refined retry conditions1.1.22Written by Cursor Bugbot for commit f7b0b90. Configure here.