@d-id/client-sdk 2.0.7 → 2.0.8-staging.406
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 +21 -20
- package/dist/{index-DeKPoqBL.js → index-DUjMi4Bk.js} +2286 -2270
- package/dist/index.js +22 -21
- package/dist/index.umd.cjs +5 -5
- package/dist/{livekit-manager-D7YZEQiJ.js → livekit-manager-6LqByuLV.js} +205 -186
- package/dist/src/services/agent-manager/connect-to-manager.d.ts +2 -1
- package/dist/src/services/socket-manager/message-queue.d.ts +1 -1
- package/dist/src/services/streaming-manager/stats/poll.d.ts +1 -1
- package/dist/src/services/streaming-manager/stats/report.d.ts +1 -1
- package/dist/src/types/entities/agents/manager.d.ts +2 -1
- package/dist/src/types/stream/stream.d.ts +19 -0
- package/dist/src/utils/stream-end.d.ts +5 -0
- package/dist/src/utils/stream-end.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StreamingManager } from '../streaming-manager';
|
|
2
|
-
import { Agent, AgentManagerOptions, AgentsAPI, AudioDetectionMetrics, Chat, ChatProgressCallback, CreateSessionV2Options, CreateStreamOptions } from '../../types';
|
|
2
|
+
import { Agent, AgentManagerOptions, AgentsAPI, AudioDetectionMetrics, Chat, ChatProgressCallback, CreateSessionV2Options, CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
3
3
|
import { Analytics } from '../analytics/mixpanel';
|
|
4
4
|
|
|
5
5
|
type ConnectToManagerOptions = AgentManagerOptions & {
|
|
@@ -10,6 +10,7 @@ type ConnectToManagerOptions = AgentManagerOptions & {
|
|
|
10
10
|
onFirstAudioDetected?: (metrics: AudioDetectionMetrics) => void;
|
|
11
11
|
};
|
|
12
12
|
chatId?: string;
|
|
13
|
+
rpcMethods?: StreamingManagerOptions['rpcMethods'];
|
|
13
14
|
};
|
|
14
15
|
export declare function initializeStreamAndChat(agent: Agent, options: ConnectToManagerOptions, agentsApi: AgentsAPI, analytics: Analytics, chat?: Chat): Promise<{
|
|
15
16
|
chat?: Chat;
|
|
@@ -6,7 +6,7 @@ export interface ChatEventQueue {
|
|
|
6
6
|
[sequence: number]: string;
|
|
7
7
|
answer?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare function createMessageEventQueue(analytics: Analytics, items: AgentManagerItems, options: AgentManagerOptions, agentEntity: Agent, onStreamDone: () => void): {
|
|
9
|
+
export declare function createMessageEventQueue(analytics: Analytics, items: AgentManagerItems, options: AgentManagerOptions, agentEntity: Agent, onStreamDone: (reason?: string) => void): {
|
|
10
10
|
clearQueue: () => void;
|
|
11
11
|
onMessage: (event: ChatProgress | StreamEvents, data: any) => void;
|
|
12
12
|
};
|
|
@@ -12,5 +12,5 @@ export declare function createAudioStatsDetector(getStats: () => Promise<RTCStat
|
|
|
12
12
|
export declare function createVideoStatsMonitor(getStats: () => Promise<RTCStatsReport | undefined>, getIsConnected: () => boolean, onConnected: () => void, onVideoStateChange?: (state: StreamingState, statsReport?: VideoRTCStatsReport) => void, onConnectivityStateChange?: (state: ConnectivityState) => void): {
|
|
13
13
|
start: () => void;
|
|
14
14
|
stop: () => void;
|
|
15
|
-
getReport: () => VideoRTCStatsReport;
|
|
15
|
+
getReport: () => VideoRTCStatsReport | null;
|
|
16
16
|
};
|
|
@@ -16,4 +16,4 @@ export interface VideoRTCStatsReport {
|
|
|
16
16
|
resolution: string;
|
|
17
17
|
}
|
|
18
18
|
export declare function formatStats(stats: RTCStatsReport): SlimRTCStatsReport;
|
|
19
|
-
export declare function createVideoStatsReport(stats: SlimRTCStatsReport[], interval: number, previousStats?: SlimRTCStatsReport): VideoRTCStatsReport;
|
|
19
|
+
export declare function createVideoStatsReport(stats: SlimRTCStatsReport[], interval: number, previousStats?: SlimRTCStatsReport): VideoRTCStatsReport | null;
|
|
@@ -42,8 +42,9 @@ interface ManagerCallbacks {
|
|
|
42
42
|
/**
|
|
43
43
|
* Optional callback will be triggered each time the RTC connection changes state
|
|
44
44
|
* @param state
|
|
45
|
+
* @param reason - a `StreamEndReason` when the server ended the stream, otherwise a diagnostic string
|
|
45
46
|
*/
|
|
46
|
-
onConnectionStateChange?(state: ConnectionState): void;
|
|
47
|
+
onConnectionStateChange?(state: ConnectionState, reason?: string): void;
|
|
47
48
|
/**
|
|
48
49
|
* Optional callback function that will be triggered each time video events happen
|
|
49
50
|
* @param state
|
|
@@ -70,6 +70,10 @@ export declare enum StreamType {
|
|
|
70
70
|
Legacy = "legacy",
|
|
71
71
|
Fluent = "fluent"
|
|
72
72
|
}
|
|
73
|
+
/** @internal */
|
|
74
|
+
export type RpcMethodHandler = (data: {
|
|
75
|
+
payload: string;
|
|
76
|
+
}) => Promise<string>;
|
|
73
77
|
export interface ManagerCallbacks {
|
|
74
78
|
onMessage?: ChatProgressCallback;
|
|
75
79
|
onConnectionStateChange?: (state: ConnectionState, reason?: string) => void;
|
|
@@ -128,6 +132,12 @@ export interface StreamingManagerOptions {
|
|
|
128
132
|
* Supported by LiveKit streaming managers.
|
|
129
133
|
*/
|
|
130
134
|
microphoneStream?: MediaStream;
|
|
135
|
+
/**
|
|
136
|
+
* RPC methods to register on the room before it connects, so the agent can
|
|
137
|
+
* call them from the moment this participant joins.
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
rpcMethods?: ReadonlyMap<string, RpcMethodHandler>;
|
|
131
141
|
}
|
|
132
142
|
export interface SlimRTCStatsReport {
|
|
133
143
|
index: number;
|
|
@@ -240,6 +250,15 @@ export type ToolEventPayload = ToolCallStartedPayload | ToolCallDonePayload | To
|
|
|
240
250
|
export interface TurnEventPayload {
|
|
241
251
|
turn_id: number | null;
|
|
242
252
|
}
|
|
253
|
+
export declare enum StreamEndReason {
|
|
254
|
+
Ok = "ok",
|
|
255
|
+
UnknownError = "unknown_error",
|
|
256
|
+
NetworkIssue = "network_issue",
|
|
257
|
+
MessageLimit = "message_limit",
|
|
258
|
+
TimeLimit = "time_limit",
|
|
259
|
+
Inactivity = "inactivity",
|
|
260
|
+
EndedByAgent = "ended_by_agent"
|
|
261
|
+
}
|
|
243
262
|
export type ToolEventCallback = {
|
|
244
263
|
(event: StreamEvents.ToolCallStarted, data: ToolCallStartedPayload): void;
|
|
245
264
|
(event: StreamEvents.ToolCallDone, data: ToolCallDonePayload): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|