@d-id/client-sdk 2.0.5 → 2.0.6

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.
@@ -6321,7 +6321,7 @@ function Th() {
6321
6321
  return k.levels[L] === void 0 && (L = void 0), L;
6322
6322
  }
6323
6323
  }
6324
- function N() {
6324
+ function U() {
6325
6325
  if (!(typeof window === t || !b)) {
6326
6326
  try {
6327
6327
  window.localStorage.removeItem(b);
@@ -6353,7 +6353,7 @@ function Th() {
6353
6353
  }, k.setDefaultLevel = function(L) {
6354
6354
  O = P(L), A() || k.setLevel(L, !1);
6355
6355
  }, k.resetLevel = function() {
6356
- y = null, N(), l.call(k);
6356
+ y = null, U(), l.call(k);
6357
6357
  }, k.enableAll = function(L) {
6358
6358
  k.setLevel(k.levels.TRACE, L);
6359
6359
  }, k.disableAll = function(L) {
@@ -6540,10 +6540,10 @@ function _h() {
6540
6540
  return c(this);
6541
6541
  }, r.prototype.emit = function(b) {
6542
6542
  for (var T = [], A = 1; A < arguments.length; A++) T.push(arguments[A]);
6543
- var N = b === "error", P = this._events;
6544
- if (P !== void 0) N = N && P.error === void 0;
6545
- else if (!N) return !1;
6546
- if (N) {
6543
+ var U = b === "error", P = this._events;
6544
+ if (P !== void 0) U = U && P.error === void 0;
6545
+ else if (!U) return !1;
6546
+ if (U) {
6547
6547
  var x;
6548
6548
  if (T.length > 0 && (x = T[0]), x instanceof Error)
6549
6549
  throw x;
@@ -6559,10 +6559,10 @@ function _h() {
6559
6559
  return !0;
6560
6560
  };
6561
6561
  function d(y, b, T, A) {
6562
- var N, P, x;
6562
+ var U, P, x;
6563
6563
  if (a(T), P = y._events, P === void 0 ? (P = y._events = /* @__PURE__ */ Object.create(null), y._eventsCount = 0) : (P.newListener !== void 0 && (y.emit("newListener", b, T.listener ? T.listener : T), P = y._events), x = P[b]), x === void 0)
6564
6564
  x = P[b] = T, ++y._eventsCount;
6565
- else if (typeof x == "function" ? x = P[b] = A ? [T, x] : [x, T] : A ? x.unshift(T) : x.push(T), N = c(y), N > 0 && x.length > N && !x.warned) {
6565
+ else if (typeof x == "function" ? x = P[b] = A ? [T, x] : [x, T] : A ? x.unshift(T) : x.push(T), U = c(y), U > 0 && x.length > U && !x.warned) {
6566
6566
  x.warned = !0;
6567
6567
  var L = new Error("Possible EventEmitter memory leak detected. " + x.length + " " + String(b) + " listeners added. Use emitter.setMaxListeners() to increase limit");
6568
6568
  L.name = "MaxListenersExceededWarning", L.emitter = y, L.type = b, L.count = x.length, i(L);
@@ -6585,19 +6585,19 @@ function _h() {
6585
6585
  target: y,
6586
6586
  type: b,
6587
6587
  listener: T
6588
- }, N = l.bind(A);
6589
- return N.listener = T, A.wrapFn = N, N;
6588
+ }, U = l.bind(A);
6589
+ return U.listener = T, A.wrapFn = U, U;
6590
6590
  }
6591
6591
  r.prototype.once = function(b, T) {
6592
6592
  return a(T), this.on(b, u(this, b, T)), this;
6593
6593
  }, r.prototype.prependOnceListener = function(b, T) {
6594
6594
  return a(T), this.prependListener(b, u(this, b, T)), this;
6595
6595
  }, r.prototype.removeListener = function(b, T) {
6596
- var A, N, P, x, L;
6597
- if (a(T), N = this._events, N === void 0) return this;
6598
- if (A = N[b], A === void 0) return this;
6596
+ var A, U, P, x, L;
6597
+ if (a(T), U = this._events, U === void 0) return this;
6598
+ if (A = U[b], A === void 0) return this;
6599
6599
  if (A === T || A.listener === T)
6600
- --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete N[b], N.removeListener && this.emit("removeListener", b, A.listener || T));
6600
+ --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete U[b], U.removeListener && this.emit("removeListener", b, A.listener || T));
6601
6601
  else if (typeof A != "function") {
6602
6602
  for (P = -1, x = A.length - 1; x >= 0; x--)
6603
6603
  if (A[x] === T || A[x].listener === T) {
@@ -6605,32 +6605,32 @@ function _h() {
6605
6605
  break;
6606
6606
  }
6607
6607
  if (P < 0) return this;
6608
- P === 0 ? A.shift() : v(A, P), A.length === 1 && (N[b] = A[0]), N.removeListener !== void 0 && this.emit("removeListener", b, L || T);
6608
+ P === 0 ? A.shift() : v(A, P), A.length === 1 && (U[b] = A[0]), U.removeListener !== void 0 && this.emit("removeListener", b, L || T);
6609
6609
  }
6610
6610
  return this;
6611
6611
  }, r.prototype.off = r.prototype.removeListener, r.prototype.removeAllListeners = function(b) {
6612
- var T, A, N;
6612
+ var T, A, U;
6613
6613
  if (A = this._events, A === void 0) return this;
6614
6614
  if (A.removeListener === void 0)
6615
6615
  return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : A[b] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete A[b]), this;
6616
6616
  if (arguments.length === 0) {
6617
6617
  var P = Object.keys(A), x;
6618
- for (N = 0; N < P.length; ++N)
6619
- x = P[N], x !== "removeListener" && this.removeAllListeners(x);
6618
+ for (U = 0; U < P.length; ++U)
6619
+ x = P[U], x !== "removeListener" && this.removeAllListeners(x);
6620
6620
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
6621
6621
  }
6622
6622
  if (T = A[b], typeof T == "function")
6623
6623
  this.removeListener(b, T);
6624
6624
  else if (T !== void 0)
6625
- for (N = T.length - 1; N >= 0; N--)
6626
- this.removeListener(b, T[N]);
6625
+ for (U = T.length - 1; U >= 0; U--)
6626
+ this.removeListener(b, T[U]);
6627
6627
  return this;
6628
6628
  };
6629
6629
  function h(y, b, T) {
6630
6630
  var A = y._events;
6631
6631
  if (A === void 0) return [];
6632
- var N = A[b];
6633
- return N === void 0 ? [] : typeof N == "function" ? T ? [N.listener || N] : [N] : T ? S(N) : g(N, N.length);
6632
+ var U = A[b];
6633
+ return U === void 0 ? [] : typeof U == "function" ? T ? [U.listener || U] : [U] : T ? S(U) : g(U, U.length);
6634
6634
  }
6635
6635
  r.prototype.listeners = function(b) {
6636
6636
  return h(this, b, !0);
@@ -6668,15 +6668,15 @@ function _h() {
6668
6668
  }
6669
6669
  function k(y, b) {
6670
6670
  return new Promise(function(T, A) {
6671
- function N(x) {
6671
+ function U(x) {
6672
6672
  y.removeListener(b, P), A(x);
6673
6673
  }
6674
6674
  function P() {
6675
- typeof y.removeListener == "function" && y.removeListener("error", N), T([].slice.call(arguments));
6675
+ typeof y.removeListener == "function" && y.removeListener("error", U), T([].slice.call(arguments));
6676
6676
  }
6677
6677
  O(y, b, P, {
6678
6678
  once: !0
6679
- }), b !== "error" && I(y, N, {
6679
+ }), b !== "error" && I(y, U, {
6680
6680
  once: !0
6681
6681
  });
6682
6682
  });
@@ -6688,8 +6688,8 @@ function _h() {
6688
6688
  if (typeof y.on == "function")
6689
6689
  A.once ? y.once(b, T) : y.on(b, T);
6690
6690
  else if (typeof y.addEventListener == "function")
6691
- y.addEventListener(b, function N(P) {
6692
- A.once && y.removeEventListener(b, N), T(P);
6691
+ y.addEventListener(b, function U(P) {
6692
+ A.once && y.removeEventListener(b, U), T(P);
6693
6693
  });
6694
6694
  else
6695
6695
  throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof y);
@@ -10156,7 +10156,7 @@ class ar {
10156
10156
  clearTimeout(A), c == null || c.removeEventListener("abort", b);
10157
10157
  }, A = setTimeout(() => {
10158
10158
  b(j.timeout("room connection has timed out (signal)"));
10159
- }, a.websocketTimeout), N = (x, L) => {
10159
+ }, a.websocketTimeout), U = (x, L) => {
10160
10160
  this.handleSignalConnected(x, A, L);
10161
10161
  }, P = new URL(g);
10162
10162
  P.searchParams.has("access_token") && P.searchParams.set("access_token", "<redacted>"), this.log.debug("connecting to ".concat(P), Object.assign({
@@ -10200,8 +10200,8 @@ class ar {
10200
10200
  timeout: this.pingTimeoutDuration,
10201
10201
  interval: this.pingIntervalDuration
10202
10202
  })));
10203
- const U = w.shouldProcessFirstMessage ? X : void 0;
10204
- N(x, U), S(w.response);
10203
+ const N = w.shouldProcessFirstMessage ? X : void 0;
10204
+ U(x, N), S(w.response);
10205
10205
  } catch (x) {
10206
10206
  k(x);
10207
10207
  } finally {
@@ -16273,14 +16273,14 @@ class Dd extends gr {
16273
16273
  }
16274
16274
  yield b();
16275
16275
  }
16276
- const N = new Ci(e.kind, T, e, {
16276
+ const U = new Ci(e.kind, T, e, {
16277
16277
  loggerName: this.roomOptions.loggerName,
16278
16278
  loggerContextCb: () => this.logContext
16279
16279
  });
16280
- if (N.on(R.CpuConstrained, (P) => this.onTrackCpuConstrained(P, N)), N.options = t, e.sid = T.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
16280
+ if (U.on(R.CpuConstrained, (P) => this.onTrackCpuConstrained(P, U)), U.options = t, e.sid = T.sid, this.log.debug("publishing ".concat(e.kind, " with encodings"), Object.assign(Object.assign({}, this.logContext), {
16281
16281
  encodings: y,
16282
16282
  trackInfo: T
16283
- })), St(e) ? e.startMonitor(this.engine.client) : lt(e) && e.startMonitor(), this.addTrackPublication(N), this.emit(D.LocalTrackPublished, N), lt(e) && T.audioFeatures.includes(be.TF_PRECONNECT_BUFFER)) {
16283
+ })), St(e) ? e.startMonitor(this.engine.client) : lt(e) && e.startMonitor(), this.addTrackPublication(U), this.emit(D.LocalTrackPublished, U), lt(e) && T.audioFeatures.includes(be.TF_PRECONNECT_BUFFER)) {
16284
16284
  const P = e.getPreConnectBuffer(), x = e.getPreConnectBufferMimeType();
16285
16285
  this.on(D.LocalTrackSubscribed, (L) => {
16286
16286
  if (L.trackSid === T.sid) {
@@ -16291,7 +16291,7 @@ class Dd extends gr {
16291
16291
  this.log.debug("finished recording preconnect buffer", Object.assign(Object.assign({}, this.logContext), J(e))), e.stopPreConnectBuffer();
16292
16292
  }
16293
16293
  }), P && new Promise((q, X) => m(this, void 0, void 0, function* () {
16294
- var w, U, F, K, Q, Z;
16294
+ var w, N, F, K, Q, Z;
16295
16295
  try {
16296
16296
  this.log.debug("waiting for agent", Object.assign(Object.assign({}, this.logContext), J(e)));
16297
16297
  const se = setTimeout(() => {
@@ -16304,7 +16304,7 @@ class Dd extends gr {
16304
16304
  topic: "lk.agent.pre-connect-audio-buffer",
16305
16305
  destinationIdentities: [B.identity],
16306
16306
  attributes: {
16307
- trackId: N.trackSid,
16307
+ trackId: U.trackSid,
16308
16308
  sampleRate: String((Q = I.sampleRate) !== null && Q !== void 0 ? Q : "48000"),
16309
16309
  channels: String((Z = I.channelCount) !== null && Z !== void 0 ? Z : "1")
16310
16310
  }
@@ -16316,14 +16316,14 @@ class Dd extends gr {
16316
16316
  yield V.write(oe);
16317
16317
  }
16318
16318
  } catch (oe) {
16319
- U = {
16319
+ N = {
16320
16320
  error: oe
16321
16321
  };
16322
16322
  } finally {
16323
16323
  try {
16324
16324
  !fe && !w && (F = Re.return) && (yield F.call(Re));
16325
16325
  } finally {
16326
- if (U) throw U.error;
16326
+ if (N) throw N.error;
16327
16327
  }
16328
16328
  }
16329
16329
  yield V.close(), q();
@@ -16338,7 +16338,7 @@ class Dd extends gr {
16338
16338
  }));
16339
16339
  });
16340
16340
  }
16341
- return N;
16341
+ return U;
16342
16342
  });
16343
16343
  }
16344
16344
  get isLocal() {
@@ -20000,7 +20000,7 @@ function za(n) {
20000
20000
  function is(n) {
20001
20001
  return n instanceof Dt ? n.toJson() : { kind: "UnknownError", message: Lp(n) || "UnknownError" };
20002
20002
  }
20003
- const Vp = "2.0.5", qp = "https://api-js.mixpanel.com/track/?verbose=1&ip=1", Kd = 50, Nt = [];
20003
+ const Vp = "2.0.6", qp = "https://api-js.mixpanel.com/track/?verbose=1&ip=1", Kd = 50, Nt = [];
20004
20004
  let ss = !1;
20005
20005
  async function Hd(n) {
20006
20006
  const e = await fetch(qp, {
@@ -20615,7 +20615,7 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20615
20615
  ice_servers: b,
20616
20616
  session_id: T,
20617
20617
  fluent: A,
20618
- interrupt_enabled: N
20618
+ interrupt_enabled: U
20619
20619
  } = await k(e, a);
20620
20620
  (se = i.onStreamCreated) == null || se.call(i, { stream_id: O, session_id: T, agent_id: n });
20621
20621
  const P = new lg({ iceServers: b }), x = P.createDataChannel("JanusDataChannel");
@@ -20628,7 +20628,7 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20628
20628
  const q = e.stream_warmup && !A, X = () => l, w = () => {
20629
20629
  var B;
20630
20630
  l = !0, u && (c("CALLBACK: onConnectionStateChange(Connected)"), (B = i.onConnectionStateChange) == null || B.call(i, ye.Connected));
20631
- }, U = dg(
20631
+ }, N = dg(
20632
20632
  () => P.getStats(),
20633
20633
  X,
20634
20634
  w,
@@ -20646,7 +20646,7 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20646
20646
  return (V = i.onConnectivityStateChange) == null ? void 0 : V.call(i, B);
20647
20647
  }
20648
20648
  );
20649
- U.start(), P.onicecandidate = (B) => {
20649
+ N.start(), P.onicecandidate = (B) => {
20650
20650
  var V;
20651
20651
  c("peerConnection.onicecandidate", B);
20652
20652
  try {
@@ -20741,7 +20741,7 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20741
20741
  const V = Xa(P.iceConnectionState);
20742
20742
  if (P) {
20743
20743
  if (V === ye.New) {
20744
- U.stop();
20744
+ N.stop();
20745
20745
  return;
20746
20746
  }
20747
20747
  P.close(), P.oniceconnectionstatechange = null, P.onnegotiationneeded = null, P.onicecandidate = null, P.ontrack = null;
@@ -20752,7 +20752,7 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20752
20752
  } catch (oe) {
20753
20753
  c("Error on close stream connection", oe);
20754
20754
  }
20755
- (B = i.onAgentActivityStateChange) == null || B.call(i, Mn.Idle), U.stop();
20755
+ (B = i.onAgentActivityStateChange) == null || B.call(i, Mn.Idle), N.stop();
20756
20756
  }
20757
20757
  },
20758
20758
  sendDataChannelMessage: Pe,
@@ -20765,10 +20765,10 @@ async function fg(n, e, { debug: t = !1, callbacks: i, auth: s, baseURL: r = Ei,
20765
20765
  */
20766
20766
  streamId: O,
20767
20767
  streamType: L,
20768
- interruptAvailable: N ?? !1,
20768
+ interruptAvailable: U ?? !1,
20769
20769
  isInterruptible: !0,
20770
20770
  interrupt(B) {
20771
- if (!N)
20771
+ if (!U)
20772
20772
  throw new Error("Interrupt is not enabled for this stream");
20773
20773
  if (L !== ht.Fluent)
20774
20774
  throw new Error("Interrupt only available for Fluent streams");
@@ -20795,7 +20795,7 @@ async function pg(n, e, t, i) {
20795
20795
  const { version: r, ...o } = e;
20796
20796
  switch (o.transport.provider) {
20797
20797
  case Bs.Livekit:
20798
- const { createLiveKitStreamingManager: a } = await import("./livekit-manager-BA2FEl8R.js");
20798
+ const { createLiveKitStreamingManager: a } = await import("./livekit-manager-BPAUUVXy.js");
20799
20799
  return a(s, o, t);
20800
20800
  default:
20801
20801
  throw new Error(`Unsupported transport provider: ${o.transport.provider}`);
@@ -21018,16 +21018,16 @@ async function Dg(n, e) {
21018
21018
  c.track("agent-sdk", { event: "init" }, d);
21019
21019
  });
21020
21020
  const l = e.callbacks.onError;
21021
- e.callbacks.onError = (w, U) => {
21022
- c.track("agent-error", { error: is(w) }), l == null || l(w, U);
21021
+ e.callbacks.onError = (w, N) => {
21022
+ c.track("agent-error", { error: is(w) }), l == null || l(w, N);
21023
21023
  };
21024
21024
  const u = Dp(e.auth, r, e.callbacks.onError, e.externalId), h = await u.getRuntimeById(n);
21025
21025
  e.debug = e.debug || ((L = h == null ? void 0 : h.advanced_settings) == null ? void 0 : L.ui_debug_mode);
21026
21026
  const f = js(h.avatar.type);
21027
21027
  c.enrich(Ap(h));
21028
21028
  const { onMessage: g, clearQueue: v } = Yp(c, a, e, h, () => {
21029
- var w, U, F;
21030
- (w = a.socketManager) == null || w.disconnect(), (F = (U = e.callbacks).onConnectionStateChange) == null || F.call(U, ye.Disconnected);
21029
+ var w, N, F;
21030
+ (w = a.socketManager) == null || w.disconnect(), (F = (N = e.callbacks).onConnectionStateChange) == null || F.call(N, ye.Disconnected);
21031
21031
  });
21032
21032
  a.messages = Hp(e.initialMessages), (X = (q = e.callbacks).onNewMessage) == null || X.call(q, [...a.messages], "answer");
21033
21033
  const S = (w) => {
@@ -21035,20 +21035,20 @@ async function Dg(n, e) {
21035
21035
  }, k = ({ type: w }) => {
21036
21036
  var F, K, Q, Z;
21037
21037
  if (!((F = a.streamingManager) != null && F.interruptAvailable) || !((K = a.streamingManager) != null && K.isInterruptible)) return;
21038
- const U = a.messages[a.messages.length - 1];
21038
+ const N = a.messages[a.messages.length - 1];
21039
21039
  c.track("agent-video-interrupt", {
21040
21040
  type: w || "click",
21041
21041
  video_duration_to_interrupt: Us.get(!0),
21042
21042
  message_duration_to_interrupt: wt.get(!0)
21043
- }), U.interrupted = !0, (Z = (Q = e.callbacks).onNewMessage) == null || Z.call(Q, [...a.messages], "answer"), a.streamingManager.interrupt(w);
21043
+ }), N.interrupted = !0, (Z = (Q = e.callbacks).onNewMessage) == null || Z.call(Q, [...a.messages], "answer"), a.streamingManager.interrupt(w);
21044
21044
  }, I = /* @__PURE__ */ new Map();
21045
21045
  function O(w) {
21046
- return async (U) => {
21046
+ return async (N) => {
21047
21047
  const F = I.get(w);
21048
21048
  if (!F)
21049
21049
  throw no(`No handler registered for client tool: ${w}`);
21050
21050
  try {
21051
- const K = JSON.parse(U.payload);
21051
+ const K = JSON.parse(N.payload);
21052
21052
  return await F(K);
21053
21053
  } catch (K) {
21054
21054
  throw K instanceof ie ? K : no((K == null ? void 0 : K.message) || "Client tool failed");
@@ -21056,27 +21056,27 @@ async function Dg(n, e) {
21056
21056
  };
21057
21057
  }
21058
21058
  function y() {
21059
- var w, U, F, K;
21059
+ var w, N, F, K;
21060
21060
  for (const [Q] of I)
21061
- (U = (w = a.streamingManager) == null ? void 0 : w.unregisterRpcMethod) == null || U.call(w, Q), (K = (F = a.streamingManager) == null ? void 0 : F.registerRpcMethod) == null || K.call(F, Q, O(Q));
21061
+ (N = (w = a.streamingManager) == null ? void 0 : w.unregisterRpcMethod) == null || N.call(w, Q), (K = (F = a.streamingManager) == null ? void 0 : F.registerRpcMethod) == null || K.call(F, Q, O(Q));
21062
21062
  }
21063
- function b(w, U) {
21063
+ function b(w, N) {
21064
21064
  var K, Q;
21065
21065
  const F = !I.has(w);
21066
- I.set(w, U), F && ((Q = (K = a.streamingManager) == null ? void 0 : K.registerRpcMethod) == null || Q.call(K, w, O(w)));
21066
+ I.set(w, N), F && ((Q = (K = a.streamingManager) == null ? void 0 : K.registerRpcMethod) == null || Q.call(K, w, O(w)));
21067
21067
  }
21068
21068
  function T(w) {
21069
- var U, F;
21070
- I.delete(w), (F = (U = a.streamingManager) == null ? void 0 : U.unregisterRpcMethod) == null || F.call(U, w);
21069
+ var N, F;
21070
+ I.delete(w), (F = (N = a.streamingManager) == null ? void 0 : N.unregisterRpcMethod) == null || F.call(N, w);
21071
21071
  }
21072
21072
  const A = Date.now();
21073
21073
  za(() => {
21074
21074
  c.track("agent-sdk", { event: "loaded", ...xp(h) }, A);
21075
21075
  });
21076
- async function N(w) {
21076
+ async function U(w) {
21077
21077
  var fe, Re, Pe, se, B, V, oe;
21078
21078
  dl(), (Re = (fe = e.callbacks).onConnectionStateChange) == null || Re.call(fe, ye.Connecting), wt.reset(), w && !t && (delete a.chat, (se = (Pe = e.callbacks).onNewMessage) == null || se.call(Pe, [...a.messages], "answer"));
21079
- const U = o === ve.DirectPlayback || f ? Promise.resolve(void 0) : zp(
21079
+ const N = o === ve.DirectPlayback || f ? Promise.resolve(void 0) : zp(
21080
21080
  e.auth,
21081
21081
  s,
21082
21082
  { onMessage: g, onError: e.callbacks.onError },
@@ -21107,7 +21107,7 @@ async function Dg(n, e) {
21107
21107
  ).catch((pe) => {
21108
21108
  var ge, Ze;
21109
21109
  throw x(ve.Maintenance), (Ze = (ge = e.callbacks).onConnectionStateChange) == null || Ze.call(ge, ye.Fail), pe;
21110
- }), [K, { streamingManager: Q, chat: Z }] = await Promise.all([U, F]);
21110
+ }), [K, { streamingManager: Q, chat: Z }] = await Promise.all([N, F]);
21111
21111
  Z && Z.id !== ((B = a.chat) == null ? void 0 : B.id) && ((oe = (V = e.callbacks).onNewChat) == null || oe.call(V, Z.id)), a.streamingManager = Q, a.socketManager = K, a.chat = Z, y(), t = !1, c.enrich({
21112
21112
  chatId: Z == null ? void 0 : Z.id,
21113
21113
  streamId: Q == null ? void 0 : Q.streamId,
@@ -21115,12 +21115,12 @@ async function Dg(n, e) {
21115
21115
  }), x((Z == null ? void 0 : Z.chat_mode) ?? o);
21116
21116
  }
21117
21117
  async function P() {
21118
- var w, U, F, K;
21119
- (w = a.socketManager) == null || w.disconnect(), await ((U = a.streamingManager) == null ? void 0 : U.disconnect()), delete a.streamingManager, delete a.socketManager, (K = (F = e.callbacks).onConnectionStateChange) == null || K.call(F, ye.Disconnected);
21118
+ var w, N, F, K;
21119
+ (w = a.socketManager) == null || w.disconnect(), await ((N = a.streamingManager) == null ? void 0 : N.disconnect()), delete a.streamingManager, delete a.socketManager, (K = (F = e.callbacks).onConnectionStateChange) == null || K.call(F, ye.Disconnected);
21120
21120
  }
21121
21121
  async function x(w) {
21122
- var U, F;
21123
- w !== a.chatMode && (c.track("agent-mode-change", { mode: w }), a.chatMode = w, a.chatMode !== ve.Functional && await P(), (F = (U = e.callbacks).onModeChange) == null || F.call(U, w));
21122
+ var N, F;
21123
+ w !== a.chatMode && (c.track("agent-mode-change", { mode: w }), a.chatMode = w, a.chatMode !== ve.Functional && await P(), (F = (N = e.callbacks).onModeChange) == null || F.call(N, w));
21124
21124
  }
21125
21125
  return {
21126
21126
  agent: h,
@@ -21137,27 +21137,27 @@ async function Dg(n, e) {
21137
21137
  changeMode: x,
21138
21138
  enrichAnalytics: c.enrich,
21139
21139
  async connect() {
21140
- await N(!0), c.track("agent-chat", {
21140
+ await U(!0), c.track("agent-chat", {
21141
21141
  event: "connect",
21142
21142
  mode: a.chatMode
21143
21143
  });
21144
21144
  },
21145
21145
  async reconnect() {
21146
21146
  const w = a.streamingManager;
21147
- let U;
21147
+ let N;
21148
21148
  if (f && (w != null && w.reconnect))
21149
21149
  try {
21150
21150
  await w.reconnect();
21151
21151
  } catch (F) {
21152
- U = is(F).kind, await P(), await N(!1);
21152
+ N = is(F).kind, await P(), await U(!1);
21153
21153
  }
21154
21154
  else
21155
- await P(), await N(!1);
21155
+ await P(), await U(!1);
21156
21156
  c.track("agent-chat", {
21157
21157
  event: "reconnect",
21158
21158
  mode: a.chatMode,
21159
21159
  success: !0,
21160
- ...U && { fallbackReason: U }
21160
+ ...N && { fallbackReason: N }
21161
21161
  });
21162
21162
  },
21163
21163
  async disconnect() {
@@ -21167,20 +21167,24 @@ async function Dg(n, e) {
21167
21167
  });
21168
21168
  },
21169
21169
  publishMicrophoneStream(w) {
21170
- var U;
21171
- return (U = a.streamingManager) != null && U.publishMicrophoneStream ? a.streamingManager.publishMicrophoneStream(w) : Promise.reject(new Error("publishMicrophoneStream is not available for this streaming manager"));
21170
+ var N;
21171
+ return (N = a.streamingManager) != null && N.publishMicrophoneStream ? a.streamingManager.publishMicrophoneStream(w) : Promise.reject(new Error("publishMicrophoneStream is not available for this streaming manager"));
21172
+ },
21173
+ setSttLanguage(w) {
21174
+ var N;
21175
+ return (N = a.streamingManager) != null && N.setSttLanguage ? (c.track("agent-stt-language-change", { language: w }), a.streamingManager.setSttLanguage(w)) : Promise.reject(new Error("setSttLanguage is not available for this streaming manager"));
21172
21176
  },
21173
21177
  unpublishMicrophoneStream() {
21174
21178
  var w;
21175
21179
  return (w = a.streamingManager) != null && w.unpublishMicrophoneStream ? a.streamingManager.unpublishMicrophoneStream() : Promise.resolve();
21176
21180
  },
21177
21181
  replaceMicrophoneTrack(w) {
21178
- var U;
21179
- return (U = a.streamingManager) != null && U.replaceMicrophoneTrack ? a.streamingManager.replaceMicrophoneTrack(w) : Promise.reject(new Error("replaceMicrophoneTrack is not available for this streaming manager"));
21182
+ var N;
21183
+ return (N = a.streamingManager) != null && N.replaceMicrophoneTrack ? a.streamingManager.replaceMicrophoneTrack(w) : Promise.reject(new Error("replaceMicrophoneTrack is not available for this streaming manager"));
21180
21184
  },
21181
21185
  publishCameraStream(w) {
21182
- var U;
21183
- return (U = a.streamingManager) != null && U.publishCameraStream ? a.streamingManager.publishCameraStream(w) : Promise.reject(new Error("publishCameraStream is not available for this streaming manager"));
21186
+ var N;
21187
+ return (N = a.streamingManager) != null && N.publishCameraStream ? a.streamingManager.publishCameraStream(w) : Promise.reject(new Error("publishCameraStream is not available for this streaming manager"));
21184
21188
  },
21185
21189
  unpublishCameraStream() {
21186
21190
  var w;
@@ -21188,7 +21192,7 @@ async function Dg(n, e) {
21188
21192
  },
21189
21193
  async chat(w) {
21190
21194
  var Q, Z, fe, Re, Pe;
21191
- const U = () => {
21195
+ const N = () => {
21192
21196
  if (lo(o))
21193
21197
  throw new He(`${o} is enabled, chat is disabled`);
21194
21198
  if (w.length >= _r)
@@ -21247,12 +21251,12 @@ async function Dg(n, e) {
21247
21251
  return !((Cr = ge == null ? void 0 : ge.message) == null ? void 0 : Cr.includes("Stream Error")) && !Ze ? ((wr = (Er = e.callbacks).onError) == null || wr.call(Er, ge), !1) : !0;
21248
21252
  },
21249
21253
  onRetry: async () => {
21250
- await P(), await N(!1);
21254
+ await P(), await U(!1);
21251
21255
  }
21252
21256
  });
21253
21257
  };
21254
21258
  try {
21255
- v(), U(), a.messages.push({
21259
+ v(), N(), a.messages.push({
21256
21260
  id: Ft(),
21257
21261
  role: "user",
21258
21262
  content: w,
@@ -21283,7 +21287,7 @@ async function Dg(n, e) {
21283
21287
  }), se;
21284
21288
  }
21285
21289
  },
21286
- rate(w, U, F) {
21290
+ rate(w, N, F) {
21287
21291
  var Z, fe, Re, Pe;
21288
21292
  const K = a.messages.find((se) => se.id === w);
21289
21293
  if (a.chat) {
@@ -21293,20 +21297,20 @@ async function Dg(n, e) {
21293
21297
  const Q = ((Z = K.matches) == null ? void 0 : Z.map((se) => [se.document_id, se.id])) ?? [];
21294
21298
  return c.track("agent-rate", {
21295
21299
  event: F ? "update" : "create",
21296
- thumb: U === 1 ? "up" : "down",
21300
+ thumb: N === 1 ? "up" : "down",
21297
21301
  knowledge_id: ((fe = h.knowledge) == null ? void 0 : fe.id) ?? "",
21298
21302
  matches: Q,
21299
- score: U
21303
+ score: N
21300
21304
  }), F ? u.updateRating(h.id, a.chat.id, F, {
21301
21305
  knowledge_id: ((Re = h.knowledge) == null ? void 0 : Re.id) ?? "",
21302
21306
  message_id: w,
21303
21307
  matches: Q,
21304
- score: U
21308
+ score: N
21305
21309
  }) : u.createRating(h.id, a.chat.id, {
21306
21310
  knowledge_id: ((Pe = h.knowledge) == null ? void 0 : Pe.id) ?? "",
21307
21311
  message_id: w,
21308
21312
  matches: Q,
21309
- score: U
21313
+ score: N
21310
21314
  });
21311
21315
  },
21312
21316
  deleteRate(w) {
@@ -21314,14 +21318,14 @@ async function Dg(n, e) {
21314
21318
  throw new He("Chat is not initialized");
21315
21319
  return c.track("agent-rate-delete", { type: "text" }), u.deleteRating(h.id, a.chat.id, w);
21316
21320
  },
21317
- submitFeedback(w, U) {
21321
+ submitFeedback(w, N) {
21318
21322
  if (!a.chat)
21319
21323
  throw new He("Chat is not initialized");
21320
- return c.track("agent-feedback", { rating: w, hasAnswer: !!U }), u.submitFeedback(h.id, a.chat.id, { rating: w, answer: U });
21324
+ return c.track("agent-feedback", { rating: w, hasAnswer: !!N }), u.submitFeedback(h.id, a.chat.id, { rating: w, answer: N });
21321
21325
  },
21322
21326
  async speak(w) {
21323
21327
  var Q, Z, fe;
21324
- function U() {
21328
+ function N() {
21325
21329
  return typeof w == "string" ? {
21326
21330
  type: "text",
21327
21331
  input: w,
@@ -21334,7 +21338,7 @@ async function Dg(n, e) {
21334
21338
  sentiment: w.sentiment
21335
21339
  } : w;
21336
21340
  }
21337
- const F = U();
21341
+ const F = N();
21338
21342
  if (c.track("agent-speak", F), wt.update(), a.messages && F.type === "text" && (a.messages.push({
21339
21343
  id: Ft(),
21340
21344
  role: "assistant",
@@ -21359,6 +21363,9 @@ async function Dg(n, e) {
21359
21363
  unregisterClientTool: T
21360
21364
  };
21361
21365
  }
21366
+ function xg(n) {
21367
+ return n.some((e) => e.executionMode === "blocking");
21368
+ }
21362
21369
  export {
21363
21370
  Mn as A,
21364
21371
  Dt as B,
@@ -21394,8 +21401,9 @@ export {
21394
21401
  cl as s,
21395
21402
  is as t,
21396
21403
  Dg as u,
21397
- Rg as v,
21398
- Pg as w,
21399
- yl as x,
21400
- Mg as y
21404
+ xg as v,
21405
+ Rg as w,
21406
+ Pg as x,
21407
+ yl as y,
21408
+ Mg as z
21401
21409
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, B as r, k as t, m as o, o as i, C as n, f as S, g as d, D as p, H as c, K as g, N as E, P as m, R as C, p as y, e as T, S as v, b as D, j as V, q as A, T as P, V as h, r as w, s as M, W as l, u, v as K, w as N, x as R } from "./index-C9-G_CI4.js";
1
+ import { A as s, B as r, k as t, m as o, o as i, C as n, f as S, g as d, D as p, H as g, K as c, N as E, P as m, R as y, p as C, e as T, S as v, b as A, j as D, q as V, T as w, V as P, r as h, s as l, W as M, u, v as K, w as N, x as R, y as b } from "./index-BLArKcFJ.js";
2
2
  export {
3
3
  s as AgentActivityState,
4
4
  r as BaseError,
@@ -9,24 +9,25 @@ export {
9
9
  S as ConnectionState,
10
10
  d as ConnectivityState,
11
11
  p as DocumentType,
12
- c as HttpError,
13
- g as KnowledgeType,
12
+ g as HttpError,
13
+ c as KnowledgeType,
14
14
  E as NetworkError,
15
15
  m as Providers,
16
- C as RateState,
17
- y as SDK_VERSION,
16
+ y as RateState,
17
+ C as SDK_VERSION,
18
18
  T as StreamError,
19
19
  v as StreamEvents,
20
- D as StreamType,
21
- V as StreamingState,
22
- A as Subject,
23
- P as TransportProvider,
24
- h as ValidationError,
25
- w as VideoType,
26
- M as VoiceAccess,
27
- l as WsError,
20
+ A as StreamType,
21
+ D as StreamingState,
22
+ V as Subject,
23
+ w as TransportProvider,
24
+ P as ValidationError,
25
+ h as VideoType,
26
+ l as VoiceAccess,
27
+ M as WsError,
28
28
  u as createAgentManager,
29
- K as isDIDError,
30
- N as mapVideoType,
31
- R as parseMessageParts
29
+ K as isAwaitingTool,
30
+ N as isDIDError,
31
+ R as mapVideoType,
32
+ b as parseMessageParts
32
33
  };