@d-id/client-sdk 2.0.6 → 2.0.7

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.
@@ -1,4 +1,5 @@
1
1
  import { CreateSessionV2Options, CreateStreamOptions, Interrupt, PayloadType, StreamType } from '../../types';
2
+ import { DataChannelTopic } from '../../types/stream/data-channel';
2
3
 
3
4
  export declare const createStreamingLogger: (debug: boolean, prefix: string) => (message: string, extra?: any) => false | void;
4
5
  /**
@@ -16,16 +17,13 @@ export type StreamingManager<T extends CreateStreamOptions | CreateSessionV2Opti
16
17
  */
17
18
  disconnect(): Promise<void>;
18
19
  /**
19
- * Method to send data channel messages to the server
20
- * @param payload The message payload to send
20
+ * The single send primitive: every message leaving the client goes out through here.
21
+ * V2 routes on the topic; V1 has no topic concept and ignores it.
22
+ * The promise tracks the send attempt and never rejects - failures go to `callbacks.onError`.
23
+ * @param topic Data-channel topic to send on
24
+ * @param payload The message payload to send, already serialized
21
25
  */
22
- sendDataChannelMessage(payload: string): void;
23
- /**
24
- * Method to send text messages to the server
25
- * @param payload The message payload to send
26
- * supported only for livekit manager
27
- */
28
- sendTextMessage?(payload: string): Promise<void>;
26
+ sendDataChannelMessage(topic: DataChannelTopic, payload: string): Promise<void>;
29
27
  /**
30
28
  * Publish a microphone stream to the DataChannel
31
29
  * Can be called after connection to add microphone input
@@ -81,19 +79,9 @@ export type StreamingManager<T extends CreateStreamOptions | CreateSessionV2Opti
81
79
  */
82
80
  isInterruptible: boolean;
83
81
  /**
84
- * Send an interrupt for the current stream segment.
85
- * Each implementation owns the validation/transport details (e.g. V1
86
- * sends a `stream/interrupt` payload over the data channel; V2 sends
87
- * `did.interrupt` and ignores `text` interrupts to avoid races).
82
+ * Send an interrupt for the current stream segment
88
83
  */
89
84
  interrupt(type: Interrupt['type']): void;
90
- /**
91
- * Switch the STT language mid-session.
92
- * Only available for Expressive (V4) agents.
93
- * supported only for livekit manager
94
- * @param language Language name or BCP-47 code (e.g. "English" or "en-US")
95
- */
96
- setSttLanguage?(language: string): Promise<void>;
97
85
  /**
98
86
  * Register an RPC method handler on the LiveKit room.
99
87
  * Used internally by the agent-manager for client tool delegation.
@@ -1,5 +1 @@
1
- /**
2
- * Edge cases and branch coverage tests for streaming manager
3
- * Tests detailed edge cases, error conditions, and branch coverage scenarios
4
- */
5
1
  export {};
@@ -1,12 +1,6 @@
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
- SttLanguage = "did.stt-language"
9
- }
10
4
  export declare function handleInitError(error: unknown, log: (message?: any, ...optionalParams: any[]) => void, callbacks: StreamingManagerOptions['callbacks']): void;
11
5
  export declare function createLiveKitStreamingManager<T extends CreateSessionV2Options>(agentId: string, sessionOptions: CreateSessionV2Options, options: StreamingManagerOptions): Promise<StreamingManager<T> & {
12
6
  reconnect(): Promise<void>;
@@ -1,5 +1 @@
1
- /**
2
- * Core functionality tests for streaming manager
3
- * Tests basic streaming manager creation, connection, and operations
4
- */
5
1
  export {};
@@ -41,6 +41,11 @@ export interface Agent {
41
41
  vm_account_id?: string;
42
42
  closed_captions_enabled?: boolean;
43
43
  };
44
+ ld_context?: {
45
+ key: string;
46
+ hash_key: string;
47
+ plan_group: string;
48
+ };
44
49
  }
45
50
  export interface AgentsAPI {
46
51
  getRuntimeById(id: string, options?: RequestInit): Promise<Agent>;
@@ -1,6 +1,6 @@
1
1
  import { STTTokenResponse } from '../..';
2
2
  import { Auth } from '../../auth';
3
- import { AgentActivityState, ClientToolHandler, CompatibilityMode, ConnectionState, ConnectivityState, SendStreamPayloadResponse, StreamEvents, StreamType, StreamingState } from '../../stream';
3
+ import { AgentActivityState, ClientToolHandler, CompatibilityMode, ConnectionState, ConnectivityState, PublicDataChannelTopic, SendStreamPayloadResponse, StreamEvents, StreamType, StreamingState } from '../../stream';
4
4
  import { SupportedStreamScript } from '../../stream-script';
5
5
  import { ManagerCallbacks as StreamManagerCallbacks } from '../../stream/stream';
6
6
  import { Agent } from './agent';
@@ -292,6 +292,13 @@ export interface AgentManager {
292
292
  * @param language - Language name or BCP-47 code (e.g. "English" or "en-US")
293
293
  */
294
294
  setSttLanguage: (language: string) => Promise<void>;
295
+ /**
296
+ * Send a JSON payload to the agent over a data-channel topic
297
+ * Only available for Expressive (V4) agents
298
+ * @param topic - Data-channel topic to send on (see `PublicDataChannelTopic`)
299
+ * @param payload - Plain object, serialized as JSON
300
+ */
301
+ sendDataChannelMessage: (topic: PublicDataChannelTopic, payload: Record<string, unknown>) => Promise<void>;
295
302
  /**
296
303
  * Register a handler for a client tool. When the agent's LLM calls this tool,
297
304
  * the handler executes on the client and returns the result to the LLM.
@@ -1,8 +1,18 @@
1
- import { KnowledgeType } from './knowledge';
1
+ import { DocumentType, KnowledgeType } from './knowledge';
2
2
 
3
+ /**
4
+ * Lifecycle status of a document, as served by the knowledge API. The API stores the
5
+ * status as a prefixed event subject (`document/done`) but strips the prefix on read,
6
+ * so the wire value is always bare.
7
+ */
8
+ export type DocumentStatus = 'created' | 'processed' | 'done' | 'rejected' | 'error';
9
+ /**
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.
13
+ */
3
14
  export declare enum Subject {
4
15
  KnowledgeProcessing = "knowledge/processing",
5
- KnowledgeIndexing = "knowledge/indexing",
6
16
  KnowledgeFailed = "knowledge/error",
7
17
  KnowledgeDone = "knowledge/done"
8
18
  }
@@ -12,7 +22,7 @@ export interface DocumentData {
12
22
  owner_id: string;
13
23
  id: string;
14
24
  created_by: string;
15
- status: Subject;
25
+ status: DocumentStatus;
16
26
  documentType: DocumentType;
17
27
  type: KnowledgeType;
18
28
  source_url: string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Data-channel topics messages can be sent on.
3
+ * V2 (LiveKit) routes by topic; V1 (WebRTC) has no topic concept and ignores it.
4
+ *
5
+ * Internal on purpose: this module is deliberately left out of the `stream`
6
+ * barrel so the topics driven by dedicated methods (`chat`, `speak`,
7
+ * `interrupt`, `setSttLanguage`) never reach the package's public API.
8
+ * Customers get `PublicDataChannelTopic` instead.
9
+ */
10
+ export declare enum DataChannelTopic {
11
+ Chat = "lk.chat",
12
+ Speak = "did.speak",
13
+ Interrupt = "did.interrupt",
14
+ SttLanguage = "did.stt-language",
15
+ Presentation = "did.presentation"
16
+ }
@@ -3,6 +3,7 @@ import { VideoRTCStatsReport } from '../../services/streaming-manager/stats/repo
3
3
  import { Auth } from '../auth';
4
4
  import { ChatProgressCallback } from '../entities/agents/manager';
5
5
  import { CreateClipStreamRequest, CreateTalkStreamRequest, SendClipStreamPayload, SendTalkStreamPayload } from './api';
6
+ import { DataChannelTopic } from './data-channel';
6
7
  import { ICreateStreamRequestResponse, IceCandidate, SendStreamPayloadResponse, Status } from './rtc';
7
8
 
8
9
  export type CompatibilityMode = 'on' | 'off' | 'auto';
@@ -41,6 +42,20 @@ export declare enum StreamEvents {
41
42
  TurnStarted = "turn/started",
42
43
  TurnEnded = "turn/ended"
43
44
  }
45
+ /**
46
+ * Topics a customer can send on via `agentManager.sendDataChannelMessage`.
47
+ * The remaining `DataChannelTopic` members are driven by their own methods
48
+ * (`chat`, `speak`, `interrupt`, `setSttLanguage`), which own the payload shape
49
+ * and bookkeeping those topics expect, so they stay internal.
50
+ *
51
+ * A const object rather than a second enum: it borrows the value from
52
+ * `DataChannelTopic`, so there is one source of truth for the wire string and
53
+ * no cast is needed where the topic reaches the transport.
54
+ */
55
+ export declare const PublicDataChannelTopic: {
56
+ readonly Presentation: DataChannelTopic.Presentation;
57
+ };
58
+ export type PublicDataChannelTopic = (typeof PublicDataChannelTopic)[keyof typeof PublicDataChannelTopic];
44
59
  export declare enum ConnectionState {
45
60
  New = "new",
46
61
  Fail = "fail",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-id/client-sdk",
3
3
  "private": false,
4
- "version": "2.0.6",
4
+ "version": "2.0.7",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {