@d-id/client-sdk 1.1.22-staging.102 → 1.1.22-staging.103
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-DRoGHx1v.js → index-Cx4MD7mS.js} +381 -373
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +5 -5
- package/dist/{livekit-manager-t6ipl1oJ.js → livekit-manager-BKZAOT9G.js} +31 -31
- package/dist/src/services/analytics/timestamp-tracker.d.ts +5 -0
- package/dist/src/types/stream/stream.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as l, a as k, S as b, d as ee, T as ne, C as u, b as w, A as _, e as N, f as $, g as te } from "./index-
|
|
2
|
-
function oe(c,
|
|
3
|
-
const
|
|
1
|
+
import { c as l, a as k, S as b, d as ee, T as ne, C as u, b as w, A as _, e as N, f as $, g as te } from "./index-Cx4MD7mS.js";
|
|
2
|
+
function oe(c, y, s, o) {
|
|
3
|
+
const v = l(c, `${y}/v2/agents/${s}`, o);
|
|
4
4
|
return {
|
|
5
5
|
async createStream(a) {
|
|
6
|
-
return
|
|
6
|
+
return v.post("/sessions", a);
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
9
|
}
|
|
@@ -26,17 +26,17 @@ const re = {
|
|
|
26
26
|
kind: "InternalServerError",
|
|
27
27
|
description: "Stream Error"
|
|
28
28
|
});
|
|
29
|
-
function U(c,
|
|
30
|
-
var
|
|
31
|
-
throw
|
|
29
|
+
function U(c, y, s, o) {
|
|
30
|
+
var v, a;
|
|
31
|
+
throw y("Failed to connect to LiveKit room:", c), o(), (v = s.onConnectionStateChange) == null || v.call(s, u.Fail), (a = s.onError) == null || a.call(s, c, { sessionId: "" }), c;
|
|
32
32
|
}
|
|
33
|
-
async function se(c,
|
|
33
|
+
async function se(c, y, s) {
|
|
34
34
|
var P, I;
|
|
35
|
-
const o = k(s.debug || !1, "LiveKitStreamingManager"), { Room:
|
|
35
|
+
const o = k(s.debug || !1, "LiveKitStreamingManager"), { Room: v, RoomEvent: a, ConnectionState: p } = await ie(), { callbacks: e, auth: j, baseURL: x, analytics: V } = s;
|
|
36
36
|
let g = null, E = !1;
|
|
37
37
|
const F = b.Fluent;
|
|
38
|
-
let T = !0,
|
|
39
|
-
g = new
|
|
38
|
+
let T = !0, f = null;
|
|
39
|
+
g = new v({
|
|
40
40
|
adaptiveStream: !1,
|
|
41
41
|
// Must be false to use mediaStreamTrack directly
|
|
42
42
|
dynacast: !0
|
|
@@ -46,7 +46,7 @@ async function se(c, v, s) {
|
|
|
46
46
|
try {
|
|
47
47
|
const n = await O.createStream({
|
|
48
48
|
transport_provider: ne.Livekit,
|
|
49
|
-
chat_persist:
|
|
49
|
+
chat_persist: y.chat_persist ?? !0
|
|
50
50
|
}), { id: t, session_token: i, session_url: r } = n;
|
|
51
51
|
(P = e.onStreamCreated) == null || P.call(e, { session_id: t, stream_id: t, agent_id: c }), S = t, A = i, M = r, await g.prepareConnection(M, A);
|
|
52
52
|
} catch (n) {
|
|
@@ -70,22 +70,22 @@ async function se(c, v, s) {
|
|
|
70
70
|
function J(n) {
|
|
71
71
|
var t, i, r, d, C;
|
|
72
72
|
switch (o("Connection state changed:", n), n) {
|
|
73
|
-
case
|
|
73
|
+
case p.Connecting:
|
|
74
74
|
(t = e.onConnectionStateChange) == null || t.call(e, u.Connecting);
|
|
75
75
|
break;
|
|
76
|
-
case
|
|
76
|
+
case p.Connected:
|
|
77
77
|
o("LiveKit room connected successfully"), E = !0, T ? queueMicrotask(() => {
|
|
78
|
-
var
|
|
79
|
-
(
|
|
78
|
+
var m;
|
|
79
|
+
(m = e.onConnectionStateChange) == null || m.call(e, u.Connected);
|
|
80
80
|
}) : (i = e.onConnectionStateChange) == null || i.call(e, u.Connected);
|
|
81
81
|
break;
|
|
82
|
-
case
|
|
82
|
+
case p.Disconnected:
|
|
83
83
|
o("LiveKit room disconnected"), E = !1, (r = e.onConnectionStateChange) == null || r.call(e, u.Disconnected);
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
85
|
+
case p.Reconnecting:
|
|
86
86
|
o("LiveKit room reconnecting..."), (d = e.onConnectionStateChange) == null || d.call(e, u.Connecting);
|
|
87
87
|
break;
|
|
88
|
-
case
|
|
88
|
+
case p.SignalReconnecting:
|
|
89
89
|
o("LiveKit room signal reconnecting..."), (C = e.onConnectionStateChange) == null || C.call(e, u.Connecting);
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
@@ -102,34 +102,34 @@ async function se(c, v, s) {
|
|
|
102
102
|
o("Participant connected:", n.identity);
|
|
103
103
|
}
|
|
104
104
|
function W(n, t, i) {
|
|
105
|
-
var d, C;
|
|
105
|
+
var d, C, m;
|
|
106
106
|
o(`Track subscribed: ${n.kind} from ${i.identity}`);
|
|
107
107
|
const r = n.mediaStreamTrack;
|
|
108
108
|
if (!r) {
|
|
109
109
|
o(`No mediaStreamTrack available for ${n.kind}`);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
f ? (f.addTrack(r), o(`Added ${n.kind} track to shared MediaStream`)) : (f = new MediaStream([r]), o(`Created shared MediaStream with ${n.kind} track`)), n.kind === "video" && ((d = e.onStreamReady) == null || d.call(e), (C = e.onSrcObjectReady) == null || C.call(e, f), (m = e.onVideoStateChange) == null || m.call(e, N.Start));
|
|
113
113
|
}
|
|
114
114
|
function B(n, t, i) {
|
|
115
115
|
var r;
|
|
116
116
|
o(`Track unsubscribed: ${n.kind} from ${i.identity}`), n.kind === "video" && ((r = e.onVideoStateChange) == null || r.call(e, N.Stop));
|
|
117
117
|
}
|
|
118
118
|
function G(n, t, i, r) {
|
|
119
|
-
var C,
|
|
119
|
+
var C, m;
|
|
120
120
|
const d = new TextDecoder().decode(n);
|
|
121
121
|
o("Data received:", d);
|
|
122
122
|
try {
|
|
123
|
-
const h = JSON.parse(d),
|
|
124
|
-
if (
|
|
123
|
+
const h = JSON.parse(d), D = r || h.subject;
|
|
124
|
+
if (D === $.ChatAnswer) {
|
|
125
125
|
const L = te.Answer;
|
|
126
126
|
(C = e.onMessage) == null || C.call(e, L, {
|
|
127
127
|
event: L,
|
|
128
128
|
...h
|
|
129
129
|
});
|
|
130
|
-
} else if ([$.StreamVideoCreated, $.StreamVideoDone].includes(
|
|
130
|
+
} else if ([$.StreamVideoCreated, $.StreamVideoDone].includes(D)) {
|
|
131
131
|
const L = (h == null ? void 0 : h.role) || (t == null ? void 0 : t.identity) || "datachannel";
|
|
132
|
-
(
|
|
132
|
+
(m = e.onMessage) == null || m.call(e, D, {
|
|
133
133
|
[L]: h
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -149,9 +149,9 @@ async function se(c, v, s) {
|
|
|
149
149
|
o("Track subscription failed:", { trackSid: n, participant: t, reason: i });
|
|
150
150
|
}
|
|
151
151
|
function Z() {
|
|
152
|
-
|
|
152
|
+
f && (f.getTracks().forEach((n) => n.stop()), f = null);
|
|
153
153
|
}
|
|
154
|
-
async function
|
|
154
|
+
async function R(n, t = "lk.chat") {
|
|
155
155
|
var i, r;
|
|
156
156
|
if (!E || !g) {
|
|
157
157
|
o("Room is not connected for sending messages"), (i = e.onError) == null || i.call(e, new Error(K), {
|
|
@@ -168,7 +168,7 @@ async function se(c, v, s) {
|
|
|
168
168
|
return {
|
|
169
169
|
speak(n) {
|
|
170
170
|
const t = typeof n == "string" ? n : JSON.stringify(n);
|
|
171
|
-
return
|
|
171
|
+
return R(
|
|
172
172
|
t,
|
|
173
173
|
"did.speak"
|
|
174
174
|
/* Speak */
|
|
@@ -178,8 +178,8 @@ async function se(c, v, s) {
|
|
|
178
178
|
var n, t;
|
|
179
179
|
g && (await g.disconnect(), g = null), Z(), E = !1, (n = e.onConnectionStateChange) == null || n.call(e, u.Completed), (t = e.onAgentActivityStateChange) == null || t.call(e, _.Idle);
|
|
180
180
|
},
|
|
181
|
-
sendDataChannelMessage:
|
|
182
|
-
sendTextMessage:
|
|
181
|
+
sendDataChannelMessage: R,
|
|
182
|
+
sendTextMessage: R,
|
|
183
183
|
sessionId: S,
|
|
184
184
|
streamId: S,
|
|
185
185
|
streamType: F,
|