@d-id/client-sdk 2.0.10-staging.411 → 3.0.0-staging.412

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.
Files changed (49) hide show
  1. package/README.md +53 -264
  2. package/dist/{index-BgmEitAw.js → index-BLrKDuV_.js} +3002 -2825
  3. package/dist/index.js +23 -31
  4. package/dist/index.umd.cjs +5 -5
  5. package/dist/{livekit-manager-CgErNpNN.js → livekit-manager-Cfb9x2ei.js} +53 -50
  6. package/dist/src/api/agents.d.ts +1 -1
  7. package/dist/src/api/apiClient.d.ts +1 -1
  8. package/dist/src/api/knowledge.d.ts +1 -1
  9. package/dist/src/api/streams/streamApi.d.ts +1 -1
  10. package/dist/src/api/streams/streamsApiV2.d.ts +1 -1
  11. package/dist/src/errors/base-error.d.ts +170 -1
  12. package/dist/src/errors/chat/chat-creation-failed.d.ts +24 -0
  13. package/dist/src/errors/chat/chat-mode-downgraded.d.ts +29 -0
  14. package/dist/src/errors/http-error.d.ts +67 -5
  15. package/dist/src/errors/index.d.ts +1 -0
  16. package/dist/src/errors/network-error.d.ts +62 -8
  17. package/dist/src/errors/request-meta.d.ts +12 -0
  18. package/dist/src/errors/stream-error.d.ts +32 -0
  19. package/dist/src/errors/validation-error.d.ts +62 -1
  20. package/dist/src/errors/ws-error.d.ts +29 -0
  21. package/dist/src/index.d.ts +18 -4
  22. package/dist/src/public-api.test.d.ts +1 -0
  23. package/dist/src/services/agent-manager/index.d.ts +46 -6
  24. package/dist/src/services/chat/intial-messages.test.d.ts +1 -0
  25. package/dist/src/services/streaming-manager/common.d.ts +8 -3
  26. package/dist/src/types/auth.d.ts +78 -6
  27. package/dist/src/types/entities/agents/agent.d.ts +152 -6
  28. package/dist/src/types/entities/agents/chat.d.ts +384 -12
  29. package/dist/src/types/entities/agents/manager.d.ts +795 -215
  30. package/dist/src/types/entities/avatar.d.ts +21 -0
  31. package/dist/src/types/entities/index.d.ts +1 -1
  32. package/dist/src/types/entities/knowledge/document.d.ts +7 -8
  33. package/dist/src/types/entities/knowledge/knowledge.d.ts +20 -0
  34. package/dist/src/types/entities/knowledge/record.d.ts +8 -0
  35. package/dist/src/types/entities/knowledge/retrival.d.ts +4 -0
  36. package/dist/src/types/stream/api/clip.d.ts +8 -9
  37. package/dist/src/types/stream/api/talk.d.ts +8 -9
  38. package/dist/src/types/stream/rtc.d.ts +54 -4
  39. package/dist/src/types/stream/stream.d.ts +553 -34
  40. package/dist/src/types/stream/streams-v2.d.ts +12 -0
  41. package/dist/src/types/stream-script.d.ts +92 -19
  42. package/dist/src/types/voice/stt.d.ts +12 -0
  43. package/dist/src/types/voice/tts.d.ts +149 -64
  44. package/dist/src/utils/analytics.d.ts +2 -2
  45. package/dist/src/utils/content-parser.d.ts +31 -0
  46. package/dist/src/utils/tool-calls.d.ts +21 -2
  47. package/dist/src/version.d.ts +6 -0
  48. package/package.json +7 -3
  49. package/dist/src/types/entities/video.d.ts +0 -6
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The kind of avatar an agent is built on, which is what decides how its video is produced.
3
+ *
4
+ * It is the `type` of the agent's avatar ({@link Agent.avatar}) and so determines which SDK
5
+ * features a session has: {@link AvatarType.Talk | talk} is Talks (V2),
6
+ * {@link AvatarType.Clip | clip} is Clips (V3), and {@link AvatarType.Expressive | expressive} is
7
+ * Expressive (V4).
8
+ *
9
+ * @category Agent Manager
10
+ */
11
+ export declare enum AvatarType {
12
+ /** A Clips (V3) agent: a pre-recorded presenter, driven by the D-ID Clips pipeline. */
13
+ Clip = "clip",
14
+ /** A Talks (V2) agent: a still photo animated to speak. */
15
+ Talk = "talk",
16
+ /**
17
+ * An Expressive (V4) avatar: a real-time avatar that also supports microphone and camera
18
+ * publishing, client tools and interruption.
19
+ */
20
+ Expressive = "expressive"
21
+ }
@@ -1,3 +1,3 @@
1
1
  export * from './agents';
2
+ export * from './avatar';
2
3
  export * from './knowledge';
3
- export * from './video';
@@ -4,18 +4,13 @@ import { DocumentType, KnowledgeType } from './knowledge';
4
4
  * Lifecycle status of a document, as served by the knowledge API. The API stores the
5
5
  * status as a prefixed event subject (`document/done`) but strips the prefix on read,
6
6
  * so the wire value is always bare.
7
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
7
8
  */
8
9
  export type DocumentStatus = 'created' | 'processed' | 'done' | 'rejected' | 'error';
9
10
  /**
10
- * @deprecated The knowledge API has never served these prefixed values — it strips the
11
- * subject prefix on read. Use `DocumentStatus` instead. Kept for backwards compatibility
12
- * and will be removed in the next major.
11
+ * A document as returned by the Knowledge API.
12
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
13
13
  */
14
- export declare enum Subject {
15
- KnowledgeProcessing = "knowledge/processing",
16
- KnowledgeFailed = "knowledge/error",
17
- KnowledgeDone = "knowledge/done"
18
- }
19
14
  export interface DocumentData {
20
15
  created_at: string;
21
16
  modified_at: string;
@@ -29,4 +24,8 @@ export interface DocumentData {
29
24
  parsed_url: string;
30
25
  title: string;
31
26
  }
27
+ /**
28
+ * Request payload for creating a document, derived from `DocumentData`.
29
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
30
+ */
32
31
  export type CreateDocumentPayload = Omit<DocumentData, 'created_by' | 'parsed_url' | 'status' | 'type' | 'created_at' | 'modified_at' | 'id' | 'owner_id'>;
@@ -1,8 +1,16 @@
1
+ /**
2
+ * Kind of a knowledge entity as stored by the Knowledge API.
3
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
4
+ */
1
5
  export declare enum KnowledgeType {
2
6
  Knowledge = "knowledge",
3
7
  Document = "document",
4
8
  Record = "record"
5
9
  }
10
+ /**
11
+ * File format of a document ingested into the Knowledge API.
12
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
13
+ */
6
14
  export declare enum DocumentType {
7
15
  Pdf = "pdf",
8
16
  Text = "text",
@@ -18,9 +26,17 @@ export declare enum DocumentType {
18
26
  Audio = "audio",
19
27
  Video = "video"
20
28
  }
29
+ /**
30
+ * Result of parsing a document's raw content for the Knowledge API.
31
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
32
+ */
21
33
  export interface IParserResult {
22
34
  data: string;
23
35
  }
36
+ /**
37
+ * A knowledge entity as returned by the Knowledge API.
38
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
39
+ */
24
40
  export interface KnowledgeData {
25
41
  created_at: string;
26
42
  modified_at: string;
@@ -33,4 +49,8 @@ export interface KnowledgeData {
33
49
  name: string;
34
50
  starter_message?: string[];
35
51
  }
52
+ /**
53
+ * Request payload for creating a knowledge entity, derived from `KnowledgeData`.
54
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
55
+ */
36
56
  export type KnowledgePayload = Omit<KnowledgeData, 'created_by' | 'type' | 'created_at' | 'modified_at' | 'id' | 'owner_id'>;
@@ -1,5 +1,9 @@
1
1
  import { KnowledgeType } from './knowledge';
2
2
 
3
+ /**
4
+ * A record (chunk of a document) as returned by the Knowledge API.
5
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
6
+ */
3
7
  export interface RecordData {
4
8
  created_at: string;
5
9
  modified_at: string;
@@ -13,4 +17,8 @@ export interface RecordData {
13
17
  title: string;
14
18
  data: string;
15
19
  }
20
+ /**
21
+ * Request payload for creating a record, derived from `RecordData`.
22
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
23
+ */
16
24
  export type CreateRecordPayload = Omit<RecordData, 'created_by' | 'type' | 'created_at' | 'modified_at' | 'id' | 'owner_id'>;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Result of a knowledge-base query against the Knowledge API.
3
+ * @internal The SDK exposes no knowledge methods; manage knowledge through the D-ID API.
4
+ */
1
5
  export interface QueryResult {
2
6
  documentIds: string[];
3
7
  result: any;
@@ -24,16 +24,11 @@ interface ClipConfig {
24
24
  */
25
25
  result_format?: 'mp4' | 'gif' | 'mov' | 'webm';
26
26
  }
27
+ /**
28
+ * Wire request body for creating a clip stream.
29
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
30
+ */
27
31
  export interface CreateClipStreamRequest {
28
- /**
29
- * The output resolution sets the maximum height or width of the streamed video.
30
- * The aspect ratio is preserved from the source video.
31
- * When resolution is not configured, it defaults to the agent output resolution.
32
- * @minimum 150
33
- * @maximum 1080
34
- * @example 512
35
- */
36
- output_resolution?: number;
37
32
  /**
38
33
  * Defines the video codec to be used in the stream.
39
34
  * When set to on: VP8 will be used.
@@ -56,6 +51,10 @@ export interface CreateClipStreamRequest {
56
51
  */
57
52
  session_timeout?: number;
58
53
  }
54
+ /**
55
+ * Wire payload sent to advance a clip stream with a new script.
56
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
57
+ */
59
58
  export interface SendClipStreamPayload extends StickyRequest {
60
59
  script: StreamScript;
61
60
  /**
@@ -1,6 +1,10 @@
1
1
  import { StreamScript } from '../..';
2
2
  import { CompatibilityMode } from '../stream';
3
3
 
4
+ /**
5
+ * Wire request body for creating a legacy (talk) stream.
6
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
7
+ */
4
8
  export interface CreateTalkStreamRequest {
5
9
  driver_url?: string;
6
10
  face?: {
@@ -21,15 +25,6 @@ export interface CreateTalkStreamRequest {
21
25
  align_expand_factor?: number;
22
26
  stitch?: boolean;
23
27
  };
24
- /**
25
- * The output resolution sets the maximum height or width of the streamed video.
26
- * The aspect ratio is preserved from the source image.
27
- * When resolution is not configured, it defaults to the agent output resolution.
28
- * @minimum 150
29
- * @maximum 1080
30
- * @example 512
31
- */
32
- output_resolution?: number;
33
28
  /**
34
29
  * Defines the video codec to be used in the stream.
35
30
  * When set to on: VP8 will be used.
@@ -52,6 +47,10 @@ export interface CreateTalkStreamRequest {
52
47
  */
53
48
  session_timeout?: number;
54
49
  }
50
+ /**
51
+ * Wire payload sent to advance a talk stream with a new script.
52
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
53
+ */
55
54
  export interface SendTalkStreamPayload {
56
55
  script: StreamScript;
57
56
  resultUrl?: string;
@@ -1,7 +1,8 @@
1
+ /**
2
+ * Carrier of the `session_id` that keeps successive streaming requests on the same server session.
3
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
4
+ */
1
5
  export interface StickyRequest {
2
- /**
3
- * session identifier information, should be returned in the body of all streaming requests
4
- */
5
6
  session_id?: string;
6
7
  }
7
8
  interface Jsep {
@@ -14,6 +15,10 @@ interface Jsep {
14
15
  */
15
16
  sdp: string;
16
17
  }
18
+ /**
19
+ * STUN/TURN server credentials returned by the Agents API for establishing the WebRTC connection.
20
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
21
+ */
17
22
  export interface IceServer {
18
23
  /**
19
24
  * URL of the server - can be multiple addresses
@@ -28,6 +33,10 @@ export interface IceServer {
28
33
  */
29
34
  credential?: string;
30
35
  }
36
+ /**
37
+ * Response of `POST /agents/{id}/streams`: the SDP offer and ICE servers for the WebRTC handshake.
38
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
39
+ */
31
40
  export interface ICreateStreamRequestResponse extends StickyRequest {
32
41
  id: string;
33
42
  jsep: Jsep;
@@ -36,6 +45,10 @@ export interface ICreateStreamRequestResponse extends StickyRequest {
36
45
  fluent?: boolean;
37
46
  interrupt_enabled?: boolean;
38
47
  }
48
+ /**
49
+ * A single ICE candidate exchanged during the WebRTC connection handshake.
50
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
51
+ */
39
52
  export interface IceCandidate {
40
53
  /**
41
54
  * A string representing the transport address for the candidate that can be used for connectivity checks.
@@ -54,11 +67,48 @@ export interface IceCandidate {
54
67
  */
55
68
  sdpMLineIndex?: number;
56
69
  }
70
+ /**
71
+ * Bare `{ status }` envelope returned by the streaming endpoints that report only success or failure.
72
+ * @internal Wire type of the streaming transport; not part of the public SDK surface.
73
+ */
57
74
  export interface Status {
58
75
  status: string;
59
76
  }
60
- export interface SendStreamPayloadResponse extends Status, StickyRequest {
77
+ /**
78
+ * What {@link AgentManager.speak | speak()} resolves with: the video the agent is about to stream.
79
+ *
80
+ * The fields come from the Talks (V2) and Clips (V3) API, which generates a discrete video while
81
+ * answering the request. Where no such video exists the call still resolves, with the same stub —
82
+ * `status` `'success'`, `duration` `0` and an empty `video_id`: on Expressive (V4) agents, whose
83
+ * speech is streamed over the data channel rather than rendered as a separate video, and in a
84
+ * text-only chat mode ({@link ChatMode.TextOnly}, {@link ChatMode.Playground} or
85
+ * {@link ChatMode.Maintenance}), which produces no video at all.
86
+ *
87
+ * @category Speak & Scripts
88
+ */
89
+ export interface SendStreamPayloadResponse {
90
+ /**
91
+ * Whether the server accepted the speak request — `'success'` when it did.
92
+ */
93
+ status: string;
94
+ /**
95
+ * Id of the session this call was made on; the SDK sends it back on later streaming requests.
96
+ */
97
+ session_id?: string;
98
+ /**
99
+ * Duration of the generated video as reported by the Agents API for Talks (V2) and Clips (V3)
100
+ * agents. `0` when the call produced no discrete video — on Expressive (V4) agents, and in a
101
+ * text-only chat mode.
102
+ */
61
103
  duration: number;
104
+ /**
105
+ * Id of the generated video.
106
+ *
107
+ * Use it to correlate this call with the video the agent then plays, which
108
+ * {@link AgentManagerCallbacks.onVideoStateChange | onVideoStateChange} reports the start and
109
+ * end of, and which {@link AgentManager.interrupt | interrupt()} cancels. Empty when the call
110
+ * produced no discrete video — on Expressive (V4) agents, and in a text-only chat mode.
111
+ */
62
112
  video_id: string;
63
113
  }
64
114
  export {};