@d-id/client-sdk 1.1.23 → 1.1.24-staging.111
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/index.js +1742 -26
- package/dist/index.umd.cjs +13 -13
- package/dist/src/services/analytics/timestamp-tracker.d.ts +5 -0
- package/dist/src/services/interrupt/index.d.ts +2 -1
- package/dist/src/services/streaming-manager/common.d.ts +13 -0
- package/dist/src/services/streaming-manager/livekit-manager.d.ts +11 -2
- package/dist/src/services/streaming-manager/livekit-manager.test.d.ts +1 -0
- package/dist/src/types/entities/agents/chat.d.ts +1 -0
- package/dist/src/types/entities/agents/manager.d.ts +19 -1
- package/dist/src/types/stream/stream.d.ts +8 -0
- package/package.json +1 -1
- package/dist/index-CVpJq_KA.js +0 -1375
- package/dist/livekit-manager-COVqmQzK.js +0 -188
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CreateStreamOptions, StreamType } from '../../types';
|
|
1
|
+
import { CreateSessionV2Options, CreateStreamOptions, StreamType } from '../../types';
|
|
2
2
|
import { StreamingManager } from '../streaming-manager';
|
|
3
3
|
|
|
4
4
|
export declare function validateInterrupt(streamingManager: StreamingManager<CreateStreamOptions> | undefined, streamType: StreamType | undefined, videoId: string | null): void;
|
|
5
5
|
export declare function sendInterrupt(streamingManager: StreamingManager<CreateStreamOptions>, videoId: string): Promise<void>;
|
|
6
|
+
export declare function sendInterruptV2(streamingManager: StreamingManager<CreateSessionV2Options>): Promise<void>;
|
|
@@ -26,6 +26,19 @@ export type StreamingManager<T extends CreateStreamOptions | CreateSessionV2Opti
|
|
|
26
26
|
* supported only for livekit manager
|
|
27
27
|
*/
|
|
28
28
|
sendTextMessage?(payload: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Publish a microphone stream to the DataChannel
|
|
31
|
+
* Can be called after connection to add microphone input
|
|
32
|
+
* @param stream The MediaStream containing the microphone audio track
|
|
33
|
+
* supported only for livekit manager
|
|
34
|
+
*/
|
|
35
|
+
publishMicrophoneStream?(stream: MediaStream): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Unpublish the currently published microphone stream
|
|
38
|
+
* Can be called after connection to remove microphone input
|
|
39
|
+
* supported only for livekit manager
|
|
40
|
+
*/
|
|
41
|
+
unpublishMicrophoneStream?(): Promise<void>;
|
|
29
42
|
/**
|
|
30
43
|
* Session identifier information, should be returned in the body of all streaming requests
|
|
31
44
|
*/
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { CreateSessionV2Options, CreateStreamOptions, StreamingManagerOptions } from '../../types';
|
|
2
2
|
import { StreamingManager } from './common';
|
|
3
3
|
|
|
4
|
+
export declare enum DataChannelTopic {
|
|
5
|
+
Chat = "lk.chat",
|
|
6
|
+
Speak = "did.speak",
|
|
7
|
+
Interrupt = "did.interrupt"
|
|
8
|
+
}
|
|
4
9
|
export declare function handleInitError(error: unknown, log: (message?: any, ...optionalParams: any[]) => void, callbacks: StreamingManagerOptions['callbacks'], markInitialConnectionDone: () => void): void;
|
|
5
|
-
export declare function createLiveKitStreamingManager<T extends CreateSessionV2Options>(agentId: string, sessionOptions: CreateSessionV2Options, options: StreamingManagerOptions): Promise<StreamingManager<T
|
|
6
|
-
|
|
10
|
+
export declare function createLiveKitStreamingManager<T extends CreateSessionV2Options>(agentId: string, sessionOptions: CreateSessionV2Options, options: StreamingManagerOptions): Promise<StreamingManager<T> & {
|
|
11
|
+
reconnect(): Promise<void>;
|
|
12
|
+
}>;
|
|
13
|
+
export type LiveKitStreamingManager<T extends CreateStreamOptions> = StreamingManager<T> & {
|
|
14
|
+
reconnect(): Promise<void>;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -26,6 +26,10 @@ export declare enum ChatProgress {
|
|
|
26
26
|
* Server processed message and returned response
|
|
27
27
|
*/
|
|
28
28
|
Answer = "answer",
|
|
29
|
+
/**
|
|
30
|
+
* Audio-transcribed user message
|
|
31
|
+
*/
|
|
32
|
+
Transcribe = "transcribe",
|
|
29
33
|
/**
|
|
30
34
|
* Chat was closed
|
|
31
35
|
*/
|
|
@@ -127,7 +131,7 @@ interface StreamOptions {
|
|
|
127
131
|
export interface AgentManagerOptions {
|
|
128
132
|
auth: Auth;
|
|
129
133
|
callbacks: ManagerCallbacks;
|
|
130
|
-
mode
|
|
134
|
+
mode?: ChatMode;
|
|
131
135
|
baseURL?: string;
|
|
132
136
|
wsURL?: string;
|
|
133
137
|
debug?: boolean;
|
|
@@ -138,6 +142,7 @@ export interface AgentManagerOptions {
|
|
|
138
142
|
streamOptions?: StreamOptions;
|
|
139
143
|
initialMessages?: Message[];
|
|
140
144
|
persistentChat?: boolean;
|
|
145
|
+
microphoneStream?: MediaStream;
|
|
141
146
|
}
|
|
142
147
|
export interface AgentManager {
|
|
143
148
|
/**
|
|
@@ -178,6 +183,19 @@ export interface AgentManager {
|
|
|
178
183
|
* Method to close all connections with agent, stream and web socket
|
|
179
184
|
*/
|
|
180
185
|
disconnect: () => Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Publish a microphone stream to the data channel
|
|
188
|
+
* Can be called after connection to add microphone input
|
|
189
|
+
* @param stream The MediaStream containing the microphone audio track
|
|
190
|
+
* supported only for livekit manager
|
|
191
|
+
*/
|
|
192
|
+
publishMicrophoneStream?: (stream: MediaStream) => Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Unpublish the currently published microphone stream
|
|
195
|
+
* Can be called after connection to remove microphone input
|
|
196
|
+
* supported only for livekit manager
|
|
197
|
+
*/
|
|
198
|
+
unpublishMicrophoneStream?: () => Promise<void>;
|
|
181
199
|
/**
|
|
182
200
|
* Method to send a chat message to existing chat with the agent
|
|
183
201
|
* @param messages
|
|
@@ -22,6 +22,7 @@ export declare enum AgentActivityState {
|
|
|
22
22
|
export declare enum StreamEvents {
|
|
23
23
|
ChatAnswer = "chat/answer",
|
|
24
24
|
ChatPartial = "chat/partial",
|
|
25
|
+
ChatAudioTranscribed = "chat/audio-transcribed",
|
|
25
26
|
StreamDone = "stream/done",
|
|
26
27
|
StreamStarted = "stream/started",
|
|
27
28
|
StreamFailed = "stream/error",
|
|
@@ -60,6 +61,7 @@ export interface ManagerCallbacks {
|
|
|
60
61
|
session_id: string;
|
|
61
62
|
agent_id: string;
|
|
62
63
|
}) => void;
|
|
64
|
+
onStreamReady?: () => void;
|
|
63
65
|
}
|
|
64
66
|
export type ManagerCallbackKeys = keyof ManagerCallbacks;
|
|
65
67
|
export interface StreamEndUserData {
|
|
@@ -88,6 +90,12 @@ export interface StreamingManagerOptions {
|
|
|
88
90
|
debug?: boolean;
|
|
89
91
|
auth: Auth;
|
|
90
92
|
analytics: Analytics;
|
|
93
|
+
/**
|
|
94
|
+
* Optional MediaStream to use for microphone input.
|
|
95
|
+
* If provided, the audio track from this stream will be published to the data channel.
|
|
96
|
+
* Supported by LiveKit streaming managers.
|
|
97
|
+
*/
|
|
98
|
+
microphoneStream?: MediaStream;
|
|
91
99
|
}
|
|
92
100
|
export interface SlimRTCStatsReport {
|
|
93
101
|
index: number;
|