Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/manual-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
working-directory: agents-ui
run: |
if [ -f .npmrc.template ]; then
sed "s/\$NPM_AUTH_TOKEN/${{ secrets.NPM_TOKEN }}/g" .npmrc.template > .npmrc
sed "s/\$NPM_AUTH_TOKEN/${{ secrets.NPM_PACKAGE_UPLOAD_TOKEN }}/g" .npmrc.template > .npmrc
fi

- name: Install local SDK build in agents-ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-main-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
working-directory: agents-ui
run: |
if [ -f .npmrc.template ]; then
sed "s/\$NPM_AUTH_TOKEN/${{ secrets.NPM_TOKEN }}/g" .npmrc.template > .npmrc
sed "s/\$NPM_AUTH_TOKEN/${{ secrets.NPM_PACKAGE_UPLOAD_TOKEN }}/g" .npmrc.template > .npmrc
fi

- name: Install local SDK build in agents-ui
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-prod-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:

- name: Render .npmrc for agents-ui
working-directory: agents-ui
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_PACKAGE_UPLOAD_TOKEN }}
run: |
if [ -f .npmrc.template ]; then
envsubst < .npmrc.template > .npmrc
fi
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install staging SDK version
working-directory: agents-ui
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
sudo chmod +x /usr/local/bin/logger

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGE_UPLOAD_TOKEN }}
run: |
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
logger -l info -m "🔍 DRY RUN MODE: Would publish version ${{ steps.version.outputs.version }} with tag ${{ steps.version.outputs.tag }}"
Expand Down
20 changes: 11 additions & 9 deletions src/services/streaming-manager/livekit-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import type {
import { createVideoStatsMonitor } from './stats/poll';
import { VideoRTCStatsReport } from './stats/report';

const TRACK_SUBSCRIPTION_TIMEOUT_MS = 20000;

async function importLiveKit(): Promise<{
Room: typeof Room;
RoomEvent: typeof RoomEvent;
Expand Down Expand Up @@ -93,7 +95,7 @@ export async function createLiveKitStreamingManager<T extends CreateSessionV2Opt

const { Room, RoomEvent, ConnectionState: LiveKitConnectionState, Track } = await importLiveKit();

const { callbacks, auth, baseURL, analytics, microphoneStream } = options;
const { callbacks, auth, baseURL, analytics } = options;
let room: Room | null = null;
let isConnected = false;
const streamType = StreamType.Fluent;
Expand All @@ -110,7 +112,6 @@ export async function createLiveKitStreamingManager<T extends CreateSessionV2Opt
});

let trackSubscriptionTimeoutId: ReturnType<typeof setTimeout> | null = null;
const TRACK_SUBSCRIPTION_TIMEOUT_MS = 20000;
let currentActivityState: AgentActivityState = AgentActivityState.Idle;

const streamApi = createStreamApiV2(auth, baseURL || didApiUrl, agentId, callbacks.onError);
Expand Down Expand Up @@ -166,7 +167,9 @@ export async function createLiveKitStreamingManager<T extends CreateSessionV2Opt
log('LiveKit room joined successfully');

trackSubscriptionTimeoutId = setTimeout(() => {
log('Track subscription timeout - no track subscribed within 30 seconds after connect');
log(
`Track subscription timeout - no track subscribed within ${TRACK_SUBSCRIPTION_TIMEOUT_MS / 1000} seconds after connect`
);
trackSubscriptionTimeoutId = null;
analytics.track('connectivity-error', {
error: 'Track subscription timeout',
Expand Down Expand Up @@ -252,12 +255,6 @@ export async function createLiveKitStreamingManager<T extends CreateSessionV2Opt
function handleTrackSubscribed(track: RemoteTrack, publication: any, participant: RemoteParticipant): void {
log(`Track subscribed: ${track.kind} from ${participant.identity}`);

if (trackSubscriptionTimeoutId) {
clearTimeout(trackSubscriptionTimeoutId);
trackSubscriptionTimeoutId = null;
log('Track subscription timeout cleared');
}

const mediaStreamTrack = track.mediaStreamTrack;
if (!mediaStreamTrack) {
log(`No mediaStreamTrack available for ${track.kind}`);
Expand Down Expand Up @@ -289,6 +286,11 @@ export async function createLiveKitStreamingManager<T extends CreateSessionV2Opt
(state, report) => {
log(`Video state change: ${state}`);
if (state === StreamingState.Start) {
if (trackSubscriptionTimeoutId) {
clearTimeout(trackSubscriptionTimeoutId);
trackSubscriptionTimeoutId = null;
log('Track subscription timeout cleared');
}
handleVideoStarted();
} else if (state === StreamingState.Stop) {
handleVideoStopped(report);
Expand Down