@asgard-js/core 0.3.61 → 0.3.63
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 +3 -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.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -262
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +15 -0
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/types/channel.d.ts +2 -0
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +45 -1
- package/dist/types/sse-response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ class w extends Error {
|
|
|
16
16
|
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = r;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function _n(n) {
|
|
20
20
|
return n instanceof w;
|
|
21
21
|
}
|
|
22
22
|
class Z extends Error {
|
|
@@ -26,7 +26,7 @@ class Z extends Error {
|
|
|
26
26
|
super(`Cannot send a message while a "${t}" run is in flight on this channel.`), this.name = "ChannelBusyError", this.runKind = t;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Ln(n) {
|
|
30
30
|
return n instanceof Z;
|
|
31
31
|
}
|
|
32
32
|
class ee extends Error {
|
|
@@ -46,7 +46,7 @@ class ee extends Error {
|
|
|
46
46
|
function Un(n) {
|
|
47
47
|
return n instanceof ee;
|
|
48
48
|
}
|
|
49
|
-
var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), l = /* @__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))(l || {}), Xe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Xe || {}), Ve = /* @__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))(Ve || {});
|
|
49
|
+
var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), l = /* @__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.PROMPT_SUGGESTION = "asgard.prompt_suggestion", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), Xe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Xe || {}), Ve = /* @__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.QUESTION = "QUESTION", n))(Ve || {});
|
|
50
50
|
async function ze(n, t) {
|
|
51
51
|
const e = n.getReader();
|
|
52
52
|
let r;
|
|
@@ -58,37 +58,37 @@ function Je(n) {
|
|
|
58
58
|
return function(i) {
|
|
59
59
|
t === void 0 ? (t = i, e = 0, r = -1) : t = Ze(t, i);
|
|
60
60
|
const a = t.length;
|
|
61
|
-
let
|
|
61
|
+
let u = 0;
|
|
62
62
|
for (; e < a; ) {
|
|
63
|
-
s && (t[e] === 10 && (
|
|
64
|
-
let
|
|
65
|
-
for (; e < a &&
|
|
63
|
+
s && (t[e] === 10 && (u = ++e), s = !1);
|
|
64
|
+
let c = -1;
|
|
65
|
+
for (; e < a && c === -1; ++e)
|
|
66
66
|
switch (t[e]) {
|
|
67
67
|
case 58:
|
|
68
|
-
r === -1 && (r = e -
|
|
68
|
+
r === -1 && (r = e - u);
|
|
69
69
|
break;
|
|
70
70
|
case 13:
|
|
71
71
|
s = !0;
|
|
72
72
|
case 10:
|
|
73
|
-
|
|
73
|
+
c = e;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (c === -1)
|
|
77
77
|
break;
|
|
78
|
-
n(t.subarray(
|
|
78
|
+
n(t.subarray(u, c), r), u = e, r = -1;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
function Qe(n, t, e) {
|
|
84
|
-
let r =
|
|
84
|
+
let r = ce();
|
|
85
85
|
const s = new TextDecoder();
|
|
86
86
|
return function(i, a) {
|
|
87
87
|
if (i.length === 0)
|
|
88
|
-
e?.(r), r =
|
|
88
|
+
e?.(r), r = ce();
|
|
89
89
|
else if (a > 0) {
|
|
90
|
-
const
|
|
91
|
-
switch (
|
|
90
|
+
const u = s.decode(i.subarray(0, a)), c = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(c));
|
|
91
|
+
switch (u) {
|
|
92
92
|
case "data":
|
|
93
93
|
r.data = r.data ? r.data + `
|
|
94
94
|
` + h : h;
|
|
@@ -111,7 +111,7 @@ function Ze(n, t) {
|
|
|
111
111
|
const e = new Uint8Array(n.length + t.length);
|
|
112
112
|
return e.set(n), e.set(t, n.length), e;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function ce() {
|
|
115
115
|
return {
|
|
116
116
|
data: "",
|
|
117
117
|
event: "",
|
|
@@ -129,7 +129,7 @@ var et = function(n, t) {
|
|
|
129
129
|
};
|
|
130
130
|
const te = "text/event-stream", tt = 1e3, le = "last-event-id";
|
|
131
131
|
function Ee(n, t) {
|
|
132
|
-
var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden:
|
|
132
|
+
var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: u, fetch: c } = t, h = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
134
|
const d = Object.assign({}, r);
|
|
135
135
|
d.accept || (d.accept = te);
|
|
@@ -137,32 +137,32 @@ function Ee(n, t) {
|
|
|
137
137
|
function f() {
|
|
138
138
|
p.abort(), document.hidden || X();
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
function
|
|
140
|
+
u || document.addEventListener("visibilitychange", f);
|
|
141
|
+
let _ = tt, E = 0;
|
|
142
|
+
function L() {
|
|
143
143
|
document.removeEventListener("visibilitychange", f), window.clearTimeout(E), p.abort();
|
|
144
144
|
}
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
|
-
|
|
146
|
+
L(), m();
|
|
147
147
|
});
|
|
148
|
-
const Ye =
|
|
148
|
+
const Ye = c ?? window.fetch, We = s ?? nt;
|
|
149
149
|
async function X() {
|
|
150
150
|
var V;
|
|
151
151
|
p = new AbortController();
|
|
152
152
|
try {
|
|
153
153
|
const H = await Ye(n, Object.assign(Object.assign({}, h), { headers: d, signal: p.signal }));
|
|
154
|
-
await We(H), await ze(H.body, Je(Qe((
|
|
155
|
-
|
|
156
|
-
}, (
|
|
157
|
-
|
|
158
|
-
}, o))), i?.(),
|
|
154
|
+
await We(H), await ze(H.body, Je(Qe((x) => {
|
|
155
|
+
x ? d[le] = x : delete d[le];
|
|
156
|
+
}, (x) => {
|
|
157
|
+
_ = x;
|
|
158
|
+
}, o))), i?.(), L(), m();
|
|
159
159
|
} catch (H) {
|
|
160
160
|
if (!p.signal.aborted)
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
163
|
-
window.clearTimeout(E), E = window.setTimeout(X,
|
|
164
|
-
} catch (
|
|
165
|
-
|
|
162
|
+
const x = (V = a?.(H)) !== null && V !== void 0 ? V : _;
|
|
163
|
+
window.clearTimeout(E), E = window.setTimeout(X, x);
|
|
164
|
+
} catch (x) {
|
|
165
|
+
L(), v(x);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -181,7 +181,7 @@ var ne = function(n, t) {
|
|
|
181
181
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
|
|
182
182
|
}, ne(n, t);
|
|
183
183
|
};
|
|
184
|
-
function
|
|
184
|
+
function C(n, t) {
|
|
185
185
|
if (typeof t != "function" && t !== null)
|
|
186
186
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
187
187
|
ne(n, t);
|
|
@@ -199,22 +199,22 @@ function rt(n, t, e, r) {
|
|
|
199
199
|
return new (e || (e = Promise))(function(o, i) {
|
|
200
200
|
function a(h) {
|
|
201
201
|
try {
|
|
202
|
-
|
|
202
|
+
c(r.next(h));
|
|
203
203
|
} catch (m) {
|
|
204
204
|
i(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function u(h) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
c(r.throw(h));
|
|
210
210
|
} catch (m) {
|
|
211
211
|
i(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
h.done ? o(h.value) : s(h.value).then(a,
|
|
214
|
+
function c(h) {
|
|
215
|
+
h.done ? o(h.value) : s(h.value).then(a, u);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
c((r = r.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
function Ie(n, t) {
|
|
@@ -225,59 +225,59 @@ function Ie(n, t) {
|
|
|
225
225
|
return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
|
|
226
226
|
return this;
|
|
227
227
|
}), i;
|
|
228
|
-
function a(
|
|
228
|
+
function a(c) {
|
|
229
229
|
return function(h) {
|
|
230
|
-
return
|
|
230
|
+
return u([c, h]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function c
|
|
233
|
+
function u(c) {
|
|
234
234
|
if (r) throw new TypeError("Generator is already executing.");
|
|
235
|
-
for (; i && (i = 0,
|
|
236
|
-
if (r = 1, s && (o =
|
|
237
|
-
switch (s = 0, o && (
|
|
235
|
+
for (; i && (i = 0, c[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (r = 1, s && (o = c[0] & 2 ? s.return : c[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, c[1])).done) return o;
|
|
237
|
+
switch (s = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
o =
|
|
240
|
+
o = c;
|
|
241
241
|
break;
|
|
242
242
|
case 4:
|
|
243
|
-
return e.label++, { value:
|
|
243
|
+
return e.label++, { value: c[1], done: !1 };
|
|
244
244
|
case 5:
|
|
245
|
-
e.label++, s =
|
|
245
|
+
e.label++, s = c[1], c = [0];
|
|
246
246
|
continue;
|
|
247
247
|
case 7:
|
|
248
|
-
|
|
248
|
+
c = e.ops.pop(), e.trys.pop();
|
|
249
249
|
continue;
|
|
250
250
|
default:
|
|
251
|
-
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (
|
|
251
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
252
252
|
e = 0;
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
|
-
if (
|
|
256
|
-
e.label =
|
|
255
|
+
if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
|
|
256
|
+
e.label = c[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
e.label = o[1], o =
|
|
259
|
+
if (c[0] === 6 && e.label < o[1]) {
|
|
260
|
+
e.label = o[1], o = c;
|
|
261
261
|
break;
|
|
262
262
|
}
|
|
263
263
|
if (o && e.label < o[2]) {
|
|
264
|
-
e.label = o[2], e.ops.push(
|
|
264
|
+
e.label = o[2], e.ops.push(c);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
o[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
270
|
+
c = t.call(n, e);
|
|
271
271
|
} catch (h) {
|
|
272
|
-
|
|
272
|
+
c = [6, h], s = 0;
|
|
273
273
|
} finally {
|
|
274
274
|
r = o = 0;
|
|
275
275
|
}
|
|
276
|
-
if (
|
|
277
|
-
return { value:
|
|
276
|
+
if (c[0] & 5) throw c[1];
|
|
277
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function k(n) {
|
|
281
281
|
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
|
|
282
282
|
if (e) return e.call(n);
|
|
283
283
|
if (n && typeof n.length == "number") return {
|
|
@@ -309,8 +309,8 @@ function F(n, t, e) {
|
|
|
309
309
|
(o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
|
|
310
310
|
return n.concat(o || Array.prototype.slice.call(t));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return this instanceof
|
|
312
|
+
function N(n) {
|
|
313
|
+
return this instanceof N ? (this.v = n, this) : new N(n);
|
|
314
314
|
}
|
|
315
315
|
function st(n, t, e) {
|
|
316
316
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
@@ -325,47 +325,47 @@ function st(n, t, e) {
|
|
|
325
325
|
}
|
|
326
326
|
function a(d, p) {
|
|
327
327
|
r[d] && (s[d] = function(f) {
|
|
328
|
-
return new Promise(function(
|
|
329
|
-
o.push([d, f,
|
|
328
|
+
return new Promise(function(_, E) {
|
|
329
|
+
o.push([d, f, _, E]) > 1 || u(d, f);
|
|
330
330
|
});
|
|
331
331
|
}, p && (s[d] = p(s[d])));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function u(d, p) {
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
c(r[d](p));
|
|
336
336
|
} catch (f) {
|
|
337
337
|
v(o[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
d.value instanceof
|
|
340
|
+
function c(d) {
|
|
341
|
+
d.value instanceof N ? Promise.resolve(d.value.v).then(h, m) : v(o[0][2], d);
|
|
342
342
|
}
|
|
343
343
|
function h(d) {
|
|
344
|
-
|
|
344
|
+
u("next", d);
|
|
345
345
|
}
|
|
346
346
|
function m(d) {
|
|
347
|
-
|
|
347
|
+
u("throw", d);
|
|
348
348
|
}
|
|
349
349
|
function v(d, p) {
|
|
350
|
-
d(p), o.shift(), o.length &&
|
|
350
|
+
d(p), o.shift(), o.length && u(o[0][0], o[0][1]);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
function ot(n) {
|
|
354
354
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
355
355
|
var t = n[Symbol.asyncIterator], e;
|
|
356
|
-
return t ? t.call(n) : (n = typeof
|
|
356
|
+
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() {
|
|
357
357
|
return this;
|
|
358
358
|
}, e);
|
|
359
359
|
function r(o) {
|
|
360
360
|
e[o] = n[o] && function(i) {
|
|
361
|
-
return new Promise(function(a,
|
|
362
|
-
i = n[o](i), s(a,
|
|
361
|
+
return new Promise(function(a, u) {
|
|
362
|
+
i = n[o](i), s(a, u, i.done, i.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function s(o, i, a,
|
|
367
|
-
Promise.resolve(
|
|
368
|
-
o({ value:
|
|
366
|
+
function s(o, i, a, u) {
|
|
367
|
+
Promise.resolve(u).then(function(c) {
|
|
368
|
+
o({ value: c, done: a });
|
|
369
369
|
}, i);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
@@ -405,15 +405,15 @@ var j = (function() {
|
|
|
405
405
|
if (i)
|
|
406
406
|
if (this._parentage = null, Array.isArray(i))
|
|
407
407
|
try {
|
|
408
|
-
for (var a =
|
|
409
|
-
var
|
|
410
|
-
|
|
408
|
+
for (var a = k(i), u = a.next(); !u.done; u = a.next()) {
|
|
409
|
+
var c = u.value;
|
|
410
|
+
c.remove(this);
|
|
411
411
|
}
|
|
412
412
|
} catch (f) {
|
|
413
413
|
t = { error: f };
|
|
414
414
|
} finally {
|
|
415
415
|
try {
|
|
416
|
-
|
|
416
|
+
u && !u.done && (e = a.return) && e.call(a);
|
|
417
417
|
} finally {
|
|
418
418
|
if (t) throw t.error;
|
|
419
419
|
}
|
|
@@ -431,7 +431,7 @@ var j = (function() {
|
|
|
431
431
|
if (m) {
|
|
432
432
|
this._finalizers = null;
|
|
433
433
|
try {
|
|
434
|
-
for (var v =
|
|
434
|
+
for (var v = k(m), d = v.next(); !d.done; d = v.next()) {
|
|
435
435
|
var p = d.value;
|
|
436
436
|
try {
|
|
437
437
|
de(p);
|
|
@@ -508,11 +508,11 @@ function Oe(n) {
|
|
|
508
508
|
}
|
|
509
509
|
function re() {
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function B(n) {
|
|
512
512
|
n();
|
|
513
513
|
}
|
|
514
514
|
var oe = (function(n) {
|
|
515
|
-
|
|
515
|
+
C(t, n);
|
|
516
516
|
function t(e) {
|
|
517
517
|
var r = n.call(this) || this;
|
|
518
518
|
return r.isStopped = !1, e ? (r.destination = e, xe(e) && e.add(r)) : r.destination = lt, r;
|
|
@@ -542,7 +542,7 @@ var oe = (function(n) {
|
|
|
542
542
|
this.unsubscribe();
|
|
543
543
|
}
|
|
544
544
|
}, t;
|
|
545
|
-
})(j),
|
|
545
|
+
})(j), ut = (function() {
|
|
546
546
|
function n(t) {
|
|
547
547
|
this.partialObserver = t;
|
|
548
548
|
}
|
|
@@ -552,7 +552,7 @@ var oe = (function(n) {
|
|
|
552
552
|
try {
|
|
553
553
|
e.next(t);
|
|
554
554
|
} catch (r) {
|
|
555
|
-
|
|
555
|
+
G(r);
|
|
556
556
|
}
|
|
557
557
|
}, n.prototype.error = function(t) {
|
|
558
558
|
var e = this.partialObserver;
|
|
@@ -560,41 +560,41 @@ var oe = (function(n) {
|
|
|
560
560
|
try {
|
|
561
561
|
e.error(t);
|
|
562
562
|
} catch (r) {
|
|
563
|
-
|
|
563
|
+
G(r);
|
|
564
564
|
}
|
|
565
565
|
else
|
|
566
|
-
|
|
566
|
+
G(t);
|
|
567
567
|
}, n.prototype.complete = function() {
|
|
568
568
|
var t = this.partialObserver;
|
|
569
569
|
if (t.complete)
|
|
570
570
|
try {
|
|
571
571
|
t.complete();
|
|
572
572
|
} catch (e) {
|
|
573
|
-
|
|
573
|
+
G(e);
|
|
574
574
|
}
|
|
575
575
|
}, n;
|
|
576
576
|
})(), se = (function(n) {
|
|
577
|
-
|
|
577
|
+
C(t, n);
|
|
578
578
|
function t(e, r, s) {
|
|
579
579
|
var o = n.call(this) || this, i;
|
|
580
580
|
return g(e) || !e ? i = {
|
|
581
581
|
next: e ?? void 0,
|
|
582
582
|
error: r ?? void 0,
|
|
583
583
|
complete: s ?? void 0
|
|
584
|
-
} : i = e, o.destination = new
|
|
584
|
+
} : i = e, o.destination = new ut(i), o;
|
|
585
585
|
}
|
|
586
586
|
return t;
|
|
587
587
|
})(oe);
|
|
588
|
-
function
|
|
588
|
+
function G(n) {
|
|
589
589
|
Oe(n);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function ct(n) {
|
|
592
592
|
throw n;
|
|
593
593
|
}
|
|
594
594
|
var lt = {
|
|
595
595
|
closed: !0,
|
|
596
596
|
next: re,
|
|
597
|
-
error:
|
|
597
|
+
error: ct,
|
|
598
598
|
complete: re
|
|
599
599
|
}, ie = (function() {
|
|
600
600
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
@@ -609,7 +609,7 @@ function dt(n) {
|
|
|
609
609
|
}, e);
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
var
|
|
612
|
+
var y = (function() {
|
|
613
613
|
function n(t) {
|
|
614
614
|
t && (this._subscribe = t);
|
|
615
615
|
}
|
|
@@ -618,9 +618,9 @@ var S = (function() {
|
|
|
618
618
|
return e.source = this, e.operator = t, e;
|
|
619
619
|
}, n.prototype.subscribe = function(t, e, r) {
|
|
620
620
|
var s = this, o = ft(t) ? t : new se(t, e, r);
|
|
621
|
-
return
|
|
622
|
-
var i = s, a = i.operator,
|
|
623
|
-
o.add(a ? a.call(o,
|
|
621
|
+
return B(function() {
|
|
622
|
+
var i = s, a = i.operator, u = i.source;
|
|
623
|
+
o.add(a ? a.call(o, u) : u ? s._subscribe(o) : s._trySubscribe(o));
|
|
624
624
|
}), o;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
@@ -635,8 +635,8 @@ var S = (function() {
|
|
|
635
635
|
next: function(a) {
|
|
636
636
|
try {
|
|
637
637
|
t(a);
|
|
638
|
-
} catch (
|
|
639
|
-
o(
|
|
638
|
+
} catch (u) {
|
|
639
|
+
o(u), i.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
642
|
error: o,
|
|
@@ -699,32 +699,32 @@ function A(n, t, e, r, s) {
|
|
|
699
699
|
return new mt(n, t, e, r, s);
|
|
700
700
|
}
|
|
701
701
|
var mt = (function(n) {
|
|
702
|
-
|
|
702
|
+
C(t, n);
|
|
703
703
|
function t(e, r, s, o, i, a) {
|
|
704
|
-
var
|
|
705
|
-
return
|
|
704
|
+
var u = n.call(this, e) || this;
|
|
705
|
+
return u.onFinalize = i, u.shouldUnsubscribe = a, u._next = r ? function(c) {
|
|
706
706
|
try {
|
|
707
|
-
r(
|
|
707
|
+
r(c);
|
|
708
708
|
} catch (h) {
|
|
709
709
|
e.error(h);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next,
|
|
711
|
+
} : n.prototype._next, u._error = o ? function(c) {
|
|
712
712
|
try {
|
|
713
|
-
o(
|
|
713
|
+
o(c);
|
|
714
714
|
} catch (h) {
|
|
715
715
|
e.error(h);
|
|
716
716
|
} finally {
|
|
717
717
|
this.unsubscribe();
|
|
718
718
|
}
|
|
719
|
-
} : n.prototype._error,
|
|
719
|
+
} : n.prototype._error, u._complete = s ? function() {
|
|
720
720
|
try {
|
|
721
721
|
s();
|
|
722
|
-
} catch (
|
|
723
|
-
e.error(
|
|
722
|
+
} catch (c) {
|
|
723
|
+
e.error(c);
|
|
724
724
|
} finally {
|
|
725
725
|
this.unsubscribe();
|
|
726
726
|
}
|
|
727
|
-
} : n.prototype._complete,
|
|
727
|
+
} : n.prototype._complete, u;
|
|
728
728
|
}
|
|
729
729
|
return t.prototype.unsubscribe = function() {
|
|
730
730
|
var e;
|
|
@@ -738,7 +738,7 @@ var mt = (function(n) {
|
|
|
738
738
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
739
739
|
};
|
|
740
740
|
}), ae = (function(n) {
|
|
741
|
-
|
|
741
|
+
C(t, n);
|
|
742
742
|
function t() {
|
|
743
743
|
var e = n.call(this) || this;
|
|
744
744
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
@@ -751,17 +751,17 @@ var mt = (function(n) {
|
|
|
751
751
|
throw new gt();
|
|
752
752
|
}, t.prototype.next = function(e) {
|
|
753
753
|
var r = this;
|
|
754
|
-
|
|
754
|
+
B(function() {
|
|
755
755
|
var s, o;
|
|
756
756
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
757
757
|
r.currentObservers || (r.currentObservers = Array.from(r.observers));
|
|
758
758
|
try {
|
|
759
|
-
for (var i =
|
|
760
|
-
var
|
|
761
|
-
|
|
759
|
+
for (var i = k(r.currentObservers), a = i.next(); !a.done; a = i.next()) {
|
|
760
|
+
var u = a.value;
|
|
761
|
+
u.next(e);
|
|
762
762
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
s = { error:
|
|
763
|
+
} catch (c) {
|
|
764
|
+
s = { error: c };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
767
|
a && !a.done && (o = i.return) && o.call(i);
|
|
@@ -773,7 +773,7 @@ var mt = (function(n) {
|
|
|
773
773
|
});
|
|
774
774
|
}, t.prototype.error = function(e) {
|
|
775
775
|
var r = this;
|
|
776
|
-
|
|
776
|
+
B(function() {
|
|
777
777
|
if (r._throwIfClosed(), !r.isStopped) {
|
|
778
778
|
r.hasError = r.isStopped = !0, r.thrownError = e;
|
|
779
779
|
for (var s = r.observers; s.length; )
|
|
@@ -782,7 +782,7 @@ var mt = (function(n) {
|
|
|
782
782
|
});
|
|
783
783
|
}, t.prototype.complete = function() {
|
|
784
784
|
var e = this;
|
|
785
|
-
|
|
785
|
+
B(function() {
|
|
786
786
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
787
787
|
e.isStopped = !0;
|
|
788
788
|
for (var r = e.observers; r.length; )
|
|
@@ -811,13 +811,13 @@ var mt = (function(n) {
|
|
|
811
811
|
var r = this, s = r.hasError, o = r.thrownError, i = r.isStopped;
|
|
812
812
|
s ? e.error(o) : i && e.complete();
|
|
813
813
|
}, t.prototype.asObservable = function() {
|
|
814
|
-
var e = new
|
|
814
|
+
var e = new y();
|
|
815
815
|
return e.source = this, e;
|
|
816
816
|
}, t.create = function(e, r) {
|
|
817
817
|
return new fe(e, r);
|
|
818
818
|
}, t;
|
|
819
|
-
})(
|
|
820
|
-
|
|
819
|
+
})(y), fe = (function(n) {
|
|
820
|
+
C(t, n);
|
|
821
821
|
function t(e, r) {
|
|
822
822
|
var s = n.call(this) || this;
|
|
823
823
|
return s.destination = e, s.source = r, s;
|
|
@@ -835,8 +835,8 @@ var mt = (function(n) {
|
|
|
835
835
|
var r, s;
|
|
836
836
|
return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : Ce;
|
|
837
837
|
}, t;
|
|
838
|
-
})(ae),
|
|
839
|
-
|
|
838
|
+
})(ae), T = (function(n) {
|
|
839
|
+
C(t, n);
|
|
840
840
|
function t(e) {
|
|
841
841
|
var r = n.call(this) || this;
|
|
842
842
|
return r._value = e, r;
|
|
@@ -863,7 +863,7 @@ var mt = (function(n) {
|
|
|
863
863
|
return Date.now();
|
|
864
864
|
}
|
|
865
865
|
}, vt = (function(n) {
|
|
866
|
-
|
|
866
|
+
C(t, n);
|
|
867
867
|
function t(e, r) {
|
|
868
868
|
return n.call(this) || this;
|
|
869
869
|
}
|
|
@@ -880,8 +880,8 @@ var mt = (function(n) {
|
|
|
880
880
|
return clearInterval(n);
|
|
881
881
|
},
|
|
882
882
|
delegate: void 0
|
|
883
|
-
},
|
|
884
|
-
|
|
883
|
+
}, St = (function(n) {
|
|
884
|
+
C(t, n);
|
|
885
885
|
function t(e, r) {
|
|
886
886
|
var s = n.call(this, e, r) || this;
|
|
887
887
|
return s.scheduler = e, s.work = r, s.pending = !1, s;
|
|
@@ -929,8 +929,8 @@ var mt = (function(n) {
|
|
|
929
929
|
return n.prototype.schedule = function(t, e, r) {
|
|
930
930
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
|
|
931
931
|
}, n.now = bt.now, n;
|
|
932
|
-
})(),
|
|
933
|
-
|
|
932
|
+
})(), yt = (function(n) {
|
|
933
|
+
C(t, n);
|
|
934
934
|
function t(e, r) {
|
|
935
935
|
r === void 0 && (r = me.now);
|
|
936
936
|
var s = n.call(this, e, r) || this;
|
|
@@ -954,20 +954,20 @@ var mt = (function(n) {
|
|
|
954
954
|
throw s;
|
|
955
955
|
}
|
|
956
956
|
}, t;
|
|
957
|
-
})(me), Ae = new St
|
|
957
|
+
})(me), Ae = new yt(St), wt = Ae, Et = new y(function(n) {
|
|
958
958
|
return n.complete();
|
|
959
959
|
});
|
|
960
960
|
function Pe(n) {
|
|
961
961
|
return n && g(n.schedule);
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function _e(n) {
|
|
964
964
|
return n[n.length - 1];
|
|
965
965
|
}
|
|
966
966
|
function It(n) {
|
|
967
|
-
return g(
|
|
967
|
+
return g(_e(n)) ? n.pop() : void 0;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
return Pe(
|
|
969
|
+
function Le(n) {
|
|
970
|
+
return Pe(_e(n)) ? n.pop() : void 0;
|
|
971
971
|
}
|
|
972
972
|
var Ue = (function(n) {
|
|
973
973
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
@@ -975,10 +975,10 @@ var Ue = (function(n) {
|
|
|
975
975
|
function Me(n) {
|
|
976
976
|
return g(n?.then);
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function Ne(n) {
|
|
979
979
|
return g(n[ie]);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function ke(n) {
|
|
982
982
|
return Symbol.asyncIterator && g(n?.[Symbol.asyncIterator]);
|
|
983
983
|
}
|
|
984
984
|
function Re(n) {
|
|
@@ -1001,13 +1001,13 @@ function De(n) {
|
|
|
1001
1001
|
case 1:
|
|
1002
1002
|
i.trys.push([1, , 9, 10]), i.label = 2;
|
|
1003
1003
|
case 2:
|
|
1004
|
-
return [4,
|
|
1004
|
+
return [4, N(e.read())];
|
|
1005
1005
|
case 3:
|
|
1006
|
-
return r = i.sent(), s = r.value, o = r.done, o ? [4,
|
|
1006
|
+
return r = i.sent(), s = r.value, o = r.done, o ? [4, N(void 0)] : [3, 5];
|
|
1007
1007
|
case 4:
|
|
1008
1008
|
return [2, i.sent()];
|
|
1009
1009
|
case 5:
|
|
1010
|
-
return [4,
|
|
1010
|
+
return [4, N(s)];
|
|
1011
1011
|
case 6:
|
|
1012
1012
|
return [4, i.sent()];
|
|
1013
1013
|
case 7:
|
|
@@ -1025,17 +1025,17 @@ function De(n) {
|
|
|
1025
1025
|
function Fe(n) {
|
|
1026
1026
|
return g(n?.getReader);
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1029
|
-
if (n instanceof
|
|
1028
|
+
function M(n) {
|
|
1029
|
+
if (n instanceof y)
|
|
1030
1030
|
return n;
|
|
1031
1031
|
if (n != null) {
|
|
1032
|
-
if (
|
|
1032
|
+
if (Ne(n))
|
|
1033
1033
|
return Ct(n);
|
|
1034
1034
|
if (Ue(n))
|
|
1035
1035
|
return xt(n);
|
|
1036
1036
|
if (Me(n))
|
|
1037
1037
|
return Ot(n);
|
|
1038
|
-
if (
|
|
1038
|
+
if (ke(n))
|
|
1039
1039
|
return He(n);
|
|
1040
1040
|
if ($e(n))
|
|
1041
1041
|
return At(n);
|
|
@@ -1045,7 +1045,7 @@ function U(n) {
|
|
|
1045
1045
|
throw Re(n);
|
|
1046
1046
|
}
|
|
1047
1047
|
function Ct(n) {
|
|
1048
|
-
return new
|
|
1048
|
+
return new y(function(t) {
|
|
1049
1049
|
var e = n[ie]();
|
|
1050
1050
|
if (g(e.subscribe))
|
|
1051
1051
|
return e.subscribe(t);
|
|
@@ -1053,14 +1053,14 @@ function Ct(n) {
|
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
1055
|
function xt(n) {
|
|
1056
|
-
return new
|
|
1056
|
+
return new y(function(t) {
|
|
1057
1057
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
1058
1058
|
t.next(n[e]);
|
|
1059
1059
|
t.complete();
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
1062
|
function Ot(n) {
|
|
1063
|
-
return new
|
|
1063
|
+
return new y(function(t) {
|
|
1064
1064
|
n.then(function(e) {
|
|
1065
1065
|
t.closed || (t.next(e), t.complete());
|
|
1066
1066
|
}, function(e) {
|
|
@@ -1069,10 +1069,10 @@ function Ot(n) {
|
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
1071
1071
|
function At(n) {
|
|
1072
|
-
return new
|
|
1072
|
+
return new y(function(t) {
|
|
1073
1073
|
var e, r;
|
|
1074
1074
|
try {
|
|
1075
|
-
for (var s =
|
|
1075
|
+
for (var s = k(n), o = s.next(); !o.done; o = s.next()) {
|
|
1076
1076
|
var i = o.value;
|
|
1077
1077
|
if (t.next(i), t.closed)
|
|
1078
1078
|
return;
|
|
@@ -1090,8 +1090,8 @@ function At(n) {
|
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
1092
|
function He(n) {
|
|
1093
|
-
return new
|
|
1094
|
-
|
|
1093
|
+
return new y(function(t) {
|
|
1094
|
+
_t(n, t).catch(function(e) {
|
|
1095
1095
|
return t.error(e);
|
|
1096
1096
|
});
|
|
1097
1097
|
});
|
|
@@ -1099,31 +1099,31 @@ function He(n) {
|
|
|
1099
1099
|
function Pt(n) {
|
|
1100
1100
|
return He(De(n));
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function _t(n, t) {
|
|
1103
1103
|
var e, r, s, o;
|
|
1104
1104
|
return rt(this, void 0, void 0, function() {
|
|
1105
1105
|
var i, a;
|
|
1106
|
-
return Ie(this, function(
|
|
1107
|
-
switch (
|
|
1106
|
+
return Ie(this, function(u) {
|
|
1107
|
+
switch (u.label) {
|
|
1108
1108
|
case 0:
|
|
1109
|
-
|
|
1109
|
+
u.trys.push([0, 5, 6, 11]), e = ot(n), u.label = 1;
|
|
1110
1110
|
case 1:
|
|
1111
1111
|
return [4, e.next()];
|
|
1112
1112
|
case 2:
|
|
1113
|
-
if (r =
|
|
1113
|
+
if (r = u.sent(), !!r.done) return [3, 4];
|
|
1114
1114
|
if (i = r.value, t.next(i), t.closed)
|
|
1115
1115
|
return [2];
|
|
1116
|
-
|
|
1116
|
+
u.label = 3;
|
|
1117
1117
|
case 3:
|
|
1118
1118
|
return [3, 1];
|
|
1119
1119
|
case 4:
|
|
1120
1120
|
return [3, 11];
|
|
1121
1121
|
case 5:
|
|
1122
|
-
return a =
|
|
1122
|
+
return a = u.sent(), s = { error: a }, [3, 11];
|
|
1123
1123
|
case 6:
|
|
1124
|
-
return
|
|
1124
|
+
return u.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
1125
1125
|
case 7:
|
|
1126
|
-
|
|
1126
|
+
u.sent(), u.label = 8;
|
|
1127
1127
|
case 8:
|
|
1128
1128
|
return [3, 10];
|
|
1129
1129
|
case 9:
|
|
@@ -1145,7 +1145,7 @@ function O(n, t, e, r, s) {
|
|
|
1145
1145
|
if (n.add(o), !s)
|
|
1146
1146
|
return o;
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1148
|
+
function Ge(n, t) {
|
|
1149
1149
|
return t === void 0 && (t = 0), P(function(e, r) {
|
|
1150
1150
|
e.subscribe(A(r, function(s) {
|
|
1151
1151
|
return O(r, n, function() {
|
|
@@ -1162,29 +1162,29 @@ function Be(n, t) {
|
|
|
1162
1162
|
}));
|
|
1163
1163
|
});
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1165
|
+
function Be(n, t) {
|
|
1166
1166
|
return t === void 0 && (t = 0), P(function(e, r) {
|
|
1167
1167
|
r.add(n.schedule(function() {
|
|
1168
1168
|
return e.subscribe(r);
|
|
1169
1169
|
}, t));
|
|
1170
1170
|
});
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1173
|
-
return
|
|
1172
|
+
function Lt(n, t) {
|
|
1173
|
+
return M(n).pipe(Be(t), Ge(t));
|
|
1174
1174
|
}
|
|
1175
1175
|
function Ut(n, t) {
|
|
1176
|
-
return
|
|
1176
|
+
return M(n).pipe(Be(t), Ge(t));
|
|
1177
1177
|
}
|
|
1178
1178
|
function Mt(n, t) {
|
|
1179
|
-
return new
|
|
1179
|
+
return new y(function(e) {
|
|
1180
1180
|
var r = 0;
|
|
1181
1181
|
return t.schedule(function() {
|
|
1182
1182
|
r === n.length ? e.complete() : (e.next(n[r++]), e.closed || this.schedule());
|
|
1183
1183
|
});
|
|
1184
1184
|
});
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1187
|
-
return new
|
|
1186
|
+
function Nt(n, t) {
|
|
1187
|
+
return new y(function(e) {
|
|
1188
1188
|
var r;
|
|
1189
1189
|
return O(e, t, function() {
|
|
1190
1190
|
r = n[je](), O(e, t, function() {
|
|
@@ -1205,7 +1205,7 @@ function kt(n, t) {
|
|
|
1205
1205
|
function qe(n, t) {
|
|
1206
1206
|
if (!n)
|
|
1207
1207
|
throw new Error("Iterable cannot be null");
|
|
1208
|
-
return new
|
|
1208
|
+
return new y(function(e) {
|
|
1209
1209
|
O(e, t, function() {
|
|
1210
1210
|
var r = n[Symbol.asyncIterator]();
|
|
1211
1211
|
O(e, t, function() {
|
|
@@ -1216,34 +1216,34 @@ function qe(n, t) {
|
|
|
1216
1216
|
});
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
|
-
function
|
|
1219
|
+
function kt(n, t) {
|
|
1220
1220
|
return qe(De(n), t);
|
|
1221
1221
|
}
|
|
1222
1222
|
function Rt(n, t) {
|
|
1223
1223
|
if (n != null) {
|
|
1224
|
-
if (
|
|
1225
|
-
return
|
|
1224
|
+
if (Ne(n))
|
|
1225
|
+
return Lt(n, t);
|
|
1226
1226
|
if (Ue(n))
|
|
1227
1227
|
return Mt(n, t);
|
|
1228
1228
|
if (Me(n))
|
|
1229
1229
|
return Ut(n, t);
|
|
1230
|
-
if (
|
|
1230
|
+
if (ke(n))
|
|
1231
1231
|
return qe(n, t);
|
|
1232
1232
|
if ($e(n))
|
|
1233
|
-
return kt(n, t);
|
|
1234
|
-
if (Fe(n))
|
|
1235
1233
|
return Nt(n, t);
|
|
1234
|
+
if (Fe(n))
|
|
1235
|
+
return kt(n, t);
|
|
1236
1236
|
}
|
|
1237
1237
|
throw Re(n);
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
return t ? Rt(n, t) :
|
|
1239
|
+
function ue(n, t) {
|
|
1240
|
+
return t ? Rt(n, t) : M(n);
|
|
1241
1241
|
}
|
|
1242
1242
|
function jt() {
|
|
1243
1243
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1244
1244
|
n[t] = arguments[t];
|
|
1245
|
-
var e =
|
|
1246
|
-
return
|
|
1245
|
+
var e = Le(n);
|
|
1246
|
+
return ue(n, e);
|
|
1247
1247
|
}
|
|
1248
1248
|
function $t(n) {
|
|
1249
1249
|
return n instanceof Date && !isNaN(n);
|
|
@@ -1265,11 +1265,11 @@ function Ht(n) {
|
|
|
1265
1265
|
return Ft(n, t);
|
|
1266
1266
|
});
|
|
1267
1267
|
}
|
|
1268
|
-
var
|
|
1268
|
+
var Gt = Array.isArray, Bt = Object.getPrototypeOf, qt = Object.prototype, Kt = Object.keys;
|
|
1269
1269
|
function Yt(n) {
|
|
1270
1270
|
if (n.length === 1) {
|
|
1271
1271
|
var t = n[0];
|
|
1272
|
-
if (
|
|
1272
|
+
if (Gt(t))
|
|
1273
1273
|
return { args: t, keys: null };
|
|
1274
1274
|
if (Wt(t)) {
|
|
1275
1275
|
var e = Kt(t);
|
|
@@ -1284,7 +1284,7 @@ function Yt(n) {
|
|
|
1284
1284
|
return { args: n, keys: null };
|
|
1285
1285
|
}
|
|
1286
1286
|
function Wt(n) {
|
|
1287
|
-
return n && typeof n == "object" &&
|
|
1287
|
+
return n && typeof n == "object" && Bt(n) === qt;
|
|
1288
1288
|
}
|
|
1289
1289
|
function Xt(n, t) {
|
|
1290
1290
|
return n.reduce(function(e, r, s) {
|
|
@@ -1294,28 +1294,28 @@ function Xt(n, t) {
|
|
|
1294
1294
|
function Vt() {
|
|
1295
1295
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1296
1296
|
n[t] = arguments[t];
|
|
1297
|
-
var e =
|
|
1297
|
+
var e = Le(n), r = It(n), s = Yt(n), o = s.args, i = s.keys;
|
|
1298
1298
|
if (o.length === 0)
|
|
1299
|
-
return
|
|
1300
|
-
var a = new
|
|
1301
|
-
return Xt(i,
|
|
1299
|
+
return ue([], e);
|
|
1300
|
+
var a = new y(zt(o, e, i ? function(u) {
|
|
1301
|
+
return Xt(i, u);
|
|
1302
1302
|
} : W));
|
|
1303
1303
|
return r ? a.pipe(Ht(r)) : a;
|
|
1304
1304
|
}
|
|
1305
1305
|
function zt(n, t, e) {
|
|
1306
1306
|
return e === void 0 && (e = W), function(r) {
|
|
1307
1307
|
ge(t, function() {
|
|
1308
|
-
for (var s = n.length, o = new Array(s), i = s, a = s,
|
|
1308
|
+
for (var s = n.length, o = new Array(s), i = s, a = s, u = function(h) {
|
|
1309
1309
|
ge(t, function() {
|
|
1310
|
-
var m =
|
|
1310
|
+
var m = ue(n[h], t), v = !1;
|
|
1311
1311
|
m.subscribe(A(r, function(d) {
|
|
1312
1312
|
o[h] = d, v || (v = !0, a--), a || r.next(e(o.slice()));
|
|
1313
1313
|
}, function() {
|
|
1314
1314
|
--i || r.complete();
|
|
1315
1315
|
}));
|
|
1316
1316
|
}, r);
|
|
1317
|
-
},
|
|
1318
|
-
c
|
|
1317
|
+
}, c = 0; c < s; c++)
|
|
1318
|
+
u(c);
|
|
1319
1319
|
}, r);
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
@@ -1323,29 +1323,29 @@ function ge(n, t, e) {
|
|
|
1323
1323
|
n ? O(e, n, t) : t();
|
|
1324
1324
|
}
|
|
1325
1325
|
function Jt(n, t, e, r, s, o, i, a) {
|
|
1326
|
-
var
|
|
1327
|
-
m && !
|
|
1326
|
+
var u = [], c = 0, h = 0, m = !1, v = function() {
|
|
1327
|
+
m && !u.length && !c && t.complete();
|
|
1328
1328
|
}, d = function(f) {
|
|
1329
|
-
return
|
|
1329
|
+
return c < r ? p(f) : u.push(f);
|
|
1330
1330
|
}, p = function(f) {
|
|
1331
|
-
|
|
1332
|
-
var
|
|
1333
|
-
|
|
1331
|
+
c++;
|
|
1332
|
+
var _ = !1;
|
|
1333
|
+
M(e(f, h++)).subscribe(A(t, function(E) {
|
|
1334
1334
|
t.next(E);
|
|
1335
1335
|
}, function() {
|
|
1336
|
-
|
|
1336
|
+
_ = !0;
|
|
1337
1337
|
}, void 0, function() {
|
|
1338
|
-
if (
|
|
1338
|
+
if (_)
|
|
1339
1339
|
try {
|
|
1340
|
-
|
|
1340
|
+
c--;
|
|
1341
1341
|
for (var E = function() {
|
|
1342
|
-
var
|
|
1343
|
-
i || p(
|
|
1344
|
-
};
|
|
1342
|
+
var L = u.shift();
|
|
1343
|
+
i || p(L);
|
|
1344
|
+
}; u.length && c < r; )
|
|
1345
1345
|
E();
|
|
1346
1346
|
v();
|
|
1347
|
-
} catch (
|
|
1348
|
-
t.error(
|
|
1347
|
+
} catch (L) {
|
|
1348
|
+
t.error(L);
|
|
1349
1349
|
}
|
|
1350
1350
|
}));
|
|
1351
1351
|
};
|
|
@@ -1358,7 +1358,7 @@ function Y(n, t, e) {
|
|
|
1358
1358
|
return e === void 0 && (e = 1 / 0), g(t) ? Y(function(r, s) {
|
|
1359
1359
|
return R(function(o, i) {
|
|
1360
1360
|
return t(r, o, s, i);
|
|
1361
|
-
})(
|
|
1361
|
+
})(M(n(r, s)));
|
|
1362
1362
|
}, e) : (typeof t == "number" && (e = t), P(function(r, s) {
|
|
1363
1363
|
return Jt(r, s, n, e);
|
|
1364
1364
|
}));
|
|
@@ -1366,7 +1366,7 @@ function Y(n, t, e) {
|
|
|
1366
1366
|
function Qt(n, t, e) {
|
|
1367
1367
|
n === void 0 && (n = 0), e === void 0 && (e = wt);
|
|
1368
1368
|
var r = -1;
|
|
1369
|
-
return t != null && (Pe(t) ? e = t : r = t), new
|
|
1369
|
+
return t != null && (Pe(t) ? e = t : r = t), new y(function(s) {
|
|
1370
1370
|
var o = $t(n) ? +n - e.now() : n;
|
|
1371
1371
|
o < 0 && (o = 0);
|
|
1372
1372
|
var i = 0;
|
|
@@ -1395,7 +1395,7 @@ function tn(n) {
|
|
|
1395
1395
|
}
|
|
1396
1396
|
function nn(n, t) {
|
|
1397
1397
|
return Y(function(e, r) {
|
|
1398
|
-
return
|
|
1398
|
+
return M(n(e, r)).pipe(en(1), tn(e));
|
|
1399
1399
|
});
|
|
1400
1400
|
}
|
|
1401
1401
|
function rn(n, t) {
|
|
@@ -1405,7 +1405,7 @@ function rn(n, t) {
|
|
|
1405
1405
|
return e;
|
|
1406
1406
|
});
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1408
|
+
function U(n, t) {
|
|
1409
1409
|
return t === void 0 && (t = W), n = n ?? sn, P(function(e, r) {
|
|
1410
1410
|
var s, o = !0;
|
|
1411
1411
|
e.subscribe(A(r, function(i) {
|
|
@@ -1428,16 +1428,16 @@ function on(n) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
function an(n) {
|
|
1430
1430
|
return P(function(t, e) {
|
|
1431
|
-
|
|
1431
|
+
M(n).subscribe(A(e, function() {
|
|
1432
1432
|
return e.complete();
|
|
1433
1433
|
}, re)), !e.closed && t.subscribe(e);
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
1436
|
function be(n) {
|
|
1437
1437
|
const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
|
|
1438
|
-
return new
|
|
1439
|
-
const
|
|
1440
|
-
let
|
|
1438
|
+
return new y((a) => {
|
|
1439
|
+
const u = new AbortController();
|
|
1440
|
+
let c, h = !1, m = !1;
|
|
1441
1441
|
const v = {
|
|
1442
1442
|
"Content-Type": "application/json",
|
|
1443
1443
|
...o
|
|
@@ -1448,7 +1448,7 @@ function be(n) {
|
|
|
1448
1448
|
method: i,
|
|
1449
1449
|
headers: v,
|
|
1450
1450
|
body: i === "POST" && r ? JSON.stringify(r) : void 0,
|
|
1451
|
-
signal:
|
|
1451
|
+
signal: u.signal,
|
|
1452
1452
|
/**
|
|
1453
1453
|
* Allow SSE to work when the page is hidden.
|
|
1454
1454
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
@@ -1456,7 +1456,7 @@ function be(n) {
|
|
|
1456
1456
|
openWhenHidden: !0,
|
|
1457
1457
|
onopen: async (p) => {
|
|
1458
1458
|
if (p.ok)
|
|
1459
|
-
|
|
1459
|
+
c = p.headers.get("X-Trace-Id") ?? void 0;
|
|
1460
1460
|
else {
|
|
1461
1461
|
let f;
|
|
1462
1462
|
try {
|
|
@@ -1468,13 +1468,13 @@ function be(n) {
|
|
|
1468
1468
|
f = null;
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
a.error(new w(p.status, p.statusText, f)),
|
|
1471
|
+
a.error(new w(p.status, p.statusText, f)), u.abort();
|
|
1472
1472
|
}
|
|
1473
1473
|
},
|
|
1474
1474
|
onmessage: (p) => {
|
|
1475
1475
|
p.id && (h = !0);
|
|
1476
1476
|
const f = JSON.parse(p.data);
|
|
1477
|
-
|
|
1477
|
+
c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
|
|
1478
1478
|
},
|
|
1479
1479
|
onclose: () => {
|
|
1480
1480
|
a.complete();
|
|
@@ -1482,14 +1482,14 @@ function be(n) {
|
|
|
1482
1482
|
onerror: (p) => {
|
|
1483
1483
|
if (m) throw p;
|
|
1484
1484
|
if (!h)
|
|
1485
|
-
throw a.error(p),
|
|
1485
|
+
throw a.error(p), u.abort(), p;
|
|
1486
1486
|
}
|
|
1487
1487
|
}), () => {
|
|
1488
|
-
m = !0,
|
|
1488
|
+
m = !0, u.abort();
|
|
1489
1489
|
};
|
|
1490
1490
|
});
|
|
1491
1491
|
}
|
|
1492
|
-
class
|
|
1492
|
+
class un {
|
|
1493
1493
|
listeners = {};
|
|
1494
1494
|
on(t, e) {
|
|
1495
1495
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1518,7 +1518,7 @@ class Mn {
|
|
|
1518
1518
|
detached = !1;
|
|
1519
1519
|
detachTimer;
|
|
1520
1520
|
inFlight = 0;
|
|
1521
|
-
sseEmitter = new
|
|
1521
|
+
sseEmitter = new un();
|
|
1522
1522
|
transformSsePayload;
|
|
1523
1523
|
customHeaders;
|
|
1524
1524
|
constructor(t) {
|
|
@@ -1631,12 +1631,12 @@ class Mn {
|
|
|
1631
1631
|
lastActivityAt: a.lastActivityAt,
|
|
1632
1632
|
// F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
|
|
1633
1633
|
// backend / a channel with none live. metadata is the sole authority on "who is live".
|
|
1634
|
-
launchedSandboxes: (a.launchedSandboxes ?? []).map((
|
|
1635
|
-
sandboxName:
|
|
1636
|
-
sandboxBlueprintName:
|
|
1637
|
-
workingDirectory:
|
|
1638
|
-
editorServerEnabled:
|
|
1639
|
-
browserEnabled:
|
|
1634
|
+
launchedSandboxes: (a.launchedSandboxes ?? []).map((u) => ({
|
|
1635
|
+
sandboxName: u.sandboxName,
|
|
1636
|
+
sandboxBlueprintName: u.sandboxBlueprintName,
|
|
1637
|
+
workingDirectory: u.workingDirectory,
|
|
1638
|
+
editorServerEnabled: u.editorServerEnabled,
|
|
1639
|
+
browserEnabled: u.browserEnabled
|
|
1640
1640
|
}))
|
|
1641
1641
|
};
|
|
1642
1642
|
}
|
|
@@ -1769,8 +1769,8 @@ class Mn {
|
|
|
1769
1769
|
});
|
|
1770
1770
|
if (!a.ok)
|
|
1771
1771
|
throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
|
|
1772
|
-
const
|
|
1773
|
-
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename:
|
|
1772
|
+
const u = await a.blob(), c = t.split("/").pop() || "download";
|
|
1773
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: c, size: u.size }), { blob: u, filename: c };
|
|
1774
1774
|
} catch (a) {
|
|
1775
1775
|
throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
|
|
1776
1776
|
}
|
|
@@ -1857,13 +1857,13 @@ class Mn {
|
|
|
1857
1857
|
if (!a.ok)
|
|
1858
1858
|
throw new w(a.status, a.statusText, await a.text().catch(() => {
|
|
1859
1859
|
}));
|
|
1860
|
-
const
|
|
1861
|
-
return { bytesWritten: (
|
|
1860
|
+
const u = await a.json();
|
|
1861
|
+
return { bytesWritten: (u.data ?? u).bytesWritten ?? 0 };
|
|
1862
1862
|
}
|
|
1863
1863
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1864
1864
|
async sandboxFsRequest(t, e, r, s) {
|
|
1865
1865
|
const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1866
|
-
Object.entries(s).forEach(([a,
|
|
1866
|
+
Object.entries(s).forEach(([a, u]) => o.searchParams.set(a, u));
|
|
1867
1867
|
const i = await fetch(o.toString(), { method: r, headers: this.apiHeaders() });
|
|
1868
1868
|
if (!i.ok)
|
|
1869
1869
|
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
@@ -1919,7 +1919,7 @@ class Mn {
|
|
|
1919
1919
|
*/
|
|
1920
1920
|
sandboxFsWatch(t, e) {
|
|
1921
1921
|
const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/watch`);
|
|
1922
|
-
return r.searchParams.set("path", e), new
|
|
1922
|
+
return r.searchParams.set("path", e), new y((s) => {
|
|
1923
1923
|
const o = new AbortController();
|
|
1924
1924
|
return Ee(r.toString(), {
|
|
1925
1925
|
headers: this.apiHeaders(),
|
|
@@ -1958,11 +1958,11 @@ class Mn {
|
|
|
1958
1958
|
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1959
1959
|
}
|
|
1960
1960
|
}
|
|
1961
|
-
const
|
|
1961
|
+
const S = [];
|
|
1962
1962
|
for (let n = 0; n < 256; ++n)
|
|
1963
|
-
|
|
1964
|
-
function
|
|
1965
|
-
return (
|
|
1963
|
+
S.push((n + 256).toString(16).slice(1));
|
|
1964
|
+
function cn(n, t = 0) {
|
|
1965
|
+
return (S[n[t + 0]] + S[n[t + 1]] + S[n[t + 2]] + S[n[t + 3]] + "-" + S[n[t + 4]] + S[n[t + 5]] + "-" + S[n[t + 6]] + S[n[t + 7]] + "-" + S[n[t + 8]] + S[n[t + 9]] + "-" + S[n[t + 10]] + S[n[t + 11]] + S[n[t + 12]] + S[n[t + 13]] + S[n[t + 14]] + S[n[t + 15]]).toLowerCase();
|
|
1966
1966
|
}
|
|
1967
1967
|
let J;
|
|
1968
1968
|
const ln = new Uint8Array(16);
|
|
@@ -1980,7 +1980,7 @@ function fn(n, t, e) {
|
|
|
1980
1980
|
const r = n.random ?? n.rng?.() ?? dn();
|
|
1981
1981
|
if (r.length < 16)
|
|
1982
1982
|
throw new Error("Random bytes length must be >= 16");
|
|
1983
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
1983
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, cn(r);
|
|
1984
1984
|
}
|
|
1985
1985
|
function Ke(n, t, e) {
|
|
1986
1986
|
return ve.randomUUID && !n ? ve.randomUUID() : fn(n);
|
|
@@ -2309,7 +2309,7 @@ const pn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
|
2309
2309
|
function mn(n) {
|
|
2310
2310
|
return n.toolsetName === "" && pn.has(n.toolName);
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function Se(n) {
|
|
2313
2313
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2314
2314
|
}
|
|
2315
2315
|
function I(n) {
|
|
@@ -2320,7 +2320,7 @@ function gn(n) {
|
|
|
2320
2320
|
for (const r of n) {
|
|
2321
2321
|
const s = r.parameter ?? {}, o = r.sidecar ?? {};
|
|
2322
2322
|
if (r.toolName === "TaskCreate") {
|
|
2323
|
-
const i =
|
|
2323
|
+
const i = Se(o.task), a = I(i?.id);
|
|
2324
2324
|
if (!a) continue;
|
|
2325
2325
|
e.has(a) || t.push(a), e.set(a, {
|
|
2326
2326
|
id: a,
|
|
@@ -2331,10 +2331,10 @@ function gn(n) {
|
|
|
2331
2331
|
// initial status = pending (keep existing on repeat)
|
|
2332
2332
|
});
|
|
2333
2333
|
} else if (r.toolName === "TaskUpdate") {
|
|
2334
|
-
const i =
|
|
2335
|
-
if (!a || !
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2334
|
+
const i = Se(o.statusChange), a = I(s.taskId) || I(o.taskId), u = I(i?.to) || I(s.status);
|
|
2335
|
+
if (!a || !u) continue;
|
|
2336
|
+
const c = e.get(a);
|
|
2337
|
+
c && e.set(a, { ...c, status: u });
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
2340
2340
|
return t.map((r) => e.get(r));
|
|
@@ -2345,10 +2345,10 @@ function bn(n) {
|
|
|
2345
2345
|
function vn(n) {
|
|
2346
2346
|
return !!n;
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2348
|
+
function ye(n) {
|
|
2349
2349
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2350
2350
|
}
|
|
2351
|
-
function
|
|
2351
|
+
function Sn(n) {
|
|
2352
2352
|
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));
|
|
2353
2353
|
for (const o of n)
|
|
2354
2354
|
switch (o.kind) {
|
|
@@ -2359,11 +2359,11 @@ function yn(n) {
|
|
|
2359
2359
|
}
|
|
2360
2360
|
case "subagentStart": {
|
|
2361
2361
|
const i = s(o.parentToolUseId);
|
|
2362
|
-
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description,
|
|
2362
|
+
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description, ye(i);
|
|
2363
2363
|
break;
|
|
2364
2364
|
}
|
|
2365
2365
|
case "toolStart": {
|
|
2366
|
-
|
|
2366
|
+
ye(s(o.parentToolUseId)), r.get(o.parentToolUseId).set(o.toolUseId, {
|
|
2367
2367
|
toolsetName: o.toolsetName,
|
|
2368
2368
|
toolName: o.toolName,
|
|
2369
2369
|
parameter: o.parameter ?? {},
|
|
@@ -2389,7 +2389,7 @@ function yn(n) {
|
|
|
2389
2389
|
tools: Array.from(r.get(o).values())
|
|
2390
2390
|
}));
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function yn(n) {
|
|
2393
2393
|
return typeof n == "string" ? n : void 0;
|
|
2394
2394
|
}
|
|
2395
2395
|
function wn(n) {
|
|
@@ -2399,7 +2399,7 @@ function wn(n) {
|
|
|
2399
2399
|
t.push({
|
|
2400
2400
|
kind: "agentStart",
|
|
2401
2401
|
toolUseId: e.toolUseId ?? e.messageId,
|
|
2402
|
-
description:
|
|
2402
|
+
description: yn(e.parameter.description)
|
|
2403
2403
|
});
|
|
2404
2404
|
continue;
|
|
2405
2405
|
}
|
|
@@ -2447,7 +2447,7 @@ function En(n) {
|
|
|
2447
2447
|
return gn(t);
|
|
2448
2448
|
}
|
|
2449
2449
|
function In(n) {
|
|
2450
|
-
return
|
|
2450
|
+
return Sn(wn(Array.from(n.messages?.values() ?? [])));
|
|
2451
2451
|
}
|
|
2452
2452
|
function Tn(n, t) {
|
|
2453
2453
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
|
|
@@ -2468,9 +2468,9 @@ function xn(n, t) {
|
|
|
2468
2468
|
});
|
|
2469
2469
|
}
|
|
2470
2470
|
function On(n) {
|
|
2471
|
-
const t = new
|
|
2472
|
-
return r.add(n.pipe(R(En),
|
|
2473
|
-
n.pipe(R(In),
|
|
2471
|
+
const t = new T([]), e = new T([]), r = new j();
|
|
2472
|
+
return r.add(n.pipe(R(En), U(Tn)).subscribe(t)), r.add(
|
|
2473
|
+
n.pipe(R(In), U(xn)).subscribe(e)
|
|
2474
2474
|
), {
|
|
2475
2475
|
tasks$: t.asObservable(),
|
|
2476
2476
|
subagents$: e.asObservable(),
|
|
@@ -2501,6 +2501,7 @@ class q {
|
|
|
2501
2501
|
runStatusSubject;
|
|
2502
2502
|
conversation$;
|
|
2503
2503
|
channelTitleSubject;
|
|
2504
|
+
promptSuggestionSubject;
|
|
2504
2505
|
sandboxPhaseSubject;
|
|
2505
2506
|
launchedSandboxesSubject;
|
|
2506
2507
|
// Sandboxes hinted live by an `asgard.sandbox.launch` frame but not yet confirmed by metadata (F-019).
|
|
@@ -2515,6 +2516,12 @@ class q {
|
|
|
2515
2516
|
subagents$;
|
|
2516
2517
|
/** Reactive channel title store (F-016): seeded from metadata, updated by `title.update`; replay-safe. */
|
|
2517
2518
|
channelTitle$;
|
|
2519
|
+
/**
|
|
2520
|
+
* Reactive next-turn suggestion store (F-028): fed by `asgard.prompt_suggestion`, cleared when the
|
|
2521
|
+
* prediction expires. Live-only — a rejoin replay carries no such event, so this legitimately stays
|
|
2522
|
+
* `null` after a reload. Never seeded: there is no metadata source for it.
|
|
2523
|
+
*/
|
|
2524
|
+
promptSuggestion$;
|
|
2518
2525
|
/** Reactive sandbox cold-start phase store (F-018): per-slice, derived from the last sandbox event; replay-safe. */
|
|
2519
2526
|
sandboxPhase$;
|
|
2520
2527
|
/** Reactive live-sandbox list store (F-019): authoritative from `/channel/metadata`, per-slice; replay-safe. */
|
|
@@ -2543,9 +2550,9 @@ class q {
|
|
|
2543
2550
|
throw new Error("client must be required");
|
|
2544
2551
|
if (!t.customChannelId)
|
|
2545
2552
|
throw new Error("customChannelId must be required");
|
|
2546
|
-
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new
|
|
2553
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new T(!1), this.runStatusSubject = new T(Q), this.conversation$ = new T(t.conversation), this.channelTitleSubject = new T(t.channelTitle ?? null), this.promptSuggestionSubject = new T(null), this.sandboxPhaseSubject = new T("idle"), this.launchedSandboxesSubject = new T(
|
|
2547
2554
|
we(t.launchedSandboxes ?? [])
|
|
2548
|
-
), this.derivedStores = On(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(
|
|
2555
|
+
), this.derivedStores = On(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(U()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(U()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(U()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(U()), this.runStatus$ = this.runStatusSubject.pipe(U(Pn)), this.statesObserver = t.statesObserver;
|
|
2549
2556
|
}
|
|
2550
2557
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2551
2558
|
getTasks() {
|
|
@@ -2559,6 +2566,18 @@ class q {
|
|
|
2559
2566
|
getChannelTitle() {
|
|
2560
2567
|
return this.channelTitleSubject.value;
|
|
2561
2568
|
}
|
|
2569
|
+
/** Current next-turn suggestion snapshot (F-028) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2570
|
+
getPromptSuggestion() {
|
|
2571
|
+
return this.promptSuggestionSubject.value;
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* Drop the current suggestion (F-028). Called when the prediction has expired: the user adopted it
|
|
2575
|
+
* (it is in the textarea now, and re-offering it would duplicate the text), or a send / a new run
|
|
2576
|
+
* made it stale. Losing focus is deliberately NOT one of those moments.
|
|
2577
|
+
*/
|
|
2578
|
+
clearPromptSuggestion() {
|
|
2579
|
+
this.promptSuggestionSubject.next(null);
|
|
2580
|
+
}
|
|
2562
2581
|
/** Current sandbox phase snapshot (F-018) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2563
2582
|
getSandboxPhase() {
|
|
2564
2583
|
return this.sandboxPhaseSubject.value;
|
|
@@ -2648,6 +2667,7 @@ class q {
|
|
|
2648
2667
|
this.derivedStores.tasks$,
|
|
2649
2668
|
this.derivedStores.subagents$,
|
|
2650
2669
|
this.channelTitle$,
|
|
2670
|
+
this.promptSuggestion$,
|
|
2651
2671
|
this.sandboxPhase$,
|
|
2652
2672
|
this.launchedSandboxes$,
|
|
2653
2673
|
this.runStatus$
|
|
@@ -2661,6 +2681,7 @@ class q {
|
|
|
2661
2681
|
o,
|
|
2662
2682
|
i,
|
|
2663
2683
|
a,
|
|
2684
|
+
u,
|
|
2664
2685
|
c
|
|
2665
2686
|
]) => ({
|
|
2666
2687
|
isConnecting: t,
|
|
@@ -2668,8 +2689,9 @@ class q {
|
|
|
2668
2689
|
tasks: r,
|
|
2669
2690
|
subagents: s,
|
|
2670
2691
|
channelTitle: o,
|
|
2671
|
-
|
|
2672
|
-
|
|
2692
|
+
promptSuggestion: i,
|
|
2693
|
+
sandboxPhase: a,
|
|
2694
|
+
launchedSandboxes: u,
|
|
2673
2695
|
runStatus: c
|
|
2674
2696
|
})
|
|
2675
2697
|
)
|
|
@@ -2719,7 +2741,9 @@ class q {
|
|
|
2719
2741
|
onSseMessage: (s) => {
|
|
2720
2742
|
if (t?.onSseMessage?.(s), this.captureRequestId(s.requestId), s.eventType === l.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
2721
2743
|
s.fact.channelTitleUpdate.title
|
|
2722
|
-
),
|
|
2744
|
+
), s.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
|
|
2745
|
+
s.fact.promptSuggestion.suggestion
|
|
2746
|
+
) : s.eventType === l.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(s.eventType), s.eventType === l.SANDBOX_LAUNCH && this.noteSandboxLaunch(s.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && s.traceId) {
|
|
2723
2747
|
const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
|
|
2724
2748
|
i && i.type === "user" && (o.set(this.currentUserMessageId, {
|
|
2725
2749
|
...i,
|
|
@@ -2796,6 +2820,7 @@ class q {
|
|
|
2796
2820
|
if (r) return Promise.reject(new Z(r));
|
|
2797
2821
|
const s = this.conversation$.value.pendingConsent;
|
|
2798
2822
|
if (s) return Promise.reject(new ee(s.processId));
|
|
2823
|
+
this.clearPromptSuggestion();
|
|
2799
2824
|
const o = t.text.trim(), i = t.customMessageId ?? Ke();
|
|
2800
2825
|
return this.currentUserMessageId = i, this.lastSentMessageId = i, this.conversation$.next(
|
|
2801
2826
|
this.conversation$.value.pushMessage({
|
|
@@ -2947,7 +2972,7 @@ class q {
|
|
|
2947
2972
|
this.currentRun?.unsubscribe(), this.currentRun = void 0, this.clearForceStopTimer(), this.isConnecting$.complete(), this.runStatusSubject.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.launchedSandboxesSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
2948
2973
|
}
|
|
2949
2974
|
}
|
|
2950
|
-
function
|
|
2975
|
+
function Nn(n) {
|
|
2951
2976
|
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
2952
2977
|
if (!t) return null;
|
|
2953
2978
|
const e = decodeURIComponent(t[1]), r = t[2], s = new URLSearchParams(t[3] ?? "");
|
|
@@ -2975,14 +3000,14 @@ export {
|
|
|
2975
3000
|
En as deriveTasks,
|
|
2976
3001
|
bn as isAgentTool,
|
|
2977
3002
|
Un as isChannelAwaitingConsentError,
|
|
2978
|
-
|
|
2979
|
-
|
|
3003
|
+
Ln as isChannelBusyError,
|
|
3004
|
+
_n as isHttpError,
|
|
2980
3005
|
vn as isSubagentChildTool,
|
|
2981
3006
|
mn as isTaskTool,
|
|
2982
3007
|
we as reconcileLaunched,
|
|
2983
|
-
|
|
3008
|
+
Sn as reduceSubagents,
|
|
2984
3009
|
gn as reduceTaskEvents,
|
|
2985
|
-
|
|
3010
|
+
Nn as resolveSandboxUri,
|
|
2986
3011
|
xn as subagentsEqual,
|
|
2987
3012
|
Tn as tasksEqual
|
|
2988
3013
|
};
|