@asgard-js/core 0.0.43-canary.25 → 0.0.43-canary.3
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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -127
- package/dist/index.mjs.map +1 -1
- package/dist/lib/create-sse-observable.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/create-sse-observable.ts +20 -1
- package/src/types/index.ts +0 -1
- package/dist/types/auth.d.ts +0 -2
- package/dist/types/auth.d.ts.map +0 -1
- package/src/types/auth.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var De = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var m = (n, t, e) =>
|
|
4
|
-
var K = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n))(K || {}),
|
|
2
|
+
var Ne = (n, t, e) => t in n ? De(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
+
var m = (n, t, e) => Ne(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
var K = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n))(K || {}), y = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(y || {}), Ue = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n))(Ue || {}), Y = function(n, t) {
|
|
5
5
|
return Y = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
6
6
|
e.__proto__ = r;
|
|
7
7
|
} || function(e, r) {
|
|
@@ -27,15 +27,15 @@ function $e(n, t, e, r) {
|
|
|
27
27
|
function c(f) {
|
|
28
28
|
try {
|
|
29
29
|
u(r.next(f));
|
|
30
|
-
} catch (
|
|
31
|
-
s(
|
|
30
|
+
} catch (d) {
|
|
31
|
+
s(d);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function a(f) {
|
|
35
35
|
try {
|
|
36
36
|
u(r.throw(f));
|
|
37
|
-
} catch (
|
|
38
|
-
s(
|
|
37
|
+
} catch (d) {
|
|
38
|
+
s(d);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function u(f) {
|
|
@@ -104,7 +104,7 @@ function ce(n, t) {
|
|
|
104
104
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function R(n) {
|
|
108
108
|
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
|
|
109
109
|
if (e) return e.call(n);
|
|
110
110
|
if (n && typeof n.length == "number") return {
|
|
@@ -131,13 +131,13 @@ function L(n, t) {
|
|
|
131
131
|
}
|
|
132
132
|
return o;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function M(n, t, e) {
|
|
135
135
|
if (e || arguments.length === 2) for (var r = 0, i = t.length, o; r < i; r++)
|
|
136
136
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
137
137
|
return n.concat(o || Array.prototype.slice.call(t));
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
return this instanceof
|
|
139
|
+
function C(n) {
|
|
140
|
+
return this instanceof C ? (this.v = n, this) : new C(n);
|
|
141
141
|
}
|
|
142
142
|
function Ge(n, t, e) {
|
|
143
143
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
@@ -147,30 +147,30 @@ function Ge(n, t, e) {
|
|
|
147
147
|
}, i;
|
|
148
148
|
function s(l) {
|
|
149
149
|
return function(v) {
|
|
150
|
-
return Promise.resolve(v).then(l,
|
|
150
|
+
return Promise.resolve(v).then(l, d);
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function c(l, v) {
|
|
154
|
-
r[l] && (i[l] = function(
|
|
154
|
+
r[l] && (i[l] = function(h) {
|
|
155
155
|
return new Promise(function(g, w) {
|
|
156
|
-
o.push([l,
|
|
156
|
+
o.push([l, h, g, w]) > 1 || a(l, h);
|
|
157
157
|
});
|
|
158
158
|
}, v && (i[l] = v(i[l])));
|
|
159
159
|
}
|
|
160
160
|
function a(l, v) {
|
|
161
161
|
try {
|
|
162
162
|
u(r[l](v));
|
|
163
|
-
} catch (
|
|
164
|
-
b(o[0][3],
|
|
163
|
+
} catch (h) {
|
|
164
|
+
b(o[0][3], h);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
function u(l) {
|
|
168
|
-
l.value instanceof
|
|
168
|
+
l.value instanceof C ? Promise.resolve(l.value.v).then(f, d) : b(o[0][2], l);
|
|
169
169
|
}
|
|
170
170
|
function f(l) {
|
|
171
171
|
a("next", l);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function d(l) {
|
|
174
174
|
a("throw", l);
|
|
175
175
|
}
|
|
176
176
|
function b(l, v) {
|
|
@@ -180,7 +180,7 @@ function Ge(n, t, e) {
|
|
|
180
180
|
function Fe(n) {
|
|
181
181
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
182
182
|
var t = n[Symbol.asyncIterator], e;
|
|
183
|
-
return t ? t.call(n) : (n = typeof
|
|
183
|
+
return t ? t.call(n) : (n = typeof R == "function" ? R(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
|
|
184
184
|
return this;
|
|
185
185
|
}, e);
|
|
186
186
|
function r(o) {
|
|
@@ -214,7 +214,7 @@ var B = fe(function(n) {
|
|
|
214
214
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
215
215
|
};
|
|
216
216
|
});
|
|
217
|
-
function
|
|
217
|
+
function U(n, t) {
|
|
218
218
|
if (n) {
|
|
219
219
|
var e = n.indexOf(t);
|
|
220
220
|
0 <= e && n.splice(e, 1);
|
|
@@ -232,12 +232,12 @@ var k = function() {
|
|
|
232
232
|
if (s)
|
|
233
233
|
if (this._parentage = null, Array.isArray(s))
|
|
234
234
|
try {
|
|
235
|
-
for (var c =
|
|
235
|
+
for (var c = R(s), a = c.next(); !a.done; a = c.next()) {
|
|
236
236
|
var u = a.value;
|
|
237
237
|
u.remove(this);
|
|
238
238
|
}
|
|
239
|
-
} catch (
|
|
240
|
-
t = { error:
|
|
239
|
+
} catch (h) {
|
|
240
|
+
t = { error: h };
|
|
241
241
|
} finally {
|
|
242
242
|
try {
|
|
243
243
|
a && !a.done && (e = c.return) && e.call(c);
|
|
@@ -251,23 +251,23 @@ var k = function() {
|
|
|
251
251
|
if (p(f))
|
|
252
252
|
try {
|
|
253
253
|
f();
|
|
254
|
-
} catch (
|
|
255
|
-
o =
|
|
254
|
+
} catch (h) {
|
|
255
|
+
o = h instanceof B ? h.errors : [h];
|
|
256
256
|
}
|
|
257
|
-
var
|
|
258
|
-
if (
|
|
257
|
+
var d = this._finalizers;
|
|
258
|
+
if (d) {
|
|
259
259
|
this._finalizers = null;
|
|
260
260
|
try {
|
|
261
|
-
for (var b =
|
|
261
|
+
for (var b = R(d), l = b.next(); !l.done; l = b.next()) {
|
|
262
262
|
var v = l.value;
|
|
263
263
|
try {
|
|
264
264
|
ee(v);
|
|
265
|
-
} catch (
|
|
266
|
-
o = o ?? [],
|
|
265
|
+
} catch (h) {
|
|
266
|
+
o = o ?? [], h instanceof B ? o = M(M([], L(o)), L(h.errors)) : o.push(h);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
} catch (
|
|
270
|
-
r = { error:
|
|
269
|
+
} catch (h) {
|
|
270
|
+
r = { error: h };
|
|
271
271
|
} finally {
|
|
272
272
|
try {
|
|
273
273
|
l && !l.done && (i = b.return) && i.call(b);
|
|
@@ -300,10 +300,10 @@ var k = function() {
|
|
|
300
300
|
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
301
301
|
}, n.prototype._removeParent = function(t) {
|
|
302
302
|
var e = this._parentage;
|
|
303
|
-
e === t ? this._parentage = null : Array.isArray(e) &&
|
|
303
|
+
e === t ? this._parentage = null : Array.isArray(e) && U(e, t);
|
|
304
304
|
}, n.prototype.remove = function(t) {
|
|
305
305
|
var e = this._finalizers;
|
|
306
|
-
e &&
|
|
306
|
+
e && U(e, t), t instanceof n && t._removeParent(this);
|
|
307
307
|
}, n.EMPTY = function() {
|
|
308
308
|
var t = new n();
|
|
309
309
|
return t.closed = !0, t;
|
|
@@ -325,7 +325,7 @@ var He = {
|
|
|
325
325
|
setTimeout: function(n, t) {
|
|
326
326
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
327
327
|
e[r - 2] = arguments[r];
|
|
328
|
-
return setTimeout.apply(void 0,
|
|
328
|
+
return setTimeout.apply(void 0, M([n, t], L(e)));
|
|
329
329
|
},
|
|
330
330
|
clearTimeout: function(n) {
|
|
331
331
|
var t = he.delegate;
|
|
@@ -340,7 +340,7 @@ function ye(n) {
|
|
|
340
340
|
}
|
|
341
341
|
function q() {
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function N(n) {
|
|
344
344
|
n();
|
|
345
345
|
}
|
|
346
346
|
var X = function(n) {
|
|
@@ -450,7 +450,7 @@ var S = function() {
|
|
|
450
450
|
return e.source = this, e.operator = t, e;
|
|
451
451
|
}, n.prototype.subscribe = function(t, e, r) {
|
|
452
452
|
var i = this, o = We(t) ? t : new W(t, e, r);
|
|
453
|
-
return
|
|
453
|
+
return N(function() {
|
|
454
454
|
var s = i, c = s.operator, a = s.source;
|
|
455
455
|
o.add(c ? c.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
|
|
456
456
|
}), o;
|
|
@@ -583,12 +583,12 @@ var Xe = function(n) {
|
|
|
583
583
|
throw new ze();
|
|
584
584
|
}, t.prototype.next = function(e) {
|
|
585
585
|
var r = this;
|
|
586
|
-
|
|
586
|
+
N(function() {
|
|
587
587
|
var i, o;
|
|
588
588
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
589
589
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
590
590
|
try {
|
|
591
|
-
for (var s =
|
|
591
|
+
for (var s = R(r.currentObservers), c = s.next(); !c.done; c = s.next()) {
|
|
592
592
|
var a = c.value;
|
|
593
593
|
a.next(e);
|
|
594
594
|
}
|
|
@@ -605,7 +605,7 @@ var Xe = function(n) {
|
|
|
605
605
|
});
|
|
606
606
|
}, t.prototype.error = function(e) {
|
|
607
607
|
var r = this;
|
|
608
|
-
|
|
608
|
+
N(function() {
|
|
609
609
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
610
610
|
r.hasError = r.isStopped = !0, r.thrownError = e;
|
|
611
611
|
for (var i = r.observers; i.length; )
|
|
@@ -614,7 +614,7 @@ var Xe = function(n) {
|
|
|
614
614
|
});
|
|
615
615
|
}, t.prototype.complete = function() {
|
|
616
616
|
var e = this;
|
|
617
|
-
|
|
617
|
+
N(function() {
|
|
618
618
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
619
619
|
e.isStopped = !0;
|
|
620
620
|
for (var r = e.observers; r.length; )
|
|
@@ -637,7 +637,7 @@ var Xe = function(n) {
|
|
|
637
637
|
}, t.prototype._innerSubscribe = function(e) {
|
|
638
638
|
var r = this, i = this, o = i.hasError, s = i.isStopped, c = i.observers;
|
|
639
639
|
return o || s ? le : (this.currentObservers = null, c.push(e), new k(function() {
|
|
640
|
-
r.currentObservers = null,
|
|
640
|
+
r.currentObservers = null, U(c, e);
|
|
641
641
|
}));
|
|
642
642
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
643
643
|
var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
|
|
@@ -707,7 +707,7 @@ var Xe = function(n) {
|
|
|
707
707
|
setInterval: function(n, t) {
|
|
708
708
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
709
709
|
e[r - 2] = arguments[r];
|
|
710
|
-
return setInterval.apply(void 0,
|
|
710
|
+
return setInterval.apply(void 0, M([n, t], L(e)));
|
|
711
711
|
},
|
|
712
712
|
clearInterval: function(n) {
|
|
713
713
|
return clearInterval(n);
|
|
@@ -752,7 +752,7 @@ var Xe = function(n) {
|
|
|
752
752
|
}, t.prototype.unsubscribe = function() {
|
|
753
753
|
if (!this.closed) {
|
|
754
754
|
var e = this, r = e.id, i = e.scheduler, o = i.actions;
|
|
755
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
755
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, U(o, this), r != null && (this.id = this.recycleAsyncId(i, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
756
756
|
}
|
|
757
757
|
}, t;
|
|
758
758
|
}(Ze), oe = function() {
|
|
@@ -834,13 +834,13 @@ function xe(n) {
|
|
|
834
834
|
case 1:
|
|
835
835
|
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
836
836
|
case 2:
|
|
837
|
-
return [4,
|
|
837
|
+
return [4, C(e.read())];
|
|
838
838
|
case 3:
|
|
839
|
-
return r = s.sent(), i = r.value, o = r.done, o ? [4,
|
|
839
|
+
return r = s.sent(), i = r.value, o = r.done, o ? [4, C(void 0)] : [3, 5];
|
|
840
840
|
case 4:
|
|
841
841
|
return [2, s.sent()];
|
|
842
842
|
case 5:
|
|
843
|
-
return [4,
|
|
843
|
+
return [4, C(i)];
|
|
844
844
|
case 6:
|
|
845
845
|
return [4, s.sent()];
|
|
846
846
|
case 7:
|
|
@@ -905,7 +905,7 @@ function ct(n) {
|
|
|
905
905
|
return new S(function(t) {
|
|
906
906
|
var e, r;
|
|
907
907
|
try {
|
|
908
|
-
for (var i =
|
|
908
|
+
for (var i = R(n), o = i.next(); !o.done; o = i.next()) {
|
|
909
909
|
var s = o.value;
|
|
910
910
|
if (t.next(s), t.closed)
|
|
911
911
|
return;
|
|
@@ -978,7 +978,7 @@ function A(n, t, e, r, i) {
|
|
|
978
978
|
if (n.add(o), !i)
|
|
979
979
|
return o;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Pe(n, t) {
|
|
982
982
|
return t === void 0 && (t = 0), T(function(e, r) {
|
|
983
983
|
e.subscribe(E(r, function(i) {
|
|
984
984
|
return A(r, n, function() {
|
|
@@ -995,7 +995,7 @@ function Ce(n, t) {
|
|
|
995
995
|
}));
|
|
996
996
|
});
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function Ce(n, t) {
|
|
999
999
|
return t === void 0 && (t = 0), T(function(e, r) {
|
|
1000
1000
|
r.add(n.schedule(function() {
|
|
1001
1001
|
return e.subscribe(r);
|
|
@@ -1003,10 +1003,10 @@ function Pe(n, t) {
|
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
function dt(n, t) {
|
|
1006
|
-
return x(n).pipe(
|
|
1006
|
+
return x(n).pipe(Ce(t), Pe(t));
|
|
1007
1007
|
}
|
|
1008
1008
|
function ht(n, t) {
|
|
1009
|
-
return x(n).pipe(
|
|
1009
|
+
return x(n).pipe(Ce(t), Pe(t));
|
|
1010
1010
|
}
|
|
1011
1011
|
function yt(n, t) {
|
|
1012
1012
|
return new S(function(e) {
|
|
@@ -1035,7 +1035,7 @@ function vt(n, t) {
|
|
|
1035
1035
|
};
|
|
1036
1036
|
});
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1038
|
+
function Re(n, t) {
|
|
1039
1039
|
if (!n)
|
|
1040
1040
|
throw new Error("Iterable cannot be null");
|
|
1041
1041
|
return new S(function(e) {
|
|
@@ -1050,7 +1050,7 @@ function Me(n, t) {
|
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
1052
|
function pt(n, t) {
|
|
1053
|
-
return
|
|
1053
|
+
return Re(xe(n), t);
|
|
1054
1054
|
}
|
|
1055
1055
|
function bt(n, t) {
|
|
1056
1056
|
if (n != null) {
|
|
@@ -1061,7 +1061,7 @@ function bt(n, t) {
|
|
|
1061
1061
|
if (ge(n))
|
|
1062
1062
|
return ht(n, t);
|
|
1063
1063
|
if (Ee(n))
|
|
1064
|
-
return
|
|
1064
|
+
return Re(n, t);
|
|
1065
1065
|
if (Ae(n))
|
|
1066
1066
|
return vt(n, t);
|
|
1067
1067
|
if (_e(n))
|
|
@@ -1091,7 +1091,7 @@ function F(n, t) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
var gt = Array.isArray;
|
|
1093
1093
|
function wt(n, t) {
|
|
1094
|
-
return gt(t) ? n.apply(void 0,
|
|
1094
|
+
return gt(t) ? n.apply(void 0, M([], L(t))) : n(t);
|
|
1095
1095
|
}
|
|
1096
1096
|
function Et(n) {
|
|
1097
1097
|
return F(function(t) {
|
|
@@ -1119,29 +1119,29 @@ function _t(n) {
|
|
|
1119
1119
|
function Tt(n) {
|
|
1120
1120
|
return n && typeof n == "object" && It(n) === At;
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function Pt(n, t) {
|
|
1123
1123
|
return n.reduce(function(e, r, i) {
|
|
1124
1124
|
return e[r] = t[i], e;
|
|
1125
1125
|
}, {});
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function Ct() {
|
|
1128
1128
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1129
1129
|
n[t] = arguments[t];
|
|
1130
1130
|
var e = me(n), r = it(n), i = _t(n), o = i.args, s = i.keys;
|
|
1131
1131
|
if (o.length === 0)
|
|
1132
1132
|
return Z([], e);
|
|
1133
|
-
var c = new S(
|
|
1134
|
-
return
|
|
1133
|
+
var c = new S(Rt(o, e, s ? function(a) {
|
|
1134
|
+
return Pt(s, a);
|
|
1135
1135
|
} : G));
|
|
1136
1136
|
return r ? c.pipe(Et(r)) : c;
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function Rt(n, t, e) {
|
|
1139
1139
|
return e === void 0 && (e = G), function(r) {
|
|
1140
1140
|
se(t, function() {
|
|
1141
1141
|
for (var i = n.length, o = new Array(i), s = i, c = i, a = function(f) {
|
|
1142
1142
|
se(t, function() {
|
|
1143
|
-
var
|
|
1144
|
-
|
|
1143
|
+
var d = Z(n[f], t), b = !1;
|
|
1144
|
+
d.subscribe(E(r, function(l) {
|
|
1145
1145
|
o[f] = l, b || (b = !0, c--), c || r.next(e(o.slice()));
|
|
1146
1146
|
}, function() {
|
|
1147
1147
|
--s || r.complete();
|
|
@@ -1156,14 +1156,14 @@ function se(n, t, e) {
|
|
|
1156
1156
|
n ? A(e, n, t) : t();
|
|
1157
1157
|
}
|
|
1158
1158
|
function Lt(n, t, e, r, i, o, s, c) {
|
|
1159
|
-
var a = [], u = 0, f = 0,
|
|
1160
|
-
|
|
1161
|
-
}, l = function(
|
|
1162
|
-
return u < r ? v(
|
|
1163
|
-
}, v = function(
|
|
1159
|
+
var a = [], u = 0, f = 0, d = !1, b = function() {
|
|
1160
|
+
d && !a.length && !u && t.complete();
|
|
1161
|
+
}, l = function(h) {
|
|
1162
|
+
return u < r ? v(h) : a.push(h);
|
|
1163
|
+
}, v = function(h) {
|
|
1164
1164
|
u++;
|
|
1165
1165
|
var g = !1;
|
|
1166
|
-
x(e(
|
|
1166
|
+
x(e(h, f++)).subscribe(E(t, function(w) {
|
|
1167
1167
|
t.next(w);
|
|
1168
1168
|
}, function() {
|
|
1169
1169
|
g = !0;
|
|
@@ -1183,7 +1183,7 @@ function Lt(n, t, e, r, i, o, s, c) {
|
|
|
1183
1183
|
}));
|
|
1184
1184
|
};
|
|
1185
1185
|
return n.subscribe(E(t, l, function() {
|
|
1186
|
-
|
|
1186
|
+
d = !0, b();
|
|
1187
1187
|
})), function() {
|
|
1188
1188
|
};
|
|
1189
1189
|
}
|
|
@@ -1208,7 +1208,7 @@ function Le(n, t, e) {
|
|
|
1208
1208
|
}, o);
|
|
1209
1209
|
});
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1211
|
+
function Mt(n, t) {
|
|
1212
1212
|
return p(t) ? $(n, t, 1) : $(n, 1);
|
|
1213
1213
|
}
|
|
1214
1214
|
function kt(n) {
|
|
@@ -1231,43 +1231,43 @@ function Dt(n, t) {
|
|
|
1231
1231
|
return x(n(e, r)).pipe(kt(1), jt(e));
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function Nt(n, t) {
|
|
1235
1235
|
t === void 0 && (t = ve);
|
|
1236
1236
|
var e = Le(n, t);
|
|
1237
1237
|
return Dt(function() {
|
|
1238
1238
|
return e;
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1241
|
+
function Ut(n) {
|
|
1242
1242
|
var t;
|
|
1243
1243
|
t = {
|
|
1244
1244
|
count: n
|
|
1245
1245
|
};
|
|
1246
1246
|
var e = t.count, r = e === void 0 ? 1 / 0 : e, i = t.delay, o = t.resetOnSuccess, s = o === void 0 ? !1 : o;
|
|
1247
1247
|
return r <= 0 ? G : T(function(c, a) {
|
|
1248
|
-
var u = 0, f,
|
|
1248
|
+
var u = 0, f, d = function() {
|
|
1249
1249
|
var b = !1;
|
|
1250
1250
|
f = c.subscribe(E(a, function(l) {
|
|
1251
1251
|
s && (u = 0), a.next(l);
|
|
1252
1252
|
}, void 0, function(l) {
|
|
1253
1253
|
if (u++ < r) {
|
|
1254
1254
|
var v = function() {
|
|
1255
|
-
f ? (f.unsubscribe(), f = null,
|
|
1255
|
+
f ? (f.unsubscribe(), f = null, d()) : b = !0;
|
|
1256
1256
|
};
|
|
1257
1257
|
if (i != null) {
|
|
1258
|
-
var
|
|
1258
|
+
var h = typeof i == "number" ? Le(i) : x(i(l, u)), g = E(a, function() {
|
|
1259
1259
|
g.unsubscribe(), v();
|
|
1260
1260
|
}, function() {
|
|
1261
1261
|
a.complete();
|
|
1262
1262
|
});
|
|
1263
|
-
|
|
1263
|
+
h.subscribe(g);
|
|
1264
1264
|
} else
|
|
1265
1265
|
v();
|
|
1266
1266
|
} else
|
|
1267
1267
|
a.error(l);
|
|
1268
|
-
})), b && (f.unsubscribe(), f = null,
|
|
1268
|
+
})), b && (f.unsubscribe(), f = null, d());
|
|
1269
1269
|
};
|
|
1270
|
-
|
|
1270
|
+
d();
|
|
1271
1271
|
});
|
|
1272
1272
|
}
|
|
1273
1273
|
function $t(n) {
|
|
@@ -1330,8 +1330,8 @@ function Ht(n, t, e) {
|
|
|
1330
1330
|
n(r.id = f);
|
|
1331
1331
|
break;
|
|
1332
1332
|
case "retry":
|
|
1333
|
-
const
|
|
1334
|
-
isNaN(
|
|
1333
|
+
const d = parseInt(f, 10);
|
|
1334
|
+
isNaN(d) || t(r.retry = d);
|
|
1335
1335
|
break;
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
@@ -1360,20 +1360,20 @@ var Bt = function(n, t) {
|
|
|
1360
1360
|
const J = "text/event-stream", Kt = 1e3, ae = "last-event-id";
|
|
1361
1361
|
function Yt(n, t) {
|
|
1362
1362
|
var { signal: e, headers: r, onopen: i, onmessage: o, onclose: s, onerror: c, openWhenHidden: a, fetch: u } = t, f = Bt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1363
|
-
return new Promise((
|
|
1363
|
+
return new Promise((d, b) => {
|
|
1364
1364
|
const l = Object.assign({}, r);
|
|
1365
1365
|
l.accept || (l.accept = J);
|
|
1366
1366
|
let v;
|
|
1367
|
-
function
|
|
1367
|
+
function h() {
|
|
1368
1368
|
v.abort(), document.hidden || H();
|
|
1369
1369
|
}
|
|
1370
|
-
a || document.addEventListener("visibilitychange",
|
|
1370
|
+
a || document.addEventListener("visibilitychange", h);
|
|
1371
1371
|
let g = Kt, w = 0;
|
|
1372
1372
|
function _() {
|
|
1373
|
-
document.removeEventListener("visibilitychange",
|
|
1373
|
+
document.removeEventListener("visibilitychange", h), window.clearTimeout(w), v.abort();
|
|
1374
1374
|
}
|
|
1375
1375
|
e == null || e.addEventListener("abort", () => {
|
|
1376
|
-
_(),
|
|
1376
|
+
_(), d();
|
|
1377
1377
|
});
|
|
1378
1378
|
const ke = u ?? window.fetch, je = i ?? qt;
|
|
1379
1379
|
async function H() {
|
|
@@ -1385,7 +1385,7 @@ function Yt(n, t) {
|
|
|
1385
1385
|
I ? l[ae] = I : delete l[ae];
|
|
1386
1386
|
}, (I) => {
|
|
1387
1387
|
g = I;
|
|
1388
|
-
}, o))), s == null || s(), _(),
|
|
1388
|
+
}, o))), s == null || s(), _(), d();
|
|
1389
1389
|
} catch (j) {
|
|
1390
1390
|
if (!v.signal.aborted)
|
|
1391
1391
|
try {
|
|
@@ -1425,7 +1425,24 @@ function Wt(n) {
|
|
|
1425
1425
|
*/
|
|
1426
1426
|
openWhenHidden: !0,
|
|
1427
1427
|
onopen: async (f) => {
|
|
1428
|
-
f.ok
|
|
1428
|
+
if (!f.ok) {
|
|
1429
|
+
let d;
|
|
1430
|
+
try {
|
|
1431
|
+
const l = await f.text();
|
|
1432
|
+
d = JSON.parse(l);
|
|
1433
|
+
} catch {
|
|
1434
|
+
d = { message: `HTTP ${f.status}: ${f.statusText}` };
|
|
1435
|
+
}
|
|
1436
|
+
const b = {
|
|
1437
|
+
response: f,
|
|
1438
|
+
status: f.status,
|
|
1439
|
+
statusText: f.statusText,
|
|
1440
|
+
errorDetail: d,
|
|
1441
|
+
isAuthError: f.status === 401,
|
|
1442
|
+
isBotProviderError: f.status === 400 && ((d == null ? void 0 : d.code) === "BOT_PROVIDER_DISABLED" || (d == null ? void 0 : d.code) === "BOT_PROVIDER_NOT_FOUND")
|
|
1443
|
+
};
|
|
1444
|
+
o.error(b), s.abort();
|
|
1445
|
+
}
|
|
1429
1446
|
},
|
|
1430
1447
|
onmessage: (f) => {
|
|
1431
1448
|
o.next(JSON.parse(f.data));
|
|
@@ -1484,43 +1501,43 @@ class zt {
|
|
|
1484
1501
|
}
|
|
1485
1502
|
handleEvent(t) {
|
|
1486
1503
|
switch (t.eventType) {
|
|
1487
|
-
case
|
|
1504
|
+
case y.INIT:
|
|
1488
1505
|
this.sseEmitter.emit(
|
|
1489
|
-
|
|
1506
|
+
y.INIT,
|
|
1490
1507
|
t
|
|
1491
1508
|
);
|
|
1492
1509
|
break;
|
|
1493
|
-
case
|
|
1494
|
-
case
|
|
1510
|
+
case y.PROCESS_START:
|
|
1511
|
+
case y.PROCESS_COMPLETE:
|
|
1495
1512
|
this.sseEmitter.emit(
|
|
1496
|
-
|
|
1513
|
+
y.PROCESS,
|
|
1497
1514
|
t
|
|
1498
1515
|
);
|
|
1499
1516
|
break;
|
|
1500
|
-
case
|
|
1501
|
-
case
|
|
1502
|
-
case
|
|
1517
|
+
case y.MESSAGE_START:
|
|
1518
|
+
case y.MESSAGE_DELTA:
|
|
1519
|
+
case y.MESSAGE_COMPLETE:
|
|
1503
1520
|
this.sseEmitter.emit(
|
|
1504
|
-
|
|
1521
|
+
y.MESSAGE,
|
|
1505
1522
|
t
|
|
1506
1523
|
);
|
|
1507
1524
|
break;
|
|
1508
|
-
case
|
|
1509
|
-
case
|
|
1525
|
+
case y.TOOL_CALL_START:
|
|
1526
|
+
case y.TOOL_CALL_COMPLETE:
|
|
1510
1527
|
this.sseEmitter.emit(
|
|
1511
|
-
|
|
1528
|
+
y.TOOL_CALL,
|
|
1512
1529
|
t
|
|
1513
1530
|
);
|
|
1514
1531
|
break;
|
|
1515
|
-
case
|
|
1532
|
+
case y.DONE:
|
|
1516
1533
|
this.sseEmitter.emit(
|
|
1517
|
-
|
|
1534
|
+
y.DONE,
|
|
1518
1535
|
t
|
|
1519
1536
|
);
|
|
1520
1537
|
break;
|
|
1521
|
-
case
|
|
1538
|
+
case y.ERROR:
|
|
1522
1539
|
this.sseEmitter.emit(
|
|
1523
|
-
|
|
1540
|
+
y.ERROR,
|
|
1524
1541
|
t
|
|
1525
1542
|
);
|
|
1526
1543
|
break;
|
|
@@ -1534,9 +1551,9 @@ class zt {
|
|
|
1534
1551
|
debugMode: this.debugMode,
|
|
1535
1552
|
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
|
|
1536
1553
|
}).pipe(
|
|
1537
|
-
|
|
1554
|
+
Mt((o) => mt(o).pipe(Nt((e == null ? void 0 : e.delayTime) ?? 50))),
|
|
1538
1555
|
$t(this.destroy$),
|
|
1539
|
-
|
|
1556
|
+
Ut(3)
|
|
1540
1557
|
).subscribe({
|
|
1541
1558
|
next: (o) => {
|
|
1542
1559
|
var s;
|
|
@@ -1556,7 +1573,7 @@ class zt {
|
|
|
1556
1573
|
this.destroy$.next(), this.destroy$.complete();
|
|
1557
1574
|
}
|
|
1558
1575
|
}
|
|
1559
|
-
class
|
|
1576
|
+
class Me {
|
|
1560
1577
|
constructor(t) {
|
|
1561
1578
|
m(this, "client");
|
|
1562
1579
|
m(this, "customChannelId");
|
|
@@ -1572,7 +1589,7 @@ class Re {
|
|
|
1572
1589
|
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new re(!1), this.conversation$ = new re(t.conversation), this.statesObserver = t.statesObserver;
|
|
1573
1590
|
}
|
|
1574
1591
|
static async reset(t, e, r) {
|
|
1575
|
-
const i = new
|
|
1592
|
+
const i = new Me(t);
|
|
1576
1593
|
try {
|
|
1577
1594
|
return i.subscribe(), await i.resetChannel(e, r), i;
|
|
1578
1595
|
} catch (o) {
|
|
@@ -1580,7 +1597,7 @@ class Re {
|
|
|
1580
1597
|
}
|
|
1581
1598
|
}
|
|
1582
1599
|
subscribe() {
|
|
1583
|
-
this.statesSubscription =
|
|
1600
|
+
this.statesSubscription = Ct([
|
|
1584
1601
|
this.isConnecting$,
|
|
1585
1602
|
this.conversation$
|
|
1586
1603
|
]).pipe(
|
|
@@ -1646,30 +1663,30 @@ class Re {
|
|
|
1646
1663
|
this.isConnecting$.complete(), this.conversation$.complete(), (t = this.statesSubscription) == null || t.unsubscribe();
|
|
1647
1664
|
}
|
|
1648
1665
|
}
|
|
1649
|
-
class
|
|
1666
|
+
class P {
|
|
1650
1667
|
constructor({ messages: t }) {
|
|
1651
1668
|
m(this, "messages", null);
|
|
1652
1669
|
this.messages = t;
|
|
1653
1670
|
}
|
|
1654
1671
|
pushMessage(t) {
|
|
1655
1672
|
const e = new Map(this.messages);
|
|
1656
|
-
return e.set(t.messageId, t), new
|
|
1673
|
+
return e.set(t.messageId, t), new P({ messages: e });
|
|
1657
1674
|
}
|
|
1658
1675
|
onMessage(t) {
|
|
1659
1676
|
switch (t.eventType) {
|
|
1660
|
-
case
|
|
1677
|
+
case y.MESSAGE_START:
|
|
1661
1678
|
return this.onMessageStart(
|
|
1662
1679
|
t
|
|
1663
1680
|
);
|
|
1664
|
-
case
|
|
1681
|
+
case y.MESSAGE_DELTA:
|
|
1665
1682
|
return this.onMessageDelta(
|
|
1666
1683
|
t
|
|
1667
1684
|
);
|
|
1668
|
-
case
|
|
1685
|
+
case y.MESSAGE_COMPLETE:
|
|
1669
1686
|
return this.onMessageComplete(
|
|
1670
1687
|
t
|
|
1671
1688
|
);
|
|
1672
|
-
case
|
|
1689
|
+
case y.ERROR:
|
|
1673
1690
|
return this.onMessageError(t);
|
|
1674
1691
|
default:
|
|
1675
1692
|
return this;
|
|
@@ -1679,13 +1696,13 @@ class C {
|
|
|
1679
1696
|
const e = t.fact.messageStart.message, r = new Map(this.messages);
|
|
1680
1697
|
return r.set(e.messageId, {
|
|
1681
1698
|
type: "bot",
|
|
1682
|
-
eventType:
|
|
1699
|
+
eventType: y.MESSAGE_START,
|
|
1683
1700
|
isTyping: !0,
|
|
1684
1701
|
typingText: "",
|
|
1685
1702
|
messageId: e.messageId,
|
|
1686
1703
|
message: e,
|
|
1687
1704
|
time: /* @__PURE__ */ new Date()
|
|
1688
|
-
}), new
|
|
1705
|
+
}), new P({ messages: r });
|
|
1689
1706
|
}
|
|
1690
1707
|
onMessageDelta(t) {
|
|
1691
1708
|
const e = t.fact.messageDelta.message, r = new Map(this.messages), i = r.get(e.messageId);
|
|
@@ -1693,43 +1710,43 @@ class C {
|
|
|
1693
1710
|
const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
|
|
1694
1711
|
return r.set(e.messageId, {
|
|
1695
1712
|
type: "bot",
|
|
1696
|
-
eventType:
|
|
1713
|
+
eventType: y.MESSAGE_DELTA,
|
|
1697
1714
|
isTyping: !0,
|
|
1698
1715
|
typingText: o,
|
|
1699
1716
|
messageId: e.messageId,
|
|
1700
1717
|
message: e,
|
|
1701
1718
|
time: /* @__PURE__ */ new Date()
|
|
1702
|
-
}), new
|
|
1719
|
+
}), new P({ messages: r });
|
|
1703
1720
|
}
|
|
1704
1721
|
onMessageComplete(t) {
|
|
1705
1722
|
const e = t.fact.messageComplete.message, r = new Map(this.messages);
|
|
1706
1723
|
return r.set(e.messageId, {
|
|
1707
1724
|
type: "bot",
|
|
1708
|
-
eventType:
|
|
1725
|
+
eventType: y.MESSAGE_COMPLETE,
|
|
1709
1726
|
isTyping: !1,
|
|
1710
1727
|
typingText: null,
|
|
1711
1728
|
messageId: e.messageId,
|
|
1712
1729
|
message: e,
|
|
1713
1730
|
time: /* @__PURE__ */ new Date()
|
|
1714
|
-
}), new
|
|
1731
|
+
}), new P({ messages: r });
|
|
1715
1732
|
}
|
|
1716
1733
|
onMessageError(t) {
|
|
1717
1734
|
const e = crypto.randomUUID(), r = t.fact.runError.error, i = new Map(this.messages);
|
|
1718
1735
|
return i.set(e, {
|
|
1719
1736
|
type: "error",
|
|
1720
|
-
eventType:
|
|
1737
|
+
eventType: y.ERROR,
|
|
1721
1738
|
messageId: e,
|
|
1722
1739
|
error: r,
|
|
1723
1740
|
time: /* @__PURE__ */ new Date()
|
|
1724
|
-
}), new
|
|
1741
|
+
}), new P({ messages: i });
|
|
1725
1742
|
}
|
|
1726
1743
|
}
|
|
1727
1744
|
export {
|
|
1728
1745
|
zt as AsgardServiceClient,
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1746
|
+
Me as Channel,
|
|
1747
|
+
P as Conversation,
|
|
1748
|
+
y as EventType,
|
|
1732
1749
|
K as FetchSseAction,
|
|
1733
|
-
|
|
1750
|
+
Ue as MessageTemplateType
|
|
1734
1751
|
};
|
|
1735
1752
|
//# sourceMappingURL=index.mjs.map
|