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

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 +54 -265
  2. package/dist/{index-K6rHpqny.js → index-BOeL7MEm.js} +3002 -2825
  3. package/dist/index.js +23 -31
  4. package/dist/index.umd.cjs +5 -5
  5. package/dist/{livekit-manager-25aUaO_G.js → livekit-manager-D-B3qdMq.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
@@ -1,104 +1,476 @@
1
- export declare enum RateState {
2
- Unrated = "Unrated",
3
- Positive = "Positive",
4
- Negative = "Negative"
5
- }
1
+ /**
2
+ * A rating stored against one message of a chat, as the Agents API returns it.
3
+ *
4
+ * Produced by {@link AgentManager.rate | rate()} and returned again by
5
+ * {@link AgentManager.deleteRate | deleteRate()}. Keep {@link RatingEntity.id | id} if the user may
6
+ * change their mind: pass it back to {@link AgentManager.rate | rate()} as `rateId` to update the
7
+ * rating, or to {@link AgentManager.deleteRate | deleteRate()} to remove it.
8
+ *
9
+ * @category Chat
10
+ */
6
11
  export interface RatingEntity {
12
+ /**
13
+ * Id of this rating.
14
+ *
15
+ * Pass it as the `rateId` argument of {@link AgentManager.rate | rate()} to update the rating,
16
+ * or to {@link AgentManager.deleteRate | deleteRate()} to remove it.
17
+ */
7
18
  id: string;
19
+ /** Id of the D-ID account that owns the agent the rating was left on. Set by the Agents API. */
8
20
  owner_id: string;
21
+ /** Id of the agent whose answer was rated. */
9
22
  agent_id: string;
23
+ /**
24
+ * The knowledge citations that were attached to the rated answer, as `[document_id, id]` pairs.
25
+ *
26
+ * The SDK builds them from the {@link Message.matches | matches} of the rated message, so a
27
+ * negative rating can be traced back to the documents the answer was drawn from. Empty when the
28
+ * answer cited nothing.
29
+ */
10
30
  matches: [string, string][];
31
+ /**
32
+ * Id of the agent's knowledge base ({@link Agent.knowledge}) at the time of the rating.
33
+ *
34
+ * An empty string when the agent has no knowledge base.
35
+ */
11
36
  knowledge_id: string;
37
+ /**
38
+ * The end-user identifier the Agents API recorded for the request.
39
+ *
40
+ * Derived from the credentials the SDK sends, which carry
41
+ * {@link AgentManagerOptions.externalId | externalId} for `type: 'key'` authorization.
42
+ */
12
43
  external_id: string;
44
+ /** Identity the Agents API attributed the rating to. Set by the Agents API. */
13
45
  created_by: string;
46
+ /** Id of the chat the rated message belongs to — the value
47
+ * {@link AgentManagerCallbacks.onNewChat | onNewChat} reported. */
14
48
  chat_id: string;
49
+ /** The score itself: `1` for a positive rating, `-1` for a negative one. */
15
50
  score: 1 | -1;
51
+ /** When the rating was created, as an ISO 8601 timestamp. */
16
52
  created_at: string;
53
+ /** When the rating was last changed, as an ISO 8601 timestamp. */
17
54
  modified_at: string;
55
+ /** {@link Message.id | Id of the message} that was rated. */
18
56
  message_id: string;
19
57
  }
58
+ /**
59
+ * Request payload for rating a chat message, derived from `RatingEntity`.
60
+ * @internal Implementation type; not part of the public SDK surface.
61
+ */
20
62
  export type RatingPayload = Omit<RatingEntity, 'owner_id' | 'id' | 'created_at' | 'modified_at' | 'created_by' | 'external_id' | 'agent_id' | 'chat_id'>;
63
+ /**
64
+ * What the Agents API stored when end-of-call feedback was submitted.
65
+ *
66
+ * Returned by {@link AgentManager.submitFeedback | submitFeedback()}, which rates the conversation
67
+ * as a whole rather than a single answer.
68
+ *
69
+ * @category Chat
70
+ */
21
71
  export interface SubmitFeedbackResponse {
72
+ /** Id of the chat the feedback belongs to — the value
73
+ * {@link AgentManagerCallbacks.onNewChat | onNewChat} reported. */
22
74
  chat_id: string;
75
+ /** The score that was submitted, on the agent's end-of-call scale of 1 to 5. */
23
76
  rating: number;
77
+ /**
78
+ * The follow-up question the user was asked, when one was recorded.
79
+ *
80
+ * Applications pick it from {@link EndOfCallFeedbackConfig.follow_up_messages}.
81
+ */
24
82
  question_shown?: string;
83
+ /** When the feedback was stored, as an ISO 8601 timestamp. */
25
84
  submitted_at: string;
26
85
  }
86
+ /**
87
+ * One renderable piece of a message: a run of text, an image, a video or a link.
88
+ *
89
+ * {@link parseMessageParts} splits a message's {@link Message.content | content} into these, and
90
+ * the SDK keeps the result on {@link Message.parts}. Switch on `type` when rendering. Anything the
91
+ * parser did not recognise is preserved verbatim as a `text` part, in its original order, and
92
+ * nothing is dropped or reordered; a recognised image, video or link replaces the markup it was
93
+ * written as, so the parts are not a concatenation of the original string.
94
+ *
95
+ * @category Chat
96
+ */
27
97
  export type MessagePart = {
98
+ /** Discriminant: plain text that the parser found no markup in. */
28
99
  type: 'text';
100
+ /** The text itself, exactly as it appeared in {@link Message.content}. */
29
101
  text: string;
30
102
  } | {
103
+ /** Discriminant: an image, from markdown image syntax such as `![alt](url)`. */
31
104
  type: 'image';
105
+ /** URL of the image. */
32
106
  src: string;
107
+ /** The alt text from the markdown, or an empty string when it had none. */
33
108
  alt: string;
109
+ /**
110
+ * `image/gif` when the URL itself ends in `.gif`, ignoring case; absent otherwise.
111
+ *
112
+ * The check looks at the whole URL, so a query string or fragment suppresses it —
113
+ * `cat.gif?v=2` carries no `mimeType`. Video detection differs: it strips both before
114
+ * looking at the extension.
115
+ */
34
116
  mimeType?: string;
35
117
  } | {
118
+ /**
119
+ * Discriminant: a video, either from thumbnail syntax (`[![alt](thumb)](video)`) or from
120
+ * an image whose URL ends in `.mp4`, `.webm`, `.mkv`, `.mov`, `.m4v` or `.ogv` once any
121
+ * query string and fragment have been stripped.
122
+ */
36
123
  type: 'video';
124
+ /** URL of the video file. */
37
125
  src: string;
126
+ /** The alt text from the markdown, or an empty string when it had none. */
38
127
  alt: string;
128
+ /** URL of the poster image, when the thumbnail syntax supplied one. */
39
129
  thumbnail?: string;
40
130
  } | {
131
+ /** Discriminant: a link, from markdown `[label](url)` or from an HTML `<a href>`. */
41
132
  type: 'link';
133
+ /** Target of the link. */
42
134
  href: string;
135
+ /** The text shown for the link. */
43
136
  label: string;
44
137
  };
138
+ /**
139
+ * One message of a chat: what the user asked, or what the agent answered.
140
+ *
141
+ * The SDK keeps the whole transcript and hands a fresh copy of it to
142
+ * {@link AgentManagerCallbacks.onNewMessage | onNewMessage} every time a message is added or
143
+ * changed, oldest first. While an answer streams in, the last message's
144
+ * {@link Message.content | content} and {@link Message.parts | parts} are replaced with the latest
145
+ * text on each `partial` callback — not appended to — and are final on `answer`. The same shape is
146
+ * accepted by {@link AgentManagerOptions.initialMessages | initialMessages} to seed a transcript.
147
+ *
148
+ * @category Chat
149
+ */
45
150
  export interface Message {
151
+ /**
152
+ * Id of this message.
153
+ *
154
+ * Pass it to {@link AgentManager.rate | rate()} to rate the answer. The SDK generates a random
155
+ * id for the messages it creates locally, and uses the id sent with the message for those that
156
+ * arrive from the agent.
157
+ */
46
158
  id: string;
159
+ /**
160
+ * Who the message is from.
161
+ *
162
+ * The SDK itself only creates `user` (the end user) and `assistant` (the agent) messages; the
163
+ * value on a transcribed or streamed message is whatever the server payload carried. `system`,
164
+ * `function` and `tool` exist because the underlying chat protocol allows them.
165
+ */
47
166
  role?: 'system' | 'assistant' | 'user' | 'function' | 'tool';
167
+ /**
168
+ * The message text.
169
+ *
170
+ * Plain text, which for agent answers may contain markdown. It is replaced by the latest text
171
+ * on every `partial` callback while the answer streams in — and the final `answer` may be
172
+ * shorter than the partials before it, which is exactly how the SDK spots an interruption — so
173
+ * render it as it is rather than appending to what you rendered before.
174
+ */
48
175
  content: string;
176
+ /**
177
+ * {@link Message.content | content} split into renderable pieces by {@link parseMessageParts}.
178
+ *
179
+ * Kept in step with `content` on every message the SDK creates, including while an answer
180
+ * streams in. Render these instead of the raw string when the agent may answer with images,
181
+ * videos or links; a message with no markup is a single `text` part, and an empty message is
182
+ * an empty array.
183
+ *
184
+ * {@link AgentManagerOptions.initialMessages | initialMessages} are treated the same way: the
185
+ * SDK runs the parser over the `content` of any of them that arrives with empty or missing
186
+ * `parts`, so a restored transcript can pass `parts: []` and still render. A non-empty array
187
+ * you built yourself is kept exactly as given.
188
+ */
49
189
  parts: MessagePart[];
190
+ /** When the message was added, as an ISO 8601 timestamp. */
50
191
  created_at?: string;
192
+ /**
193
+ * The knowledge citations the answer was drawn from, as {@link RetrievalMetadata} entries.
194
+ *
195
+ * Present on an agent answer when the chat response carried them, so a UI can show its sources;
196
+ * {@link AgentManager.rate | rate()} also sends them with a rating. The SDK strips this field
197
+ * from the transcript it sends back to the Agents API with the next
198
+ * {@link AgentManager.chat | chat()}.
199
+ */
51
200
  matches?: ChatResponse['matches'];
201
+ /**
202
+ * The retrieved context the answer was generated from, as
203
+ * {@link ChatResponse.context | the chat response} supplied it.
204
+ *
205
+ * Only ever set on an agent answer, and only when the answer came back from the Agents API.
206
+ * Expressive (V4) agents chat over the data channel instead, so their answers carry no context
207
+ * — except in {@link ChatMode.Playground}, which always takes the Agents API path.
208
+ */
52
209
  context?: string;
53
- videoId?: string;
210
+ /**
211
+ * `true` when the answer was cut short instead of being spoken to the end.
212
+ *
213
+ * Set on the last message by {@link AgentManager.interrupt | interrupt()}, and by the SDK when
214
+ * the final answer turns out to be shorter than the partial text already received — which is
215
+ * how it detects that the agent was interrupted mid-utterance.
216
+ */
54
217
  interrupted?: boolean;
218
+ /**
219
+ * `true` when this user message came from speech-to-text rather than from
220
+ * {@link AgentManager.chat | chat()}.
221
+ *
222
+ * It is what distinguishes an utterance the user spoke from one they typed.
223
+ */
55
224
  transcribed?: boolean;
56
- sentiment?: {
57
- id: string;
58
- name: string;
59
- };
225
+ /**
226
+ * The sentiment the agent delivered this answer with, when the stream reported one.
227
+ *
228
+ * Taken from the metadata the server sends with the video it created, and attached to the most
229
+ * recent agent answer. The SDK only ever fills it in from an Expressive (V4) session, and only
230
+ * while {@link AgentManagerOptions.debug | debug} is enabled.
231
+ */
232
+ sentiment?: MessageSentiment;
233
+ }
234
+ /**
235
+ * The sentiment an agent answer was delivered with, as the server reported it.
236
+ *
237
+ * The shape of {@link Message.sentiment}. It is an object rather than a string because the server
238
+ * reports both the id of the sentiment it used and its name, where
239
+ * {@link TextStreamScript.sentiment} — the sentiment the application *asks* for — is just the
240
+ * name.
241
+ *
242
+ * @category Chat
243
+ */
244
+ export interface MessageSentiment {
245
+ /** Id of the sentiment, as the server sent it. */
246
+ id: string;
247
+ /** Name of the sentiment, as the server sent it. */
248
+ name: string;
60
249
  }
250
+ /**
251
+ * Request payload for sending a chat message to the Agents API.
252
+ * @internal Implementation type; not part of the public SDK surface.
253
+ */
61
254
  export interface ChatPayload {
62
255
  messages: Message[];
63
256
  streamId?: string;
64
257
  sessionId?: string;
65
258
  chatMode?: ChatMode;
66
259
  }
67
- export interface IRetrivalMetadata {
260
+ /**
261
+ * One knowledge citation: the passage of the agent's knowledge base an answer was drawn from.
262
+ *
263
+ * The Agents API returns these with an answer and the SDK keeps them on
264
+ * {@link Message.matches | matches}, so a UI can show the sources behind a reply.
265
+ *
266
+ * @category Chat
267
+ */
268
+ export interface RetrievalMetadata {
269
+ /** Id of this match. Sent back with a rating as the second half of a
270
+ * {@link RatingEntity.matches} pair. */
68
271
  id: string;
272
+ /** The matched passage itself, as stored in the knowledge base. */
69
273
  data: string;
274
+ /** Title of the document the passage comes from. */
70
275
  title: string;
276
+ /** Id of the source document. Sent back with a rating as the first half of a
277
+ * {@link RatingEntity.matches} pair. */
71
278
  document_id: string;
279
+ /** Id of the knowledge base the document belongs to — the agent's {@link Agent.knowledge}. */
72
280
  knowledge_id: string;
281
+ /** URL of the original source, for linking the citation out of the chat. */
73
282
  source_url: string;
74
283
  }
284
+ /**
285
+ * How the agent answers: with a streamed video, as text only, or not at all.
286
+ *
287
+ * Chosen with {@link AgentManagerOptions.mode | mode} and changed later with
288
+ * {@link AgentManager.changeMode | changeMode()}, which reports the new value through
289
+ * {@link AgentManagerCallbacks.onModeChange | onModeChange}. Switching to anything other than
290
+ * {@link ChatMode.Functional} disconnects the stream. What the mode decides at creation time is
291
+ * narrower than it looks: whether a chat is created for the session, and whether the notifications
292
+ * web socket is opened. {@link AgentManager.connect | connect()} establishes the video stream in
293
+ * every mode. The server can also answer with a different mode than the one asked for when the chat
294
+ * is created; the SDK then adopts it and reports a {@link ChatModeDowngraded} error through
295
+ * {@link AgentManagerCallbacks.onError | onError}.
296
+ *
297
+ * @category Chat
298
+ */
75
299
  export declare enum ChatMode {
300
+ /**
301
+ * Chat and video: the agent answers questions with its own LLM, in a streamed video.
302
+ *
303
+ * The default when {@link AgentManagerOptions.mode | mode} is omitted, and the only mode a
304
+ * session can be in while a stream is connected and chat is available at the same time:
305
+ * {@link AgentManager.changeMode | changeMode()} to any other value disconnects the stream.
306
+ */
76
307
  Functional = "Functional",
308
+ /**
309
+ * Text answers only: the chat works, but no video is produced.
310
+ *
311
+ * {@link AgentManager.chat | chat()} still returns answers through
312
+ * {@link AgentManagerCallbacks.onNewMessage | onNewMessage}, and
313
+ * {@link AgentManager.speak | speak()} adds a text script to the transcript but streams no
314
+ * video: it resolves with a `duration` of `0` and an empty `video_id`.
315
+ */
77
316
  TextOnly = "TextOnly",
317
+ /**
318
+ * The agent is unavailable: {@link AgentManager.chat | chat()} throws a
319
+ * {@link ValidationError}.
320
+ *
321
+ * The SDK switches to it by itself when connecting fails after its retries, so a UI can show
322
+ * that the agent is temporarily out of service; the server can also return it when a chat is
323
+ * created. Like {@link ChatMode.TextOnly} it produces no video.
324
+ */
78
325
  Maintenance = "Maintenance",
326
+ /**
327
+ * A text-only test conversation, used by the agent playground in D-ID Studio.
328
+ *
329
+ * Produces no video, and marks each chat request with a playground header so the Agents API
330
+ * can treat it as a test. Chats in this mode always go over the Agents API, even for
331
+ * Expressive (V4) agents, which otherwise chat over the data channel. Applications normally
332
+ * use {@link ChatMode.Functional} or {@link ChatMode.TextOnly} instead.
333
+ */
79
334
  Playground = "Playground",
335
+ /**
336
+ * Speak-only: no chat is created for the session, while video still streams.
337
+ *
338
+ * Talks (V2) and Clips (V3) agents only; {@link createAgentManager} and
339
+ * {@link AgentManager.changeMode | changeMode()} reject it with a {@link ValidationError} for
340
+ * Expressive (V4) agents.
341
+ *
342
+ * {@link AgentManager.chat | chat()} throws a {@link ValidationError} — but only when this was
343
+ * the mode {@link createAgentManager} was given, because that guard reads the creation-time
344
+ * mode rather than the current one; arriving here later through
345
+ * {@link AgentManager.changeMode | changeMode()} leaves {@link AgentManager.chat | chat()}
346
+ * working. Chosen at creation time it also skips the notifications web socket. Use it when
347
+ * the application drives the agent entirely through {@link AgentManager.speak | speak()} and
348
+ * never asks its LLM anything. The stream keeps running only when this is the mode
349
+ * {@link createAgentManager} was given; switching into it later with
350
+ * {@link AgentManager.changeMode | changeMode()} disconnects the stream like any other
351
+ * non-{@link ChatMode.Functional} mode.
352
+ */
80
353
  DirectPlayback = "DirectPlayback",
354
+ /**
355
+ * Chat is switched off: no chat is created for the session, while video still streams.
356
+ *
357
+ * Talks (V2) and Clips (V3) agents only; {@link createAgentManager} and
358
+ * {@link AgentManager.changeMode | changeMode()} reject it with a {@link ValidationError} for
359
+ * Expressive (V4) agents.
360
+ *
361
+ * {@link AgentManager.chat | chat()} throws a {@link ValidationError} under the same
362
+ * creation-time rule as {@link ChatMode.DirectPlayback}. The one difference between the two is
363
+ * the notifications web socket: this mode still opens it on a Talks (V2) or Clips (V3) agent,
364
+ * where {@link ChatMode.DirectPlayback} skips it. As with {@link ChatMode.DirectPlayback}, the
365
+ * stream keeps running only when this is the mode set at creation; switching into it later with
366
+ * {@link AgentManager.changeMode | changeMode()} disconnects the stream.
367
+ */
81
368
  Off = "Off"
82
369
  }
370
+ /**
371
+ * What the Agents API answers a chat request with.
372
+ *
373
+ * Returned by {@link AgentManager.chat | chat()}. The SDK has already added the answer to the
374
+ * transcript by the time you get it, so most applications render
375
+ * {@link AgentManagerCallbacks.onNewMessage | onNewMessage} instead and use this only for the
376
+ * fields that never reach a {@link Message}. Expressive (V4) agents chat over the data channel
377
+ * rather than over the Agents API — except in {@link ChatMode.Playground} — so for them the
378
+ * object is empty and the answer arrives through the callback.
379
+ *
380
+ * @category Chat
381
+ */
83
382
  export interface ChatResponse {
383
+ /**
384
+ * The agent's answer.
385
+ *
386
+ * Empty or absent when the answer is delivered as it is generated instead, which is what
387
+ * streaming modes do; the SDK then adds no message for it and the text arrives through
388
+ * {@link AgentManagerCallbacks.onNewMessage | onNewMessage}.
389
+ */
84
390
  result?: string;
391
+ /**
392
+ * The Agents API's own list of ids for the documents behind the answer. The SDK never reads it;
393
+ * {@link ChatResponse.matches | matches} is what it keeps on the message.
394
+ */
85
395
  documentIds?: string[];
86
- matches?: IRetrivalMetadata[];
396
+ /**
397
+ * The knowledge citations behind the answer.
398
+ *
399
+ * Copied onto the answer as {@link Message.matches | matches}.
400
+ */
401
+ matches?: RetrievalMetadata[];
402
+ /**
403
+ * The {@link ChatMode} the server handled the request in.
404
+ *
405
+ * It can differ from the mode that was asked for — see {@link ChatMode}.
406
+ */
87
407
  chatMode?: ChatMode;
408
+ /**
409
+ * The retrieved context the answer was generated from.
410
+ *
411
+ * Copied onto the answer as {@link Message.context | context}.
412
+ */
88
413
  context?: string;
414
+ /** Id of the video generated for the answer, when the server reported one. */
89
415
  videoId?: string;
90
416
  }
417
+ /**
418
+ * A conversation with an agent, as the Agents API stores it.
419
+ * @internal Wire type of the Agents API; not part of the public SDK surface. The only part an
420
+ * application sees is the chat id, reported by
421
+ * {@link AgentManagerCallbacks.onNewChat | onNewChat}.
422
+ */
91
423
  export interface Chat {
424
+ /** Id of the chat. The value handed to
425
+ * {@link AgentManagerCallbacks.onNewChat | onNewChat}. */
92
426
  id: string;
427
+ /** Id of the agent this conversation is with. */
93
428
  agent_id: string;
429
+ /** When the chat was created, as an ISO 8601 timestamp. */
94
430
  created: string;
431
+ /** When the chat was last changed, as an ISO 8601 timestamp. */
95
432
  modified: string;
433
+ /** Id of the D-ID account that owns the chat. Set by the API; on the synthetic chat the SDK
434
+ * builds for an Expressive (V4) session it is copied from {@link Agent.owner_id}. */
96
435
  owner_id: string;
436
+ /**
437
+ * The messages stored with the chat.
438
+ *
439
+ * The SDK never reads this array — the live transcript is the one handed to
440
+ * {@link AgentManagerCallbacks.onNewMessage | onNewMessage} — and it is empty on the chat the
441
+ * SDK builds for an Expressive (V4) session.
442
+ */
97
443
  messages: Message[];
444
+ /** A composite sort key the API uses to list an agent's chats by creation time. Not meaningful
445
+ * to clients. */
98
446
  agent_id__created_at: string;
447
+ /** A composite sort key the API uses to list an agent's chats by modification time. Not
448
+ * meaningful to clients. */
99
449
  agent_id__modified_at: string;
450
+ /**
451
+ * The {@link ChatMode} the chat was created in.
452
+ *
453
+ * {@link AgentManager.connect | connect()} adopts it, which is how the server can downgrade the
454
+ * mode an application asked for.
455
+ */
100
456
  chat_mode?: ChatMode;
101
457
  }
458
+ /**
459
+ * What caused the user to interrupt the agent, passed to
460
+ * {@link AgentManager.interrupt | interrupt()}.
461
+ *
462
+ * @category Chat
463
+ */
102
464
  export interface Interrupt {
465
+ /**
466
+ * The cause: `text` when the user typed over the answer, `audio` when they started speaking,
467
+ * `click` when they pressed a stop control, and `manual` for an interruption the application
468
+ * decided on itself.
469
+ *
470
+ * The SDK records it with the interruption for analytics. It changes behaviour in one case
471
+ * only: Expressive (V4) agents ignore a `text` interrupt, because their orchestrator does not
472
+ * cancel the answer already in flight. Talks (V2) and Clips (V3) agents interrupt the current
473
+ * video whatever the value.
474
+ */
103
475
  type: 'text' | 'audio' | 'click' | 'manual';
104
476
  }