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

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.
@@ -310,7 +310,7 @@ function ye() {
310
310
  get: (t = !1) => t ? Date.now() - e : e
311
311
  };
312
312
  }
313
- const B = ye(), ae = ye();
313
+ const x = ye(), ae = ye();
314
314
  function ke(e) {
315
315
  return e === E.Playground ? { headers: { [xe]: "true" } } : {};
316
316
  }
@@ -430,8 +430,8 @@ function it(e, t, n, r, i) {
430
430
  if (c = c, c === l.StreamVideoCreated)
431
431
  e.linkTrack("agent-video", b, l.StreamVideoCreated, ["start"]);
432
432
  else if (v.includes(c)) {
433
- const $ = c.split("/")[1];
434
- M.includes(c) ? e.track("agent-video", { ...b, event: $ }) : e.linkTrack("agent-video", { ...b, event: $ }, c, ["done"]);
433
+ const B = c.split("/")[1];
434
+ M.includes(c) ? e.track("agent-video", { ...b, event: B }) : e.linkTrack("agent-video", { ...b, event: B }, c, ["done"]);
435
435
  }
436
436
  M.includes(c) && ((d = (o = n.callbacks).onError) == null || d.call(o, new Error(`Stream failed with event ${c}`), { data: a })), a.event === l.StreamDone && i();
437
437
  }
@@ -612,9 +612,9 @@ function ht() {
612
612
  }
613
613
  function wt(e, t, n, r, i, s = !1) {
614
614
  let c = [], a, o = 0, d = !1, l = G.Unknown, v = G.Unknown, M = 0, b = 0;
615
- const $ = ht();
615
+ const B = ht();
616
616
  return setInterval(async () => {
617
- const z = await e.getStats(), { isReceiving: U, avgJitterDelayInInterval: W, freezeCount: C } = $(z), K = lt(z);
617
+ const z = await e.getStats(), { isReceiving: U, avgJitterDelayInInterval: W, freezeCount: C } = B(z), K = lt(z);
618
618
  if (U)
619
619
  o = 0, M = C - b, v = W < mt ? G.Strong : W > gt && M > 1 ? G.Weak : l, v !== l && (i == null || i(v), l = v, b += M, M = 0), d || (r == null || r(w.Start), a = c[c.length - 1], c = [], d = !0), c.push(K);
620
620
  else if (d && (o++, o >= ft)) {
@@ -690,7 +690,7 @@ async function Dt(e, t, { debug: n = !1, callbacks: r, auth: i, baseURL: s = ee,
690
690
  var Y;
691
691
  const a = ot(n, "WebRTCStreamingManager"), o = vt(a);
692
692
  let d = !1, l = !1, v = w.Stop, M = w.Stop;
693
- const { startConnection: b, sendStreamRequest: $, close: z, createStream: U, addIceCandidate: W } = st(
693
+ const { startConnection: b, sendStreamRequest: B, close: z, createStream: U, addIceCandidate: W } = st(
694
694
  i,
695
695
  s,
696
696
  e,
@@ -752,16 +752,16 @@ async function Dt(e, t, { debug: n = !1, callbacks: r, auth: i, baseURL: s = ee,
752
752
  }, S.onopen = () => {
753
753
  l = !0, (!P || d) && I();
754
754
  };
755
- const x = (m) => {
755
+ const $ = (m) => {
756
756
  var g;
757
757
  (g = r.onVideoIdChange) == null || g.call(r, m);
758
758
  };
759
759
  function L(m, g) {
760
760
  if (m === j.StreamStarted && typeof g == "object" && "metadata" in g) {
761
761
  const A = g.metadata;
762
- x(A.videoId);
762
+ $(A.videoId);
763
763
  }
764
- m === j.StreamDone && x(null), v = m === j.StreamStarted ? w.Start : w.Stop, le({
764
+ m === j.StreamDone && $(null), v = m === j.StreamStarted ? w.Start : w.Stop, le({
765
765
  statsSignal: T === J.Legacy ? M : void 0,
766
766
  dataChannelSignal: v,
767
767
  onVideoStateChange: r.onVideoStateChange,
@@ -798,7 +798,7 @@ async function Dt(e, t, { debug: n = !1, callbacks: r, auth: i, baseURL: s = ee,
798
798
  * @param payload
799
799
  */
800
800
  speak(m) {
801
- return $(C, h, m);
801
+ return B(C, h, m);
802
802
  },
803
803
  /**
804
804
  * Method to close RTC connection
@@ -865,7 +865,7 @@ async function Ct(e, t, n) {
865
865
  const { version: i, ...s } = t;
866
866
  switch (s.transport_provider) {
867
867
  case oe.Livekit:
868
- const { createLiveKitStreamingManager: c } = await import("./livekit-manager-B2cn3NW6.js");
868
+ const { createLiveKitStreamingManager: c } = await import("./livekit-manager-D5uOirhd.js");
869
869
  return c(r, s, n);
870
870
  default:
871
871
  throw new Error(`Unsupported transport provider: ${s.transport_provider}`);
@@ -911,9 +911,9 @@ function Mt(e, t, n, r, i) {
911
911
  });
912
912
  }
913
913
  function _t(e, t, n, r) {
914
- B.get() <= 0 || (e === w.Start ? n.linkTrack(
914
+ x.get() <= 0 || (e === w.Start ? n.linkTrack(
915
915
  "agent-video",
916
- { event: "start", latency: B.get(!0), "stream-type": r },
916
+ { event: "start", latency: x.get(!0), "stream-type": r },
917
917
  "start",
918
918
  [j.StreamVideoCreated]
919
919
  ) : e === w.Stop && n.linkTrack(
@@ -929,9 +929,9 @@ function _t(e, t, n, r) {
929
929
  ));
930
930
  }
931
931
  function Tt(e, t, n, r, i) {
932
- B.get() <= 0 || (e === w.Start ? r.linkTrack(
932
+ x.get() <= 0 || (e === w.Start ? r.linkTrack(
933
933
  "agent-video",
934
- { event: "start", latency: B.get(!0), "stream-type": i },
934
+ { event: "start", latency: x.get(!0), "stream-type": i },
935
935
  "start",
936
936
  [j.StreamVideoCreated]
937
937
  ) : e === w.Stop && r.linkTrack(
@@ -948,7 +948,7 @@ function Tt(e, t, n, r, i) {
948
948
  ));
949
949
  }
950
950
  function At(e, t, n) {
951
- return B.reset(), new Promise(async (r, i) => {
951
+ return x.reset(), new Promise(async (r, i) => {
952
952
  try {
953
953
  let s;
954
954
  s = await Ct(e, It(e, t), {
@@ -1022,9 +1022,9 @@ async function Lt(e, t) {
1022
1022
  r = u;
1023
1023
  };
1024
1024
  o.track("agent-sdk", { event: "loaded", ...He(l) });
1025
- async function $(u) {
1026
- var S, T, P, D, I, k, x;
1027
- (T = (S = t.callbacks).onConnectionStateChange) == null || T.call(S, R.Connecting), B.reset(), u && !n && (delete a.chat, (D = (P = t.callbacks).onNewMessage) == null || D.call(P, [...a.messages], "answer"));
1025
+ async function B(u) {
1026
+ var S, T, P, D, I, k, $;
1027
+ (T = (S = t.callbacks).onConnectionStateChange) == null || T.call(S, R.Connecting), x.reset(), u && !n && (delete a.chat, (D = (P = t.callbacks).onNewMessage) == null || D.call(P, [...a.messages], "answer"));
1028
1028
  const h = t.mode === E.DirectPlayback ? Promise.resolve(void 0) : rt(t.auth, s, { onMessage: v, onError: t.callbacks.onError }), p = ne(
1029
1029
  () => jt(
1030
1030
  l,
@@ -1045,7 +1045,7 @@ async function Lt(e, t) {
1045
1045
  var F, N;
1046
1046
  throw U(E.Maintenance), (N = (F = t.callbacks).onConnectionStateChange) == null || N.call(F, R.Fail), L;
1047
1047
  }), [_, { streamingManager: y, chat: f }] = await Promise.all([h, p]);
1048
- f && f.id !== ((I = a.chat) == null ? void 0 : I.id) && ((x = (k = t.callbacks).onNewChat) == null || x.call(k, f.id)), a.streamingManager = y, a.socketManager = _, a.chat = f, n = !1, o.enrich({
1048
+ f && f.id !== ((I = a.chat) == null ? void 0 : I.id) && (($ = (k = t.callbacks).onNewChat) == null || $.call(k, f.id)), a.streamingManager = y, a.socketManager = _, a.chat = f, n = !1, o.enrich({
1049
1049
  chatId: f == null ? void 0 : f.id,
1050
1050
  streamId: y == null ? void 0 : y.streamId,
1051
1051
  mode: a.chatMode
@@ -1078,13 +1078,13 @@ async function Lt(e, t) {
1078
1078
  changeMode: U,
1079
1079
  enrichAnalytics: o.enrich,
1080
1080
  async connect() {
1081
- await $(!0), o.track("agent-chat", {
1081
+ await B(!0), o.track("agent-chat", {
1082
1082
  event: "connect",
1083
1083
  mode: a.chatMode
1084
1084
  });
1085
1085
  },
1086
1086
  async reconnect() {
1087
- await z(), await $(!1), o.track("agent-chat", {
1087
+ await z(), await B(!1), o.track("agent-chat", {
1088
1088
  event: "reconnect",
1089
1089
  mode: a.chatMode
1090
1090
  });
@@ -1129,14 +1129,14 @@ async function Lt(e, t) {
1129
1129
  return a.chat.id;
1130
1130
  }, _ = async (D, I) => ne(
1131
1131
  () => {
1132
- var k, x;
1132
+ var k, $;
1133
1133
  return d.chat(
1134
1134
  l.id,
1135
1135
  I,
1136
1136
  {
1137
1137
  chatMode: a.chatMode,
1138
1138
  streamId: (k = a.streamingManager) == null ? void 0 : k.streamId,
1139
- sessionId: (x = a.streamingManager) == null ? void 0 : x.sessionId,
1139
+ sessionId: ($ = a.streamingManager) == null ? void 0 : $.sessionId,
1140
1140
  messages: D.map(({ matches: L, ...F }) => F)
1141
1141
  },
1142
1142
  {
@@ -1149,11 +1149,11 @@ async function Lt(e, t) {
1149
1149
  limit: 2,
1150
1150
  shouldRetryFn: (k) => {
1151
1151
  var F, N, X, Y;
1152
- const x = (F = k == null ? void 0 : k.message) == null ? void 0 : F.includes("missing or invalid session_id");
1153
- return !((N = k == null ? void 0 : k.message) == null ? void 0 : N.includes("Stream Error")) && !x ? ((Y = (X = t.callbacks).onError) == null || Y.call(X, k), !1) : !0;
1152
+ const $ = (F = k == null ? void 0 : k.message) == null ? void 0 : F.includes("missing or invalid session_id");
1153
+ return !((N = k == null ? void 0 : k.message) == null ? void 0 : N.includes("Stream Error")) && !$ ? ((Y = (X = t.callbacks).onError) == null || Y.call(X, k), !1) : !0;
1154
1154
  },
1155
1155
  onRetry: async () => {
1156
- await z(), await $(!1);
1156
+ await z(), await B(!1);
1157
1157
  }
1158
1158
  }
1159
1159
  );
@@ -1162,7 +1162,7 @@ async function Lt(e, t) {
1162
1162
  id: q(),
1163
1163
  role: "user",
1164
1164
  content: u,
1165
- created_at: new Date(B.update()).toISOString()
1165
+ created_at: new Date(x.update()).toISOString()
1166
1166
  }), (f = (y = t.callbacks).onNewMessage) == null || f.call(y, [...a.messages], "user");
1167
1167
  const D = await p(), I = await _([...a.messages], D);
1168
1168
  return a.messages.push({
@@ -1176,7 +1176,7 @@ async function Lt(e, t) {
1176
1176
  event: "success",
1177
1177
  messages: a.messages.length + 1
1178
1178
  }), I.result && ((T = (S = t.callbacks).onNewMessage) == null || T.call(S, [...a.messages], "answer"), o.track("agent-message-received", {
1179
- latency: B.get(!0),
1179
+ latency: x.get(!0),
1180
1180
  messages: a.messages.length
1181
1181
  })), I;
1182
1182
  } catch (D) {
@@ -1243,11 +1243,11 @@ async function Lt(e, t) {
1243
1243
  return u;
1244
1244
  }
1245
1245
  const p = h();
1246
- if (o.track("agent-speak", p), B.update(), a.messages && p.type === "text" && (a.messages.push({
1246
+ if (o.track("agent-speak", p), x.update(), a.messages && p.type === "text" && (a.messages.push({
1247
1247
  id: q(),
1248
1248
  role: "assistant",
1249
1249
  content: p.input,
1250
- created_at: new Date(B.get(!0)).toISOString()
1250
+ created_at: (/* @__PURE__ */ new Date()).toISOString()
1251
1251
  }), (f = (y = t.callbacks).onNewMessage) == null || f.call(y, [...a.messages], "answer")), Ne(a.chatMode))
1252
1252
  return {
1253
1253
  duration: 0,
@@ -1268,7 +1268,7 @@ async function Lt(e, t) {
1268
1268
  o.track("agent-video-interrupt", {
1269
1269
  type: u || "click",
1270
1270
  video_duration_to_interrupt: ae.get(!0),
1271
- message_duration_to_interrupt: B.get(!0)
1271
+ message_duration_to_interrupt: x.get(!0)
1272
1272
  }), h.interrupted = !0, (y = (_ = t.callbacks).onNewMessage) == null || y.call(_, [...a.messages], "answer"), Ge(a.streamingManager, r);
1273
1273
  }
1274
1274
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as t, k as s, g as r, l as o, h as n, m as i, C as d, b as g, D as S, K as p, P as c, q as C, R as m, e as y, S as A, d as T, n as l, T as P, U as h, V as v, o as V, r as u, W as D, i as E, j as M, p as b } from "./index-DN5MqwMt.js";
1
+ import { A as t, k as s, g as r, l as o, h as n, m as i, C as d, b as g, D as S, K as p, P as c, q as C, R as m, e as y, S as A, d as T, n as l, T as P, U as h, V as v, o as V, r as u, W as D, i as E, j as M, p as b } from "./index-DC3bk3fD.js";
2
2
  export {
3
3
  t as AgentActivityState,
4
4
  s as AgentStatus,