@voxket-ai/voxket-live 1.0.157 → 1.1.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.
Files changed (44) hide show
  1. package/dist/components/{deep-analysis.d.ts → common/deep-analysis.d.ts} +2 -2
  2. package/dist/components/common/index.d.ts +12 -0
  3. package/dist/components/{interactive-component.d.ts → common/interactive-component.d.ts} +2 -2
  4. package/dist/components/{session-timer.d.ts → common/session-timer.d.ts} +1 -1
  5. package/dist/components/common/unified-control-bar.d.ts +58 -0
  6. package/dist/components/{welcome.d.ts → common/welcome.d.ts} +2 -2
  7. package/dist/components/{chat-view.d.ts → modalities/chat/chat-view.d.ts} +3 -3
  8. package/dist/components/{chat → modalities/chat/components}/attachment-message.d.ts +2 -2
  9. package/dist/components/{chat → modalities/chat/components}/chat-message.d.ts +2 -2
  10. package/dist/components/modalities/chat/components/index.d.ts +10 -0
  11. package/dist/components/{chat → modalities/chat/components}/markdown-utils.d.ts +1 -1
  12. package/dist/components/{chat → modalities/chat/components}/thinking-indicator.d.ts +1 -1
  13. package/dist/components/{chat → modalities/chat/components}/tool-execution-indicator.d.ts +2 -2
  14. package/dist/components/modalities/chat/index.d.ts +5 -0
  15. package/dist/components/modalities/index.d.ts +6 -0
  16. package/dist/components/{video → modalities/video/components}/index.d.ts +1 -1
  17. package/dist/components/{video → modalities/video/components}/video-controls.d.ts +1 -1
  18. package/dist/components/{video → modalities/video/components}/video-grid.d.ts +1 -1
  19. package/dist/components/{video → modalities/video/components}/video-tile.d.ts +1 -1
  20. package/dist/components/modalities/video/index.d.ts +5 -0
  21. package/dist/components/{video-view.d.ts → modalities/video/video-view.d.ts} +3 -3
  22. package/dist/components/modalities/voice/index.d.ts +4 -0
  23. package/dist/components/{session-view.d.ts → modalities/voice/session-view.d.ts} +2 -2
  24. package/dist/components/widget.d.ts +1 -0
  25. package/dist/core/agent-manager.d.ts +50 -0
  26. package/dist/core/chat-manager.d.ts +72 -0
  27. package/dist/core/client.d.ts +80 -189
  28. package/dist/core/connection-manager.d.ts +81 -0
  29. package/dist/core/index.d.ts +9 -1
  30. package/dist/core/media-manager.d.ts +177 -0
  31. package/dist/core/stream-handler-manager.d.ts +91 -0
  32. package/dist/core/ui-renderer.d.ts +76 -0
  33. package/dist/index.cjs +55 -55
  34. package/dist/index.css +1 -1
  35. package/dist/index.d.ts +8 -7
  36. package/dist/index.js +10544 -9985
  37. package/package.json +1 -1
  38. package/dist/components/chat/chat-input-panel.d.ts +0 -11
  39. /package/dist/components/{alert-toast.d.ts → common/alert-toast.d.ts} +0 -0
  40. /package/dist/components/{common-popup-trigger.d.ts → common/common-popup-trigger.d.ts} +0 -0
  41. /package/dist/components/{error-boundary.d.ts → common/error-boundary.d.ts} +0 -0
  42. /package/dist/components/{session-logger.d.ts → common/session-logger.d.ts} +0 -0
  43. /package/dist/components/{chat → modalities/chat/components}/default-views.d.ts +0 -0
  44. /package/dist/components/{chat → modalities/chat/components}/streaming-text.d.ts +0 -0
@@ -1,45 +1,9 @@
1
- import { default as React } from 'react';
2
- import { Room, RemoteParticipant, LocalParticipant, ConnectionState, Track } from 'livekit-client';
1
+ import { Room, ConnectionState } from 'livekit-client';
3
2
  import { VoxketEventEmitter } from './event-emitter';
4
3
  import { PluginManager } from '../plugins/plugin-system';
4
+ import { RenderUIOptions } from './ui-renderer';
5
5
  import { VoxketConfig, SessionConfig, VoxketSession, VoxketEvents, SessionState, SessionMetrics, AgentInfo, ParticipantInfo, ChatMessage, TranscriptionSegment, SessionModality } from '../types/core';
6
6
  import { VoxketInteractiveView, ViewPresentationMode, InteractiveUIState, RpcEvents } from '../types/rpc';
7
- import { WidgetTheme } from '../styles';
8
- import { DisplayType, PopupPosition } from '../components/widget';
9
- export interface RenderUIOptions {
10
- target?: string | HTMLElement;
11
- modality?: SessionModality[];
12
- theme?: WidgetTheme | 'dark' | 'light' | 'vox';
13
- component?: 'widget' | 'session' | 'chat-only' | 'voice-only';
14
- className?: string;
15
- style?: React.CSSProperties;
16
- autoStart?: boolean;
17
- agentId?: string;
18
- participantName?: string;
19
- displayType?: DisplayType;
20
- popupPosition?: PopupPosition;
21
- popupTriggerText?: string;
22
- width?: string;
23
- height?: string;
24
- /**
25
- * Callback function to handle display type changes (e.g., when user clicks expand button).
26
- * Required for expand/fullscreen functionality to work properly.
27
- * @param displayType - The new display type ('widget', 'fullscreen', 'popup')
28
- * @example
29
- * onDisplayTypeChange: (newDisplayType) => {
30
- * console.log('Display type changed to:', newDisplayType);
31
- * // Handle the display type change in your app
32
- * }
33
- */
34
- onDisplayTypeChange?: (displayType: DisplayType) => void;
35
- prompts?: string[];
36
- statusMessage?: string;
37
- welcomeTitle?: string;
38
- welcomeSubTitle?: string;
39
- loadingText?: string;
40
- /** Participant metadata to be sent with session creation */
41
- participantMetadata?: Record<string, any>;
42
- }
43
7
  export interface VoxketClientConfig extends VoxketConfig {
44
8
  agentId?: string;
45
9
  participantName?: string;
@@ -56,34 +20,40 @@ export interface VoxketClientConfig extends VoxketConfig {
56
20
  onUserJoined?: (userId: string) => void;
57
21
  onUserLeft?: (userId: string) => void;
58
22
  }
23
+ /**
24
+ * VoxketClient
25
+ *
26
+ * Main client class that orchestrates all Voxket functionality.
27
+ * Uses specialized managers for different concerns:
28
+ * - ChatManager: Chat messages and attachments
29
+ * - MediaManager: Camera, microphone, screen share
30
+ * - ConnectionManager: Room connection and participants
31
+ * - StreamHandlerManager: Text/byte stream handlers
32
+ * - UIRenderer: React UI rendering
33
+ * - AgentManager: Agent state and info
34
+ * - RpcManager: RPC method handling
35
+ * - PluginManager: Plugin system
36
+ */
59
37
  export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcEvents> {
60
38
  private config;
61
- private room;
62
39
  private pluginManager;
63
40
  private rpcManager;
64
- private isConnected;
41
+ private chatManager;
42
+ private mediaManager;
43
+ private connectionManager;
44
+ private streamHandlerManager;
45
+ private uiRenderer;
46
+ private agentManager;
65
47
  private currentSession;
66
- private connectionState;
67
- private renderedComponents;
68
- private textStreamHandlersRegistered;
69
- private currentAgentInfo;
70
- private chatMessages;
71
- private activeTranscriptions;
72
- private isAgentConnected;
73
- private agentState;
74
- private _eventEmitters;
75
48
  constructor(config: VoxketClientConfig);
49
+ /**
50
+ * Setup event listeners for various events
51
+ */
76
52
  private setupEventListeners;
53
+ /**
54
+ * Setup RPC event forwarding from RpcManager
55
+ */
77
56
  private setupRpcEventForwarding;
78
- private initializeClient;
79
- private setupRoomEventListeners;
80
- private setupTextStreamHandlers;
81
- fetchConnectionDetails(agentId?: string, participantName?: string, modalities?: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
82
- serverUrl: string;
83
- participantToken: string;
84
- voxketSessionId: string;
85
- agentInfo?: AgentInfo;
86
- }>;
87
57
  connect(agentId?: string, participantName?: string, modalities?: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
88
58
  serverUrl: string;
89
59
  participantToken: string;
@@ -100,66 +70,15 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
100
70
  }): Promise<VoxketSession>;
101
71
  endSession(): Promise<SessionMetrics | null>;
102
72
  getCurrentSession(): VoxketSession | null;
103
- getCurrentAgentInfo(): AgentInfo | null;
104
- getIsAgentConnected(): boolean;
105
- /**
106
- * Force mark agent as connected - useful when agent should be visible
107
- * even without receiving agent_state_changed events
108
- */
109
- forceAgentConnected(): void;
110
- getAgentState(): 'idle' | 'thinking' | 'speaking';
111
- private setAgentState;
112
- /**
113
- * Get agent tracks from remote participants
114
- */
115
- getAgentAudioTrack(): {
116
- source: Track.Source;
117
- participant: RemoteParticipant;
118
- publication: import('livekit-client').RemoteTrackPublication;
119
- } | null;
120
- getAgentVideoTrack(): {
121
- source: Track.Source;
122
- participant: RemoteParticipant;
123
- publication: import('livekit-client').RemoteTrackPublication;
124
- } | null;
125
- /**
126
- * Get all video track references (camera and screen share) from all participants
127
- */
128
- getVideoTrackRefs(): Array<{
129
- source: Track.Source;
130
- participant: any;
131
- publication: any;
132
- }>;
133
- /**
134
- * Get camera track references only
135
- */
136
- getCameraTrackRefs(): Array<{
137
- source: Track.Source;
138
- participant: any;
139
- publication: any;
140
- }>;
141
- /**
142
- * Get screen share track references only
143
- */
144
- getScreenShareTrackRefs(): Array<{
145
- source: Track.Source;
146
- participant: any;
147
- publication: any;
148
- }>;
149
- getChatMessages(): ChatMessage[];
150
- addChatMessage(message: ChatMessage): void;
151
- updateChatMessage(updatedMessage: ChatMessage): void;
152
- clearChatMessages(): void;
153
- renderUI(options?: RenderUIOptions): void;
154
- removeUI(target?: string | HTMLElement): void;
155
- removeAllUI(): void;
156
- private forceCleanupFullscreenOverlays;
157
- private resolveTarget;
158
- private getTargetKey;
73
+ getSessionMetrics(): SessionMetrics | null;
159
74
  sendMessage(message: string, metadata?: Record<string, any>): Promise<void>;
160
75
  sendChatMessage(message: string, metadata?: Record<string, any>): Promise<void>;
161
76
  sendAttachments(files: File[], metadata?: Record<string, any>): Promise<void>;
162
77
  sendAttachment(file: File, metadata?: Record<string, any>): Promise<void>;
78
+ getChatMessages(): ChatMessage[];
79
+ addChatMessage(message: ChatMessage): void;
80
+ updateChatMessage(updatedMessage: ChatMessage): void;
81
+ clearChatMessages(): void;
163
82
  toggleMicrophone(enabled?: boolean): Promise<void>;
164
83
  setMicrophoneEnabled(enabled: boolean): Promise<void>;
165
84
  toggleCamera(enabled?: boolean): Promise<void>;
@@ -172,8 +91,37 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
172
91
  getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
173
92
  setAudioInputDevice(deviceId: string): Promise<void>;
174
93
  setVideoInputDevice(deviceId: string): Promise<void>;
175
- getLocalParticipant(): LocalParticipant | null;
176
- getRemoteParticipants(): RemoteParticipant[];
94
+ get isMicrophoneEnabled(): boolean;
95
+ get isCameraEnabled(): boolean;
96
+ get isScreenShareEnabled(): boolean;
97
+ getMicrophoneTrack(): import('livekit-client').LocalTrack<import("livekit-client").Track.Kind> | null | undefined;
98
+ getCameraTrack(): import('livekit-client').LocalTrack<import("livekit-client").Track.Kind> | null | undefined;
99
+ getScreenShareTrack(): import('livekit-client').LocalTrack<import("livekit-client").Track.Kind> | null | undefined;
100
+ getAgentAudioTrack(): {
101
+ source: import("livekit-client").Track.Source;
102
+ participant: import('livekit-client').RemoteParticipant;
103
+ publication: import('livekit-client').RemoteTrackPublication;
104
+ } | null;
105
+ getAgentVideoTrack(): {
106
+ source: import("livekit-client").Track.Source;
107
+ participant: import('livekit-client').RemoteParticipant;
108
+ publication: import('livekit-client').RemoteTrackPublication;
109
+ } | null;
110
+ getVideoTrackRefs(): {
111
+ source: import("livekit-client").Track.Source;
112
+ participant: any;
113
+ publication: any;
114
+ }[];
115
+ getCameraTrackRefs(): {
116
+ source: import("livekit-client").Track.Source;
117
+ participant: any;
118
+ publication: any;
119
+ }[];
120
+ getScreenShareTrackRefs(): {
121
+ source: import("livekit-client").Track.Source;
122
+ participant: any;
123
+ publication: any;
124
+ }[];
177
125
  getPublishPermissions(): {
178
126
  camera: boolean;
179
127
  microphone: boolean;
@@ -181,89 +129,32 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
181
129
  data: boolean;
182
130
  };
183
131
  canPublishSource(source: 'camera' | 'microphone' | 'screenShare'): boolean;
132
+ getLocalParticipant(): import('livekit-client').LocalParticipant | null;
133
+ getRemoteParticipants(): import('livekit-client').RemoteParticipant[];
134
+ getParticipants(): ParticipantInfo[];
184
135
  getRoom(): Room | null;
185
136
  getConnectionState(): ConnectionState;
186
137
  get connected(): boolean;
187
- getMicrophoneTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
188
- getCameraTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
189
- getScreenShareTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
190
- get isMicrophoneEnabled(): boolean;
191
- get isCameraEnabled(): boolean;
192
- get isScreenShareEnabled(): boolean;
193
- registerPlugin(plugin: any): void;
194
- getPluginManager(): PluginManager;
195
- getParticipants(): ParticipantInfo[];
196
- getSessionMetrics(): SessionMetrics | null;
197
- updateConfig(updates: Partial<VoxketClientConfig>): void;
198
- startRecording(): Promise<void>;
199
- stopRecording(): Promise<void>;
200
- /**
201
- * Register a frontend RPC method with a React component
202
- * @param methodName The RPC method name to register
203
- * @param component React component that implements VoxketInteractiveView
204
- * @param presentationMode How the component should be displayed
205
- */
138
+ getCurrentAgentInfo(): AgentInfo | null;
139
+ getIsAgentConnected(): boolean;
140
+ getAgentState(): 'idle' | 'thinking' | 'speaking';
141
+ renderUI(options?: RenderUIOptions): void;
142
+ removeUI(target?: string | HTMLElement): void;
143
+ removeAllUI(): void;
206
144
  registerFrontendRPC(methodName: string, component: VoxketInteractiveView, presentationMode?: ViewPresentationMode): Promise<void>;
207
- /**
208
- * Get the current interactive RPC component state
209
- */
210
145
  getCurrentInteraction(): InteractiveUIState | null;
211
- /**
212
- * Dismiss the current interactive component
213
- */
214
146
  dismissCurrentInteraction(): void;
215
- /**
216
- * Get all registered RPC methods
217
- */
218
147
  getRegisteredRpcMethods(): string[];
219
- /**
220
- * Unregister an RPC method
221
- */
222
148
  unregisterRpcMethod(methodName: string): void;
223
- /**
224
- * Set participant metadata that will be sent with session creation requests.
225
- * This is useful for passing business-specific user information to the API.
226
- * @param metadata Object containing participant metadata (e.g., userId, customerType, etc.)
227
- */
228
- setParticipantMetadata(metadata: Record<string, any>): void;
229
- /**
230
- * Get the current participant metadata
231
- */
232
- getParticipantMetadata(): Record<string, any> | undefined;
233
- /**
234
- * Register a custom event listener for VoxketClient events.
235
- * This is a business-friendly alias for the inherited `on` method.
236
- * @param eventName The event name to listen for (string)
237
- * @param callback The callback function to invoke with event data
238
- * @returns Unsubscribe function
239
- *
240
- * Example:
241
- * client.registerEventListener('chat.message.received', (msg) => { ... });
242
- */
149
+ registerPlugin(plugin: any): void;
150
+ getPluginManager(): PluginManager;
243
151
  registerEventListener<K extends keyof (VoxketEvents & RpcEvents)>(eventName: K, callback: (data: any) => void): () => void;
244
- /**
245
- * Register a custom event emitter for a LiveKit text stream topic.
246
- * This allows business/consumer code to listen for custom events sent via text stream.
247
- * @param topic The topic name to listen for (string)
248
- * @param handler The callback function to invoke with (data, participantInfo)
249
- * @returns void
250
- *
251
- * Example:
252
- * client.registerEventEmitter('custom_event', (data) => { ... });
253
- */
254
152
  registerEventEmitter(topic: string, handler: (data: string) => void): void;
255
- /**
256
- * Get the list of registered custom event emitters (for debugging)
257
- */
258
153
  getRegisteredEventEmitters(): string[];
259
- /**
260
- * Check if a custom event emitter is registered for a topic
261
- */
262
154
  hasEventEmitter(topic: string): boolean;
263
- /**
264
- * Convert markdown text to plain text by removing common markdown formatting
265
- * @param markdownText The markdown text to convert
266
- * @returns Plain text without markdown formatting
267
- */
268
- private convertMarkdownToText;
155
+ updateConfig(updates: Partial<VoxketClientConfig>): void;
156
+ setParticipantMetadata(metadata: Record<string, any>): void;
157
+ getParticipantMetadata(): Record<string, any> | undefined;
158
+ startRecording(): Promise<void>;
159
+ stopRecording(): Promise<void>;
269
160
  }
@@ -0,0 +1,81 @@
1
+ import { Room, ConnectionState } from 'livekit-client';
2
+ import { VoxketEventEmitter } from './event-emitter';
3
+ import { VoxketEvents, AgentInfo, ParticipantInfo, SessionModality } from '../types/core';
4
+ export interface ConnectionConfig {
5
+ baseUrl: string;
6
+ appId: string;
7
+ appSecret: string;
8
+ }
9
+ /**
10
+ * ConnectionManager
11
+ *
12
+ * Manages all connection-related functionality including:
13
+ * - Room connection and disconnection
14
+ * - Connection state management
15
+ * - Participant tracking
16
+ * - Connection details fetching
17
+ * - Room event handling
18
+ */
19
+ export declare class ConnectionManager {
20
+ private room;
21
+ private config;
22
+ private eventEmitter;
23
+ private connectionState;
24
+ private isConnected;
25
+ private currentAgentInfo;
26
+ constructor(config: ConnectionConfig, eventEmitter: VoxketEventEmitter<VoxketEvents>);
27
+ /**
28
+ * Initialize or reinitialize the room
29
+ */
30
+ private initializeRoom;
31
+ /**
32
+ * Setup event listeners for the room
33
+ */
34
+ private setupRoomEventListeners;
35
+ /**
36
+ * Fetch connection details from the server
37
+ */
38
+ fetchConnectionDetails(agentId: string, participantName: string, modalities: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
39
+ serverUrl: string;
40
+ participantToken: string;
41
+ voxketSessionId: string;
42
+ agentInfo?: AgentInfo;
43
+ }>;
44
+ /**
45
+ * Connect to the room
46
+ */
47
+ connect(agentId: string, participantName: string, modalities: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
48
+ serverUrl: string;
49
+ participantToken: string;
50
+ voxketSessionId: string;
51
+ agentInfo?: AgentInfo;
52
+ }>;
53
+ /**
54
+ * Disconnect from the room
55
+ */
56
+ disconnect(): Promise<void>;
57
+ /**
58
+ * Get the current room instance
59
+ */
60
+ getRoom(): Room | null;
61
+ /**
62
+ * Get the connection state
63
+ */
64
+ getConnectionState(): ConnectionState;
65
+ /**
66
+ * Check if connected
67
+ */
68
+ get connected(): boolean;
69
+ /**
70
+ * Get current agent info
71
+ */
72
+ getCurrentAgentInfo(): AgentInfo | null;
73
+ /**
74
+ * Get all participants
75
+ */
76
+ getParticipants(): ParticipantInfo[];
77
+ /**
78
+ * Update configuration
79
+ */
80
+ updateConfig(updates: Partial<ConnectionConfig>): void;
81
+ }
@@ -4,6 +4,14 @@
4
4
  */
5
5
  export { VoxketClient } from './client';
6
6
  export { VoxketEventEmitter } from './event-emitter';
7
+ export { RpcManager } from './rpc-manager';
8
+ export { ChatManager } from './chat-manager';
9
+ export { MediaManager } from './media-manager';
10
+ export { ConnectionManager } from './connection-manager';
11
+ export { StreamHandlerManager } from './stream-handler-manager';
12
+ export { UIRenderer } from './ui-renderer';
13
+ export { AgentManager } from './agent-manager';
7
14
  export { VoxketClient as VoxketSDK } from './client';
8
15
  export type * from '../types/core';
9
- export type { RenderUIOptions, VoxketClientConfig } from './client';
16
+ export type { VoxketClientConfig } from './client';
17
+ export type { RenderUIOptions } from './ui-renderer';
@@ -0,0 +1,177 @@
1
+ import { Room, LocalParticipant, RemoteParticipant, Track } from 'livekit-client';
2
+ import { VoxketEventEmitter } from './event-emitter';
3
+ import { VoxketEvents } from '../types/core';
4
+ /**
5
+ * MediaManager
6
+ *
7
+ * Manages all media-related functionality including:
8
+ * - Camera control
9
+ * - Microphone control
10
+ * - Screen share control
11
+ * - Device enumeration
12
+ * - Track management
13
+ * - Media permissions
14
+ */
15
+ export declare class MediaManager {
16
+ private room;
17
+ private eventEmitter;
18
+ private silencePreventionNode;
19
+ private silencePreventionOscillator;
20
+ private audioContext;
21
+ constructor(eventEmitter: VoxketEventEmitter<VoxketEvents>);
22
+ /**
23
+ * Initialize AudioContext and ensure it's running
24
+ * This must be called on user interaction to comply with browser autoplay policies
25
+ */
26
+ private initializeAudioContext;
27
+ /**
28
+ * Ensure AudioContext is running (call before any audio operations)
29
+ */
30
+ ensureAudioContextRunning(): Promise<void>;
31
+ /**
32
+ * Set the room instance for media management
33
+ */
34
+ setRoom(room: Room | null): void;
35
+ /**
36
+ * Get local participant
37
+ */
38
+ getLocalParticipant(): LocalParticipant | null;
39
+ /**
40
+ * Get remote participants
41
+ */
42
+ getRemoteParticipants(): RemoteParticipant[];
43
+ /**
44
+ * Toggle microphone (if enabled is not specified, it will toggle)
45
+ */
46
+ toggleMicrophone(enabled?: boolean): Promise<void>;
47
+ /**
48
+ * Set microphone enabled state
49
+ */
50
+ setMicrophoneEnabled(enabled: boolean): Promise<void>;
51
+ /**
52
+ * Start silence prevention by injecting a very low-volume tone
53
+ * This prevents LiveKit's silence detection from restarting the microphone track
54
+ */
55
+ private startSilencePrevention;
56
+ /**
57
+ * Stop silence prevention
58
+ */
59
+ private stopSilencePrevention;
60
+ /**
61
+ * Toggle camera (if enabled is not specified, it will toggle)
62
+ */
63
+ toggleCamera(enabled?: boolean): Promise<void>;
64
+ /**
65
+ * Set camera enabled state
66
+ */
67
+ setCameraEnabled(enabled: boolean): Promise<void>;
68
+ /**
69
+ * Enable camera
70
+ */
71
+ enableCamera(): Promise<void>;
72
+ /**
73
+ * Disable camera
74
+ */
75
+ disableCamera(): Promise<void>;
76
+ /**
77
+ * Start screen share
78
+ */
79
+ startScreenShare(): Promise<void>;
80
+ /**
81
+ * Stop screen share
82
+ */
83
+ stopScreenShare(): Promise<void>;
84
+ /**
85
+ * Get available audio input devices
86
+ */
87
+ getAudioInputDevices(): Promise<MediaDeviceInfo[]>;
88
+ /**
89
+ * Get available video input devices
90
+ */
91
+ getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
92
+ /**
93
+ * Set audio input device
94
+ */
95
+ setAudioInputDevice(deviceId: string): Promise<void>;
96
+ /**
97
+ * Set video input device
98
+ */
99
+ setVideoInputDevice(deviceId: string): Promise<void>;
100
+ /**
101
+ * Get microphone track
102
+ */
103
+ getMicrophoneTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
104
+ /**
105
+ * Get camera track
106
+ */
107
+ getCameraTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
108
+ /**
109
+ * Get screen share track
110
+ */
111
+ getScreenShareTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
112
+ /**
113
+ * Check if microphone is enabled
114
+ */
115
+ get isMicrophoneEnabled(): boolean;
116
+ /**
117
+ * Check if camera is enabled
118
+ */
119
+ get isCameraEnabled(): boolean;
120
+ /**
121
+ * Check if screen share is enabled
122
+ */
123
+ get isScreenShareEnabled(): boolean;
124
+ /**
125
+ * Get agent audio track
126
+ */
127
+ getAgentAudioTrack(): {
128
+ source: Track.Source;
129
+ participant: RemoteParticipant;
130
+ publication: import('livekit-client').RemoteTrackPublication;
131
+ } | null;
132
+ /**
133
+ * Get agent video track
134
+ */
135
+ getAgentVideoTrack(): {
136
+ source: Track.Source;
137
+ participant: RemoteParticipant;
138
+ publication: import('livekit-client').RemoteTrackPublication;
139
+ } | null;
140
+ /**
141
+ * Get all video track refs (local and remote, camera and screen share)
142
+ */
143
+ getVideoTrackRefs(): Array<{
144
+ source: Track.Source;
145
+ participant: any;
146
+ publication: any;
147
+ }>;
148
+ /**
149
+ * Get camera track refs only
150
+ */
151
+ getCameraTrackRefs(): Array<{
152
+ source: Track.Source;
153
+ participant: any;
154
+ publication: any;
155
+ }>;
156
+ /**
157
+ * Get screen share track refs only
158
+ */
159
+ getScreenShareTrackRefs(): Array<{
160
+ source: Track.Source;
161
+ participant: any;
162
+ publication: any;
163
+ }>;
164
+ /**
165
+ * Get publish permissions for various media sources
166
+ */
167
+ getPublishPermissions(): {
168
+ camera: boolean;
169
+ microphone: boolean;
170
+ screenShare: boolean;
171
+ data: boolean;
172
+ };
173
+ /**
174
+ * Check if a specific source can be published
175
+ */
176
+ canPublishSource(source: 'camera' | 'microphone' | 'screenShare'): boolean;
177
+ }
@@ -0,0 +1,91 @@
1
+ import { Room } from 'livekit-client';
2
+ import { VoxketEventEmitter } from './event-emitter';
3
+ import { ChatManager } from './chat-manager';
4
+ import { AgentManager } from './agent-manager';
5
+ import { VoxketEvents } from '../types/core';
6
+ /**
7
+ * StreamHandlerManager
8
+ *
9
+ * Manages all text and byte stream handlers including:
10
+ * - Chat message streams (lk.chat)
11
+ * - Transcription streams (lk.transcription)
12
+ * - Agent state change streams
13
+ * - Tool execution streams
14
+ * - Image attachment streams
15
+ * - Custom event emitter streams
16
+ * - Suggested response streams
17
+ */
18
+ export declare class StreamHandlerManager {
19
+ private room;
20
+ private eventEmitter;
21
+ private chatManager;
22
+ private agentManager;
23
+ private textStreamHandlersRegistered;
24
+ private _eventEmitters;
25
+ constructor(eventEmitter: VoxketEventEmitter<VoxketEvents>, chatManager: ChatManager, agentManager: AgentManager);
26
+ /**
27
+ * Set the room instance for stream handling
28
+ * Automatically registers handlers when room is set and not already registered
29
+ */
30
+ setRoom(room: Room | null): void;
31
+ /**
32
+ * Check if stream handlers are registered
33
+ */
34
+ areHandlersRegistered(): boolean;
35
+ /**
36
+ * Reset handlers registration flag
37
+ */
38
+ resetHandlersFlag(): void;
39
+ /**
40
+ * Setup all text stream handlers
41
+ */
42
+ setupTextStreamHandlers(): void;
43
+ /**
44
+ * Register chat message handler (lk.chat)
45
+ */
46
+ private registerChatHandler;
47
+ /**
48
+ * Register transcription handler (lk.transcription)
49
+ */
50
+ private registerTranscriptionHandler;
51
+ /**
52
+ * Register suggested response handler
53
+ */
54
+ private registerSuggestedResponseHandler;
55
+ /**
56
+ * Register agent state change handler
57
+ */
58
+ private registerAgentStateHandler;
59
+ /**
60
+ * Register function tools execution handler
61
+ */
62
+ private registerFunctionToolsHandler;
63
+ /**
64
+ * Register image text stream handler
65
+ */
66
+ private registerImageTextStreamHandler;
67
+ /**
68
+ * Register image byte stream handler
69
+ */
70
+ private registerImageByteStreamHandler;
71
+ /**
72
+ * Register handlers for common topics
73
+ */
74
+ private registerCommonTopicHandlers;
75
+ /**
76
+ * Register wildcard handler for unhandled topics
77
+ */
78
+ private registerWildcardHandler;
79
+ /**
80
+ * Register a custom event emitter for a specific topic
81
+ */
82
+ registerEventEmitter(topic: string, handler: (data: string) => void): void;
83
+ /**
84
+ * Get all registered event emitters
85
+ */
86
+ getRegisteredEventEmitters(): string[];
87
+ /**
88
+ * Check if an event emitter is registered for a topic
89
+ */
90
+ hasEventEmitter(topic: string): boolean;
91
+ }