@d-id/client-sdk 1.1.52 → 1.1.54-staging.242

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;
@@ -2,11 +2,14 @@ export interface BearerToken {
2
2
  type: 'bearer';
3
3
  token: string;
4
4
  }
5
- export interface BasicAuth {
5
+ export type BasicAuth = {
6
+ type: 'basic';
7
+ token: string;
8
+ } | {
6
9
  type: 'basic';
7
10
  username: string;
8
11
  password: string;
9
- }
12
+ };
10
13
  export interface ClientKeyAuth {
11
14
  type: 'key';
12
15
  clientKey: string;
@@ -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
  /**
@@ -27,4 +27,5 @@ export interface ClipPresenter extends BasePresenter {
27
27
  }
28
28
  export interface ExpresivePresenter extends BasePresenter {
29
29
  type: 'expressive';
30
+ presenter_id: string;
30
31
  }
@@ -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 {
@@ -1,6 +1,9 @@
1
1
  import { Agent } from '../types';
2
2
 
3
3
  type AgentType = 'clip_v2' | Agent['presenter']['type'];
4
+ export type PresenterType = 'v4' | 'v3-pro' | 'v2';
4
5
  export declare const getAgentType: (presenter: Agent["presenter"]) => AgentType;
6
+ export declare const getPresenterType: (presenter: Agent["presenter"]) => PresenterType;
7
+ export declare const getPresenterIdentifier: (presenter: Agent["presenter"]) => string;
5
8
  export declare const isStreamsV2Agent: (type: AgentType) => boolean;
6
9
  export {};
@@ -14,6 +14,8 @@ export declare function getAnalyticsInfo(agent: Agent): {
14
14
  export declare function getAgentInfo(agent: Agent): {
15
15
  from?: string | undefined;
16
16
  agentType: "talk" | "clip" | "expressive" | "clip_v2";
17
+ presenterType: import('./agent').PresenterType;
18
+ presenter: string;
17
19
  owner_id: string;
18
20
  promptVersion: "v1" | "v2" | null | undefined;
19
21
  behavior: {
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.52",
4
+ "version": "1.1.54-staging.242",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {