@d-id/client-sdk 1.1.14-staging.57 → 1.1.14-staging.58

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,9 +1,9 @@
1
- import { c as x, a as N, S as O, C as g, b as U, d as P, e as V, A as w, f as q, T as J } from "./index-DrArdZby.js";
2
- function Q(u, T, h, i) {
3
- const p = x(u, `${T}/v2/agents/${h}`, i);
1
+ import { c as x, a as N, S as O, C as g, b as U, d as P, e as $, A as T, f as q, T as J } from "./index-DN5MqwMt.js";
2
+ function Q(u, p, h, i) {
3
+ const w = x(u, `${p}/v2/agents/${h}`, i);
4
4
  return {
5
5
  async createStream(d) {
6
- return p.post("/streams", d);
6
+ return w.post("/streams", d);
7
7
  }
8
8
  };
9
9
  }
@@ -16,18 +16,18 @@ async function W() {
16
16
  );
17
17
  }
18
18
  }
19
- async function H(u, T, h) {
19
+ async function H(u, p, h) {
20
20
  var E, K, I;
21
21
  const i = N(h.debug || !1, "LiveKitStreamingManager"), {
22
- Room: p,
22
+ Room: w,
23
23
  RoomEvent: d,
24
24
  ConnectionState: C,
25
25
  RemoteParticipant: z,
26
26
  RemoteTrack: B
27
- } = await W(), { callbacks: e, auth: _, baseURL: j, analytics: F } = h;
27
+ } = await W(), { callbacks: e, auth: V, baseURL: j, analytics: F } = h;
28
28
  let a = null, v = !1, y = null, c = null;
29
29
  const L = O.Fluent;
30
- a = new p({
30
+ a = new w({
31
31
  adaptiveStream: !0,
32
32
  dynacast: !0
33
33
  }), a.on(d.ConnectionStateChanged, (n) => {
@@ -61,21 +61,22 @@ async function H(u, T, h) {
61
61
  var r;
62
62
  i(`Track unsubscribed: ${n.kind} from ${o.identity}`), n.kind === "video" && ((r = e.onVideoStateChange) == null || r.call(e, P.Stop));
63
63
  }), a.on(d.DataReceived, (n, t) => {
64
- var r, s, S, D, $;
64
+ var r, s, S, D, _;
65
65
  const o = new TextDecoder().decode(n);
66
66
  i("Data received:", o);
67
67
  try {
68
68
  const m = JSON.parse(o);
69
- m.subject === V.StreamStarted && ((r = m.metadata) != null && r.videoId) ? (y = m.metadata.videoId, (s = e.onVideoIdChange) == null || s.call(e, y), (S = e.onAgentActivityStateChange) == null || S.call(e, w.Talking)) : m.subject === V.StreamDone && (y = null, (D = e.onVideoIdChange) == null || D.call(e, y), ($ = e.onAgentActivityStateChange) == null || $.call(e, w.Idle));
69
+ m.subject === $.StreamStarted && ((r = m.metadata) != null && r.videoId) ? (y = m.metadata.videoId, (s = e.onVideoIdChange) == null || s.call(e, y), (S = e.onAgentActivityStateChange) == null || S.call(e, T.Talking)) : m.subject === $.StreamDone && (y = null, (D = e.onVideoIdChange) == null || D.call(e, y), (_ = e.onAgentActivityStateChange) == null || _.call(e, T.Idle));
70
70
  } catch (m) {
71
71
  i("Failed to parse data channel message:", m);
72
72
  }
73
73
  }), (E = e.onConnectionStateChange) == null || E.call(e, g.New);
74
- const M = Q(_, j || q, u, e.onError);
74
+ const M = Q(V, j || q, u, e.onError);
75
75
  let f, A;
76
76
  try {
77
77
  const n = await M.createStream({
78
- transport_provider: J.Livekit
78
+ transport_provider: J.Livekit,
79
+ chat_id: p.chat_id
79
80
  }), { agent_id: t, session_id: o, session_token: r, session_url: s } = n;
80
81
  f = t, A = o, await a.connect(s, r), i("LiveKit room joined successfully");
81
82
  } catch (n) {
@@ -108,7 +109,7 @@ async function H(u, T, h) {
108
109
  },
109
110
  async disconnect() {
110
111
  var n, t;
111
- a && (await a.disconnect(), a = null), c && (c.getTracks().forEach((o) => o.stop()), c = null), v = !1, (n = e.onConnectionStateChange) == null || n.call(e, g.Completed), (t = e.onAgentActivityStateChange) == null || t.call(e, w.Idle);
112
+ a && (await a.disconnect(), a = null), c && (c.getTracks().forEach((o) => o.stop()), c = null), v = !1, (n = e.onConnectionStateChange) == null || n.call(e, g.Completed), (t = e.onAgentActivityStateChange) == null || t.call(e, T.Idle);
112
113
  },
113
114
  sendDataChannelMessage: R,
114
115
  sessionId: A,
@@ -1,14 +1,15 @@
1
1
  import { StreamingManager } from '../streaming-manager';
2
- import { Agent, AgentManagerOptions, AgentsAPI, Chat, CreateStreamOptions } from '../../types';
2
+ import { Agent, AgentManagerOptions, AgentsAPI, Chat, CreateStreamOptions, CreateStreamV2Options } from '../../types';
3
3
  import { Analytics } from '../analytics/mixpanel';
4
4
 
5
5
  type ConnectToManagerOptions = AgentManagerOptions & {
6
6
  callbacks: AgentManagerOptions['callbacks'] & {
7
7
  onVideoIdChange?: (videoId: string | null) => void;
8
8
  };
9
+ chatId?: string;
9
10
  };
10
11
  export declare function initializeStreamAndChat(agent: Agent, options: ConnectToManagerOptions, agentsApi: AgentsAPI, analytics: Analytics, chat?: Chat): Promise<{
11
12
  chat?: Chat;
12
- streamingManager?: StreamingManager<CreateStreamOptions>;
13
+ streamingManager?: StreamingManager<CreateStreamOptions | CreateStreamV2Options>;
13
14
  }>;
14
15
  export {};
@@ -1,11 +1,11 @@
1
- import { CreateStreamOptions, PayloadType, StreamType } from '../../types';
1
+ import { CreateStreamOptions, CreateStreamV2Options, PayloadType, StreamType } from '../../types';
2
2
 
3
3
  export declare const createStreamingLogger: (debug: boolean, prefix: string) => (message: string, extra?: any) => false | void;
4
4
  /**
5
5
  * Shared type for all streaming managers (LiveKit, WebRTC, etc.)
6
6
  * This type represents the return value of any streaming manager implementation
7
7
  */
8
- export type StreamingManager<T extends CreateStreamOptions> = {
8
+ export type StreamingManager<T extends CreateStreamOptions | CreateStreamV2Options> = {
9
9
  /**
10
10
  * Method to send request to server to get clip or talk depending on payload
11
11
  * @param payload The payload to send to the streaming service
@@ -1,3 +1,13 @@
1
- import { Agent, CreateStreamOptions, StreamingManagerOptions } from '../../types';
1
+ import { Agent, CreateStreamOptions, CreateStreamV2Options, StreamingManagerOptions } from '../../types';
2
+ import { StreamingManager } from './common';
2
3
 
3
- export declare function createStreamingManager<T extends CreateStreamOptions>(agent: Agent, streamOptions: T, options: StreamingManagerOptions): Promise<import('./common').StreamingManager<T>>;
4
+ export declare enum StreamApiVersion {
5
+ V1 = "v1",
6
+ V2 = "v2"
7
+ }
8
+ export type ExtendedStreamOptions = ({
9
+ version: StreamApiVersion.V1;
10
+ } & CreateStreamOptions) | ({
11
+ version: StreamApiVersion.V2;
12
+ } & CreateStreamV2Options);
13
+ export declare function createStreamingManager(agent: Agent, streamOptions: ExtendedStreamOptions, options: StreamingManagerOptions): Promise<StreamingManager<CreateStreamOptions | CreateStreamV2Options>>;
@@ -1,4 +1,5 @@
1
- export { createStreamingManager } from './factory';
1
+ export { StreamApiVersion as StreamApiVersion, createStreamingManager } from './factory';
2
+ export type { ExtendedStreamOptions } from './factory';
2
3
  export type { StreamingManager } from './common';
3
4
  export type { LiveKitStreamingManager } from './livekit-manager';
4
5
  export * from './webrtc-manager';
@@ -1,5 +1,5 @@
1
- import { CreateStreamOptions, StreamingManagerOptions } from '../../types';
1
+ import { CreateStreamOptions, CreateStreamV2Options, StreamingManagerOptions } from '../../types';
2
2
  import { StreamingManager } from './common';
3
3
 
4
- export declare function createLiveKitStreamingManager<T extends CreateStreamOptions>(agentId: string, agent: T, options: StreamingManagerOptions): Promise<StreamingManager<T>>;
4
+ export declare function createLiveKitStreamingManager<T extends CreateStreamV2Options>(agentId: string, agent: T, options: StreamingManagerOptions): Promise<StreamingManager<T>>;
5
5
  export type LiveKitStreamingManager<T extends CreateStreamOptions> = StreamingManager<T>;
@@ -1,8 +1,9 @@
1
- export declare enum Transport {
1
+ export declare enum TransportProvider {
2
2
  Livekit = "livekit"
3
3
  }
4
4
  export interface CreateStreamV2Options {
5
- transport_provider: Transport.Livekit;
5
+ transport_provider: TransportProvider.Livekit;
6
+ chat_id?: string;
6
7
  }
7
8
  export interface CreateStreamV2Response {
8
9
  agent_id: 'string';
@@ -2,4 +2,5 @@ import { Agent } from '../types';
2
2
 
3
3
  type AgentType = 'clip_v2' | Agent['presenter']['type'];
4
4
  export declare const getAgentType: (presenter: Agent["presenter"]) => AgentType;
5
+ export declare const isStreamsV2Agent: (type: AgentType) => boolean;
5
6
  export {};
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.14-staging.57",
4
+ "version": "1.1.14-staging.58",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Advanced functionality tests for streaming manager
3
- * Tests complex scenarios, edge cases, and advanced features
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Business flow tests for streaming manager
3
- * Tests critical end-to-end workflows and configurations
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Disconnect and cleanup tests for streaming manager
3
- * Tests disconnection workflows, cleanup, and error handling
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Edge cases and branch coverage tests for streaming manager
3
- * Tests detailed edge cases, error conditions, and branch coverage scenarios
4
- */
5
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Core functionality tests for streaming manager
3
- * Tests basic streaming manager creation, connection, and operations
4
- */
5
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Utility function tests for streaming manager
3
- * Tests helper functions like mapConnectionState and parseDataChannelMessage
4
- */
5
- export {};