@d-id/client-sdk 2.0.1 → 2.0.2-staging.383
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.
|
@@ -102,8 +102,8 @@ const In = (e) => {
|
|
|
102
102
|
throw new Error(`Unknown video type: ${e}`);
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
var k = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(k || {}), ne = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(ne || {}), ae = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e.ToolActive = "TOOL_ACTIVE", e))(ae || {}), L = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", e.ChatAudioTranscribed = "chat/audio-transcribed", e.StreamDone = "stream/done", e.StreamStarted = "stream/started", e.StreamFailed = "stream/error", e.StreamReady = "stream/ready", e.StreamCreated = "stream/created", e.StreamInterrupt = "stream/interrupt", e.StreamVideoCreated = "stream-video/started", e.StreamVideoDone = "stream-video/done", e.StreamVideoError = "stream-video/error", e.StreamVideoRejected = "stream-video/rejected", e.ToolCallStarted = "tool-call/started", e.ToolCallDone = "tool-call/done", e.ToolCallError = "tool-call/error", e))(L || {}), P = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnecting = "disconnecting", e.Disconnected = "disconnected", e))(P || {}), W = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(W || {}), Se = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(Se || {}), ht = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(ht || {}), pt = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(pt || {});
|
|
106
|
-
const
|
|
105
|
+
var k = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(k || {}), ne = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(ne || {}), ae = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e.ToolActive = "TOOL_ACTIVE", e))(ae || {}), L = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", e.ChatAudioTranscribed = "chat/audio-transcribed", e.StreamDone = "stream/done", e.StreamStarted = "stream/started", e.StreamFailed = "stream/error", e.StreamReady = "stream/ready", e.StreamCreated = "stream/created", e.StreamInterrupt = "stream/interrupt", e.StreamVideoCreated = "stream-video/started", e.StreamVideoDone = "stream-video/done", e.StreamVideoError = "stream-video/error", e.StreamVideoRejected = "stream-video/rejected", e.ToolCallStarted = "tool-call/started", e.ToolCallDone = "tool-call/done", e.ToolCallError = "tool-call/error", e.TurnStarted = "turn/started", e.TurnEnded = "turn/ended", e))(L || {}), P = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnecting = "disconnecting", e.Disconnected = "disconnected", e))(P || {}), W = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(W || {}), Se = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(Se || {}), ht = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(ht || {}), pt = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(pt || {});
|
|
106
|
+
const Tn = (...e) => {
|
|
107
107
|
}, He = (e) => new Promise((t) => setTimeout(t, e)), ee = (e = 16) => {
|
|
108
108
|
const t = new Uint8Array(e);
|
|
109
109
|
return window.crypto.getRandomValues(t), Array.from(t, (n) => n.toString(16).padStart(2, "0")).join("").slice(0, 13);
|
|
@@ -131,7 +131,7 @@ function qe(e, t) {
|
|
|
131
131
|
return `Client-Key ${e.clientKey}.${pe(t)}_${le}`;
|
|
132
132
|
throw new Error(`Unknown auth type: ${e}`);
|
|
133
133
|
}
|
|
134
|
-
const yt = 45 * 1e3, vt = "X-Playground-Chat",
|
|
134
|
+
const yt = 45 * 1e3, vt = "X-Playground-Chat", Te = 2e3, fe = "https://api.d-id.com", Ct = "wss://notifications.d-id.com", St = "79f81a83a67430be2bc0fd61042b8faa", Ge = (e) => e.type, kt = (e) => {
|
|
135
135
|
switch (e.type) {
|
|
136
136
|
case "expressive":
|
|
137
137
|
return "v4";
|
|
@@ -140,7 +140,7 @@ const yt = 45 * 1e3, vt = "X-Playground-Chat", Ee = 2e3, fe = "https://api.d-id.
|
|
|
140
140
|
case "talk":
|
|
141
141
|
return "v2";
|
|
142
142
|
}
|
|
143
|
-
}, ke = (e) => e === We.Expressive, Mt = (e) => [x.TextOnly, x.Playground, x.Maintenance].includes(e), Xe = (e) => e && [x.DirectPlayback, x.Off].includes(e), be = /\[!\[([^\[\]]*)\]\(([^)\s]+)\)\]\(([^)\s]+)\)/g,
|
|
143
|
+
}, ke = (e) => e === We.Expressive, Mt = (e) => [x.TextOnly, x.Playground, x.Maintenance].includes(e), Xe = (e) => e && [x.DirectPlayback, x.Off].includes(e), be = /\[!\[([^\[\]]*)\]\(([^)\s]+)\)\]\(([^)\s]+)\)/g, Ee = /!\[([^\[\]]*)\]\(([^)\s]+)\)/g, Rt = [".mp4", ".webm", ".mkv", ".mov", ".m4v", ".ogv"];
|
|
144
144
|
function Dt(e) {
|
|
145
145
|
const t = e.split("?")[0].split("#")[0].toLowerCase();
|
|
146
146
|
return Rt.some((n) => t.endsWith(n));
|
|
@@ -157,7 +157,7 @@ function It(e) {
|
|
|
157
157
|
length: n[0].length,
|
|
158
158
|
part: { type: "video", src: n[3], alt: n[1], thumbnail: n[2] }
|
|
159
159
|
});
|
|
160
|
-
for (
|
|
160
|
+
for (Ee.lastIndex = 0; (n = Ee.exec(e)) !== null; )
|
|
161
161
|
if (!t.some((s) => n.index >= s.index && n.index < s.index + s.length)) {
|
|
162
162
|
const s = n[2], r = n[1];
|
|
163
163
|
let a;
|
|
@@ -188,7 +188,7 @@ let xe = "", me = [];
|
|
|
188
188
|
function re(e) {
|
|
189
189
|
return e === xe || (xe = e, me = It(e)), me;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Tt(e, t) {
|
|
192
192
|
let n;
|
|
193
193
|
return {
|
|
194
194
|
promise: new Promise((c, o) => {
|
|
@@ -212,7 +212,7 @@ async function we(e, t) {
|
|
|
212
212
|
try {
|
|
213
213
|
if (!n.timeout)
|
|
214
214
|
return await e();
|
|
215
|
-
const { promise: o, clear: s } =
|
|
215
|
+
const { promise: o, clear: s } = Tt(n.timeout, n.timeoutErrorMessage), r = e().finally(s);
|
|
216
216
|
return await Promise.race([r, o]);
|
|
217
217
|
} catch (o) {
|
|
218
218
|
if (i = o, !n.shouldRetryFn(o) || c >= n.limit)
|
|
@@ -275,7 +275,7 @@ function Qe(e, t = fe, n, i) {
|
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function Et(e, t = fe, n, i) {
|
|
279
279
|
const c = Qe(e, `${t}/agents`, n, i);
|
|
280
280
|
return {
|
|
281
281
|
getRuntimeById(o, s) {
|
|
@@ -366,7 +366,7 @@ function $e(e) {
|
|
|
366
366
|
function ge(e) {
|
|
367
367
|
return e instanceof X ? e.toJson() : { kind: "UnknownError", message: xt(e) || "UnknownError" };
|
|
368
368
|
}
|
|
369
|
-
const zt = "2.0.
|
|
369
|
+
const zt = "2.0.2-staging.383", Ft = "https://api-js.mixpanel.com/track/?verbose=1&ip=1", Ye = 50, Z = [];
|
|
370
370
|
let he = !1;
|
|
371
371
|
async function Ze(e) {
|
|
372
372
|
const t = await fetch(Ft, {
|
|
@@ -881,12 +881,12 @@ function on(e, t, n, i, c) {
|
|
|
881
881
|
const D = await e();
|
|
882
882
|
if (!D)
|
|
883
883
|
return;
|
|
884
|
-
const { isReceiving: b, avgJitterDelayInInterval: j, freezeCount:
|
|
884
|
+
const { isReceiving: b, avgJitterDelayInInterval: j, freezeCount: T } = v(D), Q = tn(D);
|
|
885
885
|
if (b)
|
|
886
|
-
a = 0, f =
|
|
886
|
+
a = 0, f = T - p, u = j < rn ? ne.Strong : j > an && f > 1 ? ne.Weak : m, u !== m && (c == null || c(u), m = u, p += f, f = 0), d || (i == null || i(k.Start), r = s[s.length - 1], s = [], d = !0), s.push(Q);
|
|
887
887
|
else if (d && (a++, a >= nn)) {
|
|
888
888
|
const H = Fe(s, ue, r);
|
|
889
|
-
i == null || i(k.Stop, H), t() || n(), p =
|
|
889
|
+
i == null || i(k.Stop, H), t() || n(), p = T, d = !1;
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
return {
|
|
@@ -976,14 +976,14 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
976
976
|
e,
|
|
977
977
|
i.onError
|
|
978
978
|
), {
|
|
979
|
-
id:
|
|
979
|
+
id: T,
|
|
980
980
|
offer: Q,
|
|
981
981
|
ice_servers: H,
|
|
982
982
|
session_id: J,
|
|
983
983
|
fluent: ie,
|
|
984
984
|
interrupt_enabled: Y
|
|
985
985
|
} = await b(t, r);
|
|
986
|
-
(I = i.onStreamCreated) == null || I.call(i, { stream_id:
|
|
986
|
+
(I = i.onStreamCreated) == null || I.call(i, { stream_id: T, session_id: J, agent_id: e });
|
|
987
987
|
const M = new cn({ iceServers: H }), q = M.createDataChannel("JanusDataChannel");
|
|
988
988
|
if (!J)
|
|
989
989
|
throw new Error("Could not create session_id");
|
|
@@ -1017,7 +1017,7 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1017
1017
|
a("peerConnection.onicecandidate", h);
|
|
1018
1018
|
try {
|
|
1019
1019
|
h.candidate && h.candidate.sdpMid && h.candidate.sdpMLineIndex !== null ? j(
|
|
1020
|
-
|
|
1020
|
+
T,
|
|
1021
1021
|
{
|
|
1022
1022
|
candidate: h.candidate.candidate,
|
|
1023
1023
|
sdpMid: h.candidate.sdpMid,
|
|
@@ -1025,9 +1025,9 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1025
1025
|
},
|
|
1026
1026
|
J,
|
|
1027
1027
|
r
|
|
1028
|
-
) : j(
|
|
1029
|
-
} catch (
|
|
1030
|
-
(w = i.onError) == null || w.call(i,
|
|
1028
|
+
) : j(T, { candidate: null }, J, r);
|
|
1029
|
+
} catch (E) {
|
|
1030
|
+
(w = i.onError) == null || w.call(i, E, { streamId: T });
|
|
1031
1031
|
}
|
|
1032
1032
|
}, q.onopen = () => {
|
|
1033
1033
|
u = !0, (!se || m) && l();
|
|
@@ -1039,8 +1039,8 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1039
1039
|
};
|
|
1040
1040
|
function S(h, w) {
|
|
1041
1041
|
if (h === L.StreamStarted && typeof w == "object" && "metadata" in w) {
|
|
1042
|
-
const
|
|
1043
|
-
C(
|
|
1042
|
+
const E = w.metadata;
|
|
1043
|
+
C(E.videoId);
|
|
1044
1044
|
}
|
|
1045
1045
|
h === L.StreamDone && C(null), f = h === L.StreamStarted ? k.Start : k.Stop, Ue({
|
|
1046
1046
|
statsSignal: V === W.Legacy ? p : void 0,
|
|
@@ -1053,8 +1053,8 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1053
1053
|
}
|
|
1054
1054
|
function R(h, w) {
|
|
1055
1055
|
var _;
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1056
|
+
const E = typeof w == "string" ? w : w == null ? void 0 : w.metadata;
|
|
1057
|
+
E && s.enrich({ streamMetadata: E }), (_ = i.onStreamReady) == null || _.call(i);
|
|
1058
1058
|
}
|
|
1059
1059
|
const $ = {
|
|
1060
1060
|
[L.StreamStarted]: S,
|
|
@@ -1063,8 +1063,8 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1063
1063
|
};
|
|
1064
1064
|
q.onmessage = (h) => {
|
|
1065
1065
|
var _;
|
|
1066
|
-
const { subject: w, data:
|
|
1067
|
-
(_ = $[w]) == null || _.call($, w,
|
|
1066
|
+
const { subject: w, data: E } = d(h.data);
|
|
1067
|
+
(_ = $[w]) == null || _.call($, w, E);
|
|
1068
1068
|
}, M.oniceconnectionstatechange = () => {
|
|
1069
1069
|
var w;
|
|
1070
1070
|
a("peerConnection.oniceconnectionstatechange => " + M.iceConnectionState);
|
|
@@ -1075,19 +1075,19 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1075
1075
|
a("peerConnection.ontrack", h), a("CALLBACK: onSrcObjectReady"), (w = i.onSrcObjectReady) == null || w.call(i, h.streams[0]);
|
|
1076
1076
|
}, await M.setRemoteDescription(Q), a("set remote description OK");
|
|
1077
1077
|
const F = await M.createAnswer();
|
|
1078
|
-
a("create answer OK"), await M.setLocalDescription(F), a("set local description OK"), await v(
|
|
1078
|
+
a("create answer OK"), await M.setLocalDescription(F), a("set local description OK"), await v(T, F, J, r), a("start connection OK");
|
|
1079
1079
|
function N(h) {
|
|
1080
|
-
var w,
|
|
1080
|
+
var w, E;
|
|
1081
1081
|
if (!m || q.readyState !== "open") {
|
|
1082
1082
|
a("Data channel is not ready for sending messages"), (w = i.onError) == null || w.call(i, new Oe("Data channel is not ready for sending messages"), {
|
|
1083
|
-
streamId:
|
|
1083
|
+
streamId: T
|
|
1084
1084
|
});
|
|
1085
1085
|
return;
|
|
1086
1086
|
}
|
|
1087
1087
|
try {
|
|
1088
1088
|
q.send(h);
|
|
1089
1089
|
} catch (_) {
|
|
1090
|
-
a("Error sending data channel message", _), (
|
|
1090
|
+
a("Error sending data channel message", _), (E = i.onError) == null || E.call(i, _, { streamId: T });
|
|
1091
1091
|
}
|
|
1092
1092
|
}
|
|
1093
1093
|
return {
|
|
@@ -1096,14 +1096,14 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1096
1096
|
* @param payload
|
|
1097
1097
|
*/
|
|
1098
1098
|
speak(h) {
|
|
1099
|
-
return B(
|
|
1099
|
+
return B(T, J, h);
|
|
1100
1100
|
},
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Method to close RTC connection
|
|
1103
1103
|
*/
|
|
1104
1104
|
async disconnect() {
|
|
1105
1105
|
var h;
|
|
1106
|
-
if (
|
|
1106
|
+
if (T) {
|
|
1107
1107
|
const w = Ne(M.iceConnectionState);
|
|
1108
1108
|
if (M) {
|
|
1109
1109
|
if (w === P.New) {
|
|
@@ -1113,10 +1113,10 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1113
1113
|
M.close(), M.oniceconnectionstatechange = null, M.onnegotiationneeded = null, M.onicecandidate = null, M.ontrack = null;
|
|
1114
1114
|
}
|
|
1115
1115
|
try {
|
|
1116
|
-
w === P.Connected && await D(
|
|
1116
|
+
w === P.Connected && await D(T, J).catch((E) => {
|
|
1117
1117
|
});
|
|
1118
|
-
} catch (
|
|
1119
|
-
a("Error on close stream connection",
|
|
1118
|
+
} catch (E) {
|
|
1119
|
+
a("Error on close stream connection", E);
|
|
1120
1120
|
}
|
|
1121
1121
|
(h = i.onAgentActivityStateChange) == null || h.call(i, ae.Idle), g.stop();
|
|
1122
1122
|
}
|
|
@@ -1129,7 +1129,7 @@ async function fn(e, t, { debug: n = !1, callbacks: i, auth: c, baseURL: o = fe,
|
|
|
1129
1129
|
/**
|
|
1130
1130
|
* Id of current RTC stream
|
|
1131
1131
|
*/
|
|
1132
|
-
streamId:
|
|
1132
|
+
streamId: T,
|
|
1133
1133
|
streamType: V,
|
|
1134
1134
|
interruptAvailable: Y ?? !1,
|
|
1135
1135
|
isInterruptible: !0,
|
|
@@ -1161,7 +1161,7 @@ async function mn(e, t, n, i) {
|
|
|
1161
1161
|
const { version: o, ...s } = t;
|
|
1162
1162
|
switch (s.transport.provider) {
|
|
1163
1163
|
case Se.Livekit:
|
|
1164
|
-
const { createLiveKitStreamingManager: r } = await import("./livekit-manager-
|
|
1164
|
+
const { createLiveKitStreamingManager: r } = await import("./livekit-manager-DpvQdE6Z.js");
|
|
1165
1165
|
return r(c, s, n);
|
|
1166
1166
|
default:
|
|
1167
1167
|
throw new Error(`Unsupported transport provider: ${s.transport.provider}`);
|
|
@@ -1354,8 +1354,8 @@ async function Mn(e, t, n, i, c) {
|
|
|
1354
1354
|
t.mode,
|
|
1355
1355
|
t.persistentChat,
|
|
1356
1356
|
c
|
|
1357
|
-
), j = Ve(e, t, i, B).then((H) => (D = H, H)), [
|
|
1358
|
-
return { chatResult:
|
|
1357
|
+
), j = Ve(e, t, i, B).then((H) => (D = H, H)), [T, Q] = await Promise.all([b, j]);
|
|
1358
|
+
return { chatResult: T, streamingManager: Q };
|
|
1359
1359
|
} catch (b) {
|
|
1360
1360
|
throw v.abort(), D && await D.disconnect().catch(() => {
|
|
1361
1361
|
}), b;
|
|
@@ -1364,7 +1364,7 @@ async function Mn(e, t, n, i, c) {
|
|
|
1364
1364
|
}, { chatResult: s, streamingManager: r } = await o(), { chat: a, chatMode: d } = s;
|
|
1365
1365
|
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (u = (m = t.callbacks).onModeChange) == null || u.call(m, d), d !== x.Functional) ? ((p = (f = t.callbacks).onError) == null || p.call(f, new ot(d)), r == null || r.disconnect(), { chat: a }) : { chat: a, streamingManager: r };
|
|
1366
1366
|
}
|
|
1367
|
-
async function
|
|
1367
|
+
async function En(e, t) {
|
|
1368
1368
|
var V, se, oe;
|
|
1369
1369
|
let n = !0;
|
|
1370
1370
|
const i = t.mixpanelKey || St, c = t.wsURL || Ct, o = t.baseURL || fe, s = t.mode || x.Functional, r = {
|
|
@@ -1384,7 +1384,7 @@ async function Tn(e, t) {
|
|
|
1384
1384
|
t.callbacks.onError = (l, g) => {
|
|
1385
1385
|
a.track("agent-error", { error: ge(l) }), m == null || m(l, g);
|
|
1386
1386
|
};
|
|
1387
|
-
const u =
|
|
1387
|
+
const u = Et(t.auth, o, t.callbacks.onError, t.externalId), f = await u.getRuntimeById(e);
|
|
1388
1388
|
t.debug = t.debug || ((V = f == null ? void 0 : f.advanced_settings) == null ? void 0 : V.ui_debug_mode);
|
|
1389
1389
|
const p = ke(f.avatar.type);
|
|
1390
1390
|
a.enrich(At(f));
|
|
@@ -1405,7 +1405,7 @@ async function Tn(e, t) {
|
|
|
1405
1405
|
message_duration_to_interrupt: G.get(!0)
|
|
1406
1406
|
}), g.interrupted = !0, (R = (S = t.callbacks).onNewMessage) == null || R.call(S, [...r.messages], "answer"), r.streamingManager.interrupt(l);
|
|
1407
1407
|
}, j = /* @__PURE__ */ new Map();
|
|
1408
|
-
function
|
|
1408
|
+
function T(l) {
|
|
1409
1409
|
return async (g) => {
|
|
1410
1410
|
const y = j.get(l);
|
|
1411
1411
|
if (!y)
|
|
@@ -1421,12 +1421,12 @@ async function Tn(e, t) {
|
|
|
1421
1421
|
function Q() {
|
|
1422
1422
|
var l, g, y, C;
|
|
1423
1423
|
for (const [S] of j)
|
|
1424
|
-
(g = (l = r.streamingManager) == null ? void 0 : l.unregisterRpcMethod) == null || g.call(l, S), (C = (y = r.streamingManager) == null ? void 0 : y.registerRpcMethod) == null || C.call(y, S,
|
|
1424
|
+
(g = (l = r.streamingManager) == null ? void 0 : l.unregisterRpcMethod) == null || g.call(l, S), (C = (y = r.streamingManager) == null ? void 0 : y.registerRpcMethod) == null || C.call(y, S, T(S));
|
|
1425
1425
|
}
|
|
1426
1426
|
function H(l, g) {
|
|
1427
1427
|
var C, S;
|
|
1428
1428
|
const y = !j.has(l);
|
|
1429
|
-
j.set(l, g), y && ((S = (C = r.streamingManager) == null ? void 0 : C.registerRpcMethod) == null || S.call(C, l,
|
|
1429
|
+
j.set(l, g), y && ((S = (C = r.streamingManager) == null ? void 0 : C.registerRpcMethod) == null || S.call(C, l, T(l)));
|
|
1430
1430
|
}
|
|
1431
1431
|
function J(l) {
|
|
1432
1432
|
var g, y;
|
|
@@ -1437,7 +1437,7 @@ async function Tn(e, t) {
|
|
|
1437
1437
|
a.track("agent-sdk", { event: "loaded", ..._t(f) }, ie);
|
|
1438
1438
|
});
|
|
1439
1439
|
async function Y(l) {
|
|
1440
|
-
var $, F, N, I, h, w,
|
|
1440
|
+
var $, F, N, I, h, w, E;
|
|
1441
1441
|
wt(), (F = ($ = t.callbacks).onConnectionStateChange) == null || F.call($, P.Connecting), G.reset(), l && !n && (delete r.chat, (I = (N = t.callbacks).onNewMessage) == null || I.call(N, [...r.messages], "answer"));
|
|
1442
1442
|
const g = s === x.DirectPlayback || p ? Promise.resolve(void 0) : Ot(
|
|
1443
1443
|
t.auth,
|
|
@@ -1471,7 +1471,7 @@ async function Tn(e, t) {
|
|
|
1471
1471
|
var A, K;
|
|
1472
1472
|
throw q(x.Maintenance), (K = (A = t.callbacks).onConnectionStateChange) == null || K.call(A, P.Fail), _;
|
|
1473
1473
|
}), [C, { streamingManager: S, chat: R }] = await Promise.all([g, y]);
|
|
1474
|
-
R && R.id !== ((h = r.chat) == null ? void 0 : h.id) && ((
|
|
1474
|
+
R && R.id !== ((h = r.chat) == null ? void 0 : h.id) && ((E = (w = t.callbacks).onNewChat) == null || E.call(w, R.id)), r.streamingManager = S, r.socketManager = C, r.chat = R, Q(), n = !1, a.enrich({
|
|
1475
1475
|
chatId: R == null ? void 0 : R.id,
|
|
1476
1476
|
streamId: S == null ? void 0 : S.streamId,
|
|
1477
1477
|
mode: r.chatMode
|
|
@@ -1554,8 +1554,8 @@ async function Tn(e, t) {
|
|
|
1554
1554
|
const g = () => {
|
|
1555
1555
|
if (Xe(s))
|
|
1556
1556
|
throw new U(`${s} is enabled, chat is disabled`);
|
|
1557
|
-
if (l.length >=
|
|
1558
|
-
throw new U(`Message cannot be more than ${
|
|
1557
|
+
if (l.length >= Te)
|
|
1558
|
+
throw new U(`Message cannot be more than ${Te} characters`);
|
|
1559
1559
|
if (l.length === 0)
|
|
1560
1560
|
throw new U("Message cannot be empty");
|
|
1561
1561
|
if (r.chatMode === x.Maintenance)
|
|
@@ -1749,14 +1749,14 @@ export {
|
|
|
1749
1749
|
st as k,
|
|
1750
1750
|
G as l,
|
|
1751
1751
|
x as m,
|
|
1752
|
-
|
|
1752
|
+
Tn as n,
|
|
1753
1753
|
ot as o,
|
|
1754
1754
|
zt as p,
|
|
1755
1755
|
ft as q,
|
|
1756
1756
|
We as r,
|
|
1757
1757
|
pt as s,
|
|
1758
1758
|
ge as t,
|
|
1759
|
-
|
|
1759
|
+
En as u,
|
|
1760
1760
|
Dn as v,
|
|
1761
1761
|
In as w,
|
|
1762
1762
|
It as x
|
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-
|
|
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-DJ2zFpqc.js";
|
|
2
2
|
export {
|
|
3
3
|
s as AgentActivityState,
|
|
4
4
|
r as BaseError,
|