@voxket-ai/voxket-live 1.0.150 → 1.0.151

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/README.md CHANGED
@@ -357,6 +357,122 @@ client.on('connection.error', (error) => {
357
357
  });
358
358
  ```
359
359
 
360
+ ## 🔔 **Custom Event System**
361
+
362
+ ### 📡 **Register Event Emitters**
363
+
364
+ Register custom event emitters to listen for LiveKit text stream topics:
365
+
366
+ ```typescript
367
+ import { VoxketClient } from '@voxket-ai/voxket-live';
368
+
369
+ const client = new VoxketClient(config);
370
+
371
+ // Register an event emitter for custom events
372
+ client.registerEventEmitter('custom_event_topic', (data) => {
373
+ console.log('Custom event received:', data);
374
+ // Handle your custom business logic
375
+ handleCustomEvent(data);
376
+ });
377
+
378
+ // Register multiple event emitters
379
+ client.registerEventEmitter('user_action', (actionData) => {
380
+ console.log('User action:', actionData);
381
+ analytics.track('user_action', actionData);
382
+ });
383
+
384
+ client.registerEventEmitter('system_notification', (notification) => {
385
+ showNotification(notification);
386
+ });
387
+ ```
388
+
389
+ ### 🎯 **Event Listener Registration**
390
+
391
+ Register event listeners for any SDK events with automatic cleanup:
392
+
393
+ ```typescript
394
+ // Register event listeners with automatic unsubscribe
395
+ const unsubscribe = client.registerEventListener('chat.message.received', (message) => {
396
+ console.log('New message:', message);
397
+ updateUI(message);
398
+ });
399
+
400
+ // Manual cleanup when needed
401
+ unsubscribe();
402
+
403
+ // Register multiple listeners
404
+ client.registerEventListener('connection.connected', () => {
405
+ console.log('Connected to Voxket!');
406
+ updateConnectionStatus('connected');
407
+ });
408
+
409
+ client.registerEventListener('agent.thinking', () => {
410
+ showTypingIndicator();
411
+ });
412
+ ```
413
+
414
+ ### 🏢 **Business Integration Examples**
415
+
416
+ #### **Real-time Notifications**
417
+ ```typescript
418
+ // Listen for agent-triggered notifications
419
+ client.registerEventEmitter('agent_notification', (data) => {
420
+ // Show toast notification
421
+ showToast({
422
+ title: data.title,
423
+ message: data.message,
424
+ type: data.type
425
+ });
426
+ });
427
+
428
+ // Listen for system updates
429
+ client.registerEventEmitter('system_update', (updateInfo) => {
430
+ if (updateInfo.type === 'maintenance') {
431
+ showMaintenanceWarning(updateInfo.schedule);
432
+ }
433
+ });
434
+ ```
435
+
436
+ #### **Custom Analytics Integration**
437
+ ```typescript
438
+ // Track custom business events
439
+ client.registerEventEmitter('business_event', (eventData) => {
440
+ // Send to your analytics platform
441
+ analytics.track(eventData.event_name, {
442
+ ...eventData.properties,
443
+ timestamp: new Date().toISOString(),
444
+ session_id: client.getCurrentSession()?.id
445
+ });
446
+ });
447
+
448
+ // Example: Track user interactions
449
+ client.registerEventEmitter('user_interaction', (interaction) => {
450
+ mixpanel.track('Voxket User Interaction', {
451
+ interaction_type: interaction.type,
452
+ interaction_data: interaction.data,
453
+ user_id: getCurrentUserId()
454
+ });
455
+ });
456
+ ```
457
+
458
+ #### **Workflow Automation**
459
+ ```typescript
460
+ // Trigger business workflows
461
+ client.registerEventEmitter('workflow_trigger', (workflowData) => {
462
+ switch (workflowData.workflow_type) {
463
+ case 'lead_qualification':
464
+ triggerLeadQualificationWorkflow(workflowData.lead_data);
465
+ break;
466
+ case 'support_escalation':
467
+ escalateToHumanAgent(workflowData.ticket_data);
468
+ break;
469
+ case 'appointment_booking':
470
+ processAppointmentRequest(workflowData.appointment_data);
471
+ break;
472
+ }
473
+ });
474
+ ```
475
+
360
476
  ### 💬 **Chat & Messaging Events**
361
477
 
362
478
  ```javascript
@@ -766,7 +882,31 @@ await client.setAudioInputDevice(deviceId);
766
882
  await client.setVideoInputDevice(deviceId);
767
883
  ```
768
884
 
769
- ### 👥 **Participant Management**
885
+ ### **Event System Methods**
886
+
887
+ ```typescript
888
+ // Register custom event emitter
889
+ client.registerEventEmitter(
890
+ topic: string,
891
+ handler: (data: string) => void
892
+ ): void
893
+
894
+ // Register event listener with cleanup
895
+ client.registerEventListener<K extends keyof VoxketEvents>(
896
+ eventName: K,
897
+ callback: (data: any) => void
898
+ ): () => void
899
+
900
+ // Example usage
901
+ const unsubscribe = client.registerEventListener('chat.message.received', (msg) => {
902
+ console.log('Message:', msg);
903
+ });
904
+
905
+ // Cleanup
906
+ unsubscribe();
907
+ ```
908
+
909
+ ### �👥 **Participant Management**
770
910
 
771
911
  ```typescript
772
912
  // Get participants
@@ -0,0 +1,9 @@
1
+ import { ThemeType } from '../../styles';
2
+ import { ChatMessage } from '../../types/core';
3
+ interface AttachmentMessageProps {
4
+ message: ChatMessage;
5
+ theme: ThemeType;
6
+ isOwn: boolean;
7
+ }
8
+ export declare function AttachmentMessage({ message, theme, isOwn }: AttachmentMessageProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import { ThemeType } from '../../styles';
2
+ interface ChatInputPanelProps {
3
+ onSendMessage: (message: string) => void;
4
+ onSendAttachments: (files: File[]) => void;
5
+ disabled?: boolean;
6
+ theme: ThemeType;
7
+ onEndChat?: () => void;
8
+ attachmentsEnabled?: boolean;
9
+ }
10
+ export declare function ChatInputPanel({ onSendMessage, onSendAttachments, disabled, theme, onEndChat, attachmentsEnabled }: ChatInputPanelProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ThemeType } from '../../styles';
2
+ import { ChatMessage } from '../../types/core';
3
+ interface ChatMessageProps {
4
+ message: ChatMessage;
5
+ theme: ThemeType;
6
+ isOwn: boolean;
7
+ isStreaming?: boolean;
8
+ }
9
+ export declare function ChatMessageComponent({ message, theme, isOwn, isStreaming }: ChatMessageProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function DefaultSuccessView(): import("react/jsx-runtime").JSX.Element;
2
+ export declare function DefaultTimeoutView(): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DefaultToolExecutionView({ toolData }: {
4
+ toolData?: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { ThemeType } from '../../styles';
2
+ export declare function createMarkdownComponents(theme: ThemeType): any;
3
+ export declare function linkifyText(text: string, theme: ThemeType): (string | import("react/jsx-runtime").JSX.Element)[];
4
+ export declare function detectMarkdownContent(content: string): boolean;
5
+ export declare function cleanMarkdownContent(content: string): string;
@@ -0,0 +1,8 @@
1
+ interface StreamingTextProps {
2
+ text: string;
3
+ isComplete: boolean;
4
+ isRealTimeStream?: boolean;
5
+ speed?: number;
6
+ }
7
+ export declare function StreamingText({ text, isComplete, isRealTimeStream, speed }: StreamingTextProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ThemeType } from '../../styles';
2
+ interface ThinkingIndicatorProps {
3
+ theme: ThemeType;
4
+ }
5
+ export declare function ThinkingIndicator({ theme }: ThinkingIndicatorProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ThemeType } from '../../styles';
2
+ import { ToolExecutionData } from '../../types/tools';
3
+ interface ToolExecutionIndicatorProps {
4
+ toolData: ToolExecutionData;
5
+ theme: ThemeType;
6
+ }
7
+ export declare function ToolExecutionIndicator({ toolData, theme }: ToolExecutionIndicatorProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { VoxketClient } from '../core/client';
2
+ import { ThemeType } from '../styles';
3
+ interface DeepAnalysisProps {
4
+ voxketClient: VoxketClient | null;
5
+ theme: ThemeType;
6
+ setTheme: (theme: ThemeType) => void;
7
+ configAgentId: string;
8
+ configParticipantName: string;
9
+ className?: string;
10
+ prompts?: string[];
11
+ statusMessage?: string;
12
+ welcomeTitle?: string;
13
+ welcomeSubTitle?: string;
14
+ participantMetadata?: Record<string, any>;
15
+ }
16
+ export declare function DeepAnalysis({ voxketClient, theme, setTheme, configAgentId, configParticipantName, className, prompts, statusMessage, welcomeTitle, welcomeSubTitle, participantMetadata }: DeepAnalysisProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -33,6 +33,7 @@ export interface VoxketWidgetProps {
33
33
  onPopupToggle?: (isOpen: boolean) => void;
34
34
  onDisplayTypeChange?: (displayType: DisplayType) => void;
35
35
  voxketClient?: VoxketClient;
36
+ participantMetadata?: Record<string, any>;
36
37
  }
37
38
  declare function WrappedWidget(props: VoxketWidgetProps & {
38
39
  prompts?: string[];
@@ -37,11 +37,14 @@ export interface RenderUIOptions {
37
37
  welcomeTitle?: string;
38
38
  welcomeSubTitle?: string;
39
39
  loadingText?: string;
40
+ /** Participant metadata to be sent with session creation */
41
+ participantMetadata?: Record<string, any>;
40
42
  }
41
43
  export interface VoxketClientConfig extends VoxketConfig {
42
44
  agentId?: string;
43
45
  participantName?: string;
44
46
  modalities?: SessionModality[];
47
+ participantMetadata?: Record<string, any>;
45
48
  onConnected?: () => void;
46
49
  onDisconnected?: (reason?: string) => void;
47
50
  onError?: (error: Error) => void;
@@ -74,13 +77,13 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
74
77
  private initializeClient;
75
78
  private setupRoomEventListeners;
76
79
  private setupTextStreamHandlers;
77
- fetchConnectionDetails(agentId?: string, participantName?: string, modalities?: SessionModality[]): Promise<{
80
+ fetchConnectionDetails(agentId?: string, participantName?: string, modalities?: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
78
81
  serverUrl: string;
79
82
  participantToken: string;
80
83
  voxketSessionId: string;
81
84
  agentInfo?: AgentInfo;
82
85
  }>;
83
- connect(agentId?: string, participantName?: string, modalities?: SessionModality[]): Promise<{
86
+ connect(agentId?: string, participantName?: string, modalities?: SessionModality[], participantMetadata?: Record<string, any>): Promise<{
84
87
  serverUrl: string;
85
88
  participantToken: string;
86
89
  voxketSessionId: string;
@@ -92,6 +95,7 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
92
95
  participantName?: string;
93
96
  modalities?: SessionModality[];
94
97
  metadata?: Record<string, any>;
98
+ participantMetadata?: Record<string, any>;
95
99
  }): Promise<VoxketSession>;
96
100
  endSession(): Promise<SessionMetrics | null>;
97
101
  getCurrentSession(): VoxketSession | null;
@@ -215,6 +219,16 @@ export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcE
215
219
  * Unregister an RPC method
216
220
  */
217
221
  unregisterRpcMethod(methodName: string): void;
222
+ /**
223
+ * Set participant metadata that will be sent with session creation requests.
224
+ * This is useful for passing business-specific user information to the API.
225
+ * @param metadata Object containing participant metadata (e.g., userId, customerType, etc.)
226
+ */
227
+ setParticipantMetadata(metadata: Record<string, any>): void;
228
+ /**
229
+ * Get the current participant metadata
230
+ */
231
+ getParticipantMetadata(): Record<string, any> | undefined;
218
232
  /**
219
233
  * Register a custom event listener for VoxketClient events.
220
234
  * This is a business-friendly alias for the inherited `on` method.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Test script to simulate visualization_data events
3
+ * This can be run in the browser console when the deep analysis component is active
4
+ */
5
+ declare global {
6
+ interface Window {
7
+ voxketClient?: any;
8
+ testVisualizationEvent?: () => void;
9
+ testBarChart?: () => void;
10
+ testLineChart?: () => void;
11
+ testTableData?: () => void;
12
+ }
13
+ }
14
+ declare function testVisualizationEvent(): void;
15
+ declare function testBarChart(): void;
16
+ declare function testLineChart(): void;
17
+ declare function testTableData(): void;
18
+ export { testVisualizationEvent, testBarChart, testLineChart, testTableData };
@@ -0,0 +1,8 @@
1
+ import { VoxketInteractiveView } from '../types/rpc';
2
+ /**
3
+ * Visualization RPC Component
4
+ * - Agent calls RPC with schema JSON
5
+ * - RpcManager passes data → this component renders chart/table
6
+ * - Component responds back via handler.didSuccess or handler.didFail
7
+ */
8
+ export declare const VisualizationView: VoxketInteractiveView;
@@ -0,0 +1,39 @@
1
+ import { VoxketClient } from '../core/client';
2
+ import { ChatMessage } from '../types/core';
3
+ import { InteractiveUIState } from '../types/rpc';
4
+ import { ToolExecutionData } from '../types/tools';
5
+ import * as React from 'react';
6
+ export type { ToolExecutionData };
7
+ export declare function useChatMessages(client: VoxketClient): {
8
+ messages: ChatMessage[];
9
+ setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
10
+ isLoading: boolean;
11
+ setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;
12
+ streamingMessages: Set<string>;
13
+ setStreamingMessages: React.Dispatch<React.SetStateAction<Set<string>>>;
14
+ pendingMessages: ChatMessage[];
15
+ setPendingMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
16
+ };
17
+ export declare function useAgentState(client: VoxketClient): {
18
+ agentState: "idle" | "thinking" | "speaking" | "tool_execution";
19
+ setAgentState: React.Dispatch<React.SetStateAction<"idle" | "thinking" | "speaking" | "tool_execution">>;
20
+ toolExecutions: ToolExecutionData[];
21
+ setToolExecutions: React.Dispatch<React.SetStateAction<ToolExecutionData[]>>;
22
+ };
23
+ export declare function useInteractionState(client: VoxketClient): {
24
+ currentInteraction: InteractiveUIState | null;
25
+ setCurrentInteraction: React.Dispatch<React.SetStateAction<InteractiveUIState | null>>;
26
+ };
27
+ export declare function useScrollBehavior(): {
28
+ messagesContainerRef: React.RefObject<HTMLDivElement>;
29
+ shouldAutoScroll: boolean;
30
+ setShouldAutoScroll: React.Dispatch<React.SetStateAction<boolean>>;
31
+ scrollToBottom: (immediate?: boolean) => void;
32
+ smartScrollToBottom: (immediate?: boolean) => void;
33
+ handleScroll: () => void;
34
+ };
35
+ export declare function useMobileDetection(): {
36
+ isMobile: boolean;
37
+ isFullscreen: boolean;
38
+ setIsFullscreen: React.Dispatch<React.SetStateAction<boolean>>;
39
+ };