@voxket-ai/voxket-live 1.0.35 → 1.0.36
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 +183 -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 +46232 -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,13 @@
|
|
|
1
|
+
import { ThemeType } from '../styles';
|
|
2
|
+
import { VoxketClient } from '../core/client';
|
|
3
|
+
import { DisplayType } from './widget';
|
|
4
|
+
interface ChatViewProps {
|
|
5
|
+
client: VoxketClient;
|
|
6
|
+
theme?: ThemeType;
|
|
7
|
+
onBack?: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
displayType?: DisplayType;
|
|
10
|
+
onEndChat?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ChatView({ client, theme, onBack, disabled, displayType, onEndChat, }: ChatViewProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compound Components
|
|
3
|
+
* Advanced composable components for Voxket SDK
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { VoxketSession as VoxketSessionComponent } from './voxket-session';
|
|
7
|
+
export { SessionHeader } from './session-header';
|
|
8
|
+
export { SessionContent } from './session-content';
|
|
9
|
+
export { SessionControls } from './session-controls';
|
|
10
|
+
export { SessionFooter } from './session-footer';
|
|
11
|
+
export { VoxketSession as SessionContainer } from './voxket-session';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SessionContentProps {
|
|
3
|
+
showChat?: boolean;
|
|
4
|
+
showTranscriptions?: boolean;
|
|
5
|
+
customContent?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function SessionContent({ showChat, showTranscriptions, customContent, className }: SessionContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SessionControlsProps {
|
|
3
|
+
showMicrophoneControl?: boolean;
|
|
4
|
+
showCameraControl?: boolean;
|
|
5
|
+
showScreenShareControl?: boolean;
|
|
6
|
+
showSessionActions?: boolean;
|
|
7
|
+
customControls?: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function SessionControls({ showMicrophoneControl, showCameraControl, showScreenShareControl, showSessionActions, customControls, className }: SessionControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SessionFooterProps {
|
|
3
|
+
showMetrics?: boolean;
|
|
4
|
+
showParticipants?: boolean;
|
|
5
|
+
showStatus?: boolean;
|
|
6
|
+
customFooter?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function SessionFooter({ showMetrics, showParticipants, showStatus, customFooter, className }: SessionFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Header Component
|
|
3
|
+
* Displays session status, agent info, and basic controls
|
|
4
|
+
*/
|
|
5
|
+
export interface SessionHeaderProps {
|
|
6
|
+
showConnectionStatus?: boolean;
|
|
7
|
+
showSessionInfo?: boolean;
|
|
8
|
+
showAgentInfo?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function SessionHeader({ showConnectionStatus, showSessionInfo, showAgentInfo, className }: SessionHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface CompoundComponentContext {
|
|
3
|
+
variant?: 'default' | 'minimal' | 'enterprise';
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
theme?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useCompoundContext: () => CompoundComponentContext;
|
|
10
|
+
export interface CompoundProviderProps extends CompoundComponentContext {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function CompoundProvider({ children, ...context }: CompoundProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export interface SlotProps {
|
|
15
|
+
name: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
fallback?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function Slot({ name, children, fallback, className }: SlotProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface CompoundComponentProps {
|
|
22
|
+
variant?: 'default' | 'minimal' | 'enterprise';
|
|
23
|
+
size?: 'sm' | 'md' | 'lg';
|
|
24
|
+
theme?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function withCompoundComponent<T extends Record<string, any>>(Component: React.ComponentType<T>, subComponents?: Record<string, React.ComponentType<any>>): React.ComponentType<T> & Record<string, React.ComponentType<any>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { CompoundComponentProps } from './types';
|
|
3
|
+
import { SessionConfig } from '../../types/core';
|
|
4
|
+
export interface VoxketSessionProps extends CompoundComponentProps {
|
|
5
|
+
agentId?: string;
|
|
6
|
+
sessionConfig?: Partial<SessionConfig>;
|
|
7
|
+
autoStart?: boolean;
|
|
8
|
+
onSessionStart?: (sessionId: string) => void;
|
|
9
|
+
onSessionEnd?: (metrics: any) => void;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const VoxketSession: React.ComponentType<VoxketSessionProps> & Record<string, React.ComponentType<any>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ThemeType } from '../styles';
|
|
2
|
+
import { InteractiveUIState } from '../types/rpc';
|
|
3
|
+
interface InteractiveComponentProps {
|
|
4
|
+
interaction: InteractiveUIState | null;
|
|
5
|
+
theme: ThemeType;
|
|
6
|
+
onDismiss?: () => void;
|
|
7
|
+
client?: any;
|
|
8
|
+
addLocalMessage?: (content: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function InteractiveComponent({ interaction, theme, onDismiss, client, addLocalMessage }: InteractiveComponentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
@@ -13,8 +13,9 @@ export interface AgentControlBarProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
13
13
|
error: Error;
|
|
14
14
|
}) => void;
|
|
15
15
|
theme?: ThemeType;
|
|
16
|
+
client?: any;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* A control bar specifically designed for voice assistant interfaces
|
|
19
20
|
*/
|
|
20
|
-
export declare function AgentControlBar({ controls, saveUserChoices, capabilities, className, onSendMessage, onChatOpenChange, onDisconnect, onDeviceError, theme, ...props }: AgentControlBarProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function AgentControlBar({ controls, saveUserChoices, capabilities, className, onSendMessage, onChatOpenChange, onDisconnect, onDeviceError, theme, client, ...props }: AgentControlBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Track } from 'livekit-client';
|
|
2
|
-
import { TrackReferenceOrPlaceholder
|
|
2
|
+
import { TrackReferenceOrPlaceholder } from '@livekit/components-react';
|
|
3
3
|
export interface ControlBarControls {
|
|
4
4
|
microphone?: boolean;
|
|
5
5
|
screenShare?: boolean;
|
|
@@ -14,13 +14,26 @@ export interface UseAgentControlBarProps {
|
|
|
14
14
|
source: Track.Source;
|
|
15
15
|
error: Error;
|
|
16
16
|
}) => void;
|
|
17
|
+
client?: any;
|
|
17
18
|
}
|
|
18
19
|
export interface UseAgentControlBarReturn {
|
|
19
20
|
micTrackRef: TrackReferenceOrPlaceholder;
|
|
20
21
|
visibleControls: ControlBarControls;
|
|
21
|
-
microphoneToggle:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
microphoneToggle: {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
pending: boolean;
|
|
25
|
+
toggle: (enabled?: boolean) => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
cameraToggle: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
pending: boolean;
|
|
30
|
+
toggle: (enabled?: boolean) => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
screenShareToggle: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
pending: boolean;
|
|
35
|
+
toggle: (enabled?: boolean) => Promise<void>;
|
|
36
|
+
};
|
|
24
37
|
handleDisconnect: () => void;
|
|
25
38
|
handleAudioDeviceChange: (deviceId: string) => void;
|
|
26
39
|
handleVideoDeviceChange: (deviceId: string) => void;
|
|
@@ -9,6 +9,7 @@ type DeviceSelectProps = React.ComponentProps<typeof SelectTrigger> & {
|
|
|
9
9
|
onActiveDeviceChange?: (deviceId: string) => void;
|
|
10
10
|
onDeviceListChange?: (devices: MediaDeviceInfo[]) => void;
|
|
11
11
|
variant?: 'default' | 'small';
|
|
12
|
+
client?: any;
|
|
12
13
|
};
|
|
13
|
-
export declare function DeviceSelect({ kind, track, requestPermissions, onError, ...props }: DeviceSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function DeviceSelect({ kind, track, requestPermissions, onError, client, ...props }: DeviceSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Track } from 'livekit-client';
|
|
2
2
|
import { Toggle } from '../../components/ui/toggle';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
export type TrackToggleProps = React.ComponentProps<typeof Toggle> & {
|
|
5
|
-
source:
|
|
5
|
+
source: Track.Source;
|
|
6
6
|
pending?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare function TrackToggle({ source, pressed, pending, className, ...props }: TrackToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ThemeType } from '../styles';
|
|
3
|
+
import { DisplayType } from './widget';
|
|
3
4
|
interface SessionViewProps {
|
|
4
5
|
disabled: boolean;
|
|
5
6
|
capabilities: {
|
|
@@ -11,6 +12,9 @@ interface SessionViewProps {
|
|
|
11
12
|
participantName: string;
|
|
12
13
|
loadingText?: string;
|
|
13
14
|
theme?: ThemeType;
|
|
15
|
+
client?: any;
|
|
16
|
+
displayType?: DisplayType;
|
|
17
|
+
onBack?: () => void;
|
|
14
18
|
}
|
|
15
|
-
export declare const SessionView: ({ disabled, capabilities, sessionStarted, ref, participantName, loadingText, theme, }: React.ComponentProps<"div"> & SessionViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const SessionView: ({ disabled, capabilities, sessionStarted, ref, participantName, loadingText, theme, client, displayType, onBack, }: React.ComponentProps<"div"> & SessionViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
20
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Components
|
|
3
|
+
* Export all video-related components
|
|
4
|
+
*/
|
|
5
|
+
export { VideoTile } from './video-tile';
|
|
6
|
+
export { VideoGrid } from './video-grid';
|
|
7
|
+
export { VideoControls } from './video-controls';
|
|
8
|
+
export type { VideoTrack, VideoLayout, VideoTileProps, VideoGridProps, VideoControlsProps, VideoState, VideoHookReturn } from '../../types/video';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { VideoControlsProps } from '../../types/video';
|
|
2
|
+
export declare function VideoControls({ localTrack, onToggleCamera, onToggleScreenShare, onLayoutChange, showLayoutControls, showCameraControls, showScreenShareControls, className }: VideoControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ThemeType } from '../styles';
|
|
2
|
+
import { VoxketClient } from '../core/client';
|
|
3
|
+
import { DisplayType } from './widget';
|
|
4
|
+
interface VideoViewProps {
|
|
5
|
+
client: VoxketClient;
|
|
6
|
+
theme?: ThemeType;
|
|
7
|
+
onBack?: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
displayType?: DisplayType;
|
|
10
|
+
onEndCall?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export default function VideoView({ client, theme, onBack, disabled, displayType, onEndCall }: VideoViewProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ThemeType } from '../styles';
|
|
2
|
+
import { SessionModality } from '../types/core';
|
|
2
3
|
interface WelcomeProps {
|
|
3
4
|
disabled: boolean;
|
|
4
5
|
onStartCall: () => void;
|
|
6
|
+
onStartChat: () => void;
|
|
7
|
+
onStartVideo?: () => void;
|
|
5
8
|
agentId: string;
|
|
6
9
|
participantName: string;
|
|
7
10
|
onAgentIdChange: (value: string) => void;
|
|
@@ -11,6 +14,7 @@ interface WelcomeProps {
|
|
|
11
14
|
title?: string;
|
|
12
15
|
subTitle?: string;
|
|
13
16
|
theme?: ThemeType;
|
|
17
|
+
modalities?: SessionModality[];
|
|
14
18
|
}
|
|
15
|
-
export declare const Welcome: ({ disabled, onStartCall, prompts, statusMessage, title, subTitle, theme, }: WelcomeProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Welcome: ({ disabled, onStartCall, onStartChat, onStartVideo, prompts, statusMessage, title, subTitle, theme, modalities, }: WelcomeProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
20
|
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ThemeType } from '../styles';
|
|
2
|
+
import { VoxketClient } from '../core/client';
|
|
3
|
+
import { SessionModality } from '../types/core';
|
|
4
|
+
export type DisplayType = 'fullscreen' | 'widget' | 'popup';
|
|
5
|
+
export type PopupPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
2
6
|
export interface VoxketWidgetProps {
|
|
3
7
|
agentId: string;
|
|
4
8
|
participantName?: string;
|
|
@@ -22,6 +26,13 @@ export interface VoxketWidgetProps {
|
|
|
22
26
|
enableSessionLogging?: boolean;
|
|
23
27
|
onSessionLogsUpdate?: (logs: any[]) => void;
|
|
24
28
|
onSessionMetricsUpdate?: (metrics: any) => void;
|
|
29
|
+
modalities?: SessionModality[];
|
|
30
|
+
displayType?: DisplayType;
|
|
31
|
+
popupPosition?: PopupPosition;
|
|
32
|
+
popupTriggerText?: string;
|
|
33
|
+
onPopupToggle?: (isOpen: boolean) => void;
|
|
34
|
+
onDisplayTypeChange?: (displayType: DisplayType) => void;
|
|
35
|
+
voxketClient?: VoxketClient;
|
|
25
36
|
}
|
|
26
37
|
export default function Widget(props: VoxketWidgetProps & {
|
|
27
38
|
prompts?: string[];
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Room, RemoteParticipant, LocalParticipant, ConnectionState, Track } from 'livekit-client';
|
|
3
|
+
import { VoxketEventEmitter } from './event-emitter';
|
|
4
|
+
import { PluginManager } from '../plugins/plugin-system';
|
|
5
|
+
import { VoxketConfig, SessionConfig, VoxketSession, VoxketEvents, SessionState, SessionMetrics, AgentInfo, ParticipantInfo, ChatMessage, TranscriptionSegment, SessionModality } from '../types/core';
|
|
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
|
+
onDisplayTypeChange?: (displayType: DisplayType) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface VoxketClientConfig extends VoxketConfig {
|
|
27
|
+
agentId?: string;
|
|
28
|
+
participantName?: string;
|
|
29
|
+
modalities?: SessionModality[];
|
|
30
|
+
onConnected?: () => void;
|
|
31
|
+
onDisconnected?: (reason?: string) => void;
|
|
32
|
+
onError?: (error: Error) => void;
|
|
33
|
+
onMessageReceived?: (message: ChatMessage) => void;
|
|
34
|
+
onTranscriptionReceived?: (transcription: TranscriptionSegment) => void;
|
|
35
|
+
onSessionStateChanged?: (state: SessionState) => void;
|
|
36
|
+
onSessionStart?: (sessionId: string) => void;
|
|
37
|
+
onSessionEnd?: (metrics: any) => void;
|
|
38
|
+
onUserJoined?: (userId: string) => void;
|
|
39
|
+
onUserLeft?: (userId: string) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare class VoxketClient extends VoxketEventEmitter<VoxketEvents & RpcEvents> {
|
|
42
|
+
private config;
|
|
43
|
+
private room;
|
|
44
|
+
private pluginManager;
|
|
45
|
+
private rpcManager;
|
|
46
|
+
private isConnected;
|
|
47
|
+
private currentSession;
|
|
48
|
+
private connectionState;
|
|
49
|
+
private renderedComponents;
|
|
50
|
+
private textStreamHandlersRegistered;
|
|
51
|
+
private currentAgentInfo;
|
|
52
|
+
private chatMessages;
|
|
53
|
+
constructor(config: VoxketClientConfig);
|
|
54
|
+
private setupEventListeners;
|
|
55
|
+
private setupRpcEventForwarding;
|
|
56
|
+
private initializeClient;
|
|
57
|
+
private setupRoomEventListeners;
|
|
58
|
+
private setupTextStreamHandlers;
|
|
59
|
+
fetchConnectionDetails(agentId?: string, participantName?: string, modalities?: SessionModality[]): Promise<{
|
|
60
|
+
serverUrl: string;
|
|
61
|
+
participantToken: string;
|
|
62
|
+
voxketSessionId: string;
|
|
63
|
+
agentInfo?: AgentInfo;
|
|
64
|
+
}>;
|
|
65
|
+
connect(agentId?: string, participantName?: string, modalities?: SessionModality[]): Promise<{
|
|
66
|
+
serverUrl: string;
|
|
67
|
+
participantToken: string;
|
|
68
|
+
voxketSessionId: string;
|
|
69
|
+
agentInfo?: AgentInfo;
|
|
70
|
+
}>;
|
|
71
|
+
disconnect(): Promise<void>;
|
|
72
|
+
createSession(config: SessionConfig): Promise<VoxketSession>;
|
|
73
|
+
startSession(agentId?: string, options?: {
|
|
74
|
+
participantName?: string;
|
|
75
|
+
modalities?: SessionModality[];
|
|
76
|
+
metadata?: Record<string, any>;
|
|
77
|
+
}): Promise<VoxketSession>;
|
|
78
|
+
endSession(): Promise<SessionMetrics | null>;
|
|
79
|
+
getCurrentSession(): VoxketSession | null;
|
|
80
|
+
getCurrentAgentInfo(): AgentInfo | null;
|
|
81
|
+
getChatMessages(): ChatMessage[];
|
|
82
|
+
addChatMessage(message: ChatMessage): void;
|
|
83
|
+
updateChatMessage(updatedMessage: ChatMessage): void;
|
|
84
|
+
clearChatMessages(): void;
|
|
85
|
+
renderUI(options?: RenderUIOptions): void;
|
|
86
|
+
removeUI(target?: string | HTMLElement): void;
|
|
87
|
+
removeAllUI(): void;
|
|
88
|
+
private forceCleanupFullscreenOverlays;
|
|
89
|
+
private resolveTarget;
|
|
90
|
+
private getTargetKey;
|
|
91
|
+
sendMessage(message: string, metadata?: Record<string, any>): Promise<void>;
|
|
92
|
+
sendChatMessage(message: string, metadata?: Record<string, any>): Promise<void>;
|
|
93
|
+
sendAttachments(files: File[], metadata?: Record<string, any>): Promise<void>;
|
|
94
|
+
sendAttachment(file: File, metadata?: Record<string, any>): Promise<void>;
|
|
95
|
+
toggleMicrophone(enabled?: boolean): Promise<void>;
|
|
96
|
+
setMicrophoneEnabled(enabled: boolean): Promise<void>;
|
|
97
|
+
toggleCamera(enabled?: boolean): Promise<void>;
|
|
98
|
+
setCameraEnabled(enabled: boolean): Promise<void>;
|
|
99
|
+
enableCamera(): Promise<void>;
|
|
100
|
+
disableCamera(): Promise<void>;
|
|
101
|
+
startScreenShare(): Promise<void>;
|
|
102
|
+
stopScreenShare(): Promise<void>;
|
|
103
|
+
getAudioInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
104
|
+
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
105
|
+
setAudioInputDevice(deviceId: string): Promise<void>;
|
|
106
|
+
setVideoInputDevice(deviceId: string): Promise<void>;
|
|
107
|
+
getLocalParticipant(): LocalParticipant | null;
|
|
108
|
+
getRemoteParticipants(): RemoteParticipant[];
|
|
109
|
+
getPublishPermissions(): {
|
|
110
|
+
camera: boolean;
|
|
111
|
+
microphone: boolean;
|
|
112
|
+
screenShare: boolean;
|
|
113
|
+
data: boolean;
|
|
114
|
+
};
|
|
115
|
+
canPublishSource(source: 'camera' | 'microphone' | 'screenShare'): boolean;
|
|
116
|
+
getRoom(): Room | null;
|
|
117
|
+
getConnectionState(): ConnectionState;
|
|
118
|
+
get connected(): boolean;
|
|
119
|
+
getMicrophoneTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
|
|
120
|
+
getCameraTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
|
|
121
|
+
getScreenShareTrack(): import('livekit-client').LocalTrack<Track.Kind> | null | undefined;
|
|
122
|
+
get isMicrophoneEnabled(): boolean;
|
|
123
|
+
get isCameraEnabled(): boolean;
|
|
124
|
+
get isScreenShareEnabled(): boolean;
|
|
125
|
+
registerPlugin(plugin: any): void;
|
|
126
|
+
getPluginManager(): PluginManager;
|
|
127
|
+
getParticipants(): ParticipantInfo[];
|
|
128
|
+
getSessionMetrics(): SessionMetrics | null;
|
|
129
|
+
updateConfig(updates: Partial<VoxketClientConfig>): void;
|
|
130
|
+
startRecording(): Promise<void>;
|
|
131
|
+
stopRecording(): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Register a frontend RPC method with a React component
|
|
134
|
+
* @param methodName The RPC method name to register
|
|
135
|
+
* @param component React component that implements VoxketInteractiveView
|
|
136
|
+
* @param presentationMode How the component should be displayed
|
|
137
|
+
*/
|
|
138
|
+
registerFrontendRPC(methodName: string, component: VoxketInteractiveView, presentationMode?: ViewPresentationMode): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Get the current interactive RPC component state
|
|
141
|
+
*/
|
|
142
|
+
getCurrentInteraction(): InteractiveUIState | null;
|
|
143
|
+
/**
|
|
144
|
+
* Dismiss the current interactive component
|
|
145
|
+
*/
|
|
146
|
+
dismissCurrentInteraction(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get all registered RPC methods
|
|
149
|
+
*/
|
|
150
|
+
getRegisteredRpcMethods(): string[];
|
|
151
|
+
/**
|
|
152
|
+
* Unregister an RPC method
|
|
153
|
+
*/
|
|
154
|
+
unregisterRpcMethod(methodName: string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Register a custom event listener for VoxketClient events.
|
|
157
|
+
* This is a business-friendly alias for the inherited `on` method.
|
|
158
|
+
* @param eventName The event name to listen for (string)
|
|
159
|
+
* @param callback The callback function to invoke with event data
|
|
160
|
+
* @returns Unsubscribe function
|
|
161
|
+
*
|
|
162
|
+
* Example:
|
|
163
|
+
* client.registerEventListener('chat.message.received', (msg) => { ... });
|
|
164
|
+
*/
|
|
165
|
+
registerEventListener<K extends keyof (VoxketEvents & RpcEvents)>(eventName: K, callback: (data: any) => void): () => void;
|
|
166
|
+
/**
|
|
167
|
+
* Register a custom event emitter for a LiveKit text stream topic.
|
|
168
|
+
* This allows business/consumer code to listen for custom events sent via text stream.
|
|
169
|
+
* @param topic The topic name to listen for (string)
|
|
170
|
+
* @param handler The callback function to invoke with (data, participantInfo)
|
|
171
|
+
* @returns void
|
|
172
|
+
*
|
|
173
|
+
* Example:
|
|
174
|
+
* client.registerEventEmitter('custom_event', (data) => { ... });
|
|
175
|
+
*/
|
|
176
|
+
registerEventEmitter(topic: string, handler: (data: string) => void): void;
|
|
177
|
+
/**
|
|
178
|
+
* Convert markdown text to plain text by removing common markdown formatting
|
|
179
|
+
* @param markdownText The markdown text to convert
|
|
180
|
+
* @returns Plain text without markdown formatting
|
|
181
|
+
*/
|
|
182
|
+
private convertMarkdownToText;
|
|
183
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe event emitter for Voxket SDK
|
|
3
|
+
*/
|
|
4
|
+
export type EventMap = Record<string, (...args: any[]) => void>;
|
|
5
|
+
export declare class VoxketEventEmitter<T extends EventMap> {
|
|
6
|
+
private listeners;
|
|
7
|
+
/**
|
|
8
|
+
* Add an event listener
|
|
9
|
+
*/
|
|
10
|
+
on<K extends keyof T>(event: K, listener: T[K]): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Add a one-time event listener
|
|
13
|
+
*/
|
|
14
|
+
once<K extends keyof T>(event: K, listener: T[K]): () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Remove an event listener
|
|
17
|
+
*/
|
|
18
|
+
off<K extends keyof T>(event: K, listener: T[K]): void;
|
|
19
|
+
/**
|
|
20
|
+
* Remove all listeners for an event
|
|
21
|
+
*/
|
|
22
|
+
removeAllListeners<K extends keyof T>(event?: K): void;
|
|
23
|
+
/**
|
|
24
|
+
* Emit an event
|
|
25
|
+
*/
|
|
26
|
+
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get the number of listeners for an event
|
|
29
|
+
*/
|
|
30
|
+
listenerCount<K extends keyof T>(event: K): number;
|
|
31
|
+
/**
|
|
32
|
+
* Get all event names with listeners
|
|
33
|
+
*/
|
|
34
|
+
eventNames(): (keyof T)[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voxket SDK Core
|
|
3
|
+
* Main entry point for core SDK functionality
|
|
4
|
+
*/
|
|
5
|
+
export { VoxketClient } from './client';
|
|
6
|
+
export { VoxketEventEmitter } from './event-emitter';
|
|
7
|
+
export { VoxketClient as VoxketSDK } from './client';
|
|
8
|
+
export type * from '../types/core';
|
|
9
|
+
export type { RenderUIOptions, VoxketClientConfig } from './client';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Room } from 'livekit-client';
|
|
2
|
+
import { VoxketEventEmitter } from '../core/event-emitter';
|
|
3
|
+
import { VoxketInteractiveView, ViewPresentationMode, InteractiveUIState, RpcEvents } from '../types/rpc';
|
|
4
|
+
/**
|
|
5
|
+
* Manager for Frontend RPC functionality
|
|
6
|
+
*/
|
|
7
|
+
export declare class RpcManager extends VoxketEventEmitter<RpcEvents> {
|
|
8
|
+
private room;
|
|
9
|
+
private registeredMethods;
|
|
10
|
+
private activeInteractions;
|
|
11
|
+
private currentInteraction;
|
|
12
|
+
constructor(room?: Room);
|
|
13
|
+
/**
|
|
14
|
+
* Set the LiveKit room instance
|
|
15
|
+
*/
|
|
16
|
+
setRoom(room: Room): void;
|
|
17
|
+
/**
|
|
18
|
+
* Register a frontend RPC method with a React component
|
|
19
|
+
*/
|
|
20
|
+
registerFrontendRPC(methodName: string, component: VoxketInteractiveView, presentationMode?: ViewPresentationMode): Promise<void>;
|
|
21
|
+
private awaitUserInteraction;
|
|
22
|
+
/**
|
|
23
|
+
* Clear an active interaction
|
|
24
|
+
*/
|
|
25
|
+
private clearInteraction;
|
|
26
|
+
/**
|
|
27
|
+
* Get current interaction state
|
|
28
|
+
*/
|
|
29
|
+
getCurrentInteraction(): InteractiveUIState | null;
|
|
30
|
+
/**
|
|
31
|
+
* Dismiss current interaction
|
|
32
|
+
*/
|
|
33
|
+
dismissCurrentInteraction(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get all registered methods
|
|
36
|
+
*/
|
|
37
|
+
getRegisteredMethods(): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Unregister a method
|
|
40
|
+
*/
|
|
41
|
+
unregisterMethod(methodName: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all registrations and active interactions
|
|
44
|
+
*/
|
|
45
|
+
clear(): void;
|
|
46
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Agent triggers a give_assignment RPC with the exact schema your agent uses
|
|
3
|
+
* This simulates what an AI agent would do to trigger frontend interactive components
|
|
4
|
+
*/
|
|
5
|
+
export declare const agentRpcExample: {
|
|
6
|
+
checkAvailableRpcs(voxketClient: any): Promise<any>;
|
|
7
|
+
triggerAssignment(room: any, participantIdentity: string): Promise<any>;
|
|
8
|
+
processAssignmentResponse(response: any): Promise<{
|
|
9
|
+
status: any;
|
|
10
|
+
assignmentId: any;
|
|
11
|
+
timeSpent: any;
|
|
12
|
+
processed: boolean;
|
|
13
|
+
followupAction: string;
|
|
14
|
+
}>;
|
|
15
|
+
getAssignmentExamples(): {
|
|
16
|
+
marketing: {
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
estimated_time_of_completion: string;
|
|
20
|
+
};
|
|
21
|
+
technical: {
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
estimated_time_of_completion: string;
|
|
25
|
+
};
|
|
26
|
+
research: {
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
|
+
estimated_time_of_completion: string;
|
|
30
|
+
};
|
|
31
|
+
quick: {
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
estimated_time_of_completion: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default agentRpcExample;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VoxketInteractiveView } from '../types/rpc';
|
|
2
|
+
/**
|
|
3
|
+
* Example Assignment View - demonstrates how businesses can create interactive components
|
|
4
|
+
* This component receives data that matches the agent's JSON schema:
|
|
5
|
+
* {
|
|
6
|
+
* "title": "string",
|
|
7
|
+
* "description": "string",
|
|
8
|
+
* "estimated_time_of_completion": "string"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export declare const AssignmentView: VoxketInteractiveView;
|
|
File without changes
|