@d-id/client-sdk 1.1.35-staging.171 → 1.1.36
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.
- package/dist/index.js +491 -493
- package/dist/index.umd.cjs +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Ze = Object.defineProperty;
|
|
2
2
|
var et = (e, t, i) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
-
var
|
|
4
|
-
class
|
|
3
|
+
var me = (e, t, i) => et(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
class Ce extends Error {
|
|
5
5
|
constructor({ kind: i, description: n, error: s }) {
|
|
6
6
|
super(JSON.stringify({ kind: i, description: n }));
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
me(this, "kind");
|
|
8
|
+
me(this, "description");
|
|
9
|
+
me(this, "error");
|
|
10
10
|
this.kind = i, this.description = n, this.error = s;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
class tt extends
|
|
13
|
+
class tt extends Ce {
|
|
14
14
|
constructor(t, i) {
|
|
15
15
|
super({
|
|
16
16
|
kind: "ChatCreationFailed",
|
|
@@ -18,24 +18,24 @@ class tt extends Se {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class nt extends
|
|
21
|
+
class nt extends Ce {
|
|
22
22
|
constructor(t) {
|
|
23
23
|
super({ kind: "ChatModeDowngraded", description: `Chat mode downgraded to ${t}` });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class ue extends Ce {
|
|
27
27
|
constructor(i, n) {
|
|
28
28
|
super({ kind: "ValidationError", description: i });
|
|
29
|
-
|
|
29
|
+
me(this, "key");
|
|
30
30
|
this.key = n;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class rt extends
|
|
33
|
+
class rt extends Ce {
|
|
34
34
|
constructor(t) {
|
|
35
35
|
super({ kind: "WSError", description: t });
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
var it = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(it || {}), at = /* @__PURE__ */ ((e) => (e.TRIAL = "deid-trial", e.PRO = "deid-pro", e.ENTERPRISE = "deid-enterprise", e.LITE = "deid-lite", e.ADVANCED = "deid-advanced", e.BUILD = "deid-api-build", e.LAUNCH = "deid-api-launch", e.SCALE = "deid-api-scale", e))(at || {}), ot = /* @__PURE__ */ ((e) => (e.Created = "created", e.Started = "started", e.Done = "done", e.Error = "error", e.Rejected = "rejected", e.Ready = "ready", e))(ot || {}), st = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(st || {}), B = /* @__PURE__ */ ((e) => (e.Functional = "Functional", e.TextOnly = "TextOnly", e.Maintenance = "Maintenance", e.Playground = "Playground", e.DirectPlayback = "DirectPlayback", e.Off = "Off", e))(B || {}),
|
|
38
|
+
var it = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(it || {}), at = /* @__PURE__ */ ((e) => (e.TRIAL = "deid-trial", e.PRO = "deid-pro", e.ENTERPRISE = "deid-enterprise", e.LITE = "deid-lite", e.ADVANCED = "deid-advanced", e.BUILD = "deid-api-build", e.LAUNCH = "deid-api-launch", e.SCALE = "deid-api-scale", e))(at || {}), ot = /* @__PURE__ */ ((e) => (e.Created = "created", e.Started = "started", e.Done = "done", e.Error = "error", e.Rejected = "rejected", e.Ready = "ready", e))(ot || {}), st = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(st || {}), B = /* @__PURE__ */ ((e) => (e.Functional = "Functional", e.TextOnly = "TextOnly", e.Maintenance = "Maintenance", e.Playground = "Playground", e.DirectPlayback = "DirectPlayback", e.Off = "Off", e))(B || {}), Z = /* @__PURE__ */ ((e) => (e.Embed = "embed", e.Query = "query", e.Partial = "partial", e.Answer = "answer", e.Transcribe = "transcribe", e.Complete = "done", e))(Z || {}), ct = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(ct || {}), dt = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(dt || {}), ut = /* @__PURE__ */ ((e) => (e.Pdf = "pdf", e.Text = "text", e.Html = "html", e.Word = "word", e.Json = "json", e.Markdown = "markdown", e.Csv = "csv", e.Excel = "excel", e.Powerpoint = "powerpoint", e.Archive = "archive", e.Image = "image", e.Audio = "audio", e.Video = "video", e))(ut || {}), Ve = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e.Expressive = "expressive", e))(Ve || {});
|
|
39
39
|
const pn = (e) => {
|
|
40
40
|
switch (e) {
|
|
41
41
|
case "clip":
|
|
@@ -48,9 +48,9 @@ const pn = (e) => {
|
|
|
48
48
|
throw new Error(`Unknown video type: ${e}`);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
var
|
|
52
|
-
const
|
|
53
|
-
}, We = (e) => new Promise((t) => setTimeout(t, e)),
|
|
51
|
+
var D = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(D || {}), re = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(re || {}), H = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e))(H || {}), b = /* @__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))(b || {}), M = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnected = "disconnected", e))(M || {}), ie = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(ie || {}), Se = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(Se || {}), lt = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(lt || {}), ft = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(ft || {});
|
|
52
|
+
const mt = 45 * 1e3, gt = "X-Playground-Chat", he = "https://api.d-id.com", ht = "wss://notifications.d-id.com", pt = "79f81a83a67430be2bc0fd61042b8faa", wt = (...e) => {
|
|
53
|
+
}, We = (e) => new Promise((t) => setTimeout(t, e)), le = (e = 16) => {
|
|
54
54
|
const t = new Uint8Array(e);
|
|
55
55
|
return window.crypto.getRandomValues(t), Array.from(t, (i) => i.toString(16).padStart(2, "0")).join("").slice(0, 13);
|
|
56
56
|
}, Oe = (e) => e.type === "clip" && e.presenter_id.startsWith("v2_") ? "clip_v2" : e.type, Pe = (e) => e === Ve.Expressive, yt = (e) => [B.TextOnly, B.Playground, B.Maintenance].includes(e), He = (e) => e && [B.DirectPlayback, B.Off].includes(e);
|
|
@@ -63,7 +63,7 @@ function vt(e, t) {
|
|
|
63
63
|
clear: () => clearTimeout(i)
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function Me(e, t) {
|
|
67
67
|
const i = {
|
|
68
68
|
limit: (t == null ? void 0 : t.limit) ?? 3,
|
|
69
69
|
delayMs: (t == null ? void 0 : t.delayMs) ?? 0,
|
|
@@ -92,12 +92,12 @@ function Ie(e) {
|
|
|
92
92
|
return window.localStorage.setItem("did_external_key_id", e), e;
|
|
93
93
|
let t = window.localStorage.getItem("did_external_key_id");
|
|
94
94
|
if (!t) {
|
|
95
|
-
let i =
|
|
95
|
+
let i = le();
|
|
96
96
|
window.localStorage.setItem("did_external_key_id", i), t = i;
|
|
97
97
|
}
|
|
98
98
|
return t;
|
|
99
99
|
}
|
|
100
|
-
let Ct =
|
|
100
|
+
let Ct = le();
|
|
101
101
|
function qe(e, t) {
|
|
102
102
|
if (e.type === "bearer")
|
|
103
103
|
return `Bearer ${e.token}`;
|
|
@@ -107,13 +107,13 @@ function qe(e, t) {
|
|
|
107
107
|
return `Client-Key ${e.clientKey}.${Ie(t)}_${Ct}`;
|
|
108
108
|
throw new Error(`Unknown auth type: ${e}`);
|
|
109
109
|
}
|
|
110
|
-
const St = (e) =>
|
|
110
|
+
const St = (e) => Me(e, {
|
|
111
111
|
limit: 3,
|
|
112
112
|
delayMs: 1e3,
|
|
113
113
|
timeout: 0,
|
|
114
114
|
shouldRetryFn: (t) => t.status === 429
|
|
115
115
|
});
|
|
116
|
-
function Le(e, t =
|
|
116
|
+
function Le(e, t = he, i, n) {
|
|
117
117
|
const s = async (o, c) => {
|
|
118
118
|
const { skipErrorHandler: a, ...r } = c || {}, d = await St(
|
|
119
119
|
() => fetch(t + (o != null && o.startsWith("/") ? o : `/${o}`), {
|
|
@@ -147,7 +147,7 @@ function Le(e, t = pe, i, n) {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function kt(e, t =
|
|
150
|
+
function kt(e, t = he, i, n) {
|
|
151
151
|
const s = Le(e, `${t}/agents`, i, n);
|
|
152
152
|
return {
|
|
153
153
|
create(o, c) {
|
|
@@ -226,8 +226,8 @@ function Dt(e) {
|
|
|
226
226
|
...e.access === "public" ? { from: "agent-template" } : {}
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
const
|
|
230
|
-
function
|
|
229
|
+
const Et = (e) => e.reduce((t, i) => t + i, 0), xe = (e) => Et(e) / e.length;
|
|
230
|
+
function Mt(e, t, i) {
|
|
231
231
|
var r, d, h;
|
|
232
232
|
const { event: n, ...s } = e, { template: o } = (t == null ? void 0 : t.llm) || {}, { language: c } = ((r = t == null ? void 0 : t.presenter) == null ? void 0 : r.voice) || {};
|
|
233
233
|
return {
|
|
@@ -254,7 +254,7 @@ function Tt(e) {
|
|
|
254
254
|
...e.mixpanelAdditionalProperties || {}
|
|
255
255
|
},
|
|
256
256
|
isEnabled: e.isEnabled ?? !0,
|
|
257
|
-
getRandom:
|
|
257
|
+
getRandom: le,
|
|
258
258
|
enrich(i) {
|
|
259
259
|
this.additionalProperties = { ...this.additionalProperties, ...i };
|
|
260
260
|
},
|
|
@@ -480,7 +480,7 @@ function Ke(e, t, i) {
|
|
|
480
480
|
resolution: `${e[0].frameWidth}x${e[0].frameHeight}`
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
|
-
const
|
|
483
|
+
const ve = 100, $t = Math.max(Math.ceil(400 / ve), 1), Bt = 0.25, xt = 0.28;
|
|
484
484
|
function Ft() {
|
|
485
485
|
let e = 0, t, i, n = 0;
|
|
486
486
|
return (s) => {
|
|
@@ -499,31 +499,31 @@ function Ft() {
|
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
501
|
function Ge(e, t, i, n, s) {
|
|
502
|
-
let o = null, c = [], a, r = 0, d = !1, h = re.Unknown, w = re.Unknown, u = 0,
|
|
502
|
+
let o = null, c = [], a, r = 0, d = !1, h = re.Unknown, w = re.Unknown, u = 0, C = 0;
|
|
503
503
|
const x = Ft();
|
|
504
|
-
async function
|
|
505
|
-
const
|
|
506
|
-
if (!
|
|
504
|
+
async function j() {
|
|
505
|
+
const S = await e();
|
|
506
|
+
if (!S)
|
|
507
507
|
return;
|
|
508
|
-
const { isReceiving: R, avgJitterDelayInInterval: F, freezeCount:
|
|
508
|
+
const { isReceiving: R, avgJitterDelayInInterval: F, freezeCount: k } = x(S), q = jt(S);
|
|
509
509
|
if (R)
|
|
510
|
-
r = 0, u =
|
|
510
|
+
r = 0, u = k - C, w = F < Bt ? re.Strong : F > xt && u > 1 ? re.Weak : h, w !== h && (s == null || s(w), h = w, C += u, u = 0), d || (n == null || n(D.Start), a = c[c.length - 1], c = [], d = !0), c.push(q);
|
|
511
511
|
else if (d && (r++, r >= $t)) {
|
|
512
|
-
const
|
|
513
|
-
n == null || n(
|
|
512
|
+
const N = Ke(c, ve, a);
|
|
513
|
+
n == null || n(D.Stop, N), t() || i(), C = k, d = !1;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
return {
|
|
517
517
|
start: () => {
|
|
518
|
-
o || (o = setInterval(
|
|
518
|
+
o || (o = setInterval(j, ve));
|
|
519
519
|
},
|
|
520
520
|
stop: () => {
|
|
521
521
|
o && (clearInterval(o), o = null);
|
|
522
522
|
},
|
|
523
|
-
getReport: () => Ke(c,
|
|
523
|
+
getReport: () => Ke(c, ve, a)
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
async function
|
|
526
|
+
async function Ee() {
|
|
527
527
|
try {
|
|
528
528
|
return await import("./livekit-client.esm-C1GRQdZY.js");
|
|
529
529
|
} catch {
|
|
@@ -538,300 +538,300 @@ const zt = {
|
|
|
538
538
|
poor: re.Weak,
|
|
539
539
|
lost: re.Unknown,
|
|
540
540
|
unknown: re.Unknown
|
|
541
|
-
},
|
|
541
|
+
}, ge = JSON.stringify({
|
|
542
542
|
kind: "InternalServerError",
|
|
543
543
|
description: "Stream Error"
|
|
544
544
|
});
|
|
545
545
|
var je = /* @__PURE__ */ ((e) => (e.Chat = "lk.chat", e.Speak = "did.speak", e.Interrupt = "did.interrupt", e))(je || {});
|
|
546
546
|
function _e(e, t, i) {
|
|
547
547
|
var n, s;
|
|
548
|
-
throw t("Failed to connect to LiveKit room:", e), (n = i.onConnectionStateChange) == null || n.call(i,
|
|
548
|
+
throw t("Failed to connect to LiveKit room:", e), (n = i.onConnectionStateChange) == null || n.call(i, M.Fail), (s = i.onError) == null || s.call(i, e, { sessionId: "" }), e;
|
|
549
549
|
}
|
|
550
550
|
async function Kt(e, t, i) {
|
|
551
551
|
var $e;
|
|
552
|
-
const n = Ye(i.debug || !1, "LiveKitStreamingManager"), { Room: s, RoomEvent: o, ConnectionState: c } = await
|
|
553
|
-
let u = null,
|
|
552
|
+
const n = Ye(i.debug || !1, "LiveKitStreamingManager"), { Room: s, RoomEvent: o, ConnectionState: c } = await Ee(), { callbacks: a, auth: r, baseURL: d, analytics: h, microphoneStream: w } = i;
|
|
553
|
+
let u = null, C = !1;
|
|
554
554
|
const x = ie.Fluent;
|
|
555
|
-
let
|
|
555
|
+
let j = null, S = null, R = null, F = !1;
|
|
556
556
|
u = new s({
|
|
557
557
|
adaptiveStream: !1,
|
|
558
558
|
// Must be false to use mediaStreamTrack directly
|
|
559
559
|
dynacast: !0
|
|
560
560
|
});
|
|
561
|
-
let
|
|
562
|
-
const
|
|
563
|
-
let
|
|
564
|
-
const
|
|
565
|
-
let z,
|
|
561
|
+
let k = null;
|
|
562
|
+
const q = 2e4;
|
|
563
|
+
let N = H.Idle;
|
|
564
|
+
const Q = Pt(r, d || he, e, a.onError);
|
|
565
|
+
let z, te, f;
|
|
566
566
|
try {
|
|
567
|
-
const
|
|
568
|
-
transport_provider:
|
|
567
|
+
const l = await Q.createStream({
|
|
568
|
+
transport_provider: Se.Livekit,
|
|
569
569
|
chat_persist: t.chat_persist ?? !0
|
|
570
|
-
}), { id: g, session_token:
|
|
571
|
-
($e = a.onStreamCreated) == null || $e.call(a, { session_id: g, stream_id: g, agent_id: e }), z = g,
|
|
572
|
-
} catch (
|
|
573
|
-
_e(
|
|
570
|
+
}), { id: g, session_token: v, session_url: I } = l;
|
|
571
|
+
($e = a.onStreamCreated) == null || $e.call(a, { session_id: g, stream_id: g, agent_id: e }), z = g, te = v, f = I, await u.prepareConnection(f, te);
|
|
572
|
+
} catch (l) {
|
|
573
|
+
_e(l, n, a);
|
|
574
574
|
}
|
|
575
|
-
if (!
|
|
575
|
+
if (!f || !te || !z)
|
|
576
576
|
return Promise.reject(new Error("Failed to initialize LiveKit stream"));
|
|
577
|
-
u.on(o.ConnectionStateChanged,
|
|
578
|
-
function l
|
|
579
|
-
var
|
|
580
|
-
g != null && g.isLocal && (ne.update(),
|
|
577
|
+
u.on(o.ConnectionStateChanged, E).on(o.ConnectionQualityChanged, A).on(o.ActiveSpeakersChanged, P).on(o.ParticipantConnected, T).on(o.ParticipantDisconnected, J).on(o.TrackSubscribed, O).on(o.TrackUnsubscribed, X).on(o.DataReceived, L).on(o.MediaDevicesError, K).on(o.TranscriptionReceived, y).on(o.EncryptionError, Y).on(o.TrackSubscriptionFailed, oe);
|
|
578
|
+
function y(l, g) {
|
|
579
|
+
var v;
|
|
580
|
+
g != null && g.isLocal && (ne.update(), N === H.Talking && ((v = a.onInterruptDetected) == null || v.call(a, { type: "audio" }), N = H.Idle));
|
|
581
581
|
}
|
|
582
582
|
try {
|
|
583
|
-
await u.connect(
|
|
584
|
-
var
|
|
585
|
-
n("Track subscription timeout - no track subscribed within 30 seconds after connect"),
|
|
583
|
+
await u.connect(f, te), n("LiveKit room joined successfully"), k = setTimeout(() => {
|
|
584
|
+
var l;
|
|
585
|
+
n("Track subscription timeout - no track subscribed within 30 seconds after connect"), k = null, h.track("connectivity-error", {
|
|
586
586
|
error: "Track subscription timeout",
|
|
587
587
|
sessionId: z
|
|
588
|
-
}), (
|
|
589
|
-
},
|
|
590
|
-
} catch (
|
|
591
|
-
_e(
|
|
588
|
+
}), (l = a.onError) == null || l.call(a, new Error("Track subscription timeout"), { sessionId: z }), ke();
|
|
589
|
+
}, q);
|
|
590
|
+
} catch (l) {
|
|
591
|
+
_e(l, n, a);
|
|
592
592
|
}
|
|
593
593
|
h.enrich({
|
|
594
594
|
"stream-type": x
|
|
595
595
|
});
|
|
596
|
-
function
|
|
597
|
-
var g,
|
|
598
|
-
switch (n("Connection state changed:",
|
|
596
|
+
function E(l) {
|
|
597
|
+
var g, v, I, _;
|
|
598
|
+
switch (n("Connection state changed:", l), l) {
|
|
599
599
|
case c.Connecting:
|
|
600
|
-
n("CALLBACK: onConnectionStateChange(Connecting)"), (g = a.onConnectionStateChange) == null || g.call(a,
|
|
600
|
+
n("CALLBACK: onConnectionStateChange(Connecting)"), (g = a.onConnectionStateChange) == null || g.call(a, M.Connecting);
|
|
601
601
|
break;
|
|
602
602
|
case c.Connected:
|
|
603
|
-
n("LiveKit room connected successfully"),
|
|
603
|
+
n("LiveKit room connected successfully"), C = !0;
|
|
604
604
|
break;
|
|
605
605
|
case c.Disconnected:
|
|
606
|
-
n("LiveKit room disconnected"),
|
|
606
|
+
n("LiveKit room disconnected"), C = !1, F = !1, (v = a.onConnectionStateChange) == null || v.call(a, M.Disconnected);
|
|
607
607
|
break;
|
|
608
608
|
case c.Reconnecting:
|
|
609
|
-
n("LiveKit room reconnecting..."), (
|
|
609
|
+
n("LiveKit room reconnecting..."), (I = a.onConnectionStateChange) == null || I.call(a, M.Connecting);
|
|
610
610
|
break;
|
|
611
611
|
case c.SignalReconnecting:
|
|
612
|
-
n("LiveKit room signal reconnecting..."), (
|
|
612
|
+
n("LiveKit room signal reconnecting..."), (_ = a.onConnectionStateChange) == null || _.call(a, M.Connecting);
|
|
613
613
|
break;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
618
|
-
n("Connection quality:",
|
|
616
|
+
function A(l, g) {
|
|
617
|
+
var v;
|
|
618
|
+
n("Connection quality:", l), g != null && g.isLocal && ((v = a.onConnectivityStateChange) == null || v.call(a, zt[l]));
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
n("Active speakers changed:",
|
|
620
|
+
function P(l) {
|
|
621
|
+
n("Active speakers changed:", l);
|
|
622
622
|
}
|
|
623
|
-
function
|
|
624
|
-
n("Participant connected:",
|
|
623
|
+
function T(l) {
|
|
624
|
+
n("Participant connected:", l.identity);
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
n("Participant disconnected:",
|
|
626
|
+
function J(l) {
|
|
627
|
+
n("Participant disconnected:", l.identity), ke();
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
var
|
|
631
|
-
n(`Track subscribed: ${
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
n(`No mediaStreamTrack available for ${
|
|
629
|
+
function O(l, g, v) {
|
|
630
|
+
var _, G, ee, se;
|
|
631
|
+
n(`Track subscribed: ${l.kind} from ${v.identity}`), k && (clearTimeout(k), k = null, n("Track subscription timeout cleared"));
|
|
632
|
+
const I = l.mediaStreamTrack;
|
|
633
|
+
if (!I) {
|
|
634
|
+
n(`No mediaStreamTrack available for ${l.kind}`);
|
|
635
635
|
return;
|
|
636
636
|
}
|
|
637
|
-
|
|
638
|
-
() =>
|
|
639
|
-
() =>
|
|
637
|
+
j ? (j.addTrack(I), n(`Added ${l.kind} track to shared MediaStream`)) : (j = new MediaStream([I]), n(`Created shared MediaStream with ${l.kind} track`)), l.kind === "video" && ((_ = a.onStreamReady) == null || _.call(a), n("CALLBACK: onSrcObjectReady"), (G = a.onSrcObjectReady) == null || G.call(a, j), F || (F = !0, n("CALLBACK: onConnectionStateChange(Connected)"), (ee = a.onConnectionStateChange) == null || ee.call(a, M.Connected)), n("CALLBACK: onVideoStateChange(Start)"), (se = a.onVideoStateChange) == null || se.call(a, D.Start), R = Ge(
|
|
638
|
+
() => l.getRTCStatsReport(),
|
|
639
|
+
() => C,
|
|
640
640
|
wt,
|
|
641
|
-
(
|
|
642
|
-
n(`Video state change: ${
|
|
641
|
+
(ye, Re) => {
|
|
642
|
+
n(`Video state change: ${ye}`);
|
|
643
643
|
}
|
|
644
644
|
), R.start());
|
|
645
645
|
}
|
|
646
|
-
function
|
|
647
|
-
var
|
|
648
|
-
if (n(`Track unsubscribed: ${
|
|
649
|
-
const
|
|
650
|
-
R == null || R.stop(), R = null, (
|
|
646
|
+
function X(l, g, v) {
|
|
647
|
+
var I;
|
|
648
|
+
if (n(`Track unsubscribed: ${l.kind} from ${v.identity}`), l.kind === "video") {
|
|
649
|
+
const _ = R == null ? void 0 : R.getReport();
|
|
650
|
+
R == null || R.stop(), R = null, (I = a.onVideoStateChange) == null || I.call(a, D.Stop, _);
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
var
|
|
655
|
-
const
|
|
656
|
-
n("Data received:",
|
|
653
|
+
function L(l, g, v, I) {
|
|
654
|
+
var G, ee, se, ye, Re, Be;
|
|
655
|
+
const _ = new TextDecoder().decode(l);
|
|
656
|
+
n("Data received:", _);
|
|
657
657
|
try {
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
const ae =
|
|
661
|
-
(
|
|
658
|
+
const W = JSON.parse(_), de = I || W.subject;
|
|
659
|
+
if (de === b.ChatAnswer) {
|
|
660
|
+
const ae = Z.Answer;
|
|
661
|
+
(G = a.onMessage) == null || G.call(a, ae, {
|
|
662
662
|
event: ae,
|
|
663
|
-
...
|
|
663
|
+
...W
|
|
664
664
|
});
|
|
665
|
-
} else if (
|
|
666
|
-
const ae =
|
|
667
|
-
(
|
|
665
|
+
} else if (de === b.ChatPartial) {
|
|
666
|
+
const ae = Z.Partial;
|
|
667
|
+
(ee = a.onMessage) == null || ee.call(a, ae, {
|
|
668
668
|
event: ae,
|
|
669
|
-
...
|
|
669
|
+
...W
|
|
670
670
|
});
|
|
671
|
-
} else if ([
|
|
672
|
-
|
|
673
|
-
const fe = { [(
|
|
674
|
-
i.debug && ((
|
|
675
|
-
id:
|
|
676
|
-
name:
|
|
677
|
-
}), (Re = a.onMessage) == null || Re.call(a,
|
|
678
|
-
} else if (
|
|
679
|
-
const ae =
|
|
671
|
+
} else if ([b.StreamVideoCreated, b.StreamVideoDone].includes(de)) {
|
|
672
|
+
N = de === b.StreamVideoCreated ? H.Talking : H.Idle, (se = a.onAgentActivityStateChange) == null || se.call(a, N);
|
|
673
|
+
const fe = { [(W == null ? void 0 : W.role) || (g == null ? void 0 : g.identity) || "datachannel"]: W };
|
|
674
|
+
i.debug && ((ye = W == null ? void 0 : W.metadata) != null && ye.sentiment) && (fe.sentiment = {
|
|
675
|
+
id: W.metadata.sentiment.id,
|
|
676
|
+
name: W.metadata.sentiment.sentiment
|
|
677
|
+
}), (Re = a.onMessage) == null || Re.call(a, de, fe);
|
|
678
|
+
} else if (de === b.ChatAudioTranscribed) {
|
|
679
|
+
const ae = Z.Transcribe;
|
|
680
680
|
(Be = a.onMessage) == null || Be.call(a, ae, {
|
|
681
681
|
event: ae,
|
|
682
|
-
...
|
|
682
|
+
...W
|
|
683
683
|
}), queueMicrotask(() => {
|
|
684
684
|
var fe;
|
|
685
|
-
(fe = a.onAgentActivityStateChange) == null || fe.call(a,
|
|
685
|
+
(fe = a.onAgentActivityStateChange) == null || fe.call(a, H.Loading);
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
|
-
} catch (
|
|
689
|
-
n("Failed to parse data channel message:",
|
|
688
|
+
} catch (W) {
|
|
689
|
+
n("Failed to parse data channel message:", W);
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function K(l) {
|
|
693
693
|
var g;
|
|
694
|
-
n("Media devices error:",
|
|
694
|
+
n("Media devices error:", l), (g = a.onError) == null || g.call(a, new Error(ge), { sessionId: z });
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function Y(l) {
|
|
697
697
|
var g;
|
|
698
|
-
n("Encryption error:",
|
|
698
|
+
n("Encryption error:", l), (g = a.onError) == null || g.call(a, new Error(ge), { sessionId: z });
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
n("Track subscription failed:", { trackSid:
|
|
700
|
+
function oe(l, g, v) {
|
|
701
|
+
n("Track subscription failed:", { trackSid: l, participant: g, reason: v });
|
|
702
702
|
}
|
|
703
|
-
async function
|
|
703
|
+
async function U(l) {
|
|
704
704
|
if (!u) return null;
|
|
705
|
-
const { Track: g } = await
|
|
706
|
-
if (
|
|
707
|
-
for (const [
|
|
708
|
-
if (
|
|
709
|
-
const
|
|
710
|
-
if (
|
|
711
|
-
return
|
|
705
|
+
const { Track: g } = await Ee(), v = u.localParticipant.audioTrackPublications;
|
|
706
|
+
if (v) {
|
|
707
|
+
for (const [I, _] of v)
|
|
708
|
+
if (_.source === g.Source.Microphone && _.track) {
|
|
709
|
+
const ee = _.track.mediaStreamTrack;
|
|
710
|
+
if (ee === l || ee && ee.id === l.id)
|
|
711
|
+
return _;
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
return null;
|
|
715
715
|
}
|
|
716
|
-
function
|
|
717
|
-
if (!
|
|
716
|
+
function m(l) {
|
|
717
|
+
if (!S || !S.track)
|
|
718
718
|
return !1;
|
|
719
|
-
const g =
|
|
720
|
-
return g !==
|
|
719
|
+
const g = S.track.mediaStreamTrack;
|
|
720
|
+
return g !== l && (g == null ? void 0 : g.id) !== l.id;
|
|
721
721
|
}
|
|
722
|
-
async function
|
|
723
|
-
var
|
|
724
|
-
if (!
|
|
722
|
+
async function p(l) {
|
|
723
|
+
var G, ee;
|
|
724
|
+
if (!C || !u)
|
|
725
725
|
throw n("Room is not connected, cannot publish microphone stream"), new Error("Room is not connected");
|
|
726
|
-
const g =
|
|
726
|
+
const g = l.getAudioTracks();
|
|
727
727
|
if (g.length === 0) {
|
|
728
728
|
n("No audio track found in the provided MediaStream");
|
|
729
729
|
return;
|
|
730
730
|
}
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
731
|
+
const v = g[0], { Track: I } = await Ee(), _ = await U(v);
|
|
732
|
+
if (_) {
|
|
733
733
|
n("Microphone track is already published, skipping", {
|
|
734
|
-
trackId:
|
|
735
|
-
publishedTrackId: (
|
|
736
|
-
}),
|
|
734
|
+
trackId: v.id,
|
|
735
|
+
publishedTrackId: (ee = (G = _.track) == null ? void 0 : G.mediaStreamTrack) == null ? void 0 : ee.id
|
|
736
|
+
}), S = _;
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
739
|
-
|
|
739
|
+
m(v) && (n("Unpublishing existing microphone track before publishing new one"), await $()), n("Publishing microphone track from provided MediaStream", { trackId: v.id });
|
|
740
740
|
try {
|
|
741
|
-
|
|
742
|
-
source:
|
|
743
|
-
}), n("Microphone track published successfully", { trackSid:
|
|
744
|
-
} catch (
|
|
745
|
-
throw n("Failed to publish microphone track:",
|
|
741
|
+
S = await u.localParticipant.publishTrack(v, {
|
|
742
|
+
source: I.Source.Microphone
|
|
743
|
+
}), n("Microphone track published successfully", { trackSid: S.trackSid });
|
|
744
|
+
} catch (se) {
|
|
745
|
+
throw n("Failed to publish microphone track:", se), se;
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
async function
|
|
749
|
-
if (!(!
|
|
748
|
+
async function $() {
|
|
749
|
+
if (!(!S || !S.track))
|
|
750
750
|
try {
|
|
751
|
-
u && (await u.localParticipant.unpublishTrack(
|
|
752
|
-
} catch (
|
|
753
|
-
n("Error unpublishing microphone track:",
|
|
751
|
+
u && (await u.localParticipant.unpublishTrack(S.track), n("Microphone track unpublished"));
|
|
752
|
+
} catch (l) {
|
|
753
|
+
n("Error unpublishing microphone track:", l);
|
|
754
754
|
} finally {
|
|
755
|
-
|
|
755
|
+
S = null;
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
|
|
758
|
+
function V() {
|
|
759
|
+
j && (j.getTracks().forEach((l) => l.stop()), j = null);
|
|
760
760
|
}
|
|
761
|
-
async function
|
|
762
|
-
var
|
|
763
|
-
if (!
|
|
764
|
-
n("Room is not connected for sending messages"), (
|
|
761
|
+
async function ce(l, g) {
|
|
762
|
+
var v, I;
|
|
763
|
+
if (!C || !u) {
|
|
764
|
+
n("Room is not connected for sending messages"), (v = a.onError) == null || v.call(a, new Error(ge), {
|
|
765
765
|
sessionId: z
|
|
766
766
|
});
|
|
767
767
|
return;
|
|
768
768
|
}
|
|
769
769
|
try {
|
|
770
|
-
await u.localParticipant.sendText(
|
|
771
|
-
} catch (
|
|
772
|
-
n("Failed to send message:",
|
|
770
|
+
await u.localParticipant.sendText(l, { topic: g }), n("Message sent successfully:", l);
|
|
771
|
+
} catch (_) {
|
|
772
|
+
n("Failed to send message:", _), (I = a.onError) == null || I.call(a, new Error(ge), { sessionId: z });
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
async function
|
|
775
|
+
async function pe(l) {
|
|
776
776
|
var g;
|
|
777
777
|
try {
|
|
778
|
-
const
|
|
779
|
-
return
|
|
780
|
-
} catch (
|
|
781
|
-
n("Failed to send data channel message:",
|
|
778
|
+
const I = JSON.parse(l).topic;
|
|
779
|
+
return ce("", I);
|
|
780
|
+
} catch (v) {
|
|
781
|
+
n("Failed to send data channel message:", v), (g = a.onError) == null || g.call(a, new Error(ge), { sessionId: z });
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
return
|
|
786
|
-
|
|
784
|
+
function we(l) {
|
|
785
|
+
return ce(
|
|
786
|
+
l,
|
|
787
787
|
"lk.chat"
|
|
788
788
|
/* Chat */
|
|
789
789
|
);
|
|
790
790
|
}
|
|
791
|
-
async function
|
|
792
|
-
var
|
|
793
|
-
|
|
791
|
+
async function ke() {
|
|
792
|
+
var l, g;
|
|
793
|
+
k && (clearTimeout(k), k = null), u && (await $(), await u.disconnect()), V(), C = !1, F = !1, (l = a.onConnectionStateChange) == null || l.call(a, M.Disconnected), (g = a.onAgentActivityStateChange) == null || g.call(a, H.Idle), N = H.Idle;
|
|
794
794
|
}
|
|
795
795
|
return {
|
|
796
|
-
speak(
|
|
797
|
-
const g = typeof
|
|
798
|
-
return
|
|
796
|
+
speak(l) {
|
|
797
|
+
const g = typeof l == "string" ? l : JSON.stringify(l);
|
|
798
|
+
return ce(
|
|
799
799
|
g,
|
|
800
800
|
"did.speak"
|
|
801
801
|
/* Speak */
|
|
802
802
|
);
|
|
803
803
|
},
|
|
804
|
-
disconnect:
|
|
804
|
+
disconnect: ke,
|
|
805
805
|
async reconnect() {
|
|
806
|
-
var
|
|
806
|
+
var l, g;
|
|
807
807
|
if ((u == null ? void 0 : u.state) === c.Connected) {
|
|
808
808
|
n("Room is already connected");
|
|
809
809
|
return;
|
|
810
810
|
}
|
|
811
|
-
if (!u || !
|
|
811
|
+
if (!u || !f || !te)
|
|
812
812
|
throw n("Cannot reconnect: missing room, URL or token"), new Error("Cannot reconnect: session not available");
|
|
813
|
-
n("Reconnecting to LiveKit room, state:", u.state), F = !1, (
|
|
813
|
+
n("Reconnecting to LiveKit room, state:", u.state), F = !1, (l = a.onConnectionStateChange) == null || l.call(a, M.Connecting);
|
|
814
814
|
try {
|
|
815
|
-
if (await u.connect(
|
|
816
|
-
if (n("Waiting for agent to join..."), !await new Promise((
|
|
817
|
-
const
|
|
818
|
-
u == null || u.off(o.ParticipantConnected,
|
|
819
|
-
}, 5e3),
|
|
820
|
-
clearTimeout(
|
|
815
|
+
if (await u.connect(f, te), n("Room reconnected"), C = !0, u.remoteParticipants.size === 0) {
|
|
816
|
+
if (n("Waiting for agent to join..."), !await new Promise((I) => {
|
|
817
|
+
const _ = setTimeout(() => {
|
|
818
|
+
u == null || u.off(o.ParticipantConnected, G), I(!1);
|
|
819
|
+
}, 5e3), G = () => {
|
|
820
|
+
clearTimeout(_), u == null || u.off(o.ParticipantConnected, G), I(!0);
|
|
821
821
|
};
|
|
822
|
-
u == null || u.on(o.ParticipantConnected,
|
|
822
|
+
u == null || u.on(o.ParticipantConnected, G);
|
|
823
823
|
}))
|
|
824
824
|
throw n("Agent did not join within timeout"), await u.disconnect(), new Error("Agent did not rejoin the room");
|
|
825
825
|
n("Agent joined");
|
|
826
826
|
}
|
|
827
|
-
} catch (
|
|
828
|
-
throw n("Failed to reconnect:",
|
|
827
|
+
} catch (v) {
|
|
828
|
+
throw n("Failed to reconnect:", v), (g = a.onConnectionStateChange) == null || g.call(a, M.Fail), v;
|
|
829
829
|
}
|
|
830
830
|
},
|
|
831
|
-
sendDataChannelMessage:
|
|
832
|
-
sendTextMessage:
|
|
833
|
-
publishMicrophoneStream:
|
|
834
|
-
unpublishMicrophoneStream:
|
|
831
|
+
sendDataChannelMessage: pe,
|
|
832
|
+
sendTextMessage: we,
|
|
833
|
+
publishMicrophoneStream: p,
|
|
834
|
+
unpublishMicrophoneStream: $,
|
|
835
835
|
sessionId: z,
|
|
836
836
|
streamId: z,
|
|
837
837
|
streamType: x,
|
|
@@ -857,7 +857,7 @@ function Jt(e, t, i) {
|
|
|
857
857
|
}
|
|
858
858
|
async function Ut(e, t) {
|
|
859
859
|
const i = {
|
|
860
|
-
type:
|
|
860
|
+
type: b.StreamInterrupt,
|
|
861
861
|
videoId: t,
|
|
862
862
|
timestamp: Date.now()
|
|
863
863
|
};
|
|
@@ -937,16 +937,16 @@ function Qt(e, t, i) {
|
|
|
937
937
|
t.messages.push(s), i == null || i([...t.messages], "user");
|
|
938
938
|
}
|
|
939
939
|
function Xt(e, t, i, n, s) {
|
|
940
|
-
if (e ===
|
|
940
|
+
if (e === Z.Transcribe && t.content) {
|
|
941
941
|
Qt(t, n, s);
|
|
942
942
|
return;
|
|
943
943
|
}
|
|
944
|
-
if (!(e ===
|
|
944
|
+
if (!(e === Z.Partial || e === Z.Answer))
|
|
945
945
|
return;
|
|
946
946
|
const o = n.messages[n.messages.length - 1];
|
|
947
947
|
let c;
|
|
948
948
|
if (o != null && o.transcribed && o.role === "user")
|
|
949
|
-
e ===
|
|
949
|
+
e === Z.Answer && t.content, c = {
|
|
950
950
|
id: t.id || `assistant-${Date.now()}`,
|
|
951
951
|
role: t.role || "assistant",
|
|
952
952
|
content: t.content || "",
|
|
@@ -957,9 +957,9 @@ function Xt(e, t, i, n, s) {
|
|
|
957
957
|
else
|
|
958
958
|
return;
|
|
959
959
|
const { content: a, sequence: r } = t;
|
|
960
|
-
e ===
|
|
960
|
+
e === Z.Partial ? i[r] = a : i.answer = a;
|
|
961
961
|
const d = qt(i);
|
|
962
|
-
(c.content !== d || e ===
|
|
962
|
+
(c.content !== d || e === Z.Answer) && (c.content = d, s == null || s([...n.messages], e));
|
|
963
963
|
}
|
|
964
964
|
function Yt(e, t, i, n, s) {
|
|
965
965
|
let o = {};
|
|
@@ -974,14 +974,14 @@ function Yt(e, t, i, n, s) {
|
|
|
974
974
|
onMessage: (d, h) => {
|
|
975
975
|
var w, u;
|
|
976
976
|
if ("content" in h) {
|
|
977
|
-
const
|
|
978
|
-
Xt(
|
|
977
|
+
const C = d === b.ChatAnswer ? Z.Answer : d === b.ChatAudioTranscribed ? Z.Transcribe : d;
|
|
978
|
+
Xt(C, h, o, t, r), C === Z.Answer && e.track("agent-message-received", {
|
|
979
979
|
messages: t.messages.length,
|
|
980
980
|
mode: t.chatMode
|
|
981
981
|
});
|
|
982
982
|
} else {
|
|
983
|
-
const
|
|
984
|
-
if (d = d, d ===
|
|
983
|
+
const C = b, x = [C.StreamVideoDone, C.StreamVideoError, C.StreamVideoRejected], j = [C.StreamFailed, C.StreamVideoError, C.StreamVideoRejected], S = Mt(h, n, { mode: t.chatMode });
|
|
984
|
+
if (d = d, d === C.StreamVideoCreated && (e.linkTrack("agent-video", S, C.StreamVideoCreated, ["start"]), h.sentiment)) {
|
|
985
985
|
const R = t.messages[t.messages.length - 1];
|
|
986
986
|
if ((R == null ? void 0 : R.role) === "assistant") {
|
|
987
987
|
const F = { ...R, sentiment: h.sentiment };
|
|
@@ -990,9 +990,9 @@ function Yt(e, t, i, n, s) {
|
|
|
990
990
|
}
|
|
991
991
|
if (x.includes(d)) {
|
|
992
992
|
const R = d.split("/")[1];
|
|
993
|
-
|
|
993
|
+
j.includes(d) ? e.track("agent-video", { ...S, event: R }) : e.linkTrack("agent-video", { ...S, event: R }, d, ["done"]);
|
|
994
994
|
}
|
|
995
|
-
|
|
995
|
+
j.includes(d) && ((u = (w = i.callbacks).onError) == null || u.call(w, new Error(`Stream failed with event ${d}`), { data: h })), h.event === C.StreamDone && s();
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
};
|
|
@@ -1038,21 +1038,21 @@ const Zt = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window
|
|
|
1038
1038
|
function Ne(e) {
|
|
1039
1039
|
switch (e) {
|
|
1040
1040
|
case "connected":
|
|
1041
|
-
return
|
|
1041
|
+
return M.Connected;
|
|
1042
1042
|
case "checking":
|
|
1043
|
-
return
|
|
1043
|
+
return M.Connecting;
|
|
1044
1044
|
case "failed":
|
|
1045
|
-
return
|
|
1045
|
+
return M.Fail;
|
|
1046
1046
|
case "new":
|
|
1047
|
-
return
|
|
1047
|
+
return M.New;
|
|
1048
1048
|
case "closed":
|
|
1049
|
-
return
|
|
1049
|
+
return M.Closed;
|
|
1050
1050
|
case "disconnected":
|
|
1051
|
-
return
|
|
1051
|
+
return M.Disconnected;
|
|
1052
1052
|
case "completed":
|
|
1053
|
-
return
|
|
1053
|
+
return M.Completed;
|
|
1054
1054
|
default:
|
|
1055
|
-
return
|
|
1055
|
+
return M.New;
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
1058
|
const en = (e) => (t) => {
|
|
@@ -1071,7 +1071,7 @@ function tn({
|
|
|
1071
1071
|
report: n,
|
|
1072
1072
|
log: s
|
|
1073
1073
|
}) {
|
|
1074
|
-
e ===
|
|
1074
|
+
e === D.Start && t === D.Start ? (s("CALLBACK: onVideoStateChange(Start)"), i == null || i(D.Start)) : e === D.Stop && t === D.Stop && (s("CALLBACK: onVideoStateChange(Stop)"), i == null || i(D.Stop, n));
|
|
1075
1075
|
}
|
|
1076
1076
|
function nn({
|
|
1077
1077
|
statsSignal: e,
|
|
@@ -1081,7 +1081,7 @@ function nn({
|
|
|
1081
1081
|
report: s,
|
|
1082
1082
|
log: o
|
|
1083
1083
|
}) {
|
|
1084
|
-
e ===
|
|
1084
|
+
e === D.Start ? (o("CALLBACK: onVideoStateChange(Start)"), i == null || i(D.Start)) : e === D.Stop && (o("CALLBACK: onVideoStateChange(Stop)"), i == null || i(D.Stop, s)), t === D.Start ? n == null || n(H.Talking) : t === D.Stop && (n == null || n(H.Idle));
|
|
1085
1085
|
}
|
|
1086
1086
|
function Je({
|
|
1087
1087
|
statsSignal: e,
|
|
@@ -1101,174 +1101,174 @@ function Je({
|
|
|
1101
1101
|
log: c
|
|
1102
1102
|
});
|
|
1103
1103
|
}
|
|
1104
|
-
async function rn(e, t, { debug: i = !1, callbacks: n, auth: s, baseURL: o =
|
|
1105
|
-
var
|
|
1104
|
+
async function rn(e, t, { debug: i = !1, callbacks: n, auth: s, baseURL: o = he, analytics: c }, a) {
|
|
1105
|
+
var U;
|
|
1106
1106
|
const r = Ye(i, "WebRTCStreamingManager"), d = en(r);
|
|
1107
|
-
let h = !1, w = !1, u =
|
|
1108
|
-
const { startConnection: x, sendStreamRequest:
|
|
1107
|
+
let h = !1, w = !1, u = D.Stop, C = D.Stop;
|
|
1108
|
+
const { startConnection: x, sendStreamRequest: j, close: S, createStream: R, addIceCandidate: F } = Gt(
|
|
1109
1109
|
s,
|
|
1110
1110
|
o,
|
|
1111
1111
|
e,
|
|
1112
1112
|
n.onError
|
|
1113
1113
|
), {
|
|
1114
|
-
id:
|
|
1115
|
-
offer:
|
|
1116
|
-
ice_servers:
|
|
1117
|
-
session_id:
|
|
1114
|
+
id: k,
|
|
1115
|
+
offer: q,
|
|
1116
|
+
ice_servers: N,
|
|
1117
|
+
session_id: Q,
|
|
1118
1118
|
fluent: z,
|
|
1119
|
-
interrupt_enabled:
|
|
1120
|
-
triggers_enabled:
|
|
1119
|
+
interrupt_enabled: te,
|
|
1120
|
+
triggers_enabled: f
|
|
1121
1121
|
} = await R(t, a);
|
|
1122
|
-
(
|
|
1123
|
-
const
|
|
1124
|
-
if (!
|
|
1122
|
+
(U = n.onStreamCreated) == null || U.call(n, { stream_id: k, session_id: Q, agent_id: e });
|
|
1123
|
+
const y = new Zt({ iceServers: N }), E = y.createDataChannel("JanusDataChannel");
|
|
1124
|
+
if (!Q)
|
|
1125
1125
|
throw new Error("Could not create session_id");
|
|
1126
|
-
const
|
|
1126
|
+
const A = z ? ie.Fluent : ie.Legacy;
|
|
1127
1127
|
c.enrich({
|
|
1128
|
-
"stream-type":
|
|
1128
|
+
"stream-type": A
|
|
1129
1129
|
});
|
|
1130
|
-
const
|
|
1131
|
-
var
|
|
1132
|
-
h = !0, w && (r("CALLBACK: onConnectionStateChange(Connected)"), (
|
|
1133
|
-
},
|
|
1134
|
-
() =>
|
|
1135
|
-
P,
|
|
1130
|
+
const P = t.stream_warmup && !z, T = () => h, J = () => {
|
|
1131
|
+
var m;
|
|
1132
|
+
h = !0, w && (r("CALLBACK: onConnectionStateChange(Connected)"), (m = n.onConnectionStateChange) == null || m.call(n, M.Connected));
|
|
1133
|
+
}, O = Ge(
|
|
1134
|
+
() => y.getStats(),
|
|
1136
1135
|
T,
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1136
|
+
J,
|
|
1137
|
+
(m, p) => Je({
|
|
1138
|
+
statsSignal: C = m,
|
|
1139
|
+
dataChannelSignal: A === ie.Legacy ? u : void 0,
|
|
1140
1140
|
onVideoStateChange: n.onVideoStateChange,
|
|
1141
1141
|
onAgentActivityStateChange: n.onAgentActivityStateChange,
|
|
1142
|
-
report:
|
|
1143
|
-
streamType:
|
|
1142
|
+
report: p,
|
|
1143
|
+
streamType: A,
|
|
1144
1144
|
log: r
|
|
1145
1145
|
}),
|
|
1146
|
-
(
|
|
1147
|
-
var
|
|
1148
|
-
return (
|
|
1146
|
+
(m) => {
|
|
1147
|
+
var p;
|
|
1148
|
+
return (p = n.onConnectivityStateChange) == null ? void 0 : p.call(n, m);
|
|
1149
1149
|
}
|
|
1150
1150
|
);
|
|
1151
|
-
|
|
1152
|
-
var
|
|
1153
|
-
r("peerConnection.onicecandidate",
|
|
1151
|
+
O.start(), y.onicecandidate = (m) => {
|
|
1152
|
+
var p;
|
|
1153
|
+
r("peerConnection.onicecandidate", m);
|
|
1154
1154
|
try {
|
|
1155
|
-
|
|
1156
|
-
|
|
1155
|
+
m.candidate && m.candidate.sdpMid && m.candidate.sdpMLineIndex !== null ? F(
|
|
1156
|
+
k,
|
|
1157
1157
|
{
|
|
1158
|
-
candidate:
|
|
1159
|
-
sdpMid:
|
|
1160
|
-
sdpMLineIndex:
|
|
1158
|
+
candidate: m.candidate.candidate,
|
|
1159
|
+
sdpMid: m.candidate.sdpMid,
|
|
1160
|
+
sdpMLineIndex: m.candidate.sdpMLineIndex
|
|
1161
1161
|
},
|
|
1162
|
-
|
|
1162
|
+
Q,
|
|
1163
1163
|
a
|
|
1164
|
-
) : F(
|
|
1165
|
-
} catch (
|
|
1166
|
-
(
|
|
1164
|
+
) : F(k, { candidate: null }, Q, a);
|
|
1165
|
+
} catch ($) {
|
|
1166
|
+
(p = n.onError) == null || p.call(n, $, { streamId: k });
|
|
1167
1167
|
}
|
|
1168
|
-
},
|
|
1169
|
-
w = !0, (!
|
|
1168
|
+
}, E.onopen = () => {
|
|
1169
|
+
w = !0, (!P || h) && J();
|
|
1170
1170
|
};
|
|
1171
|
-
const
|
|
1172
|
-
var
|
|
1173
|
-
(
|
|
1171
|
+
const X = (m) => {
|
|
1172
|
+
var p;
|
|
1173
|
+
(p = n.onVideoIdChange) == null || p.call(n, m);
|
|
1174
1174
|
};
|
|
1175
|
-
function
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1175
|
+
function L(m, p) {
|
|
1176
|
+
if (m === b.StreamStarted && typeof p == "object" && "metadata" in p) {
|
|
1177
|
+
const $ = p.metadata;
|
|
1178
|
+
X($.videoId);
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1181
|
-
statsSignal:
|
|
1180
|
+
m === b.StreamDone && X(null), u = m === b.StreamStarted ? D.Start : D.Stop, Je({
|
|
1181
|
+
statsSignal: A === ie.Legacy ? C : void 0,
|
|
1182
1182
|
dataChannelSignal: u,
|
|
1183
1183
|
onVideoStateChange: n.onVideoStateChange,
|
|
1184
1184
|
onAgentActivityStateChange: n.onAgentActivityStateChange,
|
|
1185
|
-
streamType:
|
|
1185
|
+
streamType: A,
|
|
1186
1186
|
log: r
|
|
1187
1187
|
});
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1190
|
-
var
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1189
|
+
function K(m, p) {
|
|
1190
|
+
var V;
|
|
1191
|
+
const $ = typeof p == "string" ? p : p == null ? void 0 : p.metadata;
|
|
1192
|
+
$ && c.enrich({ streamMetadata: $ }), (V = n.onStreamReady) == null || V.call(n);
|
|
1193
1193
|
}
|
|
1194
|
-
const
|
|
1195
|
-
[
|
|
1196
|
-
[
|
|
1197
|
-
[
|
|
1194
|
+
const Y = {
|
|
1195
|
+
[b.StreamStarted]: L,
|
|
1196
|
+
[b.StreamDone]: L,
|
|
1197
|
+
[b.StreamReady]: K
|
|
1198
1198
|
};
|
|
1199
|
-
|
|
1200
|
-
var
|
|
1201
|
-
const { subject:
|
|
1202
|
-
(
|
|
1203
|
-
},
|
|
1204
|
-
var
|
|
1205
|
-
r("peerConnection.oniceconnectionstatechange => " +
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
},
|
|
1209
|
-
var
|
|
1210
|
-
r("peerConnection.ontrack",
|
|
1211
|
-
}, await
|
|
1212
|
-
const
|
|
1213
|
-
return r("create answer OK"), await
|
|
1199
|
+
E.onmessage = (m) => {
|
|
1200
|
+
var V;
|
|
1201
|
+
const { subject: p, data: $ } = d(m.data);
|
|
1202
|
+
(V = Y[p]) == null || V.call(Y, p, $);
|
|
1203
|
+
}, y.oniceconnectionstatechange = () => {
|
|
1204
|
+
var p;
|
|
1205
|
+
r("peerConnection.oniceconnectionstatechange => " + y.iceConnectionState);
|
|
1206
|
+
const m = Ne(y.iceConnectionState);
|
|
1207
|
+
m !== M.Connected && ((p = n.onConnectionStateChange) == null || p.call(n, m));
|
|
1208
|
+
}, y.ontrack = (m) => {
|
|
1209
|
+
var p;
|
|
1210
|
+
r("peerConnection.ontrack", m), r("CALLBACK: onSrcObjectReady"), (p = n.onSrcObjectReady) == null || p.call(n, m.streams[0]);
|
|
1211
|
+
}, await y.setRemoteDescription(q), r("set remote description OK");
|
|
1212
|
+
const oe = await y.createAnswer();
|
|
1213
|
+
return r("create answer OK"), await y.setLocalDescription(oe), r("set local description OK"), await x(k, oe, Q, a), r("start connection OK"), {
|
|
1214
1214
|
/**
|
|
1215
1215
|
* Method to send request to server to get clip or talk depend on you payload
|
|
1216
1216
|
* @param payload
|
|
1217
1217
|
*/
|
|
1218
|
-
speak(
|
|
1219
|
-
return
|
|
1218
|
+
speak(m) {
|
|
1219
|
+
return j(k, Q, m);
|
|
1220
1220
|
},
|
|
1221
1221
|
/**
|
|
1222
1222
|
* Method to close RTC connection
|
|
1223
1223
|
*/
|
|
1224
1224
|
async disconnect() {
|
|
1225
|
-
var
|
|
1226
|
-
if (
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1225
|
+
var m;
|
|
1226
|
+
if (k) {
|
|
1227
|
+
const p = Ne(y.iceConnectionState);
|
|
1228
|
+
if (y) {
|
|
1229
|
+
if (p === M.New) {
|
|
1230
|
+
O.stop();
|
|
1231
1231
|
return;
|
|
1232
1232
|
}
|
|
1233
|
-
|
|
1233
|
+
y.close(), y.oniceconnectionstatechange = null, y.onnegotiationneeded = null, y.onicecandidate = null, y.ontrack = null;
|
|
1234
1234
|
}
|
|
1235
1235
|
try {
|
|
1236
|
-
|
|
1236
|
+
p === M.Connected && await S(k, Q).catch(($) => {
|
|
1237
1237
|
});
|
|
1238
|
-
} catch (
|
|
1239
|
-
r("Error on close stream connection",
|
|
1238
|
+
} catch ($) {
|
|
1239
|
+
r("Error on close stream connection", $);
|
|
1240
1240
|
}
|
|
1241
|
-
(
|
|
1241
|
+
(m = n.onAgentActivityStateChange) == null || m.call(n, H.Idle), O.stop();
|
|
1242
1242
|
}
|
|
1243
1243
|
},
|
|
1244
1244
|
/**
|
|
1245
1245
|
* Method to send data channel messages to the server
|
|
1246
1246
|
*/
|
|
1247
|
-
sendDataChannelMessage(
|
|
1248
|
-
var
|
|
1249
|
-
if (!h ||
|
|
1250
|
-
r("Data channel is not ready for sending messages"), (
|
|
1251
|
-
streamId:
|
|
1247
|
+
sendDataChannelMessage(m) {
|
|
1248
|
+
var p, $;
|
|
1249
|
+
if (!h || E.readyState !== "open") {
|
|
1250
|
+
r("Data channel is not ready for sending messages"), (p = n.onError) == null || p.call(n, new Error("Data channel is not ready for sending messages"), {
|
|
1251
|
+
streamId: k
|
|
1252
1252
|
});
|
|
1253
1253
|
return;
|
|
1254
1254
|
}
|
|
1255
1255
|
try {
|
|
1256
|
-
|
|
1257
|
-
} catch (
|
|
1258
|
-
r("Error sending data channel message",
|
|
1256
|
+
E.send(m);
|
|
1257
|
+
} catch (V) {
|
|
1258
|
+
r("Error sending data channel message", V), ($ = n.onError) == null || $.call(n, V, { streamId: k });
|
|
1259
1259
|
}
|
|
1260
1260
|
},
|
|
1261
1261
|
/**
|
|
1262
1262
|
* Session identifier information, should be returned in the body of all streaming requests
|
|
1263
1263
|
*/
|
|
1264
|
-
sessionId:
|
|
1264
|
+
sessionId: Q,
|
|
1265
1265
|
/**
|
|
1266
1266
|
* Id of current RTC stream
|
|
1267
1267
|
*/
|
|
1268
|
-
streamId:
|
|
1269
|
-
streamType:
|
|
1270
|
-
interruptAvailable:
|
|
1271
|
-
triggersAvailable:
|
|
1268
|
+
streamId: k,
|
|
1269
|
+
streamType: A,
|
|
1270
|
+
interruptAvailable: te ?? !1,
|
|
1271
|
+
triggersAvailable: f ?? !1
|
|
1272
1272
|
};
|
|
1273
1273
|
}
|
|
1274
1274
|
var Ae = /* @__PURE__ */ ((e) => (e.V1 = "v1", e.V2 = "v2", e))(Ae || {});
|
|
@@ -1282,7 +1282,7 @@ async function an(e, t, i, n) {
|
|
|
1282
1282
|
case "v2": {
|
|
1283
1283
|
const { version: o, ...c } = t;
|
|
1284
1284
|
switch (c.transport_provider) {
|
|
1285
|
-
case
|
|
1285
|
+
case Se.Livekit:
|
|
1286
1286
|
const { createLiveKitStreamingManager: a } = await Promise.resolve().then(() => Nt);
|
|
1287
1287
|
return a(s, c, i);
|
|
1288
1288
|
default:
|
|
@@ -1296,7 +1296,7 @@ async function an(e, t, i, n) {
|
|
|
1296
1296
|
const on = "cht";
|
|
1297
1297
|
function sn() {
|
|
1298
1298
|
return {
|
|
1299
|
-
transport_provider:
|
|
1299
|
+
transport_provider: Se.Livekit
|
|
1300
1300
|
};
|
|
1301
1301
|
}
|
|
1302
1302
|
function cn(e) {
|
|
@@ -1316,10 +1316,10 @@ function dn(e, t) {
|
|
|
1316
1316
|
return Pe(e.presenter.type) ? { version: Ae.V2, ...sn() } : { version: Ae.V1, ...cn(t) };
|
|
1317
1317
|
}
|
|
1318
1318
|
function un(e, t, i, n, s) {
|
|
1319
|
-
s === ie.Fluent ? ln(e, t, i, n, s) :
|
|
1319
|
+
s === ie.Fluent ? ln(e, t, i, n, s) : mn(e, t, i, n, s);
|
|
1320
1320
|
}
|
|
1321
1321
|
function ln(e, t, i, n, s) {
|
|
1322
|
-
e ===
|
|
1322
|
+
e === D.Start ? n.track("stream-session", { event: "start", "stream-type": s }) : e === D.Stop && n.track("stream-session", {
|
|
1323
1323
|
event: "stop",
|
|
1324
1324
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
1325
1325
|
background: t.presenter.type === "clip" && t.presenter.background,
|
|
@@ -1327,13 +1327,13 @@ function ln(e, t, i, n, s) {
|
|
|
1327
1327
|
...i
|
|
1328
1328
|
});
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1331
|
-
ne.get() <= 0 || (e ===
|
|
1330
|
+
function fn(e, t, i, n) {
|
|
1331
|
+
ne.get() <= 0 || (e === D.Start ? i.linkTrack(
|
|
1332
1332
|
"agent-video",
|
|
1333
1333
|
{ event: "start", latency: ne.get(!0), "stream-type": n },
|
|
1334
1334
|
"start",
|
|
1335
|
-
[
|
|
1336
|
-
) : e ===
|
|
1335
|
+
[b.StreamVideoCreated]
|
|
1336
|
+
) : e === D.Stop && i.linkTrack(
|
|
1337
1337
|
"agent-video",
|
|
1338
1338
|
{
|
|
1339
1339
|
event: "stop",
|
|
@@ -1342,16 +1342,16 @@ function mn(e, t, i, n) {
|
|
|
1342
1342
|
"stream-type": n
|
|
1343
1343
|
},
|
|
1344
1344
|
"done",
|
|
1345
|
-
[
|
|
1345
|
+
[b.StreamVideoDone]
|
|
1346
1346
|
));
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1349
|
-
ne.get() <= 0 || (e ===
|
|
1348
|
+
function mn(e, t, i, n, s) {
|
|
1349
|
+
ne.get() <= 0 || (e === D.Start ? n.linkTrack(
|
|
1350
1350
|
"agent-video",
|
|
1351
1351
|
{ event: "start", latency: ne.get(!0), "stream-type": s },
|
|
1352
1352
|
"start",
|
|
1353
|
-
[
|
|
1354
|
-
) : e ===
|
|
1353
|
+
[b.StreamVideoCreated]
|
|
1354
|
+
) : e === D.Stop && n.linkTrack(
|
|
1355
1355
|
"agent-video",
|
|
1356
1356
|
{
|
|
1357
1357
|
event: "stop",
|
|
@@ -1361,7 +1361,7 @@ function fn(e, t, i, n, s) {
|
|
|
1361
1361
|
...i
|
|
1362
1362
|
},
|
|
1363
1363
|
"done",
|
|
1364
|
-
[
|
|
1364
|
+
[b.StreamVideoDone]
|
|
1365
1365
|
));
|
|
1366
1366
|
}
|
|
1367
1367
|
function Ue(e, t, i, n) {
|
|
@@ -1381,7 +1381,7 @@ function Ue(e, t, i, n) {
|
|
|
1381
1381
|
...t.callbacks,
|
|
1382
1382
|
onConnectionStateChange: (d) => {
|
|
1383
1383
|
var h, w;
|
|
1384
|
-
(w = (h = t.callbacks).onConnectionStateChange) == null || w.call(h, d), d ===
|
|
1384
|
+
(w = (h = t.callbacks).onConnectionStateChange) == null || w.call(h, d), d === M.Connected && (c ? s(c) : a = !0);
|
|
1385
1385
|
},
|
|
1386
1386
|
onVideoStateChange: (d, h) => {
|
|
1387
1387
|
var w, u;
|
|
@@ -1395,8 +1395,8 @@ function Ue(e, t, i, n) {
|
|
|
1395
1395
|
},
|
|
1396
1396
|
onAgentActivityStateChange: (d) => {
|
|
1397
1397
|
var h, w;
|
|
1398
|
-
(w = (h = t.callbacks).onAgentActivityStateChange) == null || w.call(h, d), d ===
|
|
1399
|
-
d ===
|
|
1398
|
+
(w = (h = t.callbacks).onAgentActivityStateChange) == null || w.call(h, d), d === H.Talking ? Te.update() : Te.reset(), fn(
|
|
1399
|
+
d === H.Talking ? D.Start : D.Stop,
|
|
1400
1400
|
e,
|
|
1401
1401
|
i,
|
|
1402
1402
|
c.streamType
|
|
@@ -1416,27 +1416,27 @@ function Ue(e, t, i, n) {
|
|
|
1416
1416
|
});
|
|
1417
1417
|
}
|
|
1418
1418
|
async function gn(e, t, i, n, s) {
|
|
1419
|
-
var h, w, u,
|
|
1419
|
+
var h, w, u, C;
|
|
1420
1420
|
const o = async () => {
|
|
1421
1421
|
if (Pe(e.presenter.type)) {
|
|
1422
|
-
const x = await Ue(e, t, n),
|
|
1422
|
+
const x = await Ue(e, t, n), j = `${on}_${x.sessionId}`, S = (/* @__PURE__ */ new Date()).toISOString();
|
|
1423
1423
|
return { chatResult: {
|
|
1424
1424
|
chatMode: B.Functional,
|
|
1425
1425
|
chat: {
|
|
1426
|
-
id:
|
|
1426
|
+
id: j,
|
|
1427
1427
|
agent_id: e.id,
|
|
1428
1428
|
owner_id: e.owner_id ?? "",
|
|
1429
|
-
created:
|
|
1430
|
-
modified:
|
|
1431
|
-
agent_id__created_at:
|
|
1432
|
-
agent_id__modified_at:
|
|
1429
|
+
created: S,
|
|
1430
|
+
modified: S,
|
|
1431
|
+
agent_id__created_at: S,
|
|
1432
|
+
agent_id__modified_at: S,
|
|
1433
1433
|
chat_mode: B.Functional,
|
|
1434
1434
|
messages: []
|
|
1435
1435
|
}
|
|
1436
1436
|
}, streamingManager: x };
|
|
1437
1437
|
} else {
|
|
1438
|
-
const x = new AbortController(),
|
|
1439
|
-
let
|
|
1438
|
+
const x = new AbortController(), j = x.signal;
|
|
1439
|
+
let S;
|
|
1440
1440
|
try {
|
|
1441
1441
|
const R = Xe(
|
|
1442
1442
|
e,
|
|
@@ -1445,20 +1445,20 @@ async function gn(e, t, i, n, s) {
|
|
|
1445
1445
|
t.mode,
|
|
1446
1446
|
t.persistentChat,
|
|
1447
1447
|
s
|
|
1448
|
-
), F = Ue(e, t, n,
|
|
1449
|
-
return { chatResult:
|
|
1448
|
+
), F = Ue(e, t, n, j).then((N) => (S = N, N)), [k, q] = await Promise.all([R, F]);
|
|
1449
|
+
return { chatResult: k, streamingManager: q };
|
|
1450
1450
|
} catch (R) {
|
|
1451
|
-
throw x.abort(),
|
|
1451
|
+
throw x.abort(), S && await S.disconnect().catch(() => {
|
|
1452
1452
|
}), R;
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
1455
|
}, { chatResult: c, streamingManager: a } = await o(), { chat: r, chatMode: d } = c;
|
|
1456
|
-
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (w = (h = t.callbacks).onModeChange) == null || w.call(h, d), d !== B.Functional) ? ((
|
|
1456
|
+
return d && t.mode !== void 0 && d !== t.mode && (t.mode = d, (w = (h = t.callbacks).onModeChange) == null || w.call(h, d), d !== B.Functional) ? ((C = (u = t.callbacks).onError) == null || C.call(u, new nt(d)), a == null || a.disconnect(), { chat: r }) : { chat: r, streamingManager: a };
|
|
1457
1457
|
}
|
|
1458
1458
|
async function wn(e, t) {
|
|
1459
|
-
var
|
|
1459
|
+
var Q, z, te;
|
|
1460
1460
|
let i = !0, n = null;
|
|
1461
|
-
const s = t.mixpanelKey || pt, o = t.wsURL || ht, c = t.baseURL ||
|
|
1461
|
+
const s = t.mixpanelKey || pt, o = t.wsURL || ht, c = t.baseURL || he, a = t.mode || B.Functional, r = {
|
|
1462
1462
|
messages: [],
|
|
1463
1463
|
chatMode: a
|
|
1464
1464
|
}, d = Tt({
|
|
@@ -1471,44 +1471,42 @@ async function wn(e, t) {
|
|
|
1471
1471
|
Fe(() => {
|
|
1472
1472
|
d.track("agent-sdk", { event: "init" }, h);
|
|
1473
1473
|
});
|
|
1474
|
-
const w = kt(t.auth, c, t.callbacks.onError, t.externalId), u = await w.getById(e);
|
|
1475
|
-
t.debug = t.debug || ((O = u == null ? void 0 : u.advanced_settings) == null ? void 0 : O.ui_debug_mode);
|
|
1476
|
-
const v = Pe(u.presenter.type);
|
|
1474
|
+
const w = kt(t.auth, c, t.callbacks.onError, t.externalId), u = await w.getById(e), C = Pe(u.presenter.type);
|
|
1477
1475
|
d.enrich(Dt(u));
|
|
1478
|
-
const { onMessage: x, clearQueue:
|
|
1476
|
+
const { onMessage: x, clearQueue: j } = Yt(
|
|
1479
1477
|
d,
|
|
1480
1478
|
r,
|
|
1481
1479
|
t,
|
|
1482
1480
|
u,
|
|
1483
1481
|
() => {
|
|
1484
|
-
var
|
|
1485
|
-
return (
|
|
1482
|
+
var f;
|
|
1483
|
+
return (f = r.socketManager) == null ? void 0 : f.disconnect();
|
|
1486
1484
|
}
|
|
1487
1485
|
);
|
|
1488
|
-
r.messages = At(t.initialMessages), (
|
|
1489
|
-
const
|
|
1490
|
-
n =
|
|
1491
|
-
}, R = ({ type:
|
|
1492
|
-
var
|
|
1493
|
-
const
|
|
1486
|
+
r.messages = At(t.initialMessages), (z = (Q = t.callbacks).onNewMessage) == null || z.call(Q, [...r.messages], "answer");
|
|
1487
|
+
const S = (f) => {
|
|
1488
|
+
n = f;
|
|
1489
|
+
}, R = ({ type: f }) => {
|
|
1490
|
+
var E, A, P;
|
|
1491
|
+
const y = r.messages[r.messages.length - 1];
|
|
1494
1492
|
d.track("agent-video-interrupt", {
|
|
1495
|
-
type:
|
|
1493
|
+
type: f || "click",
|
|
1496
1494
|
video_duration_to_interrupt: Te.get(!0),
|
|
1497
1495
|
message_duration_to_interrupt: ne.get(!0)
|
|
1498
|
-
}),
|
|
1496
|
+
}), y.interrupted = !0, (A = (E = t.callbacks).onNewMessage) == null || A.call(E, [...r.messages], "answer"), C ? Vt(r.streamingManager) : (Jt(r.streamingManager, (P = r.streamingManager) == null ? void 0 : P.streamType, n), Ut(r.streamingManager, n));
|
|
1499
1497
|
}, F = Date.now();
|
|
1500
1498
|
Fe(() => {
|
|
1501
1499
|
d.track("agent-sdk", { event: "loaded", ...Rt(u) }, F);
|
|
1502
1500
|
});
|
|
1503
|
-
async function
|
|
1504
|
-
var
|
|
1505
|
-
(
|
|
1506
|
-
const
|
|
1501
|
+
async function k(f) {
|
|
1502
|
+
var J, O, X, L, K, Y, oe;
|
|
1503
|
+
(O = (J = t.callbacks).onConnectionStateChange) == null || O.call(J, M.Connecting), ne.reset(), f && !i && (delete r.chat, (L = (X = t.callbacks).onNewMessage) == null || L.call(X, [...r.messages], "answer"));
|
|
1504
|
+
const y = a === B.DirectPlayback || C ? Promise.resolve(void 0) : Ht(
|
|
1507
1505
|
t.auth,
|
|
1508
1506
|
o,
|
|
1509
1507
|
{ onMessage: x, onError: t.callbacks.onError },
|
|
1510
1508
|
t.externalId
|
|
1511
|
-
),
|
|
1509
|
+
), E = Me(
|
|
1512
1510
|
() => gn(
|
|
1513
1511
|
u,
|
|
1514
1512
|
{
|
|
@@ -1516,7 +1514,7 @@ async function wn(e, t) {
|
|
|
1516
1514
|
mode: a,
|
|
1517
1515
|
callbacks: {
|
|
1518
1516
|
...t.callbacks,
|
|
1519
|
-
onVideoIdChange:
|
|
1517
|
+
onVideoIdChange: S,
|
|
1520
1518
|
onMessage: x,
|
|
1521
1519
|
onInterruptDetected: R
|
|
1522
1520
|
}
|
|
@@ -1527,108 +1525,108 @@ async function wn(e, t) {
|
|
|
1527
1525
|
),
|
|
1528
1526
|
{
|
|
1529
1527
|
limit: 3,
|
|
1530
|
-
timeout:
|
|
1528
|
+
timeout: mt,
|
|
1531
1529
|
timeoutErrorMessage: "Timeout initializing the stream",
|
|
1532
|
-
shouldRetryFn: (
|
|
1530
|
+
shouldRetryFn: (U) => (U == null ? void 0 : U.message) !== "Could not connect" && U.status !== 429 && (U == null ? void 0 : U.message) !== "InsufficientCreditsError",
|
|
1533
1531
|
delayMs: 1e3
|
|
1534
1532
|
}
|
|
1535
|
-
).catch((
|
|
1536
|
-
var
|
|
1537
|
-
throw
|
|
1538
|
-
}), [
|
|
1539
|
-
T && T.id !== ((
|
|
1533
|
+
).catch((U) => {
|
|
1534
|
+
var m, p;
|
|
1535
|
+
throw N(B.Maintenance), (p = (m = t.callbacks).onConnectionStateChange) == null || p.call(m, M.Fail), U;
|
|
1536
|
+
}), [A, { streamingManager: P, chat: T }] = await Promise.all([y, E]);
|
|
1537
|
+
T && T.id !== ((K = r.chat) == null ? void 0 : K.id) && ((oe = (Y = t.callbacks).onNewChat) == null || oe.call(Y, T.id)), r.streamingManager = P, r.socketManager = A, r.chat = T, i = !1, d.enrich({
|
|
1540
1538
|
chatId: T == null ? void 0 : T.id,
|
|
1541
1539
|
streamId: P == null ? void 0 : P.streamId,
|
|
1542
1540
|
mode: r.chatMode
|
|
1543
|
-
}),
|
|
1541
|
+
}), N((T == null ? void 0 : T.chat_mode) ?? a);
|
|
1544
1542
|
}
|
|
1545
|
-
async function
|
|
1546
|
-
var
|
|
1547
|
-
(
|
|
1543
|
+
async function q() {
|
|
1544
|
+
var f, y, E, A;
|
|
1545
|
+
(f = r.socketManager) == null || f.disconnect(), await ((y = r.streamingManager) == null ? void 0 : y.disconnect()), delete r.streamingManager, delete r.socketManager, (A = (E = t.callbacks).onConnectionStateChange) == null || A.call(E, M.Disconnected);
|
|
1548
1546
|
}
|
|
1549
|
-
async function
|
|
1550
|
-
var
|
|
1551
|
-
|
|
1547
|
+
async function N(f) {
|
|
1548
|
+
var y, E;
|
|
1549
|
+
f !== r.chatMode && (d.track("agent-mode-change", { mode: f }), r.chatMode = f, r.chatMode !== B.Functional && await q(), (E = (y = t.callbacks).onModeChange) == null || E.call(y, f));
|
|
1552
1550
|
}
|
|
1553
1551
|
return {
|
|
1554
1552
|
agent: u,
|
|
1555
1553
|
getStreamType: () => {
|
|
1556
|
-
var
|
|
1557
|
-
return (
|
|
1554
|
+
var f;
|
|
1555
|
+
return (f = r.streamingManager) == null ? void 0 : f.streamType;
|
|
1558
1556
|
},
|
|
1559
1557
|
getIsInterruptAvailable: () => {
|
|
1560
|
-
var
|
|
1561
|
-
return ((
|
|
1558
|
+
var f;
|
|
1559
|
+
return ((f = r.streamingManager) == null ? void 0 : f.interruptAvailable) ?? !1;
|
|
1562
1560
|
},
|
|
1563
1561
|
getIsTriggersAvailable: () => {
|
|
1564
|
-
var
|
|
1565
|
-
return ((
|
|
1562
|
+
var f;
|
|
1563
|
+
return ((f = r.streamingManager) == null ? void 0 : f.triggersAvailable) ?? !1;
|
|
1566
1564
|
},
|
|
1567
1565
|
starterMessages: ((te = u.knowledge) == null ? void 0 : te.starter_message) || [],
|
|
1568
1566
|
getSTTToken: () => w.getSTTToken(u.id),
|
|
1569
|
-
changeMode:
|
|
1567
|
+
changeMode: N,
|
|
1570
1568
|
enrichAnalytics: d.enrich,
|
|
1571
1569
|
async connect() {
|
|
1572
|
-
await
|
|
1570
|
+
await k(!0), d.track("agent-chat", {
|
|
1573
1571
|
event: "connect",
|
|
1574
1572
|
mode: r.chatMode
|
|
1575
1573
|
});
|
|
1576
1574
|
},
|
|
1577
1575
|
async reconnect() {
|
|
1578
|
-
const
|
|
1579
|
-
if (
|
|
1576
|
+
const f = r.streamingManager;
|
|
1577
|
+
if (C && (f != null && f.reconnect)) {
|
|
1580
1578
|
try {
|
|
1581
|
-
await
|
|
1579
|
+
await f.reconnect(), d.track("agent-chat", {
|
|
1582
1580
|
event: "reconnect",
|
|
1583
1581
|
mode: r.chatMode
|
|
1584
1582
|
});
|
|
1585
1583
|
} catch {
|
|
1586
|
-
await
|
|
1584
|
+
await q(), await k(!1);
|
|
1587
1585
|
}
|
|
1588
1586
|
return;
|
|
1589
1587
|
}
|
|
1590
|
-
await
|
|
1588
|
+
await q(), await k(!1), d.track("agent-chat", {
|
|
1591
1589
|
event: "reconnect",
|
|
1592
1590
|
mode: r.chatMode
|
|
1593
1591
|
});
|
|
1594
1592
|
},
|
|
1595
1593
|
async disconnect() {
|
|
1596
|
-
await
|
|
1594
|
+
await q(), d.track("agent-chat", {
|
|
1597
1595
|
event: "disconnect",
|
|
1598
1596
|
mode: r.chatMode
|
|
1599
1597
|
});
|
|
1600
1598
|
},
|
|
1601
|
-
async publishMicrophoneStream(
|
|
1602
|
-
var
|
|
1603
|
-
if (!((
|
|
1599
|
+
async publishMicrophoneStream(f) {
|
|
1600
|
+
var y;
|
|
1601
|
+
if (!((y = r.streamingManager) != null && y.publishMicrophoneStream))
|
|
1604
1602
|
throw new Error("publishMicrophoneStream is not available for this streaming manager");
|
|
1605
|
-
return r.streamingManager.publishMicrophoneStream(
|
|
1603
|
+
return r.streamingManager.publishMicrophoneStream(f);
|
|
1606
1604
|
},
|
|
1607
1605
|
async unpublishMicrophoneStream() {
|
|
1608
|
-
var
|
|
1609
|
-
if (!((
|
|
1606
|
+
var f;
|
|
1607
|
+
if (!((f = r.streamingManager) != null && f.unpublishMicrophoneStream))
|
|
1610
1608
|
throw new Error("unpublishMicrophoneStream is not available for this streaming manager");
|
|
1611
1609
|
return r.streamingManager.unpublishMicrophoneStream();
|
|
1612
1610
|
},
|
|
1613
|
-
async chat(
|
|
1614
|
-
var P, T,
|
|
1615
|
-
const
|
|
1611
|
+
async chat(f) {
|
|
1612
|
+
var P, T, J, O, X;
|
|
1613
|
+
const y = () => {
|
|
1616
1614
|
if (He(a))
|
|
1617
|
-
throw new
|
|
1618
|
-
if (
|
|
1619
|
-
throw new
|
|
1620
|
-
if (
|
|
1621
|
-
throw new
|
|
1615
|
+
throw new ue(`${a} is enabled, chat is disabled`);
|
|
1616
|
+
if (f.length >= 800)
|
|
1617
|
+
throw new ue("Message cannot be more than 800 characters");
|
|
1618
|
+
if (f.length === 0)
|
|
1619
|
+
throw new ue("Message cannot be empty");
|
|
1622
1620
|
if (r.chatMode === B.Maintenance)
|
|
1623
|
-
throw new
|
|
1621
|
+
throw new ue("Chat is in maintenance mode");
|
|
1624
1622
|
if (![B.TextOnly, B.Playground].includes(r.chatMode)) {
|
|
1625
1623
|
if (!r.streamingManager)
|
|
1626
|
-
throw new
|
|
1624
|
+
throw new ue("Streaming manager is not initialized");
|
|
1627
1625
|
if (!r.chat)
|
|
1628
|
-
throw new
|
|
1626
|
+
throw new ue("Chat is not initialized");
|
|
1629
1627
|
}
|
|
1630
|
-
},
|
|
1631
|
-
var
|
|
1628
|
+
}, E = async () => {
|
|
1629
|
+
var L, K;
|
|
1632
1630
|
if (!r.chat) {
|
|
1633
1631
|
const Y = await Xe(
|
|
1634
1632
|
u,
|
|
@@ -1639,24 +1637,24 @@ async function wn(e, t) {
|
|
|
1639
1637
|
);
|
|
1640
1638
|
if (!Y.chat)
|
|
1641
1639
|
throw new tt(r.chatMode, !!t.persistentChat);
|
|
1642
|
-
r.chat = Y.chat, (
|
|
1640
|
+
r.chat = Y.chat, (K = (L = t.callbacks).onNewChat) == null || K.call(L, r.chat.id);
|
|
1643
1641
|
}
|
|
1644
1642
|
return r.chat.id;
|
|
1645
|
-
},
|
|
1643
|
+
}, A = async (L, K) => {
|
|
1646
1644
|
const Y = r.chatMode === B.Playground;
|
|
1647
|
-
return
|
|
1648
|
-
var
|
|
1649
|
-
return await ((
|
|
1645
|
+
return Me(C && !Y ? async () => {
|
|
1646
|
+
var m, p;
|
|
1647
|
+
return await ((p = (m = r.streamingManager) == null ? void 0 : m.sendTextMessage) == null ? void 0 : p.call(m, f)), Promise.resolve({});
|
|
1650
1648
|
} : async () => {
|
|
1651
|
-
var
|
|
1649
|
+
var m, p;
|
|
1652
1650
|
return w.chat(
|
|
1653
1651
|
u.id,
|
|
1654
|
-
|
|
1652
|
+
K,
|
|
1655
1653
|
{
|
|
1656
1654
|
chatMode: r.chatMode,
|
|
1657
|
-
streamId: (
|
|
1658
|
-
sessionId: (
|
|
1659
|
-
messages:
|
|
1655
|
+
streamId: (m = r.streamingManager) == null ? void 0 : m.streamId,
|
|
1656
|
+
sessionId: (p = r.streamingManager) == null ? void 0 : p.sessionId,
|
|
1657
|
+
messages: L.map(({ matches: $, ...V }) => V)
|
|
1660
1658
|
},
|
|
1661
1659
|
{
|
|
1662
1660
|
...Qe(r.chatMode),
|
|
@@ -1665,106 +1663,106 @@ async function wn(e, t) {
|
|
|
1665
1663
|
);
|
|
1666
1664
|
}, {
|
|
1667
1665
|
limit: 2,
|
|
1668
|
-
shouldRetryFn: (
|
|
1669
|
-
var
|
|
1670
|
-
const
|
|
1671
|
-
return !((
|
|
1666
|
+
shouldRetryFn: (m) => {
|
|
1667
|
+
var V, ce, pe, we;
|
|
1668
|
+
const p = (V = m == null ? void 0 : m.message) == null ? void 0 : V.includes("missing or invalid session_id");
|
|
1669
|
+
return !((ce = m == null ? void 0 : m.message) == null ? void 0 : ce.includes("Stream Error")) && !p ? ((we = (pe = t.callbacks).onError) == null || we.call(pe, m), !1) : !0;
|
|
1672
1670
|
},
|
|
1673
1671
|
onRetry: async () => {
|
|
1674
|
-
await
|
|
1672
|
+
await q(), await k(!1);
|
|
1675
1673
|
}
|
|
1676
1674
|
});
|
|
1677
1675
|
};
|
|
1678
1676
|
try {
|
|
1679
|
-
|
|
1680
|
-
id:
|
|
1677
|
+
j(), y(), r.messages.push({
|
|
1678
|
+
id: le(),
|
|
1681
1679
|
role: "user",
|
|
1682
|
-
content:
|
|
1680
|
+
content: f,
|
|
1683
1681
|
created_at: new Date(ne.update()).toISOString()
|
|
1684
1682
|
}), (T = (P = t.callbacks).onNewMessage) == null || T.call(P, [...r.messages], "user");
|
|
1685
|
-
const
|
|
1683
|
+
const L = await E(), K = await A([...r.messages], L);
|
|
1686
1684
|
return r.messages.push({
|
|
1687
|
-
id:
|
|
1685
|
+
id: le(),
|
|
1688
1686
|
role: "assistant",
|
|
1689
|
-
content:
|
|
1687
|
+
content: K.result || "",
|
|
1690
1688
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1691
|
-
context:
|
|
1692
|
-
matches:
|
|
1689
|
+
context: K.context,
|
|
1690
|
+
matches: K.matches
|
|
1693
1691
|
}), d.track("agent-message-send", {
|
|
1694
1692
|
event: "success",
|
|
1695
1693
|
messages: r.messages.length + 1
|
|
1696
|
-
}),
|
|
1694
|
+
}), K.result && ((O = (J = t.callbacks).onNewMessage) == null || O.call(J, [...r.messages], "answer"), d.track("agent-message-received", {
|
|
1697
1695
|
latency: ne.get(!0),
|
|
1698
1696
|
messages: r.messages.length
|
|
1699
|
-
})),
|
|
1700
|
-
} catch (
|
|
1701
|
-
throw ((
|
|
1697
|
+
})), K;
|
|
1698
|
+
} catch (L) {
|
|
1699
|
+
throw ((X = r.messages[r.messages.length - 1]) == null ? void 0 : X.role) === "assistant" && r.messages.pop(), d.track("agent-message-send", {
|
|
1702
1700
|
event: "error",
|
|
1703
1701
|
messages: r.messages.length
|
|
1704
|
-
}),
|
|
1702
|
+
}), L;
|
|
1705
1703
|
}
|
|
1706
1704
|
},
|
|
1707
|
-
rate(
|
|
1708
|
-
var T,
|
|
1709
|
-
const
|
|
1705
|
+
rate(f, y, E) {
|
|
1706
|
+
var T, J, O, X;
|
|
1707
|
+
const A = r.messages.find((L) => L.id === f);
|
|
1710
1708
|
if (r.chat) {
|
|
1711
|
-
if (!
|
|
1709
|
+
if (!A)
|
|
1712
1710
|
throw new Error("Message not found");
|
|
1713
1711
|
} else throw new Error("Chat is not initialized");
|
|
1714
|
-
const P = ((T =
|
|
1712
|
+
const P = ((T = A.matches) == null ? void 0 : T.map((L) => [L.document_id, L.id])) ?? [];
|
|
1715
1713
|
return d.track("agent-rate", {
|
|
1716
|
-
event:
|
|
1717
|
-
thumb:
|
|
1718
|
-
knowledge_id: ((
|
|
1714
|
+
event: E ? "update" : "create",
|
|
1715
|
+
thumb: y === 1 ? "up" : "down",
|
|
1716
|
+
knowledge_id: ((J = u.knowledge) == null ? void 0 : J.id) ?? "",
|
|
1719
1717
|
matches: P,
|
|
1720
|
-
score:
|
|
1721
|
-
}),
|
|
1722
|
-
knowledge_id: ((
|
|
1723
|
-
message_id:
|
|
1718
|
+
score: y
|
|
1719
|
+
}), E ? w.updateRating(u.id, r.chat.id, E, {
|
|
1720
|
+
knowledge_id: ((O = u.knowledge) == null ? void 0 : O.id) ?? "",
|
|
1721
|
+
message_id: f,
|
|
1724
1722
|
matches: P,
|
|
1725
|
-
score:
|
|
1723
|
+
score: y
|
|
1726
1724
|
}) : w.createRating(u.id, r.chat.id, {
|
|
1727
|
-
knowledge_id: ((
|
|
1728
|
-
message_id:
|
|
1725
|
+
knowledge_id: ((X = u.knowledge) == null ? void 0 : X.id) ?? "",
|
|
1726
|
+
message_id: f,
|
|
1729
1727
|
matches: P,
|
|
1730
|
-
score:
|
|
1728
|
+
score: y
|
|
1731
1729
|
});
|
|
1732
1730
|
},
|
|
1733
|
-
deleteRate(
|
|
1731
|
+
deleteRate(f) {
|
|
1734
1732
|
if (!r.chat)
|
|
1735
1733
|
throw new Error("Chat is not initialized");
|
|
1736
|
-
return d.track("agent-rate-delete", { type: "text" }), w.deleteRating(u.id, r.chat.id,
|
|
1734
|
+
return d.track("agent-rate-delete", { type: "text" }), w.deleteRating(u.id, r.chat.id, f);
|
|
1737
1735
|
},
|
|
1738
|
-
async speak(
|
|
1739
|
-
var P, T,
|
|
1740
|
-
function
|
|
1741
|
-
if (typeof
|
|
1736
|
+
async speak(f) {
|
|
1737
|
+
var P, T, J;
|
|
1738
|
+
function y() {
|
|
1739
|
+
if (typeof f == "string") {
|
|
1742
1740
|
if (!u.presenter.voice)
|
|
1743
1741
|
throw new Error("Presenter voice is not initialized");
|
|
1744
1742
|
return {
|
|
1745
1743
|
type: "text",
|
|
1746
1744
|
provider: u.presenter.voice,
|
|
1747
|
-
input:
|
|
1745
|
+
input: f,
|
|
1748
1746
|
ssml: !1
|
|
1749
1747
|
};
|
|
1750
1748
|
}
|
|
1751
|
-
if (
|
|
1749
|
+
if (f.type === "text" && !f.provider) {
|
|
1752
1750
|
if (!u.presenter.voice)
|
|
1753
1751
|
throw new Error("Presenter voice is not initialized");
|
|
1754
1752
|
return {
|
|
1755
1753
|
type: "text",
|
|
1756
1754
|
provider: u.presenter.voice,
|
|
1757
|
-
input:
|
|
1758
|
-
ssml:
|
|
1755
|
+
input: f.input,
|
|
1756
|
+
ssml: f.ssml
|
|
1759
1757
|
};
|
|
1760
1758
|
}
|
|
1761
|
-
return
|
|
1759
|
+
return f;
|
|
1762
1760
|
}
|
|
1763
|
-
const
|
|
1764
|
-
if (d.track("agent-speak",
|
|
1765
|
-
id:
|
|
1761
|
+
const E = y();
|
|
1762
|
+
if (d.track("agent-speak", E), ne.update(), r.messages && E.type === "text" && (r.messages.push({
|
|
1763
|
+
id: le(),
|
|
1766
1764
|
role: "assistant",
|
|
1767
|
-
content:
|
|
1765
|
+
content: E.input,
|
|
1768
1766
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1769
1767
|
}), (T = (P = t.callbacks).onNewMessage) == null || T.call(P, [...r.messages], "answer")), yt(r.chatMode))
|
|
1770
1768
|
return {
|
|
@@ -1775,36 +1773,36 @@ async function wn(e, t) {
|
|
|
1775
1773
|
if (!r.streamingManager)
|
|
1776
1774
|
throw new Error("Please connect to the agent first");
|
|
1777
1775
|
return r.streamingManager.speak({
|
|
1778
|
-
script:
|
|
1779
|
-
metadata: { chat_id: (
|
|
1776
|
+
script: E,
|
|
1777
|
+
metadata: { chat_id: (J = r.chat) == null ? void 0 : J.id, agent_id: u.id }
|
|
1780
1778
|
});
|
|
1781
1779
|
},
|
|
1782
1780
|
interrupt: R
|
|
1783
1781
|
};
|
|
1784
1782
|
}
|
|
1785
1783
|
export {
|
|
1786
|
-
|
|
1784
|
+
H as AgentActivityState,
|
|
1787
1785
|
ot as AgentStatus,
|
|
1788
1786
|
tt as ChatCreationFailed,
|
|
1789
1787
|
B as ChatMode,
|
|
1790
1788
|
nt as ChatModeDowngraded,
|
|
1791
|
-
|
|
1792
|
-
|
|
1789
|
+
Z as ChatProgress,
|
|
1790
|
+
M as ConnectionState,
|
|
1793
1791
|
re as ConnectivityState,
|
|
1794
1792
|
ut as DocumentType,
|
|
1795
1793
|
dt as KnowledgeType,
|
|
1796
1794
|
at as PlanGroup,
|
|
1797
1795
|
lt as Providers,
|
|
1798
1796
|
st as RateState,
|
|
1799
|
-
|
|
1797
|
+
b as StreamEvents,
|
|
1800
1798
|
ie as StreamType,
|
|
1801
|
-
|
|
1799
|
+
D as StreamingState,
|
|
1802
1800
|
ct as Subject,
|
|
1803
|
-
|
|
1801
|
+
Se as TransportProvider,
|
|
1804
1802
|
it as UserPlan,
|
|
1805
|
-
|
|
1803
|
+
ue as ValidationError,
|
|
1806
1804
|
Ve as VideoType,
|
|
1807
|
-
|
|
1805
|
+
ft as VoiceAccess,
|
|
1808
1806
|
rt as WsError,
|
|
1809
1807
|
wn as createAgentManager,
|
|
1810
1808
|
pn as mapVideoType
|