@asgard-js/core 0.3.62 → 0.3.64
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 +5 -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 +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +769 -702
- package/dist/index.mjs.map +1 -1
- package/dist/lib/canvas-stream.spec.d.ts +2 -0
- package/dist/lib/canvas-stream.spec.d.ts.map +1 -0
- package/dist/lib/conversation.d.ts +9 -0
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/types/channel.d.ts +23 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +26 -1
- package/dist/types/sse-response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12,8 +12,8 @@ class w extends Error {
|
|
|
12
12
|
// `body` is optional because every construction site derives it from a response whose text or JSON
|
|
13
13
|
// may fail to parse, yielding `undefined` or `null`. An absent body is therefore a normal outcome
|
|
14
14
|
// rather than a caller mistake, and a test raising a status-only error need not pass a filler value.
|
|
15
|
-
constructor(t, e,
|
|
16
|
-
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body =
|
|
15
|
+
constructor(t, e, s) {
|
|
16
|
+
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = s;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function _n(n) {
|
|
@@ -43,65 +43,65 @@ class ee extends Error {
|
|
|
43
43
|
super("Cannot send this turn while the channel is awaiting a tool-call consent response."), this.name = "ChannelAwaitingConsentError", this.processId = t;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Mn(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.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 || {}),
|
|
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.MESSAGE_CANVAS_START = "asgard.message.canvas.start", n.MESSAGE_CANVAS_DELTA = "asgard.message.canvas.delta", n.MESSAGE_CANVAS_COMPLETE = "asgard.message.canvas.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 || {}), Ie = /* @__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.CANVAS = "CANVAS", n))(Ie || {});
|
|
50
50
|
async function ze(n, t) {
|
|
51
51
|
const e = n.getReader();
|
|
52
|
-
let
|
|
53
|
-
for (; !(
|
|
54
|
-
t(
|
|
52
|
+
let s;
|
|
53
|
+
for (; !(s = await e.read()).done; )
|
|
54
|
+
t(s.value);
|
|
55
55
|
}
|
|
56
56
|
function Je(n) {
|
|
57
|
-
let t, e,
|
|
57
|
+
let t, e, s, r = !1;
|
|
58
58
|
return function(i) {
|
|
59
|
-
t === void 0 ? (t = i, e = 0,
|
|
59
|
+
t === void 0 ? (t = i, e = 0, s = -1) : t = Ze(t, i);
|
|
60
60
|
const a = t.length;
|
|
61
|
-
let
|
|
61
|
+
let c = 0;
|
|
62
62
|
for (; e < a; ) {
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
for (; e < a &&
|
|
63
|
+
r && (t[e] === 10 && (c = ++e), r = !1);
|
|
64
|
+
let u = -1;
|
|
65
|
+
for (; e < a && u === -1; ++e)
|
|
66
66
|
switch (t[e]) {
|
|
67
67
|
case 58:
|
|
68
|
-
|
|
68
|
+
s === -1 && (s = e - c);
|
|
69
69
|
break;
|
|
70
70
|
case 13:
|
|
71
|
-
|
|
71
|
+
r = !0;
|
|
72
72
|
case 10:
|
|
73
|
-
|
|
73
|
+
u = e;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (u === -1)
|
|
77
77
|
break;
|
|
78
|
-
n(t.subarray(
|
|
78
|
+
n(t.subarray(c, u), s), c = e, s = -1;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
function Qe(n, t, e) {
|
|
84
|
-
let
|
|
85
|
-
const
|
|
84
|
+
let s = ue();
|
|
85
|
+
const r = new TextDecoder();
|
|
86
86
|
return function(i, a) {
|
|
87
87
|
if (i.length === 0)
|
|
88
|
-
e?.(
|
|
88
|
+
e?.(s), s = ue();
|
|
89
89
|
else if (a > 0) {
|
|
90
|
-
const
|
|
91
|
-
switch (
|
|
90
|
+
const c = r.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), h = r.decode(i.subarray(u));
|
|
91
|
+
switch (c) {
|
|
92
92
|
case "data":
|
|
93
|
-
|
|
93
|
+
s.data = s.data ? s.data + `
|
|
94
94
|
` + h : h;
|
|
95
95
|
break;
|
|
96
96
|
case "event":
|
|
97
|
-
|
|
97
|
+
s.event = h;
|
|
98
98
|
break;
|
|
99
99
|
case "id":
|
|
100
|
-
n(
|
|
100
|
+
n(s.id = h);
|
|
101
101
|
break;
|
|
102
102
|
case "retry":
|
|
103
103
|
const m = parseInt(h, 10);
|
|
104
|
-
isNaN(m) || t(
|
|
104
|
+
isNaN(m) || t(s.retry = m);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -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 ue() {
|
|
115
115
|
return {
|
|
116
116
|
data: "",
|
|
117
117
|
event: "",
|
|
@@ -121,33 +121,33 @@ function ce() {
|
|
|
121
121
|
}
|
|
122
122
|
var et = function(n, t) {
|
|
123
123
|
var e = {};
|
|
124
|
-
for (var
|
|
124
|
+
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && t.indexOf(s) < 0 && (e[s] = n[s]);
|
|
125
125
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
126
|
-
for (var
|
|
127
|
-
t.indexOf(r
|
|
126
|
+
for (var r = 0, s = Object.getOwnPropertySymbols(n); r < s.length; r++)
|
|
127
|
+
t.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (e[s[r]] = n[s[r]]);
|
|
128
128
|
return e;
|
|
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:
|
|
132
|
+
var { signal: e, headers: s, onopen: r, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = t, h = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
|
-
const d = Object.assign({},
|
|
134
|
+
const d = Object.assign({}, s);
|
|
135
135
|
d.accept || (d.accept = te);
|
|
136
136
|
let p;
|
|
137
137
|
function f() {
|
|
138
|
-
p.abort(), document.hidden ||
|
|
138
|
+
p.abort(), document.hidden || W();
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
let _ = tt,
|
|
140
|
+
c || document.addEventListener("visibilitychange", f);
|
|
141
|
+
let _ = tt, I = 0;
|
|
142
142
|
function L() {
|
|
143
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
143
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(I), p.abort();
|
|
144
144
|
}
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
146
|
L(), m();
|
|
147
147
|
});
|
|
148
|
-
const Ye =
|
|
149
|
-
async function
|
|
150
|
-
var
|
|
148
|
+
const Ye = u ?? window.fetch, We = r ?? nt;
|
|
149
|
+
async function W() {
|
|
150
|
+
var X;
|
|
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 }));
|
|
@@ -159,14 +159,14 @@ function Ee(n, t) {
|
|
|
159
159
|
} catch (H) {
|
|
160
160
|
if (!p.signal.aborted)
|
|
161
161
|
try {
|
|
162
|
-
const x = (
|
|
163
|
-
window.clearTimeout(
|
|
162
|
+
const x = (X = a?.(H)) !== null && X !== void 0 ? X : _;
|
|
163
|
+
window.clearTimeout(I), I = window.setTimeout(W, x);
|
|
164
164
|
} catch (x) {
|
|
165
165
|
L(), v(x);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
W();
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
function nt(n) {
|
|
@@ -175,10 +175,10 @@ function nt(n) {
|
|
|
175
175
|
throw new Error(`Expected content-type to be ${te}, Actual: ${t}`);
|
|
176
176
|
}
|
|
177
177
|
var ne = function(n, t) {
|
|
178
|
-
return ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e,
|
|
179
|
-
e.__proto__ =
|
|
180
|
-
} || function(e,
|
|
181
|
-
for (var
|
|
178
|
+
return ne = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, s) {
|
|
179
|
+
e.__proto__ = s;
|
|
180
|
+
} || function(e, s) {
|
|
181
|
+
for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
|
|
182
182
|
}, ne(n, t);
|
|
183
183
|
};
|
|
184
184
|
function C(n, t) {
|
|
@@ -190,8 +190,8 @@ function C(n, t) {
|
|
|
190
190
|
}
|
|
191
191
|
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
function
|
|
193
|
+
function st(n, t, e, s) {
|
|
194
|
+
function r(o) {
|
|
195
195
|
return o instanceof e ? o : new e(function(i) {
|
|
196
196
|
i(o);
|
|
197
197
|
});
|
|
@@ -199,90 +199,90 @@ 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
|
+
u(s.next(h));
|
|
203
203
|
} catch (m) {
|
|
204
204
|
i(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function c(h) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
u(s.throw(h));
|
|
210
210
|
} catch (m) {
|
|
211
211
|
i(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
h.done ? o(h.value) :
|
|
214
|
+
function u(h) {
|
|
215
|
+
h.done ? o(h.value) : r(h.value).then(a, c);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
u((s = s.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Te(n, t) {
|
|
221
221
|
var e = { label: 0, sent: function() {
|
|
222
222
|
if (o[0] & 1) throw o[1];
|
|
223
223
|
return o[1];
|
|
224
|
-
}, trys: [], ops: [] },
|
|
224
|
+
}, trys: [], ops: [] }, s, r, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
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(u) {
|
|
229
229
|
return function(h) {
|
|
230
|
-
return
|
|
230
|
+
return c([u, h]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function u
|
|
234
|
-
if (
|
|
235
|
-
for (; i && (i = 0,
|
|
236
|
-
if (
|
|
237
|
-
switch (
|
|
233
|
+
function c(u) {
|
|
234
|
+
if (s) throw new TypeError("Generator is already executing.");
|
|
235
|
+
for (; i && (i = 0, u[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (s = 1, r && (o = u[0] & 2 ? r.return : u[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, u[1])).done) return o;
|
|
237
|
+
switch (r = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
o =
|
|
240
|
+
o = u;
|
|
241
241
|
break;
|
|
242
242
|
case 4:
|
|
243
|
-
return e.label++, { value:
|
|
243
|
+
return e.label++, { value: u[1], done: !1 };
|
|
244
244
|
case 5:
|
|
245
|
-
e.label++,
|
|
245
|
+
e.label++, r = u[1], u = [0];
|
|
246
246
|
continue;
|
|
247
247
|
case 7:
|
|
248
|
-
|
|
248
|
+
u = 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]) && (u[0] === 6 || u[0] === 2)) {
|
|
252
252
|
e = 0;
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
|
-
if (
|
|
256
|
-
e.label =
|
|
255
|
+
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
|
256
|
+
e.label = u[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
e.label = o[1], o =
|
|
259
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
260
|
+
e.label = o[1], o = u;
|
|
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(u);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
o[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
270
|
+
u = t.call(n, e);
|
|
271
271
|
} catch (h) {
|
|
272
|
-
|
|
272
|
+
u = [6, h], r = 0;
|
|
273
273
|
} finally {
|
|
274
|
-
|
|
274
|
+
s = o = 0;
|
|
275
275
|
}
|
|
276
|
-
if (
|
|
277
|
-
return { value:
|
|
276
|
+
if (u[0] & 5) throw u[1];
|
|
277
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
function k(n) {
|
|
281
|
-
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t],
|
|
281
|
+
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], s = 0;
|
|
282
282
|
if (e) return e.call(n);
|
|
283
283
|
if (n && typeof n.length == "number") return {
|
|
284
284
|
next: function() {
|
|
285
|
-
return n &&
|
|
285
|
+
return n && s >= n.length && (n = void 0), { value: n && n[s++], done: !n };
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
288
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
@@ -290,14 +290,14 @@ function k(n) {
|
|
|
290
290
|
function D(n, t) {
|
|
291
291
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
292
292
|
if (!e) return n;
|
|
293
|
-
var
|
|
293
|
+
var s = e.call(n), r, o = [], i;
|
|
294
294
|
try {
|
|
295
|
-
for (; (t === void 0 || t-- > 0) && !(
|
|
295
|
+
for (; (t === void 0 || t-- > 0) && !(r = s.next()).done; ) o.push(r.value);
|
|
296
296
|
} catch (a) {
|
|
297
297
|
i = { error: a };
|
|
298
298
|
} finally {
|
|
299
299
|
try {
|
|
300
|
-
|
|
300
|
+
r && !r.done && (e = s.return) && e.call(s);
|
|
301
301
|
} finally {
|
|
302
302
|
if (i) throw i.error;
|
|
303
303
|
}
|
|
@@ -305,84 +305,84 @@ function D(n, t) {
|
|
|
305
305
|
return o;
|
|
306
306
|
}
|
|
307
307
|
function F(n, t, e) {
|
|
308
|
-
if (e || arguments.length === 2) for (var
|
|
309
|
-
(o || !(
|
|
308
|
+
if (e || arguments.length === 2) for (var s = 0, r = t.length, o; s < r; s++)
|
|
309
|
+
(o || !(s in t)) && (o || (o = Array.prototype.slice.call(t, 0, s)), o[s] = t[s]);
|
|
310
310
|
return n.concat(o || Array.prototype.slice.call(t));
|
|
311
311
|
}
|
|
312
312
|
function N(n) {
|
|
313
313
|
return this instanceof N ? (this.v = n, this) : new N(n);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function rt(n, t, e) {
|
|
316
316
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
317
|
-
var
|
|
318
|
-
return
|
|
317
|
+
var s = e.apply(n, t || []), r, o = [];
|
|
318
|
+
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), r[Symbol.asyncIterator] = function() {
|
|
319
319
|
return this;
|
|
320
|
-
},
|
|
320
|
+
}, r;
|
|
321
321
|
function i(d) {
|
|
322
322
|
return function(p) {
|
|
323
323
|
return Promise.resolve(p).then(d, m);
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
326
|
function a(d, p) {
|
|
327
|
-
|
|
328
|
-
return new Promise(function(_,
|
|
329
|
-
o.push([d, f, _,
|
|
327
|
+
s[d] && (r[d] = function(f) {
|
|
328
|
+
return new Promise(function(_, I) {
|
|
329
|
+
o.push([d, f, _, I]) > 1 || c(d, f);
|
|
330
330
|
});
|
|
331
|
-
}, p && (
|
|
331
|
+
}, p && (r[d] = p(r[d])));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function c(d, p) {
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
u(s[d](p));
|
|
336
336
|
} catch (f) {
|
|
337
337
|
v(o[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function u(d) {
|
|
341
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
|
+
c("next", d);
|
|
345
345
|
}
|
|
346
346
|
function m(d) {
|
|
347
|
-
|
|
347
|
+
c("throw", d);
|
|
348
348
|
}
|
|
349
349
|
function v(d, p) {
|
|
350
|
-
d(p), o.shift(), o.length &&
|
|
350
|
+
d(p), o.shift(), o.length && c(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 k == "function" ? k(n) : n[Symbol.iterator](), e = {},
|
|
356
|
+
return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, s("next"), s("throw"), s("return"), e[Symbol.asyncIterator] = function() {
|
|
357
357
|
return this;
|
|
358
358
|
}, e);
|
|
359
|
-
function
|
|
359
|
+
function s(o) {
|
|
360
360
|
e[o] = n[o] && function(i) {
|
|
361
|
-
return new Promise(function(a,
|
|
362
|
-
i = n[o](i),
|
|
361
|
+
return new Promise(function(a, c) {
|
|
362
|
+
i = n[o](i), r(a, c, i.done, i.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
Promise.resolve(
|
|
368
|
-
o({ value:
|
|
366
|
+
function r(o, i, a, c) {
|
|
367
|
+
Promise.resolve(c).then(function(u) {
|
|
368
|
+
o({ value: u, done: a });
|
|
369
369
|
}, i);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function b(n) {
|
|
373
373
|
return typeof n == "function";
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
var t = function(
|
|
377
|
-
Error.call(
|
|
375
|
+
function Ce(n) {
|
|
376
|
+
var t = function(s) {
|
|
377
|
+
Error.call(s), s.stack = new Error().stack;
|
|
378
378
|
}, e = n(t);
|
|
379
379
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
380
380
|
}
|
|
381
|
-
var z =
|
|
381
|
+
var z = Ce(function(n) {
|
|
382
382
|
return function(e) {
|
|
383
383
|
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
384
|
-
` + e.map(function(
|
|
385
|
-
return
|
|
384
|
+
` + e.map(function(s, r) {
|
|
385
|
+
return r + 1 + ") " + s.toString();
|
|
386
386
|
}).join(`
|
|
387
387
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
388
388
|
};
|
|
@@ -398,22 +398,22 @@ var j = (function() {
|
|
|
398
398
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
399
399
|
}
|
|
400
400
|
return n.prototype.unsubscribe = function() {
|
|
401
|
-
var t, e,
|
|
401
|
+
var t, e, s, r, o;
|
|
402
402
|
if (!this.closed) {
|
|
403
403
|
this.closed = !0;
|
|
404
404
|
var i = this._parentage;
|
|
405
405
|
if (i)
|
|
406
406
|
if (this._parentage = null, Array.isArray(i))
|
|
407
407
|
try {
|
|
408
|
-
for (var a = k(i),
|
|
409
|
-
var
|
|
410
|
-
|
|
408
|
+
for (var a = k(i), c = a.next(); !c.done; c = a.next()) {
|
|
409
|
+
var u = c.value;
|
|
410
|
+
u.remove(this);
|
|
411
411
|
}
|
|
412
412
|
} catch (f) {
|
|
413
413
|
t = { error: f };
|
|
414
414
|
} finally {
|
|
415
415
|
try {
|
|
416
|
-
|
|
416
|
+
c && !c.done && (e = a.return) && e.call(a);
|
|
417
417
|
} finally {
|
|
418
418
|
if (t) throw t.error;
|
|
419
419
|
}
|
|
@@ -421,7 +421,7 @@ var j = (function() {
|
|
|
421
421
|
else
|
|
422
422
|
i.remove(this);
|
|
423
423
|
var h = this.initialTeardown;
|
|
424
|
-
if (
|
|
424
|
+
if (b(h))
|
|
425
425
|
try {
|
|
426
426
|
h();
|
|
427
427
|
} catch (f) {
|
|
@@ -440,12 +440,12 @@ var j = (function() {
|
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
} catch (f) {
|
|
443
|
-
|
|
443
|
+
s = { error: f };
|
|
444
444
|
} finally {
|
|
445
445
|
try {
|
|
446
|
-
d && !d.done && (
|
|
446
|
+
d && !d.done && (r = v.return) && r.call(v);
|
|
447
447
|
} finally {
|
|
448
|
-
if (
|
|
448
|
+
if (s) throw s.error;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
}
|
|
@@ -481,19 +481,19 @@ var j = (function() {
|
|
|
481
481
|
var t = new n();
|
|
482
482
|
return t.closed = !0, t;
|
|
483
483
|
})(), n;
|
|
484
|
-
})(),
|
|
485
|
-
function
|
|
486
|
-
return n instanceof j || n && "closed" in n &&
|
|
484
|
+
})(), xe = j.EMPTY;
|
|
485
|
+
function Ae(n) {
|
|
486
|
+
return n instanceof j || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
|
|
487
487
|
}
|
|
488
488
|
function de(n) {
|
|
489
|
-
|
|
489
|
+
b(n) ? n() : n.unsubscribe();
|
|
490
490
|
}
|
|
491
491
|
var it = {
|
|
492
492
|
Promise: void 0
|
|
493
493
|
}, at = {
|
|
494
494
|
setTimeout: function(n, t) {
|
|
495
|
-
for (var e = [],
|
|
496
|
-
e[
|
|
495
|
+
for (var e = [], s = 2; s < arguments.length; s++)
|
|
496
|
+
e[s - 2] = arguments[s];
|
|
497
497
|
return setTimeout.apply(void 0, F([n, t], D(e)));
|
|
498
498
|
},
|
|
499
499
|
clearTimeout: function(n) {
|
|
@@ -506,7 +506,7 @@ function Oe(n) {
|
|
|
506
506
|
throw n;
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function se() {
|
|
510
510
|
}
|
|
511
511
|
function B(n) {
|
|
512
512
|
n();
|
|
@@ -514,11 +514,11 @@ function B(n) {
|
|
|
514
514
|
var oe = (function(n) {
|
|
515
515
|
C(t, n);
|
|
516
516
|
function t(e) {
|
|
517
|
-
var
|
|
518
|
-
return
|
|
517
|
+
var s = n.call(this) || this;
|
|
518
|
+
return s.isStopped = !1, e ? (s.destination = e, Ae(e) && e.add(s)) : s.destination = lt, s;
|
|
519
519
|
}
|
|
520
|
-
return t.create = function(e,
|
|
521
|
-
return new
|
|
520
|
+
return t.create = function(e, s, r) {
|
|
521
|
+
return new re(e, s, r);
|
|
522
522
|
}, t.prototype.next = function(e) {
|
|
523
523
|
this.isStopped || this._next(e);
|
|
524
524
|
}, t.prototype.error = function(e) {
|
|
@@ -542,7 +542,7 @@ var oe = (function(n) {
|
|
|
542
542
|
this.unsubscribe();
|
|
543
543
|
}
|
|
544
544
|
}, t;
|
|
545
|
-
})(j),
|
|
545
|
+
})(j), ct = (function() {
|
|
546
546
|
function n(t) {
|
|
547
547
|
this.partialObserver = t;
|
|
548
548
|
}
|
|
@@ -551,16 +551,16 @@ var oe = (function(n) {
|
|
|
551
551
|
if (e.next)
|
|
552
552
|
try {
|
|
553
553
|
e.next(t);
|
|
554
|
-
} catch (
|
|
555
|
-
G(
|
|
554
|
+
} catch (s) {
|
|
555
|
+
G(s);
|
|
556
556
|
}
|
|
557
557
|
}, n.prototype.error = function(t) {
|
|
558
558
|
var e = this.partialObserver;
|
|
559
559
|
if (e.error)
|
|
560
560
|
try {
|
|
561
561
|
e.error(t);
|
|
562
|
-
} catch (
|
|
563
|
-
G(
|
|
562
|
+
} catch (s) {
|
|
563
|
+
G(s);
|
|
564
564
|
}
|
|
565
565
|
else
|
|
566
566
|
G(t);
|
|
@@ -573,39 +573,39 @@ var oe = (function(n) {
|
|
|
573
573
|
G(e);
|
|
574
574
|
}
|
|
575
575
|
}, n;
|
|
576
|
-
})(),
|
|
576
|
+
})(), re = (function(n) {
|
|
577
577
|
C(t, n);
|
|
578
|
-
function t(e,
|
|
578
|
+
function t(e, s, r) {
|
|
579
579
|
var o = n.call(this) || this, i;
|
|
580
|
-
return
|
|
580
|
+
return b(e) || !e ? i = {
|
|
581
581
|
next: e ?? void 0,
|
|
582
|
-
error:
|
|
583
|
-
complete:
|
|
584
|
-
} : i = e, o.destination = new
|
|
582
|
+
error: s ?? void 0,
|
|
583
|
+
complete: r ?? void 0
|
|
584
|
+
} : i = e, o.destination = new ct(i), o;
|
|
585
585
|
}
|
|
586
586
|
return t;
|
|
587
587
|
})(oe);
|
|
588
588
|
function G(n) {
|
|
589
589
|
Oe(n);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function ut(n) {
|
|
592
592
|
throw n;
|
|
593
593
|
}
|
|
594
594
|
var lt = {
|
|
595
595
|
closed: !0,
|
|
596
|
-
next:
|
|
597
|
-
error:
|
|
598
|
-
complete:
|
|
596
|
+
next: se,
|
|
597
|
+
error: ut,
|
|
598
|
+
complete: se
|
|
599
599
|
}, ie = (function() {
|
|
600
600
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
601
601
|
})();
|
|
602
|
-
function
|
|
602
|
+
function Y(n) {
|
|
603
603
|
return n;
|
|
604
604
|
}
|
|
605
605
|
function dt(n) {
|
|
606
|
-
return n.length === 0 ?
|
|
607
|
-
return n.reduce(function(
|
|
608
|
-
return s
|
|
606
|
+
return n.length === 0 ? Y : n.length === 1 ? n[0] : function(e) {
|
|
607
|
+
return n.reduce(function(s, r) {
|
|
608
|
+
return r(s);
|
|
609
609
|
}, e);
|
|
610
610
|
};
|
|
611
611
|
}
|
|
@@ -616,11 +616,11 @@ var y = (function() {
|
|
|
616
616
|
return n.prototype.lift = function(t) {
|
|
617
617
|
var e = new n();
|
|
618
618
|
return e.source = this, e.operator = t, e;
|
|
619
|
-
}, n.prototype.subscribe = function(t, e,
|
|
620
|
-
var
|
|
619
|
+
}, n.prototype.subscribe = function(t, e, s) {
|
|
620
|
+
var r = this, o = ft(t) ? t : new re(t, e, s);
|
|
621
621
|
return B(function() {
|
|
622
|
-
var i =
|
|
623
|
-
o.add(a ? a.call(o,
|
|
622
|
+
var i = r, a = i.operator, c = i.source;
|
|
623
|
+
o.add(a ? a.call(o, c) : c ? r._subscribe(o) : r._trySubscribe(o));
|
|
624
624
|
}), o;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
@@ -629,20 +629,20 @@ var y = (function() {
|
|
|
629
629
|
t.error(e);
|
|
630
630
|
}
|
|
631
631
|
}, n.prototype.forEach = function(t, e) {
|
|
632
|
-
var
|
|
633
|
-
return e = he(e), new e(function(
|
|
634
|
-
var i = new
|
|
632
|
+
var s = this;
|
|
633
|
+
return e = he(e), new e(function(r, o) {
|
|
634
|
+
var i = new re({
|
|
635
635
|
next: function(a) {
|
|
636
636
|
try {
|
|
637
637
|
t(a);
|
|
638
|
-
} catch (
|
|
639
|
-
o(
|
|
638
|
+
} catch (c) {
|
|
639
|
+
o(c), i.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
642
|
error: o,
|
|
643
|
-
complete:
|
|
643
|
+
complete: r
|
|
644
644
|
});
|
|
645
|
-
|
|
645
|
+
s.subscribe(i);
|
|
646
646
|
});
|
|
647
647
|
}, n.prototype._subscribe = function(t) {
|
|
648
648
|
var e;
|
|
@@ -655,14 +655,14 @@ var y = (function() {
|
|
|
655
655
|
return dt(t)(this);
|
|
656
656
|
}, n.prototype.toPromise = function(t) {
|
|
657
657
|
var e = this;
|
|
658
|
-
return t = he(t), new t(function(
|
|
658
|
+
return t = he(t), new t(function(s, r) {
|
|
659
659
|
var o;
|
|
660
660
|
e.subscribe(function(i) {
|
|
661
661
|
return o = i;
|
|
662
662
|
}, function(i) {
|
|
663
|
-
return
|
|
663
|
+
return r(i);
|
|
664
664
|
}, function() {
|
|
665
|
-
return
|
|
665
|
+
return s(o);
|
|
666
666
|
});
|
|
667
667
|
});
|
|
668
668
|
}, n.create = function(t) {
|
|
@@ -674,13 +674,13 @@ function he(n) {
|
|
|
674
674
|
return (t = n ?? it.Promise) !== null && t !== void 0 ? t : Promise;
|
|
675
675
|
}
|
|
676
676
|
function ht(n) {
|
|
677
|
-
return n &&
|
|
677
|
+
return n && b(n.next) && b(n.error) && b(n.complete);
|
|
678
678
|
}
|
|
679
679
|
function ft(n) {
|
|
680
|
-
return n && n instanceof oe || ht(n) &&
|
|
680
|
+
return n && n instanceof oe || ht(n) && Ae(n);
|
|
681
681
|
}
|
|
682
682
|
function pt(n) {
|
|
683
|
-
return
|
|
683
|
+
return b(n?.lift);
|
|
684
684
|
}
|
|
685
685
|
function P(n) {
|
|
686
686
|
return function(t) {
|
|
@@ -688,52 +688,52 @@ function P(n) {
|
|
|
688
688
|
return t.lift(function(e) {
|
|
689
689
|
try {
|
|
690
690
|
return n(e, this);
|
|
691
|
-
} catch (
|
|
692
|
-
this.error(
|
|
691
|
+
} catch (s) {
|
|
692
|
+
this.error(s);
|
|
693
693
|
}
|
|
694
694
|
});
|
|
695
695
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return new mt(n, t, e,
|
|
698
|
+
function O(n, t, e, s, r) {
|
|
699
|
+
return new mt(n, t, e, s, r);
|
|
700
700
|
}
|
|
701
701
|
var mt = (function(n) {
|
|
702
702
|
C(t, n);
|
|
703
|
-
function t(e,
|
|
704
|
-
var
|
|
705
|
-
return
|
|
703
|
+
function t(e, s, r, o, i, a) {
|
|
704
|
+
var c = n.call(this, e) || this;
|
|
705
|
+
return c.onFinalize = i, c.shouldUnsubscribe = a, c._next = s ? function(u) {
|
|
706
706
|
try {
|
|
707
|
-
|
|
707
|
+
s(u);
|
|
708
708
|
} catch (h) {
|
|
709
709
|
e.error(h);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next,
|
|
711
|
+
} : n.prototype._next, c._error = o ? function(u) {
|
|
712
712
|
try {
|
|
713
|
-
o(
|
|
713
|
+
o(u);
|
|
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, c._complete = r ? function() {
|
|
720
720
|
try {
|
|
721
|
-
|
|
722
|
-
} catch (
|
|
723
|
-
e.error(
|
|
721
|
+
r();
|
|
722
|
+
} catch (u) {
|
|
723
|
+
e.error(u);
|
|
724
724
|
} finally {
|
|
725
725
|
this.unsubscribe();
|
|
726
726
|
}
|
|
727
|
-
} : n.prototype._complete,
|
|
727
|
+
} : n.prototype._complete, c;
|
|
728
728
|
}
|
|
729
729
|
return t.prototype.unsubscribe = function() {
|
|
730
730
|
var e;
|
|
731
731
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
732
|
-
var
|
|
733
|
-
n.prototype.unsubscribe.call(this), !
|
|
732
|
+
var s = this.closed;
|
|
733
|
+
n.prototype.unsubscribe.call(this), !s && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
734
734
|
}
|
|
735
735
|
}, t;
|
|
736
|
-
})(oe), gt =
|
|
736
|
+
})(oe), gt = Ce(function(n) {
|
|
737
737
|
return function() {
|
|
738
738
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
739
739
|
};
|
|
@@ -744,40 +744,40 @@ var mt = (function(n) {
|
|
|
744
744
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
745
745
|
}
|
|
746
746
|
return t.prototype.lift = function(e) {
|
|
747
|
-
var
|
|
748
|
-
return
|
|
747
|
+
var s = new fe(this, this);
|
|
748
|
+
return s.operator = e, s;
|
|
749
749
|
}, t.prototype._throwIfClosed = function() {
|
|
750
750
|
if (this.closed)
|
|
751
751
|
throw new gt();
|
|
752
752
|
}, t.prototype.next = function(e) {
|
|
753
|
-
var
|
|
753
|
+
var s = this;
|
|
754
754
|
B(function() {
|
|
755
|
-
var
|
|
756
|
-
if (
|
|
757
|
-
|
|
755
|
+
var r, o;
|
|
756
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
757
|
+
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
758
758
|
try {
|
|
759
|
-
for (var i = k(
|
|
760
|
-
var
|
|
761
|
-
|
|
759
|
+
for (var i = k(s.currentObservers), a = i.next(); !a.done; a = i.next()) {
|
|
760
|
+
var c = a.value;
|
|
761
|
+
c.next(e);
|
|
762
762
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
|
|
763
|
+
} catch (u) {
|
|
764
|
+
r = { error: u };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
767
|
a && !a.done && (o = i.return) && o.call(i);
|
|
768
768
|
} finally {
|
|
769
|
-
if (
|
|
769
|
+
if (r) throw r.error;
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
});
|
|
774
774
|
}, t.prototype.error = function(e) {
|
|
775
|
-
var
|
|
775
|
+
var s = this;
|
|
776
776
|
B(function() {
|
|
777
|
-
if (
|
|
778
|
-
|
|
779
|
-
for (var
|
|
780
|
-
|
|
777
|
+
if (s._throwIfClosed(), !s.isStopped) {
|
|
778
|
+
s.hasError = s.isStopped = !0, s.thrownError = e;
|
|
779
|
+
for (var r = s.observers; r.length; )
|
|
780
|
+
r.shift().error(e);
|
|
781
781
|
}
|
|
782
782
|
});
|
|
783
783
|
}, t.prototype.complete = function() {
|
|
@@ -785,8 +785,8 @@ var mt = (function(n) {
|
|
|
785
785
|
B(function() {
|
|
786
786
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
787
787
|
e.isStopped = !0;
|
|
788
|
-
for (var
|
|
789
|
-
|
|
788
|
+
for (var s = e.observers; s.length; )
|
|
789
|
+
s.shift().complete();
|
|
790
790
|
}
|
|
791
791
|
});
|
|
792
792
|
}, t.prototype.unsubscribe = function() {
|
|
@@ -803,43 +803,43 @@ var mt = (function(n) {
|
|
|
803
803
|
}, t.prototype._subscribe = function(e) {
|
|
804
804
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
805
805
|
}, t.prototype._innerSubscribe = function(e) {
|
|
806
|
-
var
|
|
807
|
-
return o || i ?
|
|
808
|
-
|
|
806
|
+
var s = this, r = this, o = r.hasError, i = r.isStopped, a = r.observers;
|
|
807
|
+
return o || i ? xe : (this.currentObservers = null, a.push(e), new j(function() {
|
|
808
|
+
s.currentObservers = null, K(a, e);
|
|
809
809
|
}));
|
|
810
810
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
811
|
-
var
|
|
812
|
-
|
|
811
|
+
var s = this, r = s.hasError, o = s.thrownError, i = s.isStopped;
|
|
812
|
+
r ? e.error(o) : i && e.complete();
|
|
813
813
|
}, t.prototype.asObservable = function() {
|
|
814
814
|
var e = new y();
|
|
815
815
|
return e.source = this, e;
|
|
816
|
-
}, t.create = function(e,
|
|
817
|
-
return new fe(e,
|
|
816
|
+
}, t.create = function(e, s) {
|
|
817
|
+
return new fe(e, s);
|
|
818
818
|
}, t;
|
|
819
819
|
})(y), fe = (function(n) {
|
|
820
820
|
C(t, n);
|
|
821
|
-
function t(e,
|
|
822
|
-
var
|
|
823
|
-
return
|
|
821
|
+
function t(e, s) {
|
|
822
|
+
var r = n.call(this) || this;
|
|
823
|
+
return r.destination = e, r.source = s, r;
|
|
824
824
|
}
|
|
825
825
|
return t.prototype.next = function(e) {
|
|
826
|
-
var
|
|
827
|
-
(
|
|
826
|
+
var s, r;
|
|
827
|
+
(r = (s = this.destination) === null || s === void 0 ? void 0 : s.next) === null || r === void 0 || r.call(s, e);
|
|
828
828
|
}, t.prototype.error = function(e) {
|
|
829
|
-
var
|
|
830
|
-
(
|
|
829
|
+
var s, r;
|
|
830
|
+
(r = (s = this.destination) === null || s === void 0 ? void 0 : s.error) === null || r === void 0 || r.call(s, e);
|
|
831
831
|
}, t.prototype.complete = function() {
|
|
832
|
-
var e,
|
|
833
|
-
(
|
|
832
|
+
var e, s;
|
|
833
|
+
(s = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || s === void 0 || s.call(e);
|
|
834
834
|
}, t.prototype._subscribe = function(e) {
|
|
835
|
-
var
|
|
836
|
-
return (
|
|
835
|
+
var s, r;
|
|
836
|
+
return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r : xe;
|
|
837
837
|
}, t;
|
|
838
838
|
})(ae), T = (function(n) {
|
|
839
839
|
C(t, n);
|
|
840
840
|
function t(e) {
|
|
841
|
-
var
|
|
842
|
-
return
|
|
841
|
+
var s = n.call(this) || this;
|
|
842
|
+
return s._value = e, s;
|
|
843
843
|
}
|
|
844
844
|
return Object.defineProperty(t.prototype, "value", {
|
|
845
845
|
get: function() {
|
|
@@ -848,12 +848,12 @@ var mt = (function(n) {
|
|
|
848
848
|
enumerable: !1,
|
|
849
849
|
configurable: !0
|
|
850
850
|
}), t.prototype._subscribe = function(e) {
|
|
851
|
-
var
|
|
852
|
-
return !
|
|
851
|
+
var s = n.prototype._subscribe.call(this, e);
|
|
852
|
+
return !s.closed && e.next(this._value), s;
|
|
853
853
|
}, t.prototype.getValue = function() {
|
|
854
|
-
var e = this,
|
|
855
|
-
if (
|
|
856
|
-
throw
|
|
854
|
+
var e = this, s = e.hasError, r = e.thrownError, o = e._value;
|
|
855
|
+
if (s)
|
|
856
|
+
throw r;
|
|
857
857
|
return this._throwIfClosed(), o;
|
|
858
858
|
}, t.prototype.next = function(e) {
|
|
859
859
|
n.prototype.next.call(this, this._value = e);
|
|
@@ -864,16 +864,16 @@ var mt = (function(n) {
|
|
|
864
864
|
}
|
|
865
865
|
}, vt = (function(n) {
|
|
866
866
|
C(t, n);
|
|
867
|
-
function t(e,
|
|
867
|
+
function t(e, s) {
|
|
868
868
|
return n.call(this) || this;
|
|
869
869
|
}
|
|
870
|
-
return t.prototype.schedule = function(e,
|
|
870
|
+
return t.prototype.schedule = function(e, s) {
|
|
871
871
|
return this;
|
|
872
872
|
}, t;
|
|
873
873
|
})(j), pe = {
|
|
874
874
|
setInterval: function(n, t) {
|
|
875
|
-
for (var e = [],
|
|
876
|
-
e[
|
|
875
|
+
for (var e = [], s = 2; s < arguments.length; s++)
|
|
876
|
+
e[s - 2] = arguments[s];
|
|
877
877
|
return setInterval.apply(void 0, F([n, t], D(e)));
|
|
878
878
|
},
|
|
879
879
|
clearInterval: function(n) {
|
|
@@ -882,119 +882,119 @@ var mt = (function(n) {
|
|
|
882
882
|
delegate: void 0
|
|
883
883
|
}, St = (function(n) {
|
|
884
884
|
C(t, n);
|
|
885
|
-
function t(e,
|
|
886
|
-
var
|
|
887
|
-
return
|
|
885
|
+
function t(e, s) {
|
|
886
|
+
var r = n.call(this, e, s) || this;
|
|
887
|
+
return r.scheduler = e, r.work = s, r.pending = !1, r;
|
|
888
888
|
}
|
|
889
|
-
return t.prototype.schedule = function(e,
|
|
890
|
-
var
|
|
891
|
-
if (
|
|
889
|
+
return t.prototype.schedule = function(e, s) {
|
|
890
|
+
var r;
|
|
891
|
+
if (s === void 0 && (s = 0), this.closed)
|
|
892
892
|
return this;
|
|
893
893
|
this.state = e;
|
|
894
894
|
var o = this.id, i = this.scheduler;
|
|
895
|
-
return o != null && (this.id = this.recycleAsyncId(i, o,
|
|
896
|
-
}, t.prototype.requestAsyncId = function(e,
|
|
897
|
-
return
|
|
898
|
-
}, t.prototype.recycleAsyncId = function(e,
|
|
899
|
-
if (
|
|
900
|
-
return
|
|
901
|
-
|
|
902
|
-
}, t.prototype.execute = function(e,
|
|
895
|
+
return o != null && (this.id = this.recycleAsyncId(i, o, s)), this.pending = !0, this.delay = s, this.id = (r = this.id) !== null && r !== void 0 ? r : this.requestAsyncId(i, this.id, s), this;
|
|
896
|
+
}, t.prototype.requestAsyncId = function(e, s, r) {
|
|
897
|
+
return r === void 0 && (r = 0), pe.setInterval(e.flush.bind(e, this), r);
|
|
898
|
+
}, t.prototype.recycleAsyncId = function(e, s, r) {
|
|
899
|
+
if (r === void 0 && (r = 0), r != null && this.delay === r && this.pending === !1)
|
|
900
|
+
return s;
|
|
901
|
+
s != null && pe.clearInterval(s);
|
|
902
|
+
}, t.prototype.execute = function(e, s) {
|
|
903
903
|
if (this.closed)
|
|
904
904
|
return new Error("executing a cancelled action");
|
|
905
905
|
this.pending = !1;
|
|
906
|
-
var
|
|
907
|
-
if (
|
|
908
|
-
return
|
|
906
|
+
var r = this._execute(e, s);
|
|
907
|
+
if (r)
|
|
908
|
+
return r;
|
|
909
909
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
910
|
-
}, t.prototype._execute = function(e,
|
|
911
|
-
var
|
|
910
|
+
}, t.prototype._execute = function(e, s) {
|
|
911
|
+
var r = !1, o;
|
|
912
912
|
try {
|
|
913
913
|
this.work(e);
|
|
914
914
|
} catch (i) {
|
|
915
|
-
|
|
915
|
+
r = !0, o = i || new Error("Scheduled action threw falsy error");
|
|
916
916
|
}
|
|
917
|
-
if (
|
|
917
|
+
if (r)
|
|
918
918
|
return this.unsubscribe(), o;
|
|
919
919
|
}, t.prototype.unsubscribe = function() {
|
|
920
920
|
if (!this.closed) {
|
|
921
|
-
var e = this,
|
|
922
|
-
this.work = this.state = this.scheduler = null, this.pending = !1, K(o, this),
|
|
921
|
+
var e = this, s = e.id, r = e.scheduler, o = r.actions;
|
|
922
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, K(o, this), s != null && (this.id = this.recycleAsyncId(r, s, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
923
923
|
}
|
|
924
924
|
}, t;
|
|
925
925
|
})(vt), me = (function() {
|
|
926
926
|
function n(t, e) {
|
|
927
927
|
e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
|
|
928
928
|
}
|
|
929
|
-
return n.prototype.schedule = function(t, e,
|
|
930
|
-
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(
|
|
929
|
+
return n.prototype.schedule = function(t, e, s) {
|
|
930
|
+
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(s, e);
|
|
931
931
|
}, n.now = bt.now, n;
|
|
932
932
|
})(), yt = (function(n) {
|
|
933
933
|
C(t, n);
|
|
934
|
-
function t(e,
|
|
935
|
-
|
|
936
|
-
var
|
|
937
|
-
return
|
|
934
|
+
function t(e, s) {
|
|
935
|
+
s === void 0 && (s = me.now);
|
|
936
|
+
var r = n.call(this, e, s) || this;
|
|
937
|
+
return r.actions = [], r._active = !1, r;
|
|
938
938
|
}
|
|
939
939
|
return t.prototype.flush = function(e) {
|
|
940
|
-
var
|
|
940
|
+
var s = this.actions;
|
|
941
941
|
if (this._active) {
|
|
942
|
-
|
|
942
|
+
s.push(e);
|
|
943
943
|
return;
|
|
944
944
|
}
|
|
945
|
-
var
|
|
945
|
+
var r;
|
|
946
946
|
this._active = !0;
|
|
947
947
|
do
|
|
948
|
-
if (
|
|
948
|
+
if (r = e.execute(e.state, e.delay))
|
|
949
949
|
break;
|
|
950
|
-
while (e =
|
|
951
|
-
if (this._active = !1,
|
|
952
|
-
for (; e =
|
|
950
|
+
while (e = s.shift());
|
|
951
|
+
if (this._active = !1, r) {
|
|
952
|
+
for (; e = s.shift(); )
|
|
953
953
|
e.unsubscribe();
|
|
954
|
-
throw
|
|
954
|
+
throw r;
|
|
955
955
|
}
|
|
956
956
|
}, t;
|
|
957
|
-
})(me),
|
|
957
|
+
})(me), Pe = new yt(St), wt = Pe, It = new y(function(n) {
|
|
958
958
|
return n.complete();
|
|
959
959
|
});
|
|
960
|
-
function Pe(n) {
|
|
961
|
-
return n && g(n.schedule);
|
|
962
|
-
}
|
|
963
960
|
function _e(n) {
|
|
961
|
+
return n && b(n.schedule);
|
|
962
|
+
}
|
|
963
|
+
function Le(n) {
|
|
964
964
|
return n[n.length - 1];
|
|
965
965
|
}
|
|
966
|
-
function
|
|
967
|
-
return
|
|
966
|
+
function Et(n) {
|
|
967
|
+
return b(Le(n)) ? n.pop() : void 0;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
return
|
|
969
|
+
function Me(n) {
|
|
970
|
+
return _e(Le(n)) ? n.pop() : void 0;
|
|
971
971
|
}
|
|
972
972
|
var Ue = (function(n) {
|
|
973
973
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
974
974
|
});
|
|
975
|
-
function Me(n) {
|
|
976
|
-
return g(n?.then);
|
|
977
|
-
}
|
|
978
975
|
function Ne(n) {
|
|
979
|
-
return
|
|
976
|
+
return b(n?.then);
|
|
980
977
|
}
|
|
981
978
|
function ke(n) {
|
|
982
|
-
return
|
|
979
|
+
return b(n[ie]);
|
|
983
980
|
}
|
|
984
981
|
function Re(n) {
|
|
982
|
+
return Symbol.asyncIterator && b(n?.[Symbol.asyncIterator]);
|
|
983
|
+
}
|
|
984
|
+
function je(n) {
|
|
985
985
|
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.");
|
|
986
986
|
}
|
|
987
987
|
function Tt() {
|
|
988
988
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
989
989
|
}
|
|
990
|
-
var
|
|
991
|
-
function $e(n) {
|
|
992
|
-
return g(n?.[je]);
|
|
993
|
-
}
|
|
990
|
+
var $e = Tt();
|
|
994
991
|
function De(n) {
|
|
995
|
-
return
|
|
996
|
-
|
|
997
|
-
|
|
992
|
+
return b(n?.[$e]);
|
|
993
|
+
}
|
|
994
|
+
function Fe(n) {
|
|
995
|
+
return rt(this, arguments, function() {
|
|
996
|
+
var e, s, r, o;
|
|
997
|
+
return Te(this, function(i) {
|
|
998
998
|
switch (i.label) {
|
|
999
999
|
case 0:
|
|
1000
1000
|
e = n.getReader(), i.label = 1;
|
|
@@ -1003,11 +1003,11 @@ function De(n) {
|
|
|
1003
1003
|
case 2:
|
|
1004
1004
|
return [4, N(e.read())];
|
|
1005
1005
|
case 3:
|
|
1006
|
-
return
|
|
1006
|
+
return s = i.sent(), r = s.value, o = s.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, N(
|
|
1010
|
+
return [4, N(r)];
|
|
1011
1011
|
case 6:
|
|
1012
1012
|
return [4, i.sent()];
|
|
1013
1013
|
case 7:
|
|
@@ -1022,32 +1022,32 @@ function De(n) {
|
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
return
|
|
1025
|
+
function He(n) {
|
|
1026
|
+
return b(n?.getReader);
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function U(n) {
|
|
1029
1029
|
if (n instanceof y)
|
|
1030
1030
|
return n;
|
|
1031
1031
|
if (n != null) {
|
|
1032
|
-
if (
|
|
1032
|
+
if (ke(n))
|
|
1033
1033
|
return Ct(n);
|
|
1034
1034
|
if (Ue(n))
|
|
1035
1035
|
return xt(n);
|
|
1036
|
-
if (
|
|
1037
|
-
return Ot(n);
|
|
1038
|
-
if (ke(n))
|
|
1039
|
-
return He(n);
|
|
1040
|
-
if ($e(n))
|
|
1036
|
+
if (Ne(n))
|
|
1041
1037
|
return At(n);
|
|
1042
|
-
if (
|
|
1038
|
+
if (Re(n))
|
|
1039
|
+
return Ge(n);
|
|
1040
|
+
if (De(n))
|
|
1041
|
+
return Ot(n);
|
|
1042
|
+
if (He(n))
|
|
1043
1043
|
return Pt(n);
|
|
1044
1044
|
}
|
|
1045
|
-
throw
|
|
1045
|
+
throw je(n);
|
|
1046
1046
|
}
|
|
1047
1047
|
function Ct(n) {
|
|
1048
1048
|
return new y(function(t) {
|
|
1049
1049
|
var e = n[ie]();
|
|
1050
|
-
if (
|
|
1050
|
+
if (b(e.subscribe))
|
|
1051
1051
|
return e.subscribe(t);
|
|
1052
1052
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
1053
1053
|
});
|
|
@@ -1059,7 +1059,7 @@ function xt(n) {
|
|
|
1059
1059
|
t.complete();
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function At(n) {
|
|
1063
1063
|
return new y(function(t) {
|
|
1064
1064
|
n.then(function(e) {
|
|
1065
1065
|
t.closed || (t.next(e), t.complete());
|
|
@@ -1068,11 +1068,11 @@ function Ot(n) {
|
|
|
1068
1068
|
}).then(null, Oe);
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Ot(n) {
|
|
1072
1072
|
return new y(function(t) {
|
|
1073
|
-
var e,
|
|
1073
|
+
var e, s;
|
|
1074
1074
|
try {
|
|
1075
|
-
for (var
|
|
1075
|
+
for (var r = k(n), o = r.next(); !o.done; o = r.next()) {
|
|
1076
1076
|
var i = o.value;
|
|
1077
1077
|
if (t.next(i), t.closed)
|
|
1078
1078
|
return;
|
|
@@ -1081,7 +1081,7 @@ function At(n) {
|
|
|
1081
1081
|
e = { error: a };
|
|
1082
1082
|
} finally {
|
|
1083
1083
|
try {
|
|
1084
|
-
o && !o.done && (
|
|
1084
|
+
o && !o.done && (s = r.return) && s.call(r);
|
|
1085
1085
|
} finally {
|
|
1086
1086
|
if (e) throw e.error;
|
|
1087
1087
|
}
|
|
@@ -1089,7 +1089,7 @@ function At(n) {
|
|
|
1089
1089
|
t.complete();
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function Ge(n) {
|
|
1093
1093
|
return new y(function(t) {
|
|
1094
1094
|
_t(n, t).catch(function(e) {
|
|
1095
1095
|
return t.error(e);
|
|
@@ -1097,37 +1097,37 @@ function He(n) {
|
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
function Pt(n) {
|
|
1100
|
-
return
|
|
1100
|
+
return Ge(Fe(n));
|
|
1101
1101
|
}
|
|
1102
1102
|
function _t(n, t) {
|
|
1103
|
-
var e,
|
|
1104
|
-
return
|
|
1103
|
+
var e, s, r, o;
|
|
1104
|
+
return st(this, void 0, void 0, function() {
|
|
1105
1105
|
var i, a;
|
|
1106
|
-
return
|
|
1107
|
-
switch (
|
|
1106
|
+
return Te(this, function(c) {
|
|
1107
|
+
switch (c.label) {
|
|
1108
1108
|
case 0:
|
|
1109
|
-
|
|
1109
|
+
c.trys.push([0, 5, 6, 11]), e = ot(n), c.label = 1;
|
|
1110
1110
|
case 1:
|
|
1111
1111
|
return [4, e.next()];
|
|
1112
1112
|
case 2:
|
|
1113
|
-
if (
|
|
1114
|
-
if (i =
|
|
1113
|
+
if (s = c.sent(), !!s.done) return [3, 4];
|
|
1114
|
+
if (i = s.value, t.next(i), t.closed)
|
|
1115
1115
|
return [2];
|
|
1116
|
-
|
|
1116
|
+
c.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 = c.sent(), r = { error: a }, [3, 11];
|
|
1123
1123
|
case 6:
|
|
1124
|
-
return
|
|
1124
|
+
return c.trys.push([6, , 9, 10]), s && !s.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
|
|
1125
1125
|
case 7:
|
|
1126
|
-
|
|
1126
|
+
c.sent(), c.label = 8;
|
|
1127
1127
|
case 8:
|
|
1128
1128
|
return [3, 10];
|
|
1129
1129
|
case 9:
|
|
1130
|
-
if (
|
|
1130
|
+
if (r) throw r.error;
|
|
1131
1131
|
return [7];
|
|
1132
1132
|
case 10:
|
|
1133
1133
|
return [7];
|
|
@@ -1137,60 +1137,60 @@ function _t(n, t) {
|
|
|
1137
1137
|
});
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
|
|
1140
|
+
function A(n, t, e, s, r) {
|
|
1141
|
+
s === void 0 && (s = 0), r === void 0 && (r = !1);
|
|
1142
1142
|
var o = t.schedule(function() {
|
|
1143
|
-
e(),
|
|
1144
|
-
},
|
|
1145
|
-
if (n.add(o), !
|
|
1143
|
+
e(), r ? n.add(this.schedule(null, s)) : this.unsubscribe();
|
|
1144
|
+
}, s);
|
|
1145
|
+
if (n.add(o), !r)
|
|
1146
1146
|
return o;
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return t === void 0 && (t = 0), P(function(e,
|
|
1150
|
-
e.subscribe(
|
|
1151
|
-
return
|
|
1152
|
-
return
|
|
1148
|
+
function Be(n, t) {
|
|
1149
|
+
return t === void 0 && (t = 0), P(function(e, s) {
|
|
1150
|
+
e.subscribe(O(s, function(r) {
|
|
1151
|
+
return A(s, n, function() {
|
|
1152
|
+
return s.next(r);
|
|
1153
1153
|
}, t);
|
|
1154
1154
|
}, function() {
|
|
1155
|
-
return
|
|
1156
|
-
return
|
|
1155
|
+
return A(s, n, function() {
|
|
1156
|
+
return s.complete();
|
|
1157
1157
|
}, t);
|
|
1158
|
-
}, function(
|
|
1159
|
-
return
|
|
1160
|
-
return
|
|
1158
|
+
}, function(r) {
|
|
1159
|
+
return A(s, n, function() {
|
|
1160
|
+
return s.error(r);
|
|
1161
1161
|
}, t);
|
|
1162
1162
|
}));
|
|
1163
1163
|
});
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return t === void 0 && (t = 0), P(function(e,
|
|
1167
|
-
|
|
1168
|
-
return e.subscribe(
|
|
1165
|
+
function qe(n, t) {
|
|
1166
|
+
return t === void 0 && (t = 0), P(function(e, s) {
|
|
1167
|
+
s.add(n.schedule(function() {
|
|
1168
|
+
return e.subscribe(s);
|
|
1169
1169
|
}, t));
|
|
1170
1170
|
});
|
|
1171
1171
|
}
|
|
1172
1172
|
function Lt(n, t) {
|
|
1173
|
-
return
|
|
1174
|
-
}
|
|
1175
|
-
function Ut(n, t) {
|
|
1176
|
-
return M(n).pipe(Be(t), Ge(t));
|
|
1173
|
+
return U(n).pipe(qe(t), Be(t));
|
|
1177
1174
|
}
|
|
1178
1175
|
function Mt(n, t) {
|
|
1176
|
+
return U(n).pipe(qe(t), Be(t));
|
|
1177
|
+
}
|
|
1178
|
+
function Ut(n, t) {
|
|
1179
1179
|
return new y(function(e) {
|
|
1180
|
-
var
|
|
1180
|
+
var s = 0;
|
|
1181
1181
|
return t.schedule(function() {
|
|
1182
|
-
|
|
1182
|
+
s === n.length ? e.complete() : (e.next(n[s++]), e.closed || this.schedule());
|
|
1183
1183
|
});
|
|
1184
1184
|
});
|
|
1185
1185
|
}
|
|
1186
1186
|
function Nt(n, t) {
|
|
1187
1187
|
return new y(function(e) {
|
|
1188
|
-
var
|
|
1189
|
-
return
|
|
1190
|
-
|
|
1191
|
-
var
|
|
1188
|
+
var s;
|
|
1189
|
+
return A(e, t, function() {
|
|
1190
|
+
s = n[$e](), A(e, t, function() {
|
|
1191
|
+
var r, o, i;
|
|
1192
1192
|
try {
|
|
1193
|
-
|
|
1193
|
+
r = s.next(), o = r.value, i = r.done;
|
|
1194
1194
|
} catch (a) {
|
|
1195
1195
|
e.error(a);
|
|
1196
1196
|
return;
|
|
@@ -1198,61 +1198,61 @@ function Nt(n, t) {
|
|
|
1198
1198
|
i ? e.complete() : e.next(o);
|
|
1199
1199
|
}, 0, !0);
|
|
1200
1200
|
}), function() {
|
|
1201
|
-
return
|
|
1201
|
+
return b(s?.return) && s.return();
|
|
1202
1202
|
};
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Ke(n, t) {
|
|
1206
1206
|
if (!n)
|
|
1207
1207
|
throw new Error("Iterable cannot be null");
|
|
1208
1208
|
return new y(function(e) {
|
|
1209
|
-
|
|
1210
|
-
var
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1209
|
+
A(e, t, function() {
|
|
1210
|
+
var s = n[Symbol.asyncIterator]();
|
|
1211
|
+
A(e, t, function() {
|
|
1212
|
+
s.next().then(function(r) {
|
|
1213
|
+
r.done ? e.complete() : e.next(r.value);
|
|
1214
1214
|
});
|
|
1215
1215
|
}, 0, !0);
|
|
1216
1216
|
});
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
1219
|
function kt(n, t) {
|
|
1220
|
-
return
|
|
1220
|
+
return Ke(Fe(n), t);
|
|
1221
1221
|
}
|
|
1222
1222
|
function Rt(n, t) {
|
|
1223
1223
|
if (n != null) {
|
|
1224
|
-
if (
|
|
1224
|
+
if (ke(n))
|
|
1225
1225
|
return Lt(n, t);
|
|
1226
1226
|
if (Ue(n))
|
|
1227
|
-
return Mt(n, t);
|
|
1228
|
-
if (Me(n))
|
|
1229
1227
|
return Ut(n, t);
|
|
1230
|
-
if (
|
|
1231
|
-
return
|
|
1232
|
-
if (
|
|
1228
|
+
if (Ne(n))
|
|
1229
|
+
return Mt(n, t);
|
|
1230
|
+
if (Re(n))
|
|
1231
|
+
return Ke(n, t);
|
|
1232
|
+
if (De(n))
|
|
1233
1233
|
return Nt(n, t);
|
|
1234
|
-
if (
|
|
1234
|
+
if (He(n))
|
|
1235
1235
|
return kt(n, t);
|
|
1236
1236
|
}
|
|
1237
|
-
throw
|
|
1237
|
+
throw je(n);
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
return t ? Rt(n, t) :
|
|
1239
|
+
function ce(n, t) {
|
|
1240
|
+
return t ? Rt(n, t) : U(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 = Me(n);
|
|
1246
|
+
return ce(n, e);
|
|
1247
1247
|
}
|
|
1248
1248
|
function $t(n) {
|
|
1249
1249
|
return n instanceof Date && !isNaN(n);
|
|
1250
1250
|
}
|
|
1251
1251
|
function R(n, t) {
|
|
1252
|
-
return P(function(e,
|
|
1253
|
-
var
|
|
1254
|
-
e.subscribe(
|
|
1255
|
-
|
|
1252
|
+
return P(function(e, s) {
|
|
1253
|
+
var r = 0;
|
|
1254
|
+
e.subscribe(O(s, function(o) {
|
|
1255
|
+
s.next(n.call(t, o, r++));
|
|
1256
1256
|
}));
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
@@ -1266,16 +1266,16 @@ function Ht(n) {
|
|
|
1266
1266
|
});
|
|
1267
1267
|
}
|
|
1268
1268
|
var Gt = Array.isArray, Bt = Object.getPrototypeOf, qt = Object.prototype, Kt = Object.keys;
|
|
1269
|
-
function
|
|
1269
|
+
function Vt(n) {
|
|
1270
1270
|
if (n.length === 1) {
|
|
1271
1271
|
var t = n[0];
|
|
1272
1272
|
if (Gt(t))
|
|
1273
1273
|
return { args: t, keys: null };
|
|
1274
|
-
if (
|
|
1274
|
+
if (Yt(t)) {
|
|
1275
1275
|
var e = Kt(t);
|
|
1276
1276
|
return {
|
|
1277
|
-
args: e.map(function(
|
|
1278
|
-
return t[
|
|
1277
|
+
args: e.map(function(s) {
|
|
1278
|
+
return t[s];
|
|
1279
1279
|
}),
|
|
1280
1280
|
keys: e
|
|
1281
1281
|
};
|
|
@@ -1283,108 +1283,108 @@ function Yt(n) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
return { args: n, keys: null };
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1286
|
+
function Yt(n) {
|
|
1287
1287
|
return n && typeof n == "object" && Bt(n) === qt;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1290
|
-
return n.reduce(function(e,
|
|
1291
|
-
return e[
|
|
1289
|
+
function Wt(n, t) {
|
|
1290
|
+
return n.reduce(function(e, s, r) {
|
|
1291
|
+
return e[s] = t[r], e;
|
|
1292
1292
|
}, {});
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Xt() {
|
|
1295
1295
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1296
1296
|
n[t] = arguments[t];
|
|
1297
|
-
var e =
|
|
1297
|
+
var e = Me(n), s = Et(n), r = Vt(n), o = r.args, i = r.keys;
|
|
1298
1298
|
if (o.length === 0)
|
|
1299
|
-
return
|
|
1300
|
-
var a = new y(zt(o, e, i ? function(
|
|
1301
|
-
return
|
|
1302
|
-
} :
|
|
1303
|
-
return
|
|
1299
|
+
return ce([], e);
|
|
1300
|
+
var a = new y(zt(o, e, i ? function(c) {
|
|
1301
|
+
return Wt(i, c);
|
|
1302
|
+
} : Y));
|
|
1303
|
+
return s ? a.pipe(Ht(s)) : a;
|
|
1304
1304
|
}
|
|
1305
1305
|
function zt(n, t, e) {
|
|
1306
|
-
return e === void 0 && (e =
|
|
1306
|
+
return e === void 0 && (e = Y), function(s) {
|
|
1307
1307
|
ge(t, function() {
|
|
1308
|
-
for (var
|
|
1308
|
+
for (var r = n.length, o = new Array(r), i = r, a = r, c = function(h) {
|
|
1309
1309
|
ge(t, function() {
|
|
1310
|
-
var m =
|
|
1311
|
-
m.subscribe(
|
|
1312
|
-
o[h] = d, v || (v = !0, a--), a ||
|
|
1310
|
+
var m = ce(n[h], t), v = !1;
|
|
1311
|
+
m.subscribe(O(s, function(d) {
|
|
1312
|
+
o[h] = d, v || (v = !0, a--), a || s.next(e(o.slice()));
|
|
1313
1313
|
}, function() {
|
|
1314
|
-
--i ||
|
|
1314
|
+
--i || s.complete();
|
|
1315
1315
|
}));
|
|
1316
|
-
},
|
|
1317
|
-
},
|
|
1318
|
-
u
|
|
1319
|
-
},
|
|
1316
|
+
}, s);
|
|
1317
|
+
}, u = 0; u < r; u++)
|
|
1318
|
+
c(u);
|
|
1319
|
+
}, s);
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
1322
1322
|
function ge(n, t, e) {
|
|
1323
|
-
n ?
|
|
1323
|
+
n ? A(e, n, t) : t();
|
|
1324
1324
|
}
|
|
1325
|
-
function Jt(n, t, e,
|
|
1326
|
-
var
|
|
1327
|
-
m && !
|
|
1325
|
+
function Jt(n, t, e, s, r, o, i, a) {
|
|
1326
|
+
var c = [], u = 0, h = 0, m = !1, v = function() {
|
|
1327
|
+
m && !c.length && !u && t.complete();
|
|
1328
1328
|
}, d = function(f) {
|
|
1329
|
-
return
|
|
1329
|
+
return u < s ? p(f) : c.push(f);
|
|
1330
1330
|
}, p = function(f) {
|
|
1331
|
-
|
|
1331
|
+
u++;
|
|
1332
1332
|
var _ = !1;
|
|
1333
|
-
|
|
1334
|
-
t.next(
|
|
1333
|
+
U(e(f, h++)).subscribe(O(t, function(I) {
|
|
1334
|
+
t.next(I);
|
|
1335
1335
|
}, function() {
|
|
1336
1336
|
_ = !0;
|
|
1337
1337
|
}, void 0, function() {
|
|
1338
1338
|
if (_)
|
|
1339
1339
|
try {
|
|
1340
|
-
|
|
1341
|
-
for (var
|
|
1342
|
-
var L =
|
|
1340
|
+
u--;
|
|
1341
|
+
for (var I = function() {
|
|
1342
|
+
var L = c.shift();
|
|
1343
1343
|
i || p(L);
|
|
1344
|
-
};
|
|
1345
|
-
|
|
1344
|
+
}; c.length && u < s; )
|
|
1345
|
+
I();
|
|
1346
1346
|
v();
|
|
1347
1347
|
} catch (L) {
|
|
1348
1348
|
t.error(L);
|
|
1349
1349
|
}
|
|
1350
1350
|
}));
|
|
1351
1351
|
};
|
|
1352
|
-
return n.subscribe(
|
|
1352
|
+
return n.subscribe(O(t, d, function() {
|
|
1353
1353
|
m = !0, v();
|
|
1354
1354
|
})), function() {
|
|
1355
1355
|
};
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1358
|
-
return e === void 0 && (e = 1 / 0),
|
|
1357
|
+
function V(n, t, e) {
|
|
1358
|
+
return e === void 0 && (e = 1 / 0), b(t) ? V(function(s, r) {
|
|
1359
1359
|
return R(function(o, i) {
|
|
1360
|
-
return t(
|
|
1361
|
-
})(
|
|
1362
|
-
}, e) : (typeof t == "number" && (e = t), P(function(
|
|
1363
|
-
return Jt(
|
|
1360
|
+
return t(s, o, r, i);
|
|
1361
|
+
})(U(n(s, r)));
|
|
1362
|
+
}, e) : (typeof t == "number" && (e = t), P(function(s, r) {
|
|
1363
|
+
return Jt(s, r, n, e);
|
|
1364
1364
|
}));
|
|
1365
1365
|
}
|
|
1366
1366
|
function Qt(n, t, e) {
|
|
1367
1367
|
n === void 0 && (n = 0), e === void 0 && (e = wt);
|
|
1368
|
-
var
|
|
1369
|
-
return t != null && (
|
|
1368
|
+
var s = -1;
|
|
1369
|
+
return t != null && (_e(t) ? e = t : s = t), new y(function(r) {
|
|
1370
1370
|
var o = $t(n) ? +n - e.now() : n;
|
|
1371
1371
|
o < 0 && (o = 0);
|
|
1372
1372
|
var i = 0;
|
|
1373
1373
|
return e.schedule(function() {
|
|
1374
|
-
|
|
1374
|
+
r.closed || (r.next(i++), 0 <= s ? this.schedule(void 0, s) : r.complete());
|
|
1375
1375
|
}, o);
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
1378
1378
|
function Zt(n, t) {
|
|
1379
|
-
return
|
|
1379
|
+
return b(t) ? V(n, t, 1) : V(n, 1);
|
|
1380
1380
|
}
|
|
1381
1381
|
function en(n) {
|
|
1382
1382
|
return n <= 0 ? function() {
|
|
1383
|
-
return
|
|
1383
|
+
return It;
|
|
1384
1384
|
} : P(function(t, e) {
|
|
1385
|
-
var
|
|
1386
|
-
t.subscribe(
|
|
1387
|
-
++
|
|
1385
|
+
var s = 0;
|
|
1386
|
+
t.subscribe(O(e, function(r) {
|
|
1387
|
+
++s <= n && (e.next(r), n <= s && e.complete());
|
|
1388
1388
|
}));
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
@@ -1394,27 +1394,27 @@ function tn(n) {
|
|
|
1394
1394
|
});
|
|
1395
1395
|
}
|
|
1396
1396
|
function nn(n, t) {
|
|
1397
|
-
return
|
|
1398
|
-
return
|
|
1397
|
+
return V(function(e, s) {
|
|
1398
|
+
return U(n(e, s)).pipe(en(1), tn(e));
|
|
1399
1399
|
});
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1402
|
-
t === void 0 && (t =
|
|
1401
|
+
function sn(n, t) {
|
|
1402
|
+
t === void 0 && (t = Pe);
|
|
1403
1403
|
var e = Qt(n, t);
|
|
1404
1404
|
return nn(function() {
|
|
1405
1405
|
return e;
|
|
1406
1406
|
});
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return t === void 0 && (t =
|
|
1410
|
-
var
|
|
1411
|
-
e.subscribe(
|
|
1408
|
+
function M(n, t) {
|
|
1409
|
+
return t === void 0 && (t = Y), n = n ?? rn, P(function(e, s) {
|
|
1410
|
+
var r, o = !0;
|
|
1411
|
+
e.subscribe(O(s, function(i) {
|
|
1412
1412
|
var a = t(i);
|
|
1413
|
-
(o || !n(
|
|
1413
|
+
(o || !n(r, a)) && (o = !1, r = a, s.next(i));
|
|
1414
1414
|
}));
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function rn(n, t) {
|
|
1418
1418
|
return n === t;
|
|
1419
1419
|
}
|
|
1420
1420
|
function on(n) {
|
|
@@ -1428,27 +1428,27 @@ function on(n) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
function an(n) {
|
|
1430
1430
|
return P(function(t, e) {
|
|
1431
|
-
|
|
1431
|
+
U(n).subscribe(O(e, function() {
|
|
1432
1432
|
return e.complete();
|
|
1433
|
-
},
|
|
1433
|
+
}, se)), !e.closed && t.subscribe(e);
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
1436
|
function be(n) {
|
|
1437
|
-
const { endpoint: t, apiKey: e, payload:
|
|
1437
|
+
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: o } = n, i = n.method ?? "POST";
|
|
1438
1438
|
return new y((a) => {
|
|
1439
|
-
const
|
|
1440
|
-
let
|
|
1439
|
+
const c = new AbortController();
|
|
1440
|
+
let u, h = !1, m = !1;
|
|
1441
1441
|
const v = {
|
|
1442
1442
|
"Content-Type": "application/json",
|
|
1443
1443
|
...o
|
|
1444
1444
|
};
|
|
1445
1445
|
e && (v["X-API-KEY"] = e);
|
|
1446
1446
|
const d = new URL(t);
|
|
1447
|
-
return
|
|
1447
|
+
return r && d.searchParams.set("is_debug", "true"), Ee(d.toString(), {
|
|
1448
1448
|
method: i,
|
|
1449
1449
|
headers: v,
|
|
1450
|
-
body: i === "POST" &&
|
|
1451
|
-
signal:
|
|
1450
|
+
body: i === "POST" && s ? JSON.stringify(s) : void 0,
|
|
1451
|
+
signal: c.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
|
+
u = 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)), c.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
|
+
u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = 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), c.abort(), p;
|
|
1486
1486
|
}
|
|
1487
1487
|
}), () => {
|
|
1488
|
-
m = !0,
|
|
1488
|
+
m = !0, c.abort();
|
|
1489
1489
|
};
|
|
1490
1490
|
});
|
|
1491
1491
|
}
|
|
1492
|
-
class
|
|
1492
|
+
class cn {
|
|
1493
1493
|
listeners = {};
|
|
1494
1494
|
on(t, e) {
|
|
1495
1495
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1498,17 +1498,17 @@ class un {
|
|
|
1498
1498
|
}
|
|
1499
1499
|
off(t, e) {
|
|
1500
1500
|
this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
|
|
1501
|
-
[t]: (this.listeners[t] ?? []).filter((
|
|
1501
|
+
[t]: (this.listeners[t] ?? []).filter((s) => s !== e)
|
|
1502
1502
|
}));
|
|
1503
1503
|
}
|
|
1504
1504
|
remove(t) {
|
|
1505
1505
|
delete this.listeners[t];
|
|
1506
1506
|
}
|
|
1507
1507
|
emit(t, ...e) {
|
|
1508
|
-
this.listeners[t] && this.listeners[t].forEach((
|
|
1508
|
+
this.listeners[t] && this.listeners[t].forEach((s) => s(...e));
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
1511
|
-
class
|
|
1511
|
+
class Un {
|
|
1512
1512
|
apiKey;
|
|
1513
1513
|
endpoint;
|
|
1514
1514
|
botProviderEndpoint;
|
|
@@ -1518,7 +1518,7 @@ class Mn {
|
|
|
1518
1518
|
detached = !1;
|
|
1519
1519
|
detachTimer;
|
|
1520
1520
|
inFlight = 0;
|
|
1521
|
-
sseEmitter = new
|
|
1521
|
+
sseEmitter = new cn();
|
|
1522
1522
|
transformSsePayload;
|
|
1523
1523
|
customHeaders;
|
|
1524
1524
|
constructor(t) {
|
|
@@ -1588,11 +1588,11 @@ class Mn {
|
|
|
1588
1588
|
*/
|
|
1589
1589
|
rejoinSse(t, e) {
|
|
1590
1590
|
e?.onSseStart?.(), this.inFlight += 1;
|
|
1591
|
-
const
|
|
1592
|
-
return
|
|
1591
|
+
const s = new URL(this.endpoint);
|
|
1592
|
+
return s.searchParams.set("custom_channel_id", t), this.runSse(
|
|
1593
1593
|
be({
|
|
1594
1594
|
apiKey: this.apiKey,
|
|
1595
|
-
endpoint:
|
|
1595
|
+
endpoint: s.toString(),
|
|
1596
1596
|
debugMode: this.debugMode,
|
|
1597
1597
|
method: "GET",
|
|
1598
1598
|
customHeaders: this.customHeaders
|
|
@@ -1614,11 +1614,11 @@ class Mn {
|
|
|
1614
1614
|
const e = this.deriveChannelMetadataEndpoint();
|
|
1615
1615
|
if (!e)
|
|
1616
1616
|
throw new Error("Unable to derive channel metadata endpoint. Please provide botProviderEndpoint in config.");
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1619
|
-
const
|
|
1620
|
-
this.apiKey && (
|
|
1621
|
-
const o = await fetch(
|
|
1617
|
+
const s = new URL(e);
|
|
1618
|
+
s.searchParams.set("custom_channel_id", t);
|
|
1619
|
+
const r = { ...this.customHeaders };
|
|
1620
|
+
this.apiKey && (r["X-API-KEY"] = this.apiKey);
|
|
1621
|
+
const o = await fetch(s.toString(), { method: "GET", headers: r });
|
|
1622
1622
|
if (o.status === 404)
|
|
1623
1623
|
return null;
|
|
1624
1624
|
if (!o.ok)
|
|
@@ -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((c) => ({
|
|
1635
|
+
sandboxName: c.sandboxName,
|
|
1636
|
+
sandboxBlueprintName: c.sandboxBlueprintName,
|
|
1637
|
+
workingDirectory: c.workingDirectory,
|
|
1638
|
+
editorServerEnabled: c.editorServerEnabled,
|
|
1639
|
+
browserEnabled: c.browserEnabled
|
|
1640
1640
|
}))
|
|
1641
1641
|
};
|
|
1642
1642
|
}
|
|
@@ -1661,12 +1661,12 @@ class Mn {
|
|
|
1661
1661
|
* stop, which is a success rather than an error. Every other non-2xx throws {@link HttpError}.
|
|
1662
1662
|
*/
|
|
1663
1663
|
async suspendChannel(t, e) {
|
|
1664
|
-
const
|
|
1665
|
-
if (!
|
|
1664
|
+
const s = this.deriveSuspendEndpoint();
|
|
1665
|
+
if (!s)
|
|
1666
1666
|
throw new Error("Unable to derive channel suspend endpoint. Please provide botProviderEndpoint in config.");
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
const o = await fetch(
|
|
1667
|
+
const r = new URL(s);
|
|
1668
|
+
r.searchParams.set("custom_channel_id", t), e?.requestId && r.searchParams.set("request_id", e.requestId), e?.force && r.searchParams.set("force", "true");
|
|
1669
|
+
const o = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
|
|
1670
1670
|
if (!(o.ok || o.status === 404))
|
|
1671
1671
|
throw new w(o.status, o.statusText, await o.text().catch(() => {
|
|
1672
1672
|
}));
|
|
@@ -1676,17 +1676,17 @@ class Mn {
|
|
|
1676
1676
|
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
1677
1677
|
// run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
|
|
1678
1678
|
// create-sse-observable); a no-cursor failure surfaces via `error` below.
|
|
1679
|
-
Zt((
|
|
1679
|
+
Zt((s) => jt(s).pipe(sn(e?.delayTime ?? 50))),
|
|
1680
1680
|
an(this.destroy$),
|
|
1681
1681
|
// Settle the run accounting on every termination path — complete, error, AND a user-initiated
|
|
1682
1682
|
// unsubscribe (stop-generation aborts the connection without a terminal event).
|
|
1683
1683
|
on(() => this.onRunSettled())
|
|
1684
1684
|
).subscribe({
|
|
1685
|
-
next: (
|
|
1686
|
-
this.detached || (e?.onSseMessage?.(
|
|
1685
|
+
next: (s) => {
|
|
1686
|
+
this.detached || (e?.onSseMessage?.(s), this.handleEvent(s));
|
|
1687
1687
|
},
|
|
1688
|
-
error: (
|
|
1689
|
-
this.detached || e?.onSseError?.(
|
|
1688
|
+
error: (s) => {
|
|
1689
|
+
this.detached || e?.onSseError?.(s);
|
|
1690
1690
|
},
|
|
1691
1691
|
complete: () => {
|
|
1692
1692
|
this.detached || e?.onSseCompleted?.();
|
|
@@ -1727,20 +1727,20 @@ class Mn {
|
|
|
1727
1727
|
* 根據 API 文件:/ns/{namespace}/bot-provider/{bot_provider_name}/blob
|
|
1728
1728
|
*/
|
|
1729
1729
|
async uploadFile(t, e) {
|
|
1730
|
-
const
|
|
1731
|
-
if (!
|
|
1730
|
+
const s = this.deriveBlobEndpoint();
|
|
1731
|
+
if (!s)
|
|
1732
1732
|
throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1733
|
+
const r = new FormData();
|
|
1734
|
+
r.append("file", t), r.append("customChannelId", e);
|
|
1735
1735
|
const o = {
|
|
1736
1736
|
...this.customHeaders
|
|
1737
1737
|
};
|
|
1738
1738
|
this.apiKey && (o["X-API-KEY"] = this.apiKey);
|
|
1739
1739
|
try {
|
|
1740
|
-
const i = await fetch(
|
|
1740
|
+
const i = await fetch(s, {
|
|
1741
1741
|
method: "POST",
|
|
1742
1742
|
headers: o,
|
|
1743
|
-
body:
|
|
1743
|
+
body: r
|
|
1744
1744
|
});
|
|
1745
1745
|
if (!i.ok)
|
|
1746
1746
|
throw new Error(`Upload failed: ${i.status} ${i.statusText}`);
|
|
@@ -1755,10 +1755,10 @@ class Mn {
|
|
|
1755
1755
|
* 呼叫 Edge Server GET <base>/channel-home/download?custom_channel_id=xxx&relative_path=xxx 取回 binary。
|
|
1756
1756
|
*/
|
|
1757
1757
|
async downloadChannelHomeFile(t, e) {
|
|
1758
|
-
const
|
|
1759
|
-
if (!
|
|
1758
|
+
const s = this.getBaseEndpoint();
|
|
1759
|
+
if (!s)
|
|
1760
1760
|
throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
|
|
1761
|
-
const
|
|
1761
|
+
const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${s}/channel-home/download?${r}`, i = {
|
|
1762
1762
|
...this.customHeaders
|
|
1763
1763
|
};
|
|
1764
1764
|
this.apiKey && (i["X-API-KEY"] = this.apiKey);
|
|
@@ -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 c = await a.blob(), u = t.split("/").pop() || "download";
|
|
1773
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: u, size: c.size }), { blob: c, filename: u };
|
|
1774
1774
|
} catch (a) {
|
|
1775
1775
|
throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
|
|
1776
1776
|
}
|
|
@@ -1787,9 +1787,9 @@ class Mn {
|
|
|
1787
1787
|
throw new Error(
|
|
1788
1788
|
"Unable to derive sandbox browser open-url endpoint. Please provide botProviderEndpoint in config."
|
|
1789
1789
|
);
|
|
1790
|
-
const
|
|
1791
|
-
this.apiKey && (
|
|
1792
|
-
const o = await fetch(
|
|
1790
|
+
const s = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, r = { ...this.customHeaders };
|
|
1791
|
+
this.apiKey && (r["X-API-KEY"] = this.apiKey);
|
|
1792
|
+
const o = await fetch(s, { method: "POST", headers: r });
|
|
1793
1793
|
if (!o.ok)
|
|
1794
1794
|
throw new w(o.status, o.statusText, await o.text().catch(() => {
|
|
1795
1795
|
}));
|
|
@@ -1817,23 +1817,23 @@ class Mn {
|
|
|
1817
1817
|
* 容錯,比照 `channelMetadata`)。
|
|
1818
1818
|
*/
|
|
1819
1819
|
async sandboxFsList(t, e) {
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
const
|
|
1823
|
-
if (!
|
|
1824
|
-
throw new w(
|
|
1820
|
+
const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/list`);
|
|
1821
|
+
s.searchParams.set("path", e);
|
|
1822
|
+
const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1823
|
+
if (!r.ok)
|
|
1824
|
+
throw new w(r.status, r.statusText, await r.text().catch(() => {
|
|
1825
1825
|
}));
|
|
1826
|
-
const o = await
|
|
1826
|
+
const o = await r.json(), i = o.data ?? o;
|
|
1827
1827
|
return { entries: i.entries ?? [], truncated: i.truncated ?? !1 };
|
|
1828
1828
|
}
|
|
1829
1829
|
/**
|
|
1830
1830
|
* F-021 — 讀取 sandbox 檔案(`GET fs/file?path=[&offset_bytes&limit_bytes]`)。回應是 raw octet-stream,
|
|
1831
1831
|
* 檔案總長度 / 是否截斷走 `X-Total-Bytes` / `X-Truncated` header。
|
|
1832
1832
|
*/
|
|
1833
|
-
async sandboxFsRead(t, e,
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
const o = await fetch(
|
|
1833
|
+
async sandboxFsRead(t, e, s) {
|
|
1834
|
+
const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1835
|
+
r.searchParams.set("path", e), s?.offsetBytes != null && r.searchParams.set("offset_bytes", String(s.offsetBytes)), s?.limitBytes != null && r.searchParams.set("limit_bytes", String(s.limitBytes));
|
|
1836
|
+
const o = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1837
1837
|
if (!o.ok)
|
|
1838
1838
|
throw new w(o.status, o.statusText, await o.text().catch(() => {
|
|
1839
1839
|
}));
|
|
@@ -1848,23 +1848,23 @@ class Mn {
|
|
|
1848
1848
|
* F-021 — 寫入 sandbox 檔案(`PUT fs/file?path=[&mode&create_only]`,`multipart/form-data` 帶 `file`)。
|
|
1849
1849
|
* 回應 `{ data: { bytesWritten } }`。
|
|
1850
1850
|
*/
|
|
1851
|
-
async sandboxFsWrite(t, e,
|
|
1851
|
+
async sandboxFsWrite(t, e, s, r) {
|
|
1852
1852
|
const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1853
|
-
o.searchParams.set("path", e),
|
|
1853
|
+
o.searchParams.set("path", e), r?.mode != null && o.searchParams.set("mode", String(r.mode)), r?.createOnly && o.searchParams.set("create_only", "true");
|
|
1854
1854
|
const i = new FormData();
|
|
1855
|
-
i.append("file",
|
|
1855
|
+
i.append("file", s instanceof Blob ? s : new Blob([s]));
|
|
1856
1856
|
const a = await fetch(o.toString(), { method: "PUT", headers: this.apiHeaders(), body: i });
|
|
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 c = await a.json();
|
|
1861
|
+
return { bytesWritten: (c.data ?? c).bytesWritten ?? 0 };
|
|
1862
1862
|
}
|
|
1863
1863
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1864
|
-
async sandboxFsRequest(t, e,
|
|
1864
|
+
async sandboxFsRequest(t, e, s, r) {
|
|
1865
1865
|
const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1866
|
-
Object.entries(
|
|
1867
|
-
const i = await fetch(o.toString(), { method:
|
|
1866
|
+
Object.entries(r).forEach(([a, c]) => o.searchParams.set(a, c));
|
|
1867
|
+
const i = await fetch(o.toString(), { method: s, headers: this.apiHeaders() });
|
|
1868
1868
|
if (!i.ok)
|
|
1869
1869
|
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
1870
1870
|
}));
|
|
@@ -1872,13 +1872,13 @@ class Mn {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
/** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
|
|
1874
1874
|
async sandboxFsStat(t, e) {
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1877
|
-
const
|
|
1878
|
-
if (!
|
|
1879
|
-
throw new w(
|
|
1875
|
+
const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/stat`);
|
|
1876
|
+
s.searchParams.set("path", e);
|
|
1877
|
+
const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1878
|
+
if (!r.ok)
|
|
1879
|
+
throw new w(r.status, r.statusText, await r.text().catch(() => {
|
|
1880
1880
|
}));
|
|
1881
|
-
const o = await
|
|
1881
|
+
const o = await r.json(), i = o.data ?? o;
|
|
1882
1882
|
return {
|
|
1883
1883
|
exists: i.exists ?? !1,
|
|
1884
1884
|
isDir: i.isDir ?? !1,
|
|
@@ -1901,16 +1901,16 @@ class Mn {
|
|
|
1901
1901
|
await this.sandboxFsRequest(t, "all", "DELETE", { path: e });
|
|
1902
1902
|
}
|
|
1903
1903
|
/** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
|
|
1904
|
-
async sandboxFsCopy(t, e,
|
|
1905
|
-
const o = { src: e, dst:
|
|
1906
|
-
|
|
1904
|
+
async sandboxFsCopy(t, e, s, r) {
|
|
1905
|
+
const o = { src: e, dst: s };
|
|
1906
|
+
r?.overwrite && (o.overwrite = "true");
|
|
1907
1907
|
const i = await this.sandboxFsRequest(t, "copy", "POST", o);
|
|
1908
1908
|
return { bytesCopied: (i?.data ?? i)?.bytesCopied ?? 0 };
|
|
1909
1909
|
}
|
|
1910
1910
|
/** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
|
|
1911
|
-
async sandboxFsMove(t, e,
|
|
1912
|
-
const o = { src: e, dst:
|
|
1913
|
-
|
|
1911
|
+
async sandboxFsMove(t, e, s, r) {
|
|
1912
|
+
const o = { src: e, dst: s };
|
|
1913
|
+
r?.overwrite && (o.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", o);
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
1916
1916
|
* F-021 — watch a sandbox path for changes (`GET fs/watch?path=`, SSE). Each `event: change` frame is one
|
|
@@ -1918,10 +1918,10 @@ class Mn {
|
|
|
1918
1918
|
* as a dead stream. Unsubscribing aborts the request, which ends the sandbox-side watcher.
|
|
1919
1919
|
*/
|
|
1920
1920
|
sandboxFsWatch(t, e) {
|
|
1921
|
-
const
|
|
1922
|
-
return
|
|
1921
|
+
const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/watch`);
|
|
1922
|
+
return s.searchParams.set("path", e), new y((r) => {
|
|
1923
1923
|
const o = new AbortController();
|
|
1924
|
-
return Ee(
|
|
1924
|
+
return Ee(s.toString(), {
|
|
1925
1925
|
headers: this.apiHeaders(),
|
|
1926
1926
|
signal: o.signal,
|
|
1927
1927
|
openWhenHidden: !0,
|
|
@@ -1929,15 +1929,15 @@ class Mn {
|
|
|
1929
1929
|
if (!i.ok) {
|
|
1930
1930
|
const a = await i.text().catch(() => {
|
|
1931
1931
|
});
|
|
1932
|
-
|
|
1932
|
+
r.error(new w(i.status, i.statusText, a)), o.abort();
|
|
1933
1933
|
}
|
|
1934
1934
|
},
|
|
1935
1935
|
onmessage: (i) => {
|
|
1936
|
-
i.event === "change" &&
|
|
1936
|
+
i.event === "change" && r.next(JSON.parse(i.data));
|
|
1937
1937
|
},
|
|
1938
|
-
onclose: () =>
|
|
1938
|
+
onclose: () => r.complete(),
|
|
1939
1939
|
onerror: (i) => {
|
|
1940
|
-
throw
|
|
1940
|
+
throw r.error(i), o.abort(), i;
|
|
1941
1941
|
}
|
|
1942
1942
|
}), () => o.abort();
|
|
1943
1943
|
});
|
|
@@ -1961,7 +1961,7 @@ class Mn {
|
|
|
1961
1961
|
const S = [];
|
|
1962
1962
|
for (let n = 0; n < 256; ++n)
|
|
1963
1963
|
S.push((n + 256).toString(16).slice(1));
|
|
1964
|
-
function
|
|
1964
|
+
function un(n, t = 0) {
|
|
1965
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;
|
|
@@ -1977,15 +1977,15 @@ function dn() {
|
|
|
1977
1977
|
const hn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ve = { randomUUID: hn };
|
|
1978
1978
|
function fn(n, t, e) {
|
|
1979
1979
|
n = n || {};
|
|
1980
|
-
const
|
|
1981
|
-
if (
|
|
1980
|
+
const s = n.random ?? n.rng?.() ?? dn();
|
|
1981
|
+
if (s.length < 16)
|
|
1982
1982
|
throw new Error("Random bytes length must be >= 16");
|
|
1983
|
-
return
|
|
1983
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, un(s);
|
|
1984
1984
|
}
|
|
1985
|
-
function
|
|
1985
|
+
function Ve(n, t, e) {
|
|
1986
1986
|
return ve.randomUUID && !n ? ve.randomUUID() : fn(n);
|
|
1987
1987
|
}
|
|
1988
|
-
class
|
|
1988
|
+
class g {
|
|
1989
1989
|
messages = null;
|
|
1990
1990
|
pendingConsent = null;
|
|
1991
1991
|
constructor({ messages: t, pendingConsent: e = null }) {
|
|
@@ -1993,10 +1993,10 @@ class b {
|
|
|
1993
1993
|
}
|
|
1994
1994
|
pushMessage(t) {
|
|
1995
1995
|
const e = new Map(this.messages);
|
|
1996
|
-
return e.set(t.messageId, t), new
|
|
1996
|
+
return e.set(t.messageId, t), new g({ messages: e, pendingConsent: this.pendingConsent });
|
|
1997
1997
|
}
|
|
1998
1998
|
clearPendingConsent() {
|
|
1999
|
-
return this.pendingConsent ? new
|
|
1999
|
+
return this.pendingConsent ? new g({ messages: this.messages, pendingConsent: null }) : this;
|
|
2000
2000
|
}
|
|
2001
2001
|
/**
|
|
2002
2002
|
* Put a consent prompt back (#410) — the mirror of {@link clearPendingConsent}, used to undo the
|
|
@@ -2004,7 +2004,7 @@ class b {
|
|
|
2004
2004
|
* meantime: that one is newer than the batch being restored.
|
|
2005
2005
|
*/
|
|
2006
2006
|
restorePendingConsent(t) {
|
|
2007
|
-
return this.pendingConsent ? this : new
|
|
2007
|
+
return this.pendingConsent ? this : new g({ messages: this.messages, pendingConsent: t });
|
|
2008
2008
|
}
|
|
2009
2009
|
/**
|
|
2010
2010
|
* Converge everything the aborted run left mid-flight (F-020 AC10, F-023). A stopped run sends no
|
|
@@ -2023,9 +2023,9 @@ class b {
|
|
|
2023
2023
|
if (!this.messages) return this;
|
|
2024
2024
|
let t = !1;
|
|
2025
2025
|
const e = new Map(this.messages);
|
|
2026
|
-
for (const [
|
|
2027
|
-
|
|
2028
|
-
return t ? new
|
|
2026
|
+
for (const [s, r] of e)
|
|
2027
|
+
r.type === "tool-call" && !r.isComplete && (e.set(s, { ...r, isComplete: !0, isCancelled: !0 }), t = !0), r.type === "thinking" && r.isThinking && (e.set(s, { ...r, isThinking: !1 }), t = !0);
|
|
2028
|
+
return t ? new g({ messages: e, pendingConsent: this.pendingConsent }) : this;
|
|
2029
2029
|
}
|
|
2030
2030
|
/**
|
|
2031
2031
|
* @deprecated Renamed to {@link settleInFlightMessages} in 0.3.27 — it settles in-flight thinking
|
|
@@ -2051,6 +2051,12 @@ class b {
|
|
|
2051
2051
|
return this.onThinkingDelta(t);
|
|
2052
2052
|
case l.MESSAGE_THINKING_COMPLETE:
|
|
2053
2053
|
return this.onThinkingComplete(t);
|
|
2054
|
+
case l.MESSAGE_CANVAS_START:
|
|
2055
|
+
return this.onCanvasStart(t);
|
|
2056
|
+
case l.MESSAGE_CANVAS_DELTA:
|
|
2057
|
+
return this.onCanvasDelta(t);
|
|
2058
|
+
case l.MESSAGE_CANVAS_COMPLETE:
|
|
2059
|
+
return this.onCanvasComplete(t);
|
|
2054
2060
|
case l.TOOL_CALL_START:
|
|
2055
2061
|
return this.onToolCallStart(t);
|
|
2056
2062
|
case l.TOOL_CALL_COMPLETE:
|
|
@@ -2092,12 +2098,20 @@ class b {
|
|
|
2092
2098
|
isTerminalToolCall(t) {
|
|
2093
2099
|
return t?.type === "tool-call" && t.isComplete === !0;
|
|
2094
2100
|
}
|
|
2101
|
+
/**
|
|
2102
|
+
* A canvas is terminal once `canvas.complete` has delivered the authoritative fragment
|
|
2103
|
+
* (`isDrawing === false`). Same policy as the bot / thinking guards (F-011): a late start or delta
|
|
2104
|
+
* must not swap that fragment back to whatever prefix happened to be in flight.
|
|
2105
|
+
*/
|
|
2106
|
+
isTerminalCanvas(t) {
|
|
2107
|
+
return t?.type === "canvas" && !t.isDrawing;
|
|
2108
|
+
}
|
|
2095
2109
|
onMessageStart(t) {
|
|
2096
2110
|
const e = t.fact.messageStart.message;
|
|
2097
2111
|
if (e.parentToolUseId) return this;
|
|
2098
2112
|
if (this.isTerminalBot(this.messages?.get(e.messageId))) return this;
|
|
2099
|
-
const
|
|
2100
|
-
return
|
|
2113
|
+
const s = new Map(this.messages);
|
|
2114
|
+
return s.set(e.messageId, {
|
|
2101
2115
|
type: "bot",
|
|
2102
2116
|
eventType: l.MESSAGE_START,
|
|
2103
2117
|
isTyping: !0,
|
|
@@ -2107,31 +2121,31 @@ class b {
|
|
|
2107
2121
|
time: /* @__PURE__ */ new Date(),
|
|
2108
2122
|
traceId: t.traceId,
|
|
2109
2123
|
raw: ""
|
|
2110
|
-
}), new
|
|
2124
|
+
}), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2111
2125
|
}
|
|
2112
2126
|
onMessageDelta(t) {
|
|
2113
2127
|
const e = t.fact.messageDelta.message;
|
|
2114
2128
|
if (e.parentToolUseId) return this;
|
|
2115
|
-
const
|
|
2116
|
-
if (this.isTerminalBot(
|
|
2117
|
-
const
|
|
2129
|
+
const s = this.messages?.get(e.messageId);
|
|
2130
|
+
if (this.isTerminalBot(s)) return this;
|
|
2131
|
+
const r = s?.type === "bot" ? s : void 0, o = new Map(this.messages);
|
|
2118
2132
|
return o.set(e.messageId, {
|
|
2119
2133
|
type: "bot",
|
|
2120
2134
|
eventType: l.MESSAGE_DELTA,
|
|
2121
2135
|
isTyping: !0,
|
|
2122
|
-
typingText: `${
|
|
2136
|
+
typingText: `${r?.typingText ?? ""}${e.text}`,
|
|
2123
2137
|
messageId: e.messageId,
|
|
2124
2138
|
message: e,
|
|
2125
2139
|
time: /* @__PURE__ */ new Date(),
|
|
2126
|
-
traceId: t.traceId ??
|
|
2127
|
-
raw:
|
|
2128
|
-
}), new
|
|
2140
|
+
traceId: t.traceId ?? r?.traceId,
|
|
2141
|
+
raw: r?.raw ?? ""
|
|
2142
|
+
}), new g({ messages: o, pendingConsent: this.pendingConsent });
|
|
2129
2143
|
}
|
|
2130
2144
|
onMessageComplete(t) {
|
|
2131
2145
|
const e = t.fact.messageComplete.message;
|
|
2132
2146
|
if (e.parentToolUseId) return this;
|
|
2133
|
-
const
|
|
2134
|
-
return
|
|
2147
|
+
const s = new Map(this.messages), r = s.get(e.messageId);
|
|
2148
|
+
return s.set(e.messageId, {
|
|
2135
2149
|
type: "bot",
|
|
2136
2150
|
eventType: l.MESSAGE_COMPLETE,
|
|
2137
2151
|
isTyping: !1,
|
|
@@ -2139,15 +2153,15 @@ class b {
|
|
|
2139
2153
|
messageId: e.messageId,
|
|
2140
2154
|
message: e,
|
|
2141
2155
|
time: /* @__PURE__ */ new Date(),
|
|
2142
|
-
traceId: t.traceId ?? (
|
|
2156
|
+
traceId: t.traceId ?? (r?.type === "bot" ? r.traceId : void 0),
|
|
2143
2157
|
raw: JSON.stringify(t)
|
|
2144
|
-
}), new
|
|
2158
|
+
}), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2145
2159
|
}
|
|
2146
2160
|
onThinkingStart(t) {
|
|
2147
2161
|
const e = t.fact.messageThinkingStart.message;
|
|
2148
2162
|
if (e.parentToolUseId) return this;
|
|
2149
2163
|
if (this.isTerminalThinking(this.messages?.get(e.messageId))) return this;
|
|
2150
|
-
const
|
|
2164
|
+
const s = new Map(this.messages), r = {
|
|
2151
2165
|
type: "thinking",
|
|
2152
2166
|
messageId: e.messageId,
|
|
2153
2167
|
text: e.text,
|
|
@@ -2155,42 +2169,95 @@ class b {
|
|
|
2155
2169
|
time: /* @__PURE__ */ new Date(),
|
|
2156
2170
|
traceId: t.traceId
|
|
2157
2171
|
};
|
|
2158
|
-
return
|
|
2172
|
+
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2159
2173
|
}
|
|
2160
2174
|
onThinkingDelta(t) {
|
|
2161
2175
|
const e = t.fact.messageThinkingDelta.message;
|
|
2162
2176
|
if (e.parentToolUseId) return this;
|
|
2163
|
-
const
|
|
2164
|
-
if (this.isTerminalThinking(
|
|
2165
|
-
const
|
|
2177
|
+
const s = this.messages?.get(e.messageId);
|
|
2178
|
+
if (this.isTerminalThinking(s)) return this;
|
|
2179
|
+
const r = s?.type === "thinking" ? s : void 0, o = new Map(this.messages), i = {
|
|
2166
2180
|
type: "thinking",
|
|
2167
2181
|
messageId: e.messageId,
|
|
2168
|
-
text: `${
|
|
2182
|
+
text: `${r?.text ?? ""}${e.text}`,
|
|
2169
2183
|
isThinking: !0,
|
|
2170
|
-
time:
|
|
2171
|
-
traceId: t.traceId ??
|
|
2184
|
+
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2185
|
+
traceId: t.traceId ?? r?.traceId
|
|
2172
2186
|
};
|
|
2173
|
-
return o.set(e.messageId, i), new
|
|
2187
|
+
return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
|
|
2174
2188
|
}
|
|
2175
2189
|
onThinkingComplete(t) {
|
|
2176
2190
|
const e = t.fact.messageThinkingComplete.message;
|
|
2177
2191
|
if (e.parentToolUseId) return this;
|
|
2178
|
-
const
|
|
2192
|
+
const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0, o = new Map(this.messages), i = {
|
|
2179
2193
|
type: "thinking",
|
|
2180
2194
|
messageId: e.messageId,
|
|
2181
2195
|
// Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
|
|
2182
2196
|
// replay (no start/delta) still renders the whole text.
|
|
2183
2197
|
text: e.text,
|
|
2184
2198
|
isThinking: !1,
|
|
2185
|
-
time:
|
|
2186
|
-
traceId: t.traceId ??
|
|
2199
|
+
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2200
|
+
traceId: t.traceId ?? r?.traceId
|
|
2201
|
+
};
|
|
2202
|
+
return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
|
|
2203
|
+
}
|
|
2204
|
+
onCanvasStart(t) {
|
|
2205
|
+
const e = t.fact.messageCanvasStart.message;
|
|
2206
|
+
if (e.parentToolUseId) return this;
|
|
2207
|
+
if (this.isTerminalCanvas(this.messages?.get(e.messageId))) return this;
|
|
2208
|
+
const s = new Map(this.messages), r = {
|
|
2209
|
+
type: "canvas",
|
|
2210
|
+
messageId: e.messageId,
|
|
2211
|
+
html: "",
|
|
2212
|
+
isDrawing: !0,
|
|
2213
|
+
time: /* @__PURE__ */ new Date(),
|
|
2214
|
+
traceId: t.traceId
|
|
2187
2215
|
};
|
|
2188
|
-
return
|
|
2216
|
+
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2217
|
+
}
|
|
2218
|
+
onCanvasDelta(t) {
|
|
2219
|
+
const e = t.fact.messageCanvasDelta.message;
|
|
2220
|
+
if (e.parentToolUseId) return this;
|
|
2221
|
+
const s = this.messages?.get(e.messageId);
|
|
2222
|
+
if (this.isTerminalCanvas(s)) return this;
|
|
2223
|
+
const r = s?.type === "canvas" ? s : void 0, o = new Map(this.messages), i = {
|
|
2224
|
+
type: "canvas",
|
|
2225
|
+
messageId: e.messageId,
|
|
2226
|
+
// Deltas are incremental, exactly like a text delta.
|
|
2227
|
+
html: `${r?.html ?? ""}${e.text}`,
|
|
2228
|
+
title: r?.title,
|
|
2229
|
+
isDrawing: !0,
|
|
2230
|
+
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2231
|
+
traceId: t.traceId ?? r?.traceId
|
|
2232
|
+
};
|
|
2233
|
+
return o.set(e.messageId, i), new g({ messages: o, pendingConsent: this.pendingConsent });
|
|
2234
|
+
}
|
|
2235
|
+
onCanvasComplete(t) {
|
|
2236
|
+
const e = t.fact.messageCanvasComplete.message;
|
|
2237
|
+
if (e.parentToolUseId) return this;
|
|
2238
|
+
const s = e.template?.type === Ie.CANVAS ? e.template : void 0, r = s?.canvas?.html;
|
|
2239
|
+
if (!r) {
|
|
2240
|
+
if (!this.messages?.has(e.messageId)) return this;
|
|
2241
|
+
const u = new Map(this.messages);
|
|
2242
|
+
return u.delete(e.messageId), new g({ messages: u, pendingConsent: this.pendingConsent });
|
|
2243
|
+
}
|
|
2244
|
+
const o = this.messages?.get(e.messageId), i = o?.type === "canvas" ? o : void 0, a = new Map(this.messages), c = {
|
|
2245
|
+
type: "canvas",
|
|
2246
|
+
messageId: e.messageId,
|
|
2247
|
+
// **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
|
|
2248
|
+
// complete — appending here would stream correctly and come back empty after a reload.
|
|
2249
|
+
html: r,
|
|
2250
|
+
title: s?.title,
|
|
2251
|
+
isDrawing: !1,
|
|
2252
|
+
time: i?.time ?? /* @__PURE__ */ new Date(),
|
|
2253
|
+
traceId: t.traceId ?? i?.traceId
|
|
2254
|
+
};
|
|
2255
|
+
return a.set(e.messageId, c), new g({ messages: a, pendingConsent: this.pendingConsent });
|
|
2189
2256
|
}
|
|
2190
2257
|
onMessageUser(t) {
|
|
2191
2258
|
const e = t.fact.messageUser;
|
|
2192
2259
|
if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
|
|
2193
|
-
const
|
|
2260
|
+
const r = new Map(this.messages), o = {
|
|
2194
2261
|
type: "user",
|
|
2195
2262
|
messageId: e.messageId,
|
|
2196
2263
|
text: e.text,
|
|
@@ -2200,26 +2267,26 @@ class b {
|
|
|
2200
2267
|
time: /* @__PURE__ */ new Date(),
|
|
2201
2268
|
traceId: t.traceId
|
|
2202
2269
|
};
|
|
2203
|
-
return
|
|
2270
|
+
return r.set(e.messageId, o), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2204
2271
|
}
|
|
2205
2272
|
onMessageError(t) {
|
|
2206
|
-
const e =
|
|
2207
|
-
return
|
|
2273
|
+
const e = Ve(), s = t.fact.runError.error, r = new Map(this.messages);
|
|
2274
|
+
return r.set(e, {
|
|
2208
2275
|
type: "error",
|
|
2209
2276
|
eventType: l.ERROR,
|
|
2210
2277
|
messageId: e,
|
|
2211
|
-
error:
|
|
2278
|
+
error: s,
|
|
2212
2279
|
time: /* @__PURE__ */ new Date(),
|
|
2213
2280
|
traceId: t.traceId
|
|
2214
|
-
}), new
|
|
2281
|
+
}), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2215
2282
|
}
|
|
2216
2283
|
onToolCallStart(t) {
|
|
2217
|
-
const e = t.fact.toolCallStart,
|
|
2218
|
-
if (this.isTerminalToolCall(this.messages?.get(
|
|
2284
|
+
const e = t.fact.toolCallStart, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`;
|
|
2285
|
+
if (this.isTerminalToolCall(this.messages?.get(r))) return this;
|
|
2219
2286
|
const o = {
|
|
2220
2287
|
type: "tool-call",
|
|
2221
2288
|
eventType: l.TOOL_CALL_START,
|
|
2222
|
-
messageId:
|
|
2289
|
+
messageId: r,
|
|
2223
2290
|
processId: e.processId,
|
|
2224
2291
|
callSeq: e.callSeq,
|
|
2225
2292
|
toolName: e.toolCall.toolName,
|
|
@@ -2232,10 +2299,10 @@ class b {
|
|
|
2232
2299
|
time: /* @__PURE__ */ new Date(),
|
|
2233
2300
|
traceId: t.traceId
|
|
2234
2301
|
};
|
|
2235
|
-
return
|
|
2302
|
+
return s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2236
2303
|
}
|
|
2237
2304
|
onToolCallComplete(t) {
|
|
2238
|
-
const e = t.fact.toolCallComplete,
|
|
2305
|
+
const e = t.fact.toolCallComplete, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`, o = s.get(r);
|
|
2239
2306
|
if (o?.type === "tool-call") {
|
|
2240
2307
|
const i = {
|
|
2241
2308
|
...o,
|
|
@@ -2246,12 +2313,12 @@ class b {
|
|
|
2246
2313
|
isComplete: !0,
|
|
2247
2314
|
traceId: t.traceId ?? o.traceId
|
|
2248
2315
|
};
|
|
2249
|
-
|
|
2316
|
+
s.set(r, i);
|
|
2250
2317
|
} else {
|
|
2251
2318
|
const i = {
|
|
2252
2319
|
type: "tool-call",
|
|
2253
2320
|
eventType: l.TOOL_CALL_COMPLETE,
|
|
2254
|
-
messageId:
|
|
2321
|
+
messageId: r,
|
|
2255
2322
|
processId: e.processId,
|
|
2256
2323
|
callSeq: e.callSeq,
|
|
2257
2324
|
toolName: e.toolCall.toolName,
|
|
@@ -2267,18 +2334,18 @@ class b {
|
|
|
2267
2334
|
time: /* @__PURE__ */ new Date(),
|
|
2268
2335
|
traceId: t.traceId
|
|
2269
2336
|
};
|
|
2270
|
-
|
|
2337
|
+
s.set(r, i);
|
|
2271
2338
|
}
|
|
2272
|
-
return new
|
|
2339
|
+
return new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2273
2340
|
}
|
|
2274
2341
|
onToolCallConsent(t) {
|
|
2275
2342
|
const e = t.fact.toolCallConsent;
|
|
2276
|
-
return new
|
|
2343
|
+
return new g({ messages: this.messages, pendingConsent: e });
|
|
2277
2344
|
}
|
|
2278
2345
|
onSubagentStart(t) {
|
|
2279
|
-
const e = t.fact.subagentStart,
|
|
2346
|
+
const e = t.fact.subagentStart, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:start`, o = {
|
|
2280
2347
|
type: "subagent",
|
|
2281
|
-
messageId:
|
|
2348
|
+
messageId: r,
|
|
2282
2349
|
kind: "start",
|
|
2283
2350
|
parentToolUseId: e.parentToolUseId,
|
|
2284
2351
|
agentId: e.agentId,
|
|
@@ -2287,12 +2354,12 @@ class b {
|
|
|
2287
2354
|
time: /* @__PURE__ */ new Date(),
|
|
2288
2355
|
traceId: t.traceId
|
|
2289
2356
|
};
|
|
2290
|
-
return
|
|
2357
|
+
return s.delete(r), s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2291
2358
|
}
|
|
2292
2359
|
onSubagentComplete(t) {
|
|
2293
|
-
const e = t.fact.subagentComplete,
|
|
2360
|
+
const e = t.fact.subagentComplete, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:complete`, o = {
|
|
2294
2361
|
type: "subagent",
|
|
2295
|
-
messageId:
|
|
2362
|
+
messageId: r,
|
|
2296
2363
|
kind: "complete",
|
|
2297
2364
|
parentToolUseId: e.parentToolUseId,
|
|
2298
2365
|
agentId: e.agentId,
|
|
@@ -2302,7 +2369,7 @@ class b {
|
|
|
2302
2369
|
time: /* @__PURE__ */ new Date(),
|
|
2303
2370
|
traceId: t.traceId
|
|
2304
2371
|
};
|
|
2305
|
-
return
|
|
2372
|
+
return s.delete(r), s.set(r, o), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2306
2373
|
}
|
|
2307
2374
|
}
|
|
2308
2375
|
const pn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
@@ -2312,32 +2379,32 @@ function mn(n) {
|
|
|
2312
2379
|
function Se(n) {
|
|
2313
2380
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2314
2381
|
}
|
|
2315
|
-
function
|
|
2382
|
+
function E(n) {
|
|
2316
2383
|
return typeof n == "string" ? n : void 0;
|
|
2317
2384
|
}
|
|
2318
2385
|
function gn(n) {
|
|
2319
2386
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
2320
|
-
for (const
|
|
2321
|
-
const
|
|
2322
|
-
if (
|
|
2323
|
-
const i = Se(o.task), a =
|
|
2387
|
+
for (const s of n) {
|
|
2388
|
+
const r = s.parameter ?? {}, o = s.sidecar ?? {};
|
|
2389
|
+
if (s.toolName === "TaskCreate") {
|
|
2390
|
+
const i = Se(o.task), a = E(i?.id);
|
|
2324
2391
|
if (!a) continue;
|
|
2325
2392
|
e.has(a) || t.push(a), e.set(a, {
|
|
2326
2393
|
id: a,
|
|
2327
|
-
subject:
|
|
2328
|
-
activeForm:
|
|
2329
|
-
description:
|
|
2394
|
+
subject: E(r.subject) || E(i?.subject) || "",
|
|
2395
|
+
activeForm: E(r.activeForm),
|
|
2396
|
+
description: E(r.description),
|
|
2330
2397
|
status: e.get(a)?.status ?? "pending"
|
|
2331
2398
|
// initial status = pending (keep existing on repeat)
|
|
2332
2399
|
});
|
|
2333
|
-
} else if (
|
|
2334
|
-
const i = Se(o.statusChange), a =
|
|
2335
|
-
if (!a || !
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2400
|
+
} else if (s.toolName === "TaskUpdate") {
|
|
2401
|
+
const i = Se(o.statusChange), a = E(r.taskId) || E(o.taskId), c = E(i?.to) || E(r.status);
|
|
2402
|
+
if (!a || !c) continue;
|
|
2403
|
+
const u = e.get(a);
|
|
2404
|
+
u && e.set(a, { ...u, status: c });
|
|
2338
2405
|
}
|
|
2339
2406
|
}
|
|
2340
|
-
return t.map((
|
|
2407
|
+
return t.map((s) => e.get(s));
|
|
2341
2408
|
}
|
|
2342
2409
|
function bn(n) {
|
|
2343
2410
|
return n.toolsetName === "" && n.toolName === "Agent";
|
|
@@ -2349,21 +2416,21 @@ function ye(n) {
|
|
|
2349
2416
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2350
2417
|
}
|
|
2351
2418
|
function Sn(n) {
|
|
2352
|
-
const t = [], e = /* @__PURE__ */ new Map(),
|
|
2419
|
+
const t = [], e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (o) => (e.has(o) || (t.push(o), e.set(o, { status: "running" }), s.set(o, /* @__PURE__ */ new Map())), e.get(o));
|
|
2353
2420
|
for (const o of n)
|
|
2354
2421
|
switch (o.kind) {
|
|
2355
2422
|
case "agentStart": {
|
|
2356
|
-
const i =
|
|
2423
|
+
const i = r(o.toolUseId);
|
|
2357
2424
|
o.description && !i.description && (i.description = o.description);
|
|
2358
2425
|
break;
|
|
2359
2426
|
}
|
|
2360
2427
|
case "subagentStart": {
|
|
2361
|
-
const i =
|
|
2428
|
+
const i = r(o.parentToolUseId);
|
|
2362
2429
|
i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description, ye(i);
|
|
2363
2430
|
break;
|
|
2364
2431
|
}
|
|
2365
2432
|
case "toolStart": {
|
|
2366
|
-
ye(
|
|
2433
|
+
ye(r(o.parentToolUseId)), s.get(o.parentToolUseId).set(o.toolUseId, {
|
|
2367
2434
|
toolsetName: o.toolsetName,
|
|
2368
2435
|
toolName: o.toolName,
|
|
2369
2436
|
parameter: o.parameter ?? {},
|
|
@@ -2373,12 +2440,12 @@ function Sn(n) {
|
|
|
2373
2440
|
break;
|
|
2374
2441
|
}
|
|
2375
2442
|
case "toolComplete": {
|
|
2376
|
-
const i =
|
|
2443
|
+
const i = s.get(o.parentToolUseId)?.get(o.toolUseId);
|
|
2377
2444
|
i && (i.status = o.isError ? "error" : "completed");
|
|
2378
2445
|
break;
|
|
2379
2446
|
}
|
|
2380
2447
|
case "subagentComplete": {
|
|
2381
|
-
const i =
|
|
2448
|
+
const i = r(o.parentToolUseId);
|
|
2382
2449
|
i.status = o.status, i.summary = o.summary;
|
|
2383
2450
|
break;
|
|
2384
2451
|
}
|
|
@@ -2386,7 +2453,7 @@ function Sn(n) {
|
|
|
2386
2453
|
return t.map((o) => ({
|
|
2387
2454
|
parentToolUseId: o,
|
|
2388
2455
|
...e.get(o),
|
|
2389
|
-
tools: Array.from(
|
|
2456
|
+
tools: Array.from(s.get(o).values())
|
|
2390
2457
|
}));
|
|
2391
2458
|
}
|
|
2392
2459
|
function yn(n) {
|
|
@@ -2404,11 +2471,11 @@ function wn(n) {
|
|
|
2404
2471
|
continue;
|
|
2405
2472
|
}
|
|
2406
2473
|
if (e.type === "tool-call" && vn(e.parentToolUseId)) {
|
|
2407
|
-
const
|
|
2474
|
+
const s = e.toolUseId ?? e.messageId;
|
|
2408
2475
|
t.push({
|
|
2409
2476
|
kind: "toolStart",
|
|
2410
2477
|
parentToolUseId: e.parentToolUseId,
|
|
2411
|
-
toolUseId:
|
|
2478
|
+
toolUseId: s,
|
|
2412
2479
|
toolsetName: e.toolsetName,
|
|
2413
2480
|
toolName: e.toolName,
|
|
2414
2481
|
parameter: e.parameter,
|
|
@@ -2416,7 +2483,7 @@ function wn(n) {
|
|
|
2416
2483
|
}), e.isComplete && t.push({
|
|
2417
2484
|
kind: "toolComplete",
|
|
2418
2485
|
parentToolUseId: e.parentToolUseId,
|
|
2419
|
-
toolUseId:
|
|
2486
|
+
toolUseId: s,
|
|
2420
2487
|
isError: e.isError
|
|
2421
2488
|
});
|
|
2422
2489
|
continue;
|
|
@@ -2440,53 +2507,53 @@ function wn(n) {
|
|
|
2440
2507
|
}
|
|
2441
2508
|
return t;
|
|
2442
2509
|
}
|
|
2443
|
-
function
|
|
2510
|
+
function In(n) {
|
|
2444
2511
|
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2445
2512
|
(e) => e.type === "tool-call" && e.isComplete && mn(e)
|
|
2446
2513
|
);
|
|
2447
2514
|
return gn(t);
|
|
2448
2515
|
}
|
|
2449
|
-
function
|
|
2516
|
+
function En(n) {
|
|
2450
2517
|
return Sn(wn(Array.from(n.messages?.values() ?? [])));
|
|
2451
2518
|
}
|
|
2452
2519
|
function Tn(n, t) {
|
|
2453
|
-
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e,
|
|
2454
|
-
const
|
|
2455
|
-
return e.id ===
|
|
2520
|
+
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2521
|
+
const r = t[s];
|
|
2522
|
+
return e.id === r.id && e.status === r.status && e.subject === r.subject && e.activeForm === r.activeForm && e.description === r.description;
|
|
2456
2523
|
});
|
|
2457
2524
|
}
|
|
2458
2525
|
function Cn(n, t) {
|
|
2459
|
-
return n.length !== t.length ? !1 : n.every((e,
|
|
2460
|
-
const
|
|
2461
|
-
return e.toolName ===
|
|
2526
|
+
return n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2527
|
+
const r = t[s];
|
|
2528
|
+
return e.toolName === r.toolName && e.toolsetName === r.toolsetName && e.status === r.status && e.reason === r.reason;
|
|
2462
2529
|
});
|
|
2463
2530
|
}
|
|
2464
2531
|
function xn(n, t) {
|
|
2465
|
-
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e,
|
|
2466
|
-
const
|
|
2467
|
-
return e.parentToolUseId ===
|
|
2532
|
+
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2533
|
+
const r = t[s];
|
|
2534
|
+
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary && Cn(e.tools, r.tools);
|
|
2468
2535
|
});
|
|
2469
2536
|
}
|
|
2470
|
-
function
|
|
2471
|
-
const t = new T([]), e = new T([]),
|
|
2472
|
-
return
|
|
2473
|
-
n.pipe(R(
|
|
2537
|
+
function An(n) {
|
|
2538
|
+
const t = new T([]), e = new T([]), s = new j();
|
|
2539
|
+
return s.add(n.pipe(R(In), M(Tn)).subscribe(t)), s.add(
|
|
2540
|
+
n.pipe(R(En), M(xn)).subscribe(e)
|
|
2474
2541
|
), {
|
|
2475
2542
|
tasks$: t.asObservable(),
|
|
2476
2543
|
subagents$: e.asObservable(),
|
|
2477
2544
|
getTasks: () => t.value,
|
|
2478
2545
|
getSubagents: () => e.value,
|
|
2479
|
-
teardown: () =>
|
|
2546
|
+
teardown: () => s.unsubscribe()
|
|
2480
2547
|
};
|
|
2481
2548
|
}
|
|
2482
2549
|
function we(n) {
|
|
2483
2550
|
const t = /* @__PURE__ */ new Map();
|
|
2484
2551
|
for (const e of n) t.set(e.sandboxName, e);
|
|
2485
2552
|
return [...t.values()].sort(
|
|
2486
|
-
(e,
|
|
2553
|
+
(e, s) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(s.sandboxBlueprintName || s.sandboxName)
|
|
2487
2554
|
);
|
|
2488
2555
|
}
|
|
2489
|
-
const Q = { kind: null, stopPhase: "idle" },
|
|
2556
|
+
const Q = { kind: null, stopPhase: "idle" }, On = 1e4;
|
|
2490
2557
|
function Pn(n, t) {
|
|
2491
2558
|
return n.kind === t.kind && n.stopPhase === t.stopPhase && n.requestId === t.requestId;
|
|
2492
2559
|
}
|
|
@@ -2552,7 +2619,7 @@ class q {
|
|
|
2552
2619
|
throw new Error("customChannelId must be required");
|
|
2553
2620
|
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(
|
|
2554
2621
|
we(t.launchedSandboxes ?? [])
|
|
2555
|
-
), this.derivedStores =
|
|
2622
|
+
), this.derivedStores = An(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(M()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(M()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(M()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(M()), this.runStatus$ = this.runStatusSubject.pipe(M(Pn)), this.statesObserver = t.statesObserver;
|
|
2556
2623
|
}
|
|
2557
2624
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2558
2625
|
getTasks() {
|
|
@@ -2601,15 +2668,15 @@ class q {
|
|
|
2601
2668
|
*/
|
|
2602
2669
|
applyLaunchedSandboxes(t) {
|
|
2603
2670
|
const e = we(t);
|
|
2604
|
-
this.pendingLaunches = this.pendingLaunches.filter((
|
|
2671
|
+
this.pendingLaunches = this.pendingLaunches.filter((s) => !e.some((r) => r.sandboxName === s)), this.launchedSandboxesSubject.next(e);
|
|
2605
2672
|
}
|
|
2606
2673
|
/**
|
|
2607
2674
|
* Optimistically drop one sandbox (F-019) — e.g. its fs calls keep failing or it is known to be
|
|
2608
2675
|
* recycled. The next `/channel/metadata` refetch reconciles the authoritative truth.
|
|
2609
2676
|
*/
|
|
2610
2677
|
dropSandbox(t) {
|
|
2611
|
-
const e = this.launchedSandboxesSubject.value,
|
|
2612
|
-
|
|
2678
|
+
const e = this.launchedSandboxesSubject.value, s = e.filter((r) => r.sandboxName !== t);
|
|
2679
|
+
s.length !== e.length && this.launchedSandboxesSubject.next(s);
|
|
2613
2680
|
}
|
|
2614
2681
|
/**
|
|
2615
2682
|
* Record an `asgard.sandbox.launch` hint (F-019): the event is not trusted to add a live sandbox (it may
|
|
@@ -2637,10 +2704,10 @@ class q {
|
|
|
2637
2704
|
const e = new q(t);
|
|
2638
2705
|
return e.subscribe(), e;
|
|
2639
2706
|
}
|
|
2640
|
-
static async reset(t, e,
|
|
2707
|
+
static async reset(t, e, s, r) {
|
|
2641
2708
|
const o = new q(t);
|
|
2642
2709
|
try {
|
|
2643
|
-
return o.subscribe(),
|
|
2710
|
+
return o.subscribe(), r?.(o), await o.resetChannel(e, s), o;
|
|
2644
2711
|
} catch (i) {
|
|
2645
2712
|
throw o.close(), i;
|
|
2646
2713
|
}
|
|
@@ -2652,16 +2719,16 @@ class q {
|
|
|
2652
2719
|
* so the channel's history / session / title are preserved — this is the fix for the mount-time
|
|
2653
2720
|
* "join an existing channel and wipe its history" data-loss bug.
|
|
2654
2721
|
*/
|
|
2655
|
-
static async restore(t, e,
|
|
2656
|
-
const
|
|
2722
|
+
static async restore(t, e, s) {
|
|
2723
|
+
const r = new q(t);
|
|
2657
2724
|
try {
|
|
2658
|
-
return
|
|
2725
|
+
return r.subscribe(), s?.(r), await r.rejoinChannel(e), r;
|
|
2659
2726
|
} catch (o) {
|
|
2660
|
-
throw
|
|
2727
|
+
throw r.close(), o;
|
|
2661
2728
|
}
|
|
2662
2729
|
}
|
|
2663
2730
|
subscribe() {
|
|
2664
|
-
this.statesSubscription =
|
|
2731
|
+
this.statesSubscription = Xt([
|
|
2665
2732
|
this.isConnecting$,
|
|
2666
2733
|
this.conversation$,
|
|
2667
2734
|
this.derivedStores.tasks$,
|
|
@@ -2676,23 +2743,23 @@ class q {
|
|
|
2676
2743
|
([
|
|
2677
2744
|
t,
|
|
2678
2745
|
e,
|
|
2679
|
-
r,
|
|
2680
2746
|
s,
|
|
2747
|
+
r,
|
|
2681
2748
|
o,
|
|
2682
2749
|
i,
|
|
2683
2750
|
a,
|
|
2684
|
-
|
|
2685
|
-
|
|
2751
|
+
c,
|
|
2752
|
+
u
|
|
2686
2753
|
]) => ({
|
|
2687
2754
|
isConnecting: t,
|
|
2688
2755
|
conversation: e,
|
|
2689
|
-
tasks:
|
|
2690
|
-
subagents:
|
|
2756
|
+
tasks: s,
|
|
2757
|
+
subagents: r,
|
|
2691
2758
|
channelTitle: o,
|
|
2692
2759
|
promptSuggestion: i,
|
|
2693
2760
|
sandboxPhase: a,
|
|
2694
|
-
launchedSandboxes:
|
|
2695
|
-
runStatus:
|
|
2761
|
+
launchedSandboxes: c,
|
|
2762
|
+
runStatus: u
|
|
2696
2763
|
})
|
|
2697
2764
|
)
|
|
2698
2765
|
).subscribe(this.statesObserver);
|
|
@@ -2735,27 +2802,27 @@ class q {
|
|
|
2735
2802
|
* through the conversation reducer, keep the title store in sync, attach the traceId to the pending
|
|
2736
2803
|
* user bubble, and settle the run promise (releasing `isConnecting`) on completion / error.
|
|
2737
2804
|
*/
|
|
2738
|
-
buildRunHandlers(t, e,
|
|
2805
|
+
buildRunHandlers(t, e, s) {
|
|
2739
2806
|
return {
|
|
2740
2807
|
onSseStart: t?.onSseStart,
|
|
2741
|
-
onSseMessage: (
|
|
2742
|
-
if (t?.onSseMessage?.(
|
|
2743
|
-
|
|
2744
|
-
),
|
|
2745
|
-
|
|
2746
|
-
) :
|
|
2808
|
+
onSseMessage: (r) => {
|
|
2809
|
+
if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType === l.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
2810
|
+
r.fact.channelTitleUpdate.title
|
|
2811
|
+
), r.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
|
|
2812
|
+
r.fact.promptSuggestion.suggestion
|
|
2813
|
+
) : r.eventType === l.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(r.eventType), r.eventType === l.SANDBOX_LAUNCH && this.noteSandboxLaunch(r.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && r.traceId) {
|
|
2747
2814
|
const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
|
|
2748
2815
|
i && i.type === "user" && (o.set(this.currentUserMessageId, {
|
|
2749
2816
|
...i,
|
|
2750
|
-
traceId:
|
|
2817
|
+
traceId: r.traceId
|
|
2751
2818
|
}), this.conversation$.next(
|
|
2752
|
-
new
|
|
2819
|
+
new g({ messages: o, pendingConsent: this.conversation$.value.pendingConsent })
|
|
2753
2820
|
)), this.currentUserMessageId = void 0;
|
|
2754
2821
|
}
|
|
2755
|
-
this.conversation$.next(this.conversation$.value.onMessage(
|
|
2822
|
+
this.conversation$.next(this.conversation$.value.onMessage(r));
|
|
2756
2823
|
},
|
|
2757
|
-
onSseError: (
|
|
2758
|
-
t?.onSseError?.(
|
|
2824
|
+
onSseError: (r) => {
|
|
2825
|
+
t?.onSseError?.(r), this.settleRun(), s(r);
|
|
2759
2826
|
},
|
|
2760
2827
|
onSseCompleted: () => {
|
|
2761
2828
|
t?.onSseCompleted?.(), this.settleRun(), e();
|
|
@@ -2779,9 +2846,9 @@ class q {
|
|
|
2779
2846
|
clearForceStopTimer() {
|
|
2780
2847
|
this.forceStopTimer && (clearTimeout(this.forceStopTimer), this.forceStopTimer = void 0);
|
|
2781
2848
|
}
|
|
2782
|
-
fetchSse(t, e,
|
|
2783
|
-
return new Promise((
|
|
2784
|
-
this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(
|
|
2849
|
+
fetchSse(t, e, s) {
|
|
2850
|
+
return new Promise((r, o) => {
|
|
2851
|
+
this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(s, r, o));
|
|
2785
2852
|
});
|
|
2786
2853
|
}
|
|
2787
2854
|
/**
|
|
@@ -2791,7 +2858,7 @@ class q {
|
|
|
2791
2858
|
* restore), so the input is released rather than stuck.
|
|
2792
2859
|
*/
|
|
2793
2860
|
rejoinChannel(t) {
|
|
2794
|
-
return new Promise((e,
|
|
2861
|
+
return new Promise((e, s) => {
|
|
2795
2862
|
if (!this.client.rejoinSse) {
|
|
2796
2863
|
e();
|
|
2797
2864
|
return;
|
|
@@ -2799,7 +2866,7 @@ class q {
|
|
|
2799
2866
|
this.isConnecting$.next(!0), this.runStatusSubject.next({
|
|
2800
2867
|
kind: this.joinRunState === "RUNNING" ? "restore" : "replay",
|
|
2801
2868
|
stopPhase: "idle"
|
|
2802
|
-
}), this.currentRun = this.client.rejoinSse(this.customChannelId, this.buildRunHandlers(t, e,
|
|
2869
|
+
}), this.currentRun = this.client.rejoinSse(this.customChannelId, this.buildRunHandlers(t, e, s));
|
|
2803
2870
|
});
|
|
2804
2871
|
}
|
|
2805
2872
|
resetChannel(t, e) {
|
|
@@ -2816,12 +2883,12 @@ class q {
|
|
|
2816
2883
|
);
|
|
2817
2884
|
}
|
|
2818
2885
|
sendMessage(t, e) {
|
|
2819
|
-
const
|
|
2820
|
-
if (
|
|
2821
|
-
const
|
|
2822
|
-
if (
|
|
2886
|
+
const s = this.runStatusSubject.value.kind;
|
|
2887
|
+
if (s) return Promise.reject(new Z(s));
|
|
2888
|
+
const r = this.conversation$.value.pendingConsent;
|
|
2889
|
+
if (r) return Promise.reject(new ee(r.processId));
|
|
2823
2890
|
this.clearPromptSuggestion();
|
|
2824
|
-
const o = t.text.trim(), i = t.customMessageId ??
|
|
2891
|
+
const o = t.text.trim(), i = t.customMessageId ?? Ve();
|
|
2825
2892
|
return this.currentUserMessageId = i, this.lastSentMessageId = i, this.conversation$.next(
|
|
2826
2893
|
this.conversation$.value.pushMessage({
|
|
2827
2894
|
type: "user",
|
|
@@ -2845,21 +2912,21 @@ class q {
|
|
|
2845
2912
|
e
|
|
2846
2913
|
);
|
|
2847
2914
|
}
|
|
2848
|
-
replyToolCallConsents(t, e,
|
|
2849
|
-
const
|
|
2915
|
+
replyToolCallConsents(t, e, s) {
|
|
2916
|
+
const r = this.conversation$.value.pendingConsent;
|
|
2850
2917
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
2851
2918
|
"user",
|
|
2852
2919
|
{
|
|
2853
2920
|
action: $.RESPONSE_TOOL_CALL_CONSENT,
|
|
2854
2921
|
customChannelId: this.customChannelId,
|
|
2855
2922
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
2856
|
-
payload: this.resolvePayload(
|
|
2923
|
+
payload: this.resolvePayload(s),
|
|
2857
2924
|
text: "",
|
|
2858
2925
|
toolCallConsents: t
|
|
2859
2926
|
},
|
|
2860
2927
|
e
|
|
2861
2928
|
).catch((o) => {
|
|
2862
|
-
throw
|
|
2929
|
+
throw r && this.conversation$.next(this.conversation$.value.restorePendingConsent(r)), o;
|
|
2863
2930
|
});
|
|
2864
2931
|
}
|
|
2865
2932
|
/**
|
|
@@ -2883,10 +2950,10 @@ class q {
|
|
|
2883
2950
|
* `ChannelAwaitingConsentError` while a consent prompt is pending — exactly like `sendMessage`.
|
|
2884
2951
|
*/
|
|
2885
2952
|
nudge(t, e) {
|
|
2886
|
-
const
|
|
2887
|
-
if (
|
|
2888
|
-
const
|
|
2889
|
-
return
|
|
2953
|
+
const s = this.runStatusSubject.value.kind;
|
|
2954
|
+
if (s) return Promise.reject(new Z(s));
|
|
2955
|
+
const r = this.conversation$.value.pendingConsent;
|
|
2956
|
+
return r ? Promise.reject(new ee(r.processId)) : this.fetchSse(
|
|
2890
2957
|
"nudge",
|
|
2891
2958
|
{
|
|
2892
2959
|
action: $.NUDGE,
|
|
@@ -2939,8 +3006,8 @@ class q {
|
|
|
2939
3006
|
requestId: e.requestId,
|
|
2940
3007
|
force: t?.force
|
|
2941
3008
|
});
|
|
2942
|
-
} catch (
|
|
2943
|
-
throw this.clearForceStopTimer(), this.runStatusSubject.next({ ...this.runStatusSubject.value, stopPhase: "idle" }),
|
|
3009
|
+
} catch (s) {
|
|
3010
|
+
throw this.clearForceStopTimer(), this.runStatusSubject.next({ ...this.runStatusSubject.value, stopPhase: "idle" }), s;
|
|
2944
3011
|
}
|
|
2945
3012
|
this.armForceStopTimer();
|
|
2946
3013
|
}
|
|
@@ -2955,7 +3022,7 @@ class q {
|
|
|
2955
3022
|
this.forceStopTimer = void 0;
|
|
2956
3023
|
const t = this.runStatusSubject.value;
|
|
2957
3024
|
t.stopPhase === "stopping" && this.runStatusSubject.next({ ...t, stopPhase: "force-stoppable" });
|
|
2958
|
-
},
|
|
3025
|
+
}, On);
|
|
2959
3026
|
}
|
|
2960
3027
|
/**
|
|
2961
3028
|
* Cut the local SSE connection without telling the backend. This is *not* stop-generation (see
|
|
@@ -2975,31 +3042,31 @@ class q {
|
|
|
2975
3042
|
function Nn(n) {
|
|
2976
3043
|
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
2977
3044
|
if (!t) return null;
|
|
2978
|
-
const e = decodeURIComponent(t[1]),
|
|
2979
|
-
if (
|
|
2980
|
-
if (
|
|
2981
|
-
const o =
|
|
3045
|
+
const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
|
|
3046
|
+
if (s === "open-browser") return { kind: "open-browser", sandboxName: e };
|
|
3047
|
+
if (s === "open-file") {
|
|
3048
|
+
const o = r.get("absolute_path");
|
|
2982
3049
|
return o ? { kind: "open-file", sandboxName: e, absolutePath: o } : null;
|
|
2983
3050
|
}
|
|
2984
3051
|
return null;
|
|
2985
3052
|
}
|
|
2986
3053
|
export {
|
|
2987
|
-
|
|
3054
|
+
Un as AsgardServiceClient,
|
|
2988
3055
|
q as Channel,
|
|
2989
3056
|
ee as ChannelAwaitingConsentError,
|
|
2990
3057
|
Z as ChannelBusyError,
|
|
2991
|
-
|
|
3058
|
+
g as Conversation,
|
|
2992
3059
|
l as EventType,
|
|
2993
3060
|
$ as FetchSseAction,
|
|
2994
3061
|
w as HttpError,
|
|
2995
|
-
|
|
3062
|
+
Ie as MessageTemplateType,
|
|
2996
3063
|
Xe as ToolCallConsentResult,
|
|
2997
3064
|
wn as conversationToSubagentEvents,
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3065
|
+
An as createDerivedStores,
|
|
3066
|
+
En as deriveSubagents,
|
|
3067
|
+
In as deriveTasks,
|
|
3001
3068
|
bn as isAgentTool,
|
|
3002
|
-
|
|
3069
|
+
Mn as isChannelAwaitingConsentError,
|
|
3003
3070
|
Ln as isChannelBusyError,
|
|
3004
3071
|
_n as isHttpError,
|
|
3005
3072
|
vn as isSubagentChildTool,
|