@voxket-ai/voxket-live 1.0.35 → 1.0.37
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/components/chat-view.d.ts +13 -0
- package/dist/components/compound/index.d.ts +11 -0
- package/dist/components/compound/session-content.d.ts +8 -0
- package/dist/components/compound/session-controls.d.ts +10 -0
- package/dist/components/compound/session-footer.d.ts +9 -0
- package/dist/components/compound/session-header.d.ts +11 -0
- package/dist/components/compound/types.d.ts +28 -0
- package/dist/components/compound/voxket-session.d.ts +12 -0
- package/dist/components/interactive-component.d.ts +11 -0
- package/dist/components/livekit/agent-control-bar/agent-control-bar.d.ts +2 -1
- package/dist/components/livekit/agent-control-bar/hooks/use-agent-control-bar.d.ts +17 -4
- package/dist/components/livekit/agent-control-bar/hooks/use-publish-permissions.d.ts +1 -1
- package/dist/components/livekit/device-select.d.ts +2 -1
- package/dist/components/livekit/track-toggle.d.ts +2 -2
- package/dist/components/session-view.d.ts +5 -1
- package/dist/components/video/index.d.ts +8 -0
- package/dist/components/video/video-controls.d.ts +2 -0
- package/dist/components/video/video-grid.d.ts +2 -0
- package/dist/components/video/video-tile.d.ts +2 -0
- package/dist/components/video-view.d.ts +13 -0
- package/dist/components/welcome.d.ts +5 -1
- package/dist/components/widget.d.ts +11 -0
- package/dist/core/client.d.ts +187 -0
- package/dist/core/event-emitter.d.ts +35 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/rpc-manager.d.ts +46 -0
- package/dist/core/sdk.d.ts +0 -0
- package/dist/examples/agent-rpc-example.d.ts +38 -0
- package/dist/examples/assignment-view.d.ts +11 -0
- package/dist/examples/refactored-usage-examples.d.ts +0 -0
- package/dist/examples/rpc-examples.d.ts +5 -0
- package/dist/hooks/sdk/index.d.ts +10 -0
- package/dist/hooks/sdk/use-chat.d.ts +24 -0
- package/dist/hooks/sdk/use-connection.d.ts +24 -0
- package/dist/hooks/sdk/use-media.d.ts +33 -0
- package/dist/hooks/sdk/use-session.d.ts +26 -0
- package/dist/hooks/sdk/use-video.d.ts +2 -0
- package/dist/hooks/useVoxketClient.d.ts +59 -0
- package/dist/index.cjs +394 -132
- package/dist/index.css +1 -1
- package/dist/index.d.ts +19 -3
- package/dist/index.js +46236 -33965
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/modalities/chat-plugin.d.ts +31 -0
- package/dist/plugins/modalities/voice-plugin.d.ts +8 -0
- package/dist/plugins/plugin-system.d.ts +64 -0
- package/dist/providers/voxket-provider.d.ts +33 -0
- package/dist/styles.d.ts +36 -1
- package/dist/themes/index.d.ts +5 -0
- package/dist/themes/theme-system.d.ts +89 -0
- package/dist/types/chat.d.ts +0 -0
- package/dist/types/client.d.ts +0 -0
- package/dist/types/connection.d.ts +0 -0
- package/dist/types/core.d.ts +186 -0
- package/dist/types/events.d.ts +0 -0
- package/dist/types/media.d.ts +0 -0
- package/dist/types/recording.d.ts +0 -0
- package/dist/types/rpc.d.ts +143 -0
- package/dist/types/session.d.ts +0 -0
- package/dist/types/ui.d.ts +0 -0
- package/dist/types/video.d.ts +92 -0
- package/package.json +19 -9
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat Modality Plugin
|
|
3
|
+
* Enhanced chat capabilities with custom UI components
|
|
4
|
+
*/
|
|
5
|
+
export interface ChatPluginConfig {
|
|
6
|
+
enableRichText?: boolean;
|
|
7
|
+
enableFileUpload?: boolean;
|
|
8
|
+
enableCustomComponents?: boolean;
|
|
9
|
+
maxMessageLength?: number;
|
|
10
|
+
autoScroll?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const chatModalityPlugin: import('../plugin-system').Plugin;
|
|
13
|
+
export interface ChatComponent {
|
|
14
|
+
type: string;
|
|
15
|
+
props: Record<string, any>;
|
|
16
|
+
timestamp: Date;
|
|
17
|
+
}
|
|
18
|
+
export interface QuickAction {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
action: string;
|
|
22
|
+
variant?: 'primary' | 'secondary' | 'danger';
|
|
23
|
+
}
|
|
24
|
+
export interface FormField {
|
|
25
|
+
name: string;
|
|
26
|
+
type: 'text' | 'email' | 'number' | 'select' | 'textarea';
|
|
27
|
+
label: string;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
options?: string[];
|
|
30
|
+
validation?: Record<string, any>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { VoxketClient } from '../core/client';
|
|
2
|
+
import { VoxketEvents } from '../types/core';
|
|
3
|
+
export interface PluginContext {
|
|
4
|
+
client: VoxketClient;
|
|
5
|
+
emit: <K extends keyof VoxketEvents>(event: K, ...args: Parameters<VoxketEvents[K]>) => void;
|
|
6
|
+
on: <K extends keyof VoxketEvents>(event: K, handler: VoxketEvents[K]) => () => void;
|
|
7
|
+
config: Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface Plugin {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
dependencies?: string[];
|
|
14
|
+
install?(context: PluginContext): void | Promise<void>;
|
|
15
|
+
uninstall?(context: PluginContext): void | Promise<void>;
|
|
16
|
+
onSessionStart?(context: PluginContext, sessionId: string): void | Promise<void>;
|
|
17
|
+
onSessionEnd?(context: PluginContext, sessionId: string): void | Promise<void>;
|
|
18
|
+
onAgentResponse?(context: PluginContext, response: any): void | Promise<void>;
|
|
19
|
+
config?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
export declare class PluginManager {
|
|
22
|
+
private plugins;
|
|
23
|
+
private installedPlugins;
|
|
24
|
+
private context;
|
|
25
|
+
constructor(client: VoxketClient);
|
|
26
|
+
/**
|
|
27
|
+
* Register a plugin
|
|
28
|
+
*/
|
|
29
|
+
register(plugin: Plugin): void;
|
|
30
|
+
/**
|
|
31
|
+
* Install a plugin
|
|
32
|
+
*/
|
|
33
|
+
install(pluginName: string, config?: Record<string, any>): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Uninstall a plugin
|
|
36
|
+
*/
|
|
37
|
+
uninstall(pluginName: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a plugin is installed
|
|
40
|
+
*/
|
|
41
|
+
isInstalled(pluginName: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Get list of installed plugins
|
|
44
|
+
*/
|
|
45
|
+
getInstalledPlugins(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Get list of available plugins
|
|
48
|
+
*/
|
|
49
|
+
getAvailablePlugins(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Get plugin info
|
|
52
|
+
*/
|
|
53
|
+
getPluginInfo(pluginName: string): Plugin | undefined;
|
|
54
|
+
private setupPluginEvents;
|
|
55
|
+
}
|
|
56
|
+
export declare function createPlugin(definition: Plugin): Plugin;
|
|
57
|
+
export declare function createModalityPlugin(name: string, modality: string, handlers: {
|
|
58
|
+
onActivate?: (context: PluginContext) => void | Promise<void>;
|
|
59
|
+
onDeactivate?: (context: PluginContext) => void | Promise<void>;
|
|
60
|
+
onMessage?: (context: PluginContext, message: any) => void | Promise<void>;
|
|
61
|
+
}): Plugin;
|
|
62
|
+
export declare const analyticsPlugin: Plugin;
|
|
63
|
+
export declare const debugPlugin: Plugin;
|
|
64
|
+
export declare const metricsPlugin: Plugin;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { VoxketClient } from '../core/client';
|
|
3
|
+
import { VoxketConfig, VoxketSession, SessionState, SessionMetrics, VoxketError, ParticipantInfo, ChatMessage, TranscriptionSegment } from '../types/core';
|
|
4
|
+
export interface VoxketContextValue {
|
|
5
|
+
client: VoxketClient | null;
|
|
6
|
+
isConnected: boolean;
|
|
7
|
+
isConnecting: boolean;
|
|
8
|
+
connectionError: VoxketError | null;
|
|
9
|
+
currentSession: VoxketSession | null;
|
|
10
|
+
sessionState: SessionState;
|
|
11
|
+
sessionMetrics: SessionMetrics | null;
|
|
12
|
+
participants: ParticipantInfo[];
|
|
13
|
+
chatMessages: ChatMessage[];
|
|
14
|
+
transcriptions: TranscriptionSegment[];
|
|
15
|
+
connect: () => Promise<void>;
|
|
16
|
+
disconnect: () => Promise<void>;
|
|
17
|
+
createSession: (agentId: string, options?: any) => Promise<VoxketSession>;
|
|
18
|
+
endSession: () => Promise<SessionMetrics | null>;
|
|
19
|
+
sendChatMessage: (message: string) => Promise<void>;
|
|
20
|
+
setMicrophoneEnabled: (enabled: boolean) => Promise<void>;
|
|
21
|
+
setCameraEnabled: (enabled: boolean) => Promise<void>;
|
|
22
|
+
startScreenShare: () => Promise<void>;
|
|
23
|
+
stopScreenShare: () => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
declare const VoxketContext: React.Context<VoxketContextValue | null>;
|
|
26
|
+
export interface VoxketProviderProps {
|
|
27
|
+
config: VoxketConfig;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
autoConnect?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function VoxketProvider({ config, children, autoConnect }: VoxketProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function useVoxket(): VoxketContextValue;
|
|
33
|
+
export { VoxketContext };
|
package/dist/styles.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export interface WidgetTheme {
|
|
|
15
15
|
accent: string;
|
|
16
16
|
};
|
|
17
17
|
micButton: string;
|
|
18
|
+
chatButton: string;
|
|
19
|
+
videoButton: string;
|
|
20
|
+
popupTrigger: string;
|
|
18
21
|
promptSlider: string;
|
|
19
22
|
statusIndicator: string;
|
|
20
23
|
pulseRings: {
|
|
@@ -23,8 +26,40 @@ export interface WidgetTheme {
|
|
|
23
26
|
ring3: string;
|
|
24
27
|
};
|
|
25
28
|
controlBar: string;
|
|
26
|
-
chatInput:
|
|
29
|
+
chatInput: {
|
|
30
|
+
container: string;
|
|
31
|
+
textarea: string;
|
|
32
|
+
sendButton: string;
|
|
33
|
+
attachButton: string;
|
|
34
|
+
endButton: string;
|
|
35
|
+
};
|
|
36
|
+
chatMessage: {
|
|
37
|
+
own: string;
|
|
38
|
+
other: string;
|
|
39
|
+
};
|
|
40
|
+
chatHeader: {
|
|
41
|
+
container: string;
|
|
42
|
+
backButton: string;
|
|
43
|
+
};
|
|
27
44
|
spinner: string;
|
|
45
|
+
suggestedResponse?: {
|
|
46
|
+
container: string;
|
|
47
|
+
};
|
|
48
|
+
video: {
|
|
49
|
+
container: string;
|
|
50
|
+
header: string;
|
|
51
|
+
headerButton: string;
|
|
52
|
+
statusDot: string;
|
|
53
|
+
controlsBackground: string;
|
|
54
|
+
controlEnabled: string;
|
|
55
|
+
controlDisabled: string;
|
|
56
|
+
endCall: string;
|
|
57
|
+
tile: string;
|
|
58
|
+
placeholder: string;
|
|
59
|
+
avatar: string;
|
|
60
|
+
nameOverlay: string;
|
|
61
|
+
mutedIndicator: string;
|
|
62
|
+
};
|
|
28
63
|
}
|
|
29
64
|
export declare const themes: Record<ThemeType, WidgetTheme>;
|
|
30
65
|
export declare function getTheme(themeType: ThemeType): WidgetTheme;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface VoxketTheme {
|
|
3
|
+
name: string;
|
|
4
|
+
colors: {
|
|
5
|
+
primary: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
accent: string;
|
|
8
|
+
background: string;
|
|
9
|
+
surface: string;
|
|
10
|
+
text: {
|
|
11
|
+
primary: string;
|
|
12
|
+
secondary: string;
|
|
13
|
+
muted: string;
|
|
14
|
+
inverse: string;
|
|
15
|
+
};
|
|
16
|
+
status: {
|
|
17
|
+
success: string;
|
|
18
|
+
warning: string;
|
|
19
|
+
error: string;
|
|
20
|
+
info: string;
|
|
21
|
+
};
|
|
22
|
+
border: string;
|
|
23
|
+
shadow: string;
|
|
24
|
+
};
|
|
25
|
+
typography: {
|
|
26
|
+
fontFamily: string;
|
|
27
|
+
fontSize: {
|
|
28
|
+
xs: string;
|
|
29
|
+
sm: string;
|
|
30
|
+
md: string;
|
|
31
|
+
lg: string;
|
|
32
|
+
xl: string;
|
|
33
|
+
};
|
|
34
|
+
fontWeight: {
|
|
35
|
+
normal: number;
|
|
36
|
+
medium: number;
|
|
37
|
+
semibold: number;
|
|
38
|
+
bold: number;
|
|
39
|
+
};
|
|
40
|
+
lineHeight: {
|
|
41
|
+
tight: number;
|
|
42
|
+
normal: number;
|
|
43
|
+
relaxed: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
spacing: {
|
|
47
|
+
xs: string;
|
|
48
|
+
sm: string;
|
|
49
|
+
md: string;
|
|
50
|
+
lg: string;
|
|
51
|
+
xl: string;
|
|
52
|
+
};
|
|
53
|
+
borderRadius: {
|
|
54
|
+
none: string;
|
|
55
|
+
sm: string;
|
|
56
|
+
md: string;
|
|
57
|
+
lg: string;
|
|
58
|
+
full: string;
|
|
59
|
+
};
|
|
60
|
+
shadows: {
|
|
61
|
+
sm: string;
|
|
62
|
+
md: string;
|
|
63
|
+
lg: string;
|
|
64
|
+
};
|
|
65
|
+
components?: {
|
|
66
|
+
[componentName: string]: Record<string, any>;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export declare const defaultTheme: VoxketTheme;
|
|
70
|
+
export declare const darkTheme: VoxketTheme;
|
|
71
|
+
export declare const enterpriseTheme: VoxketTheme;
|
|
72
|
+
export interface ThemeContextValue {
|
|
73
|
+
theme: VoxketTheme;
|
|
74
|
+
setTheme: (theme: VoxketTheme | string) => void;
|
|
75
|
+
themes: Record<string, VoxketTheme>;
|
|
76
|
+
registerTheme: (theme: VoxketTheme) => void;
|
|
77
|
+
}
|
|
78
|
+
export declare const useTheme: () => ThemeContextValue;
|
|
79
|
+
export interface ThemeProviderProps {
|
|
80
|
+
theme?: VoxketTheme | string;
|
|
81
|
+
themes?: Record<string, VoxketTheme>;
|
|
82
|
+
children: ReactNode;
|
|
83
|
+
cssVariables?: boolean;
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
export declare function ThemeProvider({ theme, themes: customThemes, children, cssVariables, className }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
export declare function flattenTheme(theme: VoxketTheme): Record<string, string>;
|
|
88
|
+
export declare function createCustomTheme(baseTheme: VoxketTheme | undefined, overrides: Partial<VoxketTheme>): VoxketTheme;
|
|
89
|
+
export declare function useComponentTheme(componentName: string): Record<string, any>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Room, RemoteParticipant, LocalParticipant, ConnectionState } from 'livekit-client';
|
|
2
|
+
import { VideoTrack } from './video';
|
|
3
|
+
export interface VoxketConfig {
|
|
4
|
+
/** Your Voxket App ID */
|
|
5
|
+
appId: string;
|
|
6
|
+
/** Your Voxket App Secret */
|
|
7
|
+
appSecret: string;
|
|
8
|
+
/** Base URL for Voxket API services */
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
/** Environment (development, staging, production) */
|
|
11
|
+
environment?: 'development' | 'staging' | 'production';
|
|
12
|
+
/** Enable debug logging */
|
|
13
|
+
debug?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SessionConfig {
|
|
16
|
+
/** Unique identifier for the agent */
|
|
17
|
+
agentId: string;
|
|
18
|
+
/** Display name for the participant */
|
|
19
|
+
participantName?: string;
|
|
20
|
+
/** Session-specific metadata */
|
|
21
|
+
metadata?: Record<string, any>;
|
|
22
|
+
/** Session timeout in milliseconds */
|
|
23
|
+
timeout?: number;
|
|
24
|
+
/** Supported modalities for this session */
|
|
25
|
+
modalities?: SessionModality[];
|
|
26
|
+
}
|
|
27
|
+
export type SessionModality = 'voice' | 'video' | 'chat' | 'screen_share';
|
|
28
|
+
export interface VoxketSession {
|
|
29
|
+
/** Unique session identifier */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Agent identifier */
|
|
32
|
+
agentId: string;
|
|
33
|
+
/** Current session state */
|
|
34
|
+
state: SessionState;
|
|
35
|
+
/** Session start timestamp */
|
|
36
|
+
startedAt?: Date;
|
|
37
|
+
/** Session end timestamp */
|
|
38
|
+
endedAt?: Date;
|
|
39
|
+
/** Session metadata */
|
|
40
|
+
metadata: Record<string, any>;
|
|
41
|
+
/** Active modalities */
|
|
42
|
+
activeModalities: SessionModality[];
|
|
43
|
+
/** Agent information */
|
|
44
|
+
agentInfo?: AgentInfo | null;
|
|
45
|
+
}
|
|
46
|
+
export type SessionState = 'idle' | 'connecting' | 'connected' | 'active' | 'disconnecting' | 'disconnected' | 'error';
|
|
47
|
+
export interface VoxketEvents extends Record<string, (...args: any[]) => void> {
|
|
48
|
+
'connection.connecting': () => void;
|
|
49
|
+
'connection.connected': () => void;
|
|
50
|
+
'connection.disconnected': (reason?: string) => void;
|
|
51
|
+
'connection.disconnecting': () => void;
|
|
52
|
+
'connection.error': (error: VoxketError) => void;
|
|
53
|
+
'connection.reconnecting': () => void;
|
|
54
|
+
'connection.reconnected': () => void;
|
|
55
|
+
'session.created': (session: VoxketSession) => void;
|
|
56
|
+
'session.started': (session: VoxketSession) => void;
|
|
57
|
+
'session.ended': (session: VoxketSession, metrics: SessionMetrics) => void;
|
|
58
|
+
'session.error': (error: VoxketError) => void;
|
|
59
|
+
'session.state.changed': (state: SessionState, previousState: SessionState) => void;
|
|
60
|
+
'agent.joined': (agent: AgentInfo) => void;
|
|
61
|
+
'agent.left': (agent: AgentInfo) => void;
|
|
62
|
+
'agent.speaking.started': (agent: AgentInfo) => void;
|
|
63
|
+
'agent.speaking.stopped': (agent: AgentInfo) => void;
|
|
64
|
+
'agent.response': (response: AgentResponse) => void;
|
|
65
|
+
'participant.joined': (participant: ParticipantInfo) => void;
|
|
66
|
+
'participant.left': (participant: ParticipantInfo) => void;
|
|
67
|
+
'participant.speaking.started': (participant: ParticipantInfo) => void;
|
|
68
|
+
'participant.speaking.stopped': (participant: ParticipantInfo) => void;
|
|
69
|
+
'media.track.published': (track: TrackInfo) => void;
|
|
70
|
+
'media.track.unpublished': (track: TrackInfo) => void;
|
|
71
|
+
'media.track.subscribed': (track: TrackInfo) => void;
|
|
72
|
+
'media.track.unsubscribed': (track: TrackInfo) => void;
|
|
73
|
+
'track.muted': (event: {
|
|
74
|
+
source: string;
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
}) => void;
|
|
77
|
+
'track.unmuted': (event: {
|
|
78
|
+
source: string;
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
}) => void;
|
|
81
|
+
'videoTrackAdded': (track: VideoTrack) => void;
|
|
82
|
+
'videoTrackRemoved': (trackId: string) => void;
|
|
83
|
+
'videoTrackUpdated': (track: VideoTrack) => void;
|
|
84
|
+
'recording.started': (event: {
|
|
85
|
+
sessionId?: string;
|
|
86
|
+
timestamp: Date;
|
|
87
|
+
}) => void;
|
|
88
|
+
'recording.stopped': (event: {
|
|
89
|
+
sessionId?: string;
|
|
90
|
+
timestamp: Date;
|
|
91
|
+
}) => void;
|
|
92
|
+
'chat.message.received': (message: ChatMessage) => void;
|
|
93
|
+
'chat.message.sent': (message: ChatMessage) => void;
|
|
94
|
+
'chat.message.updated': (message: ChatMessage) => void;
|
|
95
|
+
'transcription.received': (transcription: TranscriptionSegment) => void;
|
|
96
|
+
}
|
|
97
|
+
export interface AgentInfo {
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
avatar?: string;
|
|
101
|
+
capabilities: AgentCapability[];
|
|
102
|
+
metadata?: Record<string, any>;
|
|
103
|
+
}
|
|
104
|
+
export type AgentCapability = 'voice_interaction' | 'text_chat' | 'video_call' | 'screen_share' | 'file_upload' | 'custom_ui';
|
|
105
|
+
export interface AgentResponse {
|
|
106
|
+
id: string;
|
|
107
|
+
type: 'text' | 'audio' | 'action' | 'ui_component';
|
|
108
|
+
content: string;
|
|
109
|
+
metadata?: Record<string, any>;
|
|
110
|
+
timestamp: Date;
|
|
111
|
+
agentId: string;
|
|
112
|
+
}
|
|
113
|
+
export interface ParticipantInfo {
|
|
114
|
+
id: string;
|
|
115
|
+
name: string;
|
|
116
|
+
avatar?: string;
|
|
117
|
+
isLocal: boolean;
|
|
118
|
+
metadata?: Record<string, any>;
|
|
119
|
+
}
|
|
120
|
+
export interface TrackInfo {
|
|
121
|
+
id: string;
|
|
122
|
+
kind: 'audio' | 'video';
|
|
123
|
+
source: 'microphone' | 'camera' | 'screen_share';
|
|
124
|
+
participantId: string;
|
|
125
|
+
isEnabled: boolean;
|
|
126
|
+
isMuted: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface ChatMessage {
|
|
129
|
+
id: string;
|
|
130
|
+
content: string;
|
|
131
|
+
timestamp: Date;
|
|
132
|
+
sender: {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string;
|
|
135
|
+
type: 'participant' | 'agent';
|
|
136
|
+
};
|
|
137
|
+
metadata?: Record<string, any>;
|
|
138
|
+
}
|
|
139
|
+
export interface TranscriptionSegment {
|
|
140
|
+
id: string;
|
|
141
|
+
text: string;
|
|
142
|
+
isFinal: boolean;
|
|
143
|
+
startTime: number;
|
|
144
|
+
endTime?: number;
|
|
145
|
+
participantId: string;
|
|
146
|
+
language?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface SessionMetrics {
|
|
149
|
+
sessionId: string;
|
|
150
|
+
duration: number;
|
|
151
|
+
participantCount: number;
|
|
152
|
+
messageCount: number;
|
|
153
|
+
audioQuality: QualityMetrics;
|
|
154
|
+
videoQuality?: QualityMetrics;
|
|
155
|
+
networkStats: NetworkStats;
|
|
156
|
+
events: SessionEvent[];
|
|
157
|
+
}
|
|
158
|
+
export interface QualityMetrics {
|
|
159
|
+
avgBitrate: number;
|
|
160
|
+
avgLatency: number;
|
|
161
|
+
packetLoss: number;
|
|
162
|
+
jitter: number;
|
|
163
|
+
}
|
|
164
|
+
export interface NetworkStats {
|
|
165
|
+
totalBytesReceived: number;
|
|
166
|
+
totalBytesSent: number;
|
|
167
|
+
connectionType: string;
|
|
168
|
+
avgRoundTripTime: number;
|
|
169
|
+
}
|
|
170
|
+
export interface SessionEvent {
|
|
171
|
+
type: string;
|
|
172
|
+
timestamp: Date;
|
|
173
|
+
data?: Record<string, any>;
|
|
174
|
+
}
|
|
175
|
+
export declare class VoxketError extends Error {
|
|
176
|
+
code: VoxketErrorCode;
|
|
177
|
+
details?: Record<string, any> | undefined;
|
|
178
|
+
constructor(message: string, code: VoxketErrorCode, details?: Record<string, any> | undefined);
|
|
179
|
+
}
|
|
180
|
+
export type VoxketErrorCode = 'AUTHENTICATION_FAILED' | 'CONNECTION_FAILED' | 'SESSION_NOT_FOUND' | 'AGENT_NOT_AVAILABLE' | 'PERMISSION_DENIED' | 'NETWORK_ERROR' | 'CONFIGURATION_ERROR' | 'NOT_CONNECTED' | 'RECORDING_ERROR' | 'DEVICE_ERROR' | 'INVALID_PARAMETER' | 'UNKNOWN_ERROR';
|
|
181
|
+
export interface LiveKitIntegration {
|
|
182
|
+
room?: Room;
|
|
183
|
+
localParticipant?: LocalParticipant;
|
|
184
|
+
remoteParticipants: Map<string, RemoteParticipant>;
|
|
185
|
+
connectionState: ConnectionState;
|
|
186
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* RPC Invocation data received from LiveKit
|
|
4
|
+
*/
|
|
5
|
+
export interface RpcInvocationData {
|
|
6
|
+
callerIdentity: string;
|
|
7
|
+
payload: string;
|
|
8
|
+
requestId?: string;
|
|
9
|
+
responseTimeout?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Presentation modes for interactive components
|
|
13
|
+
*/
|
|
14
|
+
export type ViewPresentationMode = 'embedded' | 'modal' | 'fullscreen';
|
|
15
|
+
/**
|
|
16
|
+
* Handler for interactive component responses
|
|
17
|
+
*/
|
|
18
|
+
export interface VoxketInteractiveUIHandler {
|
|
19
|
+
/**
|
|
20
|
+
* Called when user interaction is successful
|
|
21
|
+
* @param data Response data from user interaction
|
|
22
|
+
* @param successView Optional React component to show on success
|
|
23
|
+
*/
|
|
24
|
+
didSuccess(data: Record<string, any>, successView?: React.ReactElement): void;
|
|
25
|
+
/**
|
|
26
|
+
* Called when user interaction fails or times out
|
|
27
|
+
* @param error Error data
|
|
28
|
+
*/
|
|
29
|
+
didFail(error: Record<string, any>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Dismiss the current view and send decline response to agent
|
|
32
|
+
* This notifies the agent that the user dismissed/declined the interaction
|
|
33
|
+
* and sends a structured response indicating the dismissal
|
|
34
|
+
*/
|
|
35
|
+
dismissView(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when user interaction times out
|
|
38
|
+
* @param timeoutView Optional React component to show on timeout
|
|
39
|
+
*/
|
|
40
|
+
didTimeout?(timeoutView?: React.ReactElement): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Props passed to interactive components
|
|
44
|
+
*/
|
|
45
|
+
export interface VoxketInteractiveViewProps {
|
|
46
|
+
/**
|
|
47
|
+
* Handler for component responses
|
|
48
|
+
*/
|
|
49
|
+
handler?: VoxketInteractiveUIHandler;
|
|
50
|
+
/**
|
|
51
|
+
* Load data into the component
|
|
52
|
+
* @param data JSON data from the agent
|
|
53
|
+
*/
|
|
54
|
+
loadData?(data: any): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Timeout for user interaction (in seconds)
|
|
57
|
+
*/
|
|
58
|
+
timeout?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Presentation mode
|
|
61
|
+
*/
|
|
62
|
+
presentationMode?: ViewPresentationMode;
|
|
63
|
+
/**
|
|
64
|
+
* Data passed to the component from the RPC call
|
|
65
|
+
*/
|
|
66
|
+
data?: any;
|
|
67
|
+
/**
|
|
68
|
+
* VoxketClient instance for sending messages and interacting with the session
|
|
69
|
+
*/
|
|
70
|
+
client?: any;
|
|
71
|
+
/**
|
|
72
|
+
* Function to add a local message to the chat without sending to agent
|
|
73
|
+
*/
|
|
74
|
+
addLocalMessage?: (content: string) => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Interface that interactive components must implement
|
|
78
|
+
*/
|
|
79
|
+
export type VoxketInteractiveView = React.ComponentType<VoxketInteractiveViewProps>;
|
|
80
|
+
/**
|
|
81
|
+
* RPC Method registration
|
|
82
|
+
*/
|
|
83
|
+
export interface RpcMethodRegistration {
|
|
84
|
+
methodName: string;
|
|
85
|
+
component: VoxketInteractiveView;
|
|
86
|
+
presentationMode: ViewPresentationMode;
|
|
87
|
+
timeout?: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* RPC Response data
|
|
91
|
+
*/
|
|
92
|
+
export interface RpcResponseData {
|
|
93
|
+
success: boolean;
|
|
94
|
+
data?: Record<string, any>;
|
|
95
|
+
message?: string;
|
|
96
|
+
error?: Record<string, any>;
|
|
97
|
+
timestamp: Date;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* RPC Method handler function
|
|
101
|
+
*/
|
|
102
|
+
export type RpcMethodHandler = (data: RpcInvocationData) => Promise<string>;
|
|
103
|
+
/**
|
|
104
|
+
* Interactive UI state
|
|
105
|
+
*/
|
|
106
|
+
export interface InteractiveUIState {
|
|
107
|
+
isVisible: boolean;
|
|
108
|
+
methodName: string;
|
|
109
|
+
component: VoxketInteractiveView | null;
|
|
110
|
+
presentationMode: ViewPresentationMode;
|
|
111
|
+
timeout: number;
|
|
112
|
+
data: any;
|
|
113
|
+
handler: VoxketInteractiveUIHandler | null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Events related to RPC interactions
|
|
117
|
+
*/
|
|
118
|
+
export interface RpcEvents {
|
|
119
|
+
'rpc.method.registered': (data: {
|
|
120
|
+
methodName: string;
|
|
121
|
+
}) => void;
|
|
122
|
+
'rpc.method.called': (data: {
|
|
123
|
+
methodName: string;
|
|
124
|
+
data: RpcInvocationData;
|
|
125
|
+
}) => void;
|
|
126
|
+
'rpc.interaction.started': (data: {
|
|
127
|
+
methodName: string;
|
|
128
|
+
presentationMode: ViewPresentationMode;
|
|
129
|
+
}) => void;
|
|
130
|
+
'rpc.interaction.completed': (data: {
|
|
131
|
+
methodName: string;
|
|
132
|
+
response: RpcResponseData;
|
|
133
|
+
}) => void;
|
|
134
|
+
'rpc.interaction.timeout': (data: {
|
|
135
|
+
methodName: string;
|
|
136
|
+
response: RpcResponseData;
|
|
137
|
+
}) => void;
|
|
138
|
+
'rpc.interaction.dismissed': (data: {
|
|
139
|
+
methodName: string;
|
|
140
|
+
response: RpcResponseData;
|
|
141
|
+
}) => void;
|
|
142
|
+
[key: string]: (...args: any[]) => void;
|
|
143
|
+
}
|
|
File without changes
|
|
File without changes
|