@d-id/client-sdk 1.1.23 → 1.1.24-staging.112

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.
@@ -8,3 +8,8 @@ export declare const interruptTimestampTracker: {
8
8
  update: () => number;
9
9
  get: (delta?: boolean) => number;
10
10
  };
11
+ export declare const streamReadyTimestampTracker: {
12
+ reset: () => number;
13
+ update: () => number;
14
+ get: (delta?: boolean) => number;
15
+ };
@@ -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
- export type LiveKitStreamingManager<T extends CreateStreamOptions> = StreamingManager<T>;
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
+ };
@@ -27,6 +27,7 @@ export interface Message {
27
27
  context?: string;
28
28
  videoId?: string;
29
29
  interrupted?: boolean;
30
+ transcribed?: boolean;
30
31
  }
31
32
  export interface ChatPayload {
32
33
  messages: Message[];
@@ -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: ChatMode;
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-id/client-sdk",
3
3
  "private": false,
4
- "version": "1.1.23",
4
+ "version": "1.1.24-staging.112",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {