@d-id/client-sdk 1.1.0-beta.14 → 1.1.0-beta.16
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 +540 -528
- package/dist/index.umd.cjs +1 -1
- package/dist/src/services/analytics/timestamp-tracker.d.ts +6 -1
- package/dist/src/services/chat/index.d.ts +2 -1
- package/dist/src/types/entities/agents/chat.d.ts +5 -1
- package/dist/src/types/entities/agents/manager.d.ts +2 -2
- package/dist/src/utils/chat.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var ve = (e, t, a) => t in e ? ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var X = (e, t, a) => (ve(e, typeof t != "symbol" ? t + "" : t, a), a);
|
|
4
|
+
class O extends Error {
|
|
5
5
|
constructor({
|
|
6
|
-
kind:
|
|
6
|
+
kind: a,
|
|
7
7
|
description: r,
|
|
8
8
|
error: s
|
|
9
9
|
}) {
|
|
10
10
|
super(JSON.stringify({
|
|
11
|
-
kind:
|
|
11
|
+
kind: a,
|
|
12
12
|
description: r
|
|
13
13
|
}));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.kind =
|
|
14
|
+
X(this, "kind");
|
|
15
|
+
X(this, "description");
|
|
16
|
+
X(this, "error");
|
|
17
|
+
this.kind = a, this.description = r, this.error = s;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
class
|
|
21
|
-
constructor(t,
|
|
20
|
+
class ke extends O {
|
|
21
|
+
constructor(t, a) {
|
|
22
22
|
super({
|
|
23
23
|
kind: "ChatCreationFailed",
|
|
24
|
-
description: `Failed to create ${
|
|
24
|
+
description: `Failed to create ${a ? "persistent" : ""} chat, mode: ${t}`
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class De extends O {
|
|
29
29
|
constructor(t) {
|
|
30
30
|
super({
|
|
31
31
|
kind: "ChatModeDowngraded",
|
|
@@ -33,17 +33,17 @@ class ye extends Z {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
class K extends
|
|
37
|
-
constructor(
|
|
36
|
+
class K extends O {
|
|
37
|
+
constructor(a, r) {
|
|
38
38
|
super({
|
|
39
39
|
kind: "ValidationError",
|
|
40
|
-
description:
|
|
40
|
+
description: a
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
X(this, "key");
|
|
43
43
|
this.key = r;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
class
|
|
46
|
+
class Ce extends O {
|
|
47
47
|
constructor(t) {
|
|
48
48
|
super({
|
|
49
49
|
kind: "WSError",
|
|
@@ -51,8 +51,8 @@ class ve extends Z {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
const
|
|
54
|
+
var Re = /* @__PURE__ */ ((e) => (e.TRIAL = "trial", e.BASIC = "basic", e.ENTERPRISE = "enterprise", e.LITE = "lite", e.ADVANCED = "advanced", e))(Re || {}), Ee = /* @__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))(Ee || {}), Se = /* @__PURE__ */ ((e) => (e.Created = "created", e.Started = "started", e.Done = "done", e.Error = "error", e.Rejected = "rejected", e.Ready = "ready", e))(Se || {}), Ie = /* @__PURE__ */ ((e) => (e.Unrated = "Unrated", e.Positive = "Positive", e.Negative = "Negative", e))(Ie || {}), P = /* @__PURE__ */ ((e) => (e.Functional = "Functional", e.TextOnly = "TextOnly", e.Maintenance = "Maintenance", e.Playground = "Playground", e.DirectPlayback = "DirectPlayback", e.OuterControl = "OuterControl", e))(P || {}), H = /* @__PURE__ */ ((e) => (e.Embed = "embed", e.Query = "query", e.Partial = "partial", e.Answer = "answer", e.Complete = "done", e))(H || {}), _e = /* @__PURE__ */ ((e) => (e.KnowledgeProcessing = "knowledge/processing", e.KnowledgeIndexing = "knowledge/indexing", e.KnowledgeFailed = "knowledge/error", e.KnowledgeDone = "knowledge/done", e))(_e || {}), Me = /* @__PURE__ */ ((e) => (e.Knowledge = "knowledge", e.Document = "document", e.Record = "record", e))(Me || {}), Te = /* @__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))(Te || {}), ce = /* @__PURE__ */ ((e) => (e.Clip = "clip", e.Talk = "talk", e))(ce || {});
|
|
55
|
+
const je = (e) => {
|
|
56
56
|
switch (e) {
|
|
57
57
|
case "clip":
|
|
58
58
|
return "clip";
|
|
@@ -62,22 +62,22 @@ const Me = (e) => {
|
|
|
62
62
|
throw new Error(`Unknown video type: ${e}`);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
var p = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(p || {}),
|
|
66
|
-
const
|
|
65
|
+
var p = /* @__PURE__ */ ((e) => (e.Start = "START", e.Stop = "STOP", e))(p || {}), Y = /* @__PURE__ */ ((e) => (e.Strong = "STRONG", e.Weak = "WEAK", e.Unknown = "UNKNOWN", e))(Y || {}), V = /* @__PURE__ */ ((e) => (e.Idle = "IDLE", e.Talking = "TALKING", e))(V || {}), J = /* @__PURE__ */ ((e) => (e.ChatAnswer = "chat/answer", e.ChatPartial = "chat/partial", 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))(J || {}), T = /* @__PURE__ */ ((e) => (e.New = "new", e.Fail = "fail", e.Connected = "connected", e.Connecting = "connecting", e.Closed = "closed", e.Completed = "completed", e.Disconnected = "disconnected", e))(T || {}), W = /* @__PURE__ */ ((e) => (e.Legacy = "legacy", e.Fluent = "fluent", e))(W || {}), be = /* @__PURE__ */ ((e) => (e.Amazon = "amazon", e.Microsoft = "microsoft", e.Afflorithmics = "afflorithmics", e.Elevenlabs = "elevenlabs", e))(be || {}), Pe = /* @__PURE__ */ ((e) => (e.Public = "public", e.Premium = "premium", e.Private = "private", e))(Pe || {});
|
|
66
|
+
const $e = 45 * 1e3, Ae = "X-Playground-Chat", Q = "https://api.d-id.com", Be = "wss://notifications.d-id.com", Le = "79f81a83a67430be2bc0fd61042b8faa", de = (e) => new Promise((t) => setTimeout(t, e)), q = (e = 16) => {
|
|
67
67
|
const t = new Uint8Array(e);
|
|
68
|
-
return window.crypto.getRandomValues(t), Array.from(t, (
|
|
69
|
-
},
|
|
70
|
-
function
|
|
71
|
-
let
|
|
68
|
+
return window.crypto.getRandomValues(t), Array.from(t, (a) => a.toString(16).padStart(2, "0")).join("").slice(0, 13);
|
|
69
|
+
}, ze = (e) => [P.TextOnly, P.Playground, P.Maintenance].includes(e), G = (e) => e && [P.DirectPlayback, P.OuterControl].includes(e);
|
|
70
|
+
function Ne(e, t) {
|
|
71
|
+
let a;
|
|
72
72
|
return {
|
|
73
73
|
promise: new Promise((s, i) => {
|
|
74
|
-
|
|
74
|
+
a = setTimeout(() => i(new Error(t)), e);
|
|
75
75
|
}),
|
|
76
|
-
clear: () => clearTimeout(
|
|
76
|
+
clear: () => clearTimeout(a)
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
async function
|
|
80
|
-
const
|
|
79
|
+
async function ee(e, t) {
|
|
80
|
+
const a = {
|
|
81
81
|
limit: (t == null ? void 0 : t.limit) ?? 3,
|
|
82
82
|
delayMs: (t == null ? void 0 : t.delayMs) ?? 0,
|
|
83
83
|
timeout: (t == null ? void 0 : t.timeout) ?? 3e4,
|
|
@@ -87,23 +87,23 @@ async function O(e, t) {
|
|
|
87
87
|
})
|
|
88
88
|
};
|
|
89
89
|
let r;
|
|
90
|
-
for (let s = 1; s <=
|
|
90
|
+
for (let s = 1; s <= a.limit; s++)
|
|
91
91
|
try {
|
|
92
|
-
if (!
|
|
92
|
+
if (!a.timeout)
|
|
93
93
|
return await e();
|
|
94
94
|
const {
|
|
95
95
|
promise: i,
|
|
96
96
|
clear: c
|
|
97
|
-
} =
|
|
98
|
-
return await Promise.race([
|
|
97
|
+
} = Ne(a.timeout, a.timeoutErrorMessage), n = e().finally(c);
|
|
98
|
+
return await Promise.race([n, i]);
|
|
99
99
|
} catch (i) {
|
|
100
|
-
if (r = i, !
|
|
100
|
+
if (r = i, !a.shouldRetryFn(i) || s >= a.limit)
|
|
101
101
|
throw i;
|
|
102
|
-
await
|
|
102
|
+
await de(a.delayMs), a.onRetry(i);
|
|
103
103
|
}
|
|
104
104
|
throw r;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ue() {
|
|
107
107
|
let e = window.localStorage.getItem("did_external_key_id");
|
|
108
108
|
if (!e) {
|
|
109
109
|
let t = q();
|
|
@@ -111,43 +111,43 @@ function ce() {
|
|
|
111
111
|
}
|
|
112
112
|
return e;
|
|
113
113
|
}
|
|
114
|
-
let
|
|
115
|
-
function
|
|
114
|
+
let xe = q();
|
|
115
|
+
function le(e) {
|
|
116
116
|
if (e.type === "bearer")
|
|
117
117
|
return `Bearer ${e.token}`;
|
|
118
118
|
if (e.type === "basic")
|
|
119
119
|
return `Basic ${btoa(`${e.username}:${e.password}`)}`;
|
|
120
120
|
if (e.type === "key")
|
|
121
|
-
return `Client-Key ${e.clientKey}.${
|
|
121
|
+
return `Client-Key ${e.clientKey}.${ue()}_${xe}`;
|
|
122
122
|
throw new Error(`Unknown auth type: ${e}`);
|
|
123
123
|
}
|
|
124
|
-
const
|
|
124
|
+
const Fe = (e) => ee(e, {
|
|
125
125
|
limit: 3,
|
|
126
126
|
delayMs: 1e3,
|
|
127
127
|
timeout: 0,
|
|
128
128
|
shouldRetryFn: (t) => t.status === 429
|
|
129
129
|
});
|
|
130
|
-
function
|
|
130
|
+
function ne(e, t = Q, a) {
|
|
131
131
|
const r = async (s, i) => {
|
|
132
132
|
const {
|
|
133
133
|
skipErrorHandler: c,
|
|
134
|
-
...
|
|
135
|
-
} = i || {}, o = await
|
|
136
|
-
...
|
|
134
|
+
...n
|
|
135
|
+
} = i || {}, o = await Fe(() => fetch(t + (s != null && s.startsWith("/") ? s : `/${s}`), {
|
|
136
|
+
...n,
|
|
137
137
|
headers: {
|
|
138
|
-
...
|
|
139
|
-
Authorization:
|
|
138
|
+
...n.headers,
|
|
139
|
+
Authorization: le(e),
|
|
140
140
|
"Content-Type": "application/json"
|
|
141
141
|
}
|
|
142
142
|
}));
|
|
143
143
|
if (!o.ok) {
|
|
144
144
|
let d = await o.text().catch(() => `Failed to fetch with status ${o.status}`);
|
|
145
|
-
const
|
|
146
|
-
throw
|
|
145
|
+
const l = new Error(d);
|
|
146
|
+
throw a && !c && a(l, {
|
|
147
147
|
url: s,
|
|
148
|
-
options:
|
|
148
|
+
options: n,
|
|
149
149
|
headers: o.headers
|
|
150
|
-
}),
|
|
150
|
+
}), l;
|
|
151
151
|
}
|
|
152
152
|
return o.json();
|
|
153
153
|
};
|
|
@@ -181,8 +181,8 @@ function te(e, t = Q, n) {
|
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
const r =
|
|
184
|
+
function fe(e, t = Q, a) {
|
|
185
|
+
const r = ne(e, `${t}/agents`, a);
|
|
186
186
|
return {
|
|
187
187
|
create(s, i) {
|
|
188
188
|
return r.post("/", s, i);
|
|
@@ -202,45 +202,45 @@ function le(e, t = Q, n) {
|
|
|
202
202
|
newChat(s, i, c) {
|
|
203
203
|
return r.post(`/${s}/chat`, i, c);
|
|
204
204
|
},
|
|
205
|
-
chat(s, i, c,
|
|
206
|
-
return r.post(`/${s}/chat/${i}`, c,
|
|
205
|
+
chat(s, i, c, n) {
|
|
206
|
+
return r.post(`/${s}/chat/${i}`, c, n);
|
|
207
207
|
},
|
|
208
|
-
createRating(s, i, c,
|
|
209
|
-
return r.post(`/${s}/chat/${i}/ratings`, c,
|
|
208
|
+
createRating(s, i, c, n) {
|
|
209
|
+
return r.post(`/${s}/chat/${i}/ratings`, c, n);
|
|
210
210
|
},
|
|
211
|
-
updateRating(s, i, c,
|
|
212
|
-
return r.patch(`/${s}/chat/${i}/ratings/${c}`,
|
|
211
|
+
updateRating(s, i, c, n, o) {
|
|
212
|
+
return r.patch(`/${s}/chat/${i}/ratings/${c}`, n, o);
|
|
213
213
|
},
|
|
214
|
-
deleteRating(s, i, c,
|
|
215
|
-
return r.delete(`/${s}/chat/${i}/ratings/${c}`,
|
|
214
|
+
deleteRating(s, i, c, n) {
|
|
215
|
+
return r.delete(`/${s}/chat/${i}/ratings/${c}`, n);
|
|
216
216
|
},
|
|
217
217
|
getSTTToken(s, i) {
|
|
218
218
|
return r.get(`/${s}/stt-token`, i);
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
var s, i, c,
|
|
225
|
-
const t = () => /Mobi|Android/i.test(navigator.userAgent) ? "Mobile" : "Desktop",
|
|
222
|
+
const me = (e) => e.type === "clip" && e.presenter_id.startsWith("v2_") ? "clip_v2" : e.type;
|
|
223
|
+
function Je(e) {
|
|
224
|
+
var s, i, c, n;
|
|
225
|
+
const t = () => /Mobi|Android/i.test(navigator.userAgent) ? "Mobile" : "Desktop", a = () => {
|
|
226
226
|
const o = navigator.platform;
|
|
227
227
|
return o.toLowerCase().includes("win") ? "Windows" : o.toLowerCase().includes("mac") ? "Mac OS X" : o.toLowerCase().includes("linux") ? "Linux" : "Unknown";
|
|
228
228
|
}, r = e.presenter;
|
|
229
229
|
return {
|
|
230
|
-
$os: `${
|
|
230
|
+
$os: `${a()}`,
|
|
231
231
|
isMobile: `${t() == "Mobile"}`,
|
|
232
232
|
browser: navigator.userAgent,
|
|
233
233
|
origin: window.location.origin,
|
|
234
|
-
agentType:
|
|
234
|
+
agentType: me(r),
|
|
235
235
|
agentVoice: {
|
|
236
236
|
voiceId: (i = (s = e.presenter) == null ? void 0 : s.voice) == null ? void 0 : i.voice_id,
|
|
237
|
-
provider: (
|
|
237
|
+
provider: (n = (c = e.presenter) == null ? void 0 : c.voice) == null ? void 0 : n.type
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
}
|
|
241
|
-
const
|
|
242
|
-
function
|
|
243
|
-
var o, d,
|
|
241
|
+
const We = (e) => e.reduce((t, a) => t + a, 0), ae = (e) => We(e) / e.length;
|
|
242
|
+
function Ue(e, t, a) {
|
|
243
|
+
var o, d, l;
|
|
244
244
|
const {
|
|
245
245
|
event: r,
|
|
246
246
|
...s
|
|
@@ -262,29 +262,29 @@ function Fe(e, t, n) {
|
|
|
262
262
|
language: c
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
|
-
stitch: (t == null ? void 0 : t.presenter.type) === "talk" ? (
|
|
266
|
-
...
|
|
265
|
+
stitch: (t == null ? void 0 : t.presenter.type) === "talk" ? (l = t == null ? void 0 : t.presenter) == null ? void 0 : l.stitch : void 0,
|
|
266
|
+
...a
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
let
|
|
270
|
-
const
|
|
271
|
-
function
|
|
272
|
-
var i, c,
|
|
273
|
-
const t = window != null && window.hasOwnProperty("DID_AGENTS_API") ? "agents-ui" : "agents-sdk",
|
|
269
|
+
let Z = {};
|
|
270
|
+
const Ke = "https://api-js.mixpanel.com/track/?verbose=1&ip=1";
|
|
271
|
+
function He(e) {
|
|
272
|
+
var i, c, n, o, d, l;
|
|
273
|
+
const t = window != null && window.hasOwnProperty("DID_AGENTS_API") ? "agents-ui" : "agents-sdk", a = e.agent.presenter, r = (i = e.agent.llm) == null ? void 0 : i.prompt_customization, s = {
|
|
274
274
|
token: e.token || "testKey",
|
|
275
|
-
distinct_id: e.distinctId ||
|
|
275
|
+
distinct_id: e.distinctId || ue(),
|
|
276
276
|
agentId: e.agent.id,
|
|
277
|
-
agentType:
|
|
277
|
+
agentType: me(a),
|
|
278
278
|
owner_id: e.agent.owner_id ?? "",
|
|
279
279
|
promptVersion: (c = e.agent.llm) == null ? void 0 : c.prompt_version,
|
|
280
280
|
behavior: {
|
|
281
281
|
role: r == null ? void 0 : r.role,
|
|
282
282
|
personality: r == null ? void 0 : r.personality,
|
|
283
|
-
instructions: (
|
|
283
|
+
instructions: (n = e.agent.llm) == null ? void 0 : n.instructions
|
|
284
284
|
},
|
|
285
285
|
temperature: (o = e.agent.llm) == null ? void 0 : o.temperature,
|
|
286
286
|
knowledgeSource: r == null ? void 0 : r.knowledge_source,
|
|
287
|
-
starterQuestionsCount: (
|
|
287
|
+
starterQuestionsCount: (l = (d = e.agent.knowledge) == null ? void 0 : d.starter_message) == null ? void 0 : l.length,
|
|
288
288
|
topicsToAvoid: r == null ? void 0 : r.topics_to_avoid,
|
|
289
289
|
maxResponseLength: r == null ? void 0 : r.max_response_length
|
|
290
290
|
};
|
|
@@ -293,26 +293,26 @@ function We(e) {
|
|
|
293
293
|
additionalProperties: {},
|
|
294
294
|
isEnabled: e.isEnabled ?? !0,
|
|
295
295
|
getRandom: q,
|
|
296
|
-
enrich(
|
|
296
|
+
enrich(w) {
|
|
297
297
|
this.additionalProperties = {
|
|
298
298
|
...this.additionalProperties,
|
|
299
|
-
...
|
|
299
|
+
...w
|
|
300
300
|
};
|
|
301
301
|
},
|
|
302
|
-
async track(
|
|
302
|
+
async track(w, j) {
|
|
303
303
|
if (!this.isEnabled)
|
|
304
304
|
return Promise.resolve();
|
|
305
305
|
const {
|
|
306
306
|
audioPath: R,
|
|
307
307
|
...k
|
|
308
|
-
} =
|
|
308
|
+
} = j || {}, D = {
|
|
309
309
|
method: "POST",
|
|
310
310
|
headers: {
|
|
311
311
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
312
312
|
},
|
|
313
313
|
body: new URLSearchParams({
|
|
314
314
|
data: JSON.stringify([{
|
|
315
|
-
event:
|
|
315
|
+
event: w,
|
|
316
316
|
properties: {
|
|
317
317
|
...this.additionalProperties,
|
|
318
318
|
...k,
|
|
@@ -329,32 +329,32 @@ function We(e) {
|
|
|
329
329
|
})
|
|
330
330
|
};
|
|
331
331
|
try {
|
|
332
|
-
return await fetch(
|
|
332
|
+
return await fetch(Ke, D).then((C) => C.json());
|
|
333
333
|
} catch (C) {
|
|
334
334
|
return console.error(C);
|
|
335
335
|
}
|
|
336
336
|
},
|
|
337
|
-
linkTrack(
|
|
338
|
-
|
|
337
|
+
linkTrack(w, j, R, k) {
|
|
338
|
+
Z[w] || (Z[w] = {
|
|
339
339
|
events: {},
|
|
340
340
|
resolvedDependencies: []
|
|
341
341
|
}), k.includes(R) || k.push(R);
|
|
342
|
-
const D =
|
|
342
|
+
const D = Z[w];
|
|
343
343
|
if (D.events[R] = {
|
|
344
|
-
props:
|
|
345
|
-
}, D.resolvedDependencies.push(R), k.every((
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
...D.events[
|
|
349
|
-
} :
|
|
350
|
-
this.track(
|
|
351
|
-
delete D.events[
|
|
344
|
+
props: j
|
|
345
|
+
}, D.resolvedDependencies.push(R), k.every((L) => D.resolvedDependencies.includes(L))) {
|
|
346
|
+
const L = k.reduce(($, u) => D.events[u] ? {
|
|
347
|
+
...$,
|
|
348
|
+
...D.events[u].props
|
|
349
|
+
} : $, {});
|
|
350
|
+
this.track(w, L), D.resolvedDependencies = D.resolvedDependencies.filter(($) => !k.includes($)), k.forEach(($) => {
|
|
351
|
+
delete D.events[$];
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
};
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function ge() {
|
|
358
358
|
let e = 0;
|
|
359
359
|
return {
|
|
360
360
|
reset: () => e = 0,
|
|
@@ -362,19 +362,19 @@ function Ue() {
|
|
|
362
362
|
get: (t = !1) => t ? Date.now() - e : e
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
|
-
const
|
|
366
|
-
function
|
|
367
|
-
return e ===
|
|
365
|
+
const F = ge(), te = ge();
|
|
366
|
+
function he(e) {
|
|
367
|
+
return e === P.Playground ? {
|
|
368
368
|
headers: {
|
|
369
|
-
[
|
|
369
|
+
[Ae]: "true"
|
|
370
370
|
}
|
|
371
371
|
} : {};
|
|
372
372
|
}
|
|
373
|
-
async function
|
|
373
|
+
async function we(e, t, a, r, s = !1, i) {
|
|
374
374
|
try {
|
|
375
|
-
return !i && r
|
|
375
|
+
return !i && !G(r) && (i = await t.newChat(e.id, {
|
|
376
376
|
persist: s
|
|
377
|
-
},
|
|
377
|
+
}, he(r)), a.track("agent-chat", {
|
|
378
378
|
event: "created",
|
|
379
379
|
chat_id: i.id,
|
|
380
380
|
agent_id: e.id,
|
|
@@ -385,82 +385,82 @@ async function me(e, t, n, r, s = !1, i) {
|
|
|
385
385
|
};
|
|
386
386
|
} catch (c) {
|
|
387
387
|
try {
|
|
388
|
-
const
|
|
389
|
-
if ((
|
|
388
|
+
const n = JSON.parse(c.message);
|
|
389
|
+
if ((n == null ? void 0 : n.kind) === "InsufficientCreditsError")
|
|
390
390
|
throw new Error("InsufficientCreditsError");
|
|
391
|
-
} catch (
|
|
392
|
-
console.error("Error parsing the error message:",
|
|
391
|
+
} catch (n) {
|
|
392
|
+
console.error("Error parsing the error message:", n);
|
|
393
393
|
}
|
|
394
394
|
throw new Error("Cannot create new chat");
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function qe(e) {
|
|
398
398
|
return e && e.length > 0 ? e : [];
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function Ve(e, t, a, r, s) {
|
|
401
401
|
if (!e || !t)
|
|
402
402
|
throw new Error("Please connect to the agent first");
|
|
403
403
|
if (!e.interruptEnabled)
|
|
404
404
|
throw new Error("Interrupt is not enabled for this stream");
|
|
405
|
-
if (
|
|
405
|
+
if (a !== W.Fluent)
|
|
406
406
|
throw new Error("Interrupt only available for Fluent streams");
|
|
407
407
|
if (!r && !s)
|
|
408
408
|
throw new Error("No active video to interrupt");
|
|
409
409
|
}
|
|
410
|
-
async function
|
|
411
|
-
const
|
|
412
|
-
type:
|
|
410
|
+
async function ie(e, t) {
|
|
411
|
+
const a = {
|
|
412
|
+
type: J.StreamInterrupt,
|
|
413
413
|
videoId: t,
|
|
414
414
|
timestamp: Date.now()
|
|
415
415
|
};
|
|
416
|
-
e.sendDataChannelMessage(JSON.stringify(
|
|
416
|
+
e.sendDataChannelMessage(JSON.stringify(a));
|
|
417
417
|
}
|
|
418
|
-
function
|
|
419
|
-
return new Promise((t,
|
|
418
|
+
function Xe(e) {
|
|
419
|
+
return new Promise((t, a) => {
|
|
420
420
|
const {
|
|
421
421
|
callbacks: r,
|
|
422
422
|
host: s,
|
|
423
423
|
auth: i
|
|
424
424
|
} = e, {
|
|
425
425
|
onMessage: c = null,
|
|
426
|
-
onOpen:
|
|
426
|
+
onOpen: n = null,
|
|
427
427
|
onClose: o = null,
|
|
428
428
|
onError: d = null
|
|
429
|
-
} = r || {},
|
|
430
|
-
|
|
431
|
-
console.error(
|
|
432
|
-
},
|
|
433
|
-
|
|
429
|
+
} = r || {}, l = new WebSocket(`${s}?authorization=${le(i)}`);
|
|
430
|
+
l.onmessage = c, l.onclose = o, l.onerror = (w) => {
|
|
431
|
+
console.error(w), d == null || d("Websocket failed to connect", w), a(w);
|
|
432
|
+
}, l.onopen = (w) => {
|
|
433
|
+
n == null || n(w), t(l);
|
|
434
434
|
};
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
|
-
async function
|
|
437
|
+
async function Ye(e) {
|
|
438
438
|
const {
|
|
439
439
|
retries: t = 1
|
|
440
440
|
} = e;
|
|
441
|
-
let
|
|
442
|
-
for (let r = 0; (
|
|
441
|
+
let a = null;
|
|
442
|
+
for (let r = 0; (a == null ? void 0 : a.readyState) !== WebSocket.OPEN; r++)
|
|
443
443
|
try {
|
|
444
|
-
|
|
444
|
+
a = await Xe(e);
|
|
445
445
|
} catch (s) {
|
|
446
446
|
if (r === t)
|
|
447
447
|
throw s;
|
|
448
|
-
await
|
|
448
|
+
await de(r * 500);
|
|
449
449
|
}
|
|
450
|
-
return
|
|
450
|
+
return a;
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
453
|
-
const r =
|
|
452
|
+
async function Qe(e, t, a) {
|
|
453
|
+
const r = a != null && a.onMessage ? [a.onMessage] : [], s = await Ye({
|
|
454
454
|
auth: e,
|
|
455
455
|
host: t,
|
|
456
456
|
callbacks: {
|
|
457
457
|
onError: (i) => {
|
|
458
458
|
var c;
|
|
459
|
-
return (c =
|
|
459
|
+
return (c = a.onError) == null ? void 0 : c.call(a, new Ce(i));
|
|
460
460
|
},
|
|
461
461
|
onMessage(i) {
|
|
462
462
|
const c = JSON.parse(i.data);
|
|
463
|
-
r.forEach((
|
|
463
|
+
r.forEach((n) => n(c.event, c));
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
});
|
|
@@ -470,46 +470,46 @@ async function Xe(e, t, n) {
|
|
|
470
470
|
subscribeToEvents: (i) => r.push(i)
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function Oe(e) {
|
|
474
474
|
if (e.answer !== void 0)
|
|
475
475
|
return e.answer;
|
|
476
|
-
let t = 0,
|
|
476
|
+
let t = 0, a = "";
|
|
477
477
|
for (; t in e; )
|
|
478
|
-
|
|
479
|
-
return
|
|
478
|
+
a += e[t++];
|
|
479
|
+
return a;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function Ze(e, t, a, r, s) {
|
|
482
482
|
const i = r.messages[r.messages.length - 1];
|
|
483
483
|
if (!(e === H.Partial || e === H.Answer) || (i == null ? void 0 : i.role) !== "assistant")
|
|
484
484
|
return;
|
|
485
485
|
const {
|
|
486
486
|
content: c,
|
|
487
|
-
sequence:
|
|
487
|
+
sequence: n
|
|
488
488
|
} = t;
|
|
489
|
-
e === H.Partial ? n
|
|
490
|
-
const o =
|
|
489
|
+
e === H.Partial ? a[n] = c : a.answer = c;
|
|
490
|
+
const o = Oe(a);
|
|
491
491
|
(i.content !== o || e === H.Answer) && (i.content = o, s == null || s([...r.messages], e));
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Ge(e, t, a, r, s) {
|
|
494
494
|
let i = {};
|
|
495
495
|
return {
|
|
496
496
|
clearQueue: () => i = {},
|
|
497
|
-
onMessage: (c,
|
|
497
|
+
onMessage: (c, n) => {
|
|
498
498
|
var o, d;
|
|
499
|
-
if ("content" in
|
|
500
|
-
|
|
499
|
+
if ("content" in n)
|
|
500
|
+
Ze(c, n, i, t, a.callbacks.onNewMessage), c === H.Answer && e.track("agent-message-received", {
|
|
501
501
|
messages: t.messages.length,
|
|
502
502
|
mode: t.chatMode
|
|
503
503
|
});
|
|
504
504
|
else {
|
|
505
|
-
const
|
|
505
|
+
const l = J, w = [l.StreamVideoDone, l.StreamVideoError, l.StreamVideoRejected], j = [l.StreamFailed, l.StreamVideoError, l.StreamVideoRejected], R = Ue(n, r, {
|
|
506
506
|
mode: t.chatMode
|
|
507
507
|
});
|
|
508
|
-
if (c = c, c ===
|
|
509
|
-
e.linkTrack("agent-video", R,
|
|
510
|
-
else if (
|
|
508
|
+
if (c = c, c === l.StreamVideoCreated)
|
|
509
|
+
e.linkTrack("agent-video", R, l.StreamVideoCreated, ["start"]);
|
|
510
|
+
else if (w.includes(c)) {
|
|
511
511
|
const k = c.split("/")[1];
|
|
512
|
-
|
|
512
|
+
j.includes(c) ? e.track("agent-video", {
|
|
513
513
|
...R,
|
|
514
514
|
event: k
|
|
515
515
|
}) : e.linkTrack("agent-video", {
|
|
@@ -517,15 +517,15 @@ function Ze(e, t, n, r, s) {
|
|
|
517
517
|
event: k
|
|
518
518
|
}, c, ["done"]);
|
|
519
519
|
}
|
|
520
|
-
|
|
521
|
-
data:
|
|
522
|
-
})),
|
|
520
|
+
j.includes(c) && ((d = (o = a.callbacks).onError) == null || d.call(o, new Error(`Stream failed with event ${c}`), {
|
|
521
|
+
data: n
|
|
522
|
+
})), n.event === l.StreamDone && s();
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
const s =
|
|
527
|
+
function et(e, t, a, r) {
|
|
528
|
+
const s = ne(e, `${t}/agents/${a}`, r);
|
|
529
529
|
return {
|
|
530
530
|
createStream(i) {
|
|
531
531
|
return s.post("/streams", {
|
|
@@ -536,22 +536,22 @@ function Ge(e, t, n, r) {
|
|
|
536
536
|
fluent: i.fluent
|
|
537
537
|
});
|
|
538
538
|
},
|
|
539
|
-
startConnection(i, c,
|
|
539
|
+
startConnection(i, c, n) {
|
|
540
540
|
return s.post(`/streams/${i}/sdp`, {
|
|
541
|
-
session_id:
|
|
541
|
+
session_id: n,
|
|
542
542
|
answer: c
|
|
543
543
|
});
|
|
544
544
|
},
|
|
545
|
-
addIceCandidate(i, c,
|
|
545
|
+
addIceCandidate(i, c, n) {
|
|
546
546
|
return s.post(`/streams/${i}/ice`, {
|
|
547
|
-
session_id:
|
|
547
|
+
session_id: n,
|
|
548
548
|
...c
|
|
549
549
|
});
|
|
550
550
|
},
|
|
551
|
-
sendStreamRequest(i, c,
|
|
551
|
+
sendStreamRequest(i, c, n) {
|
|
552
552
|
return s.post(`/streams/${i}`, {
|
|
553
553
|
session_id: c,
|
|
554
|
-
...
|
|
554
|
+
...n
|
|
555
555
|
});
|
|
556
556
|
},
|
|
557
557
|
close(i, c) {
|
|
@@ -561,8 +561,8 @@ function Ge(e, t, n, r) {
|
|
|
561
561
|
}
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
565
|
-
const s =
|
|
564
|
+
function tt(e, t, a, r) {
|
|
565
|
+
const s = ne(e, `${t}/agents/${a}`, r);
|
|
566
566
|
return {
|
|
567
567
|
createStream(i, c) {
|
|
568
568
|
return s.post("/streams", {
|
|
@@ -576,32 +576,32 @@ function Oe(e, t, n, r) {
|
|
|
576
576
|
fluent: i.fluent
|
|
577
577
|
}, c);
|
|
578
578
|
},
|
|
579
|
-
startConnection(i, c,
|
|
579
|
+
startConnection(i, c, n, o) {
|
|
580
580
|
return s.post(`/streams/${i}/sdp`, {
|
|
581
|
-
session_id:
|
|
581
|
+
session_id: n,
|
|
582
582
|
answer: c
|
|
583
583
|
}, o);
|
|
584
584
|
},
|
|
585
|
-
addIceCandidate(i, c,
|
|
585
|
+
addIceCandidate(i, c, n, o) {
|
|
586
586
|
return s.post(`/streams/${i}/ice`, {
|
|
587
|
-
session_id:
|
|
587
|
+
session_id: n,
|
|
588
588
|
...c
|
|
589
589
|
}, o);
|
|
590
590
|
},
|
|
591
|
-
sendStreamRequest(i, c,
|
|
591
|
+
sendStreamRequest(i, c, n, o) {
|
|
592
592
|
return s.post(`/streams/${i}`, {
|
|
593
593
|
session_id: c,
|
|
594
|
-
...
|
|
594
|
+
...n
|
|
595
595
|
}, o);
|
|
596
596
|
},
|
|
597
|
-
close(i, c,
|
|
597
|
+
close(i, c, n) {
|
|
598
598
|
return s.delete(`/streams/${i}`, {
|
|
599
599
|
session_id: c
|
|
600
|
-
},
|
|
600
|
+
}, n);
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function rt(e, t, a) {
|
|
605
605
|
const r = (t.timestamp - e.timestamp) / 1e3;
|
|
606
606
|
return {
|
|
607
607
|
duration: r,
|
|
@@ -618,13 +618,13 @@ function et(e, t, n) {
|
|
|
618
618
|
framesPerSecond: t.framesPerSecond,
|
|
619
619
|
freezeCount: t.freezeCount - e.freezeCount,
|
|
620
620
|
freezeDuration: t.freezeDuration - e.freezeDuration,
|
|
621
|
-
lowFpsCount:
|
|
621
|
+
lowFpsCount: a
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function nt(e) {
|
|
625
625
|
return e.filter((t) => t.freezeCount > 0 || t.framesPerSecond < 21 || t.framesDropped > 0 || t.packetsLost > 0).map((t) => {
|
|
626
626
|
const {
|
|
627
|
-
timestamp:
|
|
627
|
+
timestamp: a,
|
|
628
628
|
...r
|
|
629
629
|
} = t, s = [];
|
|
630
630
|
return t.freezeCount > 0 && s.push("freeze"), t.framesPerSecond < 21 && s.push("low fps"), t.framesDropped > 0 && s.push("frames dropped"), t.packetsLost > 0 && s.push("packet loss"), {
|
|
@@ -633,13 +633,13 @@ function tt(e) {
|
|
|
633
633
|
};
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
let t = "",
|
|
636
|
+
function at(e) {
|
|
637
|
+
let t = "", a = 0;
|
|
638
638
|
for (const r of e.values())
|
|
639
|
-
if (r && r.type === "codec" && r.mimeType.startsWith("video") && (t = r.mimeType.split("/")[1]), r && r.type === "candidate-pair" && (
|
|
639
|
+
if (r && r.type === "codec" && r.mimeType.startsWith("video") && (t = r.mimeType.split("/")[1]), r && r.type === "candidate-pair" && (a = r.currentRoundTripTime), r && r.type === "inbound-rtp" && r.kind === "video")
|
|
640
640
|
return {
|
|
641
641
|
codec: t,
|
|
642
|
-
rtt:
|
|
642
|
+
rtt: a,
|
|
643
643
|
timestamp: r.timestamp,
|
|
644
644
|
bytesReceived: r.bytesReceived,
|
|
645
645
|
packetsReceived: r.packetsReceived,
|
|
@@ -658,24 +658,24 @@ function rt(e) {
|
|
|
658
658
|
};
|
|
659
659
|
return {};
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
const r = e.map((o, d) => d === 0 ?
|
|
661
|
+
function it(e, t, a) {
|
|
662
|
+
const r = e.map((o, d) => d === 0 ? a ? {
|
|
663
663
|
timestamp: o.timestamp,
|
|
664
664
|
duration: 0,
|
|
665
665
|
rtt: o.rtt,
|
|
666
|
-
bytesReceived: o.bytesReceived -
|
|
667
|
-
bitrate: (o.bytesReceived -
|
|
668
|
-
packetsReceived: o.packetsReceived -
|
|
669
|
-
packetsLost: o.packetsLost -
|
|
670
|
-
framesDropped: o.framesDropped -
|
|
671
|
-
framesDecoded: o.framesDecoded -
|
|
666
|
+
bytesReceived: o.bytesReceived - a.bytesReceived,
|
|
667
|
+
bitrate: (o.bytesReceived - a.bytesReceived) * 8 / (t / 1e3),
|
|
668
|
+
packetsReceived: o.packetsReceived - a.packetsReceived,
|
|
669
|
+
packetsLost: o.packetsLost - a.packetsLost,
|
|
670
|
+
framesDropped: o.framesDropped - a.framesDropped,
|
|
671
|
+
framesDecoded: o.framesDecoded - a.framesDecoded,
|
|
672
672
|
jitter: o.jitter,
|
|
673
|
-
jitterBufferDelay: o.jitterBufferDelay -
|
|
674
|
-
jitterBufferEmittedCount: o.jitterBufferEmittedCount -
|
|
675
|
-
avgJitterDelayInInterval: (o.jitterBufferDelay -
|
|
673
|
+
jitterBufferDelay: o.jitterBufferDelay - a.jitterBufferDelay,
|
|
674
|
+
jitterBufferEmittedCount: o.jitterBufferEmittedCount - a.jitterBufferEmittedCount,
|
|
675
|
+
avgJitterDelayInInterval: (o.jitterBufferDelay - a.jitterBufferDelay) / (o.jitterBufferEmittedCount - a.jitterBufferEmittedCount),
|
|
676
676
|
framesPerSecond: o.framesPerSecond,
|
|
677
|
-
freezeCount: o.freezeCount -
|
|
678
|
-
freezeDuration: o.freezeDuration -
|
|
677
|
+
freezeCount: o.freezeCount - a.freezeCount,
|
|
678
|
+
freezeDuration: o.freezeDuration - a.freezeDuration
|
|
679
679
|
} : {
|
|
680
680
|
timestamp: o.timestamp,
|
|
681
681
|
rtt: o.rtt,
|
|
@@ -710,34 +710,34 @@ function nt(e, t, n) {
|
|
|
710
710
|
framesPerSecond: o.framesPerSecond,
|
|
711
711
|
freezeCount: o.freezeCount - e[d - 1].freezeCount,
|
|
712
712
|
freezeDuration: o.freezeDuration - e[d - 1].freezeDuration
|
|
713
|
-
}), s =
|
|
713
|
+
}), s = nt(r), i = s.reduce((o, d) => o + (d.causes.includes("low fps") ? 1 : 0), 0), c = r.filter((o) => !!o.avgJitterDelayInInterval).map((o) => o.avgJitterDelayInInterval), n = r.filter((o) => !!o.rtt).map((o) => o.rtt);
|
|
714
714
|
return {
|
|
715
715
|
webRTCStats: {
|
|
716
716
|
anomalies: s,
|
|
717
|
-
minRtt: Math.min(...
|
|
718
|
-
avgRtt:
|
|
719
|
-
maxRtt: Math.max(...
|
|
720
|
-
aggregateReport:
|
|
717
|
+
minRtt: Math.min(...n),
|
|
718
|
+
avgRtt: ae(n),
|
|
719
|
+
maxRtt: Math.max(...n),
|
|
720
|
+
aggregateReport: rt(e[0], e[e.length - 1], i),
|
|
721
721
|
minJitterDelayInInterval: Math.min(...c),
|
|
722
722
|
maxJitterDelayInInterval: Math.max(...c),
|
|
723
|
-
avgJitterDelayInInterval:
|
|
723
|
+
avgJitterDelayInInterval: ae(c)
|
|
724
724
|
},
|
|
725
725
|
codec: e[0].codec,
|
|
726
726
|
resolution: `${e[0].frameWidth}x${e[0].frameHeight}`
|
|
727
727
|
};
|
|
728
728
|
}
|
|
729
|
-
const
|
|
730
|
-
function
|
|
731
|
-
let e = 0, t,
|
|
729
|
+
const re = 100, st = Math.max(Math.ceil(400 / re), 1), ot = 0.25, ct = 0.28;
|
|
730
|
+
function dt() {
|
|
731
|
+
let e = 0, t, a, r = 0;
|
|
732
732
|
return (s) => {
|
|
733
733
|
for (const i of s.values())
|
|
734
734
|
if (i && i.type === "inbound-rtp" && i.kind === "video") {
|
|
735
|
-
const c = i.jitterBufferDelay,
|
|
736
|
-
if (
|
|
737
|
-
const
|
|
738
|
-
r =
|
|
735
|
+
const c = i.jitterBufferDelay, n = i.jitterBufferEmittedCount;
|
|
736
|
+
if (a && n > a) {
|
|
737
|
+
const l = c - t, w = n - a;
|
|
738
|
+
r = l / w;
|
|
739
739
|
}
|
|
740
|
-
t = c,
|
|
740
|
+
t = c, a = n;
|
|
741
741
|
const o = i.framesDecoded, d = o - e > 0;
|
|
742
742
|
return e = o, {
|
|
743
743
|
isReceiving: d,
|
|
@@ -751,49 +751,49 @@ function ot() {
|
|
|
751
751
|
};
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
let c = [],
|
|
756
|
-
const k =
|
|
754
|
+
function ut(e, t, a, r, s, i = !1) {
|
|
755
|
+
let c = [], n, o = 0, d = !1, l = Y.Unknown, w = Y.Unknown, j = 0, R = 0;
|
|
756
|
+
const k = dt();
|
|
757
757
|
return setInterval(async () => {
|
|
758
758
|
const D = await e.getStats(), {
|
|
759
759
|
isReceiving: C,
|
|
760
|
-
avgJitterDelayInInterval:
|
|
761
|
-
freezeCount:
|
|
762
|
-
} = k(D),
|
|
760
|
+
avgJitterDelayInInterval: L,
|
|
761
|
+
freezeCount: $
|
|
762
|
+
} = k(D), u = at(D);
|
|
763
763
|
if (C)
|
|
764
|
-
o = 0,
|
|
765
|
-
else if (d && (o++, o >=
|
|
766
|
-
const
|
|
767
|
-
r == null || r(p.Stop,
|
|
764
|
+
o = 0, j = $ - R, w = L < ot ? Y.Strong : L > ct && j > 1 ? Y.Weak : l, w !== l && (s == null || s(w), l = w, R += j, j = 0), d || (r == null || r(p.Start), n = c[c.length - 1], c = [], d = !0), c.push(u);
|
|
765
|
+
else if (d && (o++, o >= st)) {
|
|
766
|
+
const g = it(c, re, n);
|
|
767
|
+
r == null || r(p.Stop, g), t() || a(), R = $, d = !1;
|
|
768
768
|
}
|
|
769
|
-
},
|
|
769
|
+
}, re);
|
|
770
770
|
}
|
|
771
|
-
let
|
|
772
|
-
const B = (e, t) =>
|
|
773
|
-
function
|
|
771
|
+
let pe = !1;
|
|
772
|
+
const B = (e, t) => pe && console.log(e, t), lt = (window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection).bind(window);
|
|
773
|
+
function se(e) {
|
|
774
774
|
switch (e) {
|
|
775
775
|
case "connected":
|
|
776
|
-
return
|
|
776
|
+
return T.Connected;
|
|
777
777
|
case "checking":
|
|
778
|
-
return
|
|
778
|
+
return T.Connecting;
|
|
779
779
|
case "failed":
|
|
780
|
-
return
|
|
780
|
+
return T.Fail;
|
|
781
781
|
case "new":
|
|
782
|
-
return
|
|
782
|
+
return T.New;
|
|
783
783
|
case "closed":
|
|
784
|
-
return
|
|
784
|
+
return T.Closed;
|
|
785
785
|
case "disconnected":
|
|
786
|
-
return
|
|
786
|
+
return T.Disconnected;
|
|
787
787
|
case "completed":
|
|
788
|
-
return
|
|
788
|
+
return T.Completed;
|
|
789
789
|
default:
|
|
790
|
-
return
|
|
790
|
+
return T.New;
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
function
|
|
794
|
-
const [t,
|
|
793
|
+
function ft(e) {
|
|
794
|
+
const [t, a = ""] = e.split(/:(.+)/);
|
|
795
795
|
try {
|
|
796
|
-
const r = JSON.parse(
|
|
796
|
+
const r = JSON.parse(a);
|
|
797
797
|
return B("parsed data channel message", {
|
|
798
798
|
subject: t,
|
|
799
799
|
data: r
|
|
@@ -804,98 +804,98 @@ function lt(e) {
|
|
|
804
804
|
} catch (r) {
|
|
805
805
|
return B("Failed to parse data channel message, returning data as string", {
|
|
806
806
|
subject: t,
|
|
807
|
-
rawData:
|
|
807
|
+
rawData: a,
|
|
808
808
|
error: r
|
|
809
809
|
}), {
|
|
810
810
|
subject: t,
|
|
811
|
-
data:
|
|
811
|
+
data: a
|
|
812
812
|
};
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function mt({
|
|
816
816
|
statsSignal: e,
|
|
817
817
|
dataChannelSignal: t,
|
|
818
|
-
onVideoStateChange:
|
|
818
|
+
onVideoStateChange: a,
|
|
819
819
|
report: r
|
|
820
820
|
}) {
|
|
821
|
-
e === p.Start && t === p.Start ?
|
|
821
|
+
e === p.Start && t === p.Start ? a == null || a(p.Start) : e === p.Stop && t === p.Stop && (a == null || a(p.Stop, r));
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function gt({
|
|
824
824
|
statsSignal: e,
|
|
825
825
|
dataChannelSignal: t,
|
|
826
|
-
onVideoStateChange:
|
|
826
|
+
onVideoStateChange: a,
|
|
827
827
|
onAgentActivityStateChange: r,
|
|
828
828
|
report: s
|
|
829
829
|
}) {
|
|
830
|
-
e === p.Start ?
|
|
830
|
+
e === p.Start ? a == null || a(p.Start) : e === p.Stop && (a == null || a(p.Stop, s)), t === p.Start ? r == null || r(V.Talking) : t === p.Stop && (r == null || r(V.Idle));
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function oe({
|
|
833
833
|
statsSignal: e,
|
|
834
834
|
dataChannelSignal: t,
|
|
835
|
-
onVideoStateChange:
|
|
835
|
+
onVideoStateChange: a,
|
|
836
836
|
onAgentActivityStateChange: r,
|
|
837
837
|
streamType: s,
|
|
838
838
|
report: i
|
|
839
839
|
}) {
|
|
840
|
-
s === W.Legacy ?
|
|
840
|
+
s === W.Legacy ? mt({
|
|
841
841
|
statsSignal: e,
|
|
842
842
|
dataChannelSignal: t,
|
|
843
|
-
onVideoStateChange:
|
|
843
|
+
onVideoStateChange: a,
|
|
844
844
|
report: i
|
|
845
|
-
}) : s === W.Fluent &&
|
|
845
|
+
}) : s === W.Fluent && gt({
|
|
846
846
|
statsSignal: e,
|
|
847
847
|
dataChannelSignal: t,
|
|
848
|
-
onVideoStateChange:
|
|
848
|
+
onVideoStateChange: a,
|
|
849
849
|
onAgentActivityStateChange: r,
|
|
850
850
|
report: i
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
|
-
async function
|
|
854
|
-
debug:
|
|
853
|
+
async function ht(e, t, {
|
|
854
|
+
debug: a = !1,
|
|
855
855
|
callbacks: r,
|
|
856
856
|
auth: s,
|
|
857
857
|
baseURL: i = Q,
|
|
858
858
|
analytics: c
|
|
859
859
|
}) {
|
|
860
|
-
|
|
861
|
-
let
|
|
860
|
+
pe = a;
|
|
861
|
+
let n = !1, o = !1, d = p.Stop, l = p.Stop;
|
|
862
862
|
const {
|
|
863
|
-
startConnection:
|
|
864
|
-
sendStreamRequest:
|
|
863
|
+
startConnection: w,
|
|
864
|
+
sendStreamRequest: j,
|
|
865
865
|
close: R,
|
|
866
866
|
createStream: k,
|
|
867
867
|
addIceCandidate: D
|
|
868
|
-
} = t.videoType ===
|
|
868
|
+
} = t.videoType === ce.Clip ? et(s, i, e, r.onError) : tt(s, i, e, r.onError), {
|
|
869
869
|
id: C,
|
|
870
|
-
offer:
|
|
871
|
-
ice_servers:
|
|
872
|
-
session_id:
|
|
873
|
-
fluent:
|
|
874
|
-
interrupt_enabled:
|
|
875
|
-
} = await k(t),
|
|
876
|
-
iceServers:
|
|
877
|
-
}), E =
|
|
878
|
-
if (!
|
|
870
|
+
offer: L,
|
|
871
|
+
ice_servers: $,
|
|
872
|
+
session_id: u,
|
|
873
|
+
fluent: g,
|
|
874
|
+
interrupt_enabled: v
|
|
875
|
+
} = await k(t), h = new lt({
|
|
876
|
+
iceServers: $
|
|
877
|
+
}), E = h.createDataChannel("JanusDataChannel");
|
|
878
|
+
if (!u)
|
|
879
879
|
throw new Error("Could not create session_id");
|
|
880
|
-
const
|
|
880
|
+
const y = g ? W.Fluent : W.Legacy;
|
|
881
881
|
c.enrich({
|
|
882
|
-
"stream-type":
|
|
882
|
+
"stream-type": y
|
|
883
883
|
});
|
|
884
|
-
const
|
|
884
|
+
const M = t.stream_warmup && !g, A = () => n, z = () => {
|
|
885
885
|
var f;
|
|
886
|
-
|
|
887
|
-
}, S =
|
|
888
|
-
statsSignal:
|
|
889
|
-
dataChannelSignal:
|
|
886
|
+
n = !0, o && ((f = r.onConnectionStateChange) == null || f.call(r, T.Connected));
|
|
887
|
+
}, S = ut(h, A, z, (f, m) => oe({
|
|
888
|
+
statsSignal: l = f,
|
|
889
|
+
dataChannelSignal: y === W.Legacy ? d : void 0,
|
|
890
890
|
onVideoStateChange: r.onVideoStateChange,
|
|
891
891
|
onAgentActivityStateChange: r.onAgentActivityStateChange,
|
|
892
892
|
report: m,
|
|
893
|
-
streamType:
|
|
893
|
+
streamType: y
|
|
894
894
|
}), (f) => {
|
|
895
895
|
var m;
|
|
896
896
|
return (m = r.onConnectivityStateChange) == null ? void 0 : m.call(r, f);
|
|
897
|
-
},
|
|
898
|
-
|
|
897
|
+
}, M);
|
|
898
|
+
h.onicecandidate = (f) => {
|
|
899
899
|
var m;
|
|
900
900
|
B("peerConnection.onicecandidate", f);
|
|
901
901
|
try {
|
|
@@ -903,63 +903,63 @@ async function mt(e, t, {
|
|
|
903
903
|
candidate: f.candidate.candidate,
|
|
904
904
|
sdpMid: f.candidate.sdpMid,
|
|
905
905
|
sdpMLineIndex: f.candidate.sdpMLineIndex
|
|
906
|
-
},
|
|
906
|
+
}, u) : D(C, {
|
|
907
907
|
candidate: null
|
|
908
|
-
},
|
|
909
|
-
} catch (
|
|
910
|
-
(m = r.onError) == null || m.call(r,
|
|
908
|
+
}, u);
|
|
909
|
+
} catch (b) {
|
|
910
|
+
(m = r.onError) == null || m.call(r, b, {
|
|
911
911
|
streamId: C
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
}, E.onopen = () => {
|
|
915
|
-
o = !0, (!
|
|
915
|
+
o = !0, (!M || n) && z();
|
|
916
916
|
};
|
|
917
917
|
function I(f) {
|
|
918
|
-
d = f ===
|
|
919
|
-
statsSignal:
|
|
918
|
+
d = f === J.StreamStarted ? p.Start : p.Stop, oe({
|
|
919
|
+
statsSignal: y === W.Legacy ? l : void 0,
|
|
920
920
|
dataChannelSignal: d,
|
|
921
921
|
onVideoStateChange: r.onVideoStateChange,
|
|
922
922
|
onAgentActivityStateChange: r.onAgentActivityStateChange,
|
|
923
|
-
streamType:
|
|
923
|
+
streamType: y
|
|
924
924
|
});
|
|
925
925
|
}
|
|
926
|
-
function
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
streamMetadata:
|
|
926
|
+
function _(f, m) {
|
|
927
|
+
const b = typeof m == "string" ? m : m == null ? void 0 : m.metadata;
|
|
928
|
+
b && c.enrich({
|
|
929
|
+
streamMetadata: b
|
|
930
930
|
}), c.track("agent-chat", {
|
|
931
931
|
event: "ready"
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
|
-
const
|
|
935
|
-
[
|
|
936
|
-
[
|
|
937
|
-
[
|
|
934
|
+
const N = {
|
|
935
|
+
[J.StreamStarted]: I,
|
|
936
|
+
[J.StreamDone]: I,
|
|
937
|
+
[J.StreamReady]: _
|
|
938
938
|
};
|
|
939
939
|
E.onmessage = (f) => {
|
|
940
940
|
var U;
|
|
941
941
|
const {
|
|
942
942
|
subject: m,
|
|
943
|
-
data:
|
|
944
|
-
} =
|
|
945
|
-
(U =
|
|
946
|
-
},
|
|
943
|
+
data: b
|
|
944
|
+
} = ft(f.data);
|
|
945
|
+
(U = N[m]) == null || U.call(N, m, b);
|
|
946
|
+
}, h.oniceconnectionstatechange = () => {
|
|
947
947
|
var m;
|
|
948
|
-
B("peerConnection.oniceconnectionstatechange => " +
|
|
949
|
-
const f =
|
|
950
|
-
f !==
|
|
951
|
-
},
|
|
948
|
+
B("peerConnection.oniceconnectionstatechange => " + h.iceConnectionState);
|
|
949
|
+
const f = se(h.iceConnectionState);
|
|
950
|
+
f !== T.Connected && ((m = r.onConnectionStateChange) == null || m.call(r, f));
|
|
951
|
+
}, h.ontrack = (f) => {
|
|
952
952
|
var m;
|
|
953
953
|
B("peerConnection.ontrack", f), (m = r.onSrcObjectReady) == null || m.call(r, f.streams[0]);
|
|
954
|
-
}, await
|
|
955
|
-
const
|
|
956
|
-
return B("create answer OK"), await
|
|
954
|
+
}, await h.setRemoteDescription(L), B("set remote description OK");
|
|
955
|
+
const x = await h.createAnswer();
|
|
956
|
+
return B("create answer OK"), await h.setLocalDescription(x), B("set local description OK"), await w(C, x, u), B("start connection OK"), {
|
|
957
957
|
/**
|
|
958
958
|
* Method to send request to server to get clip or talk depend on you payload
|
|
959
959
|
* @param payload
|
|
960
960
|
*/
|
|
961
961
|
speak(f) {
|
|
962
|
-
return
|
|
962
|
+
return j(C, u, f);
|
|
963
963
|
},
|
|
964
964
|
/**
|
|
965
965
|
* Method to close RTC connection
|
|
@@ -967,29 +967,29 @@ async function mt(e, t, {
|
|
|
967
967
|
async disconnect() {
|
|
968
968
|
var f;
|
|
969
969
|
if (C) {
|
|
970
|
-
const m =
|
|
971
|
-
if (
|
|
972
|
-
if (m ===
|
|
970
|
+
const m = se(h.iceConnectionState);
|
|
971
|
+
if (h) {
|
|
972
|
+
if (m === T.New) {
|
|
973
973
|
clearInterval(S);
|
|
974
974
|
return;
|
|
975
975
|
}
|
|
976
|
-
|
|
976
|
+
h.close(), h.oniceconnectionstatechange = null, h.onnegotiationneeded = null, h.onicecandidate = null, h.ontrack = null;
|
|
977
977
|
}
|
|
978
978
|
try {
|
|
979
|
-
m ===
|
|
979
|
+
m === T.Connected && await R(C, u).catch((b) => {
|
|
980
980
|
});
|
|
981
|
-
} catch (
|
|
982
|
-
B("Error on close stream connection",
|
|
981
|
+
} catch (b) {
|
|
982
|
+
B("Error on close stream connection", b);
|
|
983
983
|
}
|
|
984
|
-
(f = r.onAgentActivityStateChange) == null || f.call(r,
|
|
984
|
+
(f = r.onAgentActivityStateChange) == null || f.call(r, V.Idle), clearInterval(S);
|
|
985
985
|
}
|
|
986
986
|
},
|
|
987
987
|
/**
|
|
988
988
|
* Method to send data channel messages to the server
|
|
989
989
|
*/
|
|
990
990
|
sendDataChannelMessage(f) {
|
|
991
|
-
var m,
|
|
992
|
-
if (!
|
|
991
|
+
var m, b;
|
|
992
|
+
if (!n || E.readyState !== "open") {
|
|
993
993
|
B("Data channel is not ready for sending messages"), (m = r.onError) == null || m.call(r, new Error("Data channel is not ready for sending messages"), {
|
|
994
994
|
streamId: C
|
|
995
995
|
});
|
|
@@ -998,7 +998,7 @@ async function mt(e, t, {
|
|
|
998
998
|
try {
|
|
999
999
|
E.send(f);
|
|
1000
1000
|
} catch (U) {
|
|
1001
|
-
B("Error sending data channel message", U), (
|
|
1001
|
+
B("Error sending data channel message", U), (b = r.onError) == null || b.call(r, U, {
|
|
1002
1002
|
streamId: C
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
@@ -1006,32 +1006,32 @@ async function mt(e, t, {
|
|
|
1006
1006
|
/**
|
|
1007
1007
|
* Session identifier information, should be returned in the body of all streaming requests
|
|
1008
1008
|
*/
|
|
1009
|
-
sessionId:
|
|
1009
|
+
sessionId: u,
|
|
1010
1010
|
/**
|
|
1011
1011
|
* Id of current RTC stream
|
|
1012
1012
|
*/
|
|
1013
1013
|
streamId: C,
|
|
1014
|
-
streamType:
|
|
1015
|
-
interruptEnabled:
|
|
1014
|
+
streamType: y,
|
|
1015
|
+
interruptEnabled: v
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function wt(e, t) {
|
|
1019
1019
|
const {
|
|
1020
|
-
streamOptions:
|
|
1020
|
+
streamOptions: a
|
|
1021
1021
|
} = t ?? {};
|
|
1022
1022
|
return {
|
|
1023
|
-
videoType:
|
|
1024
|
-
output_resolution:
|
|
1025
|
-
session_timeout:
|
|
1026
|
-
stream_warmup:
|
|
1027
|
-
compatibility_mode:
|
|
1028
|
-
fluent:
|
|
1023
|
+
videoType: je(e.presenter.type),
|
|
1024
|
+
output_resolution: a == null ? void 0 : a.outputResolution,
|
|
1025
|
+
session_timeout: a == null ? void 0 : a.sessionTimeout,
|
|
1026
|
+
stream_warmup: a == null ? void 0 : a.streamWarmup,
|
|
1027
|
+
compatibility_mode: a == null ? void 0 : a.compatibilityMode,
|
|
1028
|
+
fluent: a == null ? void 0 : a.fluent
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1032
|
-
s === W.Fluent ?
|
|
1031
|
+
function pt(e, t, a, r, s) {
|
|
1032
|
+
s === W.Fluent ? yt(e, t, a, r, s) : kt(e, t, a, r, s);
|
|
1033
1033
|
}
|
|
1034
|
-
function
|
|
1034
|
+
function yt(e, t, a, r, s) {
|
|
1035
1035
|
e === p.Start ? r.track("stream-session", {
|
|
1036
1036
|
event: "start",
|
|
1037
1037
|
"stream-type": s
|
|
@@ -1040,53 +1040,53 @@ function wt(e, t, n, r, s) {
|
|
|
1040
1040
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
1041
1041
|
background: t.presenter.type === "clip" && t.presenter.background,
|
|
1042
1042
|
"stream-type": s,
|
|
1043
|
-
...
|
|
1043
|
+
...a
|
|
1044
1044
|
});
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
|
|
1046
|
+
function vt(e, t, a, r) {
|
|
1047
|
+
F.get() <= 0 || (e === p.Start ? a.linkTrack("agent-video", {
|
|
1048
1048
|
event: "start",
|
|
1049
|
-
latency:
|
|
1049
|
+
latency: F.get(!0),
|
|
1050
1050
|
"stream-type": r
|
|
1051
|
-
}, "start", [
|
|
1051
|
+
}, "start", [J.StreamVideoCreated]) : e === p.Stop && a.linkTrack("agent-video", {
|
|
1052
1052
|
event: "stop",
|
|
1053
1053
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
1054
1054
|
background: t.presenter.type === "clip" && t.presenter.background,
|
|
1055
1055
|
"stream-type": r
|
|
1056
|
-
}, "done", [
|
|
1056
|
+
}, "done", [J.StreamVideoDone]));
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1058
|
+
function kt(e, t, a, r, s) {
|
|
1059
|
+
F.get() <= 0 || (e === p.Start ? r.linkTrack("agent-video", {
|
|
1060
1060
|
event: "start",
|
|
1061
|
-
latency:
|
|
1061
|
+
latency: F.get(!0),
|
|
1062
1062
|
"stream-type": s
|
|
1063
|
-
}, "start", [
|
|
1063
|
+
}, "start", [J.StreamVideoCreated]) : e === p.Stop && r.linkTrack("agent-video", {
|
|
1064
1064
|
event: "stop",
|
|
1065
1065
|
is_greenscreen: t.presenter.type === "clip" && t.presenter.is_greenscreen,
|
|
1066
1066
|
background: t.presenter.type === "clip" && t.presenter.background,
|
|
1067
1067
|
"stream-type": s,
|
|
1068
|
-
...
|
|
1069
|
-
}, "done", [
|
|
1068
|
+
...a
|
|
1069
|
+
}, "done", [J.StreamVideoDone]));
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1072
|
-
return
|
|
1071
|
+
function Dt(e, t, a) {
|
|
1072
|
+
return F.reset(), new Promise(async (r, s) => {
|
|
1073
1073
|
try {
|
|
1074
|
-
const i = await
|
|
1074
|
+
const i = await ht(e.id, wt(e, t), {
|
|
1075
1075
|
...t,
|
|
1076
|
-
analytics:
|
|
1076
|
+
analytics: a,
|
|
1077
1077
|
callbacks: {
|
|
1078
1078
|
...t.callbacks,
|
|
1079
1079
|
onConnectionStateChange: (c) => {
|
|
1080
|
-
var
|
|
1081
|
-
(o = (
|
|
1080
|
+
var n, o;
|
|
1081
|
+
(o = (n = t.callbacks).onConnectionStateChange) == null || o.call(n, c), c === T.Connected && r(i);
|
|
1082
1082
|
},
|
|
1083
|
-
onVideoStateChange: (c,
|
|
1083
|
+
onVideoStateChange: (c, n) => {
|
|
1084
1084
|
var o, d;
|
|
1085
|
-
(d = (o = t.callbacks).onVideoStateChange) == null || d.call(o, c),
|
|
1085
|
+
(d = (o = t.callbacks).onVideoStateChange) == null || d.call(o, c), pt(c, e, n, a, i.streamType);
|
|
1086
1086
|
},
|
|
1087
1087
|
onAgentActivityStateChange: (c) => {
|
|
1088
|
-
var
|
|
1089
|
-
(o = (
|
|
1088
|
+
var n, o;
|
|
1089
|
+
(o = (n = t.callbacks).onAgentActivityStateChange) == null || o.call(n, c), c === V.Talking ? te.update() : te.reset(), vt(c === V.Talking ? p.Start : p.Stop, e, a, i.streamType);
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
});
|
|
@@ -1095,177 +1095,177 @@ function vt(e, t, n) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
});
|
|
1097
1097
|
}
|
|
1098
|
-
async function
|
|
1099
|
-
var o, d,
|
|
1098
|
+
async function Ct(e, t, a, r, s) {
|
|
1099
|
+
var o, d, l, w;
|
|
1100
1100
|
const {
|
|
1101
1101
|
chat: i,
|
|
1102
1102
|
chatMode: c
|
|
1103
|
-
} = await
|
|
1104
|
-
if (c && c !== t.mode && (t.mode = c, (d = (o = t.callbacks).onModeChange) == null || d.call(o, c), c ===
|
|
1105
|
-
return (
|
|
1103
|
+
} = await we(e, a, r, t.mode, t.persistentChat, s);
|
|
1104
|
+
if (c && c !== t.mode && (t.mode = c, (d = (o = t.callbacks).onModeChange) == null || d.call(o, c), c === P.TextOnly))
|
|
1105
|
+
return (w = (l = t.callbacks).onError) == null || w.call(l, new De(c)), {
|
|
1106
1106
|
chat: i
|
|
1107
1107
|
};
|
|
1108
|
-
const
|
|
1108
|
+
const n = await Dt(e, t, r);
|
|
1109
1109
|
return {
|
|
1110
1110
|
chat: i,
|
|
1111
|
-
streamingManager:
|
|
1111
|
+
streamingManager: n
|
|
1112
1112
|
};
|
|
1113
1113
|
}
|
|
1114
|
-
async function
|
|
1115
|
-
var C,
|
|
1116
|
-
let
|
|
1117
|
-
const s = t.mixpanelKey ||
|
|
1114
|
+
async function Et(e, t) {
|
|
1115
|
+
var C, L, $;
|
|
1116
|
+
let a = !0, r = !1;
|
|
1117
|
+
const s = t.mixpanelKey || Le, i = t.wsURL || Be, c = t.baseURL || Q, n = {
|
|
1118
1118
|
messages: [],
|
|
1119
|
-
chatMode: t.mode ||
|
|
1120
|
-
}, o =
|
|
1119
|
+
chatMode: t.mode || P.Functional
|
|
1120
|
+
}, o = fe(t.auth, c, t.callbacks.onError), d = await o.getById(e), l = He({
|
|
1121
1121
|
token: s,
|
|
1122
1122
|
agent: d,
|
|
1123
1123
|
isEnabled: t.enableAnalitics,
|
|
1124
1124
|
distinctId: t.distinctId
|
|
1125
1125
|
}), {
|
|
1126
|
-
onMessage:
|
|
1127
|
-
clearQueue:
|
|
1128
|
-
} =
|
|
1129
|
-
var
|
|
1130
|
-
return (
|
|
1126
|
+
onMessage: w,
|
|
1127
|
+
clearQueue: j
|
|
1128
|
+
} = Ge(l, n, t, d, () => {
|
|
1129
|
+
var u;
|
|
1130
|
+
return (u = n.socketManager) == null ? void 0 : u.disconnect();
|
|
1131
1131
|
});
|
|
1132
|
-
|
|
1132
|
+
n.messages = qe(t.initialMessages), (L = (C = t.callbacks).onNewMessage) == null || L.call(C, [...n.messages], "answer"), l.track("agent-sdk", {
|
|
1133
1133
|
event: "loaded",
|
|
1134
|
-
...
|
|
1134
|
+
...Je(d)
|
|
1135
1135
|
});
|
|
1136
|
-
async function R(
|
|
1137
|
-
var
|
|
1138
|
-
(
|
|
1139
|
-
const
|
|
1140
|
-
onMessage:
|
|
1136
|
+
async function R(u) {
|
|
1137
|
+
var M, A, z, S, I, _, N;
|
|
1138
|
+
(A = (M = t.callbacks).onConnectionStateChange) == null || A.call(M, T.Connecting), F.reset(), r = !1, u && !a && (delete n.chat, (S = (z = t.callbacks).onNewMessage) == null || S.call(z, [...n.messages], "answer"));
|
|
1139
|
+
const g = G(t.mode) ? Promise.resolve(void 0) : Qe(t.auth, i, {
|
|
1140
|
+
onMessage: w,
|
|
1141
1141
|
onError: t.callbacks.onError
|
|
1142
|
-
}),
|
|
1142
|
+
}), v = ee(() => Ct(d, t, o, l, n.chat), {
|
|
1143
1143
|
limit: 3,
|
|
1144
|
-
timeout:
|
|
1144
|
+
timeout: $e,
|
|
1145
1145
|
timeoutErrorMessage: "Timeout initializing the stream",
|
|
1146
1146
|
// Retry on all errors except for connection errors and rate limit errors, these are already handled in client level.
|
|
1147
|
-
shouldRetryFn: (
|
|
1147
|
+
shouldRetryFn: (x) => (x == null ? void 0 : x.message) !== "Could not connect" && x.status !== 429,
|
|
1148
1148
|
delayMs: 1e3
|
|
1149
|
-
}).catch((
|
|
1149
|
+
}).catch((x) => {
|
|
1150
1150
|
var f, m;
|
|
1151
|
-
throw D(
|
|
1152
|
-
}), [
|
|
1151
|
+
throw D(P.Maintenance), (m = (f = t.callbacks).onConnectionStateChange) == null || m.call(f, T.Fail), x;
|
|
1152
|
+
}), [h, {
|
|
1153
1153
|
streamingManager: E,
|
|
1154
|
-
chat:
|
|
1155
|
-
}] = await Promise.all([
|
|
1156
|
-
|
|
1154
|
+
chat: y
|
|
1155
|
+
}] = await Promise.all([g, v]);
|
|
1156
|
+
y && y.id !== ((I = n.chat) == null ? void 0 : I.id) && ((N = (_ = t.callbacks).onNewChat) == null || N.call(_, y.id)), n.streamingManager = E, n.socketManager = h, n.chat = y, a = !1, D((y == null ? void 0 : y.chat_mode) ?? t.mode ?? P.Functional);
|
|
1157
1157
|
}
|
|
1158
1158
|
async function k() {
|
|
1159
|
-
var
|
|
1160
|
-
(
|
|
1159
|
+
var u, g, v, h;
|
|
1160
|
+
(u = n.socketManager) == null || u.disconnect(), await ((g = n.streamingManager) == null ? void 0 : g.disconnect()), r = !1, delete n.streamingManager, delete n.socketManager, (h = (v = t.callbacks).onConnectionStateChange) == null || h.call(v, T.Disconnected);
|
|
1161
1161
|
}
|
|
1162
|
-
async function D(
|
|
1163
|
-
var
|
|
1164
|
-
|
|
1165
|
-
mode:
|
|
1166
|
-
}),
|
|
1162
|
+
async function D(u) {
|
|
1163
|
+
var g, v;
|
|
1164
|
+
u !== n.chatMode && (l.track("agent-mode-change", {
|
|
1165
|
+
mode: u
|
|
1166
|
+
}), n.chatMode = u, n.chatMode !== P.Functional && await k(), (v = (g = t.callbacks).onModeChange) == null || v.call(g, u));
|
|
1167
1167
|
}
|
|
1168
1168
|
return {
|
|
1169
1169
|
agent: d,
|
|
1170
1170
|
getStreamType: () => {
|
|
1171
|
-
var
|
|
1172
|
-
return (
|
|
1171
|
+
var u;
|
|
1172
|
+
return (u = n.streamingManager) == null ? void 0 : u.streamType;
|
|
1173
1173
|
},
|
|
1174
1174
|
getIsInterruptEnabled: () => {
|
|
1175
|
-
var
|
|
1176
|
-
return ((
|
|
1175
|
+
var u;
|
|
1176
|
+
return ((u = n.streamingManager) == null ? void 0 : u.interruptEnabled) ?? !1;
|
|
1177
1177
|
},
|
|
1178
|
-
starterMessages: ((
|
|
1178
|
+
starterMessages: (($ = d.knowledge) == null ? void 0 : $.starter_message) || [],
|
|
1179
1179
|
getSTTToken: () => o.getSTTToken(d.id),
|
|
1180
1180
|
changeMode: D,
|
|
1181
|
-
enrichAnalytics:
|
|
1181
|
+
enrichAnalytics: l.enrich,
|
|
1182
1182
|
async connect() {
|
|
1183
|
-
var
|
|
1184
|
-
await R(!0),
|
|
1183
|
+
var u;
|
|
1184
|
+
await R(!0), l.track("agent-chat", {
|
|
1185
1185
|
event: "connect",
|
|
1186
|
-
chatId: (
|
|
1186
|
+
chatId: (u = n.chat) == null ? void 0 : u.id,
|
|
1187
1187
|
agentId: d.id,
|
|
1188
|
-
mode:
|
|
1188
|
+
mode: n.chatMode
|
|
1189
1189
|
});
|
|
1190
1190
|
},
|
|
1191
1191
|
async reconnect() {
|
|
1192
|
-
var
|
|
1193
|
-
await k(), await R(!1),
|
|
1192
|
+
var u;
|
|
1193
|
+
await k(), await R(!1), l.track("agent-chat", {
|
|
1194
1194
|
event: "reconnect",
|
|
1195
|
-
chatId: (
|
|
1195
|
+
chatId: (u = n.chat) == null ? void 0 : u.id,
|
|
1196
1196
|
agentId: d.id,
|
|
1197
|
-
mode:
|
|
1197
|
+
mode: n.chatMode
|
|
1198
1198
|
});
|
|
1199
1199
|
},
|
|
1200
1200
|
async disconnect() {
|
|
1201
|
-
var
|
|
1202
|
-
await k(),
|
|
1201
|
+
var u;
|
|
1202
|
+
await k(), l.track("agent-chat", {
|
|
1203
1203
|
event: "disconnect",
|
|
1204
|
-
chatId: (
|
|
1204
|
+
chatId: (u = n.chat) == null ? void 0 : u.id,
|
|
1205
1205
|
agentId: d.id,
|
|
1206
|
-
mode:
|
|
1206
|
+
mode: n.chatMode
|
|
1207
1207
|
});
|
|
1208
1208
|
},
|
|
1209
|
-
async chat(
|
|
1210
|
-
var E,
|
|
1211
|
-
const
|
|
1212
|
-
if (t.mode
|
|
1213
|
-
throw new K(
|
|
1214
|
-
if (
|
|
1209
|
+
async chat(u) {
|
|
1210
|
+
var E, y, M, A, z;
|
|
1211
|
+
const g = () => {
|
|
1212
|
+
if (G(t.mode))
|
|
1213
|
+
throw new K(`${t.mode} is enabled, chat is disabled`);
|
|
1214
|
+
if (u.length >= 800)
|
|
1215
1215
|
throw new K("Message cannot be more than 800 characters");
|
|
1216
|
-
if (
|
|
1216
|
+
if (u.length === 0)
|
|
1217
1217
|
throw new K("Message cannot be empty");
|
|
1218
|
-
if (
|
|
1218
|
+
if (n.chatMode === P.Maintenance)
|
|
1219
1219
|
throw new K("Chat is in maintenance mode");
|
|
1220
|
-
if (![
|
|
1221
|
-
if (!
|
|
1220
|
+
if (![P.TextOnly, P.Playground].includes(n.chatMode)) {
|
|
1221
|
+
if (!n.streamingManager)
|
|
1222
1222
|
throw new K("Streaming manager is not initialized");
|
|
1223
|
-
if (!
|
|
1223
|
+
if (!n.chat)
|
|
1224
1224
|
throw new K("Chat is not initialized");
|
|
1225
1225
|
}
|
|
1226
|
-
},
|
|
1226
|
+
}, v = async () => {
|
|
1227
1227
|
var S, I;
|
|
1228
|
-
if (!
|
|
1229
|
-
const
|
|
1230
|
-
if (!
|
|
1231
|
-
throw new
|
|
1232
|
-
|
|
1228
|
+
if (!n.chat) {
|
|
1229
|
+
const _ = await we(d, o, l, n.chatMode, t.persistentChat);
|
|
1230
|
+
if (!_.chat)
|
|
1231
|
+
throw new ke(n.chatMode, !!t.persistentChat);
|
|
1232
|
+
n.chat = _.chat, (I = (S = t.callbacks).onNewChat) == null || I.call(S, n.chat.id);
|
|
1233
1233
|
}
|
|
1234
|
-
return
|
|
1235
|
-
},
|
|
1236
|
-
var
|
|
1234
|
+
return n.chat.id;
|
|
1235
|
+
}, h = async (S, I) => ee(() => {
|
|
1236
|
+
var _, N;
|
|
1237
1237
|
return o.chat(d.id, I, {
|
|
1238
|
-
chatMode:
|
|
1239
|
-
streamId: (
|
|
1240
|
-
sessionId: (
|
|
1238
|
+
chatMode: n.chatMode,
|
|
1239
|
+
streamId: (_ = n.streamingManager) == null ? void 0 : _.streamId,
|
|
1240
|
+
sessionId: (N = n.streamingManager) == null ? void 0 : N.sessionId,
|
|
1241
1241
|
messages: S.map(({
|
|
1242
|
-
matches:
|
|
1242
|
+
matches: x,
|
|
1243
1243
|
...f
|
|
1244
1244
|
}) => f)
|
|
1245
1245
|
}, {
|
|
1246
|
-
...
|
|
1246
|
+
...he(n.chatMode),
|
|
1247
1247
|
skipErrorHandler: !0
|
|
1248
1248
|
});
|
|
1249
1249
|
}, {
|
|
1250
1250
|
limit: 2,
|
|
1251
|
-
shouldRetryFn: (
|
|
1252
|
-
var f, m,
|
|
1253
|
-
const
|
|
1254
|
-
return !((m =
|
|
1251
|
+
shouldRetryFn: (_) => {
|
|
1252
|
+
var f, m, b, U;
|
|
1253
|
+
const N = (f = _ == null ? void 0 : _.message) == null ? void 0 : f.includes("missing or invalid session_id");
|
|
1254
|
+
return !((m = _ == null ? void 0 : _.message) == null ? void 0 : m.includes("Stream Error")) && !N ? ((U = (b = t.callbacks).onError) == null || U.call(b, _), !1) : !0;
|
|
1255
1255
|
},
|
|
1256
1256
|
onRetry: async () => {
|
|
1257
1257
|
await k(), await R(!1);
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
1260
|
try {
|
|
1261
|
-
|
|
1261
|
+
j(), g(), n.messages.push({
|
|
1262
1262
|
id: q(),
|
|
1263
1263
|
role: "user",
|
|
1264
|
-
content:
|
|
1265
|
-
created_at: new Date(
|
|
1266
|
-
}), (
|
|
1267
|
-
const S = await
|
|
1268
|
-
return
|
|
1264
|
+
content: u,
|
|
1265
|
+
created_at: new Date(F.update()).toISOString()
|
|
1266
|
+
}), (y = (E = t.callbacks).onNewMessage) == null || y.call(E, [...n.messages], "user");
|
|
1267
|
+
const S = await v(), I = await h([...n.messages], S);
|
|
1268
|
+
return n.messages.push({
|
|
1269
1269
|
id: q(),
|
|
1270
1270
|
role: "assistant",
|
|
1271
1271
|
content: I.result || "",
|
|
@@ -1273,149 +1273,161 @@ async function Ct(e, t) {
|
|
|
1273
1273
|
context: I.context,
|
|
1274
1274
|
matches: I.matches,
|
|
1275
1275
|
videoId: I.videoId
|
|
1276
|
-
}), r && I.videoId &&
|
|
1276
|
+
}), r && I.videoId && n.streamingManager && (r = !1, n.messages[n.messages.length - 1].interrupted = !0, await ie(n.streamingManager, I.videoId)), l.track("agent-message-send", {
|
|
1277
1277
|
event: "success",
|
|
1278
|
-
mode:
|
|
1279
|
-
messages:
|
|
1280
|
-
}), I.result && ((
|
|
1281
|
-
latency:
|
|
1282
|
-
mode:
|
|
1283
|
-
messages:
|
|
1278
|
+
mode: n.chatMode,
|
|
1279
|
+
messages: n.messages.length + 1
|
|
1280
|
+
}), I.result && ((A = (M = t.callbacks).onNewMessage) == null || A.call(M, [...n.messages], "answer"), l.track("agent-message-received", {
|
|
1281
|
+
latency: F.get(!0),
|
|
1282
|
+
mode: n.chatMode,
|
|
1283
|
+
messages: n.messages.length
|
|
1284
1284
|
})), I;
|
|
1285
1285
|
} catch (S) {
|
|
1286
|
-
throw r = !1, ((
|
|
1286
|
+
throw r = !1, ((z = n.messages[n.messages.length - 1]) == null ? void 0 : z.role) === "assistant" && n.messages.pop(), l.track("agent-message-send", {
|
|
1287
1287
|
event: "error",
|
|
1288
|
-
mode:
|
|
1289
|
-
messages:
|
|
1288
|
+
mode: n.chatMode,
|
|
1289
|
+
messages: n.messages.length
|
|
1290
1290
|
}), S;
|
|
1291
1291
|
}
|
|
1292
1292
|
},
|
|
1293
|
-
rate(
|
|
1294
|
-
var
|
|
1295
|
-
const
|
|
1296
|
-
if (
|
|
1297
|
-
if (!
|
|
1293
|
+
rate(u, g, v) {
|
|
1294
|
+
var y, M, A, z;
|
|
1295
|
+
const h = n.messages.find((S) => S.id === u);
|
|
1296
|
+
if (n.chat) {
|
|
1297
|
+
if (!h)
|
|
1298
1298
|
throw new Error("Message not found");
|
|
1299
1299
|
} else
|
|
1300
1300
|
throw new Error("Chat is not initialized");
|
|
1301
|
-
const E = ((
|
|
1302
|
-
return
|
|
1303
|
-
event:
|
|
1304
|
-
thumb:
|
|
1305
|
-
knowledge_id: ((
|
|
1306
|
-
mode:
|
|
1301
|
+
const E = ((y = h.matches) == null ? void 0 : y.map((S) => [S.document_id, S.id])) ?? [];
|
|
1302
|
+
return l.track("agent-rate", {
|
|
1303
|
+
event: v ? "update" : "create",
|
|
1304
|
+
thumb: g === 1 ? "up" : "down",
|
|
1305
|
+
knowledge_id: ((M = d.knowledge) == null ? void 0 : M.id) ?? "",
|
|
1306
|
+
mode: n.chatMode,
|
|
1307
1307
|
matches: E,
|
|
1308
|
-
score:
|
|
1309
|
-
}),
|
|
1310
|
-
knowledge_id: ((
|
|
1311
|
-
message_id:
|
|
1308
|
+
score: g
|
|
1309
|
+
}), v ? o.updateRating(d.id, n.chat.id, v, {
|
|
1310
|
+
knowledge_id: ((A = d.knowledge) == null ? void 0 : A.id) ?? "",
|
|
1311
|
+
message_id: u,
|
|
1312
1312
|
matches: E,
|
|
1313
|
-
score:
|
|
1314
|
-
}) : o.createRating(d.id,
|
|
1315
|
-
knowledge_id: ((
|
|
1316
|
-
message_id:
|
|
1313
|
+
score: g
|
|
1314
|
+
}) : o.createRating(d.id, n.chat.id, {
|
|
1315
|
+
knowledge_id: ((z = d.knowledge) == null ? void 0 : z.id) ?? "",
|
|
1316
|
+
message_id: u,
|
|
1317
1317
|
matches: E,
|
|
1318
|
-
score:
|
|
1318
|
+
score: g
|
|
1319
1319
|
});
|
|
1320
1320
|
},
|
|
1321
|
-
deleteRate(
|
|
1322
|
-
var
|
|
1323
|
-
if (!
|
|
1321
|
+
deleteRate(u) {
|
|
1322
|
+
var g;
|
|
1323
|
+
if (!n.chat)
|
|
1324
1324
|
throw new Error("Chat is not initialized");
|
|
1325
|
-
return
|
|
1325
|
+
return l.track("agent-rate-delete", {
|
|
1326
1326
|
type: "text",
|
|
1327
|
-
chat_id: (
|
|
1328
|
-
id:
|
|
1329
|
-
mode:
|
|
1330
|
-
}), o.deleteRating(d.id,
|
|
1327
|
+
chat_id: (g = n.chat) == null ? void 0 : g.id,
|
|
1328
|
+
id: u,
|
|
1329
|
+
mode: n.chatMode
|
|
1330
|
+
}), o.deleteRating(d.id, n.chat.id, u);
|
|
1331
1331
|
},
|
|
1332
|
-
async speak(
|
|
1333
|
-
var E,
|
|
1334
|
-
function
|
|
1335
|
-
if (typeof
|
|
1332
|
+
async speak(u) {
|
|
1333
|
+
var E, y, M;
|
|
1334
|
+
function g() {
|
|
1335
|
+
if (typeof u == "string") {
|
|
1336
1336
|
if (!d.presenter.voice)
|
|
1337
1337
|
throw new Error("Presenter voice is not initialized");
|
|
1338
1338
|
return {
|
|
1339
1339
|
type: "text",
|
|
1340
1340
|
provider: d.presenter.voice,
|
|
1341
|
-
input:
|
|
1341
|
+
input: u,
|
|
1342
1342
|
ssml: !1
|
|
1343
1343
|
};
|
|
1344
1344
|
}
|
|
1345
|
-
if (
|
|
1345
|
+
if (u.type === "text" && !u.provider) {
|
|
1346
1346
|
if (!d.presenter.voice)
|
|
1347
1347
|
throw new Error("Presenter voice is not initialized");
|
|
1348
1348
|
return {
|
|
1349
1349
|
type: "text",
|
|
1350
1350
|
provider: d.presenter.voice,
|
|
1351
|
-
input:
|
|
1352
|
-
ssml:
|
|
1351
|
+
input: u.input,
|
|
1352
|
+
ssml: u.ssml
|
|
1353
1353
|
};
|
|
1354
1354
|
}
|
|
1355
|
-
return
|
|
1355
|
+
return u;
|
|
1356
1356
|
}
|
|
1357
|
-
const
|
|
1358
|
-
if (
|
|
1357
|
+
const v = g();
|
|
1358
|
+
if (l.track("agent-speak", v), F.update(), n.messages && v.type === "text" && (n.messages.push({
|
|
1359
1359
|
id: q(),
|
|
1360
1360
|
role: "assistant",
|
|
1361
|
-
content:
|
|
1362
|
-
created_at: new Date(
|
|
1363
|
-
}), (
|
|
1361
|
+
content: v.input,
|
|
1362
|
+
created_at: new Date(F.get(!0)).toISOString()
|
|
1363
|
+
}), (y = (E = t.callbacks).onNewMessage) == null || y.call(E, [...n.messages], "answer")), ze(n.chatMode))
|
|
1364
1364
|
return {
|
|
1365
1365
|
duration: 0,
|
|
1366
1366
|
status: "success"
|
|
1367
1367
|
};
|
|
1368
|
-
if (!
|
|
1368
|
+
if (!n.streamingManager)
|
|
1369
1369
|
throw new Error("Please connect to the agent first");
|
|
1370
|
-
return
|
|
1371
|
-
script:
|
|
1370
|
+
return n.streamingManager.speak({
|
|
1371
|
+
script: v,
|
|
1372
1372
|
metadata: {
|
|
1373
|
-
chat_id: (
|
|
1373
|
+
chat_id: (M = n.chat) == null ? void 0 : M.id,
|
|
1374
1374
|
agent_id: d.id
|
|
1375
1375
|
}
|
|
1376
1376
|
});
|
|
1377
1377
|
},
|
|
1378
|
-
async interrupt(
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1378
|
+
async interrupt({
|
|
1379
|
+
type: u
|
|
1380
|
+
}) {
|
|
1381
|
+
var h, E, y, M, A;
|
|
1382
|
+
const g = n.messages[n.messages.length - 1], v = (g == null ? void 0 : g.role) === "user";
|
|
1383
|
+
if (Ve(n.streamingManager, n.chat, (h = n.streamingManager) == null ? void 0 : h.streamType, v, !!(g != null && g.videoId)), l.track("agent-video-interrupt", {
|
|
1384
|
+
type: u || "click",
|
|
1385
|
+
stream_id: (E = n.streamingManager) == null ? void 0 : E.streamId,
|
|
1386
|
+
agent_id: d.id,
|
|
1387
|
+
owner_id: d.owner_id,
|
|
1388
|
+
video_duration_to_interrupt: te.get(!0),
|
|
1389
|
+
message_duration_to_interrupt: F.get(!0),
|
|
1390
|
+
chat_id: (y = n.chat) == null ? void 0 : y.id,
|
|
1391
|
+
mode: n.chatMode,
|
|
1392
|
+
queued_interrupt: v
|
|
1393
|
+
}), v) {
|
|
1382
1394
|
r = !0;
|
|
1383
1395
|
return;
|
|
1384
1396
|
}
|
|
1385
|
-
|
|
1397
|
+
g.interrupted = !0, (A = (M = t.callbacks).onNewMessage) == null || A.call(M, [...n.messages], "answer"), ie(n.streamingManager, g.videoId);
|
|
1386
1398
|
}
|
|
1387
1399
|
};
|
|
1388
1400
|
}
|
|
1389
|
-
function
|
|
1401
|
+
function St(e, t, a) {
|
|
1390
1402
|
const {
|
|
1391
1403
|
getById: r
|
|
1392
|
-
} =
|
|
1404
|
+
} = fe(t, a || Q);
|
|
1393
1405
|
return r(e);
|
|
1394
1406
|
}
|
|
1395
1407
|
export {
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1408
|
+
V as AgentActivityState,
|
|
1409
|
+
Se as AgentStatus,
|
|
1410
|
+
ke as ChatCreationFailed,
|
|
1411
|
+
P as ChatMode,
|
|
1412
|
+
De as ChatModeDowngraded,
|
|
1401
1413
|
H as ChatProgress,
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1414
|
+
T as ConnectionState,
|
|
1415
|
+
Y as ConnectivityState,
|
|
1416
|
+
Te as DocumentType,
|
|
1417
|
+
Me as KnowledgeType,
|
|
1418
|
+
Ee as PlanGroup,
|
|
1419
|
+
be as Providers,
|
|
1420
|
+
Ie as RateState,
|
|
1421
|
+
J as StreamEvents,
|
|
1410
1422
|
W as StreamType,
|
|
1411
1423
|
p as StreamingState,
|
|
1412
|
-
|
|
1413
|
-
|
|
1424
|
+
_e as Subject,
|
|
1425
|
+
Re as UserPlan,
|
|
1414
1426
|
K as ValidationError,
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1427
|
+
ce as VideoType,
|
|
1428
|
+
Pe as VoiceAccess,
|
|
1429
|
+
Ce as WsError,
|
|
1430
|
+
Et as createAgentManager,
|
|
1431
|
+
St as getAgent,
|
|
1432
|
+
je as mapVideoType
|
|
1421
1433
|
};
|