@asgard-js/core 0.3.80 → 0.3.82
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/README.md +50 -0
- package/dist/constants/enum.d.ts +1 -0
- package/dist/constants/enum.d.ts.map +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +860 -722
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +13 -1
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/lib/client.d.ts +31 -10
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/conversation.d.ts +25 -2
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/feedback-message.d.ts +27 -0
- package/dist/lib/feedback-message.d.ts.map +1 -0
- package/dist/lib/message-feedback.spec.d.ts +2 -0
- package/dist/lib/message-feedback.spec.d.ts.map +1 -0
- package/dist/lib/sandbox-channel-scope.spec.d.ts +2 -0
- package/dist/lib/sandbox-channel-scope.spec.d.ts.map +1 -0
- package/dist/types/channel.d.ts +17 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts +30 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/sandbox-fs.d.ts +13 -3
- package/dist/types/sandbox-fs.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +17 -0
- package/dist/types/sse-response.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class y extends Error {
|
|
2
2
|
status;
|
|
3
3
|
statusText;
|
|
4
4
|
/**
|
|
@@ -16,8 +16,8 @@ class E extends Error {
|
|
|
16
16
|
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = s;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return n instanceof
|
|
19
|
+
function kn(n) {
|
|
20
|
+
return n instanceof y;
|
|
21
21
|
}
|
|
22
22
|
class te extends Error {
|
|
23
23
|
/** Which run is holding the channel. */
|
|
@@ -26,7 +26,7 @@ class te extends Error {
|
|
|
26
26
|
super(`Cannot send a message while a "${t}" run is in flight on this channel.`), this.name = "ChannelBusyError", this.runKind = t;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function Pn(n) {
|
|
30
30
|
return n instanceof te;
|
|
31
31
|
}
|
|
32
32
|
class ne extends Error {
|
|
@@ -43,71 +43,71 @@ class ne 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 _n(n) {
|
|
47
47
|
return n instanceof ne;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
async function
|
|
49
|
+
var H = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))(H || {}), 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.MESSAGE_FEEDBACK = "asgard.message.feedback", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), ze = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(ze || {}), Ce = /* @__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))(Ce || {});
|
|
50
|
+
async function Je(n, t) {
|
|
51
51
|
const e = n.getReader();
|
|
52
52
|
let s;
|
|
53
53
|
for (; !(s = await e.read()).done; )
|
|
54
54
|
t(s.value);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Qe(n) {
|
|
57
57
|
let t, e, s, r = !1;
|
|
58
|
-
return function(
|
|
59
|
-
t === void 0 ? (t =
|
|
60
|
-
const
|
|
61
|
-
let
|
|
62
|
-
for (; e <
|
|
63
|
-
r && (t[e] === 10 && (
|
|
64
|
-
let
|
|
65
|
-
for (; e <
|
|
58
|
+
return function(a) {
|
|
59
|
+
t === void 0 ? (t = a, e = 0, s = -1) : t = et(t, a);
|
|
60
|
+
const o = t.length;
|
|
61
|
+
let c = 0;
|
|
62
|
+
for (; e < o; ) {
|
|
63
|
+
r && (t[e] === 10 && (c = ++e), r = !1);
|
|
64
|
+
let u = -1;
|
|
65
|
+
for (; e < o && u === -1; ++e)
|
|
66
66
|
switch (t[e]) {
|
|
67
67
|
case 58:
|
|
68
|
-
s === -1 && (s = e -
|
|
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 === o ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Ze(n, t, e) {
|
|
84
84
|
let s = le();
|
|
85
85
|
const r = new TextDecoder();
|
|
86
|
-
return function(
|
|
87
|
-
if (
|
|
86
|
+
return function(a, o) {
|
|
87
|
+
if (a.length === 0)
|
|
88
88
|
e?.(s), s = le();
|
|
89
|
-
else if (
|
|
90
|
-
const
|
|
91
|
-
switch (
|
|
89
|
+
else if (o > 0) {
|
|
90
|
+
const c = r.decode(a.subarray(0, o)), u = o + (a[o + 1] === 32 ? 2 : 1), d = r.decode(a.subarray(u));
|
|
91
|
+
switch (c) {
|
|
92
92
|
case "data":
|
|
93
93
|
s.data = s.data ? s.data + `
|
|
94
|
-
` +
|
|
94
|
+
` + d : d;
|
|
95
95
|
break;
|
|
96
96
|
case "event":
|
|
97
|
-
s.event =
|
|
97
|
+
s.event = d;
|
|
98
98
|
break;
|
|
99
99
|
case "id":
|
|
100
|
-
n(s.id =
|
|
100
|
+
n(s.id = d);
|
|
101
101
|
break;
|
|
102
102
|
case "retry":
|
|
103
|
-
const m = parseInt(
|
|
103
|
+
const m = parseInt(d, 10);
|
|
104
104
|
isNaN(m) || t(s.retry = m);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function et(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
|
}
|
|
@@ -119,7 +119,7 @@ function le() {
|
|
|
119
119
|
retry: void 0
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
var
|
|
122
|
+
var tt = function(n, t) {
|
|
123
123
|
var e = {};
|
|
124
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")
|
|
@@ -127,49 +127,49 @@ var et = function(n, t) {
|
|
|
127
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
|
-
const se = "text/event-stream",
|
|
131
|
-
function
|
|
132
|
-
var { signal: e, headers: s, onopen: r, onmessage: i, onclose:
|
|
130
|
+
const se = "text/event-stream", nt = 1e3, de = "last-event-id";
|
|
131
|
+
function xe(n, t) {
|
|
132
|
+
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: a, onerror: o, openWhenHidden: c, fetch: u } = t, d = tt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
134
|
const h = Object.assign({}, s);
|
|
135
135
|
h.accept || (h.accept = se);
|
|
136
136
|
let p;
|
|
137
137
|
function f() {
|
|
138
|
-
p.abort(), document.hidden ||
|
|
138
|
+
p.abort(), document.hidden || F();
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
let I =
|
|
142
|
-
function
|
|
143
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
140
|
+
c || document.addEventListener("visibilitychange", f);
|
|
141
|
+
let I = nt, E = 0;
|
|
142
|
+
function B() {
|
|
143
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(E), p.abort();
|
|
144
144
|
}
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
|
-
|
|
146
|
+
B(), m();
|
|
147
147
|
});
|
|
148
|
-
const
|
|
149
|
-
async function
|
|
150
|
-
var
|
|
148
|
+
const R = u ?? window.fetch, _ = r ?? st;
|
|
149
|
+
async function F() {
|
|
150
|
+
var j;
|
|
151
151
|
p = new AbortController();
|
|
152
152
|
try {
|
|
153
|
-
const
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
}, (
|
|
157
|
-
I =
|
|
158
|
-
}, i))),
|
|
159
|
-
} catch (
|
|
153
|
+
const $ = await R(n, Object.assign(Object.assign({}, d), { headers: h, signal: p.signal }));
|
|
154
|
+
await _($), await Je($.body, Qe(Ze((k) => {
|
|
155
|
+
k ? h[de] = k : delete h[de];
|
|
156
|
+
}, (k) => {
|
|
157
|
+
I = k;
|
|
158
|
+
}, i))), a?.(), B(), m();
|
|
159
|
+
} catch ($) {
|
|
160
160
|
if (!p.signal.aborted)
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
163
|
-
window.clearTimeout(
|
|
164
|
-
} catch (
|
|
165
|
-
|
|
162
|
+
const k = (j = o?.($)) !== null && j !== void 0 ? j : I;
|
|
163
|
+
window.clearTimeout(E), E = window.setTimeout(F, k);
|
|
164
|
+
} catch (k) {
|
|
165
|
+
B(), v(k);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
F();
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function st(n) {
|
|
173
173
|
const t = n.headers.get("content-type");
|
|
174
174
|
if (!t?.startsWith(se))
|
|
175
175
|
throw new Error(`Expected content-type to be ${se}, Actual: ${t}`);
|
|
@@ -190,94 +190,94 @@ function O(n, t) {
|
|
|
190
190
|
}
|
|
191
191
|
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function rt(n, t, e, s) {
|
|
194
194
|
function r(i) {
|
|
195
|
-
return i instanceof e ? i : new e(function(
|
|
196
|
-
|
|
195
|
+
return i instanceof e ? i : new e(function(a) {
|
|
196
|
+
a(i);
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
return new (e || (e = Promise))(function(i,
|
|
200
|
-
function
|
|
199
|
+
return new (e || (e = Promise))(function(i, a) {
|
|
200
|
+
function o(d) {
|
|
201
201
|
try {
|
|
202
|
-
|
|
202
|
+
u(s.next(d));
|
|
203
203
|
} catch (m) {
|
|
204
|
-
|
|
204
|
+
a(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function c(d) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
u(s.throw(d));
|
|
210
210
|
} catch (m) {
|
|
211
|
-
|
|
211
|
+
a(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
214
|
+
function u(d) {
|
|
215
|
+
d.done ? i(d.value) : r(d.value).then(o, c);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
u((s = s.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Ae(n, t) {
|
|
221
221
|
var e = { label: 0, sent: function() {
|
|
222
222
|
if (i[0] & 1) throw i[1];
|
|
223
223
|
return i[1];
|
|
224
|
-
}, trys: [], ops: [] }, s, r, i,
|
|
225
|
-
return
|
|
224
|
+
}, trys: [], ops: [] }, s, r, i, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
225
|
+
return a.next = o(0), a.throw = o(1), a.return = o(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
226
226
|
return this;
|
|
227
|
-
}),
|
|
228
|
-
function
|
|
229
|
-
return function(
|
|
230
|
-
return
|
|
227
|
+
}), a;
|
|
228
|
+
function o(u) {
|
|
229
|
+
return function(d) {
|
|
230
|
+
return c([u, d]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function u
|
|
233
|
+
function c(u) {
|
|
234
234
|
if (s) throw new TypeError("Generator is already executing.");
|
|
235
|
-
for (;
|
|
236
|
-
if (s = 1, r && (i =
|
|
237
|
-
switch (r = 0, i && (
|
|
235
|
+
for (; a && (a = 0, u[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (s = 1, r && (i = u[0] & 2 ? r.return : u[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, u[1])).done) return i;
|
|
237
|
+
switch (r = 0, i && (u = [u[0] & 2, i.value]), u[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
i =
|
|
240
|
+
i = 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++, r =
|
|
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 (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (
|
|
251
|
+
if (i = e.trys, !(i = i.length > 0 && i[i.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 && (!i || u[1] > i[0] && u[1] < i[3])) {
|
|
256
|
+
e.label = u[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
e.label = i[1], i =
|
|
259
|
+
if (u[0] === 6 && e.label < i[1]) {
|
|
260
|
+
e.label = i[1], i = u;
|
|
261
261
|
break;
|
|
262
262
|
}
|
|
263
263
|
if (i && e.label < i[2]) {
|
|
264
|
-
e.label = i[2], e.ops.push(
|
|
264
|
+
e.label = i[2], e.ops.push(u);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
i[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
} catch (
|
|
272
|
-
|
|
270
|
+
u = t.call(n, e);
|
|
271
|
+
} catch (d) {
|
|
272
|
+
u = [6, d], r = 0;
|
|
273
273
|
} finally {
|
|
274
274
|
s = i = 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
|
-
function
|
|
280
|
+
function U(n) {
|
|
281
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 {
|
|
@@ -290,16 +290,16 @@ function M(n) {
|
|
|
290
290
|
function q(n, t) {
|
|
291
291
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
292
292
|
if (!e) return n;
|
|
293
|
-
var s = e.call(n), r, i = [],
|
|
293
|
+
var s = e.call(n), r, i = [], a;
|
|
294
294
|
try {
|
|
295
295
|
for (; (t === void 0 || t-- > 0) && !(r = s.next()).done; ) i.push(r.value);
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
296
|
+
} catch (o) {
|
|
297
|
+
a = { error: o };
|
|
298
298
|
} finally {
|
|
299
299
|
try {
|
|
300
300
|
r && !r.done && (e = s.return) && e.call(s);
|
|
301
301
|
} finally {
|
|
302
|
-
if (
|
|
302
|
+
if (a) throw a.error;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
return i;
|
|
@@ -309,76 +309,76 @@ function K(n, t, e) {
|
|
|
309
309
|
(i || !(s in t)) && (i || (i = Array.prototype.slice.call(t, 0, s)), i[s] = t[s]);
|
|
310
310
|
return n.concat(i || Array.prototype.slice.call(t));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return this instanceof
|
|
312
|
+
function D(n) {
|
|
313
|
+
return this instanceof D ? (this.v = n, this) : new D(n);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function it(n, t, e) {
|
|
316
316
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
317
317
|
var s = e.apply(n, t || []), r, i = [];
|
|
318
|
-
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype),
|
|
318
|
+
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), o("next"), o("throw"), o("return", a), r[Symbol.asyncIterator] = function() {
|
|
319
319
|
return this;
|
|
320
320
|
}, r;
|
|
321
|
-
function
|
|
321
|
+
function a(h) {
|
|
322
322
|
return function(p) {
|
|
323
323
|
return Promise.resolve(p).then(h, m);
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function o(h, p) {
|
|
327
327
|
s[h] && (r[h] = function(f) {
|
|
328
|
-
return new Promise(function(I,
|
|
329
|
-
i.push([h, f, I,
|
|
328
|
+
return new Promise(function(I, E) {
|
|
329
|
+
i.push([h, f, I, E]) > 1 || c(h, f);
|
|
330
330
|
});
|
|
331
331
|
}, p && (r[h] = p(r[h])));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function c(h, p) {
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
u(s[h](p));
|
|
336
336
|
} catch (f) {
|
|
337
337
|
v(i[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
h.value instanceof
|
|
340
|
+
function u(h) {
|
|
341
|
+
h.value instanceof D ? Promise.resolve(h.value.v).then(d, m) : v(i[0][2], h);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
|
|
343
|
+
function d(h) {
|
|
344
|
+
c("next", h);
|
|
345
345
|
}
|
|
346
346
|
function m(h) {
|
|
347
|
-
|
|
347
|
+
c("throw", h);
|
|
348
348
|
}
|
|
349
349
|
function v(h, p) {
|
|
350
|
-
h(p), i.shift(), i.length &&
|
|
350
|
+
h(p), i.shift(), i.length && c(i[0][0], i[0][1]);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function at(n) {
|
|
354
354
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
355
355
|
var t = n[Symbol.asyncIterator], e;
|
|
356
|
-
return t ? t.call(n) : (n = typeof
|
|
356
|
+
return t ? t.call(n) : (n = typeof U == "function" ? U(n) : n[Symbol.iterator](), e = {}, s("next"), s("throw"), s("return"), e[Symbol.asyncIterator] = function() {
|
|
357
357
|
return this;
|
|
358
358
|
}, e);
|
|
359
359
|
function s(i) {
|
|
360
|
-
e[i] = n[i] && function(
|
|
361
|
-
return new Promise(function(
|
|
362
|
-
|
|
360
|
+
e[i] = n[i] && function(a) {
|
|
361
|
+
return new Promise(function(o, c) {
|
|
362
|
+
a = n[i](a), r(o, c, a.done, a.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function r(i,
|
|
367
|
-
Promise.resolve(
|
|
368
|
-
i({ value:
|
|
369
|
-
},
|
|
366
|
+
function r(i, a, o, c) {
|
|
367
|
+
Promise.resolve(c).then(function(u) {
|
|
368
|
+
i({ value: u, done: o });
|
|
369
|
+
}, a);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
function b(n) {
|
|
373
373
|
return typeof n == "function";
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Oe(n) {
|
|
376
376
|
var t = function(s) {
|
|
377
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 Q =
|
|
381
|
+
var Q = Oe(function(n) {
|
|
382
382
|
return function(e) {
|
|
383
383
|
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
384
384
|
` + e.map(function(s, r) {
|
|
@@ -393,7 +393,7 @@ function V(n, t) {
|
|
|
393
393
|
0 <= e && n.splice(e, 1);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
var
|
|
396
|
+
var L = (function() {
|
|
397
397
|
function n(t) {
|
|
398
398
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
399
399
|
}
|
|
@@ -401,29 +401,29 @@ var N = (function() {
|
|
|
401
401
|
var t, e, s, r, i;
|
|
402
402
|
if (!this.closed) {
|
|
403
403
|
this.closed = !0;
|
|
404
|
-
var
|
|
405
|
-
if (
|
|
406
|
-
if (this._parentage = null, Array.isArray(
|
|
404
|
+
var a = this._parentage;
|
|
405
|
+
if (a)
|
|
406
|
+
if (this._parentage = null, Array.isArray(a))
|
|
407
407
|
try {
|
|
408
|
-
for (var
|
|
409
|
-
var
|
|
410
|
-
|
|
408
|
+
for (var o = U(a), c = o.next(); !c.done; c = o.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 = o.return) && e.call(o);
|
|
417
417
|
} finally {
|
|
418
418
|
if (t) throw t.error;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
else
|
|
422
|
-
|
|
423
|
-
var
|
|
424
|
-
if (b(
|
|
422
|
+
a.remove(this);
|
|
423
|
+
var d = this.initialTeardown;
|
|
424
|
+
if (b(d))
|
|
425
425
|
try {
|
|
426
|
-
|
|
426
|
+
d();
|
|
427
427
|
} catch (f) {
|
|
428
428
|
i = f instanceof Q ? f.errors : [f];
|
|
429
429
|
}
|
|
@@ -431,7 +431,7 @@ var N = (function() {
|
|
|
431
431
|
if (m) {
|
|
432
432
|
this._finalizers = null;
|
|
433
433
|
try {
|
|
434
|
-
for (var v =
|
|
434
|
+
for (var v = U(m), h = v.next(); !h.done; h = v.next()) {
|
|
435
435
|
var p = h.value;
|
|
436
436
|
try {
|
|
437
437
|
he(p);
|
|
@@ -481,16 +481,16 @@ var N = (function() {
|
|
|
481
481
|
var t = new n();
|
|
482
482
|
return t.closed = !0, t;
|
|
483
483
|
})(), n;
|
|
484
|
-
})(),
|
|
484
|
+
})(), ke = L.EMPTY;
|
|
485
485
|
function Pe(n) {
|
|
486
|
-
return n instanceof
|
|
486
|
+
return n instanceof L || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
|
|
487
487
|
}
|
|
488
488
|
function he(n) {
|
|
489
489
|
b(n) ? n() : n.unsubscribe();
|
|
490
490
|
}
|
|
491
491
|
var ot = {
|
|
492
492
|
Promise: void 0
|
|
493
|
-
},
|
|
493
|
+
}, ct = {
|
|
494
494
|
setTimeout: function(n, t) {
|
|
495
495
|
for (var e = [], s = 2; s < arguments.length; s++)
|
|
496
496
|
e[s - 2] = arguments[s];
|
|
@@ -502,7 +502,7 @@ var ot = {
|
|
|
502
502
|
delegate: void 0
|
|
503
503
|
};
|
|
504
504
|
function _e(n) {
|
|
505
|
-
|
|
505
|
+
ct.setTimeout(function() {
|
|
506
506
|
throw n;
|
|
507
507
|
});
|
|
508
508
|
}
|
|
@@ -511,14 +511,14 @@ function ie() {
|
|
|
511
511
|
function X(n) {
|
|
512
512
|
n();
|
|
513
513
|
}
|
|
514
|
-
var
|
|
514
|
+
var oe = (function(n) {
|
|
515
515
|
O(t, n);
|
|
516
516
|
function t(e) {
|
|
517
517
|
var s = n.call(this) || this;
|
|
518
|
-
return s.isStopped = !1, e ? (s.destination = e, Pe(e) && e.add(s)) : s.destination =
|
|
518
|
+
return s.isStopped = !1, e ? (s.destination = e, Pe(e) && e.add(s)) : s.destination = dt, s;
|
|
519
519
|
}
|
|
520
520
|
return t.create = function(e, s, r) {
|
|
521
|
-
return new
|
|
521
|
+
return new ae(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 ae = (function(n) {
|
|
|
542
542
|
this.unsubscribe();
|
|
543
543
|
}
|
|
544
544
|
}, t;
|
|
545
|
-
})(
|
|
545
|
+
})(L), ut = (function() {
|
|
546
546
|
function n(t) {
|
|
547
547
|
this.partialObserver = t;
|
|
548
548
|
}
|
|
@@ -573,28 +573,28 @@ var ae = (function(n) {
|
|
|
573
573
|
W(e);
|
|
574
574
|
}
|
|
575
575
|
}, n;
|
|
576
|
-
})(),
|
|
576
|
+
})(), ae = (function(n) {
|
|
577
577
|
O(t, n);
|
|
578
578
|
function t(e, s, r) {
|
|
579
|
-
var i = n.call(this) || this,
|
|
580
|
-
return b(e) || !e ?
|
|
579
|
+
var i = n.call(this) || this, a;
|
|
580
|
+
return b(e) || !e ? a = {
|
|
581
581
|
next: e ?? void 0,
|
|
582
582
|
error: s ?? void 0,
|
|
583
583
|
complete: r ?? void 0
|
|
584
|
-
} :
|
|
584
|
+
} : a = e, i.destination = new ut(a), i;
|
|
585
585
|
}
|
|
586
586
|
return t;
|
|
587
|
-
})(
|
|
587
|
+
})(oe);
|
|
588
588
|
function W(n) {
|
|
589
589
|
_e(n);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function lt(n) {
|
|
592
592
|
throw n;
|
|
593
593
|
}
|
|
594
|
-
var
|
|
594
|
+
var dt = {
|
|
595
595
|
closed: !0,
|
|
596
596
|
next: ie,
|
|
597
|
-
error:
|
|
597
|
+
error: lt,
|
|
598
598
|
complete: ie
|
|
599
599
|
}, ce = (function() {
|
|
600
600
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
@@ -602,14 +602,14 @@ var lt = {
|
|
|
602
602
|
function z(n) {
|
|
603
603
|
return n;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function ht(n) {
|
|
606
606
|
return n.length === 0 ? z : n.length === 1 ? n[0] : function(e) {
|
|
607
607
|
return n.reduce(function(s, r) {
|
|
608
608
|
return r(s);
|
|
609
609
|
}, e);
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
var
|
|
612
|
+
var w = (function() {
|
|
613
613
|
function n(t) {
|
|
614
614
|
t && (this._subscribe = t);
|
|
615
615
|
}
|
|
@@ -617,10 +617,10 @@ var y = (function() {
|
|
|
617
617
|
var e = new n();
|
|
618
618
|
return e.source = this, e.operator = t, e;
|
|
619
619
|
}, n.prototype.subscribe = function(t, e, s) {
|
|
620
|
-
var r = this, i =
|
|
620
|
+
var r = this, i = pt(t) ? t : new ae(t, e, s);
|
|
621
621
|
return X(function() {
|
|
622
|
-
var
|
|
623
|
-
i.add(
|
|
622
|
+
var a = r, o = a.operator, c = a.source;
|
|
623
|
+
i.add(o ? o.call(i, c) : c ? r._subscribe(i) : r._trySubscribe(i));
|
|
624
624
|
}), i;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
@@ -631,18 +631,18 @@ var y = (function() {
|
|
|
631
631
|
}, n.prototype.forEach = function(t, e) {
|
|
632
632
|
var s = this;
|
|
633
633
|
return e = fe(e), new e(function(r, i) {
|
|
634
|
-
var
|
|
635
|
-
next: function(
|
|
634
|
+
var a = new ae({
|
|
635
|
+
next: function(o) {
|
|
636
636
|
try {
|
|
637
|
-
t(
|
|
638
|
-
} catch (
|
|
639
|
-
i(
|
|
637
|
+
t(o);
|
|
638
|
+
} catch (c) {
|
|
639
|
+
i(c), a.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
642
|
error: i,
|
|
643
643
|
complete: r
|
|
644
644
|
});
|
|
645
|
-
s.subscribe(
|
|
645
|
+
s.subscribe(a);
|
|
646
646
|
});
|
|
647
647
|
}, n.prototype._subscribe = function(t) {
|
|
648
648
|
var e;
|
|
@@ -652,15 +652,15 @@ var y = (function() {
|
|
|
652
652
|
}, n.prototype.pipe = function() {
|
|
653
653
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
654
654
|
t[e] = arguments[e];
|
|
655
|
-
return
|
|
655
|
+
return ht(t)(this);
|
|
656
656
|
}, n.prototype.toPromise = function(t) {
|
|
657
657
|
var e = this;
|
|
658
658
|
return t = fe(t), new t(function(s, r) {
|
|
659
659
|
var i;
|
|
660
|
-
e.subscribe(function(
|
|
661
|
-
return i =
|
|
662
|
-
}, function(
|
|
663
|
-
return r(
|
|
660
|
+
e.subscribe(function(a) {
|
|
661
|
+
return i = a;
|
|
662
|
+
}, function(a) {
|
|
663
|
+
return r(a);
|
|
664
664
|
}, function() {
|
|
665
665
|
return s(i);
|
|
666
666
|
});
|
|
@@ -673,18 +673,18 @@ function fe(n) {
|
|
|
673
673
|
var t;
|
|
674
674
|
return (t = n ?? ot.Promise) !== null && t !== void 0 ? t : Promise;
|
|
675
675
|
}
|
|
676
|
-
function ht(n) {
|
|
677
|
-
return n && b(n.next) && b(n.error) && b(n.complete);
|
|
678
|
-
}
|
|
679
676
|
function ft(n) {
|
|
680
|
-
return n && n
|
|
677
|
+
return n && b(n.next) && b(n.error) && b(n.complete);
|
|
681
678
|
}
|
|
682
679
|
function pt(n) {
|
|
680
|
+
return n && n instanceof oe || ft(n) && Pe(n);
|
|
681
|
+
}
|
|
682
|
+
function gt(n) {
|
|
683
683
|
return b(n?.lift);
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function P(n) {
|
|
686
686
|
return function(t) {
|
|
687
|
-
if (
|
|
687
|
+
if (gt(t))
|
|
688
688
|
return t.lift(function(e) {
|
|
689
689
|
try {
|
|
690
690
|
return n(e, this);
|
|
@@ -695,36 +695,36 @@ function _(n) {
|
|
|
695
695
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function N(n, t, e, s, r) {
|
|
699
699
|
return new mt(n, t, e, s, r);
|
|
700
700
|
}
|
|
701
701
|
var mt = (function(n) {
|
|
702
702
|
O(t, n);
|
|
703
|
-
function t(e, s, r, i,
|
|
704
|
-
var
|
|
705
|
-
return
|
|
703
|
+
function t(e, s, r, i, a, o) {
|
|
704
|
+
var c = n.call(this, e) || this;
|
|
705
|
+
return c.onFinalize = a, c.shouldUnsubscribe = o, c._next = s ? function(u) {
|
|
706
706
|
try {
|
|
707
|
-
s(
|
|
708
|
-
} catch (
|
|
709
|
-
e.error(
|
|
707
|
+
s(u);
|
|
708
|
+
} catch (d) {
|
|
709
|
+
e.error(d);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next,
|
|
711
|
+
} : n.prototype._next, c._error = i ? function(u) {
|
|
712
712
|
try {
|
|
713
|
-
i(
|
|
714
|
-
} catch (
|
|
715
|
-
e.error(
|
|
713
|
+
i(u);
|
|
714
|
+
} catch (d) {
|
|
715
|
+
e.error(d);
|
|
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
721
|
r();
|
|
722
|
-
} catch (
|
|
723
|
-
e.error(
|
|
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;
|
|
@@ -733,7 +733,7 @@ var mt = (function(n) {
|
|
|
733
733
|
n.prototype.unsubscribe.call(this), !s && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
734
734
|
}
|
|
735
735
|
}, t;
|
|
736
|
-
})(
|
|
736
|
+
})(oe), bt = Oe(function(n) {
|
|
737
737
|
return function() {
|
|
738
738
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
739
739
|
};
|
|
@@ -748,7 +748,7 @@ var mt = (function(n) {
|
|
|
748
748
|
return s.operator = e, s;
|
|
749
749
|
}, t.prototype._throwIfClosed = function() {
|
|
750
750
|
if (this.closed)
|
|
751
|
-
throw new
|
|
751
|
+
throw new bt();
|
|
752
752
|
}, t.prototype.next = function(e) {
|
|
753
753
|
var s = this;
|
|
754
754
|
X(function() {
|
|
@@ -756,15 +756,15 @@ var mt = (function(n) {
|
|
|
756
756
|
if (s._throwIfClosed(), !s.isStopped) {
|
|
757
757
|
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
758
758
|
try {
|
|
759
|
-
for (var
|
|
760
|
-
var
|
|
761
|
-
|
|
759
|
+
for (var a = U(s.currentObservers), o = a.next(); !o.done; o = a.next()) {
|
|
760
|
+
var c = o.value;
|
|
761
|
+
c.next(e);
|
|
762
762
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
r = { error:
|
|
763
|
+
} catch (u) {
|
|
764
|
+
r = { error: u };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
|
-
|
|
767
|
+
o && !o.done && (i = a.return) && i.call(a);
|
|
768
768
|
} finally {
|
|
769
769
|
if (r) throw r.error;
|
|
770
770
|
}
|
|
@@ -803,20 +803,20 @@ 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 s = this, r = this, i = r.hasError,
|
|
807
|
-
return i ||
|
|
808
|
-
s.currentObservers = null, V(
|
|
806
|
+
var s = this, r = this, i = r.hasError, a = r.isStopped, o = r.observers;
|
|
807
|
+
return i || a ? ke : (this.currentObservers = null, o.push(e), new L(function() {
|
|
808
|
+
s.currentObservers = null, V(o, e);
|
|
809
809
|
}));
|
|
810
810
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
811
|
-
var s = this, r = s.hasError, i = s.thrownError,
|
|
812
|
-
r ? e.error(i) :
|
|
811
|
+
var s = this, r = s.hasError, i = s.thrownError, a = s.isStopped;
|
|
812
|
+
r ? e.error(i) : a && e.complete();
|
|
813
813
|
}, t.prototype.asObservable = function() {
|
|
814
|
-
var e = new
|
|
814
|
+
var e = new w();
|
|
815
815
|
return e.source = this, e;
|
|
816
816
|
}, t.create = function(e, s) {
|
|
817
817
|
return new pe(e, s);
|
|
818
818
|
}, t;
|
|
819
|
-
})(
|
|
819
|
+
})(w), pe = (function(n) {
|
|
820
820
|
O(t, n);
|
|
821
821
|
function t(e, s) {
|
|
822
822
|
var r = n.call(this) || this;
|
|
@@ -833,7 +833,7 @@ var mt = (function(n) {
|
|
|
833
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
835
|
var s, r;
|
|
836
|
-
return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r :
|
|
836
|
+
return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r : ke;
|
|
837
837
|
}, t;
|
|
838
838
|
})(ue), A = (function(n) {
|
|
839
839
|
O(t, n);
|
|
@@ -858,11 +858,11 @@ var mt = (function(n) {
|
|
|
858
858
|
}, t.prototype.next = function(e) {
|
|
859
859
|
n.prototype.next.call(this, this._value = e);
|
|
860
860
|
}, t;
|
|
861
|
-
})(ue),
|
|
861
|
+
})(ue), vt = {
|
|
862
862
|
now: function() {
|
|
863
863
|
return Date.now();
|
|
864
864
|
}
|
|
865
|
-
},
|
|
865
|
+
}, St = (function(n) {
|
|
866
866
|
O(t, n);
|
|
867
867
|
function t(e, s) {
|
|
868
868
|
return n.call(this) || this;
|
|
@@ -870,7 +870,7 @@ var mt = (function(n) {
|
|
|
870
870
|
return t.prototype.schedule = function(e, s) {
|
|
871
871
|
return this;
|
|
872
872
|
}, t;
|
|
873
|
-
})(
|
|
873
|
+
})(L), ge = {
|
|
874
874
|
setInterval: function(n, t) {
|
|
875
875
|
for (var e = [], s = 2; s < arguments.length; s++)
|
|
876
876
|
e[s - 2] = arguments[s];
|
|
@@ -880,7 +880,7 @@ var mt = (function(n) {
|
|
|
880
880
|
return clearInterval(n);
|
|
881
881
|
},
|
|
882
882
|
delegate: void 0
|
|
883
|
-
},
|
|
883
|
+
}, yt = (function(n) {
|
|
884
884
|
O(t, n);
|
|
885
885
|
function t(e, s) {
|
|
886
886
|
var r = n.call(this, e, s) || this;
|
|
@@ -891,14 +891,14 @@ var mt = (function(n) {
|
|
|
891
891
|
if (s === void 0 && (s = 0), this.closed)
|
|
892
892
|
return this;
|
|
893
893
|
this.state = e;
|
|
894
|
-
var i = this.id,
|
|
895
|
-
return i != null && (this.id = this.recycleAsyncId(
|
|
894
|
+
var i = this.id, a = this.scheduler;
|
|
895
|
+
return i != null && (this.id = this.recycleAsyncId(a, i, s)), this.pending = !0, this.delay = s, this.id = (r = this.id) !== null && r !== void 0 ? r : this.requestAsyncId(a, this.id, s), this;
|
|
896
896
|
}, t.prototype.requestAsyncId = function(e, s, r) {
|
|
897
|
-
return r === void 0 && (r = 0),
|
|
897
|
+
return r === void 0 && (r = 0), ge.setInterval(e.flush.bind(e, this), r);
|
|
898
898
|
}, t.prototype.recycleAsyncId = function(e, s, r) {
|
|
899
899
|
if (r === void 0 && (r = 0), r != null && this.delay === r && this.pending === !1)
|
|
900
900
|
return s;
|
|
901
|
-
s != null &&
|
|
901
|
+
s != null && ge.clearInterval(s);
|
|
902
902
|
}, t.prototype.execute = function(e, s) {
|
|
903
903
|
if (this.closed)
|
|
904
904
|
return new Error("executing a cancelled action");
|
|
@@ -911,8 +911,8 @@ var mt = (function(n) {
|
|
|
911
911
|
var r = !1, i;
|
|
912
912
|
try {
|
|
913
913
|
this.work(e);
|
|
914
|
-
} catch (
|
|
915
|
-
r = !0, i =
|
|
914
|
+
} catch (a) {
|
|
915
|
+
r = !0, i = a || new Error("Scheduled action threw falsy error");
|
|
916
916
|
}
|
|
917
917
|
if (r)
|
|
918
918
|
return this.unsubscribe(), i;
|
|
@@ -922,17 +922,17 @@ var mt = (function(n) {
|
|
|
922
922
|
this.work = this.state = this.scheduler = null, this.pending = !1, V(i, 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
|
+
})(St), 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
929
|
return n.prototype.schedule = function(t, e, s) {
|
|
930
930
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(s, e);
|
|
931
|
-
}, n.now =
|
|
932
|
-
})(),
|
|
931
|
+
}, n.now = vt.now, n;
|
|
932
|
+
})(), wt = (function(n) {
|
|
933
933
|
O(t, n);
|
|
934
934
|
function t(e, s) {
|
|
935
|
-
s === void 0 && (s =
|
|
935
|
+
s === void 0 && (s = me.now);
|
|
936
936
|
var r = n.call(this, e, s) || this;
|
|
937
937
|
return r.actions = [], r._active = !1, r;
|
|
938
938
|
}
|
|
@@ -954,20 +954,20 @@ var mt = (function(n) {
|
|
|
954
954
|
throw r;
|
|
955
955
|
}
|
|
956
956
|
}, t;
|
|
957
|
-
})(
|
|
958
|
-
function
|
|
957
|
+
})(me), Et = new wt(yt);
|
|
958
|
+
function It(n) {
|
|
959
959
|
return n && b(n.schedule);
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function Me(n) {
|
|
962
962
|
return n[n.length - 1];
|
|
963
963
|
}
|
|
964
|
-
function
|
|
965
|
-
return b(
|
|
964
|
+
function Tt(n) {
|
|
965
|
+
return b(Me(n)) ? n.pop() : void 0;
|
|
966
966
|
}
|
|
967
967
|
function Ue(n) {
|
|
968
|
-
return
|
|
968
|
+
return It(Me(n)) ? n.pop() : void 0;
|
|
969
969
|
}
|
|
970
|
-
var
|
|
970
|
+
var Le = (function(n) {
|
|
971
971
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
972
972
|
});
|
|
973
973
|
function Ne(n) {
|
|
@@ -976,40 +976,40 @@ function Ne(n) {
|
|
|
976
976
|
function Re(n) {
|
|
977
977
|
return b(n[ce]);
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Fe(n) {
|
|
980
980
|
return Symbol.asyncIterator && b(n?.[Symbol.asyncIterator]);
|
|
981
981
|
}
|
|
982
982
|
function je(n) {
|
|
983
983
|
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.");
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function Ct() {
|
|
986
986
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
987
987
|
}
|
|
988
|
-
var $e =
|
|
988
|
+
var $e = Ct();
|
|
989
989
|
function De(n) {
|
|
990
990
|
return b(n?.[$e]);
|
|
991
991
|
}
|
|
992
|
-
function
|
|
993
|
-
return
|
|
992
|
+
function Be(n) {
|
|
993
|
+
return it(this, arguments, function() {
|
|
994
994
|
var e, s, r, i;
|
|
995
|
-
return
|
|
996
|
-
switch (
|
|
995
|
+
return Ae(this, function(a) {
|
|
996
|
+
switch (a.label) {
|
|
997
997
|
case 0:
|
|
998
|
-
e = n.getReader(),
|
|
998
|
+
e = n.getReader(), a.label = 1;
|
|
999
999
|
case 1:
|
|
1000
|
-
|
|
1000
|
+
a.trys.push([1, , 9, 10]), a.label = 2;
|
|
1001
1001
|
case 2:
|
|
1002
|
-
return [4,
|
|
1002
|
+
return [4, D(e.read())];
|
|
1003
1003
|
case 3:
|
|
1004
|
-
return s =
|
|
1004
|
+
return s = a.sent(), r = s.value, i = s.done, i ? [4, D(void 0)] : [3, 5];
|
|
1005
1005
|
case 4:
|
|
1006
|
-
return [2,
|
|
1006
|
+
return [2, a.sent()];
|
|
1007
1007
|
case 5:
|
|
1008
|
-
return [4,
|
|
1008
|
+
return [4, D(r)];
|
|
1009
1009
|
case 6:
|
|
1010
|
-
return [4,
|
|
1010
|
+
return [4, a.sent()];
|
|
1011
1011
|
case 7:
|
|
1012
|
-
return
|
|
1012
|
+
return a.sent(), [3, 2];
|
|
1013
1013
|
case 8:
|
|
1014
1014
|
return [3, 10];
|
|
1015
1015
|
case 9:
|
|
@@ -1020,45 +1020,45 @@ function He(n) {
|
|
|
1020
1020
|
});
|
|
1021
1021
|
});
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function He(n) {
|
|
1024
1024
|
return b(n?.getReader);
|
|
1025
1025
|
}
|
|
1026
1026
|
function J(n) {
|
|
1027
|
-
if (n instanceof
|
|
1027
|
+
if (n instanceof w)
|
|
1028
1028
|
return n;
|
|
1029
1029
|
if (n != null) {
|
|
1030
1030
|
if (Re(n))
|
|
1031
|
-
return Ct(n);
|
|
1032
|
-
if (Me(n))
|
|
1033
1031
|
return xt(n);
|
|
1034
|
-
if (
|
|
1032
|
+
if (Le(n))
|
|
1035
1033
|
return At(n);
|
|
1036
|
-
if (
|
|
1037
|
-
return Be(n);
|
|
1038
|
-
if (De(n))
|
|
1034
|
+
if (Ne(n))
|
|
1039
1035
|
return Ot(n);
|
|
1040
1036
|
if (Fe(n))
|
|
1037
|
+
return Ge(n);
|
|
1038
|
+
if (De(n))
|
|
1039
|
+
return kt(n);
|
|
1040
|
+
if (He(n))
|
|
1041
1041
|
return Pt(n);
|
|
1042
1042
|
}
|
|
1043
1043
|
throw je(n);
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return new
|
|
1045
|
+
function xt(n) {
|
|
1046
|
+
return new w(function(t) {
|
|
1047
1047
|
var e = n[ce]();
|
|
1048
1048
|
if (b(e.subscribe))
|
|
1049
1049
|
return e.subscribe(t);
|
|
1050
1050
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
1051
1051
|
});
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1054
|
-
return new
|
|
1053
|
+
function At(n) {
|
|
1054
|
+
return new w(function(t) {
|
|
1055
1055
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
1056
1056
|
t.next(n[e]);
|
|
1057
1057
|
t.complete();
|
|
1058
1058
|
});
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1061
|
-
return new
|
|
1060
|
+
function Ot(n) {
|
|
1061
|
+
return new w(function(t) {
|
|
1062
1062
|
n.then(function(e) {
|
|
1063
1063
|
t.closed || (t.next(e), t.complete());
|
|
1064
1064
|
}, function(e) {
|
|
@@ -1066,17 +1066,17 @@ function At(n) {
|
|
|
1066
1066
|
}).then(null, _e);
|
|
1067
1067
|
});
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
return new
|
|
1069
|
+
function kt(n) {
|
|
1070
|
+
return new w(function(t) {
|
|
1071
1071
|
var e, s;
|
|
1072
1072
|
try {
|
|
1073
|
-
for (var r =
|
|
1074
|
-
var
|
|
1075
|
-
if (t.next(
|
|
1073
|
+
for (var r = U(n), i = r.next(); !i.done; i = r.next()) {
|
|
1074
|
+
var a = i.value;
|
|
1075
|
+
if (t.next(a), t.closed)
|
|
1076
1076
|
return;
|
|
1077
1077
|
}
|
|
1078
|
-
} catch (
|
|
1079
|
-
e = { error:
|
|
1078
|
+
} catch (o) {
|
|
1079
|
+
e = { error: o };
|
|
1080
1080
|
} finally {
|
|
1081
1081
|
try {
|
|
1082
1082
|
i && !i.done && (s = r.return) && s.call(r);
|
|
@@ -1087,41 +1087,41 @@ function Ot(n) {
|
|
|
1087
1087
|
t.complete();
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return new
|
|
1090
|
+
function Ge(n) {
|
|
1091
|
+
return new w(function(t) {
|
|
1092
1092
|
_t(n, t).catch(function(e) {
|
|
1093
1093
|
return t.error(e);
|
|
1094
1094
|
});
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
1097
1097
|
function Pt(n) {
|
|
1098
|
-
return Be(
|
|
1098
|
+
return Ge(Be(n));
|
|
1099
1099
|
}
|
|
1100
1100
|
function _t(n, t) {
|
|
1101
1101
|
var e, s, r, i;
|
|
1102
|
-
return
|
|
1103
|
-
var
|
|
1104
|
-
return
|
|
1105
|
-
switch (
|
|
1102
|
+
return rt(this, void 0, void 0, function() {
|
|
1103
|
+
var a, o;
|
|
1104
|
+
return Ae(this, function(c) {
|
|
1105
|
+
switch (c.label) {
|
|
1106
1106
|
case 0:
|
|
1107
|
-
|
|
1107
|
+
c.trys.push([0, 5, 6, 11]), e = at(n), c.label = 1;
|
|
1108
1108
|
case 1:
|
|
1109
1109
|
return [4, e.next()];
|
|
1110
1110
|
case 2:
|
|
1111
|
-
if (s =
|
|
1112
|
-
if (
|
|
1111
|
+
if (s = c.sent(), !!s.done) return [3, 4];
|
|
1112
|
+
if (a = s.value, t.next(a), t.closed)
|
|
1113
1113
|
return [2];
|
|
1114
|
-
|
|
1114
|
+
c.label = 3;
|
|
1115
1115
|
case 3:
|
|
1116
1116
|
return [3, 1];
|
|
1117
1117
|
case 4:
|
|
1118
1118
|
return [3, 11];
|
|
1119
1119
|
case 5:
|
|
1120
|
-
return
|
|
1120
|
+
return o = c.sent(), r = { error: o }, [3, 11];
|
|
1121
1121
|
case 6:
|
|
1122
|
-
return
|
|
1122
|
+
return c.trys.push([6, , 9, 10]), s && !s.done && (i = e.return) ? [4, i.call(e)] : [3, 8];
|
|
1123
1123
|
case 7:
|
|
1124
|
-
|
|
1124
|
+
c.sent(), c.label = 8;
|
|
1125
1125
|
case 8:
|
|
1126
1126
|
return [3, 10];
|
|
1127
1127
|
case 9:
|
|
@@ -1143,9 +1143,9 @@ function T(n, t, e, s, r) {
|
|
|
1143
1143
|
if (n.add(i), !r)
|
|
1144
1144
|
return i;
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return t === void 0 && (t = 0),
|
|
1148
|
-
e.subscribe(
|
|
1146
|
+
function qe(n, t) {
|
|
1147
|
+
return t === void 0 && (t = 0), P(function(e, s) {
|
|
1148
|
+
e.subscribe(N(s, function(r) {
|
|
1149
1149
|
return T(s, n, function() {
|
|
1150
1150
|
return s.next(r);
|
|
1151
1151
|
}, t);
|
|
@@ -1160,21 +1160,21 @@ function Ge(n, t) {
|
|
|
1160
1160
|
}));
|
|
1161
1161
|
});
|
|
1162
1162
|
}
|
|
1163
|
-
function
|
|
1164
|
-
return t === void 0 && (t = 0),
|
|
1163
|
+
function Ke(n, t) {
|
|
1164
|
+
return t === void 0 && (t = 0), P(function(e, s) {
|
|
1165
1165
|
s.add(n.schedule(function() {
|
|
1166
1166
|
return e.subscribe(s);
|
|
1167
1167
|
}, t));
|
|
1168
1168
|
});
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1171
|
-
return J(n).pipe(
|
|
1170
|
+
function Mt(n, t) {
|
|
1171
|
+
return J(n).pipe(Ke(t), qe(t));
|
|
1172
1172
|
}
|
|
1173
1173
|
function Ut(n, t) {
|
|
1174
|
-
return J(n).pipe(
|
|
1174
|
+
return J(n).pipe(Ke(t), qe(t));
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1177
|
-
return new
|
|
1176
|
+
function Lt(n, t) {
|
|
1177
|
+
return new w(function(e) {
|
|
1178
1178
|
var s = 0;
|
|
1179
1179
|
return t.schedule(function() {
|
|
1180
1180
|
s === n.length ? e.complete() : (e.next(n[s++]), e.closed || this.schedule());
|
|
@@ -1182,28 +1182,28 @@ function Mt(n, t) {
|
|
|
1182
1182
|
});
|
|
1183
1183
|
}
|
|
1184
1184
|
function Nt(n, t) {
|
|
1185
|
-
return new
|
|
1185
|
+
return new w(function(e) {
|
|
1186
1186
|
var s;
|
|
1187
1187
|
return T(e, t, function() {
|
|
1188
1188
|
s = n[$e](), T(e, t, function() {
|
|
1189
|
-
var r, i,
|
|
1189
|
+
var r, i, a;
|
|
1190
1190
|
try {
|
|
1191
|
-
r = s.next(), i = r.value,
|
|
1192
|
-
} catch (
|
|
1193
|
-
e.error(
|
|
1191
|
+
r = s.next(), i = r.value, a = r.done;
|
|
1192
|
+
} catch (o) {
|
|
1193
|
+
e.error(o);
|
|
1194
1194
|
return;
|
|
1195
1195
|
}
|
|
1196
|
-
|
|
1196
|
+
a ? e.complete() : e.next(i);
|
|
1197
1197
|
}, 0, !0);
|
|
1198
1198
|
}), function() {
|
|
1199
1199
|
return b(s?.return) && s.return();
|
|
1200
1200
|
};
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function Ve(n, t) {
|
|
1204
1204
|
if (!n)
|
|
1205
1205
|
throw new Error("Iterable cannot be null");
|
|
1206
|
-
return new
|
|
1206
|
+
return new w(function(e) {
|
|
1207
1207
|
T(e, t, function() {
|
|
1208
1208
|
var s = n[Symbol.asyncIterator]();
|
|
1209
1209
|
T(e, t, function() {
|
|
@@ -1215,32 +1215,32 @@ function Ke(n, t) {
|
|
|
1215
1215
|
});
|
|
1216
1216
|
}
|
|
1217
1217
|
function Rt(n, t) {
|
|
1218
|
-
return
|
|
1218
|
+
return Ve(Be(n), t);
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Ft(n, t) {
|
|
1221
1221
|
if (n != null) {
|
|
1222
1222
|
if (Re(n))
|
|
1223
|
-
return Lt(n, t);
|
|
1224
|
-
if (Me(n))
|
|
1225
1223
|
return Mt(n, t);
|
|
1224
|
+
if (Le(n))
|
|
1225
|
+
return Lt(n, t);
|
|
1226
1226
|
if (Ne(n))
|
|
1227
1227
|
return Ut(n, t);
|
|
1228
|
-
if (
|
|
1229
|
-
return
|
|
1228
|
+
if (Fe(n))
|
|
1229
|
+
return Ve(n, t);
|
|
1230
1230
|
if (De(n))
|
|
1231
1231
|
return Nt(n, t);
|
|
1232
|
-
if (
|
|
1232
|
+
if (He(n))
|
|
1233
1233
|
return Rt(n, t);
|
|
1234
1234
|
}
|
|
1235
1235
|
throw je(n);
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
return t ?
|
|
1237
|
+
function We(n, t) {
|
|
1238
|
+
return t ? Ft(n, t) : J(n);
|
|
1239
1239
|
}
|
|
1240
1240
|
function Y(n, t) {
|
|
1241
|
-
return
|
|
1241
|
+
return P(function(e, s) {
|
|
1242
1242
|
var r = 0;
|
|
1243
|
-
e.subscribe(
|
|
1243
|
+
e.subscribe(N(s, function(i) {
|
|
1244
1244
|
s.next(n.call(t, i, r++));
|
|
1245
1245
|
}));
|
|
1246
1246
|
});
|
|
@@ -1254,14 +1254,14 @@ function Dt(n) {
|
|
|
1254
1254
|
return $t(n, t);
|
|
1255
1255
|
});
|
|
1256
1256
|
}
|
|
1257
|
-
var
|
|
1258
|
-
function
|
|
1257
|
+
var Bt = Array.isArray, Ht = Object.getPrototypeOf, Gt = Object.prototype, qt = Object.keys;
|
|
1258
|
+
function Kt(n) {
|
|
1259
1259
|
if (n.length === 1) {
|
|
1260
1260
|
var t = n[0];
|
|
1261
|
-
if (
|
|
1261
|
+
if (Bt(t))
|
|
1262
1262
|
return { args: t, keys: null };
|
|
1263
|
-
if (
|
|
1264
|
-
var e =
|
|
1263
|
+
if (Vt(t)) {
|
|
1264
|
+
var e = qt(t);
|
|
1265
1265
|
return {
|
|
1266
1266
|
args: e.map(function(s) {
|
|
1267
1267
|
return t[s];
|
|
@@ -1272,115 +1272,115 @@ function qt(n) {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
return { args: n, keys: null };
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return n && typeof n == "object" &&
|
|
1275
|
+
function Vt(n) {
|
|
1276
|
+
return n && typeof n == "object" && Ht(n) === Gt;
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1278
|
+
function Wt(n, t) {
|
|
1279
1279
|
return n.reduce(function(e, s, r) {
|
|
1280
1280
|
return e[s] = t[r], e;
|
|
1281
1281
|
}, {});
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1283
|
+
function Xt() {
|
|
1284
1284
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1285
1285
|
n[t] = arguments[t];
|
|
1286
|
-
var e = Ue(n), s =
|
|
1286
|
+
var e = Ue(n), s = Tt(n), r = Kt(n), i = r.args, a = r.keys;
|
|
1287
1287
|
if (i.length === 0)
|
|
1288
|
-
return
|
|
1289
|
-
var
|
|
1290
|
-
return
|
|
1288
|
+
return We([], e);
|
|
1289
|
+
var o = new w(Yt(i, e, a ? function(c) {
|
|
1290
|
+
return Wt(a, c);
|
|
1291
1291
|
} : z));
|
|
1292
|
-
return s ?
|
|
1292
|
+
return s ? o.pipe(Dt(s)) : o;
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Yt(n, t, e) {
|
|
1295
1295
|
return e === void 0 && (e = z), function(s) {
|
|
1296
1296
|
be(t, function() {
|
|
1297
|
-
for (var r = n.length, i = new Array(r),
|
|
1297
|
+
for (var r = n.length, i = new Array(r), a = r, o = r, c = function(d) {
|
|
1298
1298
|
be(t, function() {
|
|
1299
|
-
var m =
|
|
1300
|
-
m.subscribe(
|
|
1301
|
-
i[
|
|
1299
|
+
var m = We(n[d], t), v = !1;
|
|
1300
|
+
m.subscribe(N(s, function(h) {
|
|
1301
|
+
i[d] = h, v || (v = !0, o--), o || s.next(e(i.slice()));
|
|
1302
1302
|
}, function() {
|
|
1303
|
-
--
|
|
1303
|
+
--a || s.complete();
|
|
1304
1304
|
}));
|
|
1305
1305
|
}, s);
|
|
1306
|
-
},
|
|
1307
|
-
u
|
|
1306
|
+
}, u = 0; u < r; u++)
|
|
1307
|
+
c(u);
|
|
1308
1308
|
}, s);
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
1311
1311
|
function be(n, t, e) {
|
|
1312
1312
|
n ? T(e, n, t) : t();
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return
|
|
1314
|
+
function zt(n, t) {
|
|
1315
|
+
return P(function(e, s) {
|
|
1316
1316
|
var r = 0;
|
|
1317
|
-
e.subscribe(
|
|
1317
|
+
e.subscribe(N(s, function(i) {
|
|
1318
1318
|
return n.call(t, i, r++) && s.next(i);
|
|
1319
1319
|
}));
|
|
1320
1320
|
});
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1322
|
+
function Jt(n) {
|
|
1323
1323
|
for (var t, e, s = [], r = 1; r < arguments.length; r++)
|
|
1324
1324
|
s[r - 1] = arguments[r];
|
|
1325
|
-
var i = (t = Ue(s)) !== null && t !== void 0 ? t :
|
|
1326
|
-
return
|
|
1327
|
-
var
|
|
1328
|
-
var I = f.buffer,
|
|
1329
|
-
|
|
1325
|
+
var i = (t = Ue(s)) !== null && t !== void 0 ? t : Et, a = (e = s[0]) !== null && e !== void 0 ? e : null, o = s[1] || 1 / 0;
|
|
1326
|
+
return P(function(c, u) {
|
|
1327
|
+
var d = [], m = !1, v = function(f) {
|
|
1328
|
+
var I = f.buffer, E = f.subs;
|
|
1329
|
+
E.unsubscribe(), V(d, f), u.next(I), m && h();
|
|
1330
1330
|
}, h = function() {
|
|
1331
|
-
if (
|
|
1332
|
-
var f = new
|
|
1333
|
-
|
|
1334
|
-
var I = [],
|
|
1331
|
+
if (d) {
|
|
1332
|
+
var f = new L();
|
|
1333
|
+
u.add(f);
|
|
1334
|
+
var I = [], E = {
|
|
1335
1335
|
buffer: I,
|
|
1336
1336
|
subs: f
|
|
1337
1337
|
};
|
|
1338
|
-
|
|
1339
|
-
return v(
|
|
1338
|
+
d.push(E), T(f, i, function() {
|
|
1339
|
+
return v(E);
|
|
1340
1340
|
}, n);
|
|
1341
1341
|
}
|
|
1342
1342
|
};
|
|
1343
|
-
|
|
1344
|
-
var p =
|
|
1345
|
-
var I,
|
|
1343
|
+
a !== null && a >= 0 ? T(u, i, h, a, !0) : m = !0, h();
|
|
1344
|
+
var p = N(u, function(f) {
|
|
1345
|
+
var I, E, B = d.slice();
|
|
1346
1346
|
try {
|
|
1347
|
-
for (var
|
|
1348
|
-
var
|
|
1349
|
-
|
|
1347
|
+
for (var R = U(B), _ = R.next(); !_.done; _ = R.next()) {
|
|
1348
|
+
var F = _.value, j = F.buffer;
|
|
1349
|
+
j.push(f), o <= j.length && v(F);
|
|
1350
1350
|
}
|
|
1351
|
-
} catch (
|
|
1352
|
-
I = { error:
|
|
1351
|
+
} catch ($) {
|
|
1352
|
+
I = { error: $ };
|
|
1353
1353
|
} finally {
|
|
1354
1354
|
try {
|
|
1355
|
-
|
|
1355
|
+
_ && !_.done && (E = R.return) && E.call(R);
|
|
1356
1356
|
} finally {
|
|
1357
1357
|
if (I) throw I.error;
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
1360
1360
|
}, function() {
|
|
1361
|
-
for (;
|
|
1362
|
-
|
|
1363
|
-
p?.unsubscribe(),
|
|
1361
|
+
for (; d?.length; )
|
|
1362
|
+
u.next(d.shift().buffer);
|
|
1363
|
+
p?.unsubscribe(), u.complete(), u.unsubscribe();
|
|
1364
1364
|
}, void 0, function() {
|
|
1365
|
-
return
|
|
1365
|
+
return d = null;
|
|
1366
1366
|
});
|
|
1367
|
-
|
|
1367
|
+
c.subscribe(p);
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1371
|
-
return t === void 0 && (t = z), n = n ??
|
|
1370
|
+
function M(n, t) {
|
|
1371
|
+
return t === void 0 && (t = z), n = n ?? Qt, P(function(e, s) {
|
|
1372
1372
|
var r, i = !0;
|
|
1373
|
-
e.subscribe(
|
|
1374
|
-
var
|
|
1375
|
-
(i || !n(r,
|
|
1373
|
+
e.subscribe(N(s, function(a) {
|
|
1374
|
+
var o = t(a);
|
|
1375
|
+
(i || !n(r, o)) && (i = !1, r = o, s.next(a));
|
|
1376
1376
|
}));
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1379
|
+
function Qt(n, t) {
|
|
1380
1380
|
return n === t;
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1383
|
-
return
|
|
1382
|
+
function Zt(n) {
|
|
1383
|
+
return P(function(t, e) {
|
|
1384
1384
|
try {
|
|
1385
1385
|
t.subscribe(e);
|
|
1386
1386
|
} finally {
|
|
@@ -1388,29 +1388,29 @@ function Qt(n) {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
|
-
function
|
|
1392
|
-
return
|
|
1393
|
-
J(n).subscribe(
|
|
1391
|
+
function en(n) {
|
|
1392
|
+
return P(function(t, e) {
|
|
1393
|
+
J(n).subscribe(N(e, function() {
|
|
1394
1394
|
return e.complete();
|
|
1395
1395
|
}, ie)), !e.closed && t.subscribe(e);
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
1398
|
function ve(n) {
|
|
1399
|
-
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: i } = n,
|
|
1400
|
-
return new
|
|
1401
|
-
const
|
|
1402
|
-
let
|
|
1399
|
+
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: i } = n, a = n.method ?? "POST";
|
|
1400
|
+
return new w((o) => {
|
|
1401
|
+
const c = new AbortController();
|
|
1402
|
+
let u, d = !1, m = !1;
|
|
1403
1403
|
const v = {
|
|
1404
1404
|
"Content-Type": "application/json",
|
|
1405
1405
|
...i
|
|
1406
1406
|
};
|
|
1407
1407
|
e && (v["X-API-KEY"] = e);
|
|
1408
1408
|
const h = new URL(t);
|
|
1409
|
-
return r && h.searchParams.set("is_debug", "true"),
|
|
1410
|
-
method:
|
|
1409
|
+
return r && h.searchParams.set("is_debug", "true"), xe(h.toString(), {
|
|
1410
|
+
method: a,
|
|
1411
1411
|
headers: v,
|
|
1412
|
-
body:
|
|
1413
|
-
signal:
|
|
1412
|
+
body: a === "POST" && s ? JSON.stringify(s) : void 0,
|
|
1413
|
+
signal: c.signal,
|
|
1414
1414
|
/**
|
|
1415
1415
|
* Allow SSE to work when the page is hidden.
|
|
1416
1416
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
@@ -1418,7 +1418,7 @@ function ve(n) {
|
|
|
1418
1418
|
openWhenHidden: !0,
|
|
1419
1419
|
onopen: async (p) => {
|
|
1420
1420
|
if (p.ok)
|
|
1421
|
-
|
|
1421
|
+
u = p.headers.get("X-Trace-Id") ?? void 0;
|
|
1422
1422
|
else {
|
|
1423
1423
|
let f;
|
|
1424
1424
|
try {
|
|
@@ -1430,28 +1430,28 @@ function ve(n) {
|
|
|
1430
1430
|
f = null;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
|
|
1433
|
+
o.error(new y(p.status, p.statusText, f)), c.abort();
|
|
1434
1434
|
}
|
|
1435
1435
|
},
|
|
1436
1436
|
onmessage: (p) => {
|
|
1437
|
-
p.id && (
|
|
1437
|
+
p.id && (d = !0);
|
|
1438
1438
|
const f = JSON.parse(p.data);
|
|
1439
|
-
|
|
1439
|
+
u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = f.requestId)), o.next(f);
|
|
1440
1440
|
},
|
|
1441
1441
|
onclose: () => {
|
|
1442
|
-
|
|
1442
|
+
o.complete();
|
|
1443
1443
|
},
|
|
1444
1444
|
onerror: (p) => {
|
|
1445
1445
|
if (m) throw p;
|
|
1446
|
-
if (!
|
|
1447
|
-
throw
|
|
1446
|
+
if (!d)
|
|
1447
|
+
throw o.error(p), c.abort(), p;
|
|
1448
1448
|
}
|
|
1449
1449
|
}), () => {
|
|
1450
|
-
m = !0,
|
|
1450
|
+
m = !0, c.abort();
|
|
1451
1451
|
};
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
1454
|
-
class
|
|
1454
|
+
class tn {
|
|
1455
1455
|
listeners = {};
|
|
1456
1456
|
on(t, e) {
|
|
1457
1457
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1470,8 +1470,11 @@ class en {
|
|
|
1470
1470
|
this.listeners[t] && this.listeners[t].forEach((s) => s(...e));
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1473
|
+
const nn = 50;
|
|
1474
|
+
function Se(n, t) {
|
|
1475
|
+
return t?.customChannelId && n.searchParams.set("custom_channel_id", t.customChannelId), n;
|
|
1476
|
+
}
|
|
1477
|
+
class Mn {
|
|
1475
1478
|
apiKey;
|
|
1476
1479
|
endpoint;
|
|
1477
1480
|
botProviderEndpoint;
|
|
@@ -1481,7 +1484,7 @@ class _n {
|
|
|
1481
1484
|
detached = !1;
|
|
1482
1485
|
detachTimer;
|
|
1483
1486
|
inFlight = 0;
|
|
1484
|
-
sseEmitter = new
|
|
1487
|
+
sseEmitter = new tn();
|
|
1485
1488
|
transformSsePayload;
|
|
1486
1489
|
customHeaders;
|
|
1487
1490
|
constructor(t) {
|
|
@@ -1502,33 +1505,33 @@ class _n {
|
|
|
1502
1505
|
}
|
|
1503
1506
|
handleEvent(t) {
|
|
1504
1507
|
switch (t.eventType) {
|
|
1505
|
-
case
|
|
1506
|
-
this.sseEmitter.emit(
|
|
1508
|
+
case l.INIT:
|
|
1509
|
+
this.sseEmitter.emit(l.INIT, t);
|
|
1507
1510
|
break;
|
|
1508
|
-
case
|
|
1509
|
-
case
|
|
1510
|
-
this.sseEmitter.emit(
|
|
1511
|
+
case l.PROCESS_START:
|
|
1512
|
+
case l.PROCESS_COMPLETE:
|
|
1513
|
+
this.sseEmitter.emit(l.PROCESS, t);
|
|
1511
1514
|
break;
|
|
1512
|
-
case
|
|
1513
|
-
case
|
|
1514
|
-
case
|
|
1515
|
-
this.sseEmitter.emit(
|
|
1515
|
+
case l.MESSAGE_START:
|
|
1516
|
+
case l.MESSAGE_DELTA:
|
|
1517
|
+
case l.MESSAGE_COMPLETE:
|
|
1518
|
+
this.sseEmitter.emit(l.MESSAGE, t);
|
|
1516
1519
|
break;
|
|
1517
|
-
case
|
|
1518
|
-
case
|
|
1519
|
-
this.sseEmitter.emit(
|
|
1520
|
+
case l.TOOL_CALL_START:
|
|
1521
|
+
case l.TOOL_CALL_COMPLETE:
|
|
1522
|
+
this.sseEmitter.emit(l.TOOL_CALL, t);
|
|
1520
1523
|
break;
|
|
1521
|
-
case
|
|
1524
|
+
case l.TOOL_CALL_CONSENT:
|
|
1522
1525
|
this.sseEmitter.emit(
|
|
1523
|
-
|
|
1526
|
+
l.TOOL_CALL_CONSENT,
|
|
1524
1527
|
t
|
|
1525
1528
|
);
|
|
1526
1529
|
break;
|
|
1527
|
-
case
|
|
1528
|
-
this.sseEmitter.emit(
|
|
1530
|
+
case l.DONE:
|
|
1531
|
+
this.sseEmitter.emit(l.DONE, t);
|
|
1529
1532
|
break;
|
|
1530
|
-
case
|
|
1531
|
-
this.sseEmitter.emit(
|
|
1533
|
+
case l.ERROR:
|
|
1534
|
+
this.sseEmitter.emit(l.ERROR, t);
|
|
1532
1535
|
break;
|
|
1533
1536
|
}
|
|
1534
1537
|
}
|
|
@@ -1585,21 +1588,21 @@ class _n {
|
|
|
1585
1588
|
if (i.status === 404)
|
|
1586
1589
|
return null;
|
|
1587
1590
|
if (!i.ok)
|
|
1588
|
-
throw new
|
|
1591
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1589
1592
|
}));
|
|
1590
|
-
const
|
|
1593
|
+
const a = await i.json(), o = a.data ?? a;
|
|
1591
1594
|
return {
|
|
1592
|
-
title:
|
|
1593
|
-
runState:
|
|
1594
|
-
lastActivityAt:
|
|
1595
|
+
title: o.title ?? null,
|
|
1596
|
+
runState: o.runState ?? "IDLE",
|
|
1597
|
+
lastActivityAt: o.lastActivityAt,
|
|
1595
1598
|
// F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
|
|
1596
1599
|
// backend / a channel with none live. metadata is the sole authority on "who is live".
|
|
1597
|
-
launchedSandboxes: (
|
|
1598
|
-
sandboxName:
|
|
1599
|
-
sandboxBlueprintName:
|
|
1600
|
-
workingDirectory:
|
|
1601
|
-
editorServerEnabled:
|
|
1602
|
-
browserEnabled:
|
|
1600
|
+
launchedSandboxes: (o.launchedSandboxes ?? []).map((c) => ({
|
|
1601
|
+
sandboxName: c.sandboxName,
|
|
1602
|
+
sandboxBlueprintName: c.sandboxBlueprintName,
|
|
1603
|
+
workingDirectory: c.workingDirectory,
|
|
1604
|
+
editorServerEnabled: c.editorServerEnabled,
|
|
1605
|
+
browserEnabled: c.browserEnabled
|
|
1603
1606
|
}))
|
|
1604
1607
|
};
|
|
1605
1608
|
}
|
|
@@ -1631,7 +1634,7 @@ class _n {
|
|
|
1631
1634
|
r.searchParams.set("custom_channel_id", t), e?.requestId && r.searchParams.set("request_id", e.requestId), e?.force && r.searchParams.set("force", "true");
|
|
1632
1635
|
const i = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
|
|
1633
1636
|
if (!(i.ok || i.status === 404))
|
|
1634
|
-
throw new
|
|
1637
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1635
1638
|
}));
|
|
1636
1639
|
}
|
|
1637
1640
|
deriveChannelEndpoint() {
|
|
@@ -1662,9 +1665,44 @@ class _n {
|
|
|
1662
1665
|
s.searchParams.set("custom_channel_id", t);
|
|
1663
1666
|
const r = await fetch(s.toString(), { method: "DELETE", headers: this.apiHeaders() });
|
|
1664
1667
|
if (!r.ok)
|
|
1665
|
-
throw new
|
|
1668
|
+
throw new y(r.status, r.statusText, await r.text().catch(() => {
|
|
1666
1669
|
}));
|
|
1667
1670
|
}
|
|
1671
|
+
deriveFeedbackEndpoint() {
|
|
1672
|
+
const t = this.getBaseEndpoint();
|
|
1673
|
+
return t ? `${t}/message/feedback` : null;
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Rate one assistant reply Good or Bad (F-033): `POST {base}/message/feedback` with
|
|
1677
|
+
* `{ customChannelId, messageId, verdict, comment? }`. Derived from `botProviderEndpoint` exactly like
|
|
1678
|
+
* `/message/sse`, because every product relay exposes it at that same shape.
|
|
1679
|
+
*
|
|
1680
|
+
* Resolves to `{ messageId, seq }` — the persisted entry's own id and transcript cursor — on any 2xx
|
|
1681
|
+
* (the relays wrap it in a `{ data }` envelope; a bare body is accepted too). `404` means the target is
|
|
1682
|
+
* not a ratable reply (a thinking block, the user's own message, an unknown id), `400` a bad verdict
|
|
1683
|
+
* or a comment over 8 KiB; both, like any other failure, reject with {@link HttpError}. Nothing is
|
|
1684
|
+
* retried: the caller decides whether to offer another attempt, with the user's comment intact.
|
|
1685
|
+
*/
|
|
1686
|
+
async sendMessageFeedback(t) {
|
|
1687
|
+
const e = this.deriveFeedbackEndpoint();
|
|
1688
|
+
if (!e)
|
|
1689
|
+
throw new Error("Unable to derive message feedback endpoint. Please provide botProviderEndpoint in config.");
|
|
1690
|
+
const s = t.comment?.trim(), r = {
|
|
1691
|
+
customChannelId: t.customChannelId,
|
|
1692
|
+
messageId: t.messageId,
|
|
1693
|
+
verdict: t.verdict,
|
|
1694
|
+
...s ? { comment: s } : {}
|
|
1695
|
+
}, i = await fetch(e, {
|
|
1696
|
+
method: "POST",
|
|
1697
|
+
headers: { ...this.apiHeaders(), "Content-Type": "application/json" },
|
|
1698
|
+
body: JSON.stringify(r)
|
|
1699
|
+
});
|
|
1700
|
+
if (!i.ok)
|
|
1701
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1702
|
+
}));
|
|
1703
|
+
const a = await i.json(), o = a.data ?? a;
|
|
1704
|
+
return { messageId: o.messageId, seq: o.seq };
|
|
1705
|
+
}
|
|
1668
1706
|
runSse(t, e) {
|
|
1669
1707
|
return t.pipe(
|
|
1670
1708
|
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
@@ -1683,13 +1721,13 @@ class _n {
|
|
|
1683
1721
|
// at a consumer, one microtask apart — but the latency it adds is one window total, no matter
|
|
1684
1722
|
// how many frames land in it. Frames are still delivered individually and in order below, so
|
|
1685
1723
|
// nothing downstream can tell the difference apart from the timing.
|
|
1686
|
-
|
|
1724
|
+
Jt(e?.delayTime ?? nn),
|
|
1687
1725
|
// An idle stream still ticks an empty buffer every window; do not wake the consumer for nothing.
|
|
1688
|
-
|
|
1689
|
-
|
|
1726
|
+
zt((s) => s.length > 0),
|
|
1727
|
+
en(this.destroy$),
|
|
1690
1728
|
// Settle the run accounting on every termination path — complete, error, AND a user-initiated
|
|
1691
1729
|
// unsubscribe (stop-generation aborts the connection without a terminal event).
|
|
1692
|
-
|
|
1730
|
+
Zt(() => this.onRunSettled())
|
|
1693
1731
|
).subscribe({
|
|
1694
1732
|
next: (s) => {
|
|
1695
1733
|
if (!this.detached)
|
|
@@ -1748,17 +1786,17 @@ class _n {
|
|
|
1748
1786
|
};
|
|
1749
1787
|
this.apiKey && (i["X-API-KEY"] = this.apiKey);
|
|
1750
1788
|
try {
|
|
1751
|
-
const
|
|
1789
|
+
const a = await fetch(s, {
|
|
1752
1790
|
method: "POST",
|
|
1753
1791
|
headers: i,
|
|
1754
1792
|
body: r
|
|
1755
1793
|
});
|
|
1756
|
-
if (!
|
|
1757
|
-
throw new Error(`Upload failed: ${
|
|
1758
|
-
const
|
|
1759
|
-
return this.debugMode && console.log("[AsgardServiceClient] File upload response:",
|
|
1760
|
-
} catch (
|
|
1761
|
-
throw console.error("[AsgardServiceClient] File upload error:",
|
|
1794
|
+
if (!a.ok)
|
|
1795
|
+
throw new Error(`Upload failed: ${a.status} ${a.statusText}`);
|
|
1796
|
+
const o = await a.json();
|
|
1797
|
+
return this.debugMode && console.log("[AsgardServiceClient] File upload response:", o), o;
|
|
1798
|
+
} catch (a) {
|
|
1799
|
+
throw console.error("[AsgardServiceClient] File upload error:", a), a;
|
|
1762
1800
|
}
|
|
1763
1801
|
}
|
|
1764
1802
|
/**
|
|
@@ -1769,45 +1807,49 @@ class _n {
|
|
|
1769
1807
|
const s = this.getBaseEndpoint();
|
|
1770
1808
|
if (!s)
|
|
1771
1809
|
throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
|
|
1772
|
-
const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, i = `${s}/channel-home/download?${r}`,
|
|
1810
|
+
const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, i = `${s}/channel-home/download?${r}`, a = {
|
|
1773
1811
|
...this.customHeaders
|
|
1774
1812
|
};
|
|
1775
|
-
this.apiKey && (
|
|
1813
|
+
this.apiKey && (a["X-API-KEY"] = this.apiKey);
|
|
1776
1814
|
try {
|
|
1777
|
-
const
|
|
1815
|
+
const o = await fetch(i, {
|
|
1778
1816
|
method: "GET",
|
|
1779
|
-
headers:
|
|
1817
|
+
headers: a
|
|
1780
1818
|
});
|
|
1781
|
-
if (!
|
|
1782
|
-
throw new Error(`Channel Home download failed: ${
|
|
1783
|
-
const
|
|
1784
|
-
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename:
|
|
1785
|
-
} catch (
|
|
1786
|
-
throw console.error("[AsgardServiceClient] Channel Home download error:",
|
|
1819
|
+
if (!o.ok)
|
|
1820
|
+
throw new Error(`Channel Home download failed: ${o.status} ${o.statusText}`);
|
|
1821
|
+
const c = await o.blob(), u = t.split("/").pop() || "download";
|
|
1822
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: u, size: c.size }), { blob: c, filename: u };
|
|
1823
|
+
} catch (o) {
|
|
1824
|
+
throw console.error("[AsgardServiceClient] Channel Home download error:", o), o;
|
|
1787
1825
|
}
|
|
1788
1826
|
}
|
|
1789
1827
|
/**
|
|
1790
1828
|
* F-020 — 取得 sandbox 瀏覽器一次性接手 URL(`sandbox://<name>/open-browser` 卡的副作用)。
|
|
1791
1829
|
* 呼叫 `POST {base}/sandbox/{sandboxName}/browser/open-url`(對標 asgard-core edgeserver
|
|
1792
|
-
* `GenerateSandboxBrowserOpenUrl`:path 參數 namespace / bot-provider 已在 base、sandbox_name
|
|
1793
|
-
*
|
|
1830
|
+
* `GenerateSandboxBrowserOpenUrl`:path 參數 namespace / bot-provider 已在 base、sandbox_name 在路徑)。
|
|
1831
|
+
* 回應 `{ data: { openURL } }`(envelope 容錯,比照 `channelMetadata`)。
|
|
1832
|
+
*
|
|
1833
|
+
* `options.customChannelId` 帶上該 sandbox 所屬的 channel(`SandboxChannelScope`)。直接對 edge server
|
|
1834
|
+
* 呼叫時它會被忽略,但前置 relay 用它做 ownership 證明,缺了就是 `400`。
|
|
1794
1835
|
*/
|
|
1795
|
-
async generateSandboxBrowserOpenUrl(t) {
|
|
1796
|
-
const
|
|
1797
|
-
if (!
|
|
1836
|
+
async generateSandboxBrowserOpenUrl(t, e) {
|
|
1837
|
+
const s = this.getBaseEndpoint();
|
|
1838
|
+
if (!s)
|
|
1798
1839
|
throw new Error(
|
|
1799
1840
|
"Unable to derive sandbox browser open-url endpoint. Please provide botProviderEndpoint in config."
|
|
1800
1841
|
);
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
|
|
1842
|
+
const r = Se(
|
|
1843
|
+
new URL(`${s}/sandbox/${encodeURIComponent(t)}/browser/open-url`),
|
|
1844
|
+
e
|
|
1845
|
+
), i = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
|
|
1804
1846
|
if (!i.ok)
|
|
1805
|
-
throw new
|
|
1847
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1806
1848
|
}));
|
|
1807
|
-
const
|
|
1808
|
-
if (!
|
|
1849
|
+
const a = await i.json(), o = a.data?.openURL ?? a.openURL;
|
|
1850
|
+
if (!o)
|
|
1809
1851
|
throw new Error("Sandbox browser open-url response did not contain an openURL.");
|
|
1810
|
-
return
|
|
1852
|
+
return o;
|
|
1811
1853
|
}
|
|
1812
1854
|
/**
|
|
1813
1855
|
* F-021 — 衍生 sandbox fs 端點 base:`{base}/sandbox/{sandboxName}/fs`(namespace / bot-provider 已在 base)。
|
|
@@ -1818,6 +1860,13 @@ class _n {
|
|
|
1818
1860
|
throw new Error("Unable to derive sandbox fs endpoint. Please provide botProviderEndpoint in config.");
|
|
1819
1861
|
return `${e}/sandbox/${encodeURIComponent(t)}/fs`;
|
|
1820
1862
|
}
|
|
1863
|
+
/**
|
|
1864
|
+
* F-021 — one sandbox fs URL, with the channel scope already on it. Every `fs/*` call goes through here
|
|
1865
|
+
* so the ownership parameter cannot be forgotten in one of eleven places (see `withChannelScope`).
|
|
1866
|
+
*/
|
|
1867
|
+
sandboxFsUrl(t, e, s) {
|
|
1868
|
+
return Se(new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`), s);
|
|
1869
|
+
}
|
|
1821
1870
|
/** The shared auth / custom headers for the client's plain-JSON REST calls (no SSE). */
|
|
1822
1871
|
apiHeaders() {
|
|
1823
1872
|
const t = { ...this.customHeaders };
|
|
@@ -1827,14 +1876,14 @@ class _n {
|
|
|
1827
1876
|
* F-021 — 列出 sandbox 目錄內容(`GET fs/list?path=`)。回應 `{ data: { entries, truncated } }`(envelope
|
|
1828
1877
|
* 容錯,比照 `channelMetadata`)。
|
|
1829
1878
|
*/
|
|
1830
|
-
async sandboxFsList(t, e) {
|
|
1831
|
-
const
|
|
1832
|
-
|
|
1833
|
-
const
|
|
1834
|
-
if (!
|
|
1835
|
-
throw new
|
|
1879
|
+
async sandboxFsList(t, e, s) {
|
|
1880
|
+
const r = this.sandboxFsUrl(t, "list", s);
|
|
1881
|
+
r.searchParams.set("path", e);
|
|
1882
|
+
const i = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1883
|
+
if (!i.ok)
|
|
1884
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1836
1885
|
}));
|
|
1837
|
-
const
|
|
1886
|
+
const a = await i.json(), o = a.data ?? a;
|
|
1838
1887
|
return { entries: o.entries ?? [], truncated: o.truncated ?? !1 };
|
|
1839
1888
|
}
|
|
1840
1889
|
/**
|
|
@@ -1842,16 +1891,16 @@ class _n {
|
|
|
1842
1891
|
* 檔案總長度 / 是否截斷走 `X-Total-Bytes` / `X-Truncated` header。
|
|
1843
1892
|
*/
|
|
1844
1893
|
async sandboxFsRead(t, e, s) {
|
|
1845
|
-
const r =
|
|
1894
|
+
const r = this.sandboxFsUrl(t, "file", s);
|
|
1846
1895
|
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));
|
|
1847
1896
|
const i = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1848
1897
|
if (!i.ok)
|
|
1849
|
-
throw new
|
|
1898
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1850
1899
|
}));
|
|
1851
|
-
const
|
|
1900
|
+
const a = await i.blob(), o = i.headers.get("X-Total-Bytes");
|
|
1852
1901
|
return {
|
|
1853
|
-
content:
|
|
1854
|
-
totalBytes:
|
|
1902
|
+
content: a,
|
|
1903
|
+
totalBytes: o != null ? Number(o) : a.size,
|
|
1855
1904
|
truncated: i.headers.get("X-Truncated") === "true"
|
|
1856
1905
|
};
|
|
1857
1906
|
}
|
|
@@ -1860,41 +1909,41 @@ class _n {
|
|
|
1860
1909
|
* 回應 `{ data: { bytesWritten } }`。
|
|
1861
1910
|
*/
|
|
1862
1911
|
async sandboxFsWrite(t, e, s, r) {
|
|
1863
|
-
const i =
|
|
1912
|
+
const i = this.sandboxFsUrl(t, "file", r);
|
|
1864
1913
|
i.searchParams.set("path", e), r?.mode != null && i.searchParams.set("mode", String(r.mode)), r?.createOnly && i.searchParams.set("create_only", "true");
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1867
|
-
const
|
|
1914
|
+
const a = new FormData();
|
|
1915
|
+
a.append("file", s instanceof Blob ? s : new Blob([s]));
|
|
1916
|
+
const o = await fetch(i.toString(), {
|
|
1868
1917
|
method: "PUT",
|
|
1869
1918
|
headers: this.apiHeaders(),
|
|
1870
|
-
body:
|
|
1919
|
+
body: a,
|
|
1871
1920
|
signal: r?.signal
|
|
1872
1921
|
});
|
|
1873
|
-
if (!
|
|
1874
|
-
throw new
|
|
1922
|
+
if (!o.ok)
|
|
1923
|
+
throw new y(o.status, o.statusText, await o.text().catch(() => {
|
|
1875
1924
|
}));
|
|
1876
|
-
const
|
|
1877
|
-
return { bytesWritten: (
|
|
1925
|
+
const c = await o.json();
|
|
1926
|
+
return { bytesWritten: (c.data ?? c).bytesWritten ?? 0 };
|
|
1878
1927
|
}
|
|
1879
1928
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1880
|
-
async sandboxFsRequest(t, e, s, r) {
|
|
1881
|
-
const
|
|
1882
|
-
Object.entries(r).forEach(([
|
|
1883
|
-
const o = await fetch(
|
|
1929
|
+
async sandboxFsRequest(t, e, s, r, i) {
|
|
1930
|
+
const a = this.sandboxFsUrl(t, e, i);
|
|
1931
|
+
Object.entries(r).forEach(([c, u]) => a.searchParams.set(c, u));
|
|
1932
|
+
const o = await fetch(a.toString(), { method: s, headers: this.apiHeaders() });
|
|
1884
1933
|
if (!o.ok)
|
|
1885
|
-
throw new
|
|
1934
|
+
throw new y(o.status, o.statusText, await o.text().catch(() => {
|
|
1886
1935
|
}));
|
|
1887
1936
|
return o.json().catch(() => null);
|
|
1888
1937
|
}
|
|
1889
1938
|
/** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
|
|
1890
|
-
async sandboxFsStat(t, e) {
|
|
1891
|
-
const
|
|
1892
|
-
|
|
1893
|
-
const
|
|
1894
|
-
if (!
|
|
1895
|
-
throw new
|
|
1939
|
+
async sandboxFsStat(t, e, s) {
|
|
1940
|
+
const r = this.sandboxFsUrl(t, "stat", s);
|
|
1941
|
+
r.searchParams.set("path", e);
|
|
1942
|
+
const i = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1943
|
+
if (!i.ok)
|
|
1944
|
+
throw new y(i.status, i.statusText, await i.text().catch(() => {
|
|
1896
1945
|
}));
|
|
1897
|
-
const
|
|
1946
|
+
const a = await i.json(), o = a.data ?? a;
|
|
1898
1947
|
return {
|
|
1899
1948
|
exists: o.exists ?? !1,
|
|
1900
1949
|
isDir: o.isDir ?? !1,
|
|
@@ -1905,57 +1954,57 @@ class _n {
|
|
|
1905
1954
|
};
|
|
1906
1955
|
}
|
|
1907
1956
|
/** F-021 — create a directory (`POST fs/mkdir?path=`). */
|
|
1908
|
-
async sandboxFsMkdir(t, e) {
|
|
1909
|
-
await this.sandboxFsRequest(t, "mkdir", "POST", { path: e });
|
|
1957
|
+
async sandboxFsMkdir(t, e, s) {
|
|
1958
|
+
await this.sandboxFsRequest(t, "mkdir", "POST", { path: e }, s);
|
|
1910
1959
|
}
|
|
1911
1960
|
/** F-021 — delete a file (`DELETE fs/item?path=`). */
|
|
1912
|
-
async sandboxFsRemove(t, e) {
|
|
1913
|
-
await this.sandboxFsRequest(t, "item", "DELETE", { path: e });
|
|
1961
|
+
async sandboxFsRemove(t, e, s) {
|
|
1962
|
+
await this.sandboxFsRequest(t, "item", "DELETE", { path: e }, s);
|
|
1914
1963
|
}
|
|
1915
1964
|
/** F-021 — recursively delete a directory (`DELETE fs/all?path=`). */
|
|
1916
|
-
async sandboxFsRemoveAll(t, e) {
|
|
1917
|
-
await this.sandboxFsRequest(t, "all", "DELETE", { path: e });
|
|
1965
|
+
async sandboxFsRemoveAll(t, e, s) {
|
|
1966
|
+
await this.sandboxFsRequest(t, "all", "DELETE", { path: e }, s);
|
|
1918
1967
|
}
|
|
1919
1968
|
/** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
|
|
1920
1969
|
async sandboxFsCopy(t, e, s, r) {
|
|
1921
1970
|
const i = { src: e, dst: s };
|
|
1922
1971
|
r?.overwrite && (i.overwrite = "true");
|
|
1923
|
-
const
|
|
1924
|
-
return { bytesCopied: (
|
|
1972
|
+
const a = await this.sandboxFsRequest(t, "copy", "POST", i, r);
|
|
1973
|
+
return { bytesCopied: (a?.data ?? a)?.bytesCopied ?? 0 };
|
|
1925
1974
|
}
|
|
1926
1975
|
/** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
|
|
1927
1976
|
async sandboxFsMove(t, e, s, r) {
|
|
1928
1977
|
const i = { src: e, dst: s };
|
|
1929
|
-
r?.overwrite && (i.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", i);
|
|
1978
|
+
r?.overwrite && (i.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", i, r);
|
|
1930
1979
|
}
|
|
1931
1980
|
/**
|
|
1932
1981
|
* F-021 — watch a sandbox path for changes (`GET fs/watch?path=`, SSE). Each `event: change` frame is one
|
|
1933
1982
|
* `SandboxFsWatchEvent`. The backend probes the path first, so a missing path errors as HTTP rather than
|
|
1934
1983
|
* as a dead stream. Unsubscribing aborts the request, which ends the sandbox-side watcher.
|
|
1935
1984
|
*/
|
|
1936
|
-
sandboxFsWatch(t, e) {
|
|
1937
|
-
const
|
|
1938
|
-
return
|
|
1939
|
-
const
|
|
1940
|
-
return
|
|
1985
|
+
sandboxFsWatch(t, e, s) {
|
|
1986
|
+
const r = this.sandboxFsUrl(t, "watch", s);
|
|
1987
|
+
return r.searchParams.set("path", e), new w((i) => {
|
|
1988
|
+
const a = new AbortController();
|
|
1989
|
+
return xe(r.toString(), {
|
|
1941
1990
|
headers: this.apiHeaders(),
|
|
1942
|
-
signal:
|
|
1991
|
+
signal: a.signal,
|
|
1943
1992
|
openWhenHidden: !0,
|
|
1944
1993
|
onopen: async (o) => {
|
|
1945
1994
|
if (!o.ok) {
|
|
1946
|
-
const
|
|
1995
|
+
const c = await o.text().catch(() => {
|
|
1947
1996
|
});
|
|
1948
|
-
|
|
1997
|
+
i.error(new y(o.status, o.statusText, c)), a.abort();
|
|
1949
1998
|
}
|
|
1950
1999
|
},
|
|
1951
2000
|
onmessage: (o) => {
|
|
1952
|
-
o.event === "change" &&
|
|
2001
|
+
o.event === "change" && i.next(JSON.parse(o.data));
|
|
1953
2002
|
},
|
|
1954
|
-
onclose: () =>
|
|
2003
|
+
onclose: () => i.complete(),
|
|
1955
2004
|
onerror: (o) => {
|
|
1956
|
-
throw
|
|
2005
|
+
throw i.error(o), a.abort(), o;
|
|
1957
2006
|
}
|
|
1958
|
-
}), () =>
|
|
2007
|
+
}), () => a.abort();
|
|
1959
2008
|
});
|
|
1960
2009
|
}
|
|
1961
2010
|
/**
|
|
@@ -1974,9 +2023,9 @@ class _n {
|
|
|
1974
2023
|
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1975
2024
|
}
|
|
1976
2025
|
}
|
|
1977
|
-
const
|
|
2026
|
+
const sn = "", rn = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
1978
2027
|
function C(n, t) {
|
|
1979
|
-
if (n ===
|
|
2028
|
+
if (n === sn) {
|
|
1980
2029
|
if (t?.allowRoot)
|
|
1981
2030
|
return n;
|
|
1982
2031
|
throw new Error(
|
|
@@ -1987,15 +2036,15 @@ function C(n, t) {
|
|
|
1987
2036
|
throw new Error(`SourceSet volume path must be relative, with no leading slash (the root is ""): "${n}".`);
|
|
1988
2037
|
if (n.endsWith("/"))
|
|
1989
2038
|
throw new Error(`SourceSet volume path must not end with a slash: "${n}".`);
|
|
1990
|
-
if (n.split("/").some((e) =>
|
|
2039
|
+
if (n.split("/").some((e) => rn.has(e)))
|
|
1991
2040
|
throw new Error(`SourceSet volume path must not contain empty, "." or ".." segments: "${n}".`);
|
|
1992
2041
|
return n;
|
|
1993
2042
|
}
|
|
1994
|
-
const
|
|
1995
|
-
function
|
|
1996
|
-
return Math.min(Math.max(1, Math.floor(n)),
|
|
2043
|
+
const Xe = 1e3, an = 1e4;
|
|
2044
|
+
function ye(n) {
|
|
2045
|
+
return Math.min(Math.max(1, Math.floor(n)), Xe);
|
|
1997
2046
|
}
|
|
1998
|
-
class
|
|
2047
|
+
class Un {
|
|
1999
2048
|
endpoint;
|
|
2000
2049
|
apiKey;
|
|
2001
2050
|
customHeaders;
|
|
@@ -2009,25 +2058,25 @@ class Ln {
|
|
|
2009
2058
|
}
|
|
2010
2059
|
/** Issue one volume request, turning any non-2xx into {@link HttpError} (409 included, see R8). */
|
|
2011
2060
|
async request(t, e, s, r, i) {
|
|
2012
|
-
const
|
|
2013
|
-
Object.entries(s).forEach(([
|
|
2014
|
-
const
|
|
2015
|
-
if (!
|
|
2016
|
-
throw new
|
|
2061
|
+
const a = new URL(`${this.endpoint}/${t}`);
|
|
2062
|
+
Object.entries(s).forEach(([c, u]) => a.searchParams.set(c, u));
|
|
2063
|
+
const o = await fetch(a.toString(), { method: e, headers: this.headers(), body: r, signal: i });
|
|
2064
|
+
if (!o.ok)
|
|
2065
|
+
throw new y(o.status, o.statusText, await o.text().catch(() => {
|
|
2017
2066
|
}));
|
|
2018
|
-
return
|
|
2067
|
+
return o;
|
|
2019
2068
|
}
|
|
2020
2069
|
/** One page of a directory (`GET volume/list?path=[&page&page_size]`). `path` may be the root `''`. */
|
|
2021
2070
|
async list(t, e) {
|
|
2022
2071
|
const s = { path: C(t, { allowRoot: !0 }) };
|
|
2023
|
-
e?.page != null && (s.page = String(e.page)), e?.pageSize != null && (s.page_size = String(
|
|
2024
|
-
const i = await (await this.request("list", "GET", s)).json(),
|
|
2072
|
+
e?.page != null && (s.page = String(e.page)), e?.pageSize != null && (s.page_size = String(ye(e.pageSize)));
|
|
2073
|
+
const i = await (await this.request("list", "GET", s)).json(), a = i.data ?? i;
|
|
2025
2074
|
return {
|
|
2026
|
-
entries:
|
|
2075
|
+
entries: a.entries ?? [],
|
|
2027
2076
|
// Reported as `null` rather than invented. An earlier version synthesized
|
|
2028
2077
|
// `{ total: entries.length }` here to keep `listAll` terminating, which worked — and made a
|
|
2029
2078
|
// relay that omits `paging` report the first 1000 of 3000 files as the whole directory.
|
|
2030
|
-
paging:
|
|
2079
|
+
paging: a.paging ?? i.paging ?? null
|
|
2031
2080
|
};
|
|
2032
2081
|
}
|
|
2033
2082
|
/**
|
|
@@ -2037,27 +2086,27 @@ class Ln {
|
|
|
2037
2086
|
* directory that looks whole is the failure this exists to prevent.
|
|
2038
2087
|
*/
|
|
2039
2088
|
async listAll(t, e) {
|
|
2040
|
-
const s =
|
|
2041
|
-
let
|
|
2089
|
+
const s = ye(e?.pageSize ?? Xe), r = e?.maxEntries ?? an, i = [];
|
|
2090
|
+
let a = 0, o = !0, c = 0;
|
|
2042
2091
|
for (; ; ) {
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2045
|
-
|
|
2092
|
+
const u = await this.list(t, { page: c, pageSize: s }), d = u.paging;
|
|
2093
|
+
if (d && d.index !== c) {
|
|
2094
|
+
a = d.total, o = !1;
|
|
2046
2095
|
break;
|
|
2047
2096
|
}
|
|
2048
|
-
if (i.push(...
|
|
2049
|
-
|
|
2097
|
+
if (i.push(...u.entries), !d) {
|
|
2098
|
+
o = u.entries.length < s;
|
|
2050
2099
|
break;
|
|
2051
2100
|
}
|
|
2052
|
-
if (
|
|
2101
|
+
if (a = d.total, i.length >= a)
|
|
2053
2102
|
break;
|
|
2054
|
-
if (i.length >= r ||
|
|
2055
|
-
|
|
2103
|
+
if (i.length >= r || u.entries.length === 0) {
|
|
2104
|
+
o = !1;
|
|
2056
2105
|
break;
|
|
2057
2106
|
}
|
|
2058
|
-
|
|
2107
|
+
c += 1;
|
|
2059
2108
|
}
|
|
2060
|
-
return { entries: i, total:
|
|
2109
|
+
return { entries: i, total: a, complete: o };
|
|
2061
2110
|
}
|
|
2062
2111
|
/** Stat a path (`GET volume/stat?path=`). A missing path is 200 with `exists: false`, not a 404. */
|
|
2063
2112
|
async stat(t) {
|
|
@@ -2075,10 +2124,10 @@ class Ln {
|
|
|
2075
2124
|
async read(t, e) {
|
|
2076
2125
|
const s = { path: C(t) };
|
|
2077
2126
|
e?.offsetBytes != null && (s.offset_bytes = String(e.offsetBytes)), e?.limitBytes != null && (s.limit_bytes = String(e.limitBytes));
|
|
2078
|
-
const r = await this.request("file", "GET", s), i = await r.blob(),
|
|
2127
|
+
const r = await this.request("file", "GET", s), i = await r.blob(), a = r.headers.get("X-Total-Bytes");
|
|
2079
2128
|
return {
|
|
2080
2129
|
content: i,
|
|
2081
|
-
totalBytes:
|
|
2130
|
+
totalBytes: a != null ? Number(a) : i.size,
|
|
2082
2131
|
truncated: r.headers.get("X-Truncated") === "true"
|
|
2083
2132
|
};
|
|
2084
2133
|
}
|
|
@@ -2091,8 +2140,8 @@ class Ln {
|
|
|
2091
2140
|
s?.mode != null && (r.mode = String(s.mode)), s?.createOnly && (r.create_only = "true");
|
|
2092
2141
|
const i = new FormData();
|
|
2093
2142
|
i.append("file", e instanceof Blob ? e : new Blob([e]));
|
|
2094
|
-
const
|
|
2095
|
-
return { bytesWritten: (
|
|
2143
|
+
const o = await (await this.request("file", "PUT", r, i, s?.signal)).json();
|
|
2144
|
+
return { bytesWritten: (o.data ?? o).bytesWritten ?? 0 };
|
|
2096
2145
|
}
|
|
2097
2146
|
/** Create a directory and any missing parents (`POST volume/mkdir?path=`). */
|
|
2098
2147
|
async mkdir(t, e) {
|
|
@@ -2108,8 +2157,8 @@ class Ln {
|
|
|
2108
2157
|
}
|
|
2109
2158
|
/** Copy a file or directory tree (`POST volume/copy?src=&dst=[&overwrite]`). */
|
|
2110
2159
|
async copy(t, e, s) {
|
|
2111
|
-
const r = this.copyMoveQuery(t, e, s),
|
|
2112
|
-
return { bytesCopied: (
|
|
2160
|
+
const r = this.copyMoveQuery(t, e, s), a = await (await this.request("copy", "POST", r)).json();
|
|
2161
|
+
return { bytesCopied: (a.data ?? a).bytesCopied ?? 0 };
|
|
2113
2162
|
}
|
|
2114
2163
|
/** Move or rename (`POST volume/move?src=&dst=[&overwrite]`) — also how the UI renames. */
|
|
2115
2164
|
async move(t, e, s) {
|
|
@@ -2127,38 +2176,39 @@ function on(n, t = 0) {
|
|
|
2127
2176
|
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();
|
|
2128
2177
|
}
|
|
2129
2178
|
let Z;
|
|
2130
|
-
const
|
|
2131
|
-
function
|
|
2179
|
+
const cn = new Uint8Array(16);
|
|
2180
|
+
function un() {
|
|
2132
2181
|
if (!Z) {
|
|
2133
2182
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2134
2183
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2135
2184
|
Z = crypto.getRandomValues.bind(crypto);
|
|
2136
2185
|
}
|
|
2137
|
-
return Z(
|
|
2186
|
+
return Z(cn);
|
|
2138
2187
|
}
|
|
2139
|
-
const
|
|
2140
|
-
function
|
|
2188
|
+
const ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), we = { randomUUID: ln };
|
|
2189
|
+
function dn(n, t, e) {
|
|
2141
2190
|
n = n || {};
|
|
2142
|
-
const s = n.random ?? n.rng?.() ??
|
|
2191
|
+
const s = n.random ?? n.rng?.() ?? un();
|
|
2143
2192
|
if (s.length < 16)
|
|
2144
2193
|
throw new Error("Random bytes length must be >= 16");
|
|
2145
2194
|
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, on(s);
|
|
2146
2195
|
}
|
|
2147
|
-
function
|
|
2148
|
-
return
|
|
2196
|
+
function Ye(n, t, e) {
|
|
2197
|
+
return we.randomUUID && !n ? we.randomUUID() : dn(n);
|
|
2149
2198
|
}
|
|
2150
2199
|
class g {
|
|
2151
2200
|
messages = null;
|
|
2152
2201
|
pendingConsent = null;
|
|
2153
|
-
|
|
2154
|
-
|
|
2202
|
+
pendingFeedback = null;
|
|
2203
|
+
constructor({ messages: t, pendingConsent: e = null, pendingFeedback: s = null }) {
|
|
2204
|
+
this.messages = t, this.pendingConsent = e ?? null, this.pendingFeedback = s ?? null;
|
|
2155
2205
|
}
|
|
2156
2206
|
pushMessage(t) {
|
|
2157
2207
|
const e = new Map(this.messages);
|
|
2158
|
-
return e.set(t.messageId, t), new g({ messages: e, pendingConsent: this.pendingConsent });
|
|
2208
|
+
return e.set(t.messageId, t), new g({ messages: e, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2159
2209
|
}
|
|
2160
2210
|
clearPendingConsent() {
|
|
2161
|
-
return this.pendingConsent ? new g({ messages: this.messages, pendingConsent: null }) : this;
|
|
2211
|
+
return this.pendingConsent ? new g({ messages: this.messages, pendingConsent: null, pendingFeedback: this.pendingFeedback }) : this;
|
|
2162
2212
|
}
|
|
2163
2213
|
/**
|
|
2164
2214
|
* Put a consent prompt back (#410) — the mirror of {@link clearPendingConsent}, used to undo the
|
|
@@ -2166,7 +2216,7 @@ class g {
|
|
|
2166
2216
|
* meantime: that one is newer than the batch being restored.
|
|
2167
2217
|
*/
|
|
2168
2218
|
restorePendingConsent(t) {
|
|
2169
|
-
return this.pendingConsent ? this : new g({ messages: this.messages, pendingConsent: t });
|
|
2219
|
+
return this.pendingConsent ? this : new g({ messages: this.messages, pendingConsent: t, pendingFeedback: this.pendingFeedback });
|
|
2170
2220
|
}
|
|
2171
2221
|
/**
|
|
2172
2222
|
* Converge everything the aborted run left mid-flight (F-020 AC10, F-023). A stopped run sends no
|
|
@@ -2187,7 +2237,7 @@ class g {
|
|
|
2187
2237
|
const e = new Map(this.messages);
|
|
2188
2238
|
for (const [s, r] of e)
|
|
2189
2239
|
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);
|
|
2190
|
-
return t ? new g({ messages: e, pendingConsent: this.pendingConsent }) : this;
|
|
2240
|
+
return t ? new g({ messages: e, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback }) : this;
|
|
2191
2241
|
}
|
|
2192
2242
|
/**
|
|
2193
2243
|
* @deprecated Renamed to {@link settleInFlightMessages} in 0.3.27 — it settles in-flight thinking
|
|
@@ -2199,37 +2249,39 @@ class g {
|
|
|
2199
2249
|
}
|
|
2200
2250
|
onMessage(t) {
|
|
2201
2251
|
switch (t.eventType) {
|
|
2202
|
-
case
|
|
2252
|
+
case l.MESSAGE_START:
|
|
2203
2253
|
return this.onMessageStart(t);
|
|
2204
|
-
case
|
|
2254
|
+
case l.MESSAGE_DELTA:
|
|
2205
2255
|
return this.onMessageDelta(t);
|
|
2206
|
-
case
|
|
2256
|
+
case l.MESSAGE_COMPLETE:
|
|
2207
2257
|
return this.onMessageComplete(t);
|
|
2208
|
-
case
|
|
2258
|
+
case l.MESSAGE_USER:
|
|
2209
2259
|
return this.onMessageUser(t);
|
|
2210
|
-
case
|
|
2260
|
+
case l.MESSAGE_FEEDBACK:
|
|
2261
|
+
return this.onMessageFeedback(t);
|
|
2262
|
+
case l.MESSAGE_THINKING_START:
|
|
2211
2263
|
return this.onThinkingStart(t);
|
|
2212
|
-
case
|
|
2264
|
+
case l.MESSAGE_THINKING_DELTA:
|
|
2213
2265
|
return this.onThinkingDelta(t);
|
|
2214
|
-
case
|
|
2266
|
+
case l.MESSAGE_THINKING_COMPLETE:
|
|
2215
2267
|
return this.onThinkingComplete(t);
|
|
2216
|
-
case
|
|
2268
|
+
case l.MESSAGE_CANVAS_START:
|
|
2217
2269
|
return this.onCanvasStart(t);
|
|
2218
|
-
case
|
|
2270
|
+
case l.MESSAGE_CANVAS_DELTA:
|
|
2219
2271
|
return this.onCanvasDelta(t);
|
|
2220
|
-
case
|
|
2272
|
+
case l.MESSAGE_CANVAS_COMPLETE:
|
|
2221
2273
|
return this.onCanvasComplete(t);
|
|
2222
|
-
case
|
|
2274
|
+
case l.TOOL_CALL_START:
|
|
2223
2275
|
return this.onToolCallStart(t);
|
|
2224
|
-
case
|
|
2276
|
+
case l.TOOL_CALL_COMPLETE:
|
|
2225
2277
|
return this.onToolCallComplete(t);
|
|
2226
|
-
case
|
|
2278
|
+
case l.TOOL_CALL_CONSENT:
|
|
2227
2279
|
return this.onToolCallConsent(t);
|
|
2228
|
-
case
|
|
2280
|
+
case l.SUBAGENT_START:
|
|
2229
2281
|
return this.onSubagentStart(t);
|
|
2230
|
-
case
|
|
2282
|
+
case l.SUBAGENT_COMPLETE:
|
|
2231
2283
|
return this.onSubagentComplete(t);
|
|
2232
|
-
case
|
|
2284
|
+
case l.ERROR:
|
|
2233
2285
|
return this.onMessageError(t);
|
|
2234
2286
|
default:
|
|
2235
2287
|
return this;
|
|
@@ -2275,7 +2327,7 @@ class g {
|
|
|
2275
2327
|
const s = new Map(this.messages);
|
|
2276
2328
|
return s.set(e.messageId, {
|
|
2277
2329
|
type: "bot",
|
|
2278
|
-
eventType:
|
|
2330
|
+
eventType: l.MESSAGE_START,
|
|
2279
2331
|
isTyping: !0,
|
|
2280
2332
|
typingText: "",
|
|
2281
2333
|
messageId: e.messageId,
|
|
@@ -2283,7 +2335,7 @@ class g {
|
|
|
2283
2335
|
time: /* @__PURE__ */ new Date(),
|
|
2284
2336
|
traceId: t.traceId,
|
|
2285
2337
|
raw: ""
|
|
2286
|
-
}), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2338
|
+
}), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2287
2339
|
}
|
|
2288
2340
|
onMessageDelta(t) {
|
|
2289
2341
|
const e = t.fact.messageDelta.message;
|
|
@@ -2293,7 +2345,7 @@ class g {
|
|
|
2293
2345
|
const r = s?.type === "bot" ? s : void 0, i = new Map(this.messages);
|
|
2294
2346
|
return i.set(e.messageId, {
|
|
2295
2347
|
type: "bot",
|
|
2296
|
-
eventType:
|
|
2348
|
+
eventType: l.MESSAGE_DELTA,
|
|
2297
2349
|
isTyping: !0,
|
|
2298
2350
|
typingText: `${r?.typingText ?? ""}${e.text}`,
|
|
2299
2351
|
messageId: e.messageId,
|
|
@@ -2301,23 +2353,55 @@ class g {
|
|
|
2301
2353
|
time: /* @__PURE__ */ new Date(),
|
|
2302
2354
|
traceId: t.traceId ?? r?.traceId,
|
|
2303
2355
|
raw: r?.raw ?? ""
|
|
2304
|
-
}), new g({ messages: i, pendingConsent: this.pendingConsent });
|
|
2356
|
+
}), new g({ messages: i, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2305
2357
|
}
|
|
2306
2358
|
onMessageComplete(t) {
|
|
2307
2359
|
const e = t.fact.messageComplete.message;
|
|
2308
2360
|
if (e.parentToolUseId) return this;
|
|
2309
|
-
const s = new Map(this.messages), r = s.get(e.messageId);
|
|
2310
|
-
|
|
2361
|
+
const s = new Map(this.messages), r = s.get(e.messageId), i = r?.type === "bot" ? r : void 0, a = this.pendingFeedback?.get(e.messageId), o = a ?? i?.feedback;
|
|
2362
|
+
s.set(e.messageId, {
|
|
2311
2363
|
type: "bot",
|
|
2312
|
-
eventType:
|
|
2364
|
+
eventType: l.MESSAGE_COMPLETE,
|
|
2313
2365
|
isTyping: !1,
|
|
2314
2366
|
typingText: null,
|
|
2315
2367
|
messageId: e.messageId,
|
|
2316
2368
|
message: e,
|
|
2369
|
+
...o ? { feedback: o } : {},
|
|
2317
2370
|
time: /* @__PURE__ */ new Date(),
|
|
2318
|
-
traceId: t.traceId ??
|
|
2371
|
+
traceId: t.traceId ?? i?.traceId,
|
|
2319
2372
|
raw: JSON.stringify(t)
|
|
2320
|
-
})
|
|
2373
|
+
});
|
|
2374
|
+
let c = this.pendingFeedback;
|
|
2375
|
+
return a && (c = new Map(this.pendingFeedback), c.delete(e.messageId)), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: c });
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* `asgard.message.feedback` (F-033): fold a rating into the reply it targets. The server is
|
|
2379
|
+
* append-only and latest-wins, so a later frame for the same target simply replaces the earlier
|
|
2380
|
+
* state — on a replay the frames arrive in seq order and the last one standing is the current one.
|
|
2381
|
+
* Only a bot reply can carry a rating; a frame naming anything else (or a reply that has not arrived
|
|
2382
|
+
* yet) is parked in `pendingFeedback` and applied if that reply's `complete` shows up later.
|
|
2383
|
+
*/
|
|
2384
|
+
onMessageFeedback(t) {
|
|
2385
|
+
const e = t.fact.messageFeedback, s = {
|
|
2386
|
+
verdict: e.verdict,
|
|
2387
|
+
...e.text ? { comment: e.text } : {}
|
|
2388
|
+
};
|
|
2389
|
+
return this.applyFeedback(e.targetMessageId, s);
|
|
2390
|
+
}
|
|
2391
|
+
/**
|
|
2392
|
+
* Set the current rating of one bot reply (F-033). Used by the reducer for server frames and by
|
|
2393
|
+
* `Channel.sendMessageFeedback` once this client's own POST has been accepted — the SDK has no open
|
|
2394
|
+
* stream between runs, so the live echo of its own feedback would never reach it. A target that is not
|
|
2395
|
+
* (yet) a bot reply is parked in `pendingFeedback`; see {@link onMessageComplete}.
|
|
2396
|
+
*/
|
|
2397
|
+
applyFeedback(t, e) {
|
|
2398
|
+
const s = this.messages?.get(t);
|
|
2399
|
+
if (s?.type === "bot") {
|
|
2400
|
+
const i = new Map(this.messages), a = { ...s, feedback: e };
|
|
2401
|
+
return i.set(t, a), new g({ messages: i, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2402
|
+
}
|
|
2403
|
+
const r = new Map(this.pendingFeedback);
|
|
2404
|
+
return r.set(t, e), new g({ messages: this.messages, pendingConsent: this.pendingConsent, pendingFeedback: r });
|
|
2321
2405
|
}
|
|
2322
2406
|
onThinkingStart(t) {
|
|
2323
2407
|
const e = t.fact.messageThinkingStart.message;
|
|
@@ -2331,14 +2415,14 @@ class g {
|
|
|
2331
2415
|
time: /* @__PURE__ */ new Date(),
|
|
2332
2416
|
traceId: t.traceId
|
|
2333
2417
|
};
|
|
2334
|
-
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2418
|
+
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2335
2419
|
}
|
|
2336
2420
|
onThinkingDelta(t) {
|
|
2337
2421
|
const e = t.fact.messageThinkingDelta.message;
|
|
2338
2422
|
if (e.parentToolUseId) return this;
|
|
2339
2423
|
const s = this.messages?.get(e.messageId);
|
|
2340
2424
|
if (this.isTerminalThinking(s)) return this;
|
|
2341
|
-
const r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages),
|
|
2425
|
+
const r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages), a = {
|
|
2342
2426
|
type: "thinking",
|
|
2343
2427
|
messageId: e.messageId,
|
|
2344
2428
|
text: `${r?.text ?? ""}${e.text}`,
|
|
@@ -2346,12 +2430,12 @@ class g {
|
|
|
2346
2430
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2347
2431
|
traceId: t.traceId ?? r?.traceId
|
|
2348
2432
|
};
|
|
2349
|
-
return i.set(e.messageId,
|
|
2433
|
+
return i.set(e.messageId, a), new g({ messages: i, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2350
2434
|
}
|
|
2351
2435
|
onThinkingComplete(t) {
|
|
2352
2436
|
const e = t.fact.messageThinkingComplete.message;
|
|
2353
2437
|
if (e.parentToolUseId) return this;
|
|
2354
|
-
const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages),
|
|
2438
|
+
const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages), a = {
|
|
2355
2439
|
type: "thinking",
|
|
2356
2440
|
messageId: e.messageId,
|
|
2357
2441
|
// Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
|
|
@@ -2361,7 +2445,7 @@ class g {
|
|
|
2361
2445
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2362
2446
|
traceId: t.traceId ?? r?.traceId
|
|
2363
2447
|
};
|
|
2364
|
-
return i.set(e.messageId,
|
|
2448
|
+
return i.set(e.messageId, a), new g({ messages: i, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2365
2449
|
}
|
|
2366
2450
|
onCanvasStart(t) {
|
|
2367
2451
|
const e = t.fact.messageCanvasStart.message;
|
|
@@ -2375,14 +2459,14 @@ class g {
|
|
|
2375
2459
|
time: /* @__PURE__ */ new Date(),
|
|
2376
2460
|
traceId: t.traceId
|
|
2377
2461
|
};
|
|
2378
|
-
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2462
|
+
return s.set(e.messageId, r), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2379
2463
|
}
|
|
2380
2464
|
onCanvasDelta(t) {
|
|
2381
2465
|
const e = t.fact.messageCanvasDelta.message;
|
|
2382
2466
|
if (e.parentToolUseId) return this;
|
|
2383
2467
|
const s = this.messages?.get(e.messageId);
|
|
2384
2468
|
if (this.isTerminalCanvas(s)) return this;
|
|
2385
|
-
const r = s?.type === "canvas" ? s : void 0, i = new Map(this.messages),
|
|
2469
|
+
const r = s?.type === "canvas" ? s : void 0, i = new Map(this.messages), a = {
|
|
2386
2470
|
type: "canvas",
|
|
2387
2471
|
messageId: e.messageId,
|
|
2388
2472
|
// Deltas are incremental, exactly like a text delta.
|
|
@@ -2392,18 +2476,18 @@ class g {
|
|
|
2392
2476
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2393
2477
|
traceId: t.traceId ?? r?.traceId
|
|
2394
2478
|
};
|
|
2395
|
-
return i.set(e.messageId,
|
|
2479
|
+
return i.set(e.messageId, a), new g({ messages: i, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2396
2480
|
}
|
|
2397
2481
|
onCanvasComplete(t) {
|
|
2398
2482
|
const e = t.fact.messageCanvasComplete.message;
|
|
2399
2483
|
if (e.parentToolUseId) return this;
|
|
2400
|
-
const s = e.template?.type ===
|
|
2484
|
+
const s = e.template?.type === Ce.CANVAS ? e.template : void 0, r = s?.canvas?.html;
|
|
2401
2485
|
if (!r) {
|
|
2402
2486
|
if (!this.messages?.has(e.messageId)) return this;
|
|
2403
|
-
const
|
|
2404
|
-
return
|
|
2487
|
+
const u = new Map(this.messages);
|
|
2488
|
+
return u.delete(e.messageId), new g({ messages: u, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2405
2489
|
}
|
|
2406
|
-
const i = this.messages?.get(e.messageId),
|
|
2490
|
+
const i = this.messages?.get(e.messageId), a = i?.type === "canvas" ? i : void 0, o = new Map(this.messages), c = {
|
|
2407
2491
|
type: "canvas",
|
|
2408
2492
|
messageId: e.messageId,
|
|
2409
2493
|
// **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
|
|
@@ -2411,10 +2495,10 @@ class g {
|
|
|
2411
2495
|
html: r,
|
|
2412
2496
|
title: s?.title,
|
|
2413
2497
|
isDrawing: !1,
|
|
2414
|
-
time:
|
|
2415
|
-
traceId: t.traceId ??
|
|
2498
|
+
time: a?.time ?? /* @__PURE__ */ new Date(),
|
|
2499
|
+
traceId: t.traceId ?? a?.traceId
|
|
2416
2500
|
};
|
|
2417
|
-
return
|
|
2501
|
+
return o.set(e.messageId, c), new g({ messages: o, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2418
2502
|
}
|
|
2419
2503
|
onMessageUser(t) {
|
|
2420
2504
|
const e = t.fact.messageUser;
|
|
@@ -2430,25 +2514,25 @@ class g {
|
|
|
2430
2514
|
time: /* @__PURE__ */ new Date(),
|
|
2431
2515
|
traceId: t.traceId
|
|
2432
2516
|
};
|
|
2433
|
-
return r.set(e.messageId, i), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2517
|
+
return r.set(e.messageId, i), new g({ messages: r, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2434
2518
|
}
|
|
2435
2519
|
onMessageError(t) {
|
|
2436
|
-
const e =
|
|
2520
|
+
const e = Ye(), s = t.fact.runError.error, r = new Map(this.messages);
|
|
2437
2521
|
return r.set(e, {
|
|
2438
2522
|
type: "error",
|
|
2439
|
-
eventType:
|
|
2523
|
+
eventType: l.ERROR,
|
|
2440
2524
|
messageId: e,
|
|
2441
2525
|
error: s,
|
|
2442
2526
|
time: /* @__PURE__ */ new Date(),
|
|
2443
2527
|
traceId: t.traceId
|
|
2444
|
-
}), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2528
|
+
}), new g({ messages: r, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2445
2529
|
}
|
|
2446
2530
|
onToolCallStart(t) {
|
|
2447
2531
|
const e = t.fact.toolCallStart, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`;
|
|
2448
2532
|
if (this.isTerminalToolCall(this.messages?.get(r))) return this;
|
|
2449
2533
|
const i = {
|
|
2450
2534
|
type: "tool-call",
|
|
2451
|
-
eventType:
|
|
2535
|
+
eventType: l.TOOL_CALL_START,
|
|
2452
2536
|
messageId: r,
|
|
2453
2537
|
processId: e.processId,
|
|
2454
2538
|
callSeq: e.callSeq,
|
|
@@ -2462,25 +2546,25 @@ class g {
|
|
|
2462
2546
|
time: /* @__PURE__ */ new Date(),
|
|
2463
2547
|
traceId: t.traceId
|
|
2464
2548
|
};
|
|
2465
|
-
return s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2549
|
+
return s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2466
2550
|
}
|
|
2467
2551
|
onToolCallComplete(t) {
|
|
2468
2552
|
const e = t.fact.toolCallComplete, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`, i = s.get(r);
|
|
2469
2553
|
if (i?.type === "tool-call") {
|
|
2470
|
-
const
|
|
2554
|
+
const a = {
|
|
2471
2555
|
...i,
|
|
2472
|
-
eventType:
|
|
2556
|
+
eventType: l.TOOL_CALL_COMPLETE,
|
|
2473
2557
|
result: e.toolCallResult,
|
|
2474
2558
|
isError: e.isError,
|
|
2475
2559
|
sidecar: e.toolUseResultSidecar,
|
|
2476
2560
|
isComplete: !0,
|
|
2477
2561
|
traceId: t.traceId ?? i.traceId
|
|
2478
2562
|
};
|
|
2479
|
-
s.set(r,
|
|
2563
|
+
s.set(r, a);
|
|
2480
2564
|
} else {
|
|
2481
|
-
const
|
|
2565
|
+
const a = {
|
|
2482
2566
|
type: "tool-call",
|
|
2483
|
-
eventType:
|
|
2567
|
+
eventType: l.TOOL_CALL_COMPLETE,
|
|
2484
2568
|
messageId: r,
|
|
2485
2569
|
processId: e.processId,
|
|
2486
2570
|
callSeq: e.callSeq,
|
|
@@ -2497,13 +2581,17 @@ class g {
|
|
|
2497
2581
|
time: /* @__PURE__ */ new Date(),
|
|
2498
2582
|
traceId: t.traceId
|
|
2499
2583
|
};
|
|
2500
|
-
s.set(r,
|
|
2584
|
+
s.set(r, a);
|
|
2501
2585
|
}
|
|
2502
|
-
return new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2586
|
+
return new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2503
2587
|
}
|
|
2504
2588
|
onToolCallConsent(t) {
|
|
2505
2589
|
const e = t.fact.toolCallConsent;
|
|
2506
|
-
return new g({
|
|
2590
|
+
return new g({
|
|
2591
|
+
messages: this.messages,
|
|
2592
|
+
pendingConsent: e,
|
|
2593
|
+
pendingFeedback: this.pendingFeedback
|
|
2594
|
+
});
|
|
2507
2595
|
}
|
|
2508
2596
|
onSubagentStart(t) {
|
|
2509
2597
|
const e = t.fact.subagentStart, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:start`, i = {
|
|
@@ -2517,7 +2605,7 @@ class g {
|
|
|
2517
2605
|
time: /* @__PURE__ */ new Date(),
|
|
2518
2606
|
traceId: t.traceId
|
|
2519
2607
|
};
|
|
2520
|
-
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2608
|
+
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2521
2609
|
}
|
|
2522
2610
|
onSubagentComplete(t) {
|
|
2523
2611
|
const e = t.fact.subagentComplete, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:complete`, i = {
|
|
@@ -2532,68 +2620,68 @@ class g {
|
|
|
2532
2620
|
time: /* @__PURE__ */ new Date(),
|
|
2533
2621
|
traceId: t.traceId
|
|
2534
2622
|
};
|
|
2535
|
-
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2623
|
+
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent, pendingFeedback: this.pendingFeedback });
|
|
2536
2624
|
}
|
|
2537
2625
|
}
|
|
2538
|
-
const
|
|
2539
|
-
function
|
|
2540
|
-
return n.toolsetName === "" &&
|
|
2626
|
+
const hn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
2627
|
+
function fn(n) {
|
|
2628
|
+
return n.toolsetName === "" && hn.has(n.toolName);
|
|
2541
2629
|
}
|
|
2542
|
-
function
|
|
2630
|
+
function Ee(n) {
|
|
2543
2631
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2544
2632
|
}
|
|
2545
2633
|
function x(n) {
|
|
2546
2634
|
return typeof n == "string" ? n : void 0;
|
|
2547
2635
|
}
|
|
2548
|
-
function
|
|
2636
|
+
function pn(n) {
|
|
2549
2637
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
2550
2638
|
for (const s of n) {
|
|
2551
2639
|
const r = s.parameter ?? {}, i = s.sidecar ?? {};
|
|
2552
2640
|
if (s.toolName === "TaskCreate") {
|
|
2553
|
-
const
|
|
2554
|
-
if (!
|
|
2555
|
-
e.has(
|
|
2556
|
-
id:
|
|
2557
|
-
subject: x(r.subject) || x(
|
|
2641
|
+
const a = Ee(i.task), o = x(a?.id);
|
|
2642
|
+
if (!o) continue;
|
|
2643
|
+
e.has(o) || t.push(o), e.set(o, {
|
|
2644
|
+
id: o,
|
|
2645
|
+
subject: x(r.subject) || x(a?.subject) || "",
|
|
2558
2646
|
activeForm: x(r.activeForm),
|
|
2559
2647
|
description: x(r.description),
|
|
2560
|
-
status: e.get(
|
|
2648
|
+
status: e.get(o)?.status ?? "pending"
|
|
2561
2649
|
// initial status = pending (keep existing on repeat)
|
|
2562
2650
|
});
|
|
2563
2651
|
} else if (s.toolName === "TaskUpdate") {
|
|
2564
|
-
const
|
|
2565
|
-
if (!
|
|
2566
|
-
const
|
|
2567
|
-
|
|
2652
|
+
const a = Ee(i.statusChange), o = x(r.taskId) || x(i.taskId), c = x(a?.to) || x(r.status);
|
|
2653
|
+
if (!o || !c) continue;
|
|
2654
|
+
const u = e.get(o);
|
|
2655
|
+
u && e.set(o, { ...u, status: c });
|
|
2568
2656
|
}
|
|
2569
2657
|
}
|
|
2570
2658
|
return t.map((s) => e.get(s));
|
|
2571
2659
|
}
|
|
2572
|
-
function
|
|
2660
|
+
function gn(n) {
|
|
2573
2661
|
return n.toolsetName === "" && n.toolName === "Agent";
|
|
2574
2662
|
}
|
|
2575
2663
|
function mn(n) {
|
|
2576
2664
|
return !!n;
|
|
2577
2665
|
}
|
|
2578
|
-
function
|
|
2666
|
+
function Ie(n) {
|
|
2579
2667
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2580
2668
|
}
|
|
2581
|
-
function
|
|
2669
|
+
function bn(n) {
|
|
2582
2670
|
const t = [], e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (i) => (e.has(i) || (t.push(i), e.set(i, { status: "running" }), s.set(i, /* @__PURE__ */ new Map())), e.get(i));
|
|
2583
2671
|
for (const i of n)
|
|
2584
2672
|
switch (i.kind) {
|
|
2585
2673
|
case "agentStart": {
|
|
2586
|
-
const
|
|
2587
|
-
i.description && !
|
|
2674
|
+
const a = r(i.toolUseId);
|
|
2675
|
+
i.description && !a.description && (a.description = i.description);
|
|
2588
2676
|
break;
|
|
2589
2677
|
}
|
|
2590
2678
|
case "subagentStart": {
|
|
2591
|
-
const
|
|
2592
|
-
|
|
2679
|
+
const a = r(i.parentToolUseId);
|
|
2680
|
+
a.agentId = i.agentId ?? a.agentId, a.subagentType = i.subagentType ?? a.subagentType, a.description = i.description ?? a.description, Ie(a);
|
|
2593
2681
|
break;
|
|
2594
2682
|
}
|
|
2595
2683
|
case "toolStart": {
|
|
2596
|
-
|
|
2684
|
+
Ie(r(i.parentToolUseId)), s.get(i.parentToolUseId).set(i.toolUseId, {
|
|
2597
2685
|
toolsetName: i.toolsetName,
|
|
2598
2686
|
toolName: i.toolName,
|
|
2599
2687
|
parameter: i.parameter ?? {},
|
|
@@ -2603,13 +2691,13 @@ function gn(n) {
|
|
|
2603
2691
|
break;
|
|
2604
2692
|
}
|
|
2605
2693
|
case "toolComplete": {
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2694
|
+
const a = s.get(i.parentToolUseId)?.get(i.toolUseId);
|
|
2695
|
+
a && (a.status = i.isError ? "error" : "completed");
|
|
2608
2696
|
break;
|
|
2609
2697
|
}
|
|
2610
2698
|
case "subagentComplete": {
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2699
|
+
const a = r(i.parentToolUseId);
|
|
2700
|
+
a.status = i.status, a.summary = i.summary;
|
|
2613
2701
|
break;
|
|
2614
2702
|
}
|
|
2615
2703
|
}
|
|
@@ -2619,17 +2707,17 @@ function gn(n) {
|
|
|
2619
2707
|
tools: Array.from(s.get(i).values())
|
|
2620
2708
|
}));
|
|
2621
2709
|
}
|
|
2622
|
-
function
|
|
2710
|
+
function vn(n) {
|
|
2623
2711
|
return typeof n == "string" ? n : void 0;
|
|
2624
2712
|
}
|
|
2625
|
-
function
|
|
2713
|
+
function Sn(n) {
|
|
2626
2714
|
const t = [];
|
|
2627
2715
|
for (const e of n) {
|
|
2628
|
-
if (e.type === "tool-call" &&
|
|
2716
|
+
if (e.type === "tool-call" && gn(e)) {
|
|
2629
2717
|
t.push({
|
|
2630
2718
|
kind: "agentStart",
|
|
2631
2719
|
toolUseId: e.toolUseId ?? e.messageId,
|
|
2632
|
-
description:
|
|
2720
|
+
description: vn(e.parameter.description)
|
|
2633
2721
|
});
|
|
2634
2722
|
continue;
|
|
2635
2723
|
}
|
|
@@ -2670,37 +2758,37 @@ function vn(n) {
|
|
|
2670
2758
|
}
|
|
2671
2759
|
return t;
|
|
2672
2760
|
}
|
|
2673
|
-
function
|
|
2761
|
+
function yn(n) {
|
|
2674
2762
|
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2675
|
-
(e) => e.type === "tool-call" && e.isComplete &&
|
|
2763
|
+
(e) => e.type === "tool-call" && e.isComplete && fn(e)
|
|
2676
2764
|
);
|
|
2677
|
-
return
|
|
2765
|
+
return pn(t);
|
|
2678
2766
|
}
|
|
2679
|
-
function
|
|
2680
|
-
return
|
|
2767
|
+
function wn(n) {
|
|
2768
|
+
return bn(Sn(Array.from(n.messages?.values() ?? [])));
|
|
2681
2769
|
}
|
|
2682
|
-
function
|
|
2770
|
+
function En(n, t) {
|
|
2683
2771
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2684
2772
|
const r = t[s];
|
|
2685
2773
|
return e.id === r.id && e.status === r.status && e.subject === r.subject && e.activeForm === r.activeForm && e.description === r.description;
|
|
2686
2774
|
});
|
|
2687
2775
|
}
|
|
2688
|
-
function
|
|
2776
|
+
function In(n, t) {
|
|
2689
2777
|
return n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2690
2778
|
const r = t[s];
|
|
2691
2779
|
return e.toolName === r.toolName && e.toolsetName === r.toolsetName && e.status === r.status && e.reason === r.reason;
|
|
2692
2780
|
});
|
|
2693
2781
|
}
|
|
2694
|
-
function
|
|
2782
|
+
function Tn(n, t) {
|
|
2695
2783
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2696
2784
|
const r = t[s];
|
|
2697
|
-
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary &&
|
|
2785
|
+
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary && In(e.tools, r.tools);
|
|
2698
2786
|
});
|
|
2699
2787
|
}
|
|
2700
|
-
function
|
|
2701
|
-
const t = new A([]), e = new A([]), s = new
|
|
2702
|
-
return s.add(n.pipe(Y(
|
|
2703
|
-
n.pipe(Y(
|
|
2788
|
+
function Cn(n) {
|
|
2789
|
+
const t = new A([]), e = new A([]), s = new L();
|
|
2790
|
+
return s.add(n.pipe(Y(yn), M(En)).subscribe(t)), s.add(
|
|
2791
|
+
n.pipe(Y(wn), M(Tn)).subscribe(e)
|
|
2704
2792
|
), {
|
|
2705
2793
|
tasks$: t.asObservable(),
|
|
2706
2794
|
subagents$: e.asObservable(),
|
|
@@ -2709,15 +2797,15 @@ function Tn(n) {
|
|
|
2709
2797
|
teardown: () => s.unsubscribe()
|
|
2710
2798
|
};
|
|
2711
2799
|
}
|
|
2712
|
-
function
|
|
2800
|
+
function Te(n) {
|
|
2713
2801
|
const t = /* @__PURE__ */ new Map();
|
|
2714
2802
|
for (const e of n) t.set(e.sandboxName, e);
|
|
2715
2803
|
return [...t.values()].sort(
|
|
2716
2804
|
(e, s) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(s.sandboxBlueprintName || s.sandboxName)
|
|
2717
2805
|
);
|
|
2718
2806
|
}
|
|
2719
|
-
const ee = { kind: null, stopPhase: "idle" },
|
|
2720
|
-
function
|
|
2807
|
+
const ee = { kind: null, stopPhase: "idle" }, xn = 1e4;
|
|
2808
|
+
function An(n, t) {
|
|
2721
2809
|
return n.kind === t.kind && n.stopPhase === t.stopPhase && n.requestId === t.requestId;
|
|
2722
2810
|
}
|
|
2723
2811
|
class G {
|
|
@@ -2781,8 +2869,8 @@ class G {
|
|
|
2781
2869
|
if (!t.customChannelId)
|
|
2782
2870
|
throw new Error("customChannelId must be required");
|
|
2783
2871
|
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new A(!1), this.runStatusSubject = new A(ee), this.conversation$ = new A(t.conversation), this.channelTitleSubject = new A(t.channelTitle ?? null), this.promptSuggestionSubject = new A(null), this.sandboxPhaseSubject = new A("idle"), this.launchedSandboxesSubject = new A(
|
|
2784
|
-
|
|
2785
|
-
), this.derivedStores =
|
|
2872
|
+
Te(t.launchedSandboxes ?? [])
|
|
2873
|
+
), this.derivedStores = Cn(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(An)), this.statesObserver = t.statesObserver;
|
|
2786
2874
|
}
|
|
2787
2875
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2788
2876
|
getTasks() {
|
|
@@ -2830,7 +2918,7 @@ class G {
|
|
|
2830
2918
|
* launch whose name now appears (promoted to live). metadata (heartbeat-backed) is the sole authority.
|
|
2831
2919
|
*/
|
|
2832
2920
|
applyLaunchedSandboxes(t) {
|
|
2833
|
-
const e =
|
|
2921
|
+
const e = Te(t);
|
|
2834
2922
|
this.pendingLaunches = this.pendingLaunches.filter((s) => !e.some((r) => r.sandboxName === s)), this.launchedSandboxesSubject.next(e);
|
|
2835
2923
|
}
|
|
2836
2924
|
/**
|
|
@@ -2879,8 +2967,8 @@ class G {
|
|
|
2879
2967
|
const i = new G(t);
|
|
2880
2968
|
try {
|
|
2881
2969
|
return i.subscribe(), r?.(i), await i.openChannel(e, s), i;
|
|
2882
|
-
} catch (
|
|
2883
|
-
throw i.close(),
|
|
2970
|
+
} catch (a) {
|
|
2971
|
+
throw i.close(), a;
|
|
2884
2972
|
}
|
|
2885
2973
|
}
|
|
2886
2974
|
/**
|
|
@@ -2924,7 +3012,7 @@ class G {
|
|
|
2924
3012
|
}
|
|
2925
3013
|
}
|
|
2926
3014
|
subscribe() {
|
|
2927
|
-
this.statesSubscription =
|
|
3015
|
+
this.statesSubscription = Xt([
|
|
2928
3016
|
this.isConnecting$,
|
|
2929
3017
|
this.conversation$,
|
|
2930
3018
|
this.derivedStores.tasks$,
|
|
@@ -2942,20 +3030,20 @@ class G {
|
|
|
2942
3030
|
s,
|
|
2943
3031
|
r,
|
|
2944
3032
|
i,
|
|
2945
|
-
o,
|
|
2946
3033
|
a,
|
|
2947
|
-
|
|
2948
|
-
c
|
|
3034
|
+
o,
|
|
3035
|
+
c,
|
|
3036
|
+
u
|
|
2949
3037
|
]) => ({
|
|
2950
3038
|
isConnecting: t,
|
|
2951
3039
|
conversation: e,
|
|
2952
3040
|
tasks: s,
|
|
2953
3041
|
subagents: r,
|
|
2954
3042
|
channelTitle: i,
|
|
2955
|
-
promptSuggestion:
|
|
2956
|
-
sandboxPhase:
|
|
2957
|
-
launchedSandboxes:
|
|
2958
|
-
runStatus:
|
|
3043
|
+
promptSuggestion: a,
|
|
3044
|
+
sandboxPhase: o,
|
|
3045
|
+
launchedSandboxes: c,
|
|
3046
|
+
runStatus: u
|
|
2959
3047
|
})
|
|
2960
3048
|
)
|
|
2961
3049
|
).subscribe(this.statesObserver);
|
|
@@ -2981,14 +3069,14 @@ class G {
|
|
|
2981
3069
|
*/
|
|
2982
3070
|
updateSandboxPhase(t) {
|
|
2983
3071
|
switch (t) {
|
|
2984
|
-
case
|
|
3072
|
+
case l.SANDBOX_LAUNCH:
|
|
2985
3073
|
this.sandboxPhaseSubject.next("launching");
|
|
2986
3074
|
break;
|
|
2987
|
-
case
|
|
3075
|
+
case l.SANDBOX_READY:
|
|
2988
3076
|
this.sandboxPhaseSubject.next("ready");
|
|
2989
3077
|
break;
|
|
2990
|
-
case
|
|
2991
|
-
case
|
|
3078
|
+
case l.INIT:
|
|
3079
|
+
case l.ERROR:
|
|
2992
3080
|
this.sandboxPhaseSubject.next("idle");
|
|
2993
3081
|
break;
|
|
2994
3082
|
}
|
|
@@ -3002,17 +3090,21 @@ class G {
|
|
|
3002
3090
|
return {
|
|
3003
3091
|
onSseStart: t?.onSseStart,
|
|
3004
3092
|
onSseMessage: (r) => {
|
|
3005
|
-
if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType ===
|
|
3093
|
+
if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType === l.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
3006
3094
|
r.fact.channelTitleUpdate.title
|
|
3007
|
-
), r.eventType ===
|
|
3095
|
+
), r.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
|
|
3008
3096
|
r.fact.promptSuggestion.suggestion
|
|
3009
|
-
) : r.eventType ===
|
|
3010
|
-
const i = new Map(this.conversation$.value.messages),
|
|
3011
|
-
|
|
3012
|
-
...
|
|
3097
|
+
) : 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) {
|
|
3098
|
+
const i = new Map(this.conversation$.value.messages), a = i.get(this.currentUserMessageId);
|
|
3099
|
+
a && a.type === "user" && (i.set(this.currentUserMessageId, {
|
|
3100
|
+
...a,
|
|
3013
3101
|
traceId: r.traceId
|
|
3014
3102
|
}), this.conversation$.next(
|
|
3015
|
-
new g({
|
|
3103
|
+
new g({
|
|
3104
|
+
messages: i,
|
|
3105
|
+
pendingConsent: this.conversation$.value.pendingConsent,
|
|
3106
|
+
pendingFeedback: this.conversation$.value.pendingFeedback
|
|
3107
|
+
})
|
|
3016
3108
|
)), this.currentUserMessageId = void 0;
|
|
3017
3109
|
}
|
|
3018
3110
|
this.conversation$.next(this.conversation$.value.onMessage(r));
|
|
@@ -3074,7 +3166,7 @@ class G {
|
|
|
3074
3166
|
return this.fetchSse(
|
|
3075
3167
|
"reset",
|
|
3076
3168
|
{
|
|
3077
|
-
action:
|
|
3169
|
+
action: H.NONE,
|
|
3078
3170
|
customChannelId: this.customChannelId,
|
|
3079
3171
|
customMessageId: this.customMessageId,
|
|
3080
3172
|
text: t?.text || "",
|
|
@@ -3089,11 +3181,11 @@ class G {
|
|
|
3089
3181
|
const r = this.conversation$.value.pendingConsent;
|
|
3090
3182
|
if (r) return Promise.reject(new ne(r.processId));
|
|
3091
3183
|
this.clearPromptSuggestion();
|
|
3092
|
-
const i = t.text.trim(),
|
|
3093
|
-
return this.currentUserMessageId =
|
|
3184
|
+
const i = t.text.trim(), a = t.customMessageId ?? Ye();
|
|
3185
|
+
return this.currentUserMessageId = a, this.lastSentMessageId = a, this.conversation$.next(
|
|
3094
3186
|
this.conversation$.value.pushMessage({
|
|
3095
3187
|
type: "user",
|
|
3096
|
-
messageId:
|
|
3188
|
+
messageId: a,
|
|
3097
3189
|
text: i,
|
|
3098
3190
|
blobIds: t.blobIds,
|
|
3099
3191
|
filePreviewUrls: t.filePreviewUrls,
|
|
@@ -3103,9 +3195,9 @@ class G {
|
|
|
3103
3195
|
), this.fetchSse(
|
|
3104
3196
|
"user",
|
|
3105
3197
|
{
|
|
3106
|
-
action:
|
|
3198
|
+
action: H.NONE,
|
|
3107
3199
|
customChannelId: this.customChannelId,
|
|
3108
|
-
customMessageId:
|
|
3200
|
+
customMessageId: a,
|
|
3109
3201
|
payload: this.resolvePayload(t?.payload),
|
|
3110
3202
|
text: i,
|
|
3111
3203
|
blobIds: t?.blobIds
|
|
@@ -3113,12 +3205,41 @@ class G {
|
|
|
3113
3205
|
e
|
|
3114
3206
|
);
|
|
3115
3207
|
}
|
|
3208
|
+
/**
|
|
3209
|
+
* Rate one assistant reply Good or Bad (F-033 / UC-055, UC-056, UC-059). Posts the verdict, and only
|
|
3210
|
+
* once the server has accepted it writes the rating into that reply's `feedback` — the SDK holds no
|
|
3211
|
+
* open stream between runs, so the live `asgard.message.feedback` echo of its own post would never
|
|
3212
|
+
* arrive; the next rejoin replays it from the transcript instead. A rejection leaves the conversation
|
|
3213
|
+
* untouched (no optimistic update, UC-059 Alt B), so the caller can show the error and let the user try
|
|
3214
|
+
* again with the same comment.
|
|
3215
|
+
*
|
|
3216
|
+
* Rating is **not** telling the agent: when the user also wants that, the caller sends an ordinary
|
|
3217
|
+
* message composed by `composeFeedbackMessage()` through `sendMessage` after this resolves (UC-057).
|
|
3218
|
+
*/
|
|
3219
|
+
async sendMessageFeedback(t, e) {
|
|
3220
|
+
if (!this.client.sendMessageFeedback)
|
|
3221
|
+
throw new Error(
|
|
3222
|
+
"This client cannot rate a reply: IAsgardServiceClient.sendMessageFeedback is not implemented. Implement it (POST {base}/message/feedback) or use AsgardServiceClient."
|
|
3223
|
+
);
|
|
3224
|
+
const s = await this.client.sendMessageFeedback({
|
|
3225
|
+
customChannelId: this.customChannelId,
|
|
3226
|
+
messageId: t,
|
|
3227
|
+
verdict: e.verdict,
|
|
3228
|
+
comment: e.comment
|
|
3229
|
+
}), r = e.comment?.trim();
|
|
3230
|
+
return this.conversation$.next(
|
|
3231
|
+
this.conversation$.value.applyFeedback(t, {
|
|
3232
|
+
verdict: e.verdict,
|
|
3233
|
+
...r ? { comment: r } : {}
|
|
3234
|
+
})
|
|
3235
|
+
), s;
|
|
3236
|
+
}
|
|
3116
3237
|
replyToolCallConsents(t, e, s) {
|
|
3117
3238
|
const r = this.conversation$.value.pendingConsent;
|
|
3118
3239
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
3119
3240
|
"user",
|
|
3120
3241
|
{
|
|
3121
|
-
action:
|
|
3242
|
+
action: H.RESPONSE_TOOL_CALL_CONSENT,
|
|
3122
3243
|
customChannelId: this.customChannelId,
|
|
3123
3244
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
3124
3245
|
payload: this.resolvePayload(s),
|
|
@@ -3157,7 +3278,7 @@ class G {
|
|
|
3157
3278
|
return r ? Promise.reject(new ne(r.processId)) : this.fetchSse(
|
|
3158
3279
|
"nudge",
|
|
3159
3280
|
{
|
|
3160
|
-
action:
|
|
3281
|
+
action: H.NUDGE,
|
|
3161
3282
|
customChannelId: this.customChannelId,
|
|
3162
3283
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
3163
3284
|
payload: this.resolvePayload(e),
|
|
@@ -3223,7 +3344,7 @@ class G {
|
|
|
3223
3344
|
this.forceStopTimer = void 0;
|
|
3224
3345
|
const t = this.runStatusSubject.value;
|
|
3225
3346
|
t.stopPhase === "stopping" && this.runStatusSubject.next({ ...t, stopPhase: "force-stoppable" });
|
|
3226
|
-
},
|
|
3347
|
+
}, xn);
|
|
3227
3348
|
}
|
|
3228
3349
|
/**
|
|
3229
3350
|
* Cut the local SSE connection without telling the backend. This is *not* stop-generation (see
|
|
@@ -3240,7 +3361,20 @@ class G {
|
|
|
3240
3361
|
this.currentRun?.unsubscribe(), this.currentRun = void 0, this.clearForceStopTimer(), this.isConnecting$.complete(), this.runStatusSubject.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.launchedSandboxesSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
3241
3362
|
}
|
|
3242
3363
|
}
|
|
3243
|
-
|
|
3364
|
+
const On = {
|
|
3365
|
+
GOOD: "[Response Feedback: Good]",
|
|
3366
|
+
BAD: "[Response Feedback: Bad]"
|
|
3367
|
+
}, Ln = 8 * 1024;
|
|
3368
|
+
function Nn(n) {
|
|
3369
|
+
return new TextEncoder().encode(n).length;
|
|
3370
|
+
}
|
|
3371
|
+
function Rn(n, t) {
|
|
3372
|
+
const e = On[n], s = t?.trim() ?? "";
|
|
3373
|
+
return s ? `${e}
|
|
3374
|
+
|
|
3375
|
+
${s}` : e;
|
|
3376
|
+
}
|
|
3377
|
+
function Fn(n) {
|
|
3244
3378
|
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
3245
3379
|
if (!t) return null;
|
|
3246
3380
|
const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
|
|
@@ -3252,36 +3386,40 @@ function Un(n) {
|
|
|
3252
3386
|
return null;
|
|
3253
3387
|
}
|
|
3254
3388
|
export {
|
|
3255
|
-
|
|
3256
|
-
|
|
3389
|
+
Mn as AsgardServiceClient,
|
|
3390
|
+
Un as AsgardSourceSetClient,
|
|
3257
3391
|
G as Channel,
|
|
3258
3392
|
ne as ChannelAwaitingConsentError,
|
|
3259
3393
|
te as ChannelBusyError,
|
|
3260
3394
|
g as Conversation,
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3395
|
+
l as EventType,
|
|
3396
|
+
Ln as FEEDBACK_COMMENT_MAX_BYTES,
|
|
3397
|
+
H as FetchSseAction,
|
|
3398
|
+
y as HttpError,
|
|
3399
|
+
Ce as MessageTemplateType,
|
|
3400
|
+
On as RESPONSE_FEEDBACK_PREFIX,
|
|
3401
|
+
an as SOURCE_SET_DEFAULT_MAX_ENTRIES,
|
|
3402
|
+
Xe as SOURCE_SET_MAX_PAGE_SIZE,
|
|
3403
|
+
sn as SOURCE_SET_VOLUME_ROOT,
|
|
3404
|
+
ze as ToolCallConsentResult,
|
|
3269
3405
|
C as assertVolumePath,
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3406
|
+
Rn as composeFeedbackMessage,
|
|
3407
|
+
Sn as conversationToSubagentEvents,
|
|
3408
|
+
Cn as createDerivedStores,
|
|
3409
|
+
wn as deriveSubagents,
|
|
3410
|
+
yn as deriveTasks,
|
|
3411
|
+
Nn as feedbackCommentByteLength,
|
|
3412
|
+
gn as isAgentTool,
|
|
3413
|
+
_n as isChannelAwaitingConsentError,
|
|
3414
|
+
Pn as isChannelBusyError,
|
|
3415
|
+
kn as isHttpError,
|
|
3278
3416
|
mn as isSubagentChildTool,
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3417
|
+
fn as isTaskTool,
|
|
3418
|
+
Te as reconcileLaunched,
|
|
3419
|
+
bn as reduceSubagents,
|
|
3420
|
+
pn as reduceTaskEvents,
|
|
3421
|
+
Fn as resolveSandboxUri,
|
|
3422
|
+
Tn as subagentsEqual,
|
|
3423
|
+
En as tasksEqual
|
|
3286
3424
|
};
|
|
3287
3425
|
//# sourceMappingURL=index.mjs.map
|