@d-id/client-sdk 1.1.36 → 1.1.37
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 +493 -491
- 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 ge = (e, t, i) => et(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
class Se extends Error {
|
|
5
5
|
constructor({ kind: i, description: n, error: s }) {
|
|
6
6
|
super(JSON.stringify({ kind: i, description: n }));
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
ge(this, "kind");
|
|
8
|
+
ge(this, "description");
|
|
9
|
+
ge(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 Se {
|
|
14
14
|
constructor(t, i) {
|
|
15
15
|
super({
|
|
16
16
|
kind: "ChatCreationFailed",
|
|
@@ -18,24 +18,24 @@ class tt extends Ce {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
class nt extends
|
|
21
|
+
class nt extends Se {
|
|
22
22
|
constructor(t) {
|
|
23
23
|
super({ kind: "ChatModeDowngraded", description: `Chat mode downgraded to ${t}` });
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class le extends Se {
|
|
27
27
|
constructor(i, n) {
|
|
28
28
|
super({ kind: "ValidationError", description: i });
|
|
29
|
-
|
|
29
|
+
ge(this, "key");
|
|
30
30
|
this.key = n;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
class rt extends
|
|
33
|
+
class rt extends Se {
|
|
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 || {}), X = /* @__PURE__ */ ((e) => (e.Embed = "embed", e.Query = "query", e.Partial = "partial", e.Answer = "answer", e.Transcribe = "transcribe", e.Complete = "done", e))(X || {}), 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 E = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(E || {}), re = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(re || {}), V = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Loading = "LOADING", e.Talking = "TALKING", e))(V || {}), 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))(L || {}), I = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnected = "disconnected", e))(I || {}), ie = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(ie || {}), ke = /* @__PURE__ */ ((e) => (e.Livekit = "livekit", e))(ke || {}), lt = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.AzureOpenAi = "azure-openai", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(lt || {}), mt = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(mt || {});
|
|
52
|
+
const ft = 45 * 1e3, gt = "X-Playground-Chat", pe = "https://api.d-id.com", ht = "wss://notifications.d-id.com", pt = "79f81a83a67430be2bc0fd61042b8faa", wt = (...e) => {
|
|
53
|
+
}, We = (e) => new Promise((t) => setTimeout(t, e)), me = (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 Ee(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 = me();
|
|
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 = me();
|
|
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) => Ee(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 = pe, 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 = he, i, n) {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function kt(e, t =
|
|
150
|
+
function kt(e, t = pe, 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 Mt = (e) => e.reduce((t, i) => t + i, 0), xe = (e) => Mt(e) / e.length;
|
|
230
|
+
function Et(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: me,
|
|
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 Ce = 100, $t = Math.max(Math.ceil(400 / Ce), 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, v = 0;
|
|
503
503
|
const x = Ft();
|
|
504
|
-
async function
|
|
505
|
-
const
|
|
506
|
-
if (!
|
|
504
|
+
async function b() {
|
|
505
|
+
const C = await e();
|
|
506
|
+
if (!C)
|
|
507
507
|
return;
|
|
508
|
-
const { isReceiving: R, avgJitterDelayInInterval: F, freezeCount:
|
|
508
|
+
const { isReceiving: R, avgJitterDelayInInterval: F, freezeCount: S } = x(C), W = jt(C);
|
|
509
509
|
if (R)
|
|
510
|
-
r = 0, u =
|
|
510
|
+
r = 0, u = S - v, w = F < Bt ? re.Strong : F > xt && u > 1 ? re.Weak : h, w !== h && (s == null || s(w), h = w, v += u, u = 0), d || (n == null || n(E.Start), a = c[c.length - 1], c = [], d = !0), c.push(W);
|
|
511
511
|
else if (d && (r++, r >= $t)) {
|
|
512
|
-
const
|
|
513
|
-
n == null || n(
|
|
512
|
+
const J = Ke(c, Ce, a);
|
|
513
|
+
n == null || n(E.Stop, J), t() || i(), v = S, d = !1;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
return {
|
|
517
517
|
start: () => {
|
|
518
|
-
o || (o = setInterval(
|
|
518
|
+
o || (o = setInterval(b, Ce));
|
|
519
519
|
},
|
|
520
520
|
stop: () => {
|
|
521
521
|
o && (clearInterval(o), o = null);
|
|
522
522
|
},
|
|
523
|
-
getReport: () => Ke(c,
|
|
523
|
+
getReport: () => Ke(c, Ce, a)
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
async function
|
|
526
|
+
async function Me() {
|
|
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
|
+
}, he = 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, I.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 Me(), { callbacks: a, auth: r, baseURL: d, analytics: h, microphoneStream: w } = i;
|
|
553
|
+
let u = null, v = !1;
|
|
554
554
|
const x = ie.Fluent;
|
|
555
|
-
let
|
|
555
|
+
let b = null, C = 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 S = null;
|
|
562
|
+
const W = 2e4;
|
|
563
|
+
let J = V.Idle;
|
|
564
|
+
const O = Pt(r, d || pe, e, a.onError);
|
|
565
|
+
let z, ee, te;
|
|
566
566
|
try {
|
|
567
|
-
const
|
|
568
|
-
transport_provider:
|
|
567
|
+
const m = await O.createStream({
|
|
568
|
+
transport_provider: ke.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: y, session_url: _ } = m;
|
|
571
|
+
($e = a.onStreamCreated) == null || $e.call(a, { session_id: g, stream_id: g, agent_id: e }), z = g, ee = y, te = _, await u.prepareConnection(te, ee);
|
|
572
|
+
} catch (m) {
|
|
573
|
+
_e(m, n, a);
|
|
574
574
|
}
|
|
575
|
-
if (!
|
|
575
|
+
if (!te || !ee || !z)
|
|
576
576
|
return Promise.reject(new Error("Failed to initialize LiveKit stream"));
|
|
577
|
-
u.on(o.ConnectionStateChanged,
|
|
578
|
-
function
|
|
579
|
-
var
|
|
580
|
-
g != null && g.isLocal && (ne.update(),
|
|
577
|
+
u.on(o.ConnectionStateChanged, D).on(o.ConnectionQualityChanged, k).on(o.ActiveSpeakersChanged, K).on(o.ParticipantConnected, P).on(o.ParticipantDisconnected, T).on(o.TrackSubscribed, N).on(o.TrackUnsubscribed, H).on(o.DataReceived, q).on(o.MediaDevicesError, j).on(o.TranscriptionReceived, l).on(o.EncryptionError, $).on(o.TrackSubscriptionFailed, Y);
|
|
578
|
+
function l(m, g) {
|
|
579
|
+
var y;
|
|
580
|
+
g != null && g.isLocal && (ne.update(), J === V.Talking && ((y = a.onInterruptDetected) == null || y.call(a, { type: "audio" }), J = V.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(te, ee), n("LiveKit room joined successfully"), S = setTimeout(() => {
|
|
584
|
+
var m;
|
|
585
|
+
n("Track subscription timeout - no track subscribed within 30 seconds after connect"), S = null, h.track("connectivity-error", {
|
|
586
586
|
error: "Track subscription timeout",
|
|
587
587
|
sessionId: z
|
|
588
|
-
}), (
|
|
589
|
-
},
|
|
590
|
-
} catch (
|
|
591
|
-
_e(
|
|
588
|
+
}), (m = a.onError) == null || m.call(a, new Error("Track subscription timeout"), { sessionId: z }), de();
|
|
589
|
+
}, W);
|
|
590
|
+
} catch (m) {
|
|
591
|
+
_e(m, 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 D(m) {
|
|
597
|
+
var g, y, _, A;
|
|
598
|
+
switch (n("Connection state changed:", m), m) {
|
|
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, I.Connecting);
|
|
601
601
|
break;
|
|
602
602
|
case c.Connected:
|
|
603
|
-
n("LiveKit room connected successfully"),
|
|
603
|
+
n("LiveKit room connected successfully"), v = !0;
|
|
604
604
|
break;
|
|
605
605
|
case c.Disconnected:
|
|
606
|
-
n("LiveKit room disconnected"),
|
|
606
|
+
n("LiveKit room disconnected"), v = !1, F = !1, (y = a.onConnectionStateChange) == null || y.call(a, I.Disconnected);
|
|
607
607
|
break;
|
|
608
608
|
case c.Reconnecting:
|
|
609
|
-
n("LiveKit room reconnecting..."), (
|
|
609
|
+
n("LiveKit room reconnecting..."), (_ = a.onConnectionStateChange) == null || _.call(a, I.Connecting);
|
|
610
610
|
break;
|
|
611
611
|
case c.SignalReconnecting:
|
|
612
|
-
n("LiveKit room signal reconnecting..."), (
|
|
612
|
+
n("LiveKit room signal reconnecting..."), (A = a.onConnectionStateChange) == null || A.call(a, I.Connecting);
|
|
613
613
|
break;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
618
|
-
n("Connection quality:",
|
|
616
|
+
function k(m, g) {
|
|
617
|
+
var y;
|
|
618
|
+
n("Connection quality:", m), g != null && g.isLocal && ((y = a.onConnectivityStateChange) == null || y.call(a, zt[m]));
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
n("Active speakers changed:",
|
|
620
|
+
function K(m) {
|
|
621
|
+
n("Active speakers changed:", m);
|
|
622
622
|
}
|
|
623
|
-
function
|
|
624
|
-
n("Participant connected:",
|
|
623
|
+
function P(m) {
|
|
624
|
+
n("Participant connected:", m.identity);
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
n("Participant disconnected:",
|
|
626
|
+
function T(m) {
|
|
627
|
+
n("Participant disconnected:", m.identity), de();
|
|
628
628
|
}
|
|
629
|
-
function
|
|
630
|
-
var
|
|
631
|
-
n(`Track subscribed: ${
|
|
632
|
-
const
|
|
633
|
-
if (!
|
|
634
|
-
n(`No mediaStreamTrack available for ${
|
|
629
|
+
function N(m, g, y) {
|
|
630
|
+
var A, Q, Z, ce;
|
|
631
|
+
n(`Track subscribed: ${m.kind} from ${y.identity}`), S && (clearTimeout(S), S = null, n("Track subscription timeout cleared"));
|
|
632
|
+
const _ = m.mediaStreamTrack;
|
|
633
|
+
if (!_) {
|
|
634
|
+
n(`No mediaStreamTrack available for ${m.kind}`);
|
|
635
635
|
return;
|
|
636
636
|
}
|
|
637
|
-
|
|
638
|
-
() =>
|
|
639
|
-
() =>
|
|
637
|
+
b ? (b.addTrack(_), n(`Added ${m.kind} track to shared MediaStream`)) : (b = new MediaStream([_]), n(`Created shared MediaStream with ${m.kind} track`)), m.kind === "video" && ((A = a.onStreamReady) == null || A.call(a), n("CALLBACK: onSrcObjectReady"), (Q = a.onSrcObjectReady) == null || Q.call(a, b), F || (F = !0, n("CALLBACK: onConnectionStateChange(Connected)"), (Z = a.onConnectionStateChange) == null || Z.call(a, I.Connected)), n("CALLBACK: onVideoStateChange(Start)"), (ce = a.onVideoStateChange) == null || ce.call(a, E.Start), R = Ge(
|
|
638
|
+
() => m.getRTCStatsReport(),
|
|
639
|
+
() => v,
|
|
640
640
|
wt,
|
|
641
|
-
(
|
|
642
|
-
n(`Video state change: ${
|
|
641
|
+
(ve, Re) => {
|
|
642
|
+
n(`Video state change: ${ve}`);
|
|
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 H(m, g, y) {
|
|
647
|
+
var _;
|
|
648
|
+
if (n(`Track unsubscribed: ${m.kind} from ${y.identity}`), m.kind === "video") {
|
|
649
|
+
const A = R == null ? void 0 : R.getReport();
|
|
650
|
+
R == null || R.stop(), R = null, (_ = a.onVideoStateChange) == null || _.call(a, E.Stop, A);
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
var
|
|
655
|
-
const
|
|
656
|
-
n("Data received:",
|
|
653
|
+
function q(m, g, y, _) {
|
|
654
|
+
var Q, Z, ce, ve, Re, Be;
|
|
655
|
+
const A = new TextDecoder().decode(m);
|
|
656
|
+
n("Data received:", A);
|
|
657
657
|
try {
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
const ae =
|
|
661
|
-
(
|
|
658
|
+
const U = JSON.parse(A), ue = _ || U.subject;
|
|
659
|
+
if (ue === L.ChatAnswer) {
|
|
660
|
+
const ae = X.Answer;
|
|
661
|
+
(Q = a.onMessage) == null || Q.call(a, ae, {
|
|
662
662
|
event: ae,
|
|
663
|
-
...
|
|
663
|
+
...U
|
|
664
664
|
});
|
|
665
|
-
} else if (
|
|
666
|
-
const ae =
|
|
667
|
-
(
|
|
665
|
+
} else if (ue === L.ChatPartial) {
|
|
666
|
+
const ae = X.Partial;
|
|
667
|
+
(Z = a.onMessage) == null || Z.call(a, ae, {
|
|
668
668
|
event: ae,
|
|
669
|
-
...
|
|
669
|
+
...U
|
|
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 ([L.StreamVideoCreated, L.StreamVideoDone].includes(ue)) {
|
|
672
|
+
J = ue === L.StreamVideoCreated ? V.Talking : V.Idle, (ce = a.onAgentActivityStateChange) == null || ce.call(a, J);
|
|
673
|
+
const fe = { [(U == null ? void 0 : U.role) || (g == null ? void 0 : g.identity) || "datachannel"]: U };
|
|
674
|
+
i.debug && ((ve = U == null ? void 0 : U.metadata) != null && ve.sentiment) && (fe.sentiment = {
|
|
675
|
+
id: U.metadata.sentiment.id,
|
|
676
|
+
name: U.metadata.sentiment.sentiment
|
|
677
|
+
}), (Re = a.onMessage) == null || Re.call(a, ue, fe);
|
|
678
|
+
} else if (ue === L.ChatAudioTranscribed) {
|
|
679
|
+
const ae = X.Transcribe;
|
|
680
680
|
(Be = a.onMessage) == null || Be.call(a, ae, {
|
|
681
681
|
event: ae,
|
|
682
|
-
...
|
|
682
|
+
...U
|
|
683
683
|
}), queueMicrotask(() => {
|
|
684
684
|
var fe;
|
|
685
|
-
(fe = a.onAgentActivityStateChange) == null || fe.call(a,
|
|
685
|
+
(fe = a.onAgentActivityStateChange) == null || fe.call(a, V.Loading);
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
|
-
} catch (
|
|
689
|
-
n("Failed to parse data channel message:",
|
|
688
|
+
} catch (U) {
|
|
689
|
+
n("Failed to parse data channel message:", U);
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function j(m) {
|
|
693
693
|
var g;
|
|
694
|
-
n("Media devices error:",
|
|
694
|
+
n("Media devices error:", m), (g = a.onError) == null || g.call(a, new Error(he), { sessionId: z });
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function $(m) {
|
|
697
697
|
var g;
|
|
698
|
-
n("Encryption error:",
|
|
698
|
+
n("Encryption error:", m), (g = a.onError) == null || g.call(a, new Error(he), { sessionId: z });
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
n("Track subscription failed:", { trackSid:
|
|
700
|
+
function Y(m, g, y) {
|
|
701
|
+
n("Track subscription failed:", { trackSid: m, participant: g, reason: y });
|
|
702
702
|
}
|
|
703
|
-
async function
|
|
703
|
+
async function oe(m) {
|
|
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 Me(), y = u.localParticipant.audioTrackPublications;
|
|
706
|
+
if (y) {
|
|
707
|
+
for (const [_, A] of y)
|
|
708
|
+
if (A.source === g.Source.Microphone && A.track) {
|
|
709
|
+
const Z = A.track.mediaStreamTrack;
|
|
710
|
+
if (Z === m || Z && Z.id === m.id)
|
|
711
|
+
return A;
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
714
|
return null;
|
|
715
715
|
}
|
|
716
|
-
function m
|
|
717
|
-
if (!
|
|
716
|
+
function p(m) {
|
|
717
|
+
if (!C || !C.track)
|
|
718
718
|
return !1;
|
|
719
|
-
const g =
|
|
720
|
-
return g !==
|
|
719
|
+
const g = C.track.mediaStreamTrack;
|
|
720
|
+
return g !== m && (g == null ? void 0 : g.id) !== m.id;
|
|
721
721
|
}
|
|
722
|
-
async function
|
|
723
|
-
var
|
|
724
|
-
if (!
|
|
722
|
+
async function f(m) {
|
|
723
|
+
var Q, Z;
|
|
724
|
+
if (!v || !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 = m.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 y = g[0], { Track: _ } = await Me(), A = await oe(y);
|
|
732
|
+
if (A) {
|
|
733
733
|
n("Microphone track is already published, skipping", {
|
|
734
|
-
trackId:
|
|
735
|
-
publishedTrackId: (
|
|
736
|
-
}),
|
|
734
|
+
trackId: y.id,
|
|
735
|
+
publishedTrackId: (Z = (Q = A.track) == null ? void 0 : Q.mediaStreamTrack) == null ? void 0 : Z.id
|
|
736
|
+
}), C = A;
|
|
737
737
|
return;
|
|
738
738
|
}
|
|
739
|
-
|
|
739
|
+
p(y) && (n("Unpublishing existing microphone track before publishing new one"), await M()), n("Publishing microphone track from provided MediaStream", { trackId: y.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
|
+
C = await u.localParticipant.publishTrack(y, {
|
|
742
|
+
source: _.Source.Microphone
|
|
743
|
+
}), n("Microphone track published successfully", { trackSid: C.trackSid });
|
|
744
|
+
} catch (ce) {
|
|
745
|
+
throw n("Failed to publish microphone track:", ce), ce;
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
|
-
async function
|
|
749
|
-
if (!(!
|
|
748
|
+
async function M() {
|
|
749
|
+
if (!(!C || !C.track))
|
|
750
750
|
try {
|
|
751
|
-
u && (await u.localParticipant.unpublishTrack(
|
|
752
|
-
} catch (
|
|
753
|
-
n("Error unpublishing microphone track:",
|
|
751
|
+
u && (await u.localParticipant.unpublishTrack(C.track), n("Microphone track unpublished"));
|
|
752
|
+
} catch (m) {
|
|
753
|
+
n("Error unpublishing microphone track:", m);
|
|
754
754
|
} finally {
|
|
755
|
-
|
|
755
|
+
C = null;
|
|
756
756
|
}
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
|
|
758
|
+
function G() {
|
|
759
|
+
b && (b.getTracks().forEach((m) => m.stop()), b = null);
|
|
760
760
|
}
|
|
761
|
-
async function
|
|
762
|
-
var
|
|
763
|
-
if (!
|
|
764
|
-
n("Room is not connected for sending messages"), (
|
|
761
|
+
async function se(m, g) {
|
|
762
|
+
var y, _;
|
|
763
|
+
if (!v || !u) {
|
|
764
|
+
n("Room is not connected for sending messages"), (y = a.onError) == null || y.call(a, new Error(he), {
|
|
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(m, { topic: g }), n("Message sent successfully:", m);
|
|
771
|
+
} catch (A) {
|
|
772
|
+
n("Failed to send message:", A), (_ = a.onError) == null || _.call(a, new Error(he), { sessionId: z });
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
async function
|
|
775
|
+
async function we(m) {
|
|
776
776
|
var g;
|
|
777
777
|
try {
|
|
778
|
-
const
|
|
779
|
-
return
|
|
780
|
-
} catch (
|
|
781
|
-
n("Failed to send data channel message:",
|
|
778
|
+
const _ = JSON.parse(m).topic;
|
|
779
|
+
return se("", _);
|
|
780
|
+
} catch (y) {
|
|
781
|
+
n("Failed to send data channel message:", y), (g = a.onError) == null || g.call(a, new Error(he), { sessionId: z });
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
return
|
|
786
|
-
|
|
784
|
+
function ye(m) {
|
|
785
|
+
return se(
|
|
786
|
+
m,
|
|
787
787
|
"lk.chat"
|
|
788
788
|
/* Chat */
|
|
789
789
|
);
|
|
790
790
|
}
|
|
791
|
-
async function
|
|
792
|
-
var
|
|
793
|
-
|
|
791
|
+
async function de() {
|
|
792
|
+
var m, g;
|
|
793
|
+
S && (clearTimeout(S), S = null), u && (await M(), await u.disconnect()), G(), v = !1, F = !1, (m = a.onConnectionStateChange) == null || m.call(a, I.Disconnected), (g = a.onAgentActivityStateChange) == null || g.call(a, V.Idle), J = V.Idle;
|
|
794
794
|
}
|
|
795
795
|
return {
|
|
796
|
-
speak(
|
|
797
|
-
const g = typeof
|
|
798
|
-
return
|
|
796
|
+
speak(m) {
|
|
797
|
+
const g = typeof m == "string" ? m : JSON.stringify(m);
|
|
798
|
+
return se(
|
|
799
799
|
g,
|
|
800
800
|
"did.speak"
|
|
801
801
|
/* Speak */
|
|
802
802
|
);
|
|
803
803
|
},
|
|
804
|
-
disconnect:
|
|
804
|
+
disconnect: de,
|
|
805
805
|
async reconnect() {
|
|
806
|
-
var
|
|
806
|
+
var m, 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 || !te || !ee)
|
|
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, (m = a.onConnectionStateChange) == null || m.call(a, I.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(te, ee), n("Room reconnected"), v = !0, u.remoteParticipants.size === 0) {
|
|
816
|
+
if (n("Waiting for agent to join..."), !await new Promise((_) => {
|
|
817
|
+
const A = setTimeout(() => {
|
|
818
|
+
u == null || u.off(o.ParticipantConnected, Q), _(!1);
|
|
819
|
+
}, 5e3), Q = () => {
|
|
820
|
+
clearTimeout(A), u == null || u.off(o.ParticipantConnected, Q), _(!0);
|
|
821
821
|
};
|
|
822
|
-
u == null || u.on(o.ParticipantConnected,
|
|
822
|
+
u == null || u.on(o.ParticipantConnected, Q);
|
|
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 (y) {
|
|
828
|
+
throw n("Failed to reconnect:", y), (g = a.onConnectionStateChange) == null || g.call(a, I.Fail), y;
|
|
829
829
|
}
|
|
830
830
|
},
|
|
831
|
-
sendDataChannelMessage:
|
|
832
|
-
sendTextMessage:
|
|
833
|
-
publishMicrophoneStream:
|
|
834
|
-
unpublishMicrophoneStream:
|
|
831
|
+
sendDataChannelMessage: we,
|
|
832
|
+
sendTextMessage: ye,
|
|
833
|
+
publishMicrophoneStream: f,
|
|
834
|
+
unpublishMicrophoneStream: M,
|
|
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: L.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 === X.Transcribe && t.content) {
|
|
941
941
|
Qt(t, n, s);
|
|
942
942
|
return;
|
|
943
943
|
}
|
|
944
|
-
if (!(e ===
|
|
944
|
+
if (!(e === X.Partial || e === X.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 === X.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 === X.Partial ? i[r] = a : i.answer = a;
|
|
961
961
|
const d = qt(i);
|
|
962
|
-
(c.content !== d || e ===
|
|
962
|
+
(c.content !== d || e === X.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 v = d === L.ChatAnswer ? X.Answer : d === L.ChatAudioTranscribed ? X.Transcribe : d;
|
|
978
|
+
Xt(v, h, o, t, r), v === X.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 v = L, x = [v.StreamVideoDone, v.StreamVideoError, v.StreamVideoRejected], b = [v.StreamFailed, v.StreamVideoError, v.StreamVideoRejected], C = Et(h, n, { mode: t.chatMode });
|
|
984
|
+
if (d = d, d === v.StreamVideoCreated && (e.linkTrack("agent-video", C, v.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
|
+
b.includes(d) ? e.track("agent-video", { ...C, event: R }) : e.linkTrack("agent-video", { ...C, event: R }, d, ["done"]);
|
|
994
994
|
}
|
|
995
|
-
|
|
995
|
+
b.includes(d) && ((u = (w = i.callbacks).onError) == null || u.call(w, new Error(`Stream failed with event ${d}`), { data: h })), h.event === v.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 I.Connected;
|
|
1042
1042
|
case "checking":
|
|
1043
|
-
return
|
|
1043
|
+
return I.Connecting;
|
|
1044
1044
|
case "failed":
|
|
1045
|
-
return
|
|
1045
|
+
return I.Fail;
|
|
1046
1046
|
case "new":
|
|
1047
|
-
return
|
|
1047
|
+
return I.New;
|
|
1048
1048
|
case "closed":
|
|
1049
|
-
return
|
|
1049
|
+
return I.Closed;
|
|
1050
1050
|
case "disconnected":
|
|
1051
|
-
return
|
|
1051
|
+
return I.Disconnected;
|
|
1052
1052
|
case "completed":
|
|
1053
|
-
return
|
|
1053
|
+
return I.Completed;
|
|
1054
1054
|
default:
|
|
1055
|
-
return
|
|
1055
|
+
return I.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 === E.Start && t === E.Start ? (s("CALLBACK: onVideoStateChange(Start)"), i == null || i(E.Start)) : e === E.Stop && t === E.Stop && (s("CALLBACK: onVideoStateChange(Stop)"), i == null || i(E.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 === E.Start ? (o("CALLBACK: onVideoStateChange(Start)"), i == null || i(E.Start)) : e === E.Stop && (o("CALLBACK: onVideoStateChange(Stop)"), i == null || i(E.Stop, s)), t === E.Start ? n == null || n(V.Talking) : t === E.Stop && (n == null || n(V.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 = pe, analytics: c }, a) {
|
|
1105
|
+
var oe;
|
|
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 = E.Stop, v = E.Stop;
|
|
1108
|
+
const { startConnection: x, sendStreamRequest: b, close: C, 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: S,
|
|
1115
|
+
offer: W,
|
|
1116
|
+
ice_servers: J,
|
|
1117
|
+
session_id: O,
|
|
1118
1118
|
fluent: z,
|
|
1119
|
-
interrupt_enabled:
|
|
1120
|
-
triggers_enabled:
|
|
1119
|
+
interrupt_enabled: ee,
|
|
1120
|
+
triggers_enabled: te
|
|
1121
1121
|
} = await R(t, a);
|
|
1122
|
-
(
|
|
1123
|
-
const
|
|
1124
|
-
if (!
|
|
1122
|
+
(oe = n.onStreamCreated) == null || oe.call(n, { stream_id: S, session_id: O, agent_id: e });
|
|
1123
|
+
const l = new Zt({ iceServers: J }), D = l.createDataChannel("JanusDataChannel");
|
|
1124
|
+
if (!O)
|
|
1125
1125
|
throw new Error("Could not create session_id");
|
|
1126
|
-
const
|
|
1126
|
+
const k = z ? ie.Fluent : ie.Legacy;
|
|
1127
1127
|
c.enrich({
|
|
1128
|
-
"stream-type":
|
|
1128
|
+
"stream-type": k
|
|
1129
1129
|
});
|
|
1130
|
-
const
|
|
1131
|
-
var
|
|
1132
|
-
h = !0, w && (r("CALLBACK: onConnectionStateChange(Connected)"), (
|
|
1133
|
-
},
|
|
1134
|
-
() =>
|
|
1130
|
+
const K = t.stream_warmup && !z, P = () => h, T = () => {
|
|
1131
|
+
var p;
|
|
1132
|
+
h = !0, w && (r("CALLBACK: onConnectionStateChange(Connected)"), (p = n.onConnectionStateChange) == null || p.call(n, I.Connected));
|
|
1133
|
+
}, N = Ge(
|
|
1134
|
+
() => l.getStats(),
|
|
1135
|
+
P,
|
|
1135
1136
|
T,
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
dataChannelSignal: A === ie.Legacy ? u : void 0,
|
|
1137
|
+
(p, f) => Je({
|
|
1138
|
+
statsSignal: v = p,
|
|
1139
|
+
dataChannelSignal: k === ie.Legacy ? u : void 0,
|
|
1140
1140
|
onVideoStateChange: n.onVideoStateChange,
|
|
1141
1141
|
onAgentActivityStateChange: n.onAgentActivityStateChange,
|
|
1142
|
-
report:
|
|
1143
|
-
streamType:
|
|
1142
|
+
report: f,
|
|
1143
|
+
streamType: k,
|
|
1144
1144
|
log: r
|
|
1145
1145
|
}),
|
|
1146
|
-
(
|
|
1147
|
-
var
|
|
1148
|
-
return (
|
|
1146
|
+
(p) => {
|
|
1147
|
+
var f;
|
|
1148
|
+
return (f = n.onConnectivityStateChange) == null ? void 0 : f.call(n, p);
|
|
1149
1149
|
}
|
|
1150
1150
|
);
|
|
1151
|
-
|
|
1152
|
-
var
|
|
1153
|
-
r("peerConnection.onicecandidate",
|
|
1151
|
+
N.start(), l.onicecandidate = (p) => {
|
|
1152
|
+
var f;
|
|
1153
|
+
r("peerConnection.onicecandidate", p);
|
|
1154
1154
|
try {
|
|
1155
|
-
|
|
1156
|
-
|
|
1155
|
+
p.candidate && p.candidate.sdpMid && p.candidate.sdpMLineIndex !== null ? F(
|
|
1156
|
+
S,
|
|
1157
1157
|
{
|
|
1158
|
-
candidate:
|
|
1159
|
-
sdpMid:
|
|
1160
|
-
sdpMLineIndex:
|
|
1158
|
+
candidate: p.candidate.candidate,
|
|
1159
|
+
sdpMid: p.candidate.sdpMid,
|
|
1160
|
+
sdpMLineIndex: p.candidate.sdpMLineIndex
|
|
1161
1161
|
},
|
|
1162
|
-
|
|
1162
|
+
O,
|
|
1163
1163
|
a
|
|
1164
|
-
) : F(
|
|
1165
|
-
} catch (
|
|
1166
|
-
(
|
|
1164
|
+
) : F(S, { candidate: null }, O, a);
|
|
1165
|
+
} catch (M) {
|
|
1166
|
+
(f = n.onError) == null || f.call(n, M, { streamId: S });
|
|
1167
1167
|
}
|
|
1168
|
-
},
|
|
1169
|
-
w = !0, (!
|
|
1168
|
+
}, D.onopen = () => {
|
|
1169
|
+
w = !0, (!K || h) && T();
|
|
1170
1170
|
};
|
|
1171
|
-
const
|
|
1172
|
-
var
|
|
1173
|
-
(
|
|
1171
|
+
const H = (p) => {
|
|
1172
|
+
var f;
|
|
1173
|
+
(f = n.onVideoIdChange) == null || f.call(n, p);
|
|
1174
1174
|
};
|
|
1175
|
-
function
|
|
1176
|
-
if (
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1175
|
+
function q(p, f) {
|
|
1176
|
+
if (p === L.StreamStarted && typeof f == "object" && "metadata" in f) {
|
|
1177
|
+
const M = f.metadata;
|
|
1178
|
+
H(M.videoId);
|
|
1179
1179
|
}
|
|
1180
|
-
|
|
1181
|
-
statsSignal:
|
|
1180
|
+
p === L.StreamDone && H(null), u = p === L.StreamStarted ? E.Start : E.Stop, Je({
|
|
1181
|
+
statsSignal: k === ie.Legacy ? v : void 0,
|
|
1182
1182
|
dataChannelSignal: u,
|
|
1183
1183
|
onVideoStateChange: n.onVideoStateChange,
|
|
1184
1184
|
onAgentActivityStateChange: n.onAgentActivityStateChange,
|
|
1185
|
-
streamType:
|
|
1185
|
+
streamType: k,
|
|
1186
1186
|
log: r
|
|
1187
1187
|
});
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1190
|
-
var
|
|
1191
|
-
const
|
|
1192
|
-
|
|
1189
|
+
function j(p, f) {
|
|
1190
|
+
var G;
|
|
1191
|
+
const M = typeof f == "string" ? f : f == null ? void 0 : f.metadata;
|
|
1192
|
+
M && c.enrich({ streamMetadata: M }), (G = n.onStreamReady) == null || G.call(n);
|
|
1193
1193
|
}
|
|
1194
|
-
const
|
|
1195
|
-
[
|
|
1196
|
-
[
|
|
1197
|
-
[
|
|
1194
|
+
const $ = {
|
|
1195
|
+
[L.StreamStarted]: q,
|
|
1196
|
+
[L.StreamDone]: q,
|
|
1197
|
+
[L.StreamReady]: j
|
|
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
|
+
D.onmessage = (p) => {
|
|
1200
|
+
var G;
|
|
1201
|
+
const { subject: f, data: M } = d(p.data);
|
|
1202
|
+
(G = $[f]) == null || G.call($, f, M);
|
|
1203
|
+
}, l.oniceconnectionstatechange = () => {
|
|
1204
|
+
var f;
|
|
1205
|
+
r("peerConnection.oniceconnectionstatechange => " + l.iceConnectionState);
|
|
1206
|
+
const p = Ne(l.iceConnectionState);
|
|
1207
|
+
p !== I.Connected && ((f = n.onConnectionStateChange) == null || f.call(n, p));
|
|
1208
|
+
}, l.ontrack = (p) => {
|
|
1209
|
+
var f;
|
|
1210
|
+
r("peerConnection.ontrack", p), r("CALLBACK: onSrcObjectReady"), (f = n.onSrcObjectReady) == null || f.call(n, p.streams[0]);
|
|
1211
|
+
}, await l.setRemoteDescription(W), r("set remote description OK");
|
|
1212
|
+
const Y = await l.createAnswer();
|
|
1213
|
+
return r("create answer OK"), await l.setLocalDescription(Y), r("set local description OK"), await x(S, Y, O, 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(p) {
|
|
1219
|
+
return b(S, O, p);
|
|
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 p;
|
|
1226
|
+
if (S) {
|
|
1227
|
+
const f = Ne(l.iceConnectionState);
|
|
1228
|
+
if (l) {
|
|
1229
|
+
if (f === I.New) {
|
|
1230
|
+
N.stop();
|
|
1231
1231
|
return;
|
|
1232
1232
|
}
|
|
1233
|
-
|
|
1233
|
+
l.close(), l.oniceconnectionstatechange = null, l.onnegotiationneeded = null, l.onicecandidate = null, l.ontrack = null;
|
|
1234
1234
|
}
|
|
1235
1235
|
try {
|
|
1236
|
-
|
|
1236
|
+
f === I.Connected && await C(S, O).catch((M) => {
|
|
1237
1237
|
});
|
|
1238
|
-
} catch (
|
|
1239
|
-
r("Error on close stream connection",
|
|
1238
|
+
} catch (M) {
|
|
1239
|
+
r("Error on close stream connection", M);
|
|
1240
1240
|
}
|
|
1241
|
-
(
|
|
1241
|
+
(p = n.onAgentActivityStateChange) == null || p.call(n, V.Idle), N.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(p) {
|
|
1248
|
+
var f, M;
|
|
1249
|
+
if (!h || D.readyState !== "open") {
|
|
1250
|
+
r("Data channel is not ready for sending messages"), (f = n.onError) == null || f.call(n, new Error("Data channel is not ready for sending messages"), {
|
|
1251
|
+
streamId: S
|
|
1252
1252
|
});
|
|
1253
1253
|
return;
|
|
1254
1254
|
}
|
|
1255
1255
|
try {
|
|
1256
|
-
|
|
1257
|
-
} catch (
|
|
1258
|
-
r("Error sending data channel message",
|
|
1256
|
+
D.send(p);
|
|
1257
|
+
} catch (G) {
|
|
1258
|
+
r("Error sending data channel message", G), (M = n.onError) == null || M.call(n, G, { streamId: S });
|
|
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: O,
|
|
1265
1265
|
/**
|
|
1266
1266
|
* Id of current RTC stream
|
|
1267
1267
|
*/
|
|
1268
|
-
streamId:
|
|
1269
|
-
streamType:
|
|
1270
|
-
interruptAvailable:
|
|
1271
|
-
triggersAvailable:
|
|
1268
|
+
streamId: S,
|
|
1269
|
+
streamType: k,
|
|
1270
|
+
interruptAvailable: ee ?? !1,
|
|
1271
|
+
triggersAvailable: te ?? !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 ke.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: ke.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) : fn(e, t, i, n, s);
|
|
1320
1320
|
}
|
|
1321
1321
|
function ln(e, t, i, n, s) {
|
|
1322
|
-
e ===
|
|
1322
|
+
e === E.Start ? n.track("stream-session", { event: "start", "stream-type": s }) : e === E.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 mn(e, t, i, n) {
|
|
1331
|
+
ne.get() <= 0 || (e === E.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
|
+
[L.StreamVideoCreated]
|
|
1336
|
+
) : e === E.Stop && i.linkTrack(
|
|
1337
1337
|
"agent-video",
|
|
1338
1338
|
{
|
|
1339
1339
|
event: "stop",
|
|
@@ -1342,16 +1342,16 @@ function fn(e, t, i, n) {
|
|
|
1342
1342
|
"stream-type": n
|
|
1343
1343
|
},
|
|
1344
1344
|
"done",
|
|
1345
|
-
[
|
|
1345
|
+
[L.StreamVideoDone]
|
|
1346
1346
|
));
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1349
|
-
ne.get() <= 0 || (e ===
|
|
1348
|
+
function fn(e, t, i, n, s) {
|
|
1349
|
+
ne.get() <= 0 || (e === E.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
|
+
[L.StreamVideoCreated]
|
|
1354
|
+
) : e === E.Stop && n.linkTrack(
|
|
1355
1355
|
"agent-video",
|
|
1356
1356
|
{
|
|
1357
1357
|
event: "stop",
|
|
@@ -1361,7 +1361,7 @@ function mn(e, t, i, n, s) {
|
|
|
1361
1361
|
...i
|
|
1362
1362
|
},
|
|
1363
1363
|
"done",
|
|
1364
|
-
[
|
|
1364
|
+
[L.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 === I.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 === V.Talking ? Te.update() : Te.reset(), mn(
|
|
1399
|
+
d === V.Talking ? E.Start : E.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, v;
|
|
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), b = `${on}_${x.sessionId}`, C = (/* @__PURE__ */ new Date()).toISOString();
|
|
1423
1423
|
return { chatResult: {
|
|
1424
1424
|
chatMode: B.Functional,
|
|
1425
1425
|
chat: {
|
|
1426
|
-
id:
|
|
1426
|
+
id: b,
|
|
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: C,
|
|
1430
|
+
modified: C,
|
|
1431
|
+
agent_id__created_at: C,
|
|
1432
|
+
agent_id__modified_at: C,
|
|
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(), b = x.signal;
|
|
1439
|
+
let C;
|
|
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, b).then((J) => (C = J, J)), [S, W] = await Promise.all([R, F]);
|
|
1449
|
+
return { chatResult: S, streamingManager: W };
|
|
1450
1450
|
} catch (R) {
|
|
1451
|
-
throw x.abort(),
|
|
1451
|
+
throw x.abort(), C && await C.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) ? ((v = (u = t.callbacks).onError) == null || v.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 O, z, ee, 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 || pe, a = t.mode || B.Functional, r = {
|
|
1462
1462
|
messages: [],
|
|
1463
1463
|
chatMode: a
|
|
1464
1464
|
}, d = Tt({
|
|
@@ -1471,42 +1471,44 @@ 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)
|
|
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);
|
|
1475
1477
|
d.enrich(Dt(u));
|
|
1476
|
-
const { onMessage: x, clearQueue:
|
|
1478
|
+
const { onMessage: x, clearQueue: b } = Yt(
|
|
1477
1479
|
d,
|
|
1478
1480
|
r,
|
|
1479
1481
|
t,
|
|
1480
1482
|
u,
|
|
1481
1483
|
() => {
|
|
1482
|
-
var
|
|
1483
|
-
return (
|
|
1484
|
+
var l;
|
|
1485
|
+
return (l = r.socketManager) == null ? void 0 : l.disconnect();
|
|
1484
1486
|
}
|
|
1485
1487
|
);
|
|
1486
|
-
r.messages = At(t.initialMessages), (
|
|
1487
|
-
const
|
|
1488
|
-
n =
|
|
1489
|
-
}, R = ({ type:
|
|
1490
|
-
var
|
|
1491
|
-
const
|
|
1488
|
+
r.messages = At(t.initialMessages), (ee = (z = t.callbacks).onNewMessage) == null || ee.call(z, [...r.messages], "answer");
|
|
1489
|
+
const C = (l) => {
|
|
1490
|
+
n = l;
|
|
1491
|
+
}, R = ({ type: l }) => {
|
|
1492
|
+
var k, K, P;
|
|
1493
|
+
const D = r.messages[r.messages.length - 1];
|
|
1492
1494
|
d.track("agent-video-interrupt", {
|
|
1493
|
-
type:
|
|
1495
|
+
type: l || "click",
|
|
1494
1496
|
video_duration_to_interrupt: Te.get(!0),
|
|
1495
1497
|
message_duration_to_interrupt: ne.get(!0)
|
|
1496
|
-
}),
|
|
1498
|
+
}), D.interrupted = !0, (K = (k = t.callbacks).onNewMessage) == null || K.call(k, [...r.messages], "answer"), v ? Vt(r.streamingManager) : (Jt(r.streamingManager, (P = r.streamingManager) == null ? void 0 : P.streamType, n), Ut(r.streamingManager, n));
|
|
1497
1499
|
}, F = Date.now();
|
|
1498
1500
|
Fe(() => {
|
|
1499
1501
|
d.track("agent-sdk", { event: "loaded", ...Rt(u) }, F);
|
|
1500
1502
|
});
|
|
1501
|
-
async function
|
|
1502
|
-
var
|
|
1503
|
-
(
|
|
1504
|
-
const
|
|
1503
|
+
async function S(l) {
|
|
1504
|
+
var N, H, q, j, $, Y, oe;
|
|
1505
|
+
(H = (N = t.callbacks).onConnectionStateChange) == null || H.call(N, I.Connecting), ne.reset(), l && !i && (delete r.chat, (j = (q = t.callbacks).onNewMessage) == null || j.call(q, [...r.messages], "answer"));
|
|
1506
|
+
const D = a === B.DirectPlayback || v ? Promise.resolve(void 0) : Ht(
|
|
1505
1507
|
t.auth,
|
|
1506
1508
|
o,
|
|
1507
1509
|
{ onMessage: x, onError: t.callbacks.onError },
|
|
1508
1510
|
t.externalId
|
|
1509
|
-
),
|
|
1511
|
+
), k = Ee(
|
|
1510
1512
|
() => gn(
|
|
1511
1513
|
u,
|
|
1512
1514
|
{
|
|
@@ -1514,7 +1516,7 @@ async function wn(e, t) {
|
|
|
1514
1516
|
mode: a,
|
|
1515
1517
|
callbacks: {
|
|
1516
1518
|
...t.callbacks,
|
|
1517
|
-
onVideoIdChange:
|
|
1519
|
+
onVideoIdChange: C,
|
|
1518
1520
|
onMessage: x,
|
|
1519
1521
|
onInterruptDetected: R
|
|
1520
1522
|
}
|
|
@@ -1525,108 +1527,108 @@ async function wn(e, t) {
|
|
|
1525
1527
|
),
|
|
1526
1528
|
{
|
|
1527
1529
|
limit: 3,
|
|
1528
|
-
timeout:
|
|
1530
|
+
timeout: ft,
|
|
1529
1531
|
timeoutErrorMessage: "Timeout initializing the stream",
|
|
1530
|
-
shouldRetryFn: (
|
|
1532
|
+
shouldRetryFn: (p) => (p == null ? void 0 : p.message) !== "Could not connect" && p.status !== 429 && (p == null ? void 0 : p.message) !== "InsufficientCreditsError",
|
|
1531
1533
|
delayMs: 1e3
|
|
1532
1534
|
}
|
|
1533
|
-
).catch((
|
|
1534
|
-
var
|
|
1535
|
-
throw
|
|
1536
|
-
}), [
|
|
1537
|
-
T && T.id !== ((
|
|
1535
|
+
).catch((p) => {
|
|
1536
|
+
var f, M;
|
|
1537
|
+
throw J(B.Maintenance), (M = (f = t.callbacks).onConnectionStateChange) == null || M.call(f, I.Fail), p;
|
|
1538
|
+
}), [K, { streamingManager: P, chat: T }] = await Promise.all([D, k]);
|
|
1539
|
+
T && T.id !== (($ = r.chat) == null ? void 0 : $.id) && ((oe = (Y = t.callbacks).onNewChat) == null || oe.call(Y, T.id)), r.streamingManager = P, r.socketManager = K, r.chat = T, i = !1, d.enrich({
|
|
1538
1540
|
chatId: T == null ? void 0 : T.id,
|
|
1539
1541
|
streamId: P == null ? void 0 : P.streamId,
|
|
1540
1542
|
mode: r.chatMode
|
|
1541
|
-
}),
|
|
1543
|
+
}), J((T == null ? void 0 : T.chat_mode) ?? a);
|
|
1542
1544
|
}
|
|
1543
|
-
async function
|
|
1544
|
-
var
|
|
1545
|
-
(
|
|
1545
|
+
async function W() {
|
|
1546
|
+
var l, D, k, K;
|
|
1547
|
+
(l = r.socketManager) == null || l.disconnect(), await ((D = r.streamingManager) == null ? void 0 : D.disconnect()), delete r.streamingManager, delete r.socketManager, (K = (k = t.callbacks).onConnectionStateChange) == null || K.call(k, I.Disconnected);
|
|
1546
1548
|
}
|
|
1547
|
-
async function
|
|
1548
|
-
var
|
|
1549
|
-
|
|
1549
|
+
async function J(l) {
|
|
1550
|
+
var D, k;
|
|
1551
|
+
l !== r.chatMode && (d.track("agent-mode-change", { mode: l }), r.chatMode = l, r.chatMode !== B.Functional && await W(), (k = (D = t.callbacks).onModeChange) == null || k.call(D, l));
|
|
1550
1552
|
}
|
|
1551
1553
|
return {
|
|
1552
1554
|
agent: u,
|
|
1553
1555
|
getStreamType: () => {
|
|
1554
|
-
var
|
|
1555
|
-
return (
|
|
1556
|
+
var l;
|
|
1557
|
+
return (l = r.streamingManager) == null ? void 0 : l.streamType;
|
|
1556
1558
|
},
|
|
1557
1559
|
getIsInterruptAvailable: () => {
|
|
1558
|
-
var
|
|
1559
|
-
return ((
|
|
1560
|
+
var l;
|
|
1561
|
+
return ((l = r.streamingManager) == null ? void 0 : l.interruptAvailable) ?? !1;
|
|
1560
1562
|
},
|
|
1561
1563
|
getIsTriggersAvailable: () => {
|
|
1562
|
-
var
|
|
1563
|
-
return ((
|
|
1564
|
+
var l;
|
|
1565
|
+
return ((l = r.streamingManager) == null ? void 0 : l.triggersAvailable) ?? !1;
|
|
1564
1566
|
},
|
|
1565
1567
|
starterMessages: ((te = u.knowledge) == null ? void 0 : te.starter_message) || [],
|
|
1566
1568
|
getSTTToken: () => w.getSTTToken(u.id),
|
|
1567
|
-
changeMode:
|
|
1569
|
+
changeMode: J,
|
|
1568
1570
|
enrichAnalytics: d.enrich,
|
|
1569
1571
|
async connect() {
|
|
1570
|
-
await
|
|
1572
|
+
await S(!0), d.track("agent-chat", {
|
|
1571
1573
|
event: "connect",
|
|
1572
1574
|
mode: r.chatMode
|
|
1573
1575
|
});
|
|
1574
1576
|
},
|
|
1575
1577
|
async reconnect() {
|
|
1576
|
-
const
|
|
1577
|
-
if (
|
|
1578
|
+
const l = r.streamingManager;
|
|
1579
|
+
if (v && (l != null && l.reconnect)) {
|
|
1578
1580
|
try {
|
|
1579
|
-
await
|
|
1581
|
+
await l.reconnect(), d.track("agent-chat", {
|
|
1580
1582
|
event: "reconnect",
|
|
1581
1583
|
mode: r.chatMode
|
|
1582
1584
|
});
|
|
1583
1585
|
} catch {
|
|
1584
|
-
await
|
|
1586
|
+
await W(), await S(!1);
|
|
1585
1587
|
}
|
|
1586
1588
|
return;
|
|
1587
1589
|
}
|
|
1588
|
-
await
|
|
1590
|
+
await W(), await S(!1), d.track("agent-chat", {
|
|
1589
1591
|
event: "reconnect",
|
|
1590
1592
|
mode: r.chatMode
|
|
1591
1593
|
});
|
|
1592
1594
|
},
|
|
1593
1595
|
async disconnect() {
|
|
1594
|
-
await
|
|
1596
|
+
await W(), d.track("agent-chat", {
|
|
1595
1597
|
event: "disconnect",
|
|
1596
1598
|
mode: r.chatMode
|
|
1597
1599
|
});
|
|
1598
1600
|
},
|
|
1599
|
-
async publishMicrophoneStream(
|
|
1600
|
-
var
|
|
1601
|
-
if (!((
|
|
1601
|
+
async publishMicrophoneStream(l) {
|
|
1602
|
+
var D;
|
|
1603
|
+
if (!((D = r.streamingManager) != null && D.publishMicrophoneStream))
|
|
1602
1604
|
throw new Error("publishMicrophoneStream is not available for this streaming manager");
|
|
1603
|
-
return r.streamingManager.publishMicrophoneStream(
|
|
1605
|
+
return r.streamingManager.publishMicrophoneStream(l);
|
|
1604
1606
|
},
|
|
1605
1607
|
async unpublishMicrophoneStream() {
|
|
1606
|
-
var
|
|
1607
|
-
if (!((
|
|
1608
|
+
var l;
|
|
1609
|
+
if (!((l = r.streamingManager) != null && l.unpublishMicrophoneStream))
|
|
1608
1610
|
throw new Error("unpublishMicrophoneStream is not available for this streaming manager");
|
|
1609
1611
|
return r.streamingManager.unpublishMicrophoneStream();
|
|
1610
1612
|
},
|
|
1611
|
-
async chat(
|
|
1612
|
-
var P, T,
|
|
1613
|
-
const
|
|
1613
|
+
async chat(l) {
|
|
1614
|
+
var P, T, N, H, q;
|
|
1615
|
+
const D = () => {
|
|
1614
1616
|
if (He(a))
|
|
1615
|
-
throw new
|
|
1616
|
-
if (
|
|
1617
|
-
throw new
|
|
1618
|
-
if (
|
|
1619
|
-
throw new
|
|
1617
|
+
throw new le(`${a} is enabled, chat is disabled`);
|
|
1618
|
+
if (l.length >= 800)
|
|
1619
|
+
throw new le("Message cannot be more than 800 characters");
|
|
1620
|
+
if (l.length === 0)
|
|
1621
|
+
throw new le("Message cannot be empty");
|
|
1620
1622
|
if (r.chatMode === B.Maintenance)
|
|
1621
|
-
throw new
|
|
1623
|
+
throw new le("Chat is in maintenance mode");
|
|
1622
1624
|
if (![B.TextOnly, B.Playground].includes(r.chatMode)) {
|
|
1623
1625
|
if (!r.streamingManager)
|
|
1624
|
-
throw new
|
|
1626
|
+
throw new le("Streaming manager is not initialized");
|
|
1625
1627
|
if (!r.chat)
|
|
1626
|
-
throw new
|
|
1628
|
+
throw new le("Chat is not initialized");
|
|
1627
1629
|
}
|
|
1628
|
-
},
|
|
1629
|
-
var
|
|
1630
|
+
}, k = async () => {
|
|
1631
|
+
var j, $;
|
|
1630
1632
|
if (!r.chat) {
|
|
1631
1633
|
const Y = await Xe(
|
|
1632
1634
|
u,
|
|
@@ -1637,24 +1639,24 @@ async function wn(e, t) {
|
|
|
1637
1639
|
);
|
|
1638
1640
|
if (!Y.chat)
|
|
1639
1641
|
throw new tt(r.chatMode, !!t.persistentChat);
|
|
1640
|
-
r.chat = Y.chat, (
|
|
1642
|
+
r.chat = Y.chat, ($ = (j = t.callbacks).onNewChat) == null || $.call(j, r.chat.id);
|
|
1641
1643
|
}
|
|
1642
1644
|
return r.chat.id;
|
|
1643
|
-
},
|
|
1645
|
+
}, K = async (j, $) => {
|
|
1644
1646
|
const Y = r.chatMode === B.Playground;
|
|
1645
|
-
return
|
|
1646
|
-
var
|
|
1647
|
-
return await ((
|
|
1647
|
+
return Ee(v && !Y ? async () => {
|
|
1648
|
+
var f, M;
|
|
1649
|
+
return await ((M = (f = r.streamingManager) == null ? void 0 : f.sendTextMessage) == null ? void 0 : M.call(f, l)), Promise.resolve({});
|
|
1648
1650
|
} : async () => {
|
|
1649
|
-
var
|
|
1651
|
+
var f, M;
|
|
1650
1652
|
return w.chat(
|
|
1651
1653
|
u.id,
|
|
1652
|
-
|
|
1654
|
+
$,
|
|
1653
1655
|
{
|
|
1654
1656
|
chatMode: r.chatMode,
|
|
1655
|
-
streamId: (
|
|
1656
|
-
sessionId: (
|
|
1657
|
-
messages:
|
|
1657
|
+
streamId: (f = r.streamingManager) == null ? void 0 : f.streamId,
|
|
1658
|
+
sessionId: (M = r.streamingManager) == null ? void 0 : M.sessionId,
|
|
1659
|
+
messages: j.map(({ matches: G, ...se }) => se)
|
|
1658
1660
|
},
|
|
1659
1661
|
{
|
|
1660
1662
|
...Qe(r.chatMode),
|
|
@@ -1663,106 +1665,106 @@ async function wn(e, t) {
|
|
|
1663
1665
|
);
|
|
1664
1666
|
}, {
|
|
1665
1667
|
limit: 2,
|
|
1666
|
-
shouldRetryFn: (
|
|
1667
|
-
var
|
|
1668
|
-
const
|
|
1669
|
-
return !((
|
|
1668
|
+
shouldRetryFn: (f) => {
|
|
1669
|
+
var se, we, ye, de;
|
|
1670
|
+
const M = (se = f == null ? void 0 : f.message) == null ? void 0 : se.includes("missing or invalid session_id");
|
|
1671
|
+
return !((we = f == null ? void 0 : f.message) == null ? void 0 : we.includes("Stream Error")) && !M ? ((de = (ye = t.callbacks).onError) == null || de.call(ye, f), !1) : !0;
|
|
1670
1672
|
},
|
|
1671
1673
|
onRetry: async () => {
|
|
1672
|
-
await
|
|
1674
|
+
await W(), await S(!1);
|
|
1673
1675
|
}
|
|
1674
1676
|
});
|
|
1675
1677
|
};
|
|
1676
1678
|
try {
|
|
1677
|
-
|
|
1678
|
-
id:
|
|
1679
|
+
b(), D(), r.messages.push({
|
|
1680
|
+
id: me(),
|
|
1679
1681
|
role: "user",
|
|
1680
|
-
content:
|
|
1682
|
+
content: l,
|
|
1681
1683
|
created_at: new Date(ne.update()).toISOString()
|
|
1682
1684
|
}), (T = (P = t.callbacks).onNewMessage) == null || T.call(P, [...r.messages], "user");
|
|
1683
|
-
const
|
|
1685
|
+
const j = await k(), $ = await K([...r.messages], j);
|
|
1684
1686
|
return r.messages.push({
|
|
1685
|
-
id:
|
|
1687
|
+
id: me(),
|
|
1686
1688
|
role: "assistant",
|
|
1687
|
-
content:
|
|
1689
|
+
content: $.result || "",
|
|
1688
1690
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1689
|
-
context:
|
|
1690
|
-
matches:
|
|
1691
|
+
context: $.context,
|
|
1692
|
+
matches: $.matches
|
|
1691
1693
|
}), d.track("agent-message-send", {
|
|
1692
1694
|
event: "success",
|
|
1693
1695
|
messages: r.messages.length + 1
|
|
1694
|
-
}),
|
|
1696
|
+
}), $.result && ((H = (N = t.callbacks).onNewMessage) == null || H.call(N, [...r.messages], "answer"), d.track("agent-message-received", {
|
|
1695
1697
|
latency: ne.get(!0),
|
|
1696
1698
|
messages: r.messages.length
|
|
1697
|
-
})),
|
|
1698
|
-
} catch (
|
|
1699
|
-
throw ((
|
|
1699
|
+
})), $;
|
|
1700
|
+
} catch (j) {
|
|
1701
|
+
throw ((q = r.messages[r.messages.length - 1]) == null ? void 0 : q.role) === "assistant" && r.messages.pop(), d.track("agent-message-send", {
|
|
1700
1702
|
event: "error",
|
|
1701
1703
|
messages: r.messages.length
|
|
1702
|
-
}),
|
|
1704
|
+
}), j;
|
|
1703
1705
|
}
|
|
1704
1706
|
},
|
|
1705
|
-
rate(
|
|
1706
|
-
var T,
|
|
1707
|
-
const
|
|
1707
|
+
rate(l, D, k) {
|
|
1708
|
+
var T, N, H, q;
|
|
1709
|
+
const K = r.messages.find((j) => j.id === l);
|
|
1708
1710
|
if (r.chat) {
|
|
1709
|
-
if (!
|
|
1711
|
+
if (!K)
|
|
1710
1712
|
throw new Error("Message not found");
|
|
1711
1713
|
} else throw new Error("Chat is not initialized");
|
|
1712
|
-
const P = ((T =
|
|
1714
|
+
const P = ((T = K.matches) == null ? void 0 : T.map((j) => [j.document_id, j.id])) ?? [];
|
|
1713
1715
|
return d.track("agent-rate", {
|
|
1714
|
-
event:
|
|
1715
|
-
thumb:
|
|
1716
|
-
knowledge_id: ((
|
|
1716
|
+
event: k ? "update" : "create",
|
|
1717
|
+
thumb: D === 1 ? "up" : "down",
|
|
1718
|
+
knowledge_id: ((N = u.knowledge) == null ? void 0 : N.id) ?? "",
|
|
1717
1719
|
matches: P,
|
|
1718
|
-
score:
|
|
1719
|
-
}),
|
|
1720
|
-
knowledge_id: ((
|
|
1721
|
-
message_id:
|
|
1720
|
+
score: D
|
|
1721
|
+
}), k ? w.updateRating(u.id, r.chat.id, k, {
|
|
1722
|
+
knowledge_id: ((H = u.knowledge) == null ? void 0 : H.id) ?? "",
|
|
1723
|
+
message_id: l,
|
|
1722
1724
|
matches: P,
|
|
1723
|
-
score:
|
|
1725
|
+
score: D
|
|
1724
1726
|
}) : w.createRating(u.id, r.chat.id, {
|
|
1725
|
-
knowledge_id: ((
|
|
1726
|
-
message_id:
|
|
1727
|
+
knowledge_id: ((q = u.knowledge) == null ? void 0 : q.id) ?? "",
|
|
1728
|
+
message_id: l,
|
|
1727
1729
|
matches: P,
|
|
1728
|
-
score:
|
|
1730
|
+
score: D
|
|
1729
1731
|
});
|
|
1730
1732
|
},
|
|
1731
|
-
deleteRate(
|
|
1733
|
+
deleteRate(l) {
|
|
1732
1734
|
if (!r.chat)
|
|
1733
1735
|
throw new Error("Chat is not initialized");
|
|
1734
|
-
return d.track("agent-rate-delete", { type: "text" }), w.deleteRating(u.id, r.chat.id,
|
|
1736
|
+
return d.track("agent-rate-delete", { type: "text" }), w.deleteRating(u.id, r.chat.id, l);
|
|
1735
1737
|
},
|
|
1736
|
-
async speak(
|
|
1737
|
-
var P, T,
|
|
1738
|
-
function
|
|
1739
|
-
if (typeof
|
|
1738
|
+
async speak(l) {
|
|
1739
|
+
var P, T, N;
|
|
1740
|
+
function D() {
|
|
1741
|
+
if (typeof l == "string") {
|
|
1740
1742
|
if (!u.presenter.voice)
|
|
1741
1743
|
throw new Error("Presenter voice is not initialized");
|
|
1742
1744
|
return {
|
|
1743
1745
|
type: "text",
|
|
1744
1746
|
provider: u.presenter.voice,
|
|
1745
|
-
input:
|
|
1747
|
+
input: l,
|
|
1746
1748
|
ssml: !1
|
|
1747
1749
|
};
|
|
1748
1750
|
}
|
|
1749
|
-
if (
|
|
1751
|
+
if (l.type === "text" && !l.provider) {
|
|
1750
1752
|
if (!u.presenter.voice)
|
|
1751
1753
|
throw new Error("Presenter voice is not initialized");
|
|
1752
1754
|
return {
|
|
1753
1755
|
type: "text",
|
|
1754
1756
|
provider: u.presenter.voice,
|
|
1755
|
-
input:
|
|
1756
|
-
ssml:
|
|
1757
|
+
input: l.input,
|
|
1758
|
+
ssml: l.ssml
|
|
1757
1759
|
};
|
|
1758
1760
|
}
|
|
1759
|
-
return
|
|
1761
|
+
return l;
|
|
1760
1762
|
}
|
|
1761
|
-
const
|
|
1762
|
-
if (d.track("agent-speak",
|
|
1763
|
-
id:
|
|
1763
|
+
const k = D();
|
|
1764
|
+
if (d.track("agent-speak", k), ne.update(), r.messages && k.type === "text" && (r.messages.push({
|
|
1765
|
+
id: me(),
|
|
1764
1766
|
role: "assistant",
|
|
1765
|
-
content:
|
|
1767
|
+
content: k.input,
|
|
1766
1768
|
created_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1767
1769
|
}), (T = (P = t.callbacks).onNewMessage) == null || T.call(P, [...r.messages], "answer")), yt(r.chatMode))
|
|
1768
1770
|
return {
|
|
@@ -1773,36 +1775,36 @@ async function wn(e, t) {
|
|
|
1773
1775
|
if (!r.streamingManager)
|
|
1774
1776
|
throw new Error("Please connect to the agent first");
|
|
1775
1777
|
return r.streamingManager.speak({
|
|
1776
|
-
script:
|
|
1777
|
-
metadata: { chat_id: (
|
|
1778
|
+
script: k,
|
|
1779
|
+
metadata: { chat_id: (N = r.chat) == null ? void 0 : N.id, agent_id: u.id }
|
|
1778
1780
|
});
|
|
1779
1781
|
},
|
|
1780
1782
|
interrupt: R
|
|
1781
1783
|
};
|
|
1782
1784
|
}
|
|
1783
1785
|
export {
|
|
1784
|
-
|
|
1786
|
+
V as AgentActivityState,
|
|
1785
1787
|
ot as AgentStatus,
|
|
1786
1788
|
tt as ChatCreationFailed,
|
|
1787
1789
|
B as ChatMode,
|
|
1788
1790
|
nt as ChatModeDowngraded,
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
+
X as ChatProgress,
|
|
1792
|
+
I as ConnectionState,
|
|
1791
1793
|
re as ConnectivityState,
|
|
1792
1794
|
ut as DocumentType,
|
|
1793
1795
|
dt as KnowledgeType,
|
|
1794
1796
|
at as PlanGroup,
|
|
1795
1797
|
lt as Providers,
|
|
1796
1798
|
st as RateState,
|
|
1797
|
-
|
|
1799
|
+
L as StreamEvents,
|
|
1798
1800
|
ie as StreamType,
|
|
1799
|
-
|
|
1801
|
+
E as StreamingState,
|
|
1800
1802
|
ct as Subject,
|
|
1801
|
-
|
|
1803
|
+
ke as TransportProvider,
|
|
1802
1804
|
it as UserPlan,
|
|
1803
|
-
|
|
1805
|
+
le as ValidationError,
|
|
1804
1806
|
Ve as VideoType,
|
|
1805
|
-
|
|
1807
|
+
mt as VoiceAccess,
|
|
1806
1808
|
rt as WsError,
|
|
1807
1809
|
wn as createAgentManager,
|
|
1808
1810
|
pn as mapVideoType
|