@sanseng/livekit-ws-sdk 0.1.20 → 1.0.0

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.d.ts CHANGED
@@ -79,6 +79,7 @@ interface AudioEvents {
79
79
  'inner:audio:input:started': void;
80
80
  'inner:audio:input:stopped': void;
81
81
  'inner:audio:frame:received': { data: Float32Array; sampleRate: number };
82
+ 'inner:audio:no_speech:reported': { silenceDurationMs: number; timestamp: number };
82
83
  /**
83
84
  * Raw audio payload event
84
85
  * Contains PCM audio data and metadata (without protocol header)
@@ -134,6 +135,7 @@ interface AudioEvents {
134
135
  'inner:audio:track:added': { trackId: string; participantId: string };
135
136
  'inner:audio:track:removed': { trackId: string };
136
137
  'inner:audio:volume:changed': { volume: number };
138
+ 'inner:audio:speaking:changed': { participantId: string; isSpeaking: boolean };
137
139
  'inner:audio:muted': void;
138
140
  'inner:audio:unmuted': void;
139
141
  }
@@ -160,8 +162,11 @@ interface ConversationEvents {
160
162
  'inner:conversation:answer:chunk': { questionId: string; chunk: string; isComplete: boolean };
161
163
  'inner:conversation:answer:completed': { questionId: string; fullAnswer: string };
162
164
  'inner:conversation:server:message': { questionId: string; message: string; type: string };
165
+ 'inner:conversation:asr:chunk': { questionId: string; text: string; isComplete: boolean };
163
166
  'inner:conversation:asr:received': { questionId: string; text: string };
164
167
  'inner:conversation:server:command': { code: number; command: string };
168
+ 'inner:conversation:voice:start': { requestId: string };
169
+ 'inner:conversation:voice:finish': { requestId: string };
165
170
  }
166
171
 
167
172
  /**
@@ -171,14 +176,14 @@ interface ConversationEvents {
171
176
  * @interface ConnectionEvents
172
177
  */
173
178
  interface ConnectionEvents {
174
- 'inner:sdk:connected': { source: 'livekit' | 'ws' | 'http' };
175
- 'inner:sdk:disconnected': { source: 'livekit' | 'ws' | 'http'; reason?: string };
179
+ 'inner:sdk:connected': { source: 'livekit' | 'http' };
180
+ 'inner:sdk:disconnected': { source: 'livekit' | 'http'; reason?: string };
176
181
  'inner:sdk:error': { error: Error };
177
182
  }
178
183
 
179
184
  /**
180
- * Internal connection fact events (rtc/ws only).
181
- * Emitted by rtc and transport modules; coordinator aggregates and drives FSM.
185
+ * Internal connection fact events (rtc).
186
+ * Emitted by rtc; coordinator aggregates and drives FSM.
182
187
  * Must NOT emit sdk:connected / sdk:disconnected.
183
188
  *
184
189
  * @author sansen
@@ -188,8 +193,6 @@ interface InternalConnectionFactEvents {
188
193
  'inner:rtc:disconnected': { reason?: string };
189
194
  'inner:rtc:video:available': void;
190
195
  'inner:rtc:video:unavailable': void;
191
- 'inner:ws:connected': void;
192
- 'inner:ws:disconnected': { reason?: string };
193
196
  }
194
197
 
195
198
  /**
@@ -201,7 +204,8 @@ interface InternalConnectionFactEvents {
201
204
  */
202
205
  interface PublicSDKEvents {
203
206
  // Connection status
204
- 'sdk:connected': { livekit: boolean; ws: boolean; http: boolean; all: boolean };
207
+ /** `all` = livekit && http */
208
+ 'sdk:connected': { livekit: boolean; http: boolean; all: boolean };
205
209
  'sdk:disconnected': { reason?: string };
206
210
  'sdk:error': { message: string; code: string };
207
211
 
@@ -227,6 +231,7 @@ interface PublicSDKEvents {
227
231
  'conversation:question:sent': { questionId: string; text: string };
228
232
  'conversation:answer:waiting': { questionId: string };
229
233
  'conversation:server:message': { questionId: string; message: string; type: string };
234
+ 'conversation:asr:chunk': { questionId: string; text: string; isComplete: boolean };
230
235
  'conversation:asr:received': { questionId: string; text: string };
231
236
  'conversation:answer:chunk': { questionId: string; chunk: string; isComplete: boolean };
232
237
  'conversation:answer:completed': { questionId: string; fullAnswer: string };
@@ -257,6 +262,11 @@ type EventListener<T = unknown> = (data: T) => void;
257
262
  * Event Bus
258
263
  * Implements observer pattern for decoupled communication between modules
259
264
  *
265
+ * @remarks Internal vs public events:
266
+ * - Subsystems emit **factual** events on this bus using `inner:*` keys (and occasional `sdk:*` aggregates from {@link import('@/client/ConnectionLifecycleCoordinator').ConnectionLifecycleCoordinator}).
267
+ * - Application code must subscribe via {@link import('./publicEvents').PublicEventEmitter} (`SDKClient.events`), which maps a whitelist of `inner:*` → stable `media:*` / `conversation:*` / `sdk:*` names and strips sensitive shapes.
268
+ * - Do not treat every `inner:*` emission as a stable API; only forwarded public names in {@link import('./publicEvents').ALLOWED_EVENTS} are supported for external listeners.
269
+ *
260
270
  * @author sansen
261
271
  * @class EventBus
262
272
  * @extends {Disposable}
@@ -352,7 +362,7 @@ declare enum SessionStatus {
352
362
  */
353
363
  CONNECTED = "connected",
354
364
  /**
355
- * Partially connected (e.g. only RTC or only WS)
365
+ * Partially connected (e.g. only HTTP session or only LiveKit)
356
366
  *
357
367
  * @author sansen
358
368
  */
@@ -407,7 +417,9 @@ declare class SessionState {
407
417
  status: SessionStatus;
408
418
  state: SessionStatus;
409
419
  /**
410
- * Indicates if currently connected to server (both rtc and ws when fully connected)
420
+ * True when FSM is `connected`.
421
+ * - direct mode: LiveKit RTC connected
422
+ * - auth mode: HTTP config/session + LiveKit RTC connected
411
423
  *
412
424
  * @type {boolean}
413
425
  * @default false
@@ -584,39 +596,15 @@ interface VideoOptions extends BaseOptions {
584
596
  fitMode?: RenderFitMode;
585
597
  }
586
598
 
587
- /**
588
- * Audio Input Configuration Options
589
- *
590
- * @author sansen
591
- * @interface AudioInputOptions
592
- */
593
599
  interface AudioInputOptions {
594
- /**
595
- * Audio sample rate in Hz (default 24000)
596
- *
597
- * @type {number}
598
- */
600
+ deviceId?: string;
599
601
  sampleRate?: number;
600
-
601
- /**
602
- * Audio bit depth in bits (default 16)
603
- *
604
- * @type {number}
605
- */
606
- bitDepth?: number;
607
-
608
- /**
609
- * Number of audio channels, default 1 (mono)
610
- *
611
- * @type {number}
612
- */
602
+ channelCount: number;
613
603
  channels?: number;
614
-
615
- /**
616
- * Media track constraints for audio input
617
- *
618
- * @type {MediaTrackConstraints}
619
- */
604
+ sampleSize?: number;
605
+ noiseSuppression?: boolean;
606
+ voiceIsolation?: boolean;
607
+ bitDepth?: number;
620
608
  constraints?: MediaTrackConstraints;
621
609
  }
622
610
 
@@ -672,6 +660,47 @@ interface AudioOptions extends BaseOptions {
672
660
  output?: AudioOutputOptions;
673
661
  }
674
662
 
663
+ /**
664
+ * Performance metric names emitted by SDK monitoring module.
665
+ */
666
+ type PerformanceMetricName =
667
+ | 'connect_to_first_frame_ms'
668
+ | 'text_send_to_text_response_ms'
669
+ | 'text_send_to_audio_response_ms'
670
+ | 'no_speech_report_to_audio_response_ms';
671
+
672
+ /**
673
+ * Normalized metric payload for external observability systems.
674
+ */
675
+ interface PerformanceMetricRecord {
676
+ /** Stable metric name */
677
+ metric: PerformanceMetricName;
678
+ /** Duration in milliseconds */
679
+ durationMs: number;
680
+ /** Start timestamp (ms since epoch) */
681
+ startedAt: number;
682
+ /** End timestamp (ms since epoch) */
683
+ endedAt: number;
684
+ /** Optional correlation id (for question scoped metrics) */
685
+ questionId?: string;
686
+ }
687
+
688
+ /**
689
+ * Reporter callback for forwarding performance metrics to external systems (e.g. SkyWalking).
690
+ * If omitted, SDK uses the built-in reporter (default logger output).
691
+ */
692
+ type PerformanceMetricReporter = (metric: PerformanceMetricRecord) => void;
693
+
694
+ /**
695
+ * Performance monitor options for client initialization.
696
+ */
697
+ interface PerformanceMonitorOptions {
698
+ /** Enable performance monitoring. Defaults to true. */
699
+ enabled?: boolean;
700
+ /** Optional external metric reporter callback. */
701
+ reporter?: PerformanceMetricReporter;
702
+ }
703
+
675
704
  /**
676
705
  * Client Configuration Options
677
706
  *
@@ -680,32 +709,6 @@ interface AudioOptions extends BaseOptions {
680
709
  * @extends {BaseOptions}
681
710
  */
682
711
  interface ClientOptions extends BaseOptions {
683
- /**
684
- * WebSocket server URL prefix (for upstream communication)
685
- *
686
- * @type {string}
687
- * @default ''
688
- * @author sansen
689
- */
690
- wsUrlPrefix?: string;
691
-
692
- /**
693
- * Avatar name identifier
694
- *
695
- * @type {string}
696
- * @default ''
697
- * @author sansen
698
- */
699
- avatarName: string;
700
-
701
- /**
702
- * Avatar voice identifier
703
- *
704
- * @type {string}
705
- * @default ''
706
- * @author sansen
707
- */
708
- avatarVoice?: string;
709
712
  /**
710
713
  * Audio configuration options
711
714
  *
@@ -763,6 +766,13 @@ interface ClientOptions extends BaseOptions {
763
766
  */
764
767
  headers?: Record<string, string>;
765
768
  };
769
+ /**
770
+ * Performance monitoring options for external observability integration.
771
+ * Built-in monitoring is enabled by default even when this field is omitted.
772
+ *
773
+ * @type {PerformanceMonitorOptions}
774
+ */
775
+ performanceMonitor?: PerformanceMonitorOptions;
766
776
  /**
767
777
  * Indicates if sandbox is enabled
768
778
  *
@@ -771,6 +781,29 @@ interface ClientOptions extends BaseOptions {
771
781
  * @author sansen
772
782
  */
773
783
  sandbox?: boolean;
784
+
785
+ /**
786
+ * Connection configuration
787
+ * direct: direct connection to sfu server
788
+ * @type {Object}
789
+ * @author sansen
790
+ */
791
+ connectConfig:
792
+ | {
793
+ type: 'direct';
794
+ config: {
795
+ sfuUrl: string;
796
+ clientToken: string;
797
+ };
798
+ }
799
+ | {
800
+ type: 'auth';
801
+ config: {
802
+ authToken?: string;
803
+ avatarId: string;
804
+ avatarVoice?: string;
805
+ };
806
+ };
774
807
  }
775
808
 
776
809
  /**
@@ -799,17 +832,17 @@ declare class SDKError extends Error {
799
832
  /**
800
833
  * Creates an SDKError instance
801
834
  *
835
+ * @param {string} code - Error code for categorization; defaults to {@link ErrorCode.SDK_ERROR} when using {@link SDKError.fromError}
802
836
  * @param {string} message - Error description message
803
- * @param {string} [code='SDK_ERROR'] - Error code for categorization
804
837
  * @param {unknown} [cause] - Original error that caused this SDKError
805
838
  * @author sansen
806
839
  */
807
- constructor(message: string, code?: string, cause?: unknown);
840
+ constructor(code: string, message: string, cause?: unknown);
808
841
  /**
809
842
  * Creates an SDKError from any error type
810
843
  *
811
844
  * @param {unknown} error - Original error to convert
812
- * @param {string} [code] - Optional error code, defaults to 'SDK_ERROR'
845
+ * @param {string} [code] - Optional error code; defaults to {@link ErrorCode.SDK_ERROR}
813
846
  * @returns {SDKError} SDKError instance
814
847
  * @author sansen
815
848
  */
@@ -825,11 +858,11 @@ declare class SDKError extends Error {
825
858
  type SDKConnectionState = 'idle' | 'connecting' | 'connected' | 'partial' | 'reconnecting:auto' | 'reconnecting:manual' | 'disconnecting' | 'disconnected' | 'disposed' | 'error';
826
859
  /**
827
860
  * Read-only connection snapshot.
828
- * Derived from aggregated internal facts (rtc:* / ws:* events), not from LiveKit Room or Track objects.
861
+ * Derived from aggregated internal facts (rtc:* and HTTP session facts), not from LiveKit Room or Track objects.
829
862
  * Used for user-driven reconnect UX: available synchronously when user triggers manual reconnect.
830
863
  *
831
864
  * @remarks
832
- * - ws.connected: whether WebSocket (conversation) is currently connected.
865
+ * - http.connected: whether the HTTP stream session is active (after /stream/v1/start success).
833
866
  * - rtc.connected: whether RTC (LiveKit) is currently connected.
834
867
  * - rtc.hasVideoTrack: whether at least one video track is available (from rtc:video:available / rtc:video:unavailable).
835
868
  * - overall.state: current SDK lifecycle state from SDKConnectionFSM.
@@ -837,8 +870,8 @@ type SDKConnectionState = 'idle' | 'connecting' | 'connected' | 'partial' | 'rec
837
870
  * @author sansen
838
871
  */
839
872
  interface ConnectionSnapshot {
840
- readonly ws: {
841
- /** True when WebSocket connection is open. */
873
+ readonly http: {
874
+ /** True after HTTP start/stream session is established (room config applied). */
842
875
  readonly connected: boolean;
843
876
  };
844
877
  readonly rtc: {
@@ -853,6 +886,29 @@ interface ConnectionSnapshot {
853
886
  };
854
887
  }
855
888
 
889
+ /**
890
+ * Records which microphone capture path was last claimed (`rtc` = LiveKit; `ws` label unused in LiveKit-only SDK but kept for audio module compatibility).
891
+ *
892
+ * @author sansen
893
+ */
894
+ declare class MediaAudioCaptureState {
895
+ private _active;
896
+ /**
897
+ * Currently active capture label, or null if none.
898
+ */
899
+ get active(): 'ws' | 'rtc' | null;
900
+ /**
901
+ * @param mode - Capture label to claim
902
+ * @returns false if another label is already active
903
+ */
904
+ tryBegin(mode: 'ws' | 'rtc'): boolean;
905
+ /**
906
+ * @param mode - Capture label to release
907
+ */
908
+ end(mode: 'ws' | 'rtc'): void;
909
+ reset(): void;
910
+ }
911
+
856
912
  /**
857
913
  * SDK Context
858
914
  * Contains all shared states and event bus
@@ -875,6 +931,10 @@ declare class SDKContext {
875
931
  * @memberof SDKContext
876
932
  */
877
933
  readonly sessionState: SessionState;
934
+ /**
935
+ * Microphone capture mode coordination (see {@link MediaAudioCaptureState}).
936
+ */
937
+ readonly mediaAudioCaptureState: MediaAudioCaptureState;
878
938
  /**
879
939
  * Client configuration options
880
940
  *
@@ -911,7 +971,7 @@ declare class SDKContext {
911
971
  * Emits an error event and creates SDKError instance
912
972
  *
913
973
  * @param {unknown} error - Original error
914
- * @param {string} code - Error code
974
+ * @param {string} code - Error code; use a value from {@link import('@/errors/ErrorCodes').ErrorCode}
915
975
  * @returns {SDKError} Created SDKError instance
916
976
  * @author sansen
917
977
  */
@@ -923,14 +983,7 @@ declare class SDKContext {
923
983
  */
924
984
  setVideoOptions(options: VideoOptions): void;
925
985
  /**
926
- * Sets WebSocket URL
927
- *
928
- * @param {string} wsUrl - WebSocket server URL
929
- * @author sansen
930
- */
931
- setWsUrl(wsUrl: string): void;
932
- /**
933
- * Gets WebSocket URL
986
+ * Opaque URL from preConnect HTTP response.
934
987
  *
935
988
  * @type {string}
936
989
  * @author sansen
@@ -996,10 +1049,26 @@ interface PublicEmitterAPI {
996
1049
  once<K extends keyof PublicSDKEvents>(event: K, listener: (data: PublicSDKEvents[K]) => void): () => void;
997
1050
  }
998
1051
 
1052
+ interface DirectConnectionConfig {
1053
+ sfuUrl: string;
1054
+ clientToken: string;
1055
+ }
1056
+
999
1057
  /**
1000
1058
  * SDK client
1001
1059
  * Provides a unified API surface.
1002
1060
  * Orchestrates the lifecycles of all subsystems.
1061
+ *
1062
+ * @remarks Upstream transport: session text, microphone, and camera uplink use {@link LiveKitService} (publish / publishData); {@link HttpController} is the control plane.
1063
+ *
1064
+ * @remarks SDK lifecycle (ordering is contract for {@link ConnectionLifecycleCoordinator} and session state):
1065
+ * 1. **Constructor** — builds {@link SDKContext} only; no I/O.
1066
+ * 2. **preConnect** — idempotent/cached: {@link HttpController}, auth token, LiveKit config; may be skipped by callers but is always awaited inside {@link connect}.
1067
+ * 3. **connect** — creates coordinator → binds snapshot → `startConnecting` → bootstraps domain controllers → {@link LiveKitService} → wires protocol dispatch and RTC uplinks → awaits LiveKit connect.
1068
+ * 4. **Runtime** — public methods guard with {@link _ensureConnected}; media/conversation use controllers; connection facts emit on internal bus (`inner:*`).
1069
+ * 5. **disconnect** — coordinator `startDisconnecting` → stop audio/LiveKit/camera → HTTP conversation end → `completeDisconnecting`.
1070
+ * 6. **reconnect** — snapshot before transition → stop capture paths → optionally full LiveKit teardown when video missing → preConnect + restore LiveKit.
1071
+ * 7. **dispose** — triggers {@link disconnect} then disposes controllers, services, coordinator, and context.
1003
1072
  * @author sansen
1004
1073
  */
1005
1074
  declare class SDKClient extends Disposable {
@@ -1031,29 +1100,28 @@ declare class SDKClient extends Disposable {
1031
1100
  */
1032
1101
  private _cameraController;
1033
1102
  /**
1034
- * LiveKit service
1103
+ * LiveKit service; downstream RTC and session uplink (media + data).
1035
1104
  * @author sansen
1036
1105
  */
1037
1106
  private _liveKitService;
1038
- /**
1039
- * Conversation transport service
1040
- * @author sansen
1041
- */
1042
- private _conversationTransport;
1043
1107
  /**
1044
1108
  * Central coordinator for connection lifecycle (snapshot + FSM).
1045
- * Created in connect(); drives sessionState from rtc/ws fact events.
1109
+ * Created in connect(); drives sessionState from rtc/http fact aggregation.
1046
1110
  * @author sansen
1047
1111
  */
1048
1112
  private _connectionCoordinator;
1049
1113
  /**
1050
- * HTTP controller
1114
+ * HTTP controller (auth, stream start/stop, avatar control).
1051
1115
  * @author sansen
1052
1116
  */
1053
1117
  private _httpController;
1054
- private _preConnectPromise;
1055
- /** Timestamp (ms) of last successful preConnect */
1056
- private _lastPreConnectSuccessAt;
1118
+ private _configManager;
1119
+ private _performanceMonitor;
1120
+ private _pendingDirectConfig;
1121
+ private _isReconnectInProgress;
1122
+ private _reconnectPromise;
1123
+ /** Inbound session protocol: {@link ProtocolMessageDispatcher.dispatch}. */
1124
+ private _liveKitProtocolDispatcher;
1057
1125
  /**
1058
1126
  * Create SDK client
1059
1127
  * @param options Client configuration options
@@ -1065,23 +1133,6 @@ declare class SDKClient extends Disposable {
1065
1133
  * @author sansen
1066
1134
  */
1067
1135
  get events(): PublicEmitterAPI;
1068
- /**
1069
- * Push actions to the server
1070
- * @param onceActions One-time actions
1071
- * @param loopActions Repeating/loop actions
1072
- * @returns Promise<boolean> resolves to true on success, or false on failure
1073
- * @author sansen
1074
- */
1075
- pushActions({ onceActions, loopActions }: {
1076
- onceActions?: string[];
1077
- loopActions?: string[];
1078
- }): Promise<boolean> | undefined;
1079
- /**
1080
- * Interrupt the current conversation connection
1081
- * @returns Promise<boolean> resolves to true on success, or false on failure
1082
- * @author sansen
1083
- */
1084
- interruptConnection(): Promise<boolean> | undefined;
1085
1136
  /**
1086
1137
  * Send a text question/message
1087
1138
  * @param text The question text to send
@@ -1089,6 +1140,13 @@ declare class SDKClient extends Disposable {
1089
1140
  * @author sansen
1090
1141
  */
1091
1142
  sendTextQuestion(text: string): Promise<string>;
1143
+ interrupt(): Promise<void>;
1144
+ /**
1145
+ * Set external performance metric reporter.
1146
+ * @param reporter Reporter callback
1147
+ * @author sansen
1148
+ */
1149
+ setPerformanceMetricReporter(reporter: PerformanceMetricReporter | undefined): void;
1092
1150
  /**
1093
1151
  * Set render fit mode
1094
1152
  * @param mode Render fit mode
@@ -1097,7 +1155,7 @@ declare class SDKClient extends Disposable {
1097
1155
  setRenderFitMode(mode: RenderFitMode): void;
1098
1156
  /**
1099
1157
  * Start audio capture
1100
- * Begins microphone capture and starts sending audio frames over WebSocket
1158
+ * Begins microphone capture and publishes audio via LiveKit
1101
1159
  * @returns Promise<void>
1102
1160
  * @throws SDKError if the SDK is not initialized or capture fails to start
1103
1161
  * @author sansen
@@ -1105,7 +1163,7 @@ declare class SDKClient extends Disposable {
1105
1163
  startAudioCapture(): Promise<void>;
1106
1164
  /**
1107
1165
  * Stop audio capture
1108
- * Stops microphone capture and stops sending audio frames over WebSocket
1166
+ * Stops microphone capture and LiveKit microphone publish
1109
1167
  * @throws SDKError if the SDK is not initialized
1110
1168
  * @author sansen
1111
1169
  */
@@ -1155,7 +1213,12 @@ declare class SDKClient extends Disposable {
1155
1213
  */
1156
1214
  setAuthToken(token: string): void;
1157
1215
  /**
1158
- * Start camera capture and periodic screenshot sending over WebSocket
1216
+ * Update direct-mode connection config for next reconnect.
1217
+ * Does not affect current active connection.
1218
+ */
1219
+ updateConnectionConfig(config: DirectConnectionConfig): void;
1220
+ /**
1221
+ * Start camera capture and publish via LiveKit
1159
1222
  * @returns Promise<void>
1160
1223
  * @throws SDKError if not connected or camera controller unavailable
1161
1224
  * @author sansen
@@ -1190,6 +1253,9 @@ declare class SDKClient extends Disposable {
1190
1253
  * @returns Promise<boolean> resolves to true on success
1191
1254
  * @author sansen
1192
1255
  */
1256
+ /**
1257
+ * @remarks Pre-connect path: dedupe in-flight work, short TTL cache on success, then HTTP auth + LiveKit config into context.
1258
+ */
1193
1259
  preConnect(): Promise<boolean>;
1194
1260
  /**
1195
1261
  * Connect to the server
@@ -1197,12 +1263,18 @@ declare class SDKClient extends Disposable {
1197
1263
  * @returns Promise<void>
1198
1264
  * @author sansen
1199
1265
  */
1266
+ /**
1267
+ * @remarks Connect sequence: preConnect → coordinator + domain bootstrap → LiveKit connect. Errors transition coordinator idle and run {@link _cleanup}.
1268
+ */
1200
1269
  connect(): Promise<void>;
1201
1270
  /**
1202
1271
  * Disconnect
1203
1272
  * Tears down active connections but retains controller instances to allow reconnect
1204
1273
  * @author sansen
1205
1274
  */
1275
+ /**
1276
+ * @remarks User-initiated teardown: stop local capture hooks, LiveKit, camera controller, HTTP conversation; clears preConnect in-flight handle.
1277
+ */
1206
1278
  disconnect(): Promise<void>;
1207
1279
  /**
1208
1280
  * Manual reconnect.
@@ -1211,9 +1283,12 @@ declare class SDKClient extends Disposable {
1211
1283
  * @returns Promise<ConnectionSnapshot> Snapshot captured at the moment reconnect was triggered (before transition).
1212
1284
  * @author sansen
1213
1285
  */
1286
+ /**
1287
+ * @remarks Reconnect uses coordinator gating; transport restoration mirrors connect (preConnect + LiveKit) without re-running full client constructor.
1288
+ */
1214
1289
  reconnect(): Promise<ConnectionSnapshot>;
1215
1290
  /**
1216
- * Current connection snapshot (ws/rtc/overall state).
1291
+ * Current connection snapshot (rtc/http/overall state).
1217
1292
  * Derived from internal facts; available synchronously for user-driven reconnect UX.
1218
1293
  *
1219
1294
  * @returns Read-only ConnectionSnapshot
@@ -1225,8 +1300,35 @@ declare class SDKClient extends Disposable {
1225
1300
  * @author sansen
1226
1301
  */
1227
1302
  private _cleanup;
1303
+ private _disposeConnectionRuntimeBeforeConnect;
1304
+ /**
1305
+ * Instantiate domain controllers and bind context (video/audio/camera/conversation).
1306
+ */
1307
+ private _bootstrapDomainControllers;
1308
+ /**
1309
+ * Create LiveKit service; conversation uses RTC text sender only.
1310
+ */
1311
+ private _bootstrapLiveKitService;
1312
+ /**
1313
+ * Attach LiveKit event adapter to video/audio controllers for track routing.
1314
+ */
1315
+ private _wireLiveKitEventAdapterToControllers;
1316
+ /**
1317
+ * Configure LiveKit data path dispatcher and RTC text sender for conversation.
1318
+ */
1319
+ private _setupRtcProtocolDispatcher;
1320
+ /**
1321
+ * Connect LiveKit (downstream + uplink).
1322
+ */
1323
+ private _establishMediaAndSessionTransports;
1324
+ private _refreshConnectionConfigForReconnect;
1325
+ private _ensureConfigManagerReady;
1326
+ private _applyConnectionConfig;
1327
+ private _stageDirectConfigForNextReconnect;
1328
+ private _validateDirectConnectionConfig;
1329
+ private _ensurePerformanceMonitorReady;
1228
1330
  /**
1229
- * Check whether the SDK is connected (both rtc and ws; synced by ConnectionLifecycleCoordinator).
1331
+ * Whether the SDK is fully connected (HTTP session + LiveKit RTC; synced by ConnectionLifecycleCoordinator).
1230
1332
  * @author sansen
1231
1333
  */
1232
1334
  get isConnected(): boolean;
@@ -1236,6 +1338,10 @@ declare class SDKClient extends Disposable {
1236
1338
  * @author sansen
1237
1339
  */
1238
1340
  private _ensureConnected;
1341
+ private _startAudioCaptureRtc;
1342
+ private _stopAudioCaptureRtc;
1343
+ private _requireAudioController;
1344
+ private _requireLiveKitService;
1239
1345
  /**
1240
1346
  * Release resources
1241
1347
  * @author sansen
@@ -1720,4 +1826,4 @@ declare class StandaloneVideoDebugger extends Disposable {
1720
1826
  }
1721
1827
 
1722
1828
  export { ConversationStateType, DEFAULT_AUDIO_BUFFER_SIZE, DEFAULT_AUDIO_CHANNELS, DEFAULT_AUDIO_SAMPLE_RATE, DEFAULT_RECONNECT_ATTEMPTS, DEFAULT_RECONNECT_DELAY, DEFAULT_WS_TIMEOUT, Disposable, EventBus, LogLevel, Logger, SDKClient, SDKContext, SDKError, SessionState, SessionStatus, StandaloneVideoDebugger, createClient };
1723
- export type { AsyncResult, AudioEvents, AudioOptions, BaseOptions, Callback, ClientOptions, ConnectionEvents, ConnectionSnapshot, ConversationEvents, ConversationOptions, ErrorCallback, GreenScreenOptions, IDisposable, InputMode, SDKConnectionState, SDKEvents, VideoEvents, VideoOptions, VideoRenderMode };
1829
+ export type { AsyncResult, AudioEvents, AudioOptions, BaseOptions, Callback, ClientOptions, ConnectionEvents, ConnectionSnapshot, ConversationEvents, ConversationOptions, ErrorCallback, GreenScreenOptions, IDisposable, InputMode, PerformanceMetricName, PerformanceMetricRecord, PerformanceMetricReporter, PerformanceMonitorOptions, SDKConnectionState, SDKEvents, VideoEvents, VideoOptions, VideoRenderMode };