Skip to content

-> Prod#259

Merged
ariksfaradi merged 12 commits intoprodfrom
main
Jan 11, 2026
Merged

-> Prod#259
ariksfaradi merged 12 commits intoprodfrom
main

Conversation

@ariksfaradi
Copy link
Copy Markdown
Contributor

@ariksfaradi ariksfaradi commented Jan 6, 2026

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.

  • LiveKit microphone input: New publishMicrophoneStream/unpublishMicrophoneStream on streaming manager and AgentManager; demo app UI to enable/disable mic and select audio input; hook exposes mic controls and state
  • Abortable stream APIs: createStream, startConnection, addIceCandidate accept AbortSignal; plumbed through factory/WebRTC manager and guarded in initialization with AbortController
  • Event handling & analytics: Add onStreamReady callback and streamReadyTimestampTracker; handle chat/audio-transcribed over data channel; improved message queue to support transcribed user messages; enrich analytics with stream version
  • Agent manager/options: mode now optional with default; improved error mapping for insufficient credits; refined retry conditions
  • Tests & version: Extensive new tests for LiveKit mic flows, abort/error paths, and ICE signaling; bump version to 1.1.22

Written by Cursor Bugbot for commit f7b0b90. Configure here.

ariksfaradi and others added 8 commits December 30, 2025 10:43
* 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
Copy link
Copy Markdown
Contributor

@dor-eitan dor-eitan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 || '',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

}
}, [agentManager, connectionState]);

const publishMicrophoneStream = useCallback(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web


const userMessage: Message = {
id: data.id || `user-${Date.now()}`,
role: data.role,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'.

Fix in Cursor Fix in Web

@ariksfaradi ariksfaradi merged commit f2483cc into prod Jan 11, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants