@asgard-js/core 0.3.13 → 0.3.15
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/constants/enum.d.ts +2 -1
- package/dist/constants/enum.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +866 -631
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +39 -1
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/lib/client.d.ts +42 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/launched-sandboxes.d.ts +11 -0
- package/dist/lib/launched-sandboxes.d.ts.map +1 -0
- package/dist/lib/launched-sandboxes.spec.d.ts +2 -0
- package/dist/lib/launched-sandboxes.spec.d.ts.map +1 -0
- package/dist/lib/resolve-sandbox-uri.d.ts +19 -0
- package/dist/lib/resolve-sandbox-uri.d.ts.map +1 -0
- package/dist/lib/resolve-sandbox-uri.spec.d.ts +2 -0
- package/dist/lib/resolve-sandbox-uri.spec.d.ts.map +1 -0
- package/dist/types/channel.d.ts +24 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/sandbox-fs.d.ts +60 -0
- package/dist/types/sandbox-fs.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class I extends Error {
|
|
2
2
|
status;
|
|
3
3
|
statusText;
|
|
4
4
|
body;
|
|
@@ -6,110 +6,110 @@ class te extends Error {
|
|
|
6
6
|
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = r;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return n instanceof
|
|
9
|
+
function Tn(n) {
|
|
10
|
+
return n instanceof I;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
13
|
-
return
|
|
12
|
+
var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), d = /* @__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.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(d || {}), Be = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Be || {}), Ke = /* @__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.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n))(Ke || {}), Q = function(n, t) {
|
|
13
|
+
return Q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
14
14
|
e.__proto__ = r;
|
|
15
15
|
} || function(e, r) {
|
|
16
16
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
|
|
17
|
-
},
|
|
17
|
+
}, Q(n, t);
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function T(n, t) {
|
|
20
20
|
if (typeof t != "function" && t !== null)
|
|
21
21
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
22
|
-
|
|
22
|
+
Q(n, t);
|
|
23
23
|
function e() {
|
|
24
24
|
this.constructor = n;
|
|
25
25
|
}
|
|
26
26
|
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
function s(
|
|
30
|
-
return
|
|
31
|
-
o
|
|
28
|
+
function qe(n, t, e, r) {
|
|
29
|
+
function s(o) {
|
|
30
|
+
return o instanceof e ? o : new e(function(i) {
|
|
31
|
+
i(o);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
return new (e || (e = Promise))(function(
|
|
34
|
+
return new (e || (e = Promise))(function(o, i) {
|
|
35
35
|
function a(h) {
|
|
36
36
|
try {
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
|
|
37
|
+
u(r.next(h));
|
|
38
|
+
} catch (m) {
|
|
39
|
+
i(m);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function c(h) {
|
|
43
43
|
try {
|
|
44
|
-
|
|
45
|
-
} catch (
|
|
46
|
-
|
|
44
|
+
u(r.throw(h));
|
|
45
|
+
} catch (m) {
|
|
46
|
+
i(m);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
h.done ?
|
|
49
|
+
function u(h) {
|
|
50
|
+
h.done ? o(h.value) : s(h.value).then(a, c);
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
u((r = r.apply(n, t || [])).next());
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function ve(n, t) {
|
|
56
56
|
var e = { label: 0, sent: function() {
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
}, trys: [], ops: [] }, r, s,
|
|
60
|
-
return
|
|
57
|
+
if (o[0] & 1) throw o[1];
|
|
58
|
+
return o[1];
|
|
59
|
+
}, trys: [], ops: [] }, r, s, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
60
|
+
return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
61
61
|
return this;
|
|
62
|
-
}),
|
|
63
|
-
function a(
|
|
62
|
+
}), i;
|
|
63
|
+
function a(u) {
|
|
64
64
|
return function(h) {
|
|
65
|
-
return
|
|
65
|
+
return c([u, h]);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function u
|
|
68
|
+
function c(u) {
|
|
69
69
|
if (r) throw new TypeError("Generator is already executing.");
|
|
70
|
-
for (;
|
|
71
|
-
if (r = 1, s && (
|
|
72
|
-
switch (s = 0,
|
|
70
|
+
for (; i && (i = 0, u[0] && (e = 0)), e; ) try {
|
|
71
|
+
if (r = 1, s && (o = u[0] & 2 ? s.return : u[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, u[1])).done) return o;
|
|
72
|
+
switch (s = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
|
|
73
73
|
case 0:
|
|
74
74
|
case 1:
|
|
75
|
-
|
|
75
|
+
o = u;
|
|
76
76
|
break;
|
|
77
77
|
case 4:
|
|
78
|
-
return e.label++, { value:
|
|
78
|
+
return e.label++, { value: u[1], done: !1 };
|
|
79
79
|
case 5:
|
|
80
|
-
e.label++, s =
|
|
80
|
+
e.label++, s = u[1], u = [0];
|
|
81
81
|
continue;
|
|
82
82
|
case 7:
|
|
83
|
-
|
|
83
|
+
u = e.ops.pop(), e.trys.pop();
|
|
84
84
|
continue;
|
|
85
85
|
default:
|
|
86
|
-
if (
|
|
86
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
87
87
|
e = 0;
|
|
88
88
|
continue;
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
e.label =
|
|
90
|
+
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
|
91
|
+
e.label = u[1];
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
95
|
-
e.label =
|
|
94
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
95
|
+
e.label = o[1], o = u;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
99
|
-
e.label =
|
|
98
|
+
if (o && e.label < o[2]) {
|
|
99
|
+
e.label = o[2], e.ops.push(u);
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
o[2] && e.ops.pop(), e.trys.pop();
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
u = t.call(n, e);
|
|
106
106
|
} catch (h) {
|
|
107
|
-
|
|
107
|
+
u = [6, h], s = 0;
|
|
108
108
|
} finally {
|
|
109
|
-
r =
|
|
109
|
+
r = o = 0;
|
|
110
110
|
}
|
|
111
|
-
if (
|
|
112
|
-
return { value:
|
|
111
|
+
if (u[0] & 5) throw u[1];
|
|
112
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
function k(n) {
|
|
@@ -122,89 +122,89 @@ function k(n) {
|
|
|
122
122
|
};
|
|
123
123
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function D(n, t) {
|
|
126
126
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
127
127
|
if (!e) return n;
|
|
128
|
-
var r = e.call(n), s,
|
|
128
|
+
var r = e.call(n), s, o = [], i;
|
|
129
129
|
try {
|
|
130
|
-
for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; )
|
|
130
|
+
for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) o.push(s.value);
|
|
131
131
|
} catch (a) {
|
|
132
|
-
|
|
132
|
+
i = { error: a };
|
|
133
133
|
} finally {
|
|
134
134
|
try {
|
|
135
135
|
s && !s.done && (e = r.return) && e.call(r);
|
|
136
136
|
} finally {
|
|
137
|
-
if (
|
|
137
|
+
if (i) throw i.error;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
return
|
|
140
|
+
return o;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
if (e || arguments.length === 2) for (var r = 0, s = t.length,
|
|
144
|
-
(
|
|
145
|
-
return n.concat(
|
|
142
|
+
function H(n, t, e) {
|
|
143
|
+
if (e || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
|
|
144
|
+
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
145
|
+
return n.concat(o || Array.prototype.slice.call(t));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return this instanceof
|
|
147
|
+
function U(n) {
|
|
148
|
+
return this instanceof U ? (this.v = n, this) : new U(n);
|
|
149
149
|
}
|
|
150
150
|
function Ye(n, t, e) {
|
|
151
151
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
152
|
-
var r = e.apply(n, t || []), s,
|
|
153
|
-
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return",
|
|
152
|
+
var r = e.apply(n, t || []), s, o = [];
|
|
153
|
+
return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), s[Symbol.asyncIterator] = function() {
|
|
154
154
|
return this;
|
|
155
155
|
}, s;
|
|
156
|
-
function
|
|
156
|
+
function i(l) {
|
|
157
157
|
return function(f) {
|
|
158
|
-
return Promise.resolve(f).then(l,
|
|
158
|
+
return Promise.resolve(f).then(l, m);
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
function a(l, f) {
|
|
162
162
|
r[l] && (s[l] = function(p) {
|
|
163
|
-
return new Promise(function(
|
|
164
|
-
|
|
163
|
+
return new Promise(function(L, w) {
|
|
164
|
+
o.push([l, p, L, w]) > 1 || c(l, p);
|
|
165
165
|
});
|
|
166
166
|
}, f && (s[l] = f(s[l])));
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function c(l, f) {
|
|
169
169
|
try {
|
|
170
|
-
|
|
170
|
+
u(r[l](f));
|
|
171
171
|
} catch (p) {
|
|
172
|
-
|
|
172
|
+
b(o[0][3], p);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
l.value instanceof
|
|
175
|
+
function u(l) {
|
|
176
|
+
l.value instanceof U ? Promise.resolve(l.value.v).then(h, m) : b(o[0][2], l);
|
|
177
177
|
}
|
|
178
178
|
function h(l) {
|
|
179
|
-
|
|
179
|
+
c("next", l);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
181
|
+
function m(l) {
|
|
182
|
+
c("throw", l);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
l(f),
|
|
184
|
+
function b(l, f) {
|
|
185
|
+
l(f), o.shift(), o.length && c(o[0][0], o[0][1]);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Xe(n) {
|
|
189
189
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
190
190
|
var t = n[Symbol.asyncIterator], e;
|
|
191
191
|
return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
|
|
192
192
|
return this;
|
|
193
193
|
}, e);
|
|
194
|
-
function r(
|
|
195
|
-
e[
|
|
196
|
-
return new Promise(function(a,
|
|
197
|
-
|
|
194
|
+
function r(o) {
|
|
195
|
+
e[o] = n[o] && function(i) {
|
|
196
|
+
return new Promise(function(a, c) {
|
|
197
|
+
i = n[o](i), s(a, c, i.done, i.value);
|
|
198
198
|
});
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
function s(
|
|
202
|
-
Promise.resolve(
|
|
203
|
-
|
|
204
|
-
},
|
|
201
|
+
function s(o, i, a, c) {
|
|
202
|
+
Promise.resolve(c).then(function(u) {
|
|
203
|
+
o({ value: u, done: a });
|
|
204
|
+
}, i);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function g(n) {
|
|
208
208
|
return typeof n == "function";
|
|
209
209
|
}
|
|
210
210
|
function ye(n) {
|
|
@@ -213,7 +213,7 @@ function ye(n) {
|
|
|
213
213
|
}, e = n(t);
|
|
214
214
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
215
215
|
}
|
|
216
|
-
var
|
|
216
|
+
var z = ye(function(n) {
|
|
217
217
|
return function(e) {
|
|
218
218
|
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
219
219
|
` + e.map(function(r, s) {
|
|
@@ -222,76 +222,76 @@ var W = ye(function(n) {
|
|
|
222
222
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
223
223
|
};
|
|
224
224
|
});
|
|
225
|
-
function
|
|
225
|
+
function q(n, t) {
|
|
226
226
|
if (n) {
|
|
227
227
|
var e = n.indexOf(t);
|
|
228
228
|
0 <= e && n.splice(e, 1);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
var
|
|
231
|
+
var R = (function() {
|
|
232
232
|
function n(t) {
|
|
233
233
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
234
234
|
}
|
|
235
235
|
return n.prototype.unsubscribe = function() {
|
|
236
|
-
var t, e, r, s,
|
|
236
|
+
var t, e, r, s, o;
|
|
237
237
|
if (!this.closed) {
|
|
238
238
|
this.closed = !0;
|
|
239
|
-
var
|
|
240
|
-
if (
|
|
241
|
-
if (this._parentage = null, Array.isArray(
|
|
239
|
+
var i = this._parentage;
|
|
240
|
+
if (i)
|
|
241
|
+
if (this._parentage = null, Array.isArray(i))
|
|
242
242
|
try {
|
|
243
|
-
for (var a = k(
|
|
244
|
-
var
|
|
245
|
-
|
|
243
|
+
for (var a = k(i), c = a.next(); !c.done; c = a.next()) {
|
|
244
|
+
var u = c.value;
|
|
245
|
+
u.remove(this);
|
|
246
246
|
}
|
|
247
247
|
} catch (p) {
|
|
248
248
|
t = { error: p };
|
|
249
249
|
} finally {
|
|
250
250
|
try {
|
|
251
|
-
|
|
251
|
+
c && !c.done && (e = a.return) && e.call(a);
|
|
252
252
|
} finally {
|
|
253
253
|
if (t) throw t.error;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
else
|
|
257
|
-
|
|
257
|
+
i.remove(this);
|
|
258
258
|
var h = this.initialTeardown;
|
|
259
|
-
if (
|
|
259
|
+
if (g(h))
|
|
260
260
|
try {
|
|
261
261
|
h();
|
|
262
262
|
} catch (p) {
|
|
263
|
-
|
|
263
|
+
o = p instanceof z ? p.errors : [p];
|
|
264
264
|
}
|
|
265
|
-
var
|
|
266
|
-
if (
|
|
265
|
+
var m = this._finalizers;
|
|
266
|
+
if (m) {
|
|
267
267
|
this._finalizers = null;
|
|
268
268
|
try {
|
|
269
|
-
for (var
|
|
269
|
+
for (var b = k(m), l = b.next(); !l.done; l = b.next()) {
|
|
270
270
|
var f = l.value;
|
|
271
271
|
try {
|
|
272
|
-
|
|
272
|
+
ie(f);
|
|
273
273
|
} catch (p) {
|
|
274
|
-
|
|
274
|
+
o = o ?? [], p instanceof z ? o = H(H([], D(o)), D(p.errors)) : o.push(p);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} catch (p) {
|
|
278
278
|
r = { error: p };
|
|
279
279
|
} finally {
|
|
280
280
|
try {
|
|
281
|
-
l && !l.done && (s =
|
|
281
|
+
l && !l.done && (s = b.return) && s.call(b);
|
|
282
282
|
} finally {
|
|
283
283
|
if (r) throw r.error;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
if (
|
|
288
|
-
throw new
|
|
287
|
+
if (o)
|
|
288
|
+
throw new z(o);
|
|
289
289
|
}
|
|
290
290
|
}, n.prototype.add = function(t) {
|
|
291
291
|
var e;
|
|
292
292
|
if (t && t !== this)
|
|
293
293
|
if (this.closed)
|
|
294
|
-
|
|
294
|
+
ie(t);
|
|
295
295
|
else {
|
|
296
296
|
if (t instanceof n) {
|
|
297
297
|
if (t.closed || t._hasParent(this))
|
|
@@ -308,52 +308,52 @@ var N = (function() {
|
|
|
308
308
|
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
309
309
|
}, n.prototype._removeParent = function(t) {
|
|
310
310
|
var e = this._parentage;
|
|
311
|
-
e === t ? this._parentage = null : Array.isArray(e) &&
|
|
311
|
+
e === t ? this._parentage = null : Array.isArray(e) && q(e, t);
|
|
312
312
|
}, n.prototype.remove = function(t) {
|
|
313
313
|
var e = this._finalizers;
|
|
314
|
-
e &&
|
|
314
|
+
e && q(e, t), t instanceof n && t._removeParent(this);
|
|
315
315
|
}, n.EMPTY = (function() {
|
|
316
316
|
var t = new n();
|
|
317
317
|
return t.closed = !0, t;
|
|
318
318
|
})(), n;
|
|
319
|
-
})(),
|
|
320
|
-
function
|
|
321
|
-
return n instanceof
|
|
319
|
+
})(), Se = R.EMPTY;
|
|
320
|
+
function we(n) {
|
|
321
|
+
return n instanceof R || n && "closed" in n && g(n.remove) && g(n.add) && g(n.unsubscribe);
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
|
|
323
|
+
function ie(n) {
|
|
324
|
+
g(n) ? n() : n.unsubscribe();
|
|
325
325
|
}
|
|
326
326
|
var Ve = {
|
|
327
327
|
Promise: void 0
|
|
328
|
-
},
|
|
328
|
+
}, We = {
|
|
329
329
|
setTimeout: function(n, t) {
|
|
330
330
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
331
331
|
e[r - 2] = arguments[r];
|
|
332
|
-
return setTimeout.apply(void 0,
|
|
332
|
+
return setTimeout.apply(void 0, H([n, t], D(e)));
|
|
333
333
|
},
|
|
334
334
|
clearTimeout: function(n) {
|
|
335
335
|
return clearTimeout(n);
|
|
336
336
|
},
|
|
337
337
|
delegate: void 0
|
|
338
338
|
};
|
|
339
|
-
function
|
|
340
|
-
|
|
339
|
+
function Ee(n) {
|
|
340
|
+
We.setTimeout(function() {
|
|
341
341
|
throw n;
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function Z() {
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function B(n) {
|
|
347
347
|
n();
|
|
348
348
|
}
|
|
349
349
|
var ne = (function(n) {
|
|
350
|
-
|
|
350
|
+
T(t, n);
|
|
351
351
|
function t(e) {
|
|
352
352
|
var r = n.call(this) || this;
|
|
353
|
-
return r.isStopped = !1, e ? (r.destination = e,
|
|
353
|
+
return r.isStopped = !1, e ? (r.destination = e, we(e) && e.add(r)) : r.destination = Qe, r;
|
|
354
354
|
}
|
|
355
355
|
return t.create = function(e, r, s) {
|
|
356
|
-
return new
|
|
356
|
+
return new ee(e, r, s);
|
|
357
357
|
}, t.prototype.next = function(e) {
|
|
358
358
|
this.isStopped || this._next(e);
|
|
359
359
|
}, t.prototype.error = function(e) {
|
|
@@ -377,7 +377,7 @@ var ne = (function(n) {
|
|
|
377
377
|
this.unsubscribe();
|
|
378
378
|
}
|
|
379
379
|
}, t;
|
|
380
|
-
})(
|
|
380
|
+
})(R), ze = (function() {
|
|
381
381
|
function n(t) {
|
|
382
382
|
this.partialObserver = t;
|
|
383
383
|
}
|
|
@@ -387,7 +387,7 @@ var ne = (function(n) {
|
|
|
387
387
|
try {
|
|
388
388
|
e.next(t);
|
|
389
389
|
} catch (r) {
|
|
390
|
-
|
|
390
|
+
G(r);
|
|
391
391
|
}
|
|
392
392
|
}, n.prototype.error = function(t) {
|
|
393
393
|
var e = this.partialObserver;
|
|
@@ -395,50 +395,50 @@ var ne = (function(n) {
|
|
|
395
395
|
try {
|
|
396
396
|
e.error(t);
|
|
397
397
|
} catch (r) {
|
|
398
|
-
|
|
398
|
+
G(r);
|
|
399
399
|
}
|
|
400
400
|
else
|
|
401
|
-
|
|
401
|
+
G(t);
|
|
402
402
|
}, n.prototype.complete = function() {
|
|
403
403
|
var t = this.partialObserver;
|
|
404
404
|
if (t.complete)
|
|
405
405
|
try {
|
|
406
406
|
t.complete();
|
|
407
407
|
} catch (e) {
|
|
408
|
-
|
|
408
|
+
G(e);
|
|
409
409
|
}
|
|
410
410
|
}, n;
|
|
411
|
-
})(),
|
|
412
|
-
|
|
411
|
+
})(), ee = (function(n) {
|
|
412
|
+
T(t, n);
|
|
413
413
|
function t(e, r, s) {
|
|
414
|
-
var
|
|
415
|
-
return
|
|
414
|
+
var o = n.call(this) || this, i;
|
|
415
|
+
return g(e) || !e ? i = {
|
|
416
416
|
next: e ?? void 0,
|
|
417
417
|
error: r ?? void 0,
|
|
418
418
|
complete: s ?? void 0
|
|
419
|
-
} :
|
|
419
|
+
} : i = e, o.destination = new ze(i), o;
|
|
420
420
|
}
|
|
421
421
|
return t;
|
|
422
422
|
})(ne);
|
|
423
|
-
function
|
|
424
|
-
|
|
423
|
+
function G(n) {
|
|
424
|
+
Ee(n);
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function Je(n) {
|
|
427
427
|
throw n;
|
|
428
428
|
}
|
|
429
|
-
var
|
|
429
|
+
var Qe = {
|
|
430
430
|
closed: !0,
|
|
431
|
-
next:
|
|
432
|
-
error:
|
|
433
|
-
complete:
|
|
431
|
+
next: Z,
|
|
432
|
+
error: Je,
|
|
433
|
+
complete: Z
|
|
434
434
|
}, re = (function() {
|
|
435
435
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
436
436
|
})();
|
|
437
|
-
function
|
|
437
|
+
function X(n) {
|
|
438
438
|
return n;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
441
|
-
return n.length === 0 ?
|
|
440
|
+
function Ze(n) {
|
|
441
|
+
return n.length === 0 ? X : n.length === 1 ? n[0] : function(e) {
|
|
442
442
|
return n.reduce(function(r, s) {
|
|
443
443
|
return s(r);
|
|
444
444
|
}, e);
|
|
@@ -452,11 +452,11 @@ var S = (function() {
|
|
|
452
452
|
var e = new n();
|
|
453
453
|
return e.source = this, e.operator = t, e;
|
|
454
454
|
}, n.prototype.subscribe = function(t, e, r) {
|
|
455
|
-
var s = this,
|
|
456
|
-
return
|
|
457
|
-
var
|
|
458
|
-
|
|
459
|
-
}),
|
|
455
|
+
var s = this, o = tt(t) ? t : new ee(t, e, r);
|
|
456
|
+
return B(function() {
|
|
457
|
+
var i = s, a = i.operator, c = i.source;
|
|
458
|
+
o.add(a ? a.call(o, c) : c ? s._subscribe(o) : s._trySubscribe(o));
|
|
459
|
+
}), o;
|
|
460
460
|
}, n.prototype._trySubscribe = function(t) {
|
|
461
461
|
try {
|
|
462
462
|
return this._subscribe(t);
|
|
@@ -465,19 +465,19 @@ var S = (function() {
|
|
|
465
465
|
}
|
|
466
466
|
}, n.prototype.forEach = function(t, e) {
|
|
467
467
|
var r = this;
|
|
468
|
-
return e = ae(e), new e(function(s,
|
|
469
|
-
var
|
|
468
|
+
return e = ae(e), new e(function(s, o) {
|
|
469
|
+
var i = new ee({
|
|
470
470
|
next: function(a) {
|
|
471
471
|
try {
|
|
472
472
|
t(a);
|
|
473
|
-
} catch (
|
|
474
|
-
|
|
473
|
+
} catch (c) {
|
|
474
|
+
o(c), i.unsubscribe();
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
|
-
error:
|
|
477
|
+
error: o,
|
|
478
478
|
complete: s
|
|
479
479
|
});
|
|
480
|
-
r.subscribe(
|
|
480
|
+
r.subscribe(i);
|
|
481
481
|
});
|
|
482
482
|
}, n.prototype._subscribe = function(t) {
|
|
483
483
|
var e;
|
|
@@ -487,17 +487,17 @@ var S = (function() {
|
|
|
487
487
|
}, n.prototype.pipe = function() {
|
|
488
488
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
489
489
|
t[e] = arguments[e];
|
|
490
|
-
return
|
|
490
|
+
return Ze(t)(this);
|
|
491
491
|
}, n.prototype.toPromise = function(t) {
|
|
492
492
|
var e = this;
|
|
493
493
|
return t = ae(t), new t(function(r, s) {
|
|
494
|
-
var
|
|
495
|
-
e.subscribe(function(
|
|
496
|
-
return
|
|
497
|
-
}, function(
|
|
498
|
-
return s(
|
|
494
|
+
var o;
|
|
495
|
+
e.subscribe(function(i) {
|
|
496
|
+
return o = i;
|
|
497
|
+
}, function(i) {
|
|
498
|
+
return s(i);
|
|
499
499
|
}, function() {
|
|
500
|
-
return r(
|
|
500
|
+
return r(o);
|
|
501
501
|
});
|
|
502
502
|
});
|
|
503
503
|
}, n.create = function(t) {
|
|
@@ -508,18 +508,18 @@ function ae(n) {
|
|
|
508
508
|
var t;
|
|
509
509
|
return (t = n ?? Ve.Promise) !== null && t !== void 0 ? t : Promise;
|
|
510
510
|
}
|
|
511
|
-
function Ze(n) {
|
|
512
|
-
return n && m(n.next) && m(n.error) && m(n.complete);
|
|
513
|
-
}
|
|
514
511
|
function et(n) {
|
|
515
|
-
return n && n
|
|
512
|
+
return n && g(n.next) && g(n.error) && g(n.complete);
|
|
516
513
|
}
|
|
517
514
|
function tt(n) {
|
|
518
|
-
return
|
|
515
|
+
return n && n instanceof ne || et(n) && we(n);
|
|
516
|
+
}
|
|
517
|
+
function nt(n) {
|
|
518
|
+
return g(n?.lift);
|
|
519
519
|
}
|
|
520
520
|
function A(n) {
|
|
521
521
|
return function(t) {
|
|
522
|
-
if (
|
|
522
|
+
if (nt(t))
|
|
523
523
|
return t.lift(function(e) {
|
|
524
524
|
try {
|
|
525
525
|
return n(e, this);
|
|
@@ -531,35 +531,35 @@ function A(n) {
|
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
function O(n, t, e, r, s) {
|
|
534
|
-
return new
|
|
534
|
+
return new rt(n, t, e, r, s);
|
|
535
535
|
}
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
function t(e, r, s,
|
|
539
|
-
var
|
|
540
|
-
return
|
|
536
|
+
var rt = (function(n) {
|
|
537
|
+
T(t, n);
|
|
538
|
+
function t(e, r, s, o, i, a) {
|
|
539
|
+
var c = n.call(this, e) || this;
|
|
540
|
+
return c.onFinalize = i, c.shouldUnsubscribe = a, c._next = r ? function(u) {
|
|
541
541
|
try {
|
|
542
|
-
r(
|
|
542
|
+
r(u);
|
|
543
543
|
} catch (h) {
|
|
544
544
|
e.error(h);
|
|
545
545
|
}
|
|
546
|
-
} : n.prototype._next,
|
|
546
|
+
} : n.prototype._next, c._error = o ? function(u) {
|
|
547
547
|
try {
|
|
548
|
-
|
|
548
|
+
o(u);
|
|
549
549
|
} catch (h) {
|
|
550
550
|
e.error(h);
|
|
551
551
|
} finally {
|
|
552
552
|
this.unsubscribe();
|
|
553
553
|
}
|
|
554
|
-
} : n.prototype._error,
|
|
554
|
+
} : n.prototype._error, c._complete = s ? function() {
|
|
555
555
|
try {
|
|
556
556
|
s();
|
|
557
|
-
} catch (
|
|
558
|
-
e.error(
|
|
557
|
+
} catch (u) {
|
|
558
|
+
e.error(u);
|
|
559
559
|
} finally {
|
|
560
560
|
this.unsubscribe();
|
|
561
561
|
}
|
|
562
|
-
} : n.prototype._complete,
|
|
562
|
+
} : n.prototype._complete, c;
|
|
563
563
|
}
|
|
564
564
|
return t.prototype.unsubscribe = function() {
|
|
565
565
|
var e;
|
|
@@ -568,12 +568,12 @@ var nt = (function(n) {
|
|
|
568
568
|
n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
569
569
|
}
|
|
570
570
|
}, t;
|
|
571
|
-
})(ne),
|
|
571
|
+
})(ne), st = ye(function(n) {
|
|
572
572
|
return function() {
|
|
573
573
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
574
574
|
};
|
|
575
575
|
}), se = (function(n) {
|
|
576
|
-
|
|
576
|
+
T(t, n);
|
|
577
577
|
function t() {
|
|
578
578
|
var e = n.call(this) || this;
|
|
579
579
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
@@ -583,23 +583,23 @@ var nt = (function(n) {
|
|
|
583
583
|
return r.operator = e, r;
|
|
584
584
|
}, t.prototype._throwIfClosed = function() {
|
|
585
585
|
if (this.closed)
|
|
586
|
-
throw new
|
|
586
|
+
throw new st();
|
|
587
587
|
}, t.prototype.next = function(e) {
|
|
588
588
|
var r = this;
|
|
589
|
-
|
|
590
|
-
var s,
|
|
589
|
+
B(function() {
|
|
590
|
+
var s, o;
|
|
591
591
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
592
592
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
593
593
|
try {
|
|
594
|
-
for (var
|
|
595
|
-
var
|
|
596
|
-
|
|
594
|
+
for (var i = k(r.currentObservers), a = i.next(); !a.done; a = i.next()) {
|
|
595
|
+
var c = a.value;
|
|
596
|
+
c.next(e);
|
|
597
597
|
}
|
|
598
|
-
} catch (
|
|
599
|
-
s = { error:
|
|
598
|
+
} catch (u) {
|
|
599
|
+
s = { error: u };
|
|
600
600
|
} finally {
|
|
601
601
|
try {
|
|
602
|
-
a && !a.done && (
|
|
602
|
+
a && !a.done && (o = i.return) && o.call(i);
|
|
603
603
|
} finally {
|
|
604
604
|
if (s) throw s.error;
|
|
605
605
|
}
|
|
@@ -608,7 +608,7 @@ var nt = (function(n) {
|
|
|
608
608
|
});
|
|
609
609
|
}, t.prototype.error = function(e) {
|
|
610
610
|
var r = this;
|
|
611
|
-
|
|
611
|
+
B(function() {
|
|
612
612
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
613
613
|
r.hasError = r.isStopped = !0, r.thrownError = e;
|
|
614
614
|
for (var s = r.observers; s.length; )
|
|
@@ -617,7 +617,7 @@ var nt = (function(n) {
|
|
|
617
617
|
});
|
|
618
618
|
}, t.prototype.complete = function() {
|
|
619
619
|
var e = this;
|
|
620
|
-
|
|
620
|
+
B(function() {
|
|
621
621
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
622
622
|
e.isStopped = !0;
|
|
623
623
|
for (var r = e.observers; r.length; )
|
|
@@ -638,13 +638,13 @@ var nt = (function(n) {
|
|
|
638
638
|
}, t.prototype._subscribe = function(e) {
|
|
639
639
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
640
640
|
}, t.prototype._innerSubscribe = function(e) {
|
|
641
|
-
var r = this, s = this,
|
|
642
|
-
return
|
|
643
|
-
r.currentObservers = null,
|
|
641
|
+
var r = this, s = this, o = s.hasError, i = s.isStopped, a = s.observers;
|
|
642
|
+
return o || i ? Se : (this.currentObservers = null, a.push(e), new R(function() {
|
|
643
|
+
r.currentObservers = null, q(a, e);
|
|
644
644
|
}));
|
|
645
645
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
646
|
-
var r = this, s = r.hasError,
|
|
647
|
-
s ? e.error(
|
|
646
|
+
var r = this, s = r.hasError, o = r.thrownError, i = r.isStopped;
|
|
647
|
+
s ? e.error(o) : i && e.complete();
|
|
648
648
|
}, t.prototype.asObservable = function() {
|
|
649
649
|
var e = new S();
|
|
650
650
|
return e.source = this, e;
|
|
@@ -652,7 +652,7 @@ var nt = (function(n) {
|
|
|
652
652
|
return new ce(e, r);
|
|
653
653
|
}, t;
|
|
654
654
|
})(S), ce = (function(n) {
|
|
655
|
-
|
|
655
|
+
T(t, n);
|
|
656
656
|
function t(e, r) {
|
|
657
657
|
var s = n.call(this) || this;
|
|
658
658
|
return s.destination = e, s.source = r, s;
|
|
@@ -668,10 +668,10 @@ var nt = (function(n) {
|
|
|
668
668
|
(r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
|
|
669
669
|
}, t.prototype._subscribe = function(e) {
|
|
670
670
|
var r, s;
|
|
671
|
-
return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s :
|
|
671
|
+
return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : Se;
|
|
672
672
|
}, t;
|
|
673
673
|
})(se), P = (function(n) {
|
|
674
|
-
|
|
674
|
+
T(t, n);
|
|
675
675
|
function t(e) {
|
|
676
676
|
var r = n.call(this) || this;
|
|
677
677
|
return r._value = e, r;
|
|
@@ -686,37 +686,37 @@ var nt = (function(n) {
|
|
|
686
686
|
var r = n.prototype._subscribe.call(this, e);
|
|
687
687
|
return !r.closed && e.next(this._value), r;
|
|
688
688
|
}, t.prototype.getValue = function() {
|
|
689
|
-
var e = this, r = e.hasError, s = e.thrownError,
|
|
689
|
+
var e = this, r = e.hasError, s = e.thrownError, o = e._value;
|
|
690
690
|
if (r)
|
|
691
691
|
throw s;
|
|
692
|
-
return this._throwIfClosed(),
|
|
692
|
+
return this._throwIfClosed(), o;
|
|
693
693
|
}, t.prototype.next = function(e) {
|
|
694
694
|
n.prototype.next.call(this, this._value = e);
|
|
695
695
|
}, t;
|
|
696
|
-
})(se),
|
|
696
|
+
})(se), ot = {
|
|
697
697
|
now: function() {
|
|
698
698
|
return Date.now();
|
|
699
699
|
}
|
|
700
700
|
}, it = (function(n) {
|
|
701
|
-
|
|
701
|
+
T(t, n);
|
|
702
702
|
function t(e, r) {
|
|
703
703
|
return n.call(this) || this;
|
|
704
704
|
}
|
|
705
705
|
return t.prototype.schedule = function(e, r) {
|
|
706
706
|
return this;
|
|
707
707
|
}, t;
|
|
708
|
-
})(
|
|
708
|
+
})(R), ue = {
|
|
709
709
|
setInterval: function(n, t) {
|
|
710
710
|
for (var e = [], r = 2; r < arguments.length; r++)
|
|
711
711
|
e[r - 2] = arguments[r];
|
|
712
|
-
return setInterval.apply(void 0,
|
|
712
|
+
return setInterval.apply(void 0, H([n, t], D(e)));
|
|
713
713
|
},
|
|
714
714
|
clearInterval: function(n) {
|
|
715
715
|
return clearInterval(n);
|
|
716
716
|
},
|
|
717
717
|
delegate: void 0
|
|
718
|
-
},
|
|
719
|
-
|
|
718
|
+
}, at = (function(n) {
|
|
719
|
+
T(t, n);
|
|
720
720
|
function t(e, r) {
|
|
721
721
|
var s = n.call(this, e, r) || this;
|
|
722
722
|
return s.scheduler = e, s.work = r, s.pending = !1, s;
|
|
@@ -726,8 +726,8 @@ var nt = (function(n) {
|
|
|
726
726
|
if (r === void 0 && (r = 0), this.closed)
|
|
727
727
|
return this;
|
|
728
728
|
this.state = e;
|
|
729
|
-
var
|
|
730
|
-
return
|
|
729
|
+
var o = this.id, i = this.scheduler;
|
|
730
|
+
return o != null && (this.id = this.recycleAsyncId(i, o, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(i, this.id, r), this;
|
|
731
731
|
}, t.prototype.requestAsyncId = function(e, r, s) {
|
|
732
732
|
return s === void 0 && (s = 0), ue.setInterval(e.flush.bind(e, this), s);
|
|
733
733
|
}, t.prototype.recycleAsyncId = function(e, r, s) {
|
|
@@ -743,18 +743,18 @@ var nt = (function(n) {
|
|
|
743
743
|
return s;
|
|
744
744
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
745
745
|
}, t.prototype._execute = function(e, r) {
|
|
746
|
-
var s = !1,
|
|
746
|
+
var s = !1, o;
|
|
747
747
|
try {
|
|
748
748
|
this.work(e);
|
|
749
|
-
} catch (
|
|
750
|
-
s = !0,
|
|
749
|
+
} catch (i) {
|
|
750
|
+
s = !0, o = i || new Error("Scheduled action threw falsy error");
|
|
751
751
|
}
|
|
752
752
|
if (s)
|
|
753
|
-
return this.unsubscribe(),
|
|
753
|
+
return this.unsubscribe(), o;
|
|
754
754
|
}, t.prototype.unsubscribe = function() {
|
|
755
755
|
if (!this.closed) {
|
|
756
|
-
var e = this, r = e.id, s = e.scheduler,
|
|
757
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
756
|
+
var e = this, r = e.id, s = e.scheduler, o = s.actions;
|
|
757
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, q(o, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
758
758
|
}
|
|
759
759
|
}, t;
|
|
760
760
|
})(it), le = (function() {
|
|
@@ -763,9 +763,9 @@ var nt = (function(n) {
|
|
|
763
763
|
}
|
|
764
764
|
return n.prototype.schedule = function(t, e, r) {
|
|
765
765
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
|
|
766
|
-
}, n.now =
|
|
767
|
-
})(),
|
|
768
|
-
|
|
766
|
+
}, n.now = ot.now, n;
|
|
767
|
+
})(), ct = (function(n) {
|
|
768
|
+
T(t, n);
|
|
769
769
|
function t(e, r) {
|
|
770
770
|
r === void 0 && (r = le.now);
|
|
771
771
|
var s = n.call(this, e, r) || this;
|
|
@@ -789,64 +789,64 @@ var nt = (function(n) {
|
|
|
789
789
|
throw s;
|
|
790
790
|
}
|
|
791
791
|
}, t;
|
|
792
|
-
})(le),
|
|
792
|
+
})(le), Ie = new ct(at), ut = Ie, lt = new S(function(n) {
|
|
793
793
|
return n.complete();
|
|
794
794
|
});
|
|
795
|
-
function we(n) {
|
|
796
|
-
return n && m(n.schedule);
|
|
797
|
-
}
|
|
798
795
|
function Te(n) {
|
|
796
|
+
return n && g(n.schedule);
|
|
797
|
+
}
|
|
798
|
+
function xe(n) {
|
|
799
799
|
return n[n.length - 1];
|
|
800
800
|
}
|
|
801
|
-
function
|
|
802
|
-
return
|
|
801
|
+
function dt(n) {
|
|
802
|
+
return g(xe(n)) ? n.pop() : void 0;
|
|
803
803
|
}
|
|
804
804
|
function Ce(n) {
|
|
805
|
-
return
|
|
805
|
+
return Te(xe(n)) ? n.pop() : void 0;
|
|
806
806
|
}
|
|
807
807
|
var Oe = (function(n) {
|
|
808
808
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
809
809
|
});
|
|
810
810
|
function Ae(n) {
|
|
811
|
-
return
|
|
811
|
+
return g(n?.then);
|
|
812
812
|
}
|
|
813
|
-
function
|
|
814
|
-
return
|
|
813
|
+
function Le(n) {
|
|
814
|
+
return g(n[re]);
|
|
815
815
|
}
|
|
816
|
-
function
|
|
817
|
-
return Symbol.asyncIterator &&
|
|
816
|
+
function _e(n) {
|
|
817
|
+
return Symbol.asyncIterator && g(n?.[Symbol.asyncIterator]);
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function Pe(n) {
|
|
820
820
|
return new TypeError("You provided " + (n !== null && typeof n == "object" ? "an invalid object" : "'" + n + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function ht() {
|
|
823
823
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
824
824
|
}
|
|
825
|
-
var
|
|
826
|
-
function
|
|
827
|
-
return
|
|
825
|
+
var Me = ht();
|
|
826
|
+
function Ue(n) {
|
|
827
|
+
return g(n?.[Me]);
|
|
828
828
|
}
|
|
829
829
|
function ke(n) {
|
|
830
830
|
return Ye(this, arguments, function() {
|
|
831
|
-
var e, r, s,
|
|
832
|
-
return ve(this, function(
|
|
833
|
-
switch (
|
|
831
|
+
var e, r, s, o;
|
|
832
|
+
return ve(this, function(i) {
|
|
833
|
+
switch (i.label) {
|
|
834
834
|
case 0:
|
|
835
|
-
e = n.getReader(),
|
|
835
|
+
e = n.getReader(), i.label = 1;
|
|
836
836
|
case 1:
|
|
837
|
-
|
|
837
|
+
i.trys.push([1, , 9, 10]), i.label = 2;
|
|
838
838
|
case 2:
|
|
839
|
-
return [4,
|
|
839
|
+
return [4, U(e.read())];
|
|
840
840
|
case 3:
|
|
841
|
-
return r =
|
|
841
|
+
return r = i.sent(), s = r.value, o = r.done, o ? [4, U(void 0)] : [3, 5];
|
|
842
842
|
case 4:
|
|
843
|
-
return [2,
|
|
843
|
+
return [2, i.sent()];
|
|
844
844
|
case 5:
|
|
845
|
-
return [4,
|
|
845
|
+
return [4, U(s)];
|
|
846
846
|
case 6:
|
|
847
|
-
return [4,
|
|
847
|
+
return [4, i.sent()];
|
|
848
848
|
case 7:
|
|
849
|
-
return
|
|
849
|
+
return i.sent(), [3, 2];
|
|
850
850
|
case 8:
|
|
851
851
|
return [3, 10];
|
|
852
852
|
case 9:
|
|
@@ -857,66 +857,66 @@ function ke(n) {
|
|
|
857
857
|
});
|
|
858
858
|
});
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
860
|
+
function Ne(n) {
|
|
861
|
+
return g(n?.getReader);
|
|
862
862
|
}
|
|
863
863
|
function M(n) {
|
|
864
864
|
if (n instanceof S)
|
|
865
865
|
return n;
|
|
866
866
|
if (n != null) {
|
|
867
|
-
if (
|
|
868
|
-
return ht(n);
|
|
869
|
-
if (Oe(n))
|
|
867
|
+
if (Le(n))
|
|
870
868
|
return ft(n);
|
|
871
|
-
if (
|
|
869
|
+
if (Oe(n))
|
|
872
870
|
return pt(n);
|
|
873
|
-
if (
|
|
874
|
-
return Ne(n);
|
|
875
|
-
if (Le(n))
|
|
876
|
-
return gt(n);
|
|
877
|
-
if (Ue(n))
|
|
871
|
+
if (Ae(n))
|
|
878
872
|
return mt(n);
|
|
873
|
+
if (_e(n))
|
|
874
|
+
return Re(n);
|
|
875
|
+
if (Ue(n))
|
|
876
|
+
return gt(n);
|
|
877
|
+
if (Ne(n))
|
|
878
|
+
return bt(n);
|
|
879
879
|
}
|
|
880
|
-
throw
|
|
880
|
+
throw Pe(n);
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function ft(n) {
|
|
883
883
|
return new S(function(t) {
|
|
884
884
|
var e = n[re]();
|
|
885
|
-
if (
|
|
885
|
+
if (g(e.subscribe))
|
|
886
886
|
return e.subscribe(t);
|
|
887
887
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
888
888
|
});
|
|
889
889
|
}
|
|
890
|
-
function
|
|
890
|
+
function pt(n) {
|
|
891
891
|
return new S(function(t) {
|
|
892
892
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
893
893
|
t.next(n[e]);
|
|
894
894
|
t.complete();
|
|
895
895
|
});
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function mt(n) {
|
|
898
898
|
return new S(function(t) {
|
|
899
899
|
n.then(function(e) {
|
|
900
900
|
t.closed || (t.next(e), t.complete());
|
|
901
901
|
}, function(e) {
|
|
902
902
|
return t.error(e);
|
|
903
|
-
}).then(null,
|
|
903
|
+
}).then(null, Ee);
|
|
904
904
|
});
|
|
905
905
|
}
|
|
906
906
|
function gt(n) {
|
|
907
907
|
return new S(function(t) {
|
|
908
908
|
var e, r;
|
|
909
909
|
try {
|
|
910
|
-
for (var s = k(n),
|
|
911
|
-
var
|
|
912
|
-
if (t.next(
|
|
910
|
+
for (var s = k(n), o = s.next(); !o.done; o = s.next()) {
|
|
911
|
+
var i = o.value;
|
|
912
|
+
if (t.next(i), t.closed)
|
|
913
913
|
return;
|
|
914
914
|
}
|
|
915
915
|
} catch (a) {
|
|
916
916
|
e = { error: a };
|
|
917
917
|
} finally {
|
|
918
918
|
try {
|
|
919
|
-
|
|
919
|
+
o && !o.done && (r = s.return) && r.call(s);
|
|
920
920
|
} finally {
|
|
921
921
|
if (e) throw e.error;
|
|
922
922
|
}
|
|
@@ -924,41 +924,41 @@ function gt(n) {
|
|
|
924
924
|
t.complete();
|
|
925
925
|
});
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function Re(n) {
|
|
928
928
|
return new S(function(t) {
|
|
929
929
|
vt(n, t).catch(function(e) {
|
|
930
930
|
return t.error(e);
|
|
931
931
|
});
|
|
932
932
|
});
|
|
933
933
|
}
|
|
934
|
-
function
|
|
935
|
-
return
|
|
934
|
+
function bt(n) {
|
|
935
|
+
return Re(ke(n));
|
|
936
936
|
}
|
|
937
937
|
function vt(n, t) {
|
|
938
|
-
var e, r, s,
|
|
939
|
-
return
|
|
940
|
-
var
|
|
941
|
-
return ve(this, function(
|
|
942
|
-
switch (
|
|
938
|
+
var e, r, s, o;
|
|
939
|
+
return qe(this, void 0, void 0, function() {
|
|
940
|
+
var i, a;
|
|
941
|
+
return ve(this, function(c) {
|
|
942
|
+
switch (c.label) {
|
|
943
943
|
case 0:
|
|
944
|
-
|
|
944
|
+
c.trys.push([0, 5, 6, 11]), e = Xe(n), c.label = 1;
|
|
945
945
|
case 1:
|
|
946
946
|
return [4, e.next()];
|
|
947
947
|
case 2:
|
|
948
|
-
if (r =
|
|
949
|
-
if (
|
|
948
|
+
if (r = c.sent(), !!r.done) return [3, 4];
|
|
949
|
+
if (i = r.value, t.next(i), t.closed)
|
|
950
950
|
return [2];
|
|
951
|
-
|
|
951
|
+
c.label = 3;
|
|
952
952
|
case 3:
|
|
953
953
|
return [3, 1];
|
|
954
954
|
case 4:
|
|
955
955
|
return [3, 11];
|
|
956
956
|
case 5:
|
|
957
|
-
return a =
|
|
957
|
+
return a = c.sent(), s = { error: a }, [3, 11];
|
|
958
958
|
case 6:
|
|
959
|
-
return
|
|
959
|
+
return c.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
960
960
|
case 7:
|
|
961
|
-
|
|
961
|
+
c.sent(), c.label = 8;
|
|
962
962
|
case 8:
|
|
963
963
|
return [3, 10];
|
|
964
964
|
case 9:
|
|
@@ -974,13 +974,13 @@ function vt(n, t) {
|
|
|
974
974
|
}
|
|
975
975
|
function C(n, t, e, r, s) {
|
|
976
976
|
r === void 0 && (r = 0), s === void 0 && (s = !1);
|
|
977
|
-
var
|
|
977
|
+
var o = t.schedule(function() {
|
|
978
978
|
e(), s ? n.add(this.schedule(null, r)) : this.unsubscribe();
|
|
979
979
|
}, r);
|
|
980
|
-
if (n.add(
|
|
981
|
-
return
|
|
980
|
+
if (n.add(o), !s)
|
|
981
|
+
return o;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function $e(n, t) {
|
|
984
984
|
return t === void 0 && (t = 0), A(function(e, r) {
|
|
985
985
|
e.subscribe(O(r, function(s) {
|
|
986
986
|
return C(r, n, function() {
|
|
@@ -997,7 +997,7 @@ function Re(n, t) {
|
|
|
997
997
|
}));
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function je(n, t) {
|
|
1001
1001
|
return t === void 0 && (t = 0), A(function(e, r) {
|
|
1002
1002
|
r.add(n.schedule(function() {
|
|
1003
1003
|
return e.subscribe(r);
|
|
@@ -1005,12 +1005,12 @@ function $e(n, t) {
|
|
|
1005
1005
|
});
|
|
1006
1006
|
}
|
|
1007
1007
|
function yt(n, t) {
|
|
1008
|
-
return M(n).pipe(
|
|
1009
|
-
}
|
|
1010
|
-
function bt(n, t) {
|
|
1011
|
-
return M(n).pipe($e(t), Re(t));
|
|
1008
|
+
return M(n).pipe(je(t), $e(t));
|
|
1012
1009
|
}
|
|
1013
1010
|
function St(n, t) {
|
|
1011
|
+
return M(n).pipe(je(t), $e(t));
|
|
1012
|
+
}
|
|
1013
|
+
function wt(n, t) {
|
|
1014
1014
|
return new S(function(e) {
|
|
1015
1015
|
var r = 0;
|
|
1016
1016
|
return t.schedule(function() {
|
|
@@ -1018,26 +1018,26 @@ function St(n, t) {
|
|
|
1018
1018
|
});
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function Et(n, t) {
|
|
1022
1022
|
return new S(function(e) {
|
|
1023
1023
|
var r;
|
|
1024
1024
|
return C(e, t, function() {
|
|
1025
|
-
r = n[
|
|
1026
|
-
var s,
|
|
1025
|
+
r = n[Me](), C(e, t, function() {
|
|
1026
|
+
var s, o, i;
|
|
1027
1027
|
try {
|
|
1028
|
-
s = r.next(),
|
|
1028
|
+
s = r.next(), o = s.value, i = s.done;
|
|
1029
1029
|
} catch (a) {
|
|
1030
1030
|
e.error(a);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
|
|
1033
|
+
i ? e.complete() : e.next(o);
|
|
1034
1034
|
}, 0, !0);
|
|
1035
1035
|
}), function() {
|
|
1036
|
-
return
|
|
1036
|
+
return g(r?.return) && r.return();
|
|
1037
1037
|
};
|
|
1038
1038
|
});
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function De(n, t) {
|
|
1041
1041
|
if (!n)
|
|
1042
1042
|
throw new Error("Iterable cannot be null");
|
|
1043
1043
|
return new S(function(e) {
|
|
@@ -1051,63 +1051,63 @@ function je(n, t) {
|
|
|
1051
1051
|
});
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1055
|
-
return
|
|
1054
|
+
function It(n, t) {
|
|
1055
|
+
return De(ke(n), t);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Tt(n, t) {
|
|
1058
1058
|
if (n != null) {
|
|
1059
|
-
if (
|
|
1059
|
+
if (Le(n))
|
|
1060
1060
|
return yt(n, t);
|
|
1061
1061
|
if (Oe(n))
|
|
1062
|
-
return
|
|
1062
|
+
return wt(n, t);
|
|
1063
1063
|
if (Ae(n))
|
|
1064
|
-
return
|
|
1065
|
-
if (
|
|
1066
|
-
return
|
|
1067
|
-
if (Le(n))
|
|
1068
|
-
return It(n, t);
|
|
1064
|
+
return St(n, t);
|
|
1065
|
+
if (_e(n))
|
|
1066
|
+
return De(n, t);
|
|
1069
1067
|
if (Ue(n))
|
|
1070
1068
|
return Et(n, t);
|
|
1069
|
+
if (Ne(n))
|
|
1070
|
+
return It(n, t);
|
|
1071
1071
|
}
|
|
1072
|
-
throw
|
|
1072
|
+
throw Pe(n);
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
return t ?
|
|
1074
|
+
function oe(n, t) {
|
|
1075
|
+
return t ? Tt(n, t) : M(n);
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function xt() {
|
|
1078
1078
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1079
1079
|
n[t] = arguments[t];
|
|
1080
1080
|
var e = Ce(n);
|
|
1081
|
-
return
|
|
1081
|
+
return oe(n, e);
|
|
1082
1082
|
}
|
|
1083
1083
|
function Ct(n) {
|
|
1084
1084
|
return n instanceof Date && !isNaN(n);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function N(n, t) {
|
|
1087
1087
|
return A(function(e, r) {
|
|
1088
1088
|
var s = 0;
|
|
1089
|
-
e.subscribe(O(r, function(
|
|
1090
|
-
r.next(n.call(t,
|
|
1089
|
+
e.subscribe(O(r, function(o) {
|
|
1090
|
+
r.next(n.call(t, o, s++));
|
|
1091
1091
|
}));
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
var Ot = Array.isArray;
|
|
1095
1095
|
function At(n, t) {
|
|
1096
|
-
return Ot(t) ? n.apply(void 0,
|
|
1096
|
+
return Ot(t) ? n.apply(void 0, H([], D(t))) : n(t);
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return
|
|
1098
|
+
function Lt(n) {
|
|
1099
|
+
return N(function(t) {
|
|
1100
1100
|
return At(n, t);
|
|
1101
1101
|
});
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1103
|
+
var _t = Array.isArray, Pt = Object.getPrototypeOf, Mt = Object.prototype, Ut = Object.keys;
|
|
1104
1104
|
function kt(n) {
|
|
1105
1105
|
if (n.length === 1) {
|
|
1106
1106
|
var t = n[0];
|
|
1107
|
-
if (
|
|
1107
|
+
if (_t(t))
|
|
1108
1108
|
return { args: t, keys: null };
|
|
1109
|
-
if (
|
|
1110
|
-
var e =
|
|
1109
|
+
if (Nt(t)) {
|
|
1110
|
+
var e = Ut(t);
|
|
1111
1111
|
return {
|
|
1112
1112
|
args: e.map(function(r) {
|
|
1113
1113
|
return t[r];
|
|
@@ -1118,104 +1118,104 @@ function kt(n) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
return { args: n, keys: null };
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1122
|
-
return n && typeof n == "object" &&
|
|
1121
|
+
function Nt(n) {
|
|
1122
|
+
return n && typeof n == "object" && Pt(n) === Mt;
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function Rt(n, t) {
|
|
1125
1125
|
return n.reduce(function(e, r, s) {
|
|
1126
1126
|
return e[r] = t[s], e;
|
|
1127
1127
|
}, {});
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function $t() {
|
|
1130
1130
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1131
1131
|
n[t] = arguments[t];
|
|
1132
|
-
var e = Ce(n), r =
|
|
1133
|
-
if (
|
|
1134
|
-
return
|
|
1135
|
-
var a = new S(
|
|
1136
|
-
return
|
|
1137
|
-
} :
|
|
1138
|
-
return r ? a.pipe(
|
|
1139
|
-
}
|
|
1140
|
-
function
|
|
1141
|
-
return e === void 0 && (e =
|
|
1132
|
+
var e = Ce(n), r = dt(n), s = kt(n), o = s.args, i = s.keys;
|
|
1133
|
+
if (o.length === 0)
|
|
1134
|
+
return oe([], e);
|
|
1135
|
+
var a = new S(jt(o, e, i ? function(c) {
|
|
1136
|
+
return Rt(i, c);
|
|
1137
|
+
} : X));
|
|
1138
|
+
return r ? a.pipe(Lt(r)) : a;
|
|
1139
|
+
}
|
|
1140
|
+
function jt(n, t, e) {
|
|
1141
|
+
return e === void 0 && (e = X), function(r) {
|
|
1142
1142
|
de(t, function() {
|
|
1143
|
-
for (var s = n.length,
|
|
1143
|
+
for (var s = n.length, o = new Array(s), i = s, a = s, c = function(h) {
|
|
1144
1144
|
de(t, function() {
|
|
1145
|
-
var
|
|
1146
|
-
|
|
1147
|
-
|
|
1145
|
+
var m = oe(n[h], t), b = !1;
|
|
1146
|
+
m.subscribe(O(r, function(l) {
|
|
1147
|
+
o[h] = l, b || (b = !0, a--), a || r.next(e(o.slice()));
|
|
1148
1148
|
}, function() {
|
|
1149
|
-
--
|
|
1149
|
+
--i || r.complete();
|
|
1150
1150
|
}));
|
|
1151
1151
|
}, r);
|
|
1152
|
-
},
|
|
1153
|
-
u
|
|
1152
|
+
}, u = 0; u < s; u++)
|
|
1153
|
+
c(u);
|
|
1154
1154
|
}, r);
|
|
1155
1155
|
};
|
|
1156
1156
|
}
|
|
1157
1157
|
function de(n, t, e) {
|
|
1158
1158
|
n ? C(e, n, t) : t();
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1160
|
+
function Dt(n, t, e, r, s, o, i, a) {
|
|
1161
|
+
var c = [], u = 0, h = 0, m = !1, b = function() {
|
|
1162
|
+
m && !c.length && !u && t.complete();
|
|
1163
1163
|
}, l = function(p) {
|
|
1164
|
-
return
|
|
1164
|
+
return u < r ? f(p) : c.push(p);
|
|
1165
1165
|
}, f = function(p) {
|
|
1166
|
-
|
|
1167
|
-
var
|
|
1168
|
-
M(e(p, h++)).subscribe(O(t, function(
|
|
1169
|
-
t.next(
|
|
1166
|
+
u++;
|
|
1167
|
+
var L = !1;
|
|
1168
|
+
M(e(p, h++)).subscribe(O(t, function(w) {
|
|
1169
|
+
t.next(w);
|
|
1170
1170
|
}, function() {
|
|
1171
|
-
|
|
1171
|
+
L = !0;
|
|
1172
1172
|
}, void 0, function() {
|
|
1173
|
-
if (
|
|
1173
|
+
if (L)
|
|
1174
1174
|
try {
|
|
1175
|
-
|
|
1176
|
-
for (var
|
|
1177
|
-
var
|
|
1178
|
-
|
|
1179
|
-
};
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
} catch (
|
|
1183
|
-
t.error(
|
|
1175
|
+
u--;
|
|
1176
|
+
for (var w = function() {
|
|
1177
|
+
var _ = c.shift();
|
|
1178
|
+
i || f(_);
|
|
1179
|
+
}; c.length && u < r; )
|
|
1180
|
+
w();
|
|
1181
|
+
b();
|
|
1182
|
+
} catch (_) {
|
|
1183
|
+
t.error(_);
|
|
1184
1184
|
}
|
|
1185
1185
|
}));
|
|
1186
1186
|
};
|
|
1187
1187
|
return n.subscribe(O(t, l, function() {
|
|
1188
|
-
|
|
1188
|
+
m = !0, b();
|
|
1189
1189
|
})), function() {
|
|
1190
1190
|
};
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return e === void 0 && (e = 1 / 0),
|
|
1194
|
-
return
|
|
1195
|
-
return t(r,
|
|
1192
|
+
function Y(n, t, e) {
|
|
1193
|
+
return e === void 0 && (e = 1 / 0), g(t) ? Y(function(r, s) {
|
|
1194
|
+
return N(function(o, i) {
|
|
1195
|
+
return t(r, o, s, i);
|
|
1196
1196
|
})(M(n(r, s)));
|
|
1197
1197
|
}, e) : (typeof t == "number" && (e = t), A(function(r, s) {
|
|
1198
|
-
return
|
|
1198
|
+
return Dt(r, s, n, e);
|
|
1199
1199
|
}));
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1202
|
-
n === void 0 && (n = 0), e === void 0 && (e =
|
|
1201
|
+
function Ht(n, t, e) {
|
|
1202
|
+
n === void 0 && (n = 0), e === void 0 && (e = ut);
|
|
1203
1203
|
var r = -1;
|
|
1204
|
-
return t != null && (
|
|
1205
|
-
var
|
|
1206
|
-
|
|
1207
|
-
var
|
|
1204
|
+
return t != null && (Te(t) ? e = t : r = t), new S(function(s) {
|
|
1205
|
+
var o = Ct(n) ? +n - e.now() : n;
|
|
1206
|
+
o < 0 && (o = 0);
|
|
1207
|
+
var i = 0;
|
|
1208
1208
|
return e.schedule(function() {
|
|
1209
|
-
s.closed || (s.next(
|
|
1210
|
-
},
|
|
1209
|
+
s.closed || (s.next(i++), 0 <= r ? this.schedule(void 0, r) : s.complete());
|
|
1210
|
+
}, o);
|
|
1211
1211
|
});
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return
|
|
1213
|
+
function Ft(n, t) {
|
|
1214
|
+
return g(t) ? Y(n, t, 1) : Y(n, 1);
|
|
1215
1215
|
}
|
|
1216
1216
|
function Gt(n) {
|
|
1217
1217
|
return n <= 0 ? function() {
|
|
1218
|
-
return
|
|
1218
|
+
return lt;
|
|
1219
1219
|
} : A(function(t, e) {
|
|
1220
1220
|
var r = 0;
|
|
1221
1221
|
t.subscribe(O(e, function(s) {
|
|
@@ -1223,36 +1223,36 @@ function Gt(n) {
|
|
|
1223
1223
|
}));
|
|
1224
1224
|
});
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1227
|
-
return
|
|
1226
|
+
function Bt(n) {
|
|
1227
|
+
return N(function() {
|
|
1228
1228
|
return n;
|
|
1229
1229
|
});
|
|
1230
1230
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1233
|
-
return M(n(e, r)).pipe(Gt(1),
|
|
1231
|
+
function Kt(n, t) {
|
|
1232
|
+
return Y(function(e, r) {
|
|
1233
|
+
return M(n(e, r)).pipe(Gt(1), Bt(e));
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1237
|
-
t === void 0 && (t =
|
|
1238
|
-
var e =
|
|
1239
|
-
return
|
|
1236
|
+
function qt(n, t) {
|
|
1237
|
+
t === void 0 && (t = Ie);
|
|
1238
|
+
var e = Ht(n, t);
|
|
1239
|
+
return Kt(function() {
|
|
1240
1240
|
return e;
|
|
1241
1241
|
});
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return t === void 0 && (t =
|
|
1245
|
-
var s,
|
|
1246
|
-
e.subscribe(O(r, function(
|
|
1247
|
-
var a = t(
|
|
1248
|
-
(
|
|
1243
|
+
function j(n, t) {
|
|
1244
|
+
return t === void 0 && (t = X), n = n ?? Yt, A(function(e, r) {
|
|
1245
|
+
var s, o = !0;
|
|
1246
|
+
e.subscribe(O(r, function(i) {
|
|
1247
|
+
var a = t(i);
|
|
1248
|
+
(o || !n(s, a)) && (o = !1, s = a, r.next(i));
|
|
1249
1249
|
}));
|
|
1250
1250
|
});
|
|
1251
1251
|
}
|
|
1252
1252
|
function Yt(n, t) {
|
|
1253
1253
|
return n === t;
|
|
1254
1254
|
}
|
|
1255
|
-
function
|
|
1255
|
+
function Xt(n) {
|
|
1256
1256
|
return A(function(t, e) {
|
|
1257
1257
|
try {
|
|
1258
1258
|
t.subscribe(e);
|
|
@@ -1265,51 +1265,51 @@ function Vt(n) {
|
|
|
1265
1265
|
return A(function(t, e) {
|
|
1266
1266
|
M(n).subscribe(O(e, function() {
|
|
1267
1267
|
return e.complete();
|
|
1268
|
-
},
|
|
1268
|
+
}, Z)), !e.closed && t.subscribe(e);
|
|
1269
1269
|
});
|
|
1270
1270
|
}
|
|
1271
|
-
async function
|
|
1271
|
+
async function Wt(n, t) {
|
|
1272
1272
|
const e = n.getReader();
|
|
1273
1273
|
let r;
|
|
1274
1274
|
for (; !(r = await e.read()).done; )
|
|
1275
1275
|
t(r.value);
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function zt(n) {
|
|
1278
1278
|
let t, e, r, s = !1;
|
|
1279
|
-
return function(
|
|
1280
|
-
t === void 0 ? (t =
|
|
1279
|
+
return function(i) {
|
|
1280
|
+
t === void 0 ? (t = i, e = 0, r = -1) : t = Qt(t, i);
|
|
1281
1281
|
const a = t.length;
|
|
1282
|
-
let
|
|
1282
|
+
let c = 0;
|
|
1283
1283
|
for (; e < a; ) {
|
|
1284
|
-
s && (t[e] === 10 && (
|
|
1285
|
-
let
|
|
1286
|
-
for (; e < a &&
|
|
1284
|
+
s && (t[e] === 10 && (c = ++e), s = !1);
|
|
1285
|
+
let u = -1;
|
|
1286
|
+
for (; e < a && u === -1; ++e)
|
|
1287
1287
|
switch (t[e]) {
|
|
1288
1288
|
case 58:
|
|
1289
|
-
r === -1 && (r = e -
|
|
1289
|
+
r === -1 && (r = e - c);
|
|
1290
1290
|
break;
|
|
1291
1291
|
case 13:
|
|
1292
1292
|
s = !0;
|
|
1293
1293
|
case 10:
|
|
1294
|
-
|
|
1294
|
+
u = e;
|
|
1295
1295
|
break;
|
|
1296
1296
|
}
|
|
1297
|
-
if (
|
|
1297
|
+
if (u === -1)
|
|
1298
1298
|
break;
|
|
1299
|
-
n(t.subarray(
|
|
1299
|
+
n(t.subarray(c, u), r), c = e, r = -1;
|
|
1300
1300
|
}
|
|
1301
|
-
|
|
1301
|
+
c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function Jt(n, t, e) {
|
|
1305
1305
|
let r = he();
|
|
1306
1306
|
const s = new TextDecoder();
|
|
1307
|
-
return function(
|
|
1308
|
-
if (
|
|
1307
|
+
return function(i, a) {
|
|
1308
|
+
if (i.length === 0)
|
|
1309
1309
|
e?.(r), r = he();
|
|
1310
1310
|
else if (a > 0) {
|
|
1311
|
-
const
|
|
1312
|
-
switch (
|
|
1311
|
+
const c = s.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(u));
|
|
1312
|
+
switch (c) {
|
|
1313
1313
|
case "data":
|
|
1314
1314
|
r.data = r.data ? r.data + `
|
|
1315
1315
|
` + h : h;
|
|
@@ -1321,14 +1321,14 @@ function zt(n, t, e) {
|
|
|
1321
1321
|
n(r.id = h);
|
|
1322
1322
|
break;
|
|
1323
1323
|
case "retry":
|
|
1324
|
-
const
|
|
1325
|
-
isNaN(
|
|
1324
|
+
const m = parseInt(h, 10);
|
|
1325
|
+
isNaN(m) || t(r.retry = m);
|
|
1326
1326
|
break;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
};
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function Qt(n, t) {
|
|
1332
1332
|
const e = new Uint8Array(n.length + t.length);
|
|
1333
1333
|
return e.set(n), e.set(t, n.length), e;
|
|
1334
1334
|
}
|
|
@@ -1340,7 +1340,7 @@ function he() {
|
|
|
1340
1340
|
retry: void 0
|
|
1341
1341
|
};
|
|
1342
1342
|
}
|
|
1343
|
-
var
|
|
1343
|
+
var Zt = function(n, t) {
|
|
1344
1344
|
var e = {};
|
|
1345
1345
|
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
|
|
1346
1346
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -1348,69 +1348,69 @@ var Qt = function(n, t) {
|
|
|
1348
1348
|
t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (e[r[s]] = n[r[s]]);
|
|
1349
1349
|
return e;
|
|
1350
1350
|
};
|
|
1351
|
-
const
|
|
1352
|
-
function
|
|
1353
|
-
var { signal: e, headers: r, onopen: s, onmessage:
|
|
1354
|
-
return new Promise((
|
|
1351
|
+
const te = "text/event-stream", en = 1e3, fe = "last-event-id";
|
|
1352
|
+
function tn(n, t) {
|
|
1353
|
+
var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = t, h = Zt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1354
|
+
return new Promise((m, b) => {
|
|
1355
1355
|
const l = Object.assign({}, r);
|
|
1356
|
-
l.accept || (l.accept =
|
|
1356
|
+
l.accept || (l.accept = te);
|
|
1357
1357
|
let f;
|
|
1358
1358
|
function p() {
|
|
1359
1359
|
f.abort(), document.hidden || V();
|
|
1360
1360
|
}
|
|
1361
|
-
|
|
1362
|
-
let
|
|
1363
|
-
function
|
|
1364
|
-
document.removeEventListener("visibilitychange", p), window.clearTimeout(
|
|
1361
|
+
c || document.addEventListener("visibilitychange", p);
|
|
1362
|
+
let L = en, w = 0;
|
|
1363
|
+
function _() {
|
|
1364
|
+
document.removeEventListener("visibilitychange", p), window.clearTimeout(w), f.abort();
|
|
1365
1365
|
}
|
|
1366
1366
|
e?.addEventListener("abort", () => {
|
|
1367
|
-
|
|
1367
|
+
_(), m();
|
|
1368
1368
|
});
|
|
1369
|
-
const
|
|
1369
|
+
const Fe = u ?? window.fetch, Ge = s ?? nn;
|
|
1370
1370
|
async function V() {
|
|
1371
|
-
var
|
|
1371
|
+
var W;
|
|
1372
1372
|
f = new AbortController();
|
|
1373
1373
|
try {
|
|
1374
|
-
const
|
|
1375
|
-
await Ge(
|
|
1376
|
-
|
|
1377
|
-
}, (
|
|
1378
|
-
|
|
1379
|
-
},
|
|
1380
|
-
} catch (
|
|
1374
|
+
const F = await Fe(n, Object.assign(Object.assign({}, h), { headers: l, signal: f.signal }));
|
|
1375
|
+
await Ge(F), await Wt(F.body, zt(Jt((x) => {
|
|
1376
|
+
x ? l[fe] = x : delete l[fe];
|
|
1377
|
+
}, (x) => {
|
|
1378
|
+
L = x;
|
|
1379
|
+
}, o))), i?.(), _(), m();
|
|
1380
|
+
} catch (F) {
|
|
1381
1381
|
if (!f.signal.aborted)
|
|
1382
1382
|
try {
|
|
1383
|
-
const
|
|
1384
|
-
window.clearTimeout(
|
|
1385
|
-
} catch (
|
|
1386
|
-
|
|
1383
|
+
const x = (W = a?.(F)) !== null && W !== void 0 ? W : L;
|
|
1384
|
+
window.clearTimeout(w), w = window.setTimeout(V, x);
|
|
1385
|
+
} catch (x) {
|
|
1386
|
+
_(), b(x);
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
1390
|
V();
|
|
1391
1391
|
});
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1393
|
+
function nn(n) {
|
|
1394
1394
|
const t = n.headers.get("content-type");
|
|
1395
|
-
if (!t?.startsWith(
|
|
1396
|
-
throw new Error(`Expected content-type to be ${
|
|
1395
|
+
if (!t?.startsWith(te))
|
|
1396
|
+
throw new Error(`Expected content-type to be ${te}, Actual: ${t}`);
|
|
1397
1397
|
}
|
|
1398
1398
|
function pe(n) {
|
|
1399
|
-
const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders:
|
|
1399
|
+
const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
|
|
1400
1400
|
return new S((a) => {
|
|
1401
|
-
const
|
|
1402
|
-
let
|
|
1403
|
-
const
|
|
1401
|
+
const c = new AbortController();
|
|
1402
|
+
let u, h = !1;
|
|
1403
|
+
const m = {
|
|
1404
1404
|
"Content-Type": "application/json",
|
|
1405
|
-
...
|
|
1405
|
+
...o
|
|
1406
1406
|
};
|
|
1407
|
-
e && (
|
|
1408
|
-
const
|
|
1409
|
-
return s &&
|
|
1410
|
-
method:
|
|
1411
|
-
headers:
|
|
1412
|
-
body:
|
|
1413
|
-
signal:
|
|
1407
|
+
e && (m["X-API-KEY"] = e);
|
|
1408
|
+
const b = new URL(t);
|
|
1409
|
+
return s && b.searchParams.set("is_debug", "true"), tn(b.toString(), {
|
|
1410
|
+
method: i,
|
|
1411
|
+
headers: m,
|
|
1412
|
+
body: i === "POST" && r ? JSON.stringify(r) : void 0,
|
|
1413
|
+
signal: c.signal,
|
|
1414
1414
|
/**
|
|
1415
1415
|
* Allow SSE to work when the page is hidden.
|
|
1416
1416
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
@@ -1418,7 +1418,7 @@ function pe(n) {
|
|
|
1418
1418
|
openWhenHidden: !0,
|
|
1419
1419
|
onopen: async (l) => {
|
|
1420
1420
|
if (l.ok)
|
|
1421
|
-
|
|
1421
|
+
u = l.headers.get("X-Trace-Id") ?? void 0;
|
|
1422
1422
|
else {
|
|
1423
1423
|
let f;
|
|
1424
1424
|
try {
|
|
@@ -1430,27 +1430,27 @@ function pe(n) {
|
|
|
1430
1430
|
f = null;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
a.error(new
|
|
1433
|
+
a.error(new I(l.status, l.statusText, f)), c.abort();
|
|
1434
1434
|
}
|
|
1435
1435
|
},
|
|
1436
1436
|
onmessage: (l) => {
|
|
1437
1437
|
l.id && (h = !0);
|
|
1438
1438
|
const f = JSON.parse(l.data);
|
|
1439
|
-
|
|
1439
|
+
u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = f.requestId)), a.next(f);
|
|
1440
1440
|
},
|
|
1441
1441
|
onclose: () => {
|
|
1442
1442
|
a.complete();
|
|
1443
1443
|
},
|
|
1444
1444
|
onerror: (l) => {
|
|
1445
1445
|
if (!h)
|
|
1446
|
-
throw a.error(l),
|
|
1446
|
+
throw a.error(l), c.abort(), l;
|
|
1447
1447
|
}
|
|
1448
1448
|
}), () => {
|
|
1449
|
-
|
|
1449
|
+
c.abort();
|
|
1450
1450
|
};
|
|
1451
1451
|
});
|
|
1452
1452
|
}
|
|
1453
|
-
class
|
|
1453
|
+
class rn {
|
|
1454
1454
|
listeners = {};
|
|
1455
1455
|
on(t, e) {
|
|
1456
1456
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1469,7 +1469,7 @@ class nn {
|
|
|
1469
1469
|
this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
class
|
|
1472
|
+
class xn {
|
|
1473
1473
|
apiKey;
|
|
1474
1474
|
endpoint;
|
|
1475
1475
|
botProviderEndpoint;
|
|
@@ -1479,7 +1479,7 @@ class Tn {
|
|
|
1479
1479
|
detached = !1;
|
|
1480
1480
|
detachTimer;
|
|
1481
1481
|
inFlight = 0;
|
|
1482
|
-
sseEmitter = new
|
|
1482
|
+
sseEmitter = new rn();
|
|
1483
1483
|
transformSsePayload;
|
|
1484
1484
|
customHeaders;
|
|
1485
1485
|
constructor(t) {
|
|
@@ -1579,17 +1579,26 @@ class Tn {
|
|
|
1579
1579
|
r.searchParams.set("custom_channel_id", t);
|
|
1580
1580
|
const s = { ...this.customHeaders };
|
|
1581
1581
|
this.apiKey && (s["X-API-KEY"] = this.apiKey);
|
|
1582
|
-
const
|
|
1583
|
-
if (
|
|
1582
|
+
const o = await fetch(r.toString(), { method: "GET", headers: s });
|
|
1583
|
+
if (o.status === 404)
|
|
1584
1584
|
return null;
|
|
1585
|
-
if (!
|
|
1586
|
-
throw new
|
|
1585
|
+
if (!o.ok)
|
|
1586
|
+
throw new I(o.status, o.statusText, await o.text().catch(() => {
|
|
1587
1587
|
}));
|
|
1588
|
-
const
|
|
1588
|
+
const i = await o.json(), a = i.data ?? i;
|
|
1589
1589
|
return {
|
|
1590
1590
|
title: a.title ?? null,
|
|
1591
1591
|
runState: a.runState ?? "IDLE",
|
|
1592
|
-
lastActivityAt: a.lastActivityAt
|
|
1592
|
+
lastActivityAt: a.lastActivityAt,
|
|
1593
|
+
// F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
|
|
1594
|
+
// backend / a channel with none live. metadata is the sole authority on "who is live".
|
|
1595
|
+
launchedSandboxes: (a.launchedSandboxes ?? []).map((c) => ({
|
|
1596
|
+
sandboxName: c.sandboxName,
|
|
1597
|
+
sandboxBlueprintName: c.sandboxBlueprintName,
|
|
1598
|
+
workingDirectory: c.workingDirectory,
|
|
1599
|
+
editorServerEnabled: c.editorServerEnabled,
|
|
1600
|
+
browserEnabled: c.browserEnabled
|
|
1601
|
+
}))
|
|
1593
1602
|
};
|
|
1594
1603
|
}
|
|
1595
1604
|
runSse(t, e) {
|
|
@@ -1597,11 +1606,11 @@ class Tn {
|
|
|
1597
1606
|
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
1598
1607
|
// run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
|
|
1599
1608
|
// create-sse-observable); a no-cursor failure surfaces via `error` below.
|
|
1600
|
-
|
|
1609
|
+
Ft((r) => xt(r).pipe(qt(e?.delayTime ?? 50))),
|
|
1601
1610
|
Vt(this.destroy$),
|
|
1602
1611
|
// Settle the run accounting on every termination path — complete, error, AND a user-initiated
|
|
1603
1612
|
// unsubscribe (stop-generation aborts the connection without a terminal event).
|
|
1604
|
-
|
|
1613
|
+
Xt(() => this.onRunSettled())
|
|
1605
1614
|
).subscribe({
|
|
1606
1615
|
next: (r) => {
|
|
1607
1616
|
this.detached || (e?.onSseMessage?.(r), this.handleEvent(r));
|
|
@@ -1653,22 +1662,22 @@ class Tn {
|
|
|
1653
1662
|
throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
|
|
1654
1663
|
const s = new FormData();
|
|
1655
1664
|
s.append("file", t), s.append("customChannelId", e);
|
|
1656
|
-
const
|
|
1665
|
+
const o = {
|
|
1657
1666
|
...this.customHeaders
|
|
1658
1667
|
};
|
|
1659
|
-
this.apiKey && (
|
|
1668
|
+
this.apiKey && (o["X-API-KEY"] = this.apiKey);
|
|
1660
1669
|
try {
|
|
1661
|
-
const
|
|
1670
|
+
const i = await fetch(r, {
|
|
1662
1671
|
method: "POST",
|
|
1663
|
-
headers:
|
|
1672
|
+
headers: o,
|
|
1664
1673
|
body: s
|
|
1665
1674
|
});
|
|
1666
|
-
if (!
|
|
1667
|
-
throw new Error(`Upload failed: ${
|
|
1668
|
-
const a = await
|
|
1675
|
+
if (!i.ok)
|
|
1676
|
+
throw new Error(`Upload failed: ${i.status} ${i.statusText}`);
|
|
1677
|
+
const a = await i.json();
|
|
1669
1678
|
return this.debugMode && console.log("[AsgardServiceClient] File upload response:", a), a;
|
|
1670
|
-
} catch (
|
|
1671
|
-
throw console.error("[AsgardServiceClient] File upload error:",
|
|
1679
|
+
} catch (i) {
|
|
1680
|
+
throw console.error("[AsgardServiceClient] File upload error:", i), i;
|
|
1672
1681
|
}
|
|
1673
1682
|
}
|
|
1674
1683
|
/**
|
|
@@ -1679,23 +1688,159 @@ class Tn {
|
|
|
1679
1688
|
const r = this.getBaseEndpoint();
|
|
1680
1689
|
if (!r)
|
|
1681
1690
|
throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
|
|
1682
|
-
const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`,
|
|
1691
|
+
const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${r}/channel-home/download?${s}`, i = {
|
|
1683
1692
|
...this.customHeaders
|
|
1684
1693
|
};
|
|
1685
|
-
this.apiKey && (
|
|
1694
|
+
this.apiKey && (i["X-API-KEY"] = this.apiKey);
|
|
1686
1695
|
try {
|
|
1687
|
-
const a = await fetch(
|
|
1696
|
+
const a = await fetch(o, {
|
|
1688
1697
|
method: "GET",
|
|
1689
|
-
headers:
|
|
1698
|
+
headers: i
|
|
1690
1699
|
});
|
|
1691
1700
|
if (!a.ok)
|
|
1692
1701
|
throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
|
|
1693
|
-
const
|
|
1694
|
-
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename:
|
|
1702
|
+
const c = await a.blob(), u = t.split("/").pop() || "download";
|
|
1703
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: u, size: c.size }), { blob: c, filename: u };
|
|
1695
1704
|
} catch (a) {
|
|
1696
1705
|
throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
|
|
1697
1706
|
}
|
|
1698
1707
|
}
|
|
1708
|
+
/**
|
|
1709
|
+
* F-020 — 取得 sandbox 瀏覽器一次性接手 URL(`sandbox://<name>/open-browser` 卡的副作用)。
|
|
1710
|
+
* 呼叫 `POST {base}/sandbox/{sandboxName}/browser/open-url`(對標 asgard-core edgeserver
|
|
1711
|
+
* `GenerateSandboxBrowserOpenUrl`:path 參數 namespace / bot-provider 已在 base、sandbox_name 在路徑,
|
|
1712
|
+
* 不需 custom_channel_id)。回應 `{ data: { openURL } }`(envelope 容錯,比照 `channelMetadata`)。
|
|
1713
|
+
*/
|
|
1714
|
+
async generateSandboxBrowserOpenUrl(t) {
|
|
1715
|
+
const e = this.getBaseEndpoint();
|
|
1716
|
+
if (!e)
|
|
1717
|
+
throw new Error(
|
|
1718
|
+
"Unable to derive sandbox browser open-url endpoint. Please provide botProviderEndpoint in config."
|
|
1719
|
+
);
|
|
1720
|
+
const r = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, s = { ...this.customHeaders };
|
|
1721
|
+
this.apiKey && (s["X-API-KEY"] = this.apiKey);
|
|
1722
|
+
const o = await fetch(r, { method: "POST", headers: s });
|
|
1723
|
+
if (!o.ok)
|
|
1724
|
+
throw new I(o.status, o.statusText, await o.text().catch(() => {
|
|
1725
|
+
}));
|
|
1726
|
+
const i = await o.json(), a = i.data?.openURL ?? i.openURL;
|
|
1727
|
+
if (!a)
|
|
1728
|
+
throw new Error("Sandbox browser open-url response did not contain an openURL.");
|
|
1729
|
+
return a;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* F-021 — 衍生 sandbox fs 端點 base:`{base}/sandbox/{sandboxName}/fs`(namespace / bot-provider 已在 base)。
|
|
1733
|
+
*/
|
|
1734
|
+
deriveSandboxFsEndpoint(t) {
|
|
1735
|
+
const e = this.getBaseEndpoint();
|
|
1736
|
+
if (!e)
|
|
1737
|
+
throw new Error("Unable to derive sandbox fs endpoint. Please provide botProviderEndpoint in config.");
|
|
1738
|
+
return `${e}/sandbox/${encodeURIComponent(t)}/fs`;
|
|
1739
|
+
}
|
|
1740
|
+
sandboxFsHeaders() {
|
|
1741
|
+
const t = { ...this.customHeaders };
|
|
1742
|
+
return this.apiKey && (t["X-API-KEY"] = this.apiKey), t;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* F-021 — 列出 sandbox 目錄內容(`GET fs/list?path=`)。回應 `{ data: { entries, truncated } }`(envelope
|
|
1746
|
+
* 容錯,比照 `channelMetadata`)。
|
|
1747
|
+
*/
|
|
1748
|
+
async sandboxFsList(t, e) {
|
|
1749
|
+
const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/list`);
|
|
1750
|
+
r.searchParams.set("path", e);
|
|
1751
|
+
const s = await fetch(r.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
|
|
1752
|
+
if (!s.ok)
|
|
1753
|
+
throw new I(s.status, s.statusText, await s.text().catch(() => {
|
|
1754
|
+
}));
|
|
1755
|
+
const o = await s.json(), i = o.data ?? o;
|
|
1756
|
+
return { entries: i.entries ?? [], truncated: i.truncated ?? !1 };
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* F-021 — 讀取 sandbox 檔案(`GET fs/file?path=[&offset_bytes&limit_bytes]`)。回應是 raw octet-stream,
|
|
1760
|
+
* 檔案總長度 / 是否截斷走 `X-Total-Bytes` / `X-Truncated` header。
|
|
1761
|
+
*/
|
|
1762
|
+
async sandboxFsRead(t, e, r) {
|
|
1763
|
+
const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1764
|
+
s.searchParams.set("path", e), r?.offsetBytes != null && s.searchParams.set("offset_bytes", String(r.offsetBytes)), r?.limitBytes != null && s.searchParams.set("limit_bytes", String(r.limitBytes));
|
|
1765
|
+
const o = await fetch(s.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
|
|
1766
|
+
if (!o.ok)
|
|
1767
|
+
throw new I(o.status, o.statusText, await o.text().catch(() => {
|
|
1768
|
+
}));
|
|
1769
|
+
const i = await o.blob(), a = o.headers.get("X-Total-Bytes");
|
|
1770
|
+
return {
|
|
1771
|
+
content: i,
|
|
1772
|
+
totalBytes: a != null ? Number(a) : i.size,
|
|
1773
|
+
truncated: o.headers.get("X-Truncated") === "true"
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* F-021 — 寫入 sandbox 檔案(`PUT fs/file?path=[&mode&create_only]`,`multipart/form-data` 帶 `file`)。
|
|
1778
|
+
* 回應 `{ data: { bytesWritten } }`。
|
|
1779
|
+
*/
|
|
1780
|
+
async sandboxFsWrite(t, e, r, s) {
|
|
1781
|
+
const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1782
|
+
o.searchParams.set("path", e), s?.mode != null && o.searchParams.set("mode", String(s.mode)), s?.createOnly && o.searchParams.set("create_only", "true");
|
|
1783
|
+
const i = new FormData();
|
|
1784
|
+
i.append("file", r instanceof Blob ? r : new Blob([r]));
|
|
1785
|
+
const a = await fetch(o.toString(), { method: "PUT", headers: this.sandboxFsHeaders(), body: i });
|
|
1786
|
+
if (!a.ok)
|
|
1787
|
+
throw new I(a.status, a.statusText, await a.text().catch(() => {
|
|
1788
|
+
}));
|
|
1789
|
+
const c = await a.json();
|
|
1790
|
+
return { bytesWritten: (c.data ?? c).bytesWritten ?? 0 };
|
|
1791
|
+
}
|
|
1792
|
+
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1793
|
+
async sandboxFsRequest(t, e, r, s) {
|
|
1794
|
+
const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1795
|
+
Object.entries(s).forEach(([a, c]) => o.searchParams.set(a, c));
|
|
1796
|
+
const i = await fetch(o.toString(), { method: r, headers: this.sandboxFsHeaders() });
|
|
1797
|
+
if (!i.ok)
|
|
1798
|
+
throw new I(i.status, i.statusText, await i.text().catch(() => {
|
|
1799
|
+
}));
|
|
1800
|
+
return i.json().catch(() => null);
|
|
1801
|
+
}
|
|
1802
|
+
/** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
|
|
1803
|
+
async sandboxFsStat(t, e) {
|
|
1804
|
+
const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/stat`);
|
|
1805
|
+
r.searchParams.set("path", e);
|
|
1806
|
+
const s = await fetch(r.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
|
|
1807
|
+
if (!s.ok)
|
|
1808
|
+
throw new I(s.status, s.statusText, await s.text().catch(() => {
|
|
1809
|
+
}));
|
|
1810
|
+
const o = await s.json(), i = o.data ?? o;
|
|
1811
|
+
return {
|
|
1812
|
+
exists: i.exists ?? !1,
|
|
1813
|
+
isDir: i.isDir ?? !1,
|
|
1814
|
+
sizeBytes: i.sizeBytes ?? 0,
|
|
1815
|
+
mtimeUnix: i.mtimeUnix ?? 0,
|
|
1816
|
+
mode: i.mode ?? 0,
|
|
1817
|
+
etag: i.etag
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
/** F-021 — create a directory (`POST fs/mkdir?path=`). */
|
|
1821
|
+
async sandboxFsMkdir(t, e) {
|
|
1822
|
+
await this.sandboxFsRequest(t, "mkdir", "POST", { path: e });
|
|
1823
|
+
}
|
|
1824
|
+
/** F-021 — delete a file (`DELETE fs/item?path=`). */
|
|
1825
|
+
async sandboxFsRemove(t, e) {
|
|
1826
|
+
await this.sandboxFsRequest(t, "item", "DELETE", { path: e });
|
|
1827
|
+
}
|
|
1828
|
+
/** F-021 — recursively delete a directory (`DELETE fs/all?path=`). */
|
|
1829
|
+
async sandboxFsRemoveAll(t, e) {
|
|
1830
|
+
await this.sandboxFsRequest(t, "all", "DELETE", { path: e });
|
|
1831
|
+
}
|
|
1832
|
+
/** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
|
|
1833
|
+
async sandboxFsCopy(t, e, r, s) {
|
|
1834
|
+
const o = { src: e, dst: r };
|
|
1835
|
+
s?.overwrite && (o.overwrite = "true");
|
|
1836
|
+
const i = await this.sandboxFsRequest(t, "copy", "POST", o);
|
|
1837
|
+
return { bytesCopied: (i?.data ?? i)?.bytesCopied ?? 0 };
|
|
1838
|
+
}
|
|
1839
|
+
/** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
|
|
1840
|
+
async sandboxFsMove(t, e, r, s) {
|
|
1841
|
+
const o = { src: e, dst: r };
|
|
1842
|
+
s?.overwrite && (o.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", o);
|
|
1843
|
+
}
|
|
1699
1844
|
/**
|
|
1700
1845
|
* 從 botProviderEndpoint 衍生 Blob API endpoint
|
|
1701
1846
|
*/
|
|
@@ -1712,34 +1857,34 @@ class Tn {
|
|
|
1712
1857
|
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1713
1858
|
}
|
|
1714
1859
|
}
|
|
1715
|
-
const
|
|
1860
|
+
const y = [];
|
|
1716
1861
|
for (let n = 0; n < 256; ++n)
|
|
1717
|
-
|
|
1718
|
-
function
|
|
1719
|
-
return (
|
|
1720
|
-
}
|
|
1721
|
-
let
|
|
1722
|
-
const
|
|
1723
|
-
function
|
|
1724
|
-
if (!
|
|
1862
|
+
y.push((n + 256).toString(16).slice(1));
|
|
1863
|
+
function sn(n, t = 0) {
|
|
1864
|
+
return (y[n[t + 0]] + y[n[t + 1]] + y[n[t + 2]] + y[n[t + 3]] + "-" + y[n[t + 4]] + y[n[t + 5]] + "-" + y[n[t + 6]] + y[n[t + 7]] + "-" + y[n[t + 8]] + y[n[t + 9]] + "-" + y[n[t + 10]] + y[n[t + 11]] + y[n[t + 12]] + y[n[t + 13]] + y[n[t + 14]] + y[n[t + 15]]).toLowerCase();
|
|
1865
|
+
}
|
|
1866
|
+
let J;
|
|
1867
|
+
const on = new Uint8Array(16);
|
|
1868
|
+
function an() {
|
|
1869
|
+
if (!J) {
|
|
1725
1870
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1726
1871
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1727
|
-
|
|
1872
|
+
J = crypto.getRandomValues.bind(crypto);
|
|
1728
1873
|
}
|
|
1729
|
-
return
|
|
1874
|
+
return J(on);
|
|
1730
1875
|
}
|
|
1731
|
-
const
|
|
1732
|
-
function
|
|
1876
|
+
const cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), me = { randomUUID: cn };
|
|
1877
|
+
function un(n, t, e) {
|
|
1733
1878
|
n = n || {};
|
|
1734
|
-
const r = n.random ?? n.rng?.() ??
|
|
1879
|
+
const r = n.random ?? n.rng?.() ?? an();
|
|
1735
1880
|
if (r.length < 16)
|
|
1736
1881
|
throw new Error("Random bytes length must be >= 16");
|
|
1737
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1882
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, sn(r);
|
|
1738
1883
|
}
|
|
1739
|
-
function
|
|
1740
|
-
return
|
|
1884
|
+
function He(n, t, e) {
|
|
1885
|
+
return me.randomUUID && !n ? me.randomUUID() : un(n);
|
|
1741
1886
|
}
|
|
1742
|
-
class
|
|
1887
|
+
class v {
|
|
1743
1888
|
messages = null;
|
|
1744
1889
|
pendingConsent = null;
|
|
1745
1890
|
constructor({ messages: t, pendingConsent: e = null }) {
|
|
@@ -1747,10 +1892,10 @@ class y {
|
|
|
1747
1892
|
}
|
|
1748
1893
|
pushMessage(t) {
|
|
1749
1894
|
const e = new Map(this.messages);
|
|
1750
|
-
return e.set(t.messageId, t), new
|
|
1895
|
+
return e.set(t.messageId, t), new v({ messages: e, pendingConsent: this.pendingConsent });
|
|
1751
1896
|
}
|
|
1752
1897
|
clearPendingConsent() {
|
|
1753
|
-
return this.pendingConsent ? new
|
|
1898
|
+
return this.pendingConsent ? new v({ messages: this.messages, pendingConsent: null }) : this;
|
|
1754
1899
|
}
|
|
1755
1900
|
/**
|
|
1756
1901
|
* Converge every still-running tool-call to `cancelled` (F-020 AC10). Called when a user-initiated
|
|
@@ -1765,7 +1910,7 @@ class y {
|
|
|
1765
1910
|
const e = new Map(this.messages);
|
|
1766
1911
|
for (const [r, s] of e)
|
|
1767
1912
|
s.type === "tool-call" && !s.isComplete && (e.set(r, { ...s, isComplete: !0, isCancelled: !0 }), t = !0);
|
|
1768
|
-
return t ? new
|
|
1913
|
+
return t ? new v({ messages: e, pendingConsent: this.pendingConsent }) : this;
|
|
1769
1914
|
}
|
|
1770
1915
|
onMessage(t) {
|
|
1771
1916
|
switch (t.eventType) {
|
|
@@ -1830,15 +1975,15 @@ class y {
|
|
|
1830
1975
|
time: /* @__PURE__ */ new Date(),
|
|
1831
1976
|
traceId: t.traceId,
|
|
1832
1977
|
raw: ""
|
|
1833
|
-
}), new
|
|
1978
|
+
}), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1834
1979
|
}
|
|
1835
1980
|
onMessageDelta(t) {
|
|
1836
1981
|
const e = t.fact.messageDelta.message;
|
|
1837
1982
|
if (e.parentToolUseId) return this;
|
|
1838
1983
|
const r = this.messages?.get(e.messageId);
|
|
1839
1984
|
if (this.isTerminalBot(r)) return this;
|
|
1840
|
-
const s = r?.type === "bot" ? r : void 0,
|
|
1841
|
-
return
|
|
1985
|
+
const s = r?.type === "bot" ? r : void 0, o = new Map(this.messages);
|
|
1986
|
+
return o.set(e.messageId, {
|
|
1842
1987
|
type: "bot",
|
|
1843
1988
|
eventType: d.MESSAGE_DELTA,
|
|
1844
1989
|
isTyping: !0,
|
|
@@ -1848,7 +1993,7 @@ class y {
|
|
|
1848
1993
|
time: /* @__PURE__ */ new Date(),
|
|
1849
1994
|
traceId: t.traceId ?? s?.traceId,
|
|
1850
1995
|
raw: s?.raw ?? ""
|
|
1851
|
-
}), new
|
|
1996
|
+
}), new v({ messages: o, pendingConsent: this.pendingConsent });
|
|
1852
1997
|
}
|
|
1853
1998
|
onMessageComplete(t) {
|
|
1854
1999
|
const e = t.fact.messageComplete.message;
|
|
@@ -1864,7 +2009,7 @@ class y {
|
|
|
1864
2009
|
time: /* @__PURE__ */ new Date(),
|
|
1865
2010
|
traceId: t.traceId ?? (s?.type === "bot" ? s.traceId : void 0),
|
|
1866
2011
|
raw: JSON.stringify(t)
|
|
1867
|
-
}), new
|
|
2012
|
+
}), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1868
2013
|
}
|
|
1869
2014
|
onThinkingStart(t) {
|
|
1870
2015
|
const e = t.fact.messageThinkingStart.message;
|
|
@@ -1878,14 +2023,14 @@ class y {
|
|
|
1878
2023
|
time: /* @__PURE__ */ new Date(),
|
|
1879
2024
|
traceId: t.traceId
|
|
1880
2025
|
};
|
|
1881
|
-
return r.set(e.messageId, s), new
|
|
2026
|
+
return r.set(e.messageId, s), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1882
2027
|
}
|
|
1883
2028
|
onThinkingDelta(t) {
|
|
1884
2029
|
const e = t.fact.messageThinkingDelta.message;
|
|
1885
2030
|
if (e.parentToolUseId) return this;
|
|
1886
2031
|
const r = this.messages?.get(e.messageId);
|
|
1887
2032
|
if (this.isTerminalThinking(r)) return this;
|
|
1888
|
-
const s = r?.type === "thinking" ? r : void 0,
|
|
2033
|
+
const s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
|
|
1889
2034
|
type: "thinking",
|
|
1890
2035
|
messageId: e.messageId,
|
|
1891
2036
|
text: `${s?.text ?? ""}${e.text}`,
|
|
@@ -1893,12 +2038,12 @@ class y {
|
|
|
1893
2038
|
time: s?.time ?? /* @__PURE__ */ new Date(),
|
|
1894
2039
|
traceId: t.traceId ?? s?.traceId
|
|
1895
2040
|
};
|
|
1896
|
-
return
|
|
2041
|
+
return o.set(e.messageId, i), new v({ messages: o, pendingConsent: this.pendingConsent });
|
|
1897
2042
|
}
|
|
1898
2043
|
onThinkingComplete(t) {
|
|
1899
2044
|
const e = t.fact.messageThinkingComplete.message;
|
|
1900
2045
|
if (e.parentToolUseId) return this;
|
|
1901
|
-
const r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0,
|
|
2046
|
+
const r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
|
|
1902
2047
|
type: "thinking",
|
|
1903
2048
|
messageId: e.messageId,
|
|
1904
2049
|
// Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
|
|
@@ -1908,12 +2053,12 @@ class y {
|
|
|
1908
2053
|
time: s?.time ?? /* @__PURE__ */ new Date(),
|
|
1909
2054
|
traceId: t.traceId ?? s?.traceId
|
|
1910
2055
|
};
|
|
1911
|
-
return
|
|
2056
|
+
return o.set(e.messageId, i), new v({ messages: o, pendingConsent: this.pendingConsent });
|
|
1912
2057
|
}
|
|
1913
2058
|
onMessageUser(t) {
|
|
1914
2059
|
const e = t.fact.messageUser;
|
|
1915
2060
|
if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
|
|
1916
|
-
const s = new Map(this.messages),
|
|
2061
|
+
const s = new Map(this.messages), o = {
|
|
1917
2062
|
type: "user",
|
|
1918
2063
|
messageId: e.messageId,
|
|
1919
2064
|
text: e.text,
|
|
@@ -1923,10 +2068,10 @@ class y {
|
|
|
1923
2068
|
time: /* @__PURE__ */ new Date(),
|
|
1924
2069
|
traceId: t.traceId
|
|
1925
2070
|
};
|
|
1926
|
-
return s.set(e.messageId,
|
|
2071
|
+
return s.set(e.messageId, o), new v({ messages: s, pendingConsent: this.pendingConsent });
|
|
1927
2072
|
}
|
|
1928
2073
|
onMessageError(t) {
|
|
1929
|
-
const e =
|
|
2074
|
+
const e = He(), r = t.fact.runError.error, s = new Map(this.messages);
|
|
1930
2075
|
return s.set(e, {
|
|
1931
2076
|
type: "error",
|
|
1932
2077
|
eventType: d.ERROR,
|
|
@@ -1934,10 +2079,10 @@ class y {
|
|
|
1934
2079
|
error: r,
|
|
1935
2080
|
time: /* @__PURE__ */ new Date(),
|
|
1936
2081
|
traceId: t.traceId
|
|
1937
|
-
}), new
|
|
2082
|
+
}), new v({ messages: s, pendingConsent: this.pendingConsent });
|
|
1938
2083
|
}
|
|
1939
2084
|
onToolCallStart(t) {
|
|
1940
|
-
const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`,
|
|
2085
|
+
const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = {
|
|
1941
2086
|
type: "tool-call",
|
|
1942
2087
|
eventType: d.TOOL_CALL_START,
|
|
1943
2088
|
messageId: s,
|
|
@@ -1953,30 +2098,30 @@ class y {
|
|
|
1953
2098
|
time: /* @__PURE__ */ new Date(),
|
|
1954
2099
|
traceId: t.traceId
|
|
1955
2100
|
};
|
|
1956
|
-
return r.set(s,
|
|
2101
|
+
return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1957
2102
|
}
|
|
1958
2103
|
onToolCallComplete(t) {
|
|
1959
|
-
const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`,
|
|
1960
|
-
if (
|
|
1961
|
-
const
|
|
1962
|
-
...
|
|
2104
|
+
const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = r.get(s);
|
|
2105
|
+
if (o?.type === "tool-call") {
|
|
2106
|
+
const i = {
|
|
2107
|
+
...o,
|
|
1963
2108
|
eventType: d.TOOL_CALL_COMPLETE,
|
|
1964
2109
|
result: e.toolCallResult,
|
|
1965
2110
|
isError: e.isError,
|
|
1966
2111
|
sidecar: e.toolUseResultSidecar,
|
|
1967
2112
|
isComplete: !0,
|
|
1968
|
-
traceId: t.traceId ??
|
|
2113
|
+
traceId: t.traceId ?? o.traceId
|
|
1969
2114
|
};
|
|
1970
|
-
r.set(s,
|
|
2115
|
+
r.set(s, i);
|
|
1971
2116
|
}
|
|
1972
|
-
return new
|
|
2117
|
+
return new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1973
2118
|
}
|
|
1974
2119
|
onToolCallConsent(t) {
|
|
1975
2120
|
const e = t.fact.toolCallConsent;
|
|
1976
|
-
return new
|
|
2121
|
+
return new v({ messages: this.messages, pendingConsent: e });
|
|
1977
2122
|
}
|
|
1978
2123
|
onSubagentStart(t) {
|
|
1979
|
-
const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`,
|
|
2124
|
+
const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`, o = {
|
|
1980
2125
|
type: "subagent",
|
|
1981
2126
|
messageId: s,
|
|
1982
2127
|
kind: "start",
|
|
@@ -1987,10 +2132,10 @@ class y {
|
|
|
1987
2132
|
time: /* @__PURE__ */ new Date(),
|
|
1988
2133
|
traceId: t.traceId
|
|
1989
2134
|
};
|
|
1990
|
-
return r.set(s,
|
|
2135
|
+
return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
1991
2136
|
}
|
|
1992
2137
|
onSubagentComplete(t) {
|
|
1993
|
-
const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`,
|
|
2138
|
+
const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`, o = {
|
|
1994
2139
|
type: "subagent",
|
|
1995
2140
|
messageId: s,
|
|
1996
2141
|
kind: "complete",
|
|
@@ -2002,97 +2147,97 @@ class y {
|
|
|
2002
2147
|
time: /* @__PURE__ */ new Date(),
|
|
2003
2148
|
traceId: t.traceId
|
|
2004
2149
|
};
|
|
2005
|
-
return r.set(s,
|
|
2150
|
+
return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
|
|
2006
2151
|
}
|
|
2007
2152
|
}
|
|
2008
|
-
const
|
|
2009
|
-
function
|
|
2010
|
-
return n.toolsetName === "" &&
|
|
2153
|
+
const ln = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
2154
|
+
function dn(n) {
|
|
2155
|
+
return n.toolsetName === "" && ln.has(n.toolName);
|
|
2011
2156
|
}
|
|
2012
|
-
function
|
|
2157
|
+
function ge(n) {
|
|
2013
2158
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2014
2159
|
}
|
|
2015
2160
|
function E(n) {
|
|
2016
2161
|
return typeof n == "string" ? n : void 0;
|
|
2017
2162
|
}
|
|
2018
|
-
function
|
|
2163
|
+
function hn(n) {
|
|
2019
2164
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
2020
2165
|
for (const r of n) {
|
|
2021
|
-
const s = r.parameter ?? {},
|
|
2166
|
+
const s = r.parameter ?? {}, o = r.sidecar ?? {};
|
|
2022
2167
|
if (r.toolName === "TaskCreate") {
|
|
2023
|
-
const
|
|
2168
|
+
const i = ge(o.task), a = E(i?.id);
|
|
2024
2169
|
if (!a) continue;
|
|
2025
2170
|
e.has(a) || t.push(a), e.set(a, {
|
|
2026
2171
|
id: a,
|
|
2027
|
-
subject: E(s.subject) || E(
|
|
2172
|
+
subject: E(s.subject) || E(i?.subject) || "",
|
|
2028
2173
|
activeForm: E(s.activeForm),
|
|
2029
2174
|
description: E(s.description),
|
|
2030
2175
|
status: e.get(a)?.status ?? "pending"
|
|
2031
2176
|
// initial status = pending (keep existing on repeat)
|
|
2032
2177
|
});
|
|
2033
2178
|
} else if (r.toolName === "TaskUpdate") {
|
|
2034
|
-
const
|
|
2035
|
-
if (!a || !
|
|
2036
|
-
const
|
|
2037
|
-
|
|
2179
|
+
const i = ge(o.statusChange), a = E(s.taskId) || E(o.taskId), c = E(i?.to) || E(s.status);
|
|
2180
|
+
if (!a || !c) continue;
|
|
2181
|
+
const u = e.get(a);
|
|
2182
|
+
u && e.set(a, { ...u, status: c });
|
|
2038
2183
|
}
|
|
2039
2184
|
}
|
|
2040
2185
|
return t.map((r) => e.get(r));
|
|
2041
2186
|
}
|
|
2042
|
-
function
|
|
2187
|
+
function fn(n) {
|
|
2043
2188
|
return n.toolsetName === "" && n.toolName === "Agent";
|
|
2044
2189
|
}
|
|
2045
|
-
function
|
|
2190
|
+
function pn(n) {
|
|
2046
2191
|
return !!n;
|
|
2047
2192
|
}
|
|
2048
|
-
function
|
|
2049
|
-
const t = [], e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = (
|
|
2050
|
-
for (const
|
|
2051
|
-
switch (
|
|
2193
|
+
function mn(n) {
|
|
2194
|
+
const t = [], e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = (o) => (e.has(o) || (t.push(o), e.set(o, { status: "running" }), r.set(o, /* @__PURE__ */ new Map())), e.get(o));
|
|
2195
|
+
for (const o of n)
|
|
2196
|
+
switch (o.kind) {
|
|
2052
2197
|
case "agentStart": {
|
|
2053
|
-
const
|
|
2054
|
-
|
|
2198
|
+
const i = s(o.toolUseId);
|
|
2199
|
+
o.description && !i.description && (i.description = o.description);
|
|
2055
2200
|
break;
|
|
2056
2201
|
}
|
|
2057
2202
|
case "subagentStart": {
|
|
2058
|
-
const
|
|
2059
|
-
|
|
2203
|
+
const i = s(o.parentToolUseId);
|
|
2204
|
+
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description;
|
|
2060
2205
|
break;
|
|
2061
2206
|
}
|
|
2062
2207
|
case "toolStart": {
|
|
2063
|
-
s(
|
|
2064
|
-
toolsetName:
|
|
2065
|
-
toolName:
|
|
2066
|
-
parameter:
|
|
2067
|
-
reason:
|
|
2208
|
+
s(o.parentToolUseId), r.get(o.parentToolUseId).set(o.toolUseId, {
|
|
2209
|
+
toolsetName: o.toolsetName,
|
|
2210
|
+
toolName: o.toolName,
|
|
2211
|
+
parameter: o.parameter ?? {},
|
|
2212
|
+
reason: o.reason,
|
|
2068
2213
|
status: "running"
|
|
2069
2214
|
});
|
|
2070
2215
|
break;
|
|
2071
2216
|
}
|
|
2072
2217
|
case "toolComplete": {
|
|
2073
|
-
const
|
|
2074
|
-
|
|
2218
|
+
const i = r.get(o.parentToolUseId)?.get(o.toolUseId);
|
|
2219
|
+
i && (i.status = o.isError ? "error" : "completed");
|
|
2075
2220
|
break;
|
|
2076
2221
|
}
|
|
2077
2222
|
case "subagentComplete": {
|
|
2078
|
-
const
|
|
2079
|
-
|
|
2223
|
+
const i = s(o.parentToolUseId);
|
|
2224
|
+
i.status = o.status, i.summary = o.summary;
|
|
2080
2225
|
break;
|
|
2081
2226
|
}
|
|
2082
2227
|
}
|
|
2083
|
-
return t.map((
|
|
2084
|
-
parentToolUseId:
|
|
2085
|
-
...e.get(
|
|
2086
|
-
tools: Array.from(r.get(
|
|
2228
|
+
return t.map((o) => ({
|
|
2229
|
+
parentToolUseId: o,
|
|
2230
|
+
...e.get(o),
|
|
2231
|
+
tools: Array.from(r.get(o).values())
|
|
2087
2232
|
}));
|
|
2088
2233
|
}
|
|
2089
2234
|
function gn(n) {
|
|
2090
2235
|
return typeof n == "string" ? n : void 0;
|
|
2091
2236
|
}
|
|
2092
|
-
function
|
|
2237
|
+
function bn(n) {
|
|
2093
2238
|
const t = [];
|
|
2094
2239
|
for (const e of n) {
|
|
2095
|
-
if (e.type === "tool-call" &&
|
|
2240
|
+
if (e.type === "tool-call" && fn(e)) {
|
|
2096
2241
|
t.push({
|
|
2097
2242
|
kind: "agentStart",
|
|
2098
2243
|
toolUseId: e.toolUseId ?? e.messageId,
|
|
@@ -2100,7 +2245,7 @@ function mn(n) {
|
|
|
2100
2245
|
});
|
|
2101
2246
|
continue;
|
|
2102
2247
|
}
|
|
2103
|
-
if (e.type === "tool-call" &&
|
|
2248
|
+
if (e.type === "tool-call" && pn(e.parentToolUseId)) {
|
|
2104
2249
|
const r = e.toolUseId ?? e.messageId;
|
|
2105
2250
|
t.push({
|
|
2106
2251
|
kind: "toolStart",
|
|
@@ -2139,35 +2284,35 @@ function mn(n) {
|
|
|
2139
2284
|
}
|
|
2140
2285
|
function vn(n) {
|
|
2141
2286
|
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2142
|
-
(e) => e.type === "tool-call" && e.isComplete &&
|
|
2287
|
+
(e) => e.type === "tool-call" && e.isComplete && dn(e)
|
|
2143
2288
|
);
|
|
2144
|
-
return
|
|
2289
|
+
return hn(t);
|
|
2145
2290
|
}
|
|
2146
2291
|
function yn(n) {
|
|
2147
|
-
return
|
|
2292
|
+
return mn(bn(Array.from(n.messages?.values() ?? [])));
|
|
2148
2293
|
}
|
|
2149
|
-
function
|
|
2294
|
+
function Sn(n, t) {
|
|
2150
2295
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2151
2296
|
const s = t[r];
|
|
2152
2297
|
return e.id === s.id && e.status === s.status && e.subject === s.subject && e.activeForm === s.activeForm && e.description === s.description;
|
|
2153
2298
|
});
|
|
2154
2299
|
}
|
|
2155
|
-
function
|
|
2300
|
+
function wn(n, t) {
|
|
2156
2301
|
return n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2157
2302
|
const s = t[r];
|
|
2158
2303
|
return e.toolName === s.toolName && e.toolsetName === s.toolsetName && e.status === s.status && e.reason === s.reason;
|
|
2159
2304
|
});
|
|
2160
2305
|
}
|
|
2161
|
-
function
|
|
2306
|
+
function En(n, t) {
|
|
2162
2307
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
|
|
2163
2308
|
const s = t[r];
|
|
2164
|
-
return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary &&
|
|
2309
|
+
return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary && wn(e.tools, s.tools);
|
|
2165
2310
|
});
|
|
2166
2311
|
}
|
|
2167
|
-
function
|
|
2168
|
-
const t = new P([]), e = new P([]), r = new
|
|
2169
|
-
return r.add(n.pipe(
|
|
2170
|
-
n.pipe(
|
|
2312
|
+
function In(n) {
|
|
2313
|
+
const t = new P([]), e = new P([]), r = new R();
|
|
2314
|
+
return r.add(n.pipe(N(vn), j(Sn)).subscribe(t)), r.add(
|
|
2315
|
+
n.pipe(N(yn), j(En)).subscribe(e)
|
|
2171
2316
|
), {
|
|
2172
2317
|
tasks$: t.asObservable(),
|
|
2173
2318
|
subagents$: e.asObservable(),
|
|
@@ -2176,6 +2321,13 @@ function En(n) {
|
|
|
2176
2321
|
teardown: () => r.unsubscribe()
|
|
2177
2322
|
};
|
|
2178
2323
|
}
|
|
2324
|
+
function be(n) {
|
|
2325
|
+
const t = /* @__PURE__ */ new Map();
|
|
2326
|
+
for (const e of n) t.set(e.sandboxName, e);
|
|
2327
|
+
return [...t.values()].sort(
|
|
2328
|
+
(e, r) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(r.sandboxBlueprintName || r.sandboxName)
|
|
2329
|
+
);
|
|
2330
|
+
}
|
|
2179
2331
|
class K {
|
|
2180
2332
|
client;
|
|
2181
2333
|
customChannelId;
|
|
@@ -2184,6 +2336,10 @@ class K {
|
|
|
2184
2336
|
conversation$;
|
|
2185
2337
|
channelTitleSubject;
|
|
2186
2338
|
sandboxPhaseSubject;
|
|
2339
|
+
launchedSandboxesSubject;
|
|
2340
|
+
// Sandboxes hinted live by an `asgard.sandbox.launch` frame but not yet confirmed by metadata (F-019).
|
|
2341
|
+
// Never merged into the live list directly — cleared once metadata confirms (or held until it does).
|
|
2342
|
+
pendingLaunches = [];
|
|
2187
2343
|
derivedStores;
|
|
2188
2344
|
statesObserver;
|
|
2189
2345
|
statesSubscription;
|
|
@@ -2195,6 +2351,8 @@ class K {
|
|
|
2195
2351
|
channelTitle$;
|
|
2196
2352
|
/** Reactive sandbox cold-start phase store (F-018): per-slice, derived from the last sandbox event; replay-safe. */
|
|
2197
2353
|
sandboxPhase$;
|
|
2354
|
+
/** Reactive live-sandbox list store (F-019): authoritative from `/channel/metadata`, per-slice; replay-safe. */
|
|
2355
|
+
launchedSandboxes$;
|
|
2198
2356
|
currentUserMessageId;
|
|
2199
2357
|
// The most-recently-sent user message id. Unlike currentUserMessageId (which
|
|
2200
2358
|
// is cleared once a traceId is attached), this is kept across the SSE
|
|
@@ -2210,7 +2368,9 @@ class K {
|
|
|
2210
2368
|
throw new Error("client must be required");
|
|
2211
2369
|
if (!t.customChannelId)
|
|
2212
2370
|
throw new Error("customChannelId must be required");
|
|
2213
|
-
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new P(!1), this.conversation$ = new P(t.conversation), this.channelTitleSubject = new P(t.channelTitle ?? null), this.sandboxPhaseSubject = new P("idle"), this.
|
|
2371
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new P(!1), this.conversation$ = new P(t.conversation), this.channelTitleSubject = new P(t.channelTitle ?? null), this.sandboxPhaseSubject = new P("idle"), this.launchedSandboxesSubject = new P(
|
|
2372
|
+
be(t.launchedSandboxes ?? [])
|
|
2373
|
+
), this.derivedStores = In(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(j()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(j()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(j()), this.statesObserver = t.statesObserver;
|
|
2214
2374
|
}
|
|
2215
2375
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2216
2376
|
getTasks() {
|
|
@@ -2228,6 +2388,49 @@ class K {
|
|
|
2228
2388
|
getSandboxPhase() {
|
|
2229
2389
|
return this.sandboxPhaseSubject.value;
|
|
2230
2390
|
}
|
|
2391
|
+
/** Current live-sandbox snapshot (F-019) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2392
|
+
getLaunchedSandboxes() {
|
|
2393
|
+
return this.launchedSandboxesSubject.value;
|
|
2394
|
+
}
|
|
2395
|
+
/** Names hinted by `sandbox.launch` but not yet confirmed live by metadata (F-019) — "starting" placeholders. */
|
|
2396
|
+
getPendingLaunches() {
|
|
2397
|
+
return this.pendingLaunches;
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Authoritatively replace the live-sandbox list from a fresh `/channel/metadata` snapshot (F-019). This
|
|
2401
|
+
* is the only sanctioned way to change "who is live": it reconciles the list and clears any pending
|
|
2402
|
+
* launch whose name now appears (promoted to live). metadata (heartbeat-backed) is the sole authority.
|
|
2403
|
+
*/
|
|
2404
|
+
applyLaunchedSandboxes(t) {
|
|
2405
|
+
const e = be(t);
|
|
2406
|
+
this.pendingLaunches = this.pendingLaunches.filter((r) => !e.some((s) => s.sandboxName === r)), this.launchedSandboxesSubject.next(e);
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* Optimistically drop one sandbox (F-019) — e.g. its fs calls keep failing or it is known to be
|
|
2410
|
+
* recycled. The next `/channel/metadata` refetch reconciles the authoritative truth.
|
|
2411
|
+
*/
|
|
2412
|
+
dropSandbox(t) {
|
|
2413
|
+
const e = this.launchedSandboxesSubject.value, r = e.filter((s) => s.sandboxName !== t);
|
|
2414
|
+
r.length !== e.length && this.launchedSandboxesSubject.next(r);
|
|
2415
|
+
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Record an `asgard.sandbox.launch` hint (F-019): the event is not trusted to add a live sandbox (it may
|
|
2418
|
+
* not be Ready / heartbeat-visible yet), so the name is held as pending and a metadata refetch is
|
|
2419
|
+
* scheduled. `applyLaunchedSandboxes` promotes it to live once metadata confirms.
|
|
2420
|
+
*/
|
|
2421
|
+
noteSandboxLaunch(t) {
|
|
2422
|
+
this.pendingLaunches.includes(t) || (this.pendingLaunches = [...this.pendingLaunches, t]), this.refetchMetadata();
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Re-fetch `/channel/metadata` and authoritatively apply its `launchedSandboxes` (F-019). Called on a
|
|
2426
|
+
* launch hint, and by the react adapter on `visibilitychange` / polling. A client without metadata
|
|
2427
|
+
* support is a no-op.
|
|
2428
|
+
*/
|
|
2429
|
+
async refetchMetadata() {
|
|
2430
|
+
if (!this.client.channelMetadata) return;
|
|
2431
|
+
const t = await this.client.channelMetadata(this.customChannelId);
|
|
2432
|
+
t && this.applyLaunchedSandboxes(t.launchedSandboxes);
|
|
2433
|
+
}
|
|
2231
2434
|
/** Seed / override the channel title (F-016) — used by the join-restore metadata seed (F-015). */
|
|
2232
2435
|
setChannelTitle(t) {
|
|
2233
2436
|
this.channelTitleSubject.next(t);
|
|
@@ -2237,11 +2440,11 @@ class K {
|
|
|
2237
2440
|
return e.subscribe(), e;
|
|
2238
2441
|
}
|
|
2239
2442
|
static async reset(t, e, r, s) {
|
|
2240
|
-
const
|
|
2443
|
+
const o = new K(t);
|
|
2241
2444
|
try {
|
|
2242
|
-
return
|
|
2243
|
-
} catch (
|
|
2244
|
-
throw
|
|
2445
|
+
return o.subscribe(), s?.(o), await o.resetChannel(e, r), o;
|
|
2446
|
+
} catch (i) {
|
|
2447
|
+
throw o.close(), i;
|
|
2245
2448
|
}
|
|
2246
2449
|
}
|
|
2247
2450
|
/**
|
|
@@ -2255,26 +2458,28 @@ class K {
|
|
|
2255
2458
|
const s = new K(t);
|
|
2256
2459
|
try {
|
|
2257
2460
|
return s.subscribe(), r?.(s), await s.rejoinChannel(e), s;
|
|
2258
|
-
} catch (
|
|
2259
|
-
throw s.close(),
|
|
2461
|
+
} catch (o) {
|
|
2462
|
+
throw s.close(), o;
|
|
2260
2463
|
}
|
|
2261
2464
|
}
|
|
2262
2465
|
subscribe() {
|
|
2263
|
-
this.statesSubscription =
|
|
2466
|
+
this.statesSubscription = $t([
|
|
2264
2467
|
this.isConnecting$,
|
|
2265
2468
|
this.conversation$,
|
|
2266
2469
|
this.derivedStores.tasks$,
|
|
2267
2470
|
this.derivedStores.subagents$,
|
|
2268
2471
|
this.channelTitle$,
|
|
2269
|
-
this.sandboxPhase
|
|
2472
|
+
this.sandboxPhase$,
|
|
2473
|
+
this.launchedSandboxes$
|
|
2270
2474
|
]).pipe(
|
|
2271
|
-
|
|
2475
|
+
N(([t, e, r, s, o, i, a]) => ({
|
|
2272
2476
|
isConnecting: t,
|
|
2273
2477
|
conversation: e,
|
|
2274
2478
|
tasks: r,
|
|
2275
2479
|
subagents: s,
|
|
2276
|
-
channelTitle:
|
|
2277
|
-
sandboxPhase:
|
|
2480
|
+
channelTitle: o,
|
|
2481
|
+
sandboxPhase: i,
|
|
2482
|
+
launchedSandboxes: a
|
|
2278
2483
|
}))
|
|
2279
2484
|
).subscribe(this.statesObserver);
|
|
2280
2485
|
}
|
|
@@ -2322,12 +2527,12 @@ class K {
|
|
|
2322
2527
|
onSseMessage: (s) => {
|
|
2323
2528
|
if (t?.onSseMessage?.(s), s.eventType === d.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
2324
2529
|
s.fact.channelTitleUpdate.title
|
|
2325
|
-
), this.updateSandboxPhase(s.eventType), this.currentUserMessageId && s.traceId) {
|
|
2326
|
-
const
|
|
2327
|
-
|
|
2328
|
-
...
|
|
2530
|
+
), this.updateSandboxPhase(s.eventType), s.eventType === d.SANDBOX_LAUNCH && this.noteSandboxLaunch(s.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && s.traceId) {
|
|
2531
|
+
const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
|
|
2532
|
+
i && i.type === "user" && (o.set(this.currentUserMessageId, {
|
|
2533
|
+
...i,
|
|
2329
2534
|
traceId: s.traceId
|
|
2330
|
-
}), this.conversation$.next(new
|
|
2535
|
+
}), this.conversation$.next(new v({ messages: o }))), this.currentUserMessageId = void 0;
|
|
2331
2536
|
}
|
|
2332
2537
|
this.conversation$.next(this.conversation$.value.onMessage(s));
|
|
2333
2538
|
},
|
|
@@ -2362,7 +2567,7 @@ class K {
|
|
|
2362
2567
|
resetChannel(t, e) {
|
|
2363
2568
|
return this.fetchSse(
|
|
2364
2569
|
{
|
|
2365
|
-
action:
|
|
2570
|
+
action: $.RESET_CHANNEL,
|
|
2366
2571
|
customChannelId: this.customChannelId,
|
|
2367
2572
|
customMessageId: this.customMessageId,
|
|
2368
2573
|
text: t?.text || "",
|
|
@@ -2372,7 +2577,7 @@ class K {
|
|
|
2372
2577
|
);
|
|
2373
2578
|
}
|
|
2374
2579
|
sendMessage(t, e) {
|
|
2375
|
-
const r = t.text.trim(), s = t.customMessageId ??
|
|
2580
|
+
const r = t.text.trim(), s = t.customMessageId ?? He();
|
|
2376
2581
|
return this.currentUserMessageId = s, this.lastSentMessageId = s, this.conversation$.next(
|
|
2377
2582
|
this.conversation$.value.pushMessage({
|
|
2378
2583
|
type: "user",
|
|
@@ -2385,7 +2590,7 @@ class K {
|
|
|
2385
2590
|
})
|
|
2386
2591
|
), this.fetchSse(
|
|
2387
2592
|
{
|
|
2388
|
-
action:
|
|
2593
|
+
action: $.NONE,
|
|
2389
2594
|
customChannelId: this.customChannelId,
|
|
2390
2595
|
customMessageId: s,
|
|
2391
2596
|
payload: this.resolvePayload(t?.payload),
|
|
@@ -2398,7 +2603,7 @@ class K {
|
|
|
2398
2603
|
replyToolCallConsents(t, e, r) {
|
|
2399
2604
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
2400
2605
|
{
|
|
2401
|
-
action:
|
|
2606
|
+
action: $.RESPONSE_TOOL_CALL_CONSENT,
|
|
2402
2607
|
customChannelId: this.customChannelId,
|
|
2403
2608
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
2404
2609
|
payload: this.resolvePayload(r),
|
|
@@ -2408,6 +2613,23 @@ class K {
|
|
|
2408
2613
|
e
|
|
2409
2614
|
);
|
|
2410
2615
|
}
|
|
2616
|
+
/**
|
|
2617
|
+
* Nudge an idle / recycled sandbox back to life (F-021 AC4). Sends an `action=NUDGE` turn with empty
|
|
2618
|
+
* text — the backend suppresses `message.*` and writes no transcript, so nothing renders in the
|
|
2619
|
+
* conversation; the FE simply waits for the resulting `sandbox.launch`/`ready` frames (and a metadata
|
|
2620
|
+
* refetch) to refill `launchedSandboxes$`. An invisible turn, unlike `sendMessage`.
|
|
2621
|
+
*/
|
|
2622
|
+
nudge(t) {
|
|
2623
|
+
return this.fetchSse(
|
|
2624
|
+
{
|
|
2625
|
+
action: $.NUDGE,
|
|
2626
|
+
customChannelId: this.customChannelId,
|
|
2627
|
+
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
2628
|
+
text: ""
|
|
2629
|
+
},
|
|
2630
|
+
t
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2411
2633
|
/**
|
|
2412
2634
|
* User-initiated stop-generation: abort the in-flight SSE run (if any) and release the input.
|
|
2413
2635
|
* Unsubscribing tears down the SSE observable → AbortController.abort() cuts the HTTP stream. The
|
|
@@ -2418,29 +2640,42 @@ class K {
|
|
|
2418
2640
|
this.currentRun && (this.currentRun.unsubscribe(), this.currentRun = void 0, this.isConnecting$.next(!1), this.currentUserMessageId = void 0, this.conversation$.next(this.conversation$.value.cancelInFlightToolCalls()));
|
|
2419
2641
|
}
|
|
2420
2642
|
close() {
|
|
2421
|
-
this.currentRun?.unsubscribe(), this.currentRun = void 0, this.isConnecting$.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
2643
|
+
this.currentRun?.unsubscribe(), this.currentRun = void 0, this.isConnecting$.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.launchedSandboxesSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
function Cn(n) {
|
|
2647
|
+
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
2648
|
+
if (!t) return null;
|
|
2649
|
+
const e = decodeURIComponent(t[1]), r = t[2], s = new URLSearchParams(t[3] ?? "");
|
|
2650
|
+
if (r === "open-browser") return { kind: "open-browser", sandboxName: e };
|
|
2651
|
+
if (r === "open-file") {
|
|
2652
|
+
const o = s.get("absolute_path");
|
|
2653
|
+
return o ? { kind: "open-file", sandboxName: e, absolutePath: o } : null;
|
|
2422
2654
|
}
|
|
2655
|
+
return null;
|
|
2423
2656
|
}
|
|
2424
2657
|
export {
|
|
2425
|
-
|
|
2658
|
+
xn as AsgardServiceClient,
|
|
2426
2659
|
K as Channel,
|
|
2427
|
-
|
|
2660
|
+
v as Conversation,
|
|
2428
2661
|
d as EventType,
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2662
|
+
$ as FetchSseAction,
|
|
2663
|
+
I as HttpError,
|
|
2664
|
+
Ke as MessageTemplateType,
|
|
2665
|
+
Be as ToolCallConsentResult,
|
|
2666
|
+
bn as conversationToSubagentEvents,
|
|
2667
|
+
In as createDerivedStores,
|
|
2435
2668
|
yn as deriveSubagents,
|
|
2436
2669
|
vn as deriveTasks,
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2670
|
+
fn as isAgentTool,
|
|
2671
|
+
Tn as isHttpError,
|
|
2672
|
+
pn as isSubagentChildTool,
|
|
2673
|
+
dn as isTaskTool,
|
|
2674
|
+
be as reconcileLaunched,
|
|
2675
|
+
mn as reduceSubagents,
|
|
2676
|
+
hn as reduceTaskEvents,
|
|
2677
|
+
Cn as resolveSandboxUri,
|
|
2678
|
+
En as subagentsEqual,
|
|
2679
|
+
Sn as tasksEqual
|
|
2445
2680
|
};
|
|
2446
2681
|
//# sourceMappingURL=index.mjs.map
|