@d-id/client-sdk 1.1.53 → 1.1.54-staging.243

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.
@@ -9,6 +9,7 @@ type ConnectToManagerOptions = AgentManagerOptions & {
9
9
  onMessage?: ChatProgressCallback;
10
10
  /** Internal callback for when interrupt is detected by streaming manager */
11
11
  onInterruptDetected?: (interrupt: Interrupt) => void;
12
+ onFirstAudioDetected?: (latency?: number) => void;
12
13
  };
13
14
  chatId?: string;
14
15
  };
@@ -13,3 +13,8 @@ export declare const streamReadyTimestampTracker: {
13
13
  update: () => number;
14
14
  get: (delta?: boolean) => number;
15
15
  };
16
+ export declare const sttLatencyStore: {
17
+ set: (newValue: number | undefined) => void;
18
+ get: () => number | undefined;
19
+ reset: () => void;
20
+ };
@@ -67,6 +67,10 @@ export type StreamingManager<T extends CreateStreamOptions | CreateSessionV2Opti
67
67
  * Whether interrupt functionality is available for this stream
68
68
  */
69
69
  interruptAvailable: boolean;
70
+ /**
71
+ * Whether the current stream segment can be interrupted by the user
72
+ */
73
+ isInterruptible: boolean;
70
74
  /**
71
75
  * Whether triggers functionality is available for this stream
72
76
  */
@@ -0,0 +1,3 @@
1
+ import { ChatProgress } from '../../types/entities/agents/manager';
2
+
3
+ export declare const chatEventMap: Record<string, ChatProgress>;
@@ -1,6 +1,10 @@
1
1
  import { ConnectivityState, StreamingState } from '../../../types';
2
2
  import { VideoRTCStatsReport } from './report';
3
3
 
4
+ export declare function createAudioStatsDetector(getStats: () => Promise<RTCStatsReport | undefined>, onFirstAudioDetected: () => void): {
5
+ arm(): void;
6
+ destroy(): void;
7
+ };
4
8
  export declare function createVideoStatsMonitor(getStats: () => Promise<RTCStatsReport | undefined>, getIsConnected: () => boolean, onConnected: () => void, onVideoStateChange?: (state: StreamingState, statsReport?: VideoRTCStatsReport) => void, onConnectivityStateChange?: (state: ConnectivityState) => void): {
5
9
  start: () => void;
6
10
  stop: () => void;
@@ -1,6 +1,6 @@
1
1
  import { STTTokenResponse } from '../..';
2
2
  import { Auth } from '../../auth';
3
- import { AgentActivityState, CompatibilityMode, ConnectionState, ConnectivityState, SendStreamPayloadResponse, StreamEvents, StreamType, StreamingState } from '../../stream';
3
+ import { AgentActivityState, CompatibilityMode, ConnectionState, ConnectivityState, SendStreamPayloadResponse, StreamEvents, StreamType, StreamingState, ToolCallingPayload, ToolResultPayload } from '../../stream';
4
4
  import { SupportedStreamScript } from '../../stream-script';
5
5
  import { ManagerCallbacks as StreamManagerCallbacks } from '../../stream/stream';
6
6
  import { Agent } from './agent';
@@ -92,6 +92,17 @@ interface ManagerCallbacks {
92
92
  * @param stream - object containing stream_id, session_id and agent_id
93
93
  */
94
94
  onStreamCreated?: StreamManagerCallbacks['onStreamCreated'];
95
+ /**
96
+ * Optional callback function that will be triggered when tool events occur during the call
97
+ * @param event - The tool event type (tool/calling or tool/result)
98
+ * @param data - The tool event payload
99
+ */
100
+ onToolEvent?: (event: StreamEvents.ToolCalling | StreamEvents.ToolResult, data: ToolCallingPayload | ToolResultPayload) => void;
101
+ /**
102
+ * Optional callback function that will be triggered when the interruptible state changes
103
+ * @param interruptible - Whether the agent can be interrupted by the user
104
+ */
105
+ onInterruptibleChange?: StreamManagerCallbacks['onInterruptibleChange'];
95
106
  }
96
107
  interface StreamOptions {
97
108
  /**
@@ -19,7 +19,8 @@ export declare enum ConnectivityState {
19
19
  export declare enum AgentActivityState {
20
20
  Idle = "IDLE",
21
21
  Loading = "LOADING",
22
- Talking = "TALKING"
22
+ Talking = "TALKING",
23
+ ToolActive = "TOOL_ACTIVE"
23
24
  }
24
25
  export declare enum StreamEvents {
25
26
  ChatAnswer = "chat/answer",
@@ -34,7 +35,9 @@ export declare enum StreamEvents {
34
35
  StreamVideoCreated = "stream-video/started",
35
36
  StreamVideoDone = "stream-video/done",
36
37
  StreamVideoError = "stream-video/error",
37
- StreamVideoRejected = "stream-video/rejected"
38
+ StreamVideoRejected = "stream-video/rejected",
39
+ ToolCalling = "tool/calling",
40
+ ToolResult = "tool/result"
38
41
  }
39
42
  export declare enum ConnectionState {
40
43
  New = "new",
@@ -66,6 +69,9 @@ export interface ManagerCallbacks {
66
69
  }) => void;
67
70
  onStreamReady?: () => void;
68
71
  onInterruptDetected?: (interrupt: Interrupt) => void;
72
+ onToolEvent?: (event: StreamEvents.ToolCalling | StreamEvents.ToolResult, data: ToolCallingPayload | ToolResultPayload) => void;
73
+ onInterruptibleChange?: (interruptible: boolean) => void;
74
+ onFirstAudioDetected?: (latency?: number) => void;
69
75
  }
70
76
  export type ManagerCallbackKeys = keyof ManagerCallbacks;
71
77
  export interface StreamEndUserData {
@@ -147,3 +153,17 @@ export interface StreamInterruptPayload {
147
153
  videoId: string;
148
154
  timestamp: number;
149
155
  }
156
+ export interface ToolCallingPayload {
157
+ execution_id: string;
158
+ tool_name: string;
159
+ arguments: Record<string, unknown>;
160
+ created_at: string;
161
+ }
162
+ export interface ToolResultPayload {
163
+ execution_id: string;
164
+ tool_name: string;
165
+ duration_ms: number;
166
+ result?: unknown;
167
+ error_message?: string | null;
168
+ created_at: string;
169
+ }
@@ -2,7 +2,9 @@ export declare enum TransportProvider {
2
2
  Livekit = "livekit"
3
3
  }
4
4
  export interface CreateSessionV2Options {
5
- transport_provider: TransportProvider.Livekit;
5
+ transport: {
6
+ provider: TransportProvider.Livekit;
7
+ };
6
8
  chat_persist?: boolean;
7
9
  }
8
10
  export interface CreateSessionV2Response {
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.53",
4
+ "version": "1.1.54-staging.243",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {