page-agent-sdk 3.22.1 → 3.23.1
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 +7 -6
- package/README.zh-CN.md +7 -6
- package/dist/page-agent-sdk.headless.js +1053 -775
- package/dist/page-agent-sdk.iife.js +148 -146
- package/dist/page-agent-sdk.js +1515 -1217
- package/dist/page-agent-sdk.umd.cjs +49 -47
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/types/headless.d.ts +8 -6
- package/types/index.d.ts +81 -4
|
@@ -172,39 +172,39 @@ var S = () => {}, C = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110
|
|
|
172
172
|
}, D = Object.prototype.hasOwnProperty, O = (e, t) => D.call(e, t), k = Array.isArray, A = (e) => re(e) === "[object Map]", ee = (e) => re(e) === "[object Set]", j = (e) => typeof e == "function", M = (e) => typeof e == "string", te = (e) => typeof e == "symbol", N = (e) => typeof e == "object" && !!e, P = (e) => (N(e) || j(e)) && j(e.then) && j(e.catch), ne = Object.prototype.toString, re = (e) => ne.call(e), ie = (e) => re(e).slice(8, -1), F = (e) => re(e) === "[object Object]", I = (e) => M(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, L = ((e) => {
|
|
173
173
|
let t = /* @__PURE__ */ Object.create(null);
|
|
174
174
|
return ((n) => t[n] || (t[n] = e(n)));
|
|
175
|
-
})((e) => e.charAt(0).toUpperCase() + e.slice(1)),
|
|
175
|
+
})((e) => e.charAt(0).toUpperCase() + e.slice(1)), ae = (e, t) => !Object.is(e, t), oe = (e, t, n, r = !1) => {
|
|
176
176
|
Object.defineProperty(e, t, {
|
|
177
177
|
configurable: !0,
|
|
178
178
|
enumerable: !1,
|
|
179
179
|
writable: r,
|
|
180
180
|
value: n
|
|
181
181
|
});
|
|
182
|
-
},
|
|
183
|
-
function
|
|
182
|
+
}, se, ce = () => se ||= typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {};
|
|
183
|
+
function le(e) {
|
|
184
184
|
if (k(e)) {
|
|
185
185
|
let t = {};
|
|
186
186
|
for (let n = 0; n < e.length; n++) {
|
|
187
|
-
let r = e[n], i = M(r) ?
|
|
187
|
+
let r = e[n], i = M(r) ? fe(r) : le(r);
|
|
188
188
|
if (i) for (let e in i) t[e] = i[e];
|
|
189
189
|
}
|
|
190
190
|
return t;
|
|
191
191
|
} else if (M(e) || N(e)) return e;
|
|
192
192
|
}
|
|
193
|
-
var
|
|
194
|
-
function
|
|
193
|
+
var ue = /;(?![^(]*\))/g, de = /:([^]+)/, R = /\/\*[^]*?\*\//g;
|
|
194
|
+
function fe(e) {
|
|
195
195
|
let t = {};
|
|
196
|
-
return e.replace(
|
|
196
|
+
return e.replace(R, "").split(ue).forEach((e) => {
|
|
197
197
|
if (e) {
|
|
198
|
-
let n = e.split(
|
|
198
|
+
let n = e.split(de);
|
|
199
199
|
n.length > 1 && (t[n[0].trim()] = n[1].trim());
|
|
200
200
|
}
|
|
201
201
|
}), t;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function z(e) {
|
|
204
204
|
let t = "";
|
|
205
205
|
if (M(e)) t = e;
|
|
206
206
|
else if (k(e)) for (let n = 0; n < e.length; n++) {
|
|
207
|
-
let r =
|
|
207
|
+
let r = z(e[n]);
|
|
208
208
|
r && (t += r + " ");
|
|
209
209
|
}
|
|
210
210
|
else if (N(e)) for (let n in e) e[n] && (t += n + " ");
|
|
@@ -212,76 +212,76 @@ function B(e) {
|
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
|
214
214
|
//#region node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
215
|
-
function
|
|
215
|
+
function B(e, ...t) {
|
|
216
216
|
console.warn(`[Vue warn] ${e}`, ...t);
|
|
217
217
|
}
|
|
218
|
-
var
|
|
219
|
-
function
|
|
220
|
-
return
|
|
218
|
+
var pe;
|
|
219
|
+
function me() {
|
|
220
|
+
return pe;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
222
|
+
var V, he = /* @__PURE__ */ new WeakSet(), ge = class {
|
|
223
223
|
constructor(e) {
|
|
224
|
-
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0,
|
|
224
|
+
this.fn = e, this.deps = void 0, this.depsTail = void 0, this.flags = 5, this.next = void 0, this.cleanup = void 0, this.scheduler = void 0, pe && (pe.active ? pe.effects.push(this) : this.flags &= -2);
|
|
225
225
|
}
|
|
226
226
|
pause() {
|
|
227
227
|
this.flags |= 64;
|
|
228
228
|
}
|
|
229
229
|
resume() {
|
|
230
|
-
this.flags & 64 && (this.flags &= -65,
|
|
230
|
+
this.flags & 64 && (this.flags &= -65, he.has(this) && (he.delete(this), this.trigger()));
|
|
231
231
|
}
|
|
232
232
|
notify() {
|
|
233
|
-
this.flags & 2 && !(this.flags & 32) || this.flags & 8 ||
|
|
233
|
+
this.flags & 2 && !(this.flags & 32) || this.flags & 8 || H(this);
|
|
234
234
|
}
|
|
235
235
|
run() {
|
|
236
236
|
if (!(this.flags & 1)) return this.fn();
|
|
237
|
-
this.flags |= 2,
|
|
238
|
-
let e =
|
|
239
|
-
|
|
237
|
+
this.flags |= 2, Ae(this), Se(this);
|
|
238
|
+
let e = V, t = W;
|
|
239
|
+
V = this, W = !0;
|
|
240
240
|
try {
|
|
241
241
|
return this.fn();
|
|
242
242
|
} finally {
|
|
243
|
-
process.env.NODE_ENV !== "production" &&
|
|
243
|
+
process.env.NODE_ENV !== "production" && V !== this && B("Active effect was not restored correctly - this is likely a Vue internal bug."), Ce(this), V = e, W = t, this.flags &= -3;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
stop() {
|
|
247
247
|
if (this.flags & 1) {
|
|
248
|
-
for (let e = this.deps; e; e = e.nextDep)
|
|
249
|
-
this.deps = this.depsTail = void 0,
|
|
248
|
+
for (let e = this.deps; e; e = e.nextDep) Ee(e);
|
|
249
|
+
this.deps = this.depsTail = void 0, Ae(this), this.onStop && this.onStop(), this.flags &= -2;
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
trigger() {
|
|
253
|
-
this.flags & 64 ?
|
|
253
|
+
this.flags & 64 ? he.add(this) : this.scheduler ? this.scheduler() : this.runIfDirty();
|
|
254
254
|
}
|
|
255
255
|
runIfDirty() {
|
|
256
|
-
|
|
256
|
+
we(this) && this.run();
|
|
257
257
|
}
|
|
258
258
|
get dirty() {
|
|
259
|
-
return
|
|
259
|
+
return we(this);
|
|
260
260
|
}
|
|
261
|
-
},
|
|
262
|
-
function
|
|
261
|
+
}, _e = 0, ve, ye;
|
|
262
|
+
function H(e, t = !1) {
|
|
263
263
|
if (e.flags |= 8, t) {
|
|
264
|
-
e.next =
|
|
264
|
+
e.next = ye, ye = e;
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
|
-
e.next =
|
|
268
|
-
}
|
|
269
|
-
function ye() {
|
|
270
|
-
ge++;
|
|
267
|
+
e.next = ve, ve = e;
|
|
271
268
|
}
|
|
272
269
|
function be() {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
270
|
+
_e++;
|
|
271
|
+
}
|
|
272
|
+
function xe() {
|
|
273
|
+
if (--_e > 0) return;
|
|
274
|
+
if (ye) {
|
|
275
|
+
let e = ye;
|
|
276
|
+
for (ye = void 0; e;) {
|
|
277
277
|
let t = e.next;
|
|
278
278
|
e.next = void 0, e.flags &= -9, e = t;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
let e;
|
|
282
|
-
for (;
|
|
283
|
-
let t =
|
|
284
|
-
for (
|
|
282
|
+
for (; ve;) {
|
|
283
|
+
let t = ve;
|
|
284
|
+
for (ve = void 0; t;) {
|
|
285
285
|
let n = t.next;
|
|
286
286
|
if (t.next = void 0, t.flags &= -9, t.flags & 1) try {
|
|
287
287
|
t.trigger();
|
|
@@ -293,127 +293,127 @@ function be() {
|
|
|
293
293
|
}
|
|
294
294
|
if (e) throw e;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Se(e) {
|
|
297
297
|
for (let t = e.deps; t; t = t.nextDep) t.version = -1, t.prevActiveLink = t.dep.activeLink, t.dep.activeLink = t;
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function Ce(e) {
|
|
300
300
|
let t, n = e.depsTail, r = n;
|
|
301
301
|
for (; r;) {
|
|
302
302
|
let e = r.prevDep;
|
|
303
|
-
r.version === -1 ? (r === n && (n = e),
|
|
303
|
+
r.version === -1 ? (r === n && (n = e), Ee(r), U(r)) : t = r, r.dep.activeLink = r.prevActiveLink, r.prevActiveLink = void 0, r = e;
|
|
304
304
|
}
|
|
305
305
|
e.deps = t, e.depsTail = n;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
308
|
-
for (let t = e.deps; t; t = t.nextDep) if (t.dep.version !== t.version || t.dep.computed && (
|
|
307
|
+
function we(e) {
|
|
308
|
+
for (let t = e.deps; t; t = t.nextDep) if (t.dep.version !== t.version || t.dep.computed && (Te(t.dep.computed) || t.dep.version !== t.version)) return !0;
|
|
309
309
|
return !!e._dirty;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
if (e.flags & 4 && !(e.flags & 16) || (e.flags &= -17, e.globalVersion ===
|
|
311
|
+
function Te(e) {
|
|
312
|
+
if (e.flags & 4 && !(e.flags & 16) || (e.flags &= -17, e.globalVersion === je) || (e.globalVersion = je, !e.isSSR && e.flags & 128 && (!e.deps && !e._dirty || !we(e)))) return;
|
|
313
313
|
e.flags |= 2;
|
|
314
|
-
let t = e.dep, n =
|
|
315
|
-
|
|
314
|
+
let t = e.dep, n = V, r = W;
|
|
315
|
+
V = e, W = !0;
|
|
316
316
|
try {
|
|
317
|
-
|
|
317
|
+
Se(e);
|
|
318
318
|
let n = e.fn(e._value);
|
|
319
|
-
(t.version === 0 ||
|
|
319
|
+
(t.version === 0 || ae(n, e._value)) && (e.flags |= 128, e._value = n, t.version++);
|
|
320
320
|
} catch (e) {
|
|
321
321
|
throw t.version++, e;
|
|
322
322
|
} finally {
|
|
323
|
-
|
|
323
|
+
V = n, W = r, Ce(e), e.flags &= -3;
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Ee(e, t = !1) {
|
|
327
327
|
let { dep: n, prevSub: r, nextSub: i } = e;
|
|
328
328
|
if (r && (r.nextSub = i, e.prevSub = void 0), i && (i.prevSub = r, e.nextSub = void 0), process.env.NODE_ENV !== "production" && n.subsHead === e && (n.subsHead = i), n.subs === e && (n.subs = r, !r && n.computed)) {
|
|
329
329
|
n.computed.flags &= -5;
|
|
330
|
-
for (let e = n.computed.deps; e; e = e.nextDep)
|
|
330
|
+
for (let e = n.computed.deps; e; e = e.nextDep) Ee(e, !0);
|
|
331
331
|
}
|
|
332
332
|
!t && !--n.sc && n.map && n.map.delete(n.key);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function U(e) {
|
|
335
335
|
let { prevDep: t, nextDep: n } = e;
|
|
336
336
|
t && (t.nextDep = n, e.prevDep = void 0), n && (n.prevDep = t, e.nextDep = void 0);
|
|
337
337
|
}
|
|
338
|
-
var
|
|
339
|
-
function De() {
|
|
340
|
-
Ee.push(G), G = !1;
|
|
341
|
-
}
|
|
338
|
+
var W = !0, De = [];
|
|
342
339
|
function Oe() {
|
|
343
|
-
|
|
344
|
-
|
|
340
|
+
De.push(W), W = !1;
|
|
341
|
+
}
|
|
342
|
+
function ke() {
|
|
343
|
+
let e = De.pop();
|
|
344
|
+
W = e === void 0 || e;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Ae(e) {
|
|
347
347
|
let { cleanup: t } = e;
|
|
348
348
|
if (e.cleanup = void 0, t) {
|
|
349
|
-
let e =
|
|
350
|
-
|
|
349
|
+
let e = V;
|
|
350
|
+
V = void 0;
|
|
351
351
|
try {
|
|
352
352
|
t();
|
|
353
353
|
} finally {
|
|
354
|
-
|
|
354
|
+
V = e;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
var
|
|
358
|
+
var je = 0, Me = class {
|
|
359
359
|
constructor(e, t) {
|
|
360
360
|
this.sub = e, this.dep = t, this.version = t.version, this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
361
361
|
}
|
|
362
|
-
},
|
|
362
|
+
}, Ne = class {
|
|
363
363
|
constructor(e) {
|
|
364
364
|
this.computed = e, this.version = 0, this.activeLink = void 0, this.subs = void 0, this.map = void 0, this.key = void 0, this.sc = 0, this.__v_skip = !0, process.env.NODE_ENV !== "production" && (this.subsHead = void 0);
|
|
365
365
|
}
|
|
366
366
|
track(e) {
|
|
367
|
-
if (!
|
|
367
|
+
if (!V || !W || V === this.computed) return;
|
|
368
368
|
let t = this.activeLink;
|
|
369
|
-
if (t === void 0 || t.sub !==
|
|
369
|
+
if (t === void 0 || t.sub !== V) t = this.activeLink = new Me(V, this), V.deps ? (t.prevDep = V.depsTail, V.depsTail.nextDep = t, V.depsTail = t) : V.deps = V.depsTail = t, Pe(t);
|
|
370
370
|
else if (t.version === -1 && (t.version = this.version, t.nextDep)) {
|
|
371
371
|
let e = t.nextDep;
|
|
372
|
-
e.prevDep = t.prevDep, t.prevDep && (t.prevDep.nextDep = e), t.prevDep =
|
|
372
|
+
e.prevDep = t.prevDep, t.prevDep && (t.prevDep.nextDep = e), t.prevDep = V.depsTail, t.nextDep = void 0, V.depsTail.nextDep = t, V.depsTail = t, V.deps === t && (V.deps = e);
|
|
373
373
|
}
|
|
374
|
-
return process.env.NODE_ENV !== "production" &&
|
|
374
|
+
return process.env.NODE_ENV !== "production" && V.onTrack && V.onTrack(T({ effect: V }, e)), t;
|
|
375
375
|
}
|
|
376
376
|
trigger(e) {
|
|
377
|
-
this.version++,
|
|
377
|
+
this.version++, je++, this.notify(e);
|
|
378
378
|
}
|
|
379
379
|
notify(e) {
|
|
380
|
-
|
|
380
|
+
be();
|
|
381
381
|
try {
|
|
382
382
|
if (process.env.NODE_ENV !== "production") for (let t = this.subsHead; t; t = t.nextSub) t.sub.onTrigger && !(t.sub.flags & 8) && t.sub.onTrigger(T({ effect: t.sub }, e));
|
|
383
383
|
for (let e = this.subs; e; e = e.prevSub) e.sub.notify() && e.sub.dep.notify();
|
|
384
384
|
} finally {
|
|
385
|
-
|
|
385
|
+
xe();
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
|
-
function
|
|
389
|
+
function Pe(e) {
|
|
390
390
|
if (e.dep.sc++, e.sub.flags & 4) {
|
|
391
391
|
let t = e.dep.computed;
|
|
392
392
|
if (t && !e.dep.subs) {
|
|
393
393
|
t.flags |= 20;
|
|
394
|
-
for (let e = t.deps; e; e = e.nextDep)
|
|
394
|
+
for (let e = t.deps; e; e = e.nextDep) Pe(e);
|
|
395
395
|
}
|
|
396
396
|
let n = e.dep.subs;
|
|
397
397
|
n !== e && (e.prevSub = n, n && (n.nextSub = e)), process.env.NODE_ENV !== "production" && e.dep.subsHead === void 0 && (e.dep.subsHead = e), e.dep.subs = e;
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
|
-
var
|
|
401
|
-
function
|
|
402
|
-
if (
|
|
403
|
-
let r =
|
|
404
|
-
r ||
|
|
400
|
+
var Fe = /* @__PURE__ */ new WeakMap(), Ie = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Object iterate"), Le = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Map keys iterate"), Re = /* @__PURE__ */ Symbol(process.env.NODE_ENV === "production" ? "" : "Array iterate");
|
|
401
|
+
function ze(e, t, n) {
|
|
402
|
+
if (W && V) {
|
|
403
|
+
let r = Fe.get(e);
|
|
404
|
+
r || Fe.set(e, r = /* @__PURE__ */ new Map());
|
|
405
405
|
let i = r.get(n);
|
|
406
|
-
i || (r.set(n, i = new
|
|
406
|
+
i || (r.set(n, i = new Ne()), i.map = r, i.key = n), process.env.NODE_ENV === "production" ? i.track() : i.track({
|
|
407
407
|
target: e,
|
|
408
408
|
type: t,
|
|
409
409
|
key: n
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
let o =
|
|
413
|
+
function Be(e, t, n, r, i, a) {
|
|
414
|
+
let o = Fe.get(e);
|
|
415
415
|
if (!o) {
|
|
416
|
-
|
|
416
|
+
je++;
|
|
417
417
|
return;
|
|
418
418
|
}
|
|
419
419
|
let s = (o) => {
|
|
@@ -426,173 +426,173 @@ function Re(e, t, n, r, i, a) {
|
|
|
426
426
|
oldTarget: a
|
|
427
427
|
}));
|
|
428
428
|
};
|
|
429
|
-
if (
|
|
429
|
+
if (be(), t === "clear") o.forEach(s);
|
|
430
430
|
else {
|
|
431
431
|
let i = k(e), a = i && I(n);
|
|
432
432
|
if (i && n === "length") {
|
|
433
433
|
let e = Number(r);
|
|
434
434
|
o.forEach((t, n) => {
|
|
435
|
-
(n === "length" || n ===
|
|
435
|
+
(n === "length" || n === Re || !te(n) && n >= e) && s(t);
|
|
436
436
|
});
|
|
437
|
-
} else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(
|
|
437
|
+
} else switch ((n !== void 0 || o.has(void 0)) && s(o.get(n)), a && s(o.get(Re)), t) {
|
|
438
438
|
case "add":
|
|
439
|
-
i ? a && s(o.get("length")) : (s(o.get(
|
|
439
|
+
i ? a && s(o.get("length")) : (s(o.get(Ie)), A(e) && s(o.get(Le)));
|
|
440
440
|
break;
|
|
441
441
|
case "delete":
|
|
442
|
-
i || (s(o.get(
|
|
442
|
+
i || (s(o.get(Ie)), A(e) && s(o.get(Le)));
|
|
443
443
|
break;
|
|
444
444
|
case "set":
|
|
445
|
-
A(e) && s(o.get(
|
|
445
|
+
A(e) && s(o.get(Ie));
|
|
446
446
|
break;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
|
|
449
|
+
xe();
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
let t = /* @__PURE__ */
|
|
453
|
-
return t === e ? t : (
|
|
451
|
+
function Ve(e) {
|
|
452
|
+
let t = /* @__PURE__ */ q(e);
|
|
453
|
+
return t === e ? t : (ze(t, "iterate", Re), /* @__PURE__ */ K(e) ? t : t.map(Ot));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
return
|
|
455
|
+
function He(e) {
|
|
456
|
+
return ze(e = /* @__PURE__ */ q(e), "iterate", Re), e;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
return /* @__PURE__ */
|
|
458
|
+
function Ue(e, t) {
|
|
459
|
+
return /* @__PURE__ */ Tt(e) ? J(/* @__PURE__ */ wt(e) ? Ot(t) : t) : Ot(t);
|
|
460
460
|
}
|
|
461
|
-
var
|
|
461
|
+
var We = {
|
|
462
462
|
__proto__: null,
|
|
463
463
|
[Symbol.iterator]() {
|
|
464
|
-
return
|
|
464
|
+
return Ge(this, Symbol.iterator, (e) => Ue(this, e));
|
|
465
465
|
},
|
|
466
466
|
concat(...e) {
|
|
467
|
-
return
|
|
467
|
+
return Ve(this).concat(...e.map((e) => k(e) ? Ve(e) : e));
|
|
468
468
|
},
|
|
469
469
|
entries() {
|
|
470
|
-
return
|
|
470
|
+
return Ge(this, "entries", (e) => (e[1] = Ue(this, e[1]), e));
|
|
471
471
|
},
|
|
472
472
|
every(e, t) {
|
|
473
|
-
return
|
|
473
|
+
return qe(this, "every", e, t, void 0, arguments);
|
|
474
474
|
},
|
|
475
475
|
filter(e, t) {
|
|
476
|
-
return
|
|
476
|
+
return qe(this, "filter", e, t, (e) => e.map((e) => Ue(this, e)), arguments);
|
|
477
477
|
},
|
|
478
478
|
find(e, t) {
|
|
479
|
-
return
|
|
479
|
+
return qe(this, "find", e, t, (e) => Ue(this, e), arguments);
|
|
480
480
|
},
|
|
481
481
|
findIndex(e, t) {
|
|
482
|
-
return
|
|
482
|
+
return qe(this, "findIndex", e, t, void 0, arguments);
|
|
483
483
|
},
|
|
484
484
|
findLast(e, t) {
|
|
485
|
-
return
|
|
485
|
+
return qe(this, "findLast", e, t, (e) => Ue(this, e), arguments);
|
|
486
486
|
},
|
|
487
487
|
findLastIndex(e, t) {
|
|
488
|
-
return
|
|
488
|
+
return qe(this, "findLastIndex", e, t, void 0, arguments);
|
|
489
489
|
},
|
|
490
490
|
forEach(e, t) {
|
|
491
|
-
return
|
|
491
|
+
return qe(this, "forEach", e, t, void 0, arguments);
|
|
492
492
|
},
|
|
493
493
|
includes(...e) {
|
|
494
|
-
return
|
|
494
|
+
return Ye(this, "includes", e);
|
|
495
495
|
},
|
|
496
496
|
indexOf(...e) {
|
|
497
|
-
return
|
|
497
|
+
return Ye(this, "indexOf", e);
|
|
498
498
|
},
|
|
499
499
|
join(e) {
|
|
500
|
-
return
|
|
500
|
+
return Ve(this).join(e);
|
|
501
501
|
},
|
|
502
502
|
lastIndexOf(...e) {
|
|
503
|
-
return
|
|
503
|
+
return Ye(this, "lastIndexOf", e);
|
|
504
504
|
},
|
|
505
505
|
map(e, t) {
|
|
506
|
-
return
|
|
506
|
+
return qe(this, "map", e, t, void 0, arguments);
|
|
507
507
|
},
|
|
508
508
|
pop() {
|
|
509
|
-
return
|
|
509
|
+
return Xe(this, "pop");
|
|
510
510
|
},
|
|
511
511
|
push(...e) {
|
|
512
|
-
return
|
|
512
|
+
return Xe(this, "push", e);
|
|
513
513
|
},
|
|
514
514
|
reduce(e, ...t) {
|
|
515
|
-
return
|
|
515
|
+
return Je(this, "reduce", e, t);
|
|
516
516
|
},
|
|
517
517
|
reduceRight(e, ...t) {
|
|
518
|
-
return
|
|
518
|
+
return Je(this, "reduceRight", e, t);
|
|
519
519
|
},
|
|
520
520
|
shift() {
|
|
521
|
-
return
|
|
521
|
+
return Xe(this, "shift");
|
|
522
522
|
},
|
|
523
523
|
some(e, t) {
|
|
524
|
-
return
|
|
524
|
+
return qe(this, "some", e, t, void 0, arguments);
|
|
525
525
|
},
|
|
526
526
|
splice(...e) {
|
|
527
|
-
return
|
|
527
|
+
return Xe(this, "splice", e);
|
|
528
528
|
},
|
|
529
529
|
toReversed() {
|
|
530
|
-
return
|
|
530
|
+
return Ve(this).toReversed();
|
|
531
531
|
},
|
|
532
532
|
toSorted(e) {
|
|
533
|
-
return
|
|
533
|
+
return Ve(this).toSorted(e);
|
|
534
534
|
},
|
|
535
535
|
toSpliced(...e) {
|
|
536
|
-
return
|
|
536
|
+
return Ve(this).toSpliced(...e);
|
|
537
537
|
},
|
|
538
538
|
unshift(...e) {
|
|
539
|
-
return
|
|
539
|
+
return Xe(this, "unshift", e);
|
|
540
540
|
},
|
|
541
541
|
values() {
|
|
542
|
-
return
|
|
542
|
+
return Ge(this, "values", (e) => Ue(this, e));
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
|
-
function
|
|
546
|
-
let r =
|
|
547
|
-
return r !== e && !/* @__PURE__ */
|
|
545
|
+
function Ge(e, t, n) {
|
|
546
|
+
let r = He(e), i = r[t]();
|
|
547
|
+
return r !== e && !/* @__PURE__ */ K(e) && (i._next = i.next, i.next = () => {
|
|
548
548
|
let e = i._next();
|
|
549
549
|
return e.done || (e.value = n(e.value)), e;
|
|
550
550
|
}), i;
|
|
551
551
|
}
|
|
552
|
-
var
|
|
553
|
-
function
|
|
554
|
-
let o =
|
|
555
|
-
if (c !==
|
|
552
|
+
var Ke = Array.prototype;
|
|
553
|
+
function qe(e, t, n, r, i, a) {
|
|
554
|
+
let o = He(e), s = o !== e && !/* @__PURE__ */ K(e), c = o[t];
|
|
555
|
+
if (c !== Ke[t]) {
|
|
556
556
|
let t = c.apply(e, a);
|
|
557
|
-
return s ?
|
|
557
|
+
return s ? Ot(t) : t;
|
|
558
558
|
}
|
|
559
559
|
let l = n;
|
|
560
560
|
o !== e && (s ? l = function(t, r) {
|
|
561
|
-
return n.call(this,
|
|
561
|
+
return n.call(this, Ue(e, t), r, e);
|
|
562
562
|
} : n.length > 2 && (l = function(t, r) {
|
|
563
563
|
return n.call(this, t, r, e);
|
|
564
564
|
}));
|
|
565
565
|
let u = c.call(o, l, r);
|
|
566
566
|
return s && i ? i(u) : u;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
569
|
-
let i =
|
|
568
|
+
function Je(e, t, n, r) {
|
|
569
|
+
let i = He(e), a = i !== e && !/* @__PURE__ */ K(e), o = n, s = !1;
|
|
570
570
|
i !== e && (a ? (s = r.length === 0, o = function(t, r, i) {
|
|
571
|
-
return s && (s = !1, t =
|
|
571
|
+
return s && (s = !1, t = Ue(e, t)), n.call(this, t, Ue(e, r), i, e);
|
|
572
572
|
}) : n.length > 3 && (o = function(t, r, i) {
|
|
573
573
|
return n.call(this, t, r, i, e);
|
|
574
574
|
}));
|
|
575
575
|
let c = i[t](o, ...r);
|
|
576
|
-
return s ?
|
|
576
|
+
return s ? Ue(e, c) : c;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
let r = /* @__PURE__ */
|
|
580
|
-
|
|
578
|
+
function Ye(e, t, n) {
|
|
579
|
+
let r = /* @__PURE__ */ q(e);
|
|
580
|
+
ze(r, "iterate", Re);
|
|
581
581
|
let i = r[t](...n);
|
|
582
|
-
return (i === -1 || i === !1) && /* @__PURE__ */
|
|
582
|
+
return (i === -1 || i === !1) && /* @__PURE__ */ Et(n[0]) ? (n[0] = /* @__PURE__ */ q(n[0]), r[t](...n)) : i;
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
|
|
586
|
-
let r = (/* @__PURE__ */
|
|
587
|
-
return
|
|
584
|
+
function Xe(e, t, n = []) {
|
|
585
|
+
Oe(), be();
|
|
586
|
+
let r = (/* @__PURE__ */ q(e))[t].apply(e, n);
|
|
587
|
+
return xe(), ke(), r;
|
|
588
588
|
}
|
|
589
|
-
var
|
|
590
|
-
function
|
|
589
|
+
var Ze = /* @__PURE__ */ b("__proto__,__v_isRef,__isVue"), Qe = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(te));
|
|
590
|
+
function $e(e) {
|
|
591
591
|
te(e) || (e = String(e));
|
|
592
|
-
let t = /* @__PURE__ */
|
|
593
|
-
return
|
|
592
|
+
let t = /* @__PURE__ */ q(this);
|
|
593
|
+
return ze(t, "has", e), t.hasOwnProperty(e);
|
|
594
594
|
}
|
|
595
|
-
var
|
|
595
|
+
var et = class {
|
|
596
596
|
constructor(e = !1, t = !1) {
|
|
597
597
|
this._isReadonly = e, this._isShallow = t;
|
|
598
598
|
}
|
|
@@ -602,60 +602,60 @@ var Qe = class {
|
|
|
602
602
|
if (t === "__v_isReactive") return !r;
|
|
603
603
|
if (t === "__v_isReadonly") return r;
|
|
604
604
|
if (t === "__v_isShallow") return i;
|
|
605
|
-
if (t === "__v_raw") return n === (r ? i ?
|
|
605
|
+
if (t === "__v_raw") return n === (r ? i ? vt : _t : i ? gt : ht).get(e) || Object.getPrototypeOf(e) === Object.getPrototypeOf(n) ? e : void 0;
|
|
606
606
|
let a = k(e);
|
|
607
607
|
if (!r) {
|
|
608
608
|
let e;
|
|
609
|
-
if (a && (e =
|
|
610
|
-
if (t === "hasOwnProperty") return
|
|
609
|
+
if (a && (e = We[t])) return e;
|
|
610
|
+
if (t === "hasOwnProperty") return $e;
|
|
611
611
|
}
|
|
612
612
|
let o = Reflect.get(e, t, /* @__PURE__ */ kt(e) ? e : n);
|
|
613
|
-
if ((te(t) ?
|
|
613
|
+
if ((te(t) ? Qe.has(t) : Ze(t)) || (r || ze(e, "get", t), i)) return o;
|
|
614
614
|
if (/* @__PURE__ */ kt(o)) {
|
|
615
615
|
let e = a && I(t) ? o : o.value;
|
|
616
|
-
return r && N(e) ? /* @__PURE__ */
|
|
616
|
+
return r && N(e) ? /* @__PURE__ */ xt(e) : e;
|
|
617
617
|
}
|
|
618
|
-
return N(o) ? r ? /* @__PURE__ */
|
|
618
|
+
return N(o) ? r ? /* @__PURE__ */ xt(o) : /* @__PURE__ */ bt(o) : o;
|
|
619
619
|
}
|
|
620
|
-
},
|
|
620
|
+
}, tt = class extends et {
|
|
621
621
|
constructor(e = !1) {
|
|
622
622
|
super(!1, e);
|
|
623
623
|
}
|
|
624
624
|
set(e, t, n, r) {
|
|
625
625
|
let i = e[t], a = k(e) && I(t);
|
|
626
626
|
if (!this._isShallow) {
|
|
627
|
-
let r = /* @__PURE__ */
|
|
628
|
-
if (!/* @__PURE__ */
|
|
627
|
+
let r = /* @__PURE__ */ Tt(i);
|
|
628
|
+
if (!/* @__PURE__ */ K(n) && !/* @__PURE__ */ Tt(n) && (i = /* @__PURE__ */ q(i), n = /* @__PURE__ */ q(n)), !a && /* @__PURE__ */ kt(i) && !/* @__PURE__ */ kt(n)) return r ? (process.env.NODE_ENV !== "production" && B(`Set operation on key "${String(t)}" failed: target is readonly.`, e[t]), !0) : (i.value = n, !0);
|
|
629
629
|
}
|
|
630
630
|
let o = a ? Number(t) < e.length : O(e, t), s = Reflect.set(e, t, n, /* @__PURE__ */ kt(e) ? e : r);
|
|
631
|
-
return e === /* @__PURE__ */
|
|
631
|
+
return e === /* @__PURE__ */ q(r) && s && (o ? ae(n, i) && Be(e, "set", t, n, i) : Be(e, "add", t, n)), s;
|
|
632
632
|
}
|
|
633
633
|
deleteProperty(e, t) {
|
|
634
634
|
let n = O(e, t), r = e[t], i = Reflect.deleteProperty(e, t);
|
|
635
|
-
return i && n &&
|
|
635
|
+
return i && n && Be(e, "delete", t, void 0, r), i;
|
|
636
636
|
}
|
|
637
637
|
has(e, t) {
|
|
638
638
|
let n = Reflect.has(e, t);
|
|
639
|
-
return (!te(t) || !
|
|
639
|
+
return (!te(t) || !Qe.has(t)) && ze(e, "has", t), n;
|
|
640
640
|
}
|
|
641
641
|
ownKeys(e) {
|
|
642
|
-
return
|
|
642
|
+
return ze(e, "iterate", k(e) ? "length" : Ie), Reflect.ownKeys(e);
|
|
643
643
|
}
|
|
644
|
-
},
|
|
644
|
+
}, nt = class extends et {
|
|
645
645
|
constructor(e = !1) {
|
|
646
646
|
super(!0, e);
|
|
647
647
|
}
|
|
648
648
|
set(e, t) {
|
|
649
|
-
return process.env.NODE_ENV !== "production" &&
|
|
649
|
+
return process.env.NODE_ENV !== "production" && B(`Set operation on key "${String(t)}" failed: target is readonly.`, e), !0;
|
|
650
650
|
}
|
|
651
651
|
deleteProperty(e, t) {
|
|
652
|
-
return process.env.NODE_ENV !== "production" &&
|
|
652
|
+
return process.env.NODE_ENV !== "production" && B(`Delete operation on key "${String(t)}" failed: target is readonly.`, e), !0;
|
|
653
653
|
}
|
|
654
|
-
},
|
|
655
|
-
function
|
|
654
|
+
}, rt = /* @__PURE__ */ new tt(), it = /* @__PURE__ */ new nt(), at = /* @__PURE__ */ new nt(!0), ot = (e) => e, G = (e) => Reflect.getPrototypeOf(e);
|
|
655
|
+
function st(e, t, n) {
|
|
656
656
|
return function(...r) {
|
|
657
|
-
let i = this.__v_raw, a = /* @__PURE__ */
|
|
658
|
-
return !t &&
|
|
657
|
+
let i = this.__v_raw, a = /* @__PURE__ */ q(i), o = A(a), s = e === "entries" || e === Symbol.iterator && o, c = e === "keys" && o, l = i[e](...r), u = n ? ot : t ? J : Ot;
|
|
658
|
+
return !t && ze(a, "iterate", c ? Le : Ie), T(Object.create(l), { next() {
|
|
659
659
|
let { value: e, done: t } = l.next();
|
|
660
660
|
return t ? {
|
|
661
661
|
value: e,
|
|
@@ -667,64 +667,64 @@ function at(e, t, n) {
|
|
|
667
667
|
} });
|
|
668
668
|
};
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function ct(e) {
|
|
671
671
|
return function(...t) {
|
|
672
672
|
if (process.env.NODE_ENV !== "production") {
|
|
673
673
|
let n = t[0] ? `on key "${t[0]}" ` : "";
|
|
674
|
-
|
|
674
|
+
B(`${L(e)} operation ${n}failed: target is readonly.`, /* @__PURE__ */ q(this));
|
|
675
675
|
}
|
|
676
676
|
return e === "delete" ? !1 : e === "clear" ? void 0 : this;
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function lt(e, t) {
|
|
680
680
|
let n = {
|
|
681
681
|
get(n) {
|
|
682
|
-
let r = this.__v_raw, i = /* @__PURE__ */
|
|
683
|
-
e || (
|
|
684
|
-
let { has: o } =
|
|
682
|
+
let r = this.__v_raw, i = /* @__PURE__ */ q(r), a = /* @__PURE__ */ q(n);
|
|
683
|
+
e || (ae(n, a) && ze(i, "get", n), ze(i, "get", a));
|
|
684
|
+
let { has: o } = G(i), s = t ? ot : e ? J : Ot;
|
|
685
685
|
if (o.call(i, n)) return s(r.get(n));
|
|
686
686
|
if (o.call(i, a)) return s(r.get(a));
|
|
687
687
|
r !== i && r.get(n);
|
|
688
688
|
},
|
|
689
689
|
get size() {
|
|
690
690
|
let t = this.__v_raw;
|
|
691
|
-
return !e &&
|
|
691
|
+
return !e && ze(/* @__PURE__ */ q(t), "iterate", Ie), t.size;
|
|
692
692
|
},
|
|
693
693
|
has(t) {
|
|
694
|
-
let n = this.__v_raw, r = /* @__PURE__ */
|
|
695
|
-
return e || (
|
|
694
|
+
let n = this.__v_raw, r = /* @__PURE__ */ q(n), i = /* @__PURE__ */ q(t);
|
|
695
|
+
return e || (ae(t, i) && ze(r, "has", t), ze(r, "has", i)), t === i ? n.has(t) : n.has(t) || n.has(i);
|
|
696
696
|
},
|
|
697
697
|
forEach(n, r) {
|
|
698
|
-
let i = this, a = i.__v_raw, o = /* @__PURE__ */
|
|
699
|
-
return !e &&
|
|
698
|
+
let i = this, a = i.__v_raw, o = /* @__PURE__ */ q(a), s = t ? ot : e ? J : Ot;
|
|
699
|
+
return !e && ze(o, "iterate", Ie), a.forEach((e, t) => n.call(r, s(e), s(t), i));
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
702
|
return T(n, e ? {
|
|
703
|
-
add:
|
|
704
|
-
set:
|
|
705
|
-
delete:
|
|
706
|
-
clear:
|
|
703
|
+
add: ct("add"),
|
|
704
|
+
set: ct("set"),
|
|
705
|
+
delete: ct("delete"),
|
|
706
|
+
clear: ct("clear")
|
|
707
707
|
} : {
|
|
708
708
|
add(e) {
|
|
709
|
-
let n = /* @__PURE__ */
|
|
710
|
-
return r.has.call(n, a) ||
|
|
709
|
+
let n = /* @__PURE__ */ q(this), r = G(n), i = /* @__PURE__ */ q(e), a = !t && !/* @__PURE__ */ K(e) && !/* @__PURE__ */ Tt(e) ? i : e;
|
|
710
|
+
return r.has.call(n, a) || ae(e, a) && r.has.call(n, e) || ae(i, a) && r.has.call(n, i) || (n.add(a), Be(n, "add", a, a)), this;
|
|
711
711
|
},
|
|
712
712
|
set(e, n) {
|
|
713
|
-
!t && !/* @__PURE__ */
|
|
714
|
-
let r = /* @__PURE__ */
|
|
715
|
-
o ? process.env.NODE_ENV !== "production" &&
|
|
713
|
+
!t && !/* @__PURE__ */ K(n) && !/* @__PURE__ */ Tt(n) && (n = /* @__PURE__ */ q(n));
|
|
714
|
+
let r = /* @__PURE__ */ q(this), { has: i, get: a } = G(r), o = i.call(r, e);
|
|
715
|
+
o ? process.env.NODE_ENV !== "production" && mt(r, i, e) : (e = /* @__PURE__ */ q(e), o = i.call(r, e));
|
|
716
716
|
let s = a.call(r, e);
|
|
717
|
-
return r.set(e, n), o ?
|
|
717
|
+
return r.set(e, n), o ? ae(n, s) && Be(r, "set", e, n, s) : Be(r, "add", e, n), this;
|
|
718
718
|
},
|
|
719
719
|
delete(e) {
|
|
720
|
-
let t = /* @__PURE__ */
|
|
721
|
-
i ? process.env.NODE_ENV !== "production" &&
|
|
720
|
+
let t = /* @__PURE__ */ q(this), { has: n, get: r } = G(t), i = n.call(t, e);
|
|
721
|
+
i ? process.env.NODE_ENV !== "production" && mt(t, n, e) : (e = /* @__PURE__ */ q(e), i = n.call(t, e));
|
|
722
722
|
let a = r ? r.call(t, e) : void 0, o = t.delete(e);
|
|
723
|
-
return i &&
|
|
723
|
+
return i && Be(t, "delete", e, void 0, a), o;
|
|
724
724
|
},
|
|
725
725
|
clear() {
|
|
726
|
-
let e = /* @__PURE__ */
|
|
727
|
-
return t &&
|
|
726
|
+
let e = /* @__PURE__ */ q(this), t = e.size !== 0, n = process.env.NODE_ENV === "production" ? void 0 : A(e) ? new Map(e) : new Set(e), r = e.clear();
|
|
727
|
+
return t && Be(e, "clear", void 0, void 0, n), r;
|
|
728
728
|
}
|
|
729
729
|
}), [
|
|
730
730
|
"keys",
|
|
@@ -732,23 +732,23 @@ function st(e, t) {
|
|
|
732
732
|
"entries",
|
|
733
733
|
Symbol.iterator
|
|
734
734
|
].forEach((r) => {
|
|
735
|
-
n[r] =
|
|
735
|
+
n[r] = st(r, e, t);
|
|
736
736
|
}), n;
|
|
737
737
|
}
|
|
738
|
-
function
|
|
739
|
-
let n =
|
|
738
|
+
function ut(e, t) {
|
|
739
|
+
let n = lt(e, t);
|
|
740
740
|
return (t, r, i) => r === "__v_isReactive" ? !e : r === "__v_isReadonly" ? e : r === "__v_raw" ? t : Reflect.get(O(n, r) && r in t ? n : t, r, i);
|
|
741
741
|
}
|
|
742
|
-
var
|
|
743
|
-
function
|
|
744
|
-
let r = /* @__PURE__ */
|
|
742
|
+
var dt = { get: /* @__PURE__ */ ut(!1, !1) }, ft = { get: /* @__PURE__ */ ut(!0, !1) }, pt = { get: /* @__PURE__ */ ut(!0, !0) };
|
|
743
|
+
function mt(e, t, n) {
|
|
744
|
+
let r = /* @__PURE__ */ q(n);
|
|
745
745
|
if (r !== n && t.call(e, r)) {
|
|
746
746
|
let t = ie(e);
|
|
747
|
-
|
|
747
|
+
B(`Reactive ${t} contains both the raw and reactive versions of the same object${t === "Map" ? " as keys" : ""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
var
|
|
751
|
-
function
|
|
750
|
+
var ht = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), _t = /* @__PURE__ */ new WeakMap(), vt = /* @__PURE__ */ new WeakMap();
|
|
751
|
+
function yt(e) {
|
|
752
752
|
switch (e) {
|
|
753
753
|
case "Object":
|
|
754
754
|
case "Array": return 1;
|
|
@@ -760,52 +760,52 @@ function _t(e) {
|
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
762
|
// @__NO_SIDE_EFFECTS__
|
|
763
|
-
function
|
|
764
|
-
return /* @__PURE__ */
|
|
763
|
+
function bt(e) {
|
|
764
|
+
return /* @__PURE__ */ Tt(e) ? e : Ct(e, !1, rt, dt, ht);
|
|
765
765
|
}
|
|
766
766
|
// @__NO_SIDE_EFFECTS__
|
|
767
|
-
function
|
|
768
|
-
return
|
|
767
|
+
function xt(e) {
|
|
768
|
+
return Ct(e, !0, it, ft, _t);
|
|
769
769
|
}
|
|
770
770
|
// @__NO_SIDE_EFFECTS__
|
|
771
|
-
function
|
|
772
|
-
return
|
|
771
|
+
function St(e) {
|
|
772
|
+
return Ct(e, !0, at, pt, vt);
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
if (!N(e)) return process.env.NODE_ENV !== "production" &&
|
|
774
|
+
function Ct(e, t, n, r, i) {
|
|
775
|
+
if (!N(e)) return process.env.NODE_ENV !== "production" && B(`value cannot be made ${t ? "readonly" : "reactive"}: ${String(e)}`), e;
|
|
776
776
|
if (e.__v_raw && !(t && e.__v_isReactive) || e.__v_skip || !Object.isExtensible(e)) return e;
|
|
777
777
|
let a = i.get(e);
|
|
778
778
|
if (a) return a;
|
|
779
|
-
let o =
|
|
779
|
+
let o = yt(ie(e));
|
|
780
780
|
if (o === 0) return e;
|
|
781
781
|
let s = new Proxy(e, o === 2 ? r : n);
|
|
782
782
|
return i.set(e, s), s;
|
|
783
783
|
}
|
|
784
784
|
// @__NO_SIDE_EFFECTS__
|
|
785
|
-
function
|
|
786
|
-
return /* @__PURE__ */
|
|
785
|
+
function wt(e) {
|
|
786
|
+
return /* @__PURE__ */ Tt(e) ? /* @__PURE__ */ wt(e.__v_raw) : !!(e && e.__v_isReactive);
|
|
787
787
|
}
|
|
788
788
|
// @__NO_SIDE_EFFECTS__
|
|
789
|
-
function
|
|
789
|
+
function Tt(e) {
|
|
790
790
|
return !!(e && e.__v_isReadonly);
|
|
791
791
|
}
|
|
792
792
|
// @__NO_SIDE_EFFECTS__
|
|
793
|
-
function
|
|
793
|
+
function K(e) {
|
|
794
794
|
return !!(e && e.__v_isShallow);
|
|
795
795
|
}
|
|
796
796
|
// @__NO_SIDE_EFFECTS__
|
|
797
|
-
function
|
|
797
|
+
function Et(e) {
|
|
798
798
|
return e ? !!e.__v_raw : !1;
|
|
799
799
|
}
|
|
800
800
|
// @__NO_SIDE_EFFECTS__
|
|
801
|
-
function
|
|
801
|
+
function q(e) {
|
|
802
802
|
let t = e && e.__v_raw;
|
|
803
|
-
return t ? /* @__PURE__ */
|
|
803
|
+
return t ? /* @__PURE__ */ q(t) : e;
|
|
804
804
|
}
|
|
805
|
-
function
|
|
806
|
-
return !O(e, "__v_skip") && Object.isExtensible(e) &&
|
|
805
|
+
function Dt(e) {
|
|
806
|
+
return !O(e, "__v_skip") && Object.isExtensible(e) && oe(e, "__v_skip", !0), e;
|
|
807
807
|
}
|
|
808
|
-
var
|
|
808
|
+
var Ot = (e) => N(e) ? /* @__PURE__ */ bt(e) : e, J = (e) => N(e) ? /* @__PURE__ */ xt(e) : e;
|
|
809
809
|
// @__NO_SIDE_EFFECTS__
|
|
810
810
|
function kt(e) {
|
|
811
811
|
return e ? e.__v_isRef === !0 : !1;
|
|
@@ -823,7 +823,7 @@ function Mt(e, t) {
|
|
|
823
823
|
}
|
|
824
824
|
var Nt = class {
|
|
825
825
|
constructor(e, t) {
|
|
826
|
-
this.dep = new
|
|
826
|
+
this.dep = new Ne(), this.__v_isRef = !0, this.__v_isShallow = !1, this._rawValue = t ? e : /* @__PURE__ */ q(e), this._value = t ? e : Ot(e), this.__v_isShallow = t;
|
|
827
827
|
}
|
|
828
828
|
get value() {
|
|
829
829
|
return process.env.NODE_ENV === "production" ? this.dep.track() : this.dep.track({
|
|
@@ -833,8 +833,8 @@ var Nt = class {
|
|
|
833
833
|
}), this._value;
|
|
834
834
|
}
|
|
835
835
|
set value(e) {
|
|
836
|
-
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */
|
|
837
|
-
e = n ? e : /* @__PURE__ */
|
|
836
|
+
let t = this._rawValue, n = this.__v_isShallow || /* @__PURE__ */ K(e) || /* @__PURE__ */ Tt(e);
|
|
837
|
+
e = n ? e : /* @__PURE__ */ q(e), ae(e, t) && (this._rawValue = e, this._value = n ? e : Ot(e), process.env.NODE_ENV === "production" ? this.dep.trigger() : this.dep.trigger({
|
|
838
838
|
target: this,
|
|
839
839
|
type: "set",
|
|
840
840
|
key: "value",
|
|
@@ -862,14 +862,14 @@ var It = {
|
|
|
862
862
|
}
|
|
863
863
|
};
|
|
864
864
|
function Lt(e) {
|
|
865
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ wt(e) ? e : new Proxy(e, It);
|
|
866
866
|
}
|
|
867
867
|
var Rt = class {
|
|
868
868
|
constructor(e, t, n) {
|
|
869
|
-
this.fn = e, this.setter = t, this._value = void 0, this.dep = new
|
|
869
|
+
this.fn = e, this.setter = t, this._value = void 0, this.dep = new Ne(this), this.__v_isRef = !0, this.deps = void 0, this.depsTail = void 0, this.flags = 16, this.globalVersion = je - 1, this.next = void 0, this.effect = this, this.__v_isReadonly = !t, this.isSSR = n;
|
|
870
870
|
}
|
|
871
871
|
notify() {
|
|
872
|
-
if (this.flags |= 16, !(this.flags & 8) &&
|
|
872
|
+
if (this.flags |= 16, !(this.flags & 8) && V !== this) return H(this, !0), !0;
|
|
873
873
|
process.env.NODE_ENV;
|
|
874
874
|
}
|
|
875
875
|
get value() {
|
|
@@ -878,10 +878,10 @@ var Rt = class {
|
|
|
878
878
|
type: "get",
|
|
879
879
|
key: "value"
|
|
880
880
|
});
|
|
881
|
-
return
|
|
881
|
+
return Te(this), e && (e.version = this.dep.version), this._value;
|
|
882
882
|
}
|
|
883
883
|
set value(e) {
|
|
884
|
-
this.setter ? this.setter(e) : process.env.NODE_ENV !== "production" &&
|
|
884
|
+
this.setter ? this.setter(e) : process.env.NODE_ENV !== "production" && B("Write operation failed: computed value is readonly");
|
|
885
885
|
}
|
|
886
886
|
};
|
|
887
887
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -896,24 +896,24 @@ function Ut(e, t = !1, n = Ht) {
|
|
|
896
896
|
if (n) {
|
|
897
897
|
let t = Vt.get(n);
|
|
898
898
|
t || Vt.set(n, t = []), t.push(e);
|
|
899
|
-
} else process.env.NODE_ENV !== "production" && !t &&
|
|
899
|
+
} else process.env.NODE_ENV !== "production" && !t && B("onWatcherCleanup() was called when there was no active watcher to associate with.");
|
|
900
900
|
}
|
|
901
901
|
function Wt(e, t, n = x) {
|
|
902
902
|
let { immediate: r, deep: i, once: a, scheduler: o, augmentJob: s, call: c } = n, l = (e) => {
|
|
903
|
-
(n.onWarn ||
|
|
904
|
-
}, u = (e) => i ? e : /* @__PURE__ */
|
|
905
|
-
if (/* @__PURE__ */ kt(e) ? (f = () => e.value, h = /* @__PURE__ */
|
|
903
|
+
(n.onWarn || B)("Invalid watch source: ", e, "A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");
|
|
904
|
+
}, u = (e) => i ? e : /* @__PURE__ */ K(e) || i === !1 || i === 0 ? Gt(e, 1) : Gt(e), d, f, p, m, h = !1, g = !1;
|
|
905
|
+
if (/* @__PURE__ */ kt(e) ? (f = () => e.value, h = /* @__PURE__ */ K(e)) : /* @__PURE__ */ wt(e) ? (f = () => u(e), h = !0) : k(e) ? (g = !0, h = e.some((e) => /* @__PURE__ */ wt(e) || /* @__PURE__ */ K(e)), f = () => e.map((e) => {
|
|
906
906
|
if (/* @__PURE__ */ kt(e)) return e.value;
|
|
907
|
-
if (/* @__PURE__ */
|
|
907
|
+
if (/* @__PURE__ */ wt(e)) return u(e);
|
|
908
908
|
if (j(e)) return c ? c(e, 2) : e();
|
|
909
909
|
process.env.NODE_ENV !== "production" && l(e);
|
|
910
910
|
})) : j(e) ? f = t ? c ? () => c(e, 2) : e : () => {
|
|
911
911
|
if (p) {
|
|
912
|
-
|
|
912
|
+
Oe();
|
|
913
913
|
try {
|
|
914
914
|
p();
|
|
915
915
|
} finally {
|
|
916
|
-
|
|
916
|
+
ke();
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
let t = Ht;
|
|
@@ -927,7 +927,7 @@ function Wt(e, t, n = x) {
|
|
|
927
927
|
let e = f, t = i === !0 ? Infinity : i;
|
|
928
928
|
f = () => Gt(e(), t);
|
|
929
929
|
}
|
|
930
|
-
let _ =
|
|
930
|
+
let _ = me(), v = () => {
|
|
931
931
|
d.stop(), _ && _.active && E(_.effects, d);
|
|
932
932
|
};
|
|
933
933
|
if (a && t) {
|
|
@@ -940,7 +940,7 @@ function Wt(e, t, n = x) {
|
|
|
940
940
|
let y = g ? Array(e.length).fill(Bt) : Bt, b = (e) => {
|
|
941
941
|
if (!(!(d.flags & 1) || !d.dirty && !e)) if (t) {
|
|
942
942
|
let n = d.run();
|
|
943
|
-
if (e || i || h || (g ? n.some((e, t) =>
|
|
943
|
+
if (e || i || h || (g ? n.some((e, t) => ae(e, y[t])) : ae(n, y))) {
|
|
944
944
|
p && p();
|
|
945
945
|
let e = Ht;
|
|
946
946
|
Ht = d;
|
|
@@ -957,7 +957,7 @@ function Wt(e, t, n = x) {
|
|
|
957
957
|
}
|
|
958
958
|
} else d.run();
|
|
959
959
|
};
|
|
960
|
-
return s && s(b), d = new
|
|
960
|
+
return s && s(b), d = new ge(f), d.scheduler = o ? () => o(b, !1) : b, m = (e) => Ut(e, !1, d), p = d.onStop = () => {
|
|
961
961
|
let e = Vt.get(d);
|
|
962
962
|
if (e) {
|
|
963
963
|
if (c) c(e, 4);
|
|
@@ -991,7 +991,7 @@ function Jt() {
|
|
|
991
991
|
var Yt = !1;
|
|
992
992
|
function Xt(e, ...t) {
|
|
993
993
|
if (Yt) return;
|
|
994
|
-
Yt = !0,
|
|
994
|
+
Yt = !0, Oe();
|
|
995
995
|
let n = Kt.length ? Kt[Kt.length - 1].component : null, r = n && n.appContext.config.warnHandler, i = Zt();
|
|
996
996
|
if (r) rn(r, n, 11, [
|
|
997
997
|
e + t.map((e) => e.toString?.call(e) ?? JSON.stringify(e)).join(""),
|
|
@@ -1003,7 +1003,7 @@ function Xt(e, ...t) {
|
|
|
1003
1003
|
let n = [`[Vue warn]: ${e}`, ...t];
|
|
1004
1004
|
i.length && n.push("\n", ...Qt(i)), console.warn(...n);
|
|
1005
1005
|
}
|
|
1006
|
-
|
|
1006
|
+
ke(), Yt = !1;
|
|
1007
1007
|
}
|
|
1008
1008
|
function Zt() {
|
|
1009
1009
|
let e = Kt[Kt.length - 1];
|
|
@@ -1041,11 +1041,11 @@ function en(e) {
|
|
|
1041
1041
|
}), n.length > 3 && t.push(" ..."), t;
|
|
1042
1042
|
}
|
|
1043
1043
|
function tn(e, t, n) {
|
|
1044
|
-
return M(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ kt(t) ? (t = tn(e, /* @__PURE__ */
|
|
1044
|
+
return M(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : /* @__PURE__ */ kt(t) ? (t = tn(e, /* @__PURE__ */ q(t.value), !0), n ? t : [
|
|
1045
1045
|
`${e}=Ref<`,
|
|
1046
1046
|
t,
|
|
1047
1047
|
">"
|
|
1048
|
-
]) : j(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */
|
|
1048
|
+
]) : j(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = /* @__PURE__ */ q(t), n ? t : [`${e}=`, t]);
|
|
1049
1049
|
}
|
|
1050
1050
|
var nn = {
|
|
1051
1051
|
sp: "serverPrefetch hook",
|
|
@@ -1112,11 +1112,11 @@ function on(e, t, n, r = !0) {
|
|
|
1112
1112
|
r = r.parent;
|
|
1113
1113
|
}
|
|
1114
1114
|
if (a) {
|
|
1115
|
-
|
|
1115
|
+
Oe(), rn(a, null, 10, [
|
|
1116
1116
|
e,
|
|
1117
1117
|
i,
|
|
1118
1118
|
o
|
|
1119
|
-
]),
|
|
1119
|
+
]), ke();
|
|
1120
1120
|
return;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
@@ -1198,7 +1198,7 @@ function wn(e, t) {
|
|
|
1198
1198
|
return e.set(t, n + 1), !1;
|
|
1199
1199
|
}
|
|
1200
1200
|
var Tn = /* @__PURE__ */ new Map();
|
|
1201
|
-
process.env.NODE_ENV !== "production" && (
|
|
1201
|
+
process.env.NODE_ENV !== "production" && (ce().__VUE_HMR_RUNTIME__ = {
|
|
1202
1202
|
createRecord: Mn(Dn),
|
|
1203
1203
|
rerender: Mn(kn),
|
|
1204
1204
|
reload: Mn(An)
|
|
@@ -1317,15 +1317,15 @@ var Wn = (e) => e.__isTeleport;
|
|
|
1317
1317
|
function Gn(e, t) {
|
|
1318
1318
|
e.shapeFlag & 6 && e.component ? (e.transition = t, Gn(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
|
|
1319
1319
|
}
|
|
1320
|
-
|
|
1320
|
+
ce().requestIdleCallback, ce().cancelIdleCallback;
|
|
1321
1321
|
var Kn = /* @__PURE__ */ Symbol.for("v-ndc"), qn = (e) => e ? Ir(e) ? Rr(e) : qn(e.parent) : null, Jn = /* @__PURE__ */ T(/* @__PURE__ */ Object.create(null), {
|
|
1322
1322
|
$: (e) => e,
|
|
1323
1323
|
$el: (e) => e.vnode.el,
|
|
1324
1324
|
$data: (e) => e.data,
|
|
1325
|
-
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */
|
|
1326
|
-
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */
|
|
1327
|
-
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */
|
|
1328
|
-
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */
|
|
1325
|
+
$props: (e) => process.env.NODE_ENV === "production" ? e.props : /* @__PURE__ */ St(e.props),
|
|
1326
|
+
$attrs: (e) => process.env.NODE_ENV === "production" ? e.attrs : /* @__PURE__ */ St(e.attrs),
|
|
1327
|
+
$slots: (e) => process.env.NODE_ENV === "production" ? e.slots : /* @__PURE__ */ St(e.slots),
|
|
1328
|
+
$refs: (e) => process.env.NODE_ENV === "production" ? e.refs : /* @__PURE__ */ St(e.refs),
|
|
1329
1329
|
$parent: (e) => qn(e.parent),
|
|
1330
1330
|
$root: (e) => qn(e.root),
|
|
1331
1331
|
$host: (e) => e.ce,
|
|
@@ -1356,7 +1356,7 @@ var Kn = /* @__PURE__ */ Symbol.for("v-ndc"), qn = (e) => e ? Ir(e) ? Rr(e) : qn
|
|
|
1356
1356
|
else Qn && (o[t] = 0);
|
|
1357
1357
|
}
|
|
1358
1358
|
let l = Jn[t], u, d;
|
|
1359
|
-
if (l) return t === "$attrs" ? (
|
|
1359
|
+
if (l) return t === "$attrs" ? (ze(e.attrs, "get", ""), process.env.NODE_ENV) : process.env.NODE_ENV !== "production" && t === "$slots" && ze(e, "get", t), l(e);
|
|
1360
1360
|
if ((u = s.__cssModules) && (u = u[t])) return u;
|
|
1361
1361
|
if (n !== x && O(n, t)) return o[t] = 4, n[t];
|
|
1362
1362
|
if (d = c.config.globalProperties, O(d, t)) return d[t];
|
|
@@ -1510,13 +1510,13 @@ function Tr(e, t = null, n = null, r = 0, i = null, a = !1) {
|
|
|
1510
1510
|
if (Ur(e) && (e = e.__vccOpts), t) {
|
|
1511
1511
|
t = Er(t);
|
|
1512
1512
|
let { class: e, style: n } = t;
|
|
1513
|
-
e && !M(e) && (t.class =
|
|
1513
|
+
e && !M(e) && (t.class = z(e)), N(n) && (/* @__PURE__ */ Et(n) && !k(n) && (n = T({}, n)), t.style = le(n));
|
|
1514
1514
|
}
|
|
1515
1515
|
let o = M(e) ? 1 : pr(e) ? 128 : Wn(e) ? 64 : N(e) ? 4 : j(e) ? 2 : 0;
|
|
1516
|
-
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */
|
|
1516
|
+
return process.env.NODE_ENV !== "production" && o & 4 && /* @__PURE__ */ Et(e) && (e = /* @__PURE__ */ q(e), Xt("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.", "\nComponent that was made reactive: ", e)), Cr(e, t, n, r, i, o, a, !0);
|
|
1517
1517
|
}
|
|
1518
1518
|
function Er(e) {
|
|
1519
|
-
return e ? /* @__PURE__ */
|
|
1519
|
+
return e ? /* @__PURE__ */ Et(e) || dr(e) ? T({}, e) : e : null;
|
|
1520
1520
|
}
|
|
1521
1521
|
function Dr(e, t, n = !1, r = !1) {
|
|
1522
1522
|
let { props: i, ref: a, patchFlag: o, children: s, transition: c } = e, l = t ? jr(i || {}, t) : i, u = {
|
|
@@ -1584,8 +1584,8 @@ function jr(...e) {
|
|
|
1584
1584
|
let t = {};
|
|
1585
1585
|
for (let n = 0; n < e.length; n++) {
|
|
1586
1586
|
let r = e[n];
|
|
1587
|
-
for (let e in r) if (e === "class") t.class !== r.class && (t.class =
|
|
1588
|
-
else if (e === "style") t.style =
|
|
1587
|
+
for (let e in r) if (e === "class") t.class !== r.class && (t.class = z([t.class, r.class]));
|
|
1588
|
+
else if (e === "style") t.style = le([t.style, r.style]);
|
|
1589
1589
|
else if (C(e)) {
|
|
1590
1590
|
let n = t[e], i = r[e];
|
|
1591
1591
|
i && n !== i && !(k(n) && n.includes(i)) ? t[e] = n ? [].concat(n, i) : i : i == null && n == null && !w(e) && (t[e] = i);
|
|
@@ -1595,7 +1595,7 @@ function jr(...e) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
var Mr = null, Nr = () => Mr || In, Pr;
|
|
1597
1597
|
{
|
|
1598
|
-
let e =
|
|
1598
|
+
let e = ce(), t = (t, n) => {
|
|
1599
1599
|
let r;
|
|
1600
1600
|
return (r = e[t]) || (r = e[t] = []), r.push(n), (e) => {
|
|
1601
1601
|
r.length > 1 ? r.forEach((t) => t(e)) : r[0](e);
|
|
@@ -1615,7 +1615,7 @@ function Ir(e) {
|
|
|
1615
1615
|
var Lr = !1;
|
|
1616
1616
|
process.env.NODE_ENV;
|
|
1617
1617
|
function Rr(e) {
|
|
1618
|
-
return e.exposed ? e.exposeProxy ||= new Proxy(Lt(
|
|
1618
|
+
return e.exposed ? e.exposeProxy ||= new Proxy(Lt(Dt(e.exposed)), {
|
|
1619
1619
|
get(t, n) {
|
|
1620
1620
|
if (n in t) return t[n];
|
|
1621
1621
|
if (n in Jn) return Jn[n](e);
|
|
@@ -1666,9 +1666,9 @@ function Gr() {
|
|
|
1666
1666
|
"VueInstance"
|
|
1667
1667
|
];
|
|
1668
1668
|
if (/* @__PURE__ */ kt(t)) {
|
|
1669
|
-
|
|
1669
|
+
Oe();
|
|
1670
1670
|
let n = t.value;
|
|
1671
|
-
return
|
|
1671
|
+
return ke(), [
|
|
1672
1672
|
"div",
|
|
1673
1673
|
{},
|
|
1674
1674
|
[
|
|
@@ -1680,25 +1680,25 @@ function Gr() {
|
|
|
1680
1680
|
s(n),
|
|
1681
1681
|
">"
|
|
1682
1682
|
];
|
|
1683
|
-
} else if (/* @__PURE__ */
|
|
1683
|
+
} else if (/* @__PURE__ */ wt(t)) return [
|
|
1684
1684
|
"div",
|
|
1685
1685
|
{},
|
|
1686
1686
|
[
|
|
1687
1687
|
"span",
|
|
1688
1688
|
e,
|
|
1689
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ K(t) ? "ShallowReactive" : "Reactive"
|
|
1690
1690
|
],
|
|
1691
1691
|
"<",
|
|
1692
1692
|
s(t),
|
|
1693
|
-
`>${/* @__PURE__ */
|
|
1693
|
+
`>${/* @__PURE__ */ Tt(t) ? " (readonly)" : ""}`
|
|
1694
1694
|
];
|
|
1695
|
-
else if (/* @__PURE__ */
|
|
1695
|
+
else if (/* @__PURE__ */ Tt(t)) return [
|
|
1696
1696
|
"div",
|
|
1697
1697
|
{},
|
|
1698
1698
|
[
|
|
1699
1699
|
"span",
|
|
1700
1700
|
e,
|
|
1701
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ K(t) ? "ShallowReadonly" : "Readonly"
|
|
1702
1702
|
],
|
|
1703
1703
|
"<",
|
|
1704
1704
|
s(t),
|
|
@@ -1719,7 +1719,7 @@ function Gr() {
|
|
|
1719
1719
|
};
|
|
1720
1720
|
function a(e) {
|
|
1721
1721
|
let t = [];
|
|
1722
|
-
e.type.props && e.props && t.push(o("props", /* @__PURE__ */
|
|
1722
|
+
e.type.props && e.props && t.push(o("props", /* @__PURE__ */ q(e.props))), e.setupState !== x && t.push(o("setup", e.setupState)), e.data !== x && t.push(o("data", /* @__PURE__ */ q(e.data)));
|
|
1723
1723
|
let n = c(e, "computed");
|
|
1724
1724
|
n && t.push(o("computed", n));
|
|
1725
1725
|
let i = c(e, "inject");
|
|
@@ -1772,7 +1772,7 @@ function Gr() {
|
|
|
1772
1772
|
"span",
|
|
1773
1773
|
r,
|
|
1774
1774
|
e
|
|
1775
|
-
] : N(e) ? ["object", { object: i ? /* @__PURE__ */
|
|
1775
|
+
] : N(e) ? ["object", { object: i ? /* @__PURE__ */ q(e) : e }] : [
|
|
1776
1776
|
"span",
|
|
1777
1777
|
n,
|
|
1778
1778
|
String(e)
|
|
@@ -1790,7 +1790,7 @@ function Gr() {
|
|
|
1790
1790
|
if (k(r) && r.includes(t) || N(r) && t in r || e.extends && l(e.extends, t, n) || e.mixins && e.mixins.some((e) => l(e, t, n))) return !0;
|
|
1791
1791
|
}
|
|
1792
1792
|
function u(e) {
|
|
1793
|
-
return /* @__PURE__ */
|
|
1793
|
+
return /* @__PURE__ */ K(e) ? "ShallowRef" : e.effect ? "ComputedRef" : "Ref";
|
|
1794
1794
|
}
|
|
1795
1795
|
window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
|
|
1796
1796
|
}
|
|
@@ -2403,13 +2403,13 @@ function Wi(e) {
|
|
|
2403
2403
|
};
|
|
2404
2404
|
I.value.push(n), I.value.length > Ri && I.value.splice(0, I.value.length - Ri), Pt(I), A?.(n), te && console.log(`%c[Agent] ${e}`, "color:#667eea;font-weight:bold", t);
|
|
2405
2405
|
}
|
|
2406
|
-
let
|
|
2406
|
+
let ae = (e) => {
|
|
2407
2407
|
I.value.push(e), I.value.length > Ri && I.value.splice(0, I.value.length - Ri), Pt(I);
|
|
2408
|
-
},
|
|
2409
|
-
function
|
|
2410
|
-
if (!
|
|
2408
|
+
}, oe = /* @__PURE__ */ jt([]), se = 0, ce = !!ee || !!j;
|
|
2409
|
+
function le(e, t, n, r = {}) {
|
|
2410
|
+
if (!ce) return null;
|
|
2411
2411
|
let i = {
|
|
2412
|
-
id: `span-${++
|
|
2412
|
+
id: `span-${++se}`,
|
|
2413
2413
|
parentId: e,
|
|
2414
2414
|
name: n,
|
|
2415
2415
|
type: t,
|
|
@@ -2417,12 +2417,12 @@ function Wi(e) {
|
|
|
2417
2417
|
status: "ok",
|
|
2418
2418
|
attributes: r
|
|
2419
2419
|
};
|
|
2420
|
-
return
|
|
2420
|
+
return oe.value.push(i), oe.value.length > Ri && oe.value.splice(0, oe.value.length - Ri), Pt(oe), i;
|
|
2421
2421
|
}
|
|
2422
|
-
function
|
|
2423
|
-
!e || !
|
|
2422
|
+
function ue(e, t = "ok", n) {
|
|
2423
|
+
!e || !ce || (e.endTs = Date.now(), e.durationMs = e.endTs - e.startTs, e.status = t, n && Object.assign(e.attributes, n), Pt(oe), ee?.(e));
|
|
2424
2424
|
}
|
|
2425
|
-
let
|
|
2425
|
+
let de = [...x.flatMap((e) => e.tools || []), ...b], R = e.llm ?? new n({
|
|
2426
2426
|
apiKey: t,
|
|
2427
2427
|
model: c,
|
|
2428
2428
|
temperature: l,
|
|
@@ -2433,44 +2433,44 @@ function Wi(e) {
|
|
|
2433
2433
|
...m
|
|
2434
2434
|
},
|
|
2435
2435
|
...p ? { modelKwargs: p } : {}
|
|
2436
|
-
}),
|
|
2437
|
-
function
|
|
2438
|
-
|
|
2436
|
+
}), fe = de.length > 0 ? R.bindTools?.(de) ?? R : R;
|
|
2437
|
+
function z() {
|
|
2438
|
+
fe = de.length > 0 ? R.bindTools?.(de) ?? R : R;
|
|
2439
2439
|
}
|
|
2440
|
-
let
|
|
2441
|
-
function
|
|
2440
|
+
let B = ui(), pe = .25, me = /* @__PURE__ */ new Set(["mission", "workingMemory"]);
|
|
2441
|
+
function V() {
|
|
2442
2442
|
let e = v || "你是一个智能助手。", t = [];
|
|
2443
2443
|
for (let e of x) if (e.augmentPrompt) {
|
|
2444
|
-
let n = e.augmentPrompt(
|
|
2444
|
+
let n = e.augmentPrompt(B);
|
|
2445
2445
|
n && t.push({
|
|
2446
2446
|
name: e.name,
|
|
2447
2447
|
text: n,
|
|
2448
2448
|
tokens: X(n),
|
|
2449
|
-
pin:
|
|
2449
|
+
pin: me.has(e.name)
|
|
2450
2450
|
});
|
|
2451
2451
|
}
|
|
2452
|
-
let n = Math.max(2e3, Math.round(P.contextWindow *
|
|
2452
|
+
let n = Math.max(2e3, Math.round(P.contextWindow * pe)), r = X(e) + t.reduce((e, t) => e + t.tokens, 0);
|
|
2453
2453
|
if (r > n) {
|
|
2454
2454
|
let e = r, i = [];
|
|
2455
2455
|
for (let e of t.filter((e) => !e.pin).sort((e, t) => t.tokens - e.tokens)) {
|
|
2456
2456
|
if (r <= n) break;
|
|
2457
2457
|
i.push(`${e.name}(${e.tokens})`), r -= e.tokens, e.text = "";
|
|
2458
2458
|
}
|
|
2459
|
-
i.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${P.contextWindow} 的 ${
|
|
2459
|
+
i.length && console.warn(`[page-agent-sdk] 系统段超预算(${e} > ${n} tokens,窗口 ${P.contextWindow} 的 ${pe * 100}%),drop 非核心段:${i.join(", ")}(保 base/mission/workingMemory)`);
|
|
2460
2460
|
}
|
|
2461
2461
|
return [e, ...t.filter((e) => e.text).map((e) => e.text)].join("\n\n");
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2464
|
-
let t = [new o(
|
|
2463
|
+
function he(e) {
|
|
2464
|
+
let t = [new o(V())];
|
|
2465
2465
|
for (let n of e) n.role === "user" ? t.push(new a(n.content)) : n.role === "assistant" ? t.push(new i(n.content)) : n.role === "system" && t.push(new o(n.content));
|
|
2466
2466
|
return t;
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2469
|
-
let t = e[0] &&
|
|
2470
|
-
return [new o(
|
|
2468
|
+
function ge(e) {
|
|
2469
|
+
let t = e[0] && ye(e[0]) === "system" ? e.slice(1) : e.slice();
|
|
2470
|
+
return [new o(V()), ...t];
|
|
2471
2471
|
}
|
|
2472
|
-
async function
|
|
2473
|
-
let a = r ??
|
|
2472
|
+
async function _e(e, t, n, r) {
|
|
2473
|
+
let a = r ?? fe, o = {
|
|
2474
2474
|
signal: n,
|
|
2475
2475
|
maxRetries: w,
|
|
2476
2476
|
baseDelayMs: T,
|
|
@@ -2508,14 +2508,14 @@ function Wi(e) {
|
|
|
2508
2508
|
};
|
|
2509
2509
|
if (yi(a) && !e._ctxRetry) {
|
|
2510
2510
|
e._ctxRetry = !0;
|
|
2511
|
-
let i = (e) => X(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + i(t), 0), o =
|
|
2511
|
+
let i = (e) => X(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + i(t), 0), o = H(e.messages, Math.round(P.contextWindow * .3)), s = o.reduce((e, t) => e + i(t), 0);
|
|
2512
2512
|
return L("error", {
|
|
2513
2513
|
stage: "context_overflow_retry",
|
|
2514
2514
|
at: "launch",
|
|
2515
2515
|
beforeTokens: a,
|
|
2516
2516
|
afterTokens: s,
|
|
2517
2517
|
window: P.contextWindow
|
|
2518
|
-
}), console.warn(`[page-agent-sdk] 上下文超限(启动)→ 激进 trim 重试:${a} → ${s} tokens`),
|
|
2518
|
+
}), console.warn(`[page-agent-sdk] 上下文超限(启动)→ 激进 trim 重试:${a} → ${s} tokens`), _e({
|
|
2519
2519
|
...e,
|
|
2520
2520
|
messages: o
|
|
2521
2521
|
}, t, n, r);
|
|
@@ -2557,13 +2557,13 @@ function Wi(e) {
|
|
|
2557
2557
|
};
|
|
2558
2558
|
if (yi(a) && l === null && u === "" && !e._ctxRetry) {
|
|
2559
2559
|
e._ctxRetry = !0;
|
|
2560
|
-
let i = (e) => X(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + i(t), 0), o =
|
|
2560
|
+
let i = (e) => X(typeof e.content == "string" ? e.content : JSON.stringify(e.content)), a = e.messages.reduce((e, t) => e + i(t), 0), o = H(e.messages, Math.round(P.contextWindow * .3)), s = o.reduce((e, t) => e + i(t), 0);
|
|
2561
2561
|
return L("error", {
|
|
2562
2562
|
stage: "context_overflow_retry",
|
|
2563
2563
|
beforeTokens: a,
|
|
2564
2564
|
afterTokens: s,
|
|
2565
2565
|
window: P.contextWindow
|
|
2566
|
-
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${P.contextWindow})`),
|
|
2566
|
+
}), console.warn(`[page-agent-sdk] 上下文超限 → 激进 trim 重试:${a} → ${s} tokens(窗口 ${P.contextWindow})`), _e({
|
|
2567
2567
|
...e,
|
|
2568
2568
|
messages: o
|
|
2569
2569
|
}, t, n, r);
|
|
@@ -2577,8 +2577,8 @@ function Wi(e) {
|
|
|
2577
2577
|
content: u
|
|
2578
2578
|
};
|
|
2579
2579
|
}
|
|
2580
|
-
async function
|
|
2581
|
-
let t =
|
|
2580
|
+
async function ve(e) {
|
|
2581
|
+
let t = de.find((t) => t.name === e.name);
|
|
2582
2582
|
if (!t) return {
|
|
2583
2583
|
content: `工具 "${e.name}" 不存在`,
|
|
2584
2584
|
status: "error"
|
|
@@ -2590,7 +2590,7 @@ function Wi(e) {
|
|
|
2590
2590
|
}, r = await t.invoke(e.args, { configurable: n }), i = typeof r == "string" ? r : JSON.stringify(r);
|
|
2591
2591
|
return i = ti(i, {
|
|
2592
2592
|
files: e.state.files,
|
|
2593
|
-
vfsAvailable:
|
|
2593
|
+
vfsAvailable: de.some((e) => e.name === "vfs_read"),
|
|
2594
2594
|
toolName: e.name,
|
|
2595
2595
|
threshold: re,
|
|
2596
2596
|
passThroughChars: ie
|
|
@@ -2605,15 +2605,15 @@ function Wi(e) {
|
|
|
2605
2605
|
};
|
|
2606
2606
|
}
|
|
2607
2607
|
}
|
|
2608
|
-
function
|
|
2608
|
+
function ye(e) {
|
|
2609
2609
|
return e instanceof a ? "human" : e instanceof i ? "ai" : e instanceof o ? "system" : e instanceof s ? "tool" : "unknown";
|
|
2610
2610
|
}
|
|
2611
|
-
function
|
|
2611
|
+
function H(e, t) {
|
|
2612
2612
|
return Bi(e, t);
|
|
2613
2613
|
}
|
|
2614
|
-
function
|
|
2614
|
+
function be(e) {
|
|
2615
2615
|
return !te && !A ? [] : e.map((e) => {
|
|
2616
|
-
let t =
|
|
2616
|
+
let t = ye(e), n = { role: t === "human" ? "user" : t === "ai" ? "assistant" : t }, r = typeof e.content == "string" ? e.content : JSON.stringify(e.content);
|
|
2617
2617
|
r && (n.content = r.length > zi ? r.slice(0, zi) + `…(截断 ${r.length - zi} 字符)` : r);
|
|
2618
2618
|
let i = e.tool_calls;
|
|
2619
2619
|
Array.isArray(i) && i.length && (n.tool_calls = i.map((e) => ({
|
|
@@ -2628,20 +2628,20 @@ function Wi(e) {
|
|
|
2628
2628
|
return a && (n.tool_call_id = a), n;
|
|
2629
2629
|
});
|
|
2630
2630
|
}
|
|
2631
|
-
async function
|
|
2632
|
-
I.value = [],
|
|
2631
|
+
async function xe(e, t, n) {
|
|
2632
|
+
I.value = [], oe.value = [], se = 0, B = ui(), B.messages = e, B = await xi(x, B);
|
|
2633
2633
|
let r = e;
|
|
2634
2634
|
for (let e of x) if (e.compressInput) {
|
|
2635
|
-
let t =
|
|
2636
|
-
r = Array.isArray(n) ? n : n.messages, n && !Array.isArray(n) && n.stats ? (
|
|
2637
|
-
...
|
|
2635
|
+
let t = le(void 0, "compression", `compress:${e.name}`, {}), n = await e.compressInput(r);
|
|
2636
|
+
r = Array.isArray(n) ? n : n.messages, n && !Array.isArray(n) && n.stats ? (B = {
|
|
2637
|
+
...B,
|
|
2638
2638
|
lastCompression: n.stats
|
|
2639
|
-
},
|
|
2639
|
+
}, ue(t, "ok", { stats: n.stats })) : ue(t);
|
|
2640
2640
|
}
|
|
2641
2641
|
{
|
|
2642
|
-
let e = X(v || "你是一个智能助手。"), n = Math.max(2e3, Math.round(P.contextWindow *
|
|
2642
|
+
let e = X(v || "你是一个智能助手。"), n = Math.max(2e3, Math.round(P.contextWindow * pe));
|
|
2643
2643
|
if (e > n) {
|
|
2644
|
-
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${n} tokens,窗口 ${P.contextWindow} 的 ${
|
|
2644
|
+
let r = `[page-agent-sdk] systemPrompt 本身(${e} tokens)超过系统段预算(${n} tokens,窗口 ${P.contextWindow} 的 ${pe * 100}%);请缩减 systemPrompt 或换更大窗口模型`;
|
|
2645
2645
|
return console.error(r), t({
|
|
2646
2646
|
type: "error",
|
|
2647
2647
|
message: r,
|
|
@@ -2653,13 +2653,13 @@ function Wi(e) {
|
|
|
2653
2653
|
}), "";
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
2656
|
-
let i =
|
|
2656
|
+
let i = he(r);
|
|
2657
2657
|
L("context", {
|
|
2658
2658
|
model: c,
|
|
2659
|
-
tools:
|
|
2659
|
+
tools: de.map((e) => e.name),
|
|
2660
2660
|
middleware: x.map((e) => e.name)
|
|
2661
2661
|
});
|
|
2662
|
-
let l = Ei(x, (e) =>
|
|
2662
|
+
let l = Ei(x, (e) => _e(e, t, n)), u = Di(x, ve), d = {
|
|
2663
2663
|
rounds: 0,
|
|
2664
2664
|
maxToolRounds: N,
|
|
2665
2665
|
invokeUsage: {
|
|
@@ -2670,7 +2670,7 @@ function Wi(e) {
|
|
|
2670
2670
|
writeFailures: {},
|
|
2671
2671
|
budgetHinted: !1
|
|
2672
2672
|
};
|
|
2673
|
-
|
|
2673
|
+
B.loopProgress = d;
|
|
2674
2674
|
let f = 0, p = 0, m = Vi(N, C), h = null, g = 0, b = !1, S = 0;
|
|
2675
2675
|
try {
|
|
2676
2676
|
for (; (f < N || b) && p < m && (p++, !n?.aborted);) {
|
|
@@ -2695,38 +2695,38 @@ function Wi(e) {
|
|
|
2695
2695
|
content: e
|
|
2696
2696
|
}), e;
|
|
2697
2697
|
}
|
|
2698
|
-
let e =
|
|
2698
|
+
let e = le(void 0, "round", `round ${p}`, { round: p })?.id;
|
|
2699
2699
|
t({
|
|
2700
2700
|
type: "round_start",
|
|
2701
2701
|
round: p
|
|
2702
|
-
}),
|
|
2702
|
+
}), B = Si(x, {
|
|
2703
2703
|
messages: i,
|
|
2704
|
-
state:
|
|
2705
|
-
}), i =
|
|
2706
|
-
let r =
|
|
2704
|
+
state: B
|
|
2705
|
+
}), i = ge(i), i = H(i, Math.round(P.contextWindow * .6));
|
|
2706
|
+
let r = le(e, "model", c, {
|
|
2707
2707
|
round: f + 1,
|
|
2708
|
-
tools:
|
|
2708
|
+
tools: de.map((e) => e.name)
|
|
2709
2709
|
});
|
|
2710
2710
|
L("llm_request", {
|
|
2711
2711
|
round: f + 1,
|
|
2712
2712
|
model: c,
|
|
2713
|
-
tools:
|
|
2714
|
-
messages:
|
|
2713
|
+
tools: de.map((e) => e.name),
|
|
2714
|
+
messages: be(i)
|
|
2715
2715
|
});
|
|
2716
2716
|
let o = await l({
|
|
2717
2717
|
messages: i,
|
|
2718
|
-
state:
|
|
2718
|
+
state: B
|
|
2719
2719
|
});
|
|
2720
2720
|
i.push(o.message), L("llm_response", {
|
|
2721
2721
|
round: f + 1,
|
|
2722
2722
|
content: o.content,
|
|
2723
2723
|
toolCalls: o.toolCalls
|
|
2724
|
-
}),
|
|
2724
|
+
}), ue(r, o.aborted ? "timeout" : "ok", { usage: _(o.message) });
|
|
2725
2725
|
{
|
|
2726
2726
|
let e = y(o.message);
|
|
2727
2727
|
e && (d.invokeUsage.prompt_tokens += e.prompt_tokens ?? 0, d.invokeUsage.completion_tokens += e.completion_tokens ?? 0, d.invokeUsage.total_tokens += e.total_tokens ?? 0);
|
|
2728
2728
|
}
|
|
2729
|
-
if (
|
|
2729
|
+
if (B = Ci(x, o, B), o.aborted) return t({
|
|
2730
2730
|
type: "done",
|
|
2731
2731
|
content: o.content
|
|
2732
2732
|
}), o.content;
|
|
@@ -2772,17 +2772,17 @@ function Wi(e) {
|
|
|
2772
2772
|
}), i.push(new a("⚠️ 你刚才输出的是计划/过渡性表述(如「我先看看」「稍后委派」),任务尚未完成。请立即继续执行 —— 调用所需工具把任务做完,全部完成后再给出总结回复。"));
|
|
2773
2773
|
continue;
|
|
2774
2774
|
}
|
|
2775
|
-
if (!e && O > 0 &&
|
|
2775
|
+
if (!e && O > 0 && B.verifyAttempts < O) {
|
|
2776
2776
|
let e = await Ti(x, {
|
|
2777
2777
|
messages: i,
|
|
2778
|
-
state:
|
|
2778
|
+
state: B,
|
|
2779
2779
|
response: o,
|
|
2780
2780
|
log: (e, t) => L(e, t)
|
|
2781
2781
|
});
|
|
2782
2782
|
if (e) {
|
|
2783
|
-
h = o.content,
|
|
2783
|
+
h = o.content, B.verifyAttempts += 1, i.push(new a(`⚠️ 验证未通过,请修正:${e}`)), L("middleware", {
|
|
2784
2784
|
stage: "verify_retry",
|
|
2785
|
-
attempt:
|
|
2785
|
+
attempt: B.verifyAttempts,
|
|
2786
2786
|
feedback: e
|
|
2787
2787
|
});
|
|
2788
2788
|
continue;
|
|
@@ -2810,19 +2810,20 @@ function Wi(e) {
|
|
|
2810
2810
|
id: r,
|
|
2811
2811
|
name: e.name,
|
|
2812
2812
|
args: e.args,
|
|
2813
|
-
state:
|
|
2813
|
+
state: B,
|
|
2814
2814
|
signal: n,
|
|
2815
2815
|
emit: t,
|
|
2816
|
-
logSink:
|
|
2816
|
+
logSink: ae
|
|
2817
2817
|
}
|
|
2818
2818
|
};
|
|
2819
2819
|
}), v = await ni(m, D, async (r) => {
|
|
2820
2820
|
if (n?.aborted) return;
|
|
2821
|
-
let i =
|
|
2821
|
+
let i = le(e, "tool", r.call.name, { name: r.call.name }), a = Date.now();
|
|
2822
2822
|
t({
|
|
2823
2823
|
type: "tool_call",
|
|
2824
2824
|
name: r.call.name,
|
|
2825
|
-
args: r.call.args
|
|
2825
|
+
args: r.call.args,
|
|
2826
|
+
id: r.id
|
|
2826
2827
|
}), L("tool_call", {
|
|
2827
2828
|
round: f + 1,
|
|
2828
2829
|
name: r.call.name,
|
|
@@ -2845,14 +2846,15 @@ function Wi(e) {
|
|
|
2845
2846
|
name: r.call.name,
|
|
2846
2847
|
result: o.content,
|
|
2847
2848
|
status: o.status,
|
|
2848
|
-
durationMs: s
|
|
2849
|
+
durationMs: s,
|
|
2850
|
+
id: r.id
|
|
2849
2851
|
}), L("tool_result", {
|
|
2850
2852
|
round: f + 1,
|
|
2851
2853
|
name: r.call.name,
|
|
2852
2854
|
result: o.content,
|
|
2853
2855
|
status: o.status,
|
|
2854
2856
|
durationMs: s
|
|
2855
|
-
}),
|
|
2857
|
+
}), ue(i, o.status === "error" ? "error" : "ok", { resultSnippet: String(o.content).slice(0, 100) }), o;
|
|
2856
2858
|
}, n);
|
|
2857
2859
|
for (let e = 0; e < m.length; e++) {
|
|
2858
2860
|
let t = v[e];
|
|
@@ -2879,19 +2881,19 @@ function Wi(e) {
|
|
|
2879
2881
|
content: h
|
|
2880
2882
|
}), h;
|
|
2881
2883
|
let e = i[i.length - 1];
|
|
2882
|
-
if (e &&
|
|
2883
|
-
let e = i[0] &&
|
|
2884
|
+
if (e && ye(e) === "tool") {
|
|
2885
|
+
let e = i[0] && ye(i[0]) === "system" ? i.slice(1) : i.slice(), r = [new o(V() + "\n\n工具调用次数已达上限,请基于已有工具结果直接给出最终回答,不要再调用工具。"), ...e];
|
|
2884
2886
|
L("llm_request", {
|
|
2885
2887
|
round: "wrap_up",
|
|
2886
2888
|
model: c,
|
|
2887
2889
|
tools: [],
|
|
2888
|
-
messages:
|
|
2890
|
+
messages: be(r)
|
|
2889
2891
|
});
|
|
2890
|
-
let a = await Ei(x, (e) =>
|
|
2892
|
+
let a = await Ei(x, (e) => _e(e, t, n, R))({
|
|
2891
2893
|
messages: r,
|
|
2892
|
-
state:
|
|
2894
|
+
state: B
|
|
2893
2895
|
});
|
|
2894
|
-
if (
|
|
2896
|
+
if (B = Ci(x, a, B), L("llm_response", {
|
|
2895
2897
|
round: "wrap_up",
|
|
2896
2898
|
content: a.content
|
|
2897
2899
|
}), a.aborted) return t({
|
|
@@ -2926,41 +2928,41 @@ function Wi(e) {
|
|
|
2926
2928
|
}), r;
|
|
2927
2929
|
} finally {
|
|
2928
2930
|
try {
|
|
2929
|
-
await wi(x,
|
|
2931
|
+
await wi(x, B);
|
|
2930
2932
|
} catch (e) {
|
|
2931
2933
|
let t = Zr(e, "observable");
|
|
2932
2934
|
console.warn("[Agent] afterAgent 清理出错(observable,已忽略):", t.message);
|
|
2933
2935
|
}
|
|
2934
|
-
if (
|
|
2935
|
-
j(
|
|
2936
|
+
if (ce && j) try {
|
|
2937
|
+
j(oe.value, li(oe.value));
|
|
2936
2938
|
} catch {}
|
|
2937
2939
|
}
|
|
2938
2940
|
}
|
|
2939
|
-
async function
|
|
2941
|
+
async function Se(e, t, n) {
|
|
2940
2942
|
let r = "";
|
|
2941
|
-
return await
|
|
2943
|
+
return await xe(e, (e) => {
|
|
2942
2944
|
e.type === "done" && (r = e.content), n?.(e);
|
|
2943
2945
|
}, t), r;
|
|
2944
2946
|
}
|
|
2945
|
-
function Se(e) {
|
|
2946
|
-
ue = [...x.flatMap((e) => e.tools || []), ...e], B();
|
|
2947
|
-
}
|
|
2948
2947
|
function Ce(e) {
|
|
2949
|
-
|
|
2948
|
+
de = [...x.flatMap((e) => e.tools || []), ...e], z();
|
|
2949
|
+
}
|
|
2950
|
+
function we(e) {
|
|
2951
|
+
R = e, z(), M?.(e);
|
|
2950
2952
|
}
|
|
2951
2953
|
return {
|
|
2952
|
-
invoke:
|
|
2953
|
-
stream:
|
|
2954
|
-
getState: () =>
|
|
2954
|
+
invoke: Se,
|
|
2955
|
+
stream: xe,
|
|
2956
|
+
getState: () => B,
|
|
2955
2957
|
get allTools() {
|
|
2956
|
-
return
|
|
2958
|
+
return de;
|
|
2957
2959
|
},
|
|
2958
|
-
setTools:
|
|
2959
|
-
setLlm:
|
|
2960
|
+
setTools: Ce,
|
|
2961
|
+
setLlm: we,
|
|
2960
2962
|
setModelCaps: F,
|
|
2961
2963
|
debugLogs: I,
|
|
2962
|
-
spans:
|
|
2963
|
-
getEffectiveSystemPrompt: () =>
|
|
2964
|
+
spans: oe,
|
|
2965
|
+
getEffectiveSystemPrompt: () => V()
|
|
2964
2966
|
};
|
|
2965
2967
|
}
|
|
2966
2968
|
//#endregion
|
|
@@ -5050,31 +5052,33 @@ function Es(e) {
|
|
|
5050
5052
|
signal: i,
|
|
5051
5053
|
emit: a,
|
|
5052
5054
|
logSink: o
|
|
5053
|
-
}, c = (t, n, r) => (
|
|
5054
|
-
if (
|
|
5055
|
-
|
|
5055
|
+
}, c = (t, n, r, i) => (a) => {
|
|
5056
|
+
if (a.type === "reasoning") {
|
|
5057
|
+
i?.({
|
|
5056
5058
|
type: "subagent",
|
|
5057
5059
|
taskId: t,
|
|
5058
5060
|
label: n,
|
|
5059
5061
|
kind: "reasoning",
|
|
5060
5062
|
name: "",
|
|
5061
|
-
delta:
|
|
5063
|
+
delta: a.delta,
|
|
5064
|
+
toolCallId: r
|
|
5062
5065
|
});
|
|
5063
5066
|
return;
|
|
5064
5067
|
}
|
|
5065
5068
|
e.tracker?.pushStep(t, {
|
|
5066
|
-
kind:
|
|
5067
|
-
name:
|
|
5069
|
+
kind: a.type,
|
|
5070
|
+
name: a.name,
|
|
5068
5071
|
ts: Date.now()
|
|
5069
|
-
}),
|
|
5072
|
+
}), i && i({
|
|
5070
5073
|
type: "subagent",
|
|
5071
5074
|
taskId: t,
|
|
5072
5075
|
label: n,
|
|
5073
|
-
kind:
|
|
5074
|
-
name:
|
|
5075
|
-
args:
|
|
5076
|
-
result:
|
|
5077
|
-
status:
|
|
5076
|
+
kind: a.type,
|
|
5077
|
+
name: a.name,
|
|
5078
|
+
args: a.type === "tool_call" ? a.args : void 0,
|
|
5079
|
+
result: a.type === "tool_result" ? a.result : void 0,
|
|
5080
|
+
status: a.type === "tool_result" ? a.status : void 0,
|
|
5081
|
+
toolCallId: r
|
|
5078
5082
|
});
|
|
5079
5083
|
};
|
|
5080
5084
|
return {
|
|
@@ -5094,7 +5098,7 @@ function Es(e) {
|
|
|
5094
5098
|
prompt: t,
|
|
5095
5099
|
role: n,
|
|
5096
5100
|
model: a
|
|
5097
|
-
}, d, l.signal, c(f, p, l.emit), m, l.emit);
|
|
5101
|
+
}, d, l.signal, c(f, p, l.toolCallId, l.emit), m, l.emit);
|
|
5098
5102
|
return e.tracker?.finish(f, "done", r), r;
|
|
5099
5103
|
} catch (t) {
|
|
5100
5104
|
throw e.tracker?.finish(f, "error", String(t?.message ?? t)), t;
|
|
@@ -5118,7 +5122,7 @@ function Es(e) {
|
|
|
5118
5122
|
}), s = Date.now();
|
|
5119
5123
|
e.tracker?.start(r, t.prompt, a, s);
|
|
5120
5124
|
try {
|
|
5121
|
-
let n = await Ts(t, e, i.signal, c(r, a, i.emit), o, i.emit);
|
|
5125
|
+
let n = await Ts(t, e, i.signal, c(r, a, i.toolCallId, i.emit), o, i.emit);
|
|
5122
5126
|
return e.tracker?.finish(r, "done", n ?? "(未完成)"), {
|
|
5123
5127
|
ok: !0,
|
|
5124
5128
|
text: n ?? "(未完成)"
|
|
@@ -5144,7 +5148,8 @@ function Es(e) {
|
|
|
5144
5148
|
__pgSubagentCall: {
|
|
5145
5149
|
signal: e.signal ?? i,
|
|
5146
5150
|
emit: e.emit ?? a,
|
|
5147
|
-
logSink: e.logSink ?? o
|
|
5151
|
+
logSink: e.logSink ?? o,
|
|
5152
|
+
toolCallId: e.id
|
|
5148
5153
|
}
|
|
5149
5154
|
}, t(e))
|
|
5150
5155
|
};
|
|
@@ -5183,27 +5188,29 @@ function ks(e, n) {
|
|
|
5183
5188
|
signal: i,
|
|
5184
5189
|
emit: a,
|
|
5185
5190
|
logSink: o
|
|
5186
|
-
}, c = (e, t, n) => (
|
|
5187
|
-
if (
|
|
5188
|
-
|
|
5191
|
+
}, c = (e, t, n, r) => (i) => {
|
|
5192
|
+
if (i.type === "reasoning") {
|
|
5193
|
+
r?.({
|
|
5189
5194
|
type: "subagent",
|
|
5190
5195
|
taskId: e,
|
|
5191
5196
|
label: t,
|
|
5192
5197
|
kind: "reasoning",
|
|
5193
5198
|
name: "",
|
|
5194
|
-
delta:
|
|
5199
|
+
delta: i.delta,
|
|
5200
|
+
toolCallId: n
|
|
5195
5201
|
});
|
|
5196
5202
|
return;
|
|
5197
5203
|
}
|
|
5198
|
-
|
|
5204
|
+
r && r({
|
|
5199
5205
|
type: "subagent",
|
|
5200
5206
|
taskId: e,
|
|
5201
5207
|
label: t,
|
|
5202
|
-
kind:
|
|
5203
|
-
name:
|
|
5204
|
-
args:
|
|
5205
|
-
result:
|
|
5206
|
-
status:
|
|
5208
|
+
kind: i.type,
|
|
5209
|
+
name: i.name,
|
|
5210
|
+
args: i.type === "tool_call" ? i.args : void 0,
|
|
5211
|
+
result: i.type === "tool_result" ? i.result : void 0,
|
|
5212
|
+
status: i.type === "tool_result" ? i.status : void 0,
|
|
5213
|
+
toolCallId: n
|
|
5207
5214
|
});
|
|
5208
5215
|
}, l = [], u = [], d;
|
|
5209
5216
|
function f(e) {
|
|
@@ -5241,7 +5248,7 @@ function ks(e, n) {
|
|
|
5241
5248
|
if (!e.ok) return g("conflict", { heldBy: e.heldBy }), `COMPONENT_BUSY · 组件 [${h.join(", ")}] 正在被子 agent(${e.heldBy})修改,本次委派未执行。同一组件同一时间只能有一个委派在途;请先做其他组件,或等该委派结束后(下一轮)再重试本组件。`;
|
|
5242
5249
|
m = e.release, g("acquire");
|
|
5243
5250
|
}
|
|
5244
|
-
let _ = c(`use_${l.id}`, l.id, i.emit), v = u ? (e) => {
|
|
5251
|
+
let _ = c(`use_${l.id}`, l.id, i.toolCallId, i.emit), v = u ? (e) => {
|
|
5245
5252
|
e.type !== "reasoning" && u.pushStep(d, {
|
|
5246
5253
|
kind: e.type,
|
|
5247
5254
|
name: e.name,
|
|
@@ -5307,7 +5314,8 @@ function ks(e, n) {
|
|
|
5307
5314
|
__pgSubagentCall: {
|
|
5308
5315
|
signal: e.signal ?? i,
|
|
5309
5316
|
emit: e.emit ?? a,
|
|
5310
|
-
logSink: e.logSink ?? o
|
|
5317
|
+
logSink: e.logSink ?? o,
|
|
5318
|
+
toolCallId: e.id
|
|
5311
5319
|
}
|
|
5312
5320
|
}, t(e))
|
|
5313
5321
|
};
|
|
@@ -7536,6 +7544,10 @@ var Rl = [
|
|
|
7536
7544
|
name: "agentCompression",
|
|
7537
7545
|
defaultOn: !1,
|
|
7538
7546
|
requires: ["summarization"]
|
|
7547
|
+
},
|
|
7548
|
+
{
|
|
7549
|
+
name: "preferences",
|
|
7550
|
+
defaultOn: !1
|
|
7539
7551
|
}
|
|
7540
7552
|
];
|
|
7541
7553
|
function zl(e) {
|
|
@@ -9325,7 +9337,7 @@ function Fu(e, n = {}) {
|
|
|
9325
9337
|
})
|
|
9326
9338
|
});
|
|
9327
9339
|
A(L);
|
|
9328
|
-
let
|
|
9340
|
+
let ae = r(async ({ jsonPath: e }) => {
|
|
9329
9341
|
let t = e || "", n = t ? Ji(o, t) : o;
|
|
9330
9342
|
return n ? `schema${t ? ` @ ${t}` : ""} = ${Q(sa(n))}` : Y({
|
|
9331
9343
|
code: "PATH_DENIED",
|
|
@@ -9336,7 +9348,7 @@ function Fu(e, n = {}) {
|
|
|
9336
9348
|
name: "schema_data",
|
|
9337
9349
|
description: "查看主数据(或子路径)的字段约束:类型/min/max/enum/必填/默认值/嵌套 shape。写前查约束,避免写错重试。不传 jsonPath 查根;传子路径(如 components.0)查该位置约束。",
|
|
9338
9350
|
schema: t.object({ jsonPath: t.string().optional().describe("要查约束的子路径;不传查根 schema") })
|
|
9339
|
-
}),
|
|
9351
|
+
}), oe = r(async ({ snapshotId: e, against: t }) => {
|
|
9340
9352
|
let n = t != null, r, i;
|
|
9341
9353
|
if (n) {
|
|
9342
9354
|
let e = t;
|
|
@@ -9368,7 +9380,7 @@ function Fu(e, n = {}) {
|
|
|
9368
9380
|
snapshotId: t.number().int().optional().describe("对比的快照序号;不传则最近一次"),
|
|
9369
9381
|
against: t.unknown().optional().describe("对比的一段 JSON 值(与 snapshotId 互斥;传则忽略快照)")
|
|
9370
9382
|
})
|
|
9371
|
-
}),
|
|
9383
|
+
}), se = [];
|
|
9372
9384
|
if (n.vfsStore) {
|
|
9373
9385
|
let e = n.vfsStore, i = (e) => `drafts/${e}.json`, c = r(({ draftId: t, chunk: n, mode: r }) => {
|
|
9374
9386
|
let a = i(t), o = e.files[a], s = r === "append" && o, c = s ? o.content + n : n;
|
|
@@ -9433,9 +9445,9 @@ function Fu(e, n = {}) {
|
|
|
9433
9445
|
expectedHash: t.string().optional().describe("乐观锁:改前 read/get 返回的 hash;传入则校验,不一致拒绝写入防覆盖。不传则自动用你最后读到的 hash(autoLock)")
|
|
9434
9446
|
})
|
|
9435
9447
|
});
|
|
9436
|
-
A(u),
|
|
9448
|
+
A(u), se.push(c, u);
|
|
9437
9449
|
}
|
|
9438
|
-
let
|
|
9450
|
+
let ce = [];
|
|
9439
9451
|
if (e.resources?.length && d) {
|
|
9440
9452
|
let e = r(async ({ path: e, handle: t }) => {
|
|
9441
9453
|
let n = e;
|
|
@@ -9539,9 +9551,9 @@ function Fu(e, n = {}) {
|
|
|
9539
9551
|
handle: t.string().optional().describe("占位符句柄(与 path 二选一)")
|
|
9540
9552
|
})
|
|
9541
9553
|
});
|
|
9542
|
-
A(a),
|
|
9554
|
+
A(a), ce.push(e, n, i, a);
|
|
9543
9555
|
}
|
|
9544
|
-
let
|
|
9556
|
+
let le = [
|
|
9545
9557
|
ee,
|
|
9546
9558
|
j,
|
|
9547
9559
|
M,
|
|
@@ -9554,23 +9566,23 @@ function Fu(e, n = {}) {
|
|
|
9554
9566
|
F,
|
|
9555
9567
|
I,
|
|
9556
9568
|
L,
|
|
9557
|
-
R,
|
|
9558
9569
|
ae,
|
|
9559
|
-
|
|
9560
|
-
...se
|
|
9570
|
+
oe,
|
|
9571
|
+
...se,
|
|
9572
|
+
...ce
|
|
9561
9573
|
];
|
|
9562
|
-
Object.defineProperty(
|
|
9574
|
+
Object.defineProperty(le, "controller", {
|
|
9563
9575
|
value: E,
|
|
9564
9576
|
enumerable: !1,
|
|
9565
9577
|
configurable: !1,
|
|
9566
9578
|
writable: !1
|
|
9567
9579
|
});
|
|
9568
|
-
for (let e of
|
|
9580
|
+
for (let e of le) Object.defineProperty(e, "__dataOpsScoped", {
|
|
9569
9581
|
value: !0,
|
|
9570
9582
|
enumerable: !1,
|
|
9571
9583
|
configurable: !1
|
|
9572
9584
|
});
|
|
9573
|
-
return
|
|
9585
|
+
return le;
|
|
9574
9586
|
}
|
|
9575
9587
|
//#endregion
|
|
9576
9588
|
//#region src/core/tools/fetchDoc.ts
|
|
@@ -9945,24 +9957,236 @@ function pd(e = {}) {
|
|
|
9945
9957
|
dispose() {}
|
|
9946
9958
|
};
|
|
9947
9959
|
}
|
|
9948
|
-
|
|
9949
|
-
|
|
9960
|
+
//#endregion
|
|
9961
|
+
//#region src/core/backends/preferenceStore.ts
|
|
9962
|
+
var md = [
|
|
9963
|
+
"color",
|
|
9964
|
+
"copy",
|
|
9965
|
+
"layout",
|
|
9966
|
+
"interaction",
|
|
9967
|
+
"tech",
|
|
9968
|
+
"other"
|
|
9969
|
+
], hd = "v:1::pref-store", gd = "chat-sdk";
|
|
9970
|
+
function _d(e, t, n) {
|
|
9971
|
+
return `${hd}::${e}::${t}::${n}`;
|
|
9972
|
+
}
|
|
9973
|
+
function vd(e, t) {
|
|
9974
|
+
return `${hd}::${e}::${t}::`;
|
|
9975
|
+
}
|
|
9976
|
+
function yd() {
|
|
9977
|
+
return `pref-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
9978
|
+
}
|
|
9979
|
+
function bd(e = {}) {
|
|
9980
|
+
let t = e.dbName ?? gd, n = e.backend ?? "indexed", r = e.id ?? "", i = e.maxEntries ?? 20, a, o, s = new Promise((e) => {
|
|
9981
|
+
o = e;
|
|
9982
|
+
});
|
|
9983
|
+
(async () => {
|
|
9984
|
+
try {
|
|
9985
|
+
if (n === "indexed") {
|
|
9986
|
+
if (typeof indexedDB > "u") throw Error("indexedDB 不可用");
|
|
9987
|
+
a = await Ml(t), o(!0);
|
|
9988
|
+
} else if (n === "session") {
|
|
9989
|
+
if (typeof sessionStorage > "u") throw Error("sessionStorage 不可用");
|
|
9990
|
+
a = Nl(sessionStorage), o(!0);
|
|
9991
|
+
} else if (n === "local") {
|
|
9992
|
+
if (typeof localStorage > "u") throw Error("localStorage 不可用");
|
|
9993
|
+
a = Nl(localStorage), o(!0);
|
|
9994
|
+
} else a = jl(), o(!1);
|
|
9995
|
+
} catch {
|
|
9996
|
+
a = jl(), o(!1);
|
|
9997
|
+
}
|
|
9998
|
+
})();
|
|
9999
|
+
async function c() {
|
|
10000
|
+
let e = [];
|
|
10001
|
+
return await a.scan(vd(t, r), (t, n) => {
|
|
10002
|
+
e.push(n);
|
|
10003
|
+
}), e;
|
|
10004
|
+
}
|
|
10005
|
+
return {
|
|
10006
|
+
ready: s,
|
|
10007
|
+
async list() {
|
|
10008
|
+
return (await c()).sort((e, t) => t.updatedAt - e.updatedAt);
|
|
10009
|
+
},
|
|
10010
|
+
async put(e) {
|
|
10011
|
+
let n = await c(), o = Date.now(), s = n.reduce((e, t) => Math.max(e, t.updatedAt), 0), l = n.find((t) => t.topic === e.topic), u = {
|
|
10012
|
+
id: e.id ?? l?.id ?? yd(),
|
|
10013
|
+
content: e.content,
|
|
10014
|
+
topic: e.topic,
|
|
10015
|
+
sourceSessionId: l?.sourceSessionId ?? e.sourceSessionId,
|
|
10016
|
+
sourceRound: l?.sourceRound ?? e.sourceRound,
|
|
10017
|
+
createdAt: l?.createdAt ?? o,
|
|
10018
|
+
updatedAt: Math.max(o, s + 1)
|
|
10019
|
+
};
|
|
10020
|
+
l && l.id !== u.id && await a.del(_d(t, r, l.id));
|
|
10021
|
+
try {
|
|
10022
|
+
await a.set(_d(t, r, u.id), u);
|
|
10023
|
+
} catch (e) {
|
|
10024
|
+
Cl(e) && (a = jl(), await a.set(_d(t, r, u.id), u));
|
|
10025
|
+
}
|
|
10026
|
+
let d = await c();
|
|
10027
|
+
if (d.length > i) {
|
|
10028
|
+
let e = d.sort((e, t) => e.updatedAt - t.updatedAt).slice(0, d.length - i);
|
|
10029
|
+
for (let n of e) await a.del(_d(t, r, n.id));
|
|
10030
|
+
}
|
|
10031
|
+
return u;
|
|
10032
|
+
},
|
|
10033
|
+
async remove(e) {
|
|
10034
|
+
let n = _d(t, r, e);
|
|
10035
|
+
return await a.get(n) == null ? !1 : (await a.del(n), !0);
|
|
10036
|
+
},
|
|
10037
|
+
async clear() {
|
|
10038
|
+
await a.clearPrefix(vd(t, r));
|
|
10039
|
+
},
|
|
10040
|
+
dispose() {}
|
|
10041
|
+
};
|
|
10042
|
+
}
|
|
10043
|
+
//#endregion
|
|
10044
|
+
//#region src/core/harness/preferences.ts
|
|
10045
|
+
var xd = {
|
|
10046
|
+
color: "颜色",
|
|
10047
|
+
copy: "文案",
|
|
10048
|
+
layout: "排版",
|
|
10049
|
+
interaction: "交互",
|
|
10050
|
+
tech: "技术",
|
|
10051
|
+
other: "其他"
|
|
10052
|
+
}, Sd = [
|
|
10053
|
+
/^(?:请|帮我|麻烦)?你?记住[::,,、]?\s*(.{4,200})/,
|
|
10054
|
+
/^(?:从)?今后(?:开始|起)?[::,,]?\s*(.{4,200})/,
|
|
10055
|
+
/^以后(?:都|全都|总是|尽量)?[::,,]?\s*(.{4,200})/
|
|
10056
|
+
], Cd = /(?:不要|别再|别用|别加|太(?:艳|花|亮|暗|大|小|密|挤|乱|复杂|素|少)|不喜欢|讨厌|希望|更喜欢|偏好|永远|一律|统一保持|保持统一)/, wd = [
|
|
10057
|
+
["layout", /布局|排版|间距|留白|密度|居中|对齐|栅格|边距|紧凑|圆角|分栏|层级|大小|尺寸/],
|
|
10058
|
+
["copy", /文案|文字|标题|副标题|字体|字号|措辞|语气|口语|书面|简洁|简短|详尽|emoji|表情/],
|
|
10059
|
+
["interaction", /动画|动效|过渡|交互|悬停|hover|点击反馈|弹窗|提示|加载|滚动/],
|
|
10060
|
+
["tech", /代码|框架|组件|技术|写法|命名|注释|依赖|版本|接口/],
|
|
10061
|
+
["color", /颜色|配色|色调|色彩|深色|浅色|饱和|渐变|紫|红|橙|黄|绿|青|蓝|粉|棕|灰|黑|白|金|银/]
|
|
10062
|
+
];
|
|
10063
|
+
function Td(e) {
|
|
10064
|
+
for (let [t, n] of wd) if (n.test(e)) return t;
|
|
10065
|
+
return "other";
|
|
10066
|
+
}
|
|
10067
|
+
function Ed(e) {
|
|
10068
|
+
let t = e.trim();
|
|
10069
|
+
if (!(!t || t.length > 500)) for (let e of Sd) {
|
|
10070
|
+
let n = t.match(e);
|
|
10071
|
+
if (n?.[1]) {
|
|
10072
|
+
let e = n[1].trim().replace(/[。.!!]+$/, "");
|
|
10073
|
+
return e.length < 3 ? void 0 : {
|
|
10074
|
+
content: e,
|
|
10075
|
+
topic: Td(e)
|
|
10076
|
+
};
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
10079
|
+
}
|
|
10080
|
+
function Dd(e) {
|
|
10081
|
+
let t = e.trim();
|
|
10082
|
+
return t.length < 4 || t.length > 500 || /^(你好|hi|hello|ok|好的|继续|嗯|谢谢|hey|哈喽|收到|明白)/i.test(t) ? !1 : Cd.test(t);
|
|
10083
|
+
}
|
|
10084
|
+
function Od(e) {
|
|
10085
|
+
return [
|
|
10086
|
+
"你是用户偏好提取器。判断下面的用户消息是否包含「持久偏好」—— 对未来同类工作都适用的口味/规则(如配色口味、文案风格、排版密度),而非仅针对本轮的任务指令。",
|
|
10087
|
+
"只输出 JSON(无任何其他文本):{\"captured\": true, \"content\": \"一句话中性陈述(用户视角,如:不用紫色,偏好低饱和)\", \"topic\": \"color|copy|layout|interaction|tech|other\"} 或 {\"captured\": false, \"content\": \"\", \"topic\": \"other\"}",
|
|
10088
|
+
"判定:用户明确表达喜欢/不喜欢/以后要/不要某类风格 → captured:true;仅本轮的任务要求(如「把这个改成红色」「删掉这个组件」)→ captured:false。宁漏勿误:拿不准一律 false。",
|
|
10089
|
+
"content 用用户原语言表述。",
|
|
10090
|
+
`用户消息:"""${e.slice(0, 800)}"""`
|
|
10091
|
+
].join("\n");
|
|
10092
|
+
}
|
|
10093
|
+
function kd(e) {
|
|
10094
|
+
if (!e) return;
|
|
10095
|
+
let t = (e.match(/```(?:json)?\s*([\s\S]*?)```/)?.[1] ?? e).match(/\{[\s\S]*\}/)?.[0];
|
|
10096
|
+
if (t) try {
|
|
10097
|
+
let e = JSON.parse(t);
|
|
10098
|
+
if (e.captured !== !0) return;
|
|
10099
|
+
let n = typeof e.content == "string" ? e.content.trim().replace(/[。.!!]+$/, "") : "";
|
|
10100
|
+
return n.length < 3 || n.length > 200 ? void 0 : {
|
|
10101
|
+
content: n,
|
|
10102
|
+
topic: md.includes(e.topic) ? e.topic : "other"
|
|
10103
|
+
};
|
|
10104
|
+
} catch {
|
|
10105
|
+
return;
|
|
10106
|
+
}
|
|
10107
|
+
}
|
|
10108
|
+
function Ad(e) {
|
|
10109
|
+
if (!e.length) return;
|
|
10110
|
+
let t = ["## 用户偏好(跨会话沉淀;除非用户本轮另有指示,遵守以下偏好)"];
|
|
10111
|
+
for (let n of e) t.push(`- ${xd[n.topic]}:${n.content}`);
|
|
10112
|
+
return t.join("\n");
|
|
10113
|
+
}
|
|
10114
|
+
function jd(e) {
|
|
10115
|
+
let t = [], n = -1, r = Promise.resolve(), i = (t) => e.onDebug?.({
|
|
10116
|
+
stage: "preferences",
|
|
10117
|
+
...t
|
|
10118
|
+
});
|
|
10119
|
+
function a(n, a, o, s) {
|
|
10120
|
+
r = r.then(() => e.store.put({
|
|
10121
|
+
content: n,
|
|
10122
|
+
topic: a,
|
|
10123
|
+
sourceSessionId: e.getSessionId(),
|
|
10124
|
+
sourceRound: o
|
|
10125
|
+
})).then((e) => {
|
|
10126
|
+
t = [e, ...t.filter((t) => t.id !== e.id && t.topic !== e.topic)], i({
|
|
10127
|
+
captured: s,
|
|
10128
|
+
topic: a,
|
|
10129
|
+
content: n
|
|
10130
|
+
});
|
|
10131
|
+
}).catch((e) => i({ error: String(e) }));
|
|
10132
|
+
}
|
|
10133
|
+
return {
|
|
10134
|
+
name: "preferences",
|
|
10135
|
+
augmentPrompt: () => Ad(t),
|
|
10136
|
+
afterAgent: (t) => {
|
|
10137
|
+
let r = t.messages ?? [];
|
|
10138
|
+
for (let t = n + 1; t < r.length; t++) {
|
|
10139
|
+
let n = r[t];
|
|
10140
|
+
if (n.role !== "user" || typeof n.content != "string" || !n.content) continue;
|
|
10141
|
+
let o = n.content, s = Ed(o);
|
|
10142
|
+
if (s) {
|
|
10143
|
+
a(s.content, s.topic, t, "explicit");
|
|
10144
|
+
continue;
|
|
10145
|
+
}
|
|
10146
|
+
if (e.llmInvoke && Dd(o)) {
|
|
10147
|
+
let n = t;
|
|
10148
|
+
e.llmInvoke(Od(o)).then((e) => {
|
|
10149
|
+
let t = kd(e);
|
|
10150
|
+
t && a(t.content, t.topic, n, "llm");
|
|
10151
|
+
}).catch((e) => i({ extractError: String(e) }));
|
|
10152
|
+
}
|
|
10153
|
+
}
|
|
10154
|
+
n = r.length - 1;
|
|
10155
|
+
},
|
|
10156
|
+
preload: async () => {
|
|
10157
|
+
await e.store.ready, t = await e.store.list();
|
|
10158
|
+
},
|
|
10159
|
+
getPreferences: () => [...t],
|
|
10160
|
+
removePreference: async (n) => {
|
|
10161
|
+
let r = await e.store.remove(n);
|
|
10162
|
+
return r && (t = t.filter((e) => e.id !== n)), r;
|
|
10163
|
+
},
|
|
10164
|
+
clearPreferences: async () => {
|
|
10165
|
+
await e.store.clear(), t = [];
|
|
10166
|
+
},
|
|
10167
|
+
resetScanCursor: () => {
|
|
10168
|
+
n = -1;
|
|
10169
|
+
}
|
|
10170
|
+
};
|
|
10171
|
+
}
|
|
10172
|
+
var Md = /large_results\/[^\s"'`),]+\.txt/g;
|
|
10173
|
+
function Nd(e) {
|
|
9950
10174
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
9951
10175
|
if (typeof e != "string" || !e) return;
|
|
9952
10176
|
let n;
|
|
9953
|
-
for (
|
|
10177
|
+
for (Md.lastIndex = 0; (n = Md.exec(e)) !== null;) t.add(n[0]);
|
|
9954
10178
|
};
|
|
9955
10179
|
for (let t of e) if (n(t.content), t.steps) for (let e of t.steps) n(e.result);
|
|
9956
10180
|
return t;
|
|
9957
10181
|
}
|
|
9958
|
-
function
|
|
10182
|
+
function Pd(e, t) {
|
|
9959
10183
|
let n = [];
|
|
9960
10184
|
for (let r of Object.keys(e)) r.startsWith("large_results/") && !t.has(r) && n.push(r);
|
|
9961
10185
|
return n;
|
|
9962
10186
|
}
|
|
9963
10187
|
//#endregion
|
|
9964
10188
|
//#region src/core/utils/serialRunner.ts
|
|
9965
|
-
function
|
|
10189
|
+
function Fd() {
|
|
9966
10190
|
let e = Promise.resolve();
|
|
9967
10191
|
return function(t) {
|
|
9968
10192
|
let n = e.then(t, t);
|
|
@@ -9971,24 +10195,24 @@ function _d() {
|
|
|
9971
10195
|
}
|
|
9972
10196
|
//#endregion
|
|
9973
10197
|
//#region src/core/sdk/createChatSdk.ts
|
|
9974
|
-
var
|
|
9975
|
-
function
|
|
10198
|
+
var Id = 30, Ld = /* @__PURE__ */ new Map();
|
|
10199
|
+
function Rd(e, t) {
|
|
9976
10200
|
return e === "set_data" ? "set" : e === "edit_data" ? "edit" : e === "delete_data" ? "delete" : e === "restore_data" ? "restore" : e === "write" ? t?.del ? "delete" : t?.patch ? "edit" : "set" : null;
|
|
9977
10201
|
}
|
|
9978
|
-
function
|
|
10202
|
+
function zd(e) {
|
|
9979
10203
|
return e === "spawn_agent" || e === "spawn_agents" || e.startsWith("use_");
|
|
9980
10204
|
}
|
|
9981
|
-
function
|
|
10205
|
+
function Bd(e, t, n, r) {
|
|
9982
10206
|
let i = 0;
|
|
9983
10207
|
return {
|
|
9984
10208
|
name: "sdk-events",
|
|
9985
10209
|
wrapToolCall: async (t, r) => {
|
|
9986
|
-
let i = await r(t), a =
|
|
10210
|
+
let i = await r(t), a = Rd(t.name, t.args);
|
|
9987
10211
|
return a ? e({
|
|
9988
10212
|
type: "data_change",
|
|
9989
10213
|
operation: a,
|
|
9990
10214
|
value: n()?.bind
|
|
9991
|
-
}) : i.status === "done" &&
|
|
10215
|
+
}) : i.status === "done" && zd(t.name) && e({
|
|
9992
10216
|
type: "data_change",
|
|
9993
10217
|
operation: "edit",
|
|
9994
10218
|
value: n()?.bind
|
|
@@ -10015,7 +10239,7 @@ function Sd(e, t, n, r) {
|
|
|
10015
10239
|
}
|
|
10016
10240
|
};
|
|
10017
10241
|
}
|
|
10018
|
-
function
|
|
10242
|
+
function Vd(e, t, n, r, i) {
|
|
10019
10243
|
if (!n) return i && console.warn(`[page-agent-sdk][focus] capabilities.focus 关闭,${t} 忽略`), {
|
|
10020
10244
|
ok: !1,
|
|
10021
10245
|
error: "capabilities.focus 关闭"
|
|
@@ -10033,28 +10257,28 @@ function Cd(e, t, n, r, i) {
|
|
|
10033
10257
|
error: "当前无主数据 schema,无法聚焦"
|
|
10034
10258
|
});
|
|
10035
10259
|
}
|
|
10036
|
-
function
|
|
10260
|
+
function Hd(e, n) {
|
|
10037
10261
|
let i = {
|
|
10038
10262
|
prompt_tokens: 0,
|
|
10039
10263
|
completion_tokens: 0,
|
|
10040
10264
|
total_tokens: 0
|
|
10041
|
-
}, a = ul(() =>
|
|
10265
|
+
}, a = ul(() => G), o = /* @__PURE__ */ At(0), s = Il(e.storage);
|
|
10042
10266
|
e.debug && s && s.onEvent((e) => console.log("[page-agent-sdk][storage]", e));
|
|
10043
10267
|
let { modelCaps: c, summaryLlmInvoke: l, titleLlmInvoke: u, compressDecisionInvoke: d } = ll(e), f = c;
|
|
10044
10268
|
if (e.debug && console.log("[page-agent-sdk][modelCaps]", f), f.contextWindow < 2e5) throw Error(`[page-agent-sdk] 模型上下文窗口 ${f.contextWindow} 小于最小支持 ${ai}(需 ≥200K 窗口模型,如 GLM-5.2/Claude/Kimi/Qwen-1M/DeepSeek-v4)`);
|
|
10045
10269
|
let h = Ul(e, f.contextWindow), g = h.enableLLMSummary !== !1, _ = (e.contextOptions && e.contextOptions.preserveLastToolResults) ?? Hl[e.contextPreset ?? "auto"], v = new Set(_), y = e.llm;
|
|
10046
10270
|
e.debug && !l && console.warn("[page-agent-sdk][summarization] 未构造 llmInvoke(apiKey 缺失?),摘要回退零成本索引摘要");
|
|
10047
|
-
let b = /* @__PURE__ */
|
|
10271
|
+
let b = /* @__PURE__ */ bt([]), x = lc(e.vfs?.initialFiles, {
|
|
10048
10272
|
persist: s ? { save: (e) => {
|
|
10049
|
-
|
|
10273
|
+
zt({ vfs: e });
|
|
10050
10274
|
} } : void 0,
|
|
10051
10275
|
maxBytes: e.vfs?.maxBytes,
|
|
10052
10276
|
poolBytes: e.vfs?.poolBytes
|
|
10053
10277
|
}), S = Ta([], { maxPlanRevisions: e.maxPlanRevisions }), C = ka(), w = Qa({
|
|
10054
|
-
getSchema: () =>
|
|
10055
|
-
getBind: () =>
|
|
10278
|
+
getSchema: () => z()?.schema,
|
|
10279
|
+
getBind: () => z()?.bind,
|
|
10056
10280
|
unfocusGuidance: e.toolMode === "advanced" ? "tool" : "ask-user",
|
|
10057
|
-
onChange: (e) =>
|
|
10281
|
+
onChange: (e) => G({
|
|
10058
10282
|
type: "focus_change",
|
|
10059
10283
|
focuses: e
|
|
10060
10284
|
})
|
|
@@ -10072,43 +10296,43 @@ function wd(e, n) {
|
|
|
10072
10296
|
t.length ? (e._codeAsset.writablePaths = t, Array.isArray(e.writablePaths) && (e.writablePaths = t), e._rebuildCodeAssetPaths?.(t[0]), console.info(`[page-agent-sdk][createHtmlSubagent] 未传 writablePaths,已从 schema 推断: [${t.map((e) => `'${e}'`).join(", ")}]`)) : (console.warn("[page-agent-sdk][createHtmlSubagent] 未能从 schema 推断 writablePaths(开放 schema(z.any()/z.record())/嵌套容器(如 sections[].children[])/点路径 codeField(如 props.html_code)不支持自动推断),已跳过该 html 子 agent(整体不受影响);如确需代码资产机制(vfs + 格式校验 + 增量 commit),请显式传 writablePaths(代码组件 data 区,如 ['components'])"), j.add(e));
|
|
10073
10297
|
}
|
|
10074
10298
|
let M = j.size ? ee.filter((e) => !j.has(e)) : ee, te = j.size ? (A ?? []).filter((e) => !j.has(e)) : A, N = M.length > 0, P = M.flatMap((e) => e._codeAsset.writablePaths), ne = M.flatMap((e) => e._codeAsset.writablePaths.map((t) => `${t}.${e._codeAsset.codeField}`)), re = e.checkpoint, ie = re !== void 0 && re !== !1, F = ie ? Bo({
|
|
10075
|
-
getData: () =>
|
|
10076
|
-
consumeDataDirty: () =>
|
|
10299
|
+
getData: () => z()?.bind,
|
|
10300
|
+
consumeDataDirty: () => R?.consumeDataDirty?.() ?? !0,
|
|
10077
10301
|
slotPaths: O ? [""] : [],
|
|
10078
10302
|
vfsStore: x,
|
|
10079
10303
|
todosMw: S,
|
|
10080
10304
|
getTodos: () => D.current?.getState?.()?.todos ?? [],
|
|
10081
10305
|
messages: b,
|
|
10082
10306
|
maxCheckpoints: re && typeof re == "object" ? re.maxCheckpoints : void 0
|
|
10083
|
-
}) : null, I = !re || typeof re != "object" || re.auto !== !1, L = zl(e.capabilities),
|
|
10307
|
+
}) : null, I = !re || typeof re != "object" || re.auto !== !1, L = zl(e.capabilities), ae = L.dataOps, oe = L.draftWrite, se = L.tracing, ce = L.automation, le = ac({
|
|
10084
10308
|
...e,
|
|
10085
10309
|
locale: e.i18n?.locale
|
|
10086
10310
|
});
|
|
10087
10311
|
if (N) {
|
|
10088
10312
|
let e = M.map((e) => e._codeAsset.orchestratorPrompt).filter(Boolean).join("\n\n");
|
|
10089
|
-
e && (
|
|
10090
|
-
} else O?.schema && Qi(O.schema) && (
|
|
10091
|
-
let
|
|
10313
|
+
e && (le += "\n\n" + e);
|
|
10314
|
+
} else O?.schema && Qi(O.schema) && (le += "\n\n" + ga.htmlDirectWriteFallback, console.warn("[page-agent-sdk] 检测到 schema 含 code 字段但未注册 html 子 agent:已自动注入「主 agent 自己写 HTML」编排(code 作普通字段直接 write,无 vfs 工作副本 / 无格式校验门禁)。如需代码资产机制(vfs + 格式校验 + 增量 commit + 主上下文 code 摘要),注册 createHtmlSubagent;若确为降级意图可忽略。"));
|
|
10315
|
+
let ue = ae && O ? Fu(O, {
|
|
10092
10316
|
onAudit: e.onAudit ?? (e.debug ? (e) => console.log("[page-agent-sdk][data audit]", e) : void 0),
|
|
10093
10317
|
maxSnapshots: e.maxSnapshots,
|
|
10094
10318
|
onConflict: a.set,
|
|
10095
10319
|
autoLock: e.autoLock,
|
|
10096
10320
|
interceptors: e.interceptors,
|
|
10097
|
-
vfsStore:
|
|
10321
|
+
vfsStore: oe || O?.resources?.length ? x : void 0,
|
|
10098
10322
|
...P.length ? { pgIdPaths: P } : {},
|
|
10099
10323
|
...ne.length ? { largeTextPaths: ne } : {}
|
|
10100
|
-
}) : [],
|
|
10101
|
-
getResourcesSnapshot: () =>
|
|
10324
|
+
}) : [], de = ae ? Eu(ue, e.toolMode) : [], R = ae && O ? ue.controller ?? null : null, fe = ae && O?.resources?.length && R?.getResourcesSnapshot ? cd({
|
|
10325
|
+
getResourcesSnapshot: () => R?.getResourcesSnapshot?.() ?? [],
|
|
10102
10326
|
toolsExposed: e.toolMode === "advanced"
|
|
10103
|
-
}) : void 0,
|
|
10104
|
-
|
|
10105
|
-
let
|
|
10106
|
-
|
|
10107
|
-
let
|
|
10108
|
-
|
|
10109
|
-
let
|
|
10110
|
-
|
|
10111
|
-
let
|
|
10327
|
+
}) : void 0, z = () => R?.get() ?? O, B = /* @__PURE__ */ new Map(), pe = id(L, de, Lu, Uu, Xu);
|
|
10328
|
+
pe.forEach((e) => B.set(e.name, "builtin"));
|
|
10329
|
+
let me = [...e.tools || []];
|
|
10330
|
+
me.forEach((e) => B.set(e.name, "user"));
|
|
10331
|
+
let V = $u(e.actions ?? {});
|
|
10332
|
+
V.forEach((e) => B.set(e.name, "action"));
|
|
10333
|
+
let he = [], ge = !1, _e = e.humanConfirm !== !1 && (!e.approval || e.approval.humanConfirmTool !== !1), ve = _e ? Mo() : null;
|
|
10334
|
+
ve && B.set(Ao, "builtin");
|
|
10335
|
+
let ye = ie && F ? [r(async () => {
|
|
10112
10336
|
let e = F.list();
|
|
10113
10337
|
return e.length ? F.restore() ? `已回退到最近一次正常状态(checkpoint #${e[e.length - 1].id})。对话历史、主数据、vfs、todos 已整体还原。请基于回退后的状态重新判断并继续。` : "回退失败:无可用 checkpoint。" : "无可用 checkpoint,无法回退。";
|
|
10114
10338
|
}, {
|
|
@@ -10123,9 +10347,9 @@ function wd(e, n) {
|
|
|
10123
10347
|
description: "列出可用会话 checkpoint(回退点)。",
|
|
10124
10348
|
schema: t.object({}).optional()
|
|
10125
10349
|
})] : [];
|
|
10126
|
-
|
|
10127
|
-
let
|
|
10128
|
-
let n =
|
|
10350
|
+
ye.forEach((e) => B.set(e.name, "builtin"));
|
|
10351
|
+
let H = L.focus, be = r(async ({ path: e, label: t }) => {
|
|
10352
|
+
let n = z()?.schema;
|
|
10129
10353
|
return n ? Ji(n, e) ? (w.setFocus({
|
|
10130
10354
|
path: e,
|
|
10131
10355
|
...t ? { label: t } : {}
|
|
@@ -10137,12 +10361,12 @@ function wd(e, n) {
|
|
|
10137
10361
|
path: t.string().describe("要聚焦的组件 jsonPath,如 components.3"),
|
|
10138
10362
|
label: t.string().optional().describe("人类可读标签,如「导航栏」")
|
|
10139
10363
|
})
|
|
10140
|
-
}),
|
|
10364
|
+
}), xe = r(async () => (w.clearFocus(), "已清除聚焦,恢复全量可操作范围(可读写所有组件)。"), {
|
|
10141
10365
|
name: "clear_focus",
|
|
10142
10366
|
description: "清除当前聚焦,退出精修模式,恢复对全部组件的读写权限。",
|
|
10143
10367
|
schema: t.object({}).optional()
|
|
10144
|
-
}),
|
|
10145
|
-
let n =
|
|
10368
|
+
}), Se = r(async ({ path: e, label: t }) => {
|
|
10369
|
+
let n = z()?.schema;
|
|
10146
10370
|
if (!n) return "聚焦失败:当前无主数据 schema,无法聚焦。";
|
|
10147
10371
|
if (!Ji(n, e)) return `PATH_DENIED · 聚焦失败:path "${e}" 不在 schema 内。请先用 read 查看可操作路径再聚焦。`;
|
|
10148
10372
|
w.addFocus({
|
|
@@ -10158,7 +10382,7 @@ function wd(e, n) {
|
|
|
10158
10382
|
path: t.string().describe("要追加聚焦的组件 jsonPath,如 components.3"),
|
|
10159
10383
|
label: t.string().optional().describe("人类可读标签")
|
|
10160
10384
|
})
|
|
10161
|
-
}),
|
|
10385
|
+
}), Ce = r(async ({ path: e }) => {
|
|
10162
10386
|
let t = w.getFocuses().length;
|
|
10163
10387
|
w.removeFocus(e);
|
|
10164
10388
|
let n = w.getFocuses();
|
|
@@ -10167,81 +10391,81 @@ function wd(e, n) {
|
|
|
10167
10391
|
name: "remove_focus",
|
|
10168
10392
|
description: "移除单个聚焦焦点(by path),保留其他焦点。移除最后一个等价退出精修。全部退出用 clear_focus。",
|
|
10169
10393
|
schema: t.object({ path: t.string().describe("要移除的焦点 jsonPath") })
|
|
10170
|
-
}),
|
|
10171
|
-
ye,
|
|
10394
|
+
}), we = H && e.toolMode === "advanced" ? [
|
|
10172
10395
|
be,
|
|
10173
10396
|
xe,
|
|
10174
|
-
Se
|
|
10397
|
+
Se,
|
|
10398
|
+
Ce
|
|
10175
10399
|
] : [];
|
|
10176
|
-
|
|
10177
|
-
let
|
|
10178
|
-
function
|
|
10400
|
+
we.forEach((e) => B.set(e.name, "builtin"));
|
|
10401
|
+
let Te = [], Ee = /* @__PURE__ */ new Map(), U = W();
|
|
10402
|
+
function W() {
|
|
10179
10403
|
let { tools: e, collisions: t } = ad([
|
|
10180
10404
|
{
|
|
10181
10405
|
label: "builtin",
|
|
10182
|
-
tools:
|
|
10406
|
+
tools: pe
|
|
10183
10407
|
},
|
|
10184
10408
|
{
|
|
10185
10409
|
label: "user",
|
|
10186
|
-
tools:
|
|
10410
|
+
tools: me
|
|
10187
10411
|
},
|
|
10188
10412
|
{
|
|
10189
10413
|
label: "action",
|
|
10190
|
-
tools:
|
|
10414
|
+
tools: V
|
|
10191
10415
|
},
|
|
10192
10416
|
{
|
|
10193
10417
|
label: "humanConfirm",
|
|
10194
|
-
tools:
|
|
10418
|
+
tools: ve ? [ve] : []
|
|
10195
10419
|
},
|
|
10196
10420
|
{
|
|
10197
10421
|
label: "checkpoint",
|
|
10198
|
-
tools:
|
|
10422
|
+
tools: ye
|
|
10199
10423
|
},
|
|
10200
10424
|
{
|
|
10201
10425
|
label: "focus",
|
|
10202
|
-
tools:
|
|
10426
|
+
tools: we
|
|
10203
10427
|
},
|
|
10204
10428
|
{
|
|
10205
10429
|
label: "mcp",
|
|
10206
|
-
tools:
|
|
10430
|
+
tools: he
|
|
10207
10431
|
},
|
|
10208
10432
|
{
|
|
10209
10433
|
label: "skill",
|
|
10210
|
-
tools:
|
|
10434
|
+
tools: Te
|
|
10211
10435
|
}
|
|
10212
10436
|
]);
|
|
10213
10437
|
return t.length && console.warn("[page-agent-sdk] 工具重名,后注册覆盖先注册:", t.map((e) => `${e.name}(${e.loser}→${e.winner})`).join(", ")), e;
|
|
10214
10438
|
}
|
|
10215
|
-
let
|
|
10216
|
-
if (
|
|
10217
|
-
if (
|
|
10218
|
-
let
|
|
10439
|
+
let De = L.planning, Oe = L.missionAnchor, ke = L.workingMemory, Ae = L.skills, je = L.vfs || N;
|
|
10440
|
+
if (je) for (let e of gc) B.set(e, "builtin");
|
|
10441
|
+
if (De) for (let e of S.tools ?? []) B.set(e.name, "builtin");
|
|
10442
|
+
let Me = L.summarization, Ne = L.agentCompression && !!d;
|
|
10219
10443
|
e.debug && L.agentCompression && !d && console.warn("[page-agent-sdk][agentCompression] agentCompression 开启但 summaryLlm 不可用(或缺 apiKey / 模型不支持工具),压缩决策不启用,回退静态压缩");
|
|
10220
|
-
let
|
|
10221
|
-
|
|
10222
|
-
let
|
|
10223
|
-
llm:
|
|
10224
|
-
allTools: () => J.agent?.allTools ??
|
|
10225
|
-
allowedTools:
|
|
10226
|
-
systemPrompt:
|
|
10227
|
-
temperature:
|
|
10228
|
-
maxTokens:
|
|
10229
|
-
skills:
|
|
10230
|
-
maxDepth:
|
|
10231
|
-
maxParallel:
|
|
10444
|
+
let Pe = L.memory, Fe = L.subagent, Ie = Fe ? us() : void 0, Le = e.verify?.maxAttempts ?? 2, Re = !!(e.verify?.check || e.verify?.maxAttempts || e.verify?.adversarial), ze = e.capabilities?.verify === !1, Be = (L.verify || Re && !ze) && e.verify?.enabled !== !1 && Le > 0, Ve = L.contextInspector;
|
|
10445
|
+
Re && !Be && e.verify?.enabled !== !1 && console.warn("[page-agent-sdk][verify] 检测到 verify 配置(check/maxAttempts/adversarial)但未装载(capabilities.verify:false 显式关闭 或 maxAttempts≤0)");
|
|
10446
|
+
let He = e.subagent, Ue = He?.allowedTools ?? [], We = e.permissions?.length ? Oo(e.permissions) : void 0, Ge = e.approval && (e.approval.tools !== void 0 || e.approval.confirm) ? ko(e.approval) : void 0, Ke = [...We ? [We] : [], ...Ge ? [Ge] : []], qe = !Fe || He?.enabled === !1 ? void 0 : Es({
|
|
10447
|
+
llm: He?.llm ?? e.llm,
|
|
10448
|
+
allTools: () => J.agent?.allTools ?? U,
|
|
10449
|
+
allowedTools: Ue.length ? Ue : void 0,
|
|
10450
|
+
systemPrompt: He?.systemPrompt,
|
|
10451
|
+
temperature: He?.temperature,
|
|
10452
|
+
maxTokens: He?.maxTokens,
|
|
10453
|
+
skills: He?.skills,
|
|
10454
|
+
maxDepth: He?.maxDepth,
|
|
10455
|
+
maxParallel: He?.maxParallel,
|
|
10232
10456
|
debug: e.debug,
|
|
10233
10457
|
getFocuses: () => w.getFocuses(),
|
|
10234
|
-
getSchema: () =>
|
|
10235
|
-
tracker:
|
|
10236
|
-
guardMiddleware:
|
|
10237
|
-
getVfsFiles:
|
|
10238
|
-
enterDataScope:
|
|
10239
|
-
exitDataScope:
|
|
10458
|
+
getSchema: () => z()?.schema ?? null,
|
|
10459
|
+
tracker: Ie,
|
|
10460
|
+
guardMiddleware: Ke.length ? Ke : void 0,
|
|
10461
|
+
getVfsFiles: je ? () => x.files : void 0,
|
|
10462
|
+
enterDataScope: R?.enterScope ? (e) => R.enterScope(e) : void 0,
|
|
10463
|
+
exitDataScope: R?.exitScope ? (e) => R.exitScope(e) : void 0,
|
|
10240
10464
|
onUsage: (e) => {
|
|
10241
10465
|
i.prompt_tokens = (i.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), i.completion_tokens = (i.completion_tokens ?? 0) + (e.completion_tokens ?? 0), i.total_tokens = (i.total_tokens ?? 0) + (e.total_tokens ?? 0);
|
|
10242
10466
|
},
|
|
10243
|
-
timeoutMs:
|
|
10244
|
-
}),
|
|
10467
|
+
timeoutMs: He?.timeoutMs
|
|
10468
|
+
}), Je = te?.map((e) => {
|
|
10245
10469
|
if (!e._codeAsset) return e;
|
|
10246
10470
|
let t = e._codeAsset, n = Pc({
|
|
10247
10471
|
writablePaths: t.writablePaths,
|
|
@@ -10250,165 +10474,181 @@ function wd(e, n) {
|
|
|
10250
10474
|
codeField: t.codeField,
|
|
10251
10475
|
craftNotes: t.craftNotes,
|
|
10252
10476
|
onWarning: (e) => console.warn(`[page-agent-sdk][code-asset] ${e}`),
|
|
10253
|
-
getController: () =>
|
|
10477
|
+
getController: () => R,
|
|
10254
10478
|
vfsStore: x
|
|
10255
10479
|
}), r = [...e.middleware ?? [], n];
|
|
10256
|
-
for (let e of r) e && typeof e == "object" && typeof e._setGetController == "function" && e._setGetController(() =>
|
|
10480
|
+
for (let e of r) e && typeof e == "object" && typeof e._setGetController == "function" && e._setGetController(() => R);
|
|
10257
10481
|
return {
|
|
10258
10482
|
...e,
|
|
10259
10483
|
middleware: r
|
|
10260
10484
|
};
|
|
10261
|
-
}),
|
|
10262
|
-
getBind: () =>
|
|
10485
|
+
}), Ye = N && Fe ? Fc() : void 0, Xe = Ye ? Vc({
|
|
10486
|
+
getBind: () => z()?.bind,
|
|
10263
10487
|
writablePaths: P,
|
|
10264
|
-
getLocked: () =>
|
|
10265
|
-
tools:
|
|
10266
|
-
}) : void 0,
|
|
10488
|
+
getLocked: () => Ye.locked(),
|
|
10489
|
+
tools: U
|
|
10490
|
+
}) : void 0, Ze = Fe && Je !== void 0 ? ks(Je, {
|
|
10267
10491
|
llm: e.llm,
|
|
10268
|
-
allTools: () => J.agent?.allTools ??
|
|
10492
|
+
allTools: () => J.agent?.allTools ?? U,
|
|
10269
10493
|
debug: e.debug,
|
|
10270
10494
|
getFocuses: () => w.getFocuses(),
|
|
10271
|
-
getSchema: () =>
|
|
10272
|
-
getBind: () =>
|
|
10273
|
-
tracker:
|
|
10274
|
-
guardMiddleware:
|
|
10275
|
-
getVfsFiles:
|
|
10276
|
-
enterDataScope:
|
|
10277
|
-
exitDataScope:
|
|
10495
|
+
getSchema: () => z()?.schema ?? null,
|
|
10496
|
+
getBind: () => z()?.bind,
|
|
10497
|
+
tracker: Ie,
|
|
10498
|
+
guardMiddleware: Ke.length ? Ke : void 0,
|
|
10499
|
+
getVfsFiles: je ? () => x.files : void 0,
|
|
10500
|
+
enterDataScope: R?.enterScope ? (e) => R.enterScope(e) : void 0,
|
|
10501
|
+
exitDataScope: R?.exitScope ? (e) => R.exitScope(e) : void 0,
|
|
10278
10502
|
onUsage: (e) => {
|
|
10279
10503
|
i.prompt_tokens = (i.prompt_tokens ?? 0) + (e.prompt_tokens ?? 0), i.completion_tokens = (i.completion_tokens ?? 0) + (e.completion_tokens ?? 0), i.total_tokens = (i.total_tokens ?? 0) + (e.total_tokens ?? 0);
|
|
10280
10504
|
},
|
|
10281
10505
|
timeoutMs: e.subagent?.timeoutMs,
|
|
10282
|
-
...
|
|
10283
|
-
componentLock:
|
|
10284
|
-
resolveComponents: (e) => Ic(e, Ac(
|
|
10506
|
+
...Ye ? {
|
|
10507
|
+
componentLock: Ye,
|
|
10508
|
+
resolveComponents: (e) => Ic(e, Ac(z()?.bind, P))
|
|
10285
10509
|
} : {}
|
|
10286
|
-
}) : void 0,
|
|
10510
|
+
}) : void 0, Qe = Ze ? Ze.controller : null, $e = [
|
|
10287
10511
|
"get_data",
|
|
10288
10512
|
"describe_data",
|
|
10289
10513
|
"read",
|
|
10290
10514
|
"fetch_document"
|
|
10291
|
-
],
|
|
10515
|
+
], et = U.filter((e) => $e.includes(e.name)), tt = Be ? As({
|
|
10292
10516
|
check: e.verify.check ?? Is({
|
|
10293
|
-
schemas: () =>
|
|
10294
|
-
root: () =>
|
|
10517
|
+
schemas: () => z() ? { "": z().schema } : {},
|
|
10518
|
+
root: () => z()?.bind
|
|
10295
10519
|
}),
|
|
10296
10520
|
adversarial: e.verify?.adversarial ? {
|
|
10297
10521
|
llm: e.llm,
|
|
10298
|
-
tools:
|
|
10522
|
+
tools: et
|
|
10299
10523
|
} : void 0
|
|
10300
|
-
}) : void 0,
|
|
10524
|
+
}) : void 0, nt = Ve ? Xs({
|
|
10301
10525
|
contextWindow: f.contextWindow,
|
|
10302
10526
|
thresholdRatio: Ul(e, f.contextWindow).summaryThresholdRatio
|
|
10303
|
-
}) : void 0,
|
|
10527
|
+
}) : void 0, rt = sd({
|
|
10304
10528
|
...L,
|
|
10305
|
-
humanConfirm:
|
|
10529
|
+
humanConfirm: _e,
|
|
10306
10530
|
subagents: te?.map((e) => ({
|
|
10307
10531
|
id: e.id,
|
|
10308
10532
|
description: e.description,
|
|
10309
10533
|
temperature: e.temperature
|
|
10310
10534
|
}))
|
|
10311
|
-
},
|
|
10535
|
+
}, ae && !!O, e.toolMode, !!O?.resources?.length, { promptSoftCap: as(f.contextWindow, h.promptSoftCapTokens) }), it = O ? {
|
|
10312
10536
|
name: "dataHint",
|
|
10313
|
-
augmentPrompt: () => ic(
|
|
10314
|
-
} : null,
|
|
10537
|
+
augmentPrompt: () => ic(z(), e.schemaHint) || void 0
|
|
10538
|
+
} : null, at = e.augmentSystem ? {
|
|
10315
10539
|
name: "augmentSystem",
|
|
10316
10540
|
augmentPrompt: (t) => {
|
|
10317
10541
|
try {
|
|
10318
10542
|
return e.augmentSystem({
|
|
10319
10543
|
state: t,
|
|
10320
|
-
data:
|
|
10544
|
+
data: z()
|
|
10321
10545
|
});
|
|
10322
10546
|
} catch (t) {
|
|
10323
10547
|
e.debug && console.log("[page-agent-sdk][augmentSystem] 回调抛错,降级跳过:", t.message);
|
|
10324
10548
|
return;
|
|
10325
10549
|
}
|
|
10326
10550
|
}
|
|
10327
|
-
} : null,
|
|
10551
|
+
} : null, ot = Bl(e.onEvent), G = ot.emit, st, ct = [], lt = (e) => ({
|
|
10328
10552
|
name: e.name,
|
|
10329
10553
|
description: e.description,
|
|
10330
10554
|
content: typeof e.getContent == "function" ? e.getContent() : ""
|
|
10331
|
-
}),
|
|
10555
|
+
}), ut = (e) => ({
|
|
10332
10556
|
name: e.name,
|
|
10333
10557
|
description: e.description,
|
|
10334
10558
|
getContent: () => e.content
|
|
10335
|
-
}),
|
|
10559
|
+
}), dt = e.skillStorage === !1 ? null : pd({
|
|
10336
10560
|
...typeof e.skillStorage == "object" ? e.skillStorage : {},
|
|
10337
10561
|
id: e.skillStorage && typeof e.skillStorage == "object" && e.skillStorage.id ? e.skillStorage.id : `agent::${n}`
|
|
10338
|
-
}),
|
|
10339
|
-
|
|
10562
|
+
}), ft = L.preferences, pt = ft && e.preferenceStorage !== !1 ? bd({
|
|
10563
|
+
...typeof e.preferenceStorage == "object" ? e.preferenceStorage : {},
|
|
10564
|
+
id: e.preferenceStorage && typeof e.preferenceStorage == "object" && e.preferenceStorage.id ? e.preferenceStorage.id : `agent::${n}`
|
|
10565
|
+
}) : null, mt = pt ? jd({
|
|
10566
|
+
store: pt,
|
|
10567
|
+
llmInvoke: l,
|
|
10568
|
+
getSessionId: () => J.sessionId,
|
|
10569
|
+
onDebug: (e) => {
|
|
10570
|
+
let t = J.agent?.debugLogs;
|
|
10571
|
+
t && (t.value.push({
|
|
10572
|
+
timestamp: Date.now(),
|
|
10573
|
+
type: "middleware",
|
|
10574
|
+
data: e
|
|
10575
|
+
}), Pt(t));
|
|
10576
|
+
}
|
|
10577
|
+
}) : null, ht = () => {
|
|
10578
|
+
let t = st ? st.controller : null;
|
|
10340
10579
|
if (t) {
|
|
10341
|
-
let n = (e.skills || []).filter((e) => !
|
|
10342
|
-
t.set([...n, ...
|
|
10580
|
+
let n = (e.skills || []).filter((e) => !ct.some((t) => t.name === e.name));
|
|
10581
|
+
t.set([...n, ...ct]);
|
|
10343
10582
|
}
|
|
10344
10583
|
J.infoTick.value++;
|
|
10345
|
-
},
|
|
10346
|
-
if (
|
|
10347
|
-
let t = await
|
|
10584
|
+
}, gt = async () => {
|
|
10585
|
+
if (dt) try {
|
|
10586
|
+
let t = await dt.list();
|
|
10348
10587
|
if (t.length) {
|
|
10349
|
-
|
|
10350
|
-
let n =
|
|
10588
|
+
ct = t.map(ut);
|
|
10589
|
+
let n = st ? st.controller : null;
|
|
10351
10590
|
if (n) {
|
|
10352
|
-
let t = (e.skills || []).filter((e) => !
|
|
10353
|
-
n.set([...t, ...
|
|
10591
|
+
let t = (e.skills || []).filter((e) => !ct.some((t) => t.name === e.name));
|
|
10592
|
+
n.set([...t, ...ct]);
|
|
10354
10593
|
}
|
|
10355
10594
|
J.infoTick.value++;
|
|
10356
10595
|
}
|
|
10357
10596
|
} catch {}
|
|
10358
|
-
},
|
|
10597
|
+
}, _t = Me ? ls({
|
|
10359
10598
|
...h,
|
|
10360
10599
|
llmInvoke: l,
|
|
10361
|
-
getRegisteredData: () =>
|
|
10600
|
+
getRegisteredData: () => z() ? [{ description: z().description ?? "主数据对象" }] : [],
|
|
10362
10601
|
preserveLastToolResults: _,
|
|
10363
|
-
...
|
|
10602
|
+
...Ne ? {
|
|
10364
10603
|
decideInvoke: d,
|
|
10365
|
-
getSnapshot: () =>
|
|
10604
|
+
getSnapshot: () => nt?.getSnapshot()
|
|
10366
10605
|
} : {}
|
|
10367
|
-
}) : void 0,
|
|
10368
|
-
...
|
|
10369
|
-
|
|
10370
|
-
...
|
|
10371
|
-
...
|
|
10372
|
-
...
|
|
10373
|
-
|
|
10606
|
+
}) : void 0, vt = Gl([
|
|
10607
|
+
...it ? [it] : [],
|
|
10608
|
+
rt,
|
|
10609
|
+
...Oe ? [C] : [],
|
|
10610
|
+
...mt ? [mt] : [],
|
|
10611
|
+
...De ? [S] : [],
|
|
10612
|
+
...Ae ? [st = xo(e.skills || [], {
|
|
10613
|
+
readVfs: je ? (e) => x.files[e]?.content : void 0,
|
|
10374
10614
|
hostScriptEnabled: L.skillHostScript,
|
|
10375
10615
|
onToolsReady: (e, t) => {
|
|
10376
10616
|
for (let n of t) {
|
|
10377
|
-
let t =
|
|
10378
|
-
t >= 0 &&
|
|
10617
|
+
let t = Te.findIndex((e) => e.name === n.name);
|
|
10618
|
+
t >= 0 && Te.splice(t, 1), Te.push(n), Ee.set(n.name, e), B.set(n.name, `skill:${e}`);
|
|
10379
10619
|
}
|
|
10380
|
-
|
|
10620
|
+
U = W(), J.agent && J.agent.setTools(U), J.infoTick.value++;
|
|
10381
10621
|
}
|
|
10382
10622
|
})] : [],
|
|
10383
|
-
...
|
|
10384
|
-
...
|
|
10385
|
-
...
|
|
10386
|
-
...
|
|
10387
|
-
...
|
|
10388
|
-
...
|
|
10389
|
-
...
|
|
10623
|
+
...je ? [vc(x)] : [],
|
|
10624
|
+
..._t ? [_t] : [],
|
|
10625
|
+
...ke ? [T] : [],
|
|
10626
|
+
...H ? [w] : [],
|
|
10627
|
+
...fe ? [fe] : [],
|
|
10628
|
+
...Pe ? [E] : [],
|
|
10629
|
+
...We ? [We] : [],
|
|
10390
10630
|
...ie && I && F ? [Vo(F)] : [],
|
|
10391
|
-
...
|
|
10392
|
-
...Ue ? [Ue] : [],
|
|
10393
|
-
...$e ? [$e] : [],
|
|
10631
|
+
..._e ? [No()] : [],
|
|
10394
10632
|
...Ge ? [Ge] : [],
|
|
10395
|
-
...
|
|
10396
|
-
...
|
|
10397
|
-
...
|
|
10398
|
-
...
|
|
10633
|
+
...tt ? [tt] : [],
|
|
10634
|
+
...qe ? [qe] : [],
|
|
10635
|
+
...Ze ? [Ze] : [],
|
|
10636
|
+
...Xe ? [Xe] : [],
|
|
10637
|
+
...at ? [at] : [],
|
|
10638
|
+
...nt ? [nt] : [],
|
|
10399
10639
|
...e.middleware || [],
|
|
10400
|
-
...
|
|
10640
|
+
...ce ? [Zu(i, {
|
|
10401
10641
|
tokenBudget: e.tokenBudget,
|
|
10402
10642
|
timeBudgetMs: e.timeBudgetMs
|
|
10403
|
-
},
|
|
10404
|
-
|
|
10405
|
-
]),
|
|
10406
|
-
function
|
|
10407
|
-
if (
|
|
10643
|
+
}, G)] : [],
|
|
10644
|
+
Bd(G, b, z, i)
|
|
10645
|
+
]), yt = e.maxMemoryRounds ?? Id, xt = e.approval?.timeoutMs, St = xt === void 0 || xt === 0 ? 3e4 : !Number.isFinite(xt) || xt < 0 ? 0 : xt;
|
|
10646
|
+
function Ct(e) {
|
|
10647
|
+
if (St) return (t) => {
|
|
10408
10648
|
if (t.type !== "approval_request") return;
|
|
10409
10649
|
let n = Date.now(), r = t.toolName;
|
|
10410
10650
|
setTimeout(() => {
|
|
10411
|
-
e?.aborted || (t.resolve(!1),
|
|
10651
|
+
e?.aborted || (t.resolve(!1), G({
|
|
10412
10652
|
type: "error",
|
|
10413
10653
|
message: `确认请求(${r})${Math.round((Date.now() - n) / 1e3)}s 无响应已自动拒绝 —— send/batch 路径无 UI 响应方;可传 approval.timeoutMs 调整(Infinity = 无限等)`,
|
|
10414
10654
|
severity: "observable",
|
|
@@ -10418,43 +10658,43 @@ function wd(e, n) {
|
|
|
10418
10658
|
waitedMs: Date.now() - n
|
|
10419
10659
|
}
|
|
10420
10660
|
}));
|
|
10421
|
-
},
|
|
10661
|
+
}, St);
|
|
10422
10662
|
};
|
|
10423
10663
|
}
|
|
10424
|
-
function
|
|
10425
|
-
let t =
|
|
10664
|
+
function wt(e) {
|
|
10665
|
+
let t = Ct(e);
|
|
10426
10666
|
return (e) => {
|
|
10427
|
-
t?.(e), e.type === "error" &&
|
|
10667
|
+
t?.(e), e.type === "error" && G(e);
|
|
10428
10668
|
};
|
|
10429
10669
|
}
|
|
10430
|
-
let
|
|
10431
|
-
async function
|
|
10670
|
+
let Tt = /* @__PURE__ */ At([]);
|
|
10671
|
+
async function K() {
|
|
10432
10672
|
if (s) try {
|
|
10433
|
-
|
|
10673
|
+
Tt.value = (await s.listSessions(n)).sort((e, t) => t.lastAccessed - e.lastAccessed);
|
|
10434
10674
|
} catch (t) {
|
|
10435
10675
|
e.debug && console.warn("[page-agent-sdk][persist] refreshSessions 失败(已吞):", t);
|
|
10436
10676
|
}
|
|
10437
10677
|
}
|
|
10438
|
-
let
|
|
10439
|
-
function
|
|
10678
|
+
let Et = Fd(), q = /* @__PURE__ */ new Set();
|
|
10679
|
+
function Dt(e) {
|
|
10440
10680
|
let t = new AbortController(), n = () => t.abort();
|
|
10441
|
-
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })),
|
|
10681
|
+
return e && (e.aborted ? t.abort() : e.addEventListener("abort", n, { once: !0 })), q.add(t), {
|
|
10442
10682
|
controller: t,
|
|
10443
10683
|
untrack: () => {
|
|
10444
|
-
|
|
10684
|
+
q.delete(t), e?.removeEventListener("abort", n);
|
|
10445
10685
|
}
|
|
10446
10686
|
};
|
|
10447
10687
|
}
|
|
10448
|
-
function
|
|
10449
|
-
for (let e of
|
|
10450
|
-
|
|
10688
|
+
function Ot() {
|
|
10689
|
+
for (let e of q) e.abort();
|
|
10690
|
+
q.clear();
|
|
10451
10691
|
}
|
|
10452
10692
|
let J = {
|
|
10453
10693
|
agentId: n,
|
|
10454
10694
|
store: s,
|
|
10455
10695
|
messages: b,
|
|
10456
10696
|
vfsStore: x,
|
|
10457
|
-
listeners:
|
|
10697
|
+
listeners: ot.listeners,
|
|
10458
10698
|
todosMw: S,
|
|
10459
10699
|
memoryMw: E,
|
|
10460
10700
|
missionMw: C,
|
|
@@ -10467,55 +10707,55 @@ function wd(e, n) {
|
|
|
10467
10707
|
mcpClosers: [],
|
|
10468
10708
|
mcpServers: [],
|
|
10469
10709
|
checkpoint: F,
|
|
10470
|
-
dataOpsController:
|
|
10471
|
-
skillsController:
|
|
10710
|
+
dataOpsController: R,
|
|
10711
|
+
skillsController: st ? st.controller : null,
|
|
10472
10712
|
infoTick: o,
|
|
10473
10713
|
pendingConflict: a.pendingConflict,
|
|
10474
|
-
sessions:
|
|
10475
|
-
refreshSessions:
|
|
10476
|
-
liveData:
|
|
10714
|
+
sessions: Tt,
|
|
10715
|
+
refreshSessions: K,
|
|
10716
|
+
liveData: z,
|
|
10477
10717
|
usage: i,
|
|
10478
|
-
emit:
|
|
10479
|
-
runSerial:
|
|
10480
|
-
trackActive:
|
|
10481
|
-
abortAllActive:
|
|
10718
|
+
emit: G,
|
|
10719
|
+
runSerial: Et,
|
|
10720
|
+
trackActive: Dt,
|
|
10721
|
+
abortAllActive: Ot,
|
|
10482
10722
|
unloadSkillTools(e) {
|
|
10483
10723
|
if (e) {
|
|
10484
|
-
let t =
|
|
10485
|
-
if (
|
|
10724
|
+
let t = Te.length;
|
|
10725
|
+
if (Te = Te.filter((t) => Ee.get(t.name) === e ? (B.delete(t.name), Ee.delete(t.name), !1) : !0), Te.length === t) return;
|
|
10486
10726
|
} else {
|
|
10487
|
-
if (!
|
|
10488
|
-
for (let e of
|
|
10489
|
-
|
|
10727
|
+
if (!Te.length) return;
|
|
10728
|
+
for (let e of Te) B.delete(e.name), Ee.delete(e.name);
|
|
10729
|
+
Te = [];
|
|
10490
10730
|
}
|
|
10491
|
-
|
|
10731
|
+
U = W(), J.agent && J.agent.setTools(U);
|
|
10492
10732
|
},
|
|
10493
10733
|
applySnapshot(t) {
|
|
10494
|
-
if (t.messages?.length && b.push(...t.messages), t.vfs && x.hydrate && x.hydrate(t.vfs), t.todos?.length && S.reset(t.todos), t.memory && !e.memory && E.reset(t.memory), t.checkpoints?.length && F && F.importStack(t.checkpoints), t.usage && Object.assign(i, t.usage), t.mission &&
|
|
10734
|
+
if (t.messages?.length && b.push(...t.messages), t.vfs && x.hydrate && x.hydrate(t.vfs), t.todos?.length && S.reset(t.todos), t.memory && !e.memory && E.reset(t.memory), t.checkpoints?.length && F && F.importStack(t.checkpoints), t.usage && Object.assign(i, t.usage), t.mission && Oe && C.setMission(t.mission), t.workingMemory && ke && T.restore(t.workingMemory), H) {
|
|
10495
10735
|
let n = t.focus, r = n ? Array.isArray(n) ? n : [n] : [];
|
|
10496
10736
|
if (r.length) {
|
|
10497
|
-
let t =
|
|
10737
|
+
let t = z()?.schema, n = t ? r.filter((e) => Ji(t, e.path)) : [];
|
|
10498
10738
|
if (n.length && (w.setFocus(null), n.forEach((e) => w.addFocus(e))), e.debug && n.length < r.length) {
|
|
10499
10739
|
let e = r.filter((e) => !n.includes(e)).map((e) => e.path);
|
|
10500
10740
|
console.warn("[page-agent-sdk][focus] 恢复的焦点部分 path 已失效(schema 变化/无 schema),剔除:", e);
|
|
10501
10741
|
}
|
|
10502
10742
|
}
|
|
10503
10743
|
}
|
|
10504
|
-
|
|
10744
|
+
Nt();
|
|
10505
10745
|
},
|
|
10506
10746
|
addSkill(e) {
|
|
10507
|
-
let t =
|
|
10508
|
-
t >= 0 ?
|
|
10747
|
+
let t = ct.findIndex((t) => t.name === e.name);
|
|
10748
|
+
t >= 0 ? ct[t] = e : ct.push(e), ht(), dt && dt.put(lt(e));
|
|
10509
10749
|
},
|
|
10510
10750
|
removeSkill(e) {
|
|
10511
|
-
let t =
|
|
10512
|
-
return t < 0 ? !1 : (
|
|
10751
|
+
let t = ct.findIndex((t) => t.name === e);
|
|
10752
|
+
return t < 0 ? !1 : (ct.splice(t, 1), ht(), dt && dt.remove(e), !0);
|
|
10513
10753
|
},
|
|
10514
10754
|
listUserSkills() {
|
|
10515
|
-
return
|
|
10755
|
+
return ct.map((e) => e.name);
|
|
10516
10756
|
},
|
|
10517
10757
|
getUserSkill(e) {
|
|
10518
|
-
let t =
|
|
10758
|
+
let t = ct.find((t) => t.name === e);
|
|
10519
10759
|
if (t) return {
|
|
10520
10760
|
name: t.name,
|
|
10521
10761
|
description: t.description,
|
|
@@ -10523,17 +10763,17 @@ function wd(e, n) {
|
|
|
10523
10763
|
};
|
|
10524
10764
|
},
|
|
10525
10765
|
afterRound() {
|
|
10526
|
-
|
|
10766
|
+
Ft(), Vt();
|
|
10527
10767
|
},
|
|
10528
10768
|
async send(e, t) {
|
|
10529
10769
|
if (await J.initDone, J.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 send");
|
|
10530
|
-
t ??= {}, t?.mission &&
|
|
10770
|
+
t ??= {}, t?.mission && Oe && C.setMission(t.mission);
|
|
10531
10771
|
let n = e;
|
|
10532
10772
|
if (t.interceptors?.input) try {
|
|
10533
10773
|
let r = t.interceptors.input(e);
|
|
10534
10774
|
typeof r == "string" && (n = r);
|
|
10535
10775
|
} catch {}
|
|
10536
|
-
let r =
|
|
10776
|
+
let r = ce ? t.maxAutoRetries ?? 1 : 0, i = 0, a = !1, o = wt(t.signal), c = J.sessionId;
|
|
10537
10777
|
for (;;) {
|
|
10538
10778
|
a ||= (b.push({
|
|
10539
10779
|
role: "user",
|
|
@@ -10565,7 +10805,7 @@ function wd(e, n) {
|
|
|
10565
10805
|
if (di(e, t.signal)) throw e;
|
|
10566
10806
|
let n = Zr(e, "fatal");
|
|
10567
10807
|
if (i < r && F?.canRestore()) {
|
|
10568
|
-
i += 1, F.restore(), a = !0,
|
|
10808
|
+
i += 1, F.restore(), a = !0, G({
|
|
10569
10809
|
type: "error",
|
|
10570
10810
|
message: `致命错误自动恢复(${i}/${r}):${n.message},已回退 checkpoint 重试`,
|
|
10571
10811
|
severity: "observable",
|
|
@@ -10577,7 +10817,7 @@ function wd(e, n) {
|
|
|
10577
10817
|
});
|
|
10578
10818
|
continue;
|
|
10579
10819
|
}
|
|
10580
|
-
throw
|
|
10820
|
+
throw G({
|
|
10581
10821
|
type: "error",
|
|
10582
10822
|
message: n.message,
|
|
10583
10823
|
severity: n.severity,
|
|
@@ -10590,7 +10830,7 @@ function wd(e, n) {
|
|
|
10590
10830
|
async batch(e, t, n) {
|
|
10591
10831
|
if (await J.initDone, !e.length) return [];
|
|
10592
10832
|
if (J.refCount <= 0) throw Error("page-agent-sdk: agent 已释放(unmount),拒绝排队中的 batch");
|
|
10593
|
-
let r = [], i =
|
|
10833
|
+
let r = [], i = wt(n);
|
|
10594
10834
|
for (let a = 0; a < e.length; a++) {
|
|
10595
10835
|
if (n?.aborted) {
|
|
10596
10836
|
for (let t = a; t < e.length; t++) r.push({
|
|
@@ -10643,7 +10883,7 @@ function wd(e, n) {
|
|
|
10643
10883
|
break;
|
|
10644
10884
|
}
|
|
10645
10885
|
let s = Zr(i, "fatal");
|
|
10646
|
-
|
|
10886
|
+
G({
|
|
10647
10887
|
type: "error",
|
|
10648
10888
|
message: `批量任务 ${a + 1}/${e.length} 失败:${s.message}`,
|
|
10649
10889
|
severity: "observable",
|
|
@@ -10670,70 +10910,70 @@ function wd(e, n) {
|
|
|
10670
10910
|
async switchSession(t) {
|
|
10671
10911
|
if (await J.initDone, !s) throw Error("page-agent-sdk: storage 未开启,无法切换会话(请传 storage 选项)");
|
|
10672
10912
|
if (a.resolve("keep_external"), J.sessionId && s) {
|
|
10673
|
-
if (
|
|
10913
|
+
if (Oe) {
|
|
10674
10914
|
let e = C.getMission();
|
|
10675
|
-
e &&
|
|
10915
|
+
e && zt({ mission: e });
|
|
10676
10916
|
}
|
|
10677
|
-
if (
|
|
10917
|
+
if (ke) {
|
|
10678
10918
|
let e = T.getWorkingMemory();
|
|
10679
|
-
e &&
|
|
10919
|
+
e && zt({ workingMemory: e });
|
|
10680
10920
|
}
|
|
10681
|
-
if (
|
|
10921
|
+
if (H) {
|
|
10682
10922
|
let e = w.getFocuses();
|
|
10683
|
-
|
|
10923
|
+
zt({ focus: e.length ? e : null });
|
|
10684
10924
|
}
|
|
10685
10925
|
}
|
|
10686
10926
|
x.flush?.(), await s.flush();
|
|
10687
10927
|
let r = t ?? "", i;
|
|
10688
|
-
return r ? (i = await s.load(n, r), i || await s.createSession(n, e.session?.title, r)) : r = await s.createSession(n, e.session?.title), J.sessionId = r, b.splice(0, b.length), x.clear?.(), S.reset([]), e.memory || E.reset(""), C.reset(), T.reset(), w.reset(), F && F.importStack([]), J.agent.debugLogs.value = [], i ||= await s.load(n, r), i && (J.applySnapshot(i),
|
|
10928
|
+
return r ? (i = await s.load(n, r), i || await s.createSession(n, e.session?.title, r)) : r = await s.createSession(n, e.session?.title), J.sessionId = r, b.splice(0, b.length), x.clear?.(), S.reset([]), e.memory || E.reset(""), C.reset(), T.reset(), w.reset(), mt?.resetScanCursor(), F && F.importStack([]), J.agent.debugLogs.value = [], i ||= await s.load(n, r), i && (J.applySnapshot(i), G({
|
|
10689
10929
|
type: "session_restored",
|
|
10690
10930
|
sessionId: r,
|
|
10691
10931
|
rounds: i.messages?.length ?? 0
|
|
10692
|
-
})), e.memory &&
|
|
10932
|
+
})), e.memory && zt({ memory: E.get() || (typeof e.memory == "string" ? e.memory : "") }), K(), It = void 0, Lt = !1, J.infoTick.value++, r;
|
|
10693
10933
|
},
|
|
10694
10934
|
resetSession: () => {
|
|
10695
|
-
|
|
10935
|
+
Ot(), a.resolve("keep_external"), J.sessionId = dl(), b.splice(0, b.length), x.clear?.(), S.reset([]), e.memory || E.reset(""), C.reset(), T.reset(), w.reset(), mt?.resetScanCursor(), F && F.importStack([]), J.agent && (J.agent.debugLogs.value = []), s && s.createSession(J.agentId, e.session?.title, J.sessionId).catch((t) => {
|
|
10696
10936
|
e.debug && console.warn("[page-agent-sdk][persist] createSession 失败(已吞):", t);
|
|
10697
|
-
}),
|
|
10937
|
+
}), G({
|
|
10698
10938
|
type: "session_restored",
|
|
10699
10939
|
sessionId: J.sessionId,
|
|
10700
10940
|
rounds: 0
|
|
10701
|
-
}), J.infoTick.value++,
|
|
10941
|
+
}), J.infoTick.value++, K(), It = void 0, Lt = !1;
|
|
10702
10942
|
},
|
|
10703
10943
|
stream: (e, t, n) => {
|
|
10704
10944
|
if (!J.agent) throw Error("page-agent-sdk: agent 尚未初始化完成,请先 await mount()");
|
|
10705
|
-
x?.setProtectedRefs?.(
|
|
10945
|
+
x?.setProtectedRefs?.(Nd(e));
|
|
10706
10946
|
let r = (e) => {
|
|
10707
|
-
t?.(e),
|
|
10947
|
+
t?.(e), G(e), e.type === "subagent" && (e.kind === "tool_call" || e.kind === "tool_result") && J.infoTick.value++;
|
|
10708
10948
|
};
|
|
10709
10949
|
if (n) {
|
|
10710
10950
|
let e = () => a.resolve("keep_external");
|
|
10711
10951
|
n.aborted ? e() : n.addEventListener("abort", e, { once: !0 });
|
|
10712
10952
|
}
|
|
10713
|
-
let { controller: i, untrack: o } =
|
|
10953
|
+
let { controller: i, untrack: o } = Dt(n);
|
|
10714
10954
|
return J.agent.stream(e, r, i.signal).finally(o);
|
|
10715
10955
|
},
|
|
10716
10956
|
release() {
|
|
10717
10957
|
if (J.refCount--, J.refCount <= 0) {
|
|
10718
|
-
|
|
10958
|
+
Ot(), ge = !0, s && (x.flush?.(), s.flush(), s.dispose()), dt && dt.dispose();
|
|
10719
10959
|
let e = J.mcpClosers.splice(0);
|
|
10720
|
-
e.length && Promise.allSettled(e.map((e) => e())),
|
|
10960
|
+
e.length && Promise.allSettled(e.map((e) => e())), Ld.delete(n);
|
|
10721
10961
|
}
|
|
10722
10962
|
},
|
|
10723
10963
|
resolveConflict: a.resolve,
|
|
10724
10964
|
setTools(e) {
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
}),
|
|
10965
|
+
me.length = 0, e.forEach((e) => {
|
|
10966
|
+
me.push(e), B.set(e.name, "user");
|
|
10967
|
+
}), U = W(), J.agent && J.agent.setTools(U), J.infoTick.value++;
|
|
10728
10968
|
},
|
|
10729
10969
|
addTool(e) {
|
|
10730
|
-
|
|
10731
|
-
for (let t =
|
|
10732
|
-
|
|
10970
|
+
U.some((t) => t.name === e.name) && console.warn(`[page-agent-sdk] 工具 "${e.name}" 已存在,新工具覆盖(后注册覆盖先注册)`);
|
|
10971
|
+
for (let t = me.length - 1; t >= 0; t--) me[t].name === e.name && me.splice(t, 1);
|
|
10972
|
+
me.push(e), B.set(e.name, "user"), U = W(), J.agent && J.agent.setTools(U), J.infoTick.value++;
|
|
10733
10973
|
},
|
|
10734
10974
|
removeTool(e) {
|
|
10735
|
-
let t =
|
|
10736
|
-
return t < 0 ? !1 : (
|
|
10975
|
+
let t = me.findIndex((t) => t.name === e);
|
|
10976
|
+
return t < 0 ? !1 : (me.splice(t, 1), B.delete(e), U = W(), J.agent && J.agent.setTools(U), J.infoTick.value++, !0);
|
|
10737
10977
|
},
|
|
10738
10978
|
setLlm(t) {
|
|
10739
10979
|
let n;
|
|
@@ -10750,7 +10990,7 @@ function wd(e, n) {
|
|
|
10750
10990
|
contextWindow: e.contextWindow ?? r?.contextWindow,
|
|
10751
10991
|
maxOutputTokens: e.maxOutputTokens ?? r?.maxOutputTokens
|
|
10752
10992
|
}), f.contextWindow < 2e5) throw Error(`[page-agent-sdk][setLlm] 新模型上下文窗口 ${f.contextWindow} 小于最小支持 ${ai}(需 ≥200K 窗口模型)`);
|
|
10753
|
-
J.agent && (J.agent.setLlm(n), J.agent.setModelCaps?.(f)),
|
|
10993
|
+
J.agent && (J.agent.setLlm(n), J.agent.setModelCaps?.(f)), _t?.setContextWindow?.(f.contextWindow), nt?.setContextWindow?.(f.contextWindow), J.infoTick.value++, e.debug && console.log("[page-agent-sdk][setLlm] 重解析 modelCaps + 回灌:", f);
|
|
10754
10994
|
},
|
|
10755
10995
|
setMemory(e) {
|
|
10756
10996
|
E.reset(e), typeof e == "function" && E.refresh(), J.infoTick.value++;
|
|
@@ -10759,49 +10999,49 @@ function wd(e, n) {
|
|
|
10759
10999
|
return E.refresh();
|
|
10760
11000
|
},
|
|
10761
11001
|
setSubagents(t) {
|
|
10762
|
-
if (!
|
|
11002
|
+
if (!Qe) {
|
|
10763
11003
|
e.debug && console.warn("[page-agent-sdk][setSubagents] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
10764
11004
|
return;
|
|
10765
11005
|
}
|
|
10766
|
-
|
|
11006
|
+
Qe.set(t), J.infoTick.value++;
|
|
10767
11007
|
},
|
|
10768
11008
|
addSubagent(t) {
|
|
10769
|
-
if (!
|
|
11009
|
+
if (!Qe) {
|
|
10770
11010
|
e.debug && console.warn("[page-agent-sdk][addSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略");
|
|
10771
11011
|
return;
|
|
10772
11012
|
}
|
|
10773
|
-
|
|
11013
|
+
Qe.add(t), J.infoTick.value++;
|
|
10774
11014
|
},
|
|
10775
11015
|
removeSubagent(t) {
|
|
10776
|
-
if (!
|
|
10777
|
-
let n =
|
|
11016
|
+
if (!Qe) return e.debug && console.warn("[page-agent-sdk][removeSubagent] 未配 subagents:[] 或 capabilities.subagent 关闭,忽略"), !1;
|
|
11017
|
+
let n = Qe.remove(t);
|
|
10778
11018
|
return n && J.infoTick.value++, n;
|
|
10779
11019
|
},
|
|
10780
11020
|
getActiveSubagents() {
|
|
10781
|
-
return
|
|
11021
|
+
return Ie?.getActive() ?? [];
|
|
10782
11022
|
},
|
|
10783
11023
|
get subagentHistory() {
|
|
10784
|
-
return
|
|
11024
|
+
return Ie?.getHistory() ?? [];
|
|
10785
11025
|
},
|
|
10786
11026
|
getInfo() {
|
|
10787
11027
|
return {
|
|
10788
11028
|
id: n,
|
|
10789
11029
|
sessionId: J.sessionId,
|
|
10790
11030
|
model: el(y) ? y.model ?? y.modelName : y.model,
|
|
10791
|
-
systemPrompt: J.agent?.getEffectiveSystemPrompt?.() ??
|
|
10792
|
-
tools: (J.agent?.allTools ??
|
|
11031
|
+
systemPrompt: J.agent?.getEffectiveSystemPrompt?.() ?? le + ic(z(), e.schemaHint),
|
|
11032
|
+
tools: (J.agent?.allTools ?? U).map((e) => ({
|
|
10793
11033
|
name: e.name,
|
|
10794
11034
|
description: e.description,
|
|
10795
11035
|
schema: e.schema,
|
|
10796
|
-
source:
|
|
11036
|
+
source: B.get(e.name) || "user"
|
|
10797
11037
|
})),
|
|
10798
|
-
skills: (
|
|
11038
|
+
skills: (st ? st.controller.get() : e.skills ?? []).map((e) => ({
|
|
10799
11039
|
name: e.name,
|
|
10800
11040
|
description: e.description
|
|
10801
11041
|
})),
|
|
10802
|
-
data:
|
|
10803
|
-
description:
|
|
10804
|
-
schema:
|
|
11042
|
+
data: z() ? {
|
|
11043
|
+
description: z().description,
|
|
11044
|
+
schema: z().schema
|
|
10805
11045
|
} : void 0,
|
|
10806
11046
|
contextPreset: e.contextPreset ?? "auto",
|
|
10807
11047
|
compression: {
|
|
@@ -10810,7 +11050,7 @@ function wd(e, n) {
|
|
|
10810
11050
|
promptSoftCap: as(f.contextWindow, h.promptSoftCapTokens)
|
|
10811
11051
|
},
|
|
10812
11052
|
memory: E.get(),
|
|
10813
|
-
middleware:
|
|
11053
|
+
middleware: vt.map((e) => e.name),
|
|
10814
11054
|
todos: (J.agent?.getState?.()?.todos ?? []).map((e) => ({
|
|
10815
11055
|
id: e.id,
|
|
10816
11056
|
content: e.content,
|
|
@@ -10821,32 +11061,33 @@ function wd(e, n) {
|
|
|
10821
11061
|
...e.evidence === void 0 ? {} : { evidence: e.evidence }
|
|
10822
11062
|
})),
|
|
10823
11063
|
planPhase: S.getPlanPhase(),
|
|
10824
|
-
mission:
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
11064
|
+
mission: Oe ? C.getMission() : void 0,
|
|
11065
|
+
preferences: ft && mt ? mt.getPreferences() : void 0,
|
|
11066
|
+
workingMemory: ke ? T.getWorkingMemory() : void 0,
|
|
11067
|
+
focus: H ? w.getFocus() : void 0,
|
|
11068
|
+
focuses: H ? w.getFocuses() : [],
|
|
11069
|
+
trace: se && J.agent?.spans ? {
|
|
10829
11070
|
spans: J.agent.spans.value,
|
|
10830
11071
|
metrics: li(J.agent.spans.value)
|
|
10831
11072
|
} : void 0,
|
|
10832
11073
|
actions: ed(e.actions ?? {}),
|
|
10833
11074
|
subagent: {
|
|
10834
|
-
enabled: !!
|
|
11075
|
+
enabled: !!qe,
|
|
10835
11076
|
maxDepth: e.subagent?.maxDepth ?? 1,
|
|
10836
11077
|
maxParallel: e.subagent?.maxParallel ?? 4,
|
|
10837
11078
|
allowedTools: e.subagent?.allowedTools ?? [],
|
|
10838
|
-
subagents:
|
|
10839
|
-
active:
|
|
10840
|
-
history:
|
|
10841
|
-
lockedComponents:
|
|
11079
|
+
subagents: Qe?.get() ?? [],
|
|
11080
|
+
active: Ie?.getActive() ?? [],
|
|
11081
|
+
history: Ie?.getHistory() ?? [],
|
|
11082
|
+
lockedComponents: Ye?.locked() ?? {}
|
|
10842
11083
|
},
|
|
10843
11084
|
verify: {
|
|
10844
|
-
enabled:
|
|
10845
|
-
maxAttempts:
|
|
10846
|
-
adversarial:
|
|
11085
|
+
enabled: !!tt,
|
|
11086
|
+
maxAttempts: Be ? Le : 0,
|
|
11087
|
+
adversarial: Be && !!e.verify?.adversarial
|
|
10847
11088
|
},
|
|
10848
11089
|
context: (() => {
|
|
10849
|
-
let e =
|
|
11090
|
+
let e = nt?.getSnapshot();
|
|
10850
11091
|
if (e) {
|
|
10851
11092
|
let t = J.agent?.getState?.()?.lastCompression;
|
|
10852
11093
|
t && (e.compression = t);
|
|
@@ -10863,47 +11104,58 @@ function wd(e, n) {
|
|
|
10863
11104
|
};
|
|
10864
11105
|
},
|
|
10865
11106
|
getMission() {
|
|
10866
|
-
return
|
|
11107
|
+
return Oe ? C.getMission() : void 0;
|
|
10867
11108
|
},
|
|
10868
11109
|
setMission(t) {
|
|
10869
|
-
if (!
|
|
11110
|
+
if (!Oe) {
|
|
10870
11111
|
e.debug && console.warn("[page-agent-sdk][mission] capabilities.missionAnchor 关闭,setMission 忽略");
|
|
10871
11112
|
return;
|
|
10872
11113
|
}
|
|
10873
11114
|
C.setMission(t), J.infoTick.value++;
|
|
10874
11115
|
},
|
|
11116
|
+
getPreferences() {
|
|
11117
|
+
return mt ? mt.getPreferences() : [];
|
|
11118
|
+
},
|
|
11119
|
+
async removePreference(e) {
|
|
11120
|
+
if (!mt) return !1;
|
|
11121
|
+
let t = await mt.removePreference(e);
|
|
11122
|
+
return t && J.infoTick.value++, t;
|
|
11123
|
+
},
|
|
11124
|
+
async clearPreferences() {
|
|
11125
|
+
mt && (await mt.clearPreferences(), J.infoTick.value++);
|
|
11126
|
+
},
|
|
10875
11127
|
getFocus() {
|
|
10876
|
-
return
|
|
11128
|
+
return H ? w.getFocus() : void 0;
|
|
10877
11129
|
},
|
|
10878
11130
|
getFocuses() {
|
|
10879
|
-
return
|
|
11131
|
+
return H ? w.getFocuses() : [];
|
|
10880
11132
|
},
|
|
10881
11133
|
setFocus(t) {
|
|
10882
|
-
let n =
|
|
11134
|
+
let n = Vd(t, "setFocus", H, () => z()?.schema, e.debug);
|
|
10883
11135
|
return n.ok ? (w.setFocus(t), J.infoTick.value++, { ok: !0 }) : n;
|
|
10884
11136
|
},
|
|
10885
11137
|
addFocus(t) {
|
|
10886
|
-
let n =
|
|
11138
|
+
let n = Vd(t, "addFocus", H, () => z()?.schema, e.debug);
|
|
10887
11139
|
return n.ok ? w.getFocuses().length >= 8 ? (e.debug && console.warn("[page-agent-sdk][focus] addFocus 拒绝:焦点数已达上限 8(augmentPrompt 注入每焦点子树 schema,过多致 system prompt 超预算)"), {
|
|
10888
11140
|
ok: !1,
|
|
10889
11141
|
error: "焦点数上限 8(避免 system prompt 撑爆)"
|
|
10890
11142
|
}) : (w.addFocus(t), J.infoTick.value++, { ok: !0 }) : n;
|
|
10891
11143
|
},
|
|
10892
11144
|
removeFocus(e) {
|
|
10893
|
-
|
|
11145
|
+
H && (w.removeFocus(e), J.infoTick.value++);
|
|
10894
11146
|
},
|
|
10895
11147
|
clearFocus() {
|
|
10896
|
-
|
|
11148
|
+
H && (w.clearFocus(), J.infoTick.value++);
|
|
10897
11149
|
}
|
|
10898
11150
|
};
|
|
10899
|
-
async function
|
|
11151
|
+
async function kt() {
|
|
10900
11152
|
if (!s) return;
|
|
10901
11153
|
await s.ready;
|
|
10902
11154
|
let t = e.session || {};
|
|
10903
11155
|
if (t.id) {
|
|
10904
11156
|
J.sessionId = t.id;
|
|
10905
11157
|
let e = await s.load(n, J.sessionId);
|
|
10906
|
-
e ? (J.applySnapshot(e),
|
|
11158
|
+
e ? (J.applySnapshot(e), G({
|
|
10907
11159
|
type: "session_restored",
|
|
10908
11160
|
sessionId: J.sessionId,
|
|
10909
11161
|
rounds: e.messages?.length ?? 0
|
|
@@ -10913,35 +11165,35 @@ function wd(e, n) {
|
|
|
10913
11165
|
if (e.debug && console.log("[page-agent-sdk][restore] listSessions", n, r.length, r.map((e) => e.sessionId)), r.length) {
|
|
10914
11166
|
J.sessionId = r[0].sessionId;
|
|
10915
11167
|
let t = await s.load(n, J.sessionId);
|
|
10916
|
-
t ? (J.applySnapshot(t),
|
|
11168
|
+
t ? (J.applySnapshot(t), G({
|
|
10917
11169
|
type: "session_restored",
|
|
10918
11170
|
sessionId: J.sessionId,
|
|
10919
11171
|
rounds: t.messages?.length ?? 0
|
|
10920
11172
|
}), e.debug && console.log("[page-agent-sdk][restore] 恢复会话", J.sessionId, `${t.messages?.length ?? 0} msgs`)) : e.debug && console.log("[page-agent-sdk][restore] 会话 meta 存在但快照为空", J.sessionId);
|
|
10921
11173
|
} else J.sessionId = await s.createSession(n, t.title), e.debug && console.log("[page-agent-sdk][restore] 新建会话(无历史)", J.sessionId);
|
|
10922
11174
|
} else J.sessionId = await s.createSession(n, t.title);
|
|
10923
|
-
e.memory &&
|
|
11175
|
+
e.memory && zt({ memory: E.get() || (typeof e.memory == "string" ? e.memory : "") }), K();
|
|
10924
11176
|
}
|
|
10925
|
-
async function
|
|
10926
|
-
await
|
|
11177
|
+
async function jt() {
|
|
11178
|
+
await gt();
|
|
10927
11179
|
}
|
|
10928
|
-
function
|
|
11180
|
+
function Mt(e) {
|
|
10929
11181
|
let t = {};
|
|
10930
|
-
for (let n of
|
|
11182
|
+
for (let n of Nd(e)) {
|
|
10931
11183
|
let e = x.files[n];
|
|
10932
11184
|
e && (t[n] = e.content);
|
|
10933
11185
|
}
|
|
10934
11186
|
return t;
|
|
10935
11187
|
}
|
|
10936
|
-
function
|
|
10937
|
-
let e =
|
|
11188
|
+
function Nt() {
|
|
11189
|
+
let e = Pd(x.files, Nd(b));
|
|
10938
11190
|
for (let t of e) delete x.files[t];
|
|
10939
11191
|
}
|
|
10940
|
-
function
|
|
10941
|
-
let e = Xo(b,
|
|
11192
|
+
function Ft() {
|
|
11193
|
+
let e = Xo(b, yt);
|
|
10942
11194
|
if (!e.trimmed) return;
|
|
10943
11195
|
let { older: t, summary: n } = e;
|
|
10944
|
-
if (
|
|
11196
|
+
if (G({
|
|
10945
11197
|
type: "context_trimmed",
|
|
10946
11198
|
dropped: t.map((e) => ({
|
|
10947
11199
|
round: e.round,
|
|
@@ -10949,22 +11201,22 @@ function wd(e, n) {
|
|
|
10949
11201
|
assistant: e.assistantMsgs.map((e) => e.content),
|
|
10950
11202
|
steps: e.assistantMsgs.flatMap((e) => e.steps ?? [])
|
|
10951
11203
|
})),
|
|
10952
|
-
vfsResults:
|
|
11204
|
+
vfsResults: Mt(t.flatMap((e) => [e.userMsg, ...e.assistantMsgs])),
|
|
10953
11205
|
summary: n.content,
|
|
10954
11206
|
reason: "max_memory_rounds"
|
|
10955
|
-
}), b.splice(e.deleteFrom, e.deleteCount, n),
|
|
11207
|
+
}), b.splice(e.deleteFrom, e.deleteCount, n), Nt(), g && l) {
|
|
10956
11208
|
let n = e.summary, { prevSeg: r } = e;
|
|
10957
11209
|
(async () => {
|
|
10958
11210
|
try {
|
|
10959
11211
|
let e = await l(ts(t, v)), i = b.indexOf(n);
|
|
10960
11212
|
if (i < 0) return;
|
|
10961
|
-
b[i].content = Yo(t, r, e),
|
|
11213
|
+
b[i].content = Yo(t, r, e), Vt();
|
|
10962
11214
|
} catch {}
|
|
10963
11215
|
})();
|
|
10964
11216
|
}
|
|
10965
11217
|
}
|
|
10966
|
-
let
|
|
10967
|
-
function
|
|
11218
|
+
let It, Lt = !1;
|
|
11219
|
+
function Rt(t, n) {
|
|
10968
11220
|
e.debug && console.warn(`[page-agent-sdk][persist] ${t} 失败(已吞):`, n);
|
|
10969
11221
|
let r = J.agent?.debugLogs;
|
|
10970
11222
|
r && r.value.push({
|
|
@@ -10977,30 +11229,30 @@ function wd(e, n) {
|
|
|
10977
11229
|
}
|
|
10978
11230
|
});
|
|
10979
11231
|
}
|
|
10980
|
-
function
|
|
10981
|
-
!J.sessionId || !s || s.save(n, J.sessionId, e).catch((e) =>
|
|
11232
|
+
function zt(e) {
|
|
11233
|
+
!J.sessionId || !s || s.save(n, J.sessionId, e).catch((e) => Rt("save", e));
|
|
10982
11234
|
}
|
|
10983
|
-
function
|
|
10984
|
-
s && s.updateTitle(n, e, t).catch((e) =>
|
|
11235
|
+
function Bt(e, t) {
|
|
11236
|
+
s && s.updateTitle(n, e, t).catch((e) => Rt("updateTitle", e));
|
|
10985
11237
|
}
|
|
10986
|
-
function
|
|
11238
|
+
function Vt() {
|
|
10987
11239
|
if (!J.sessionId || !s) return;
|
|
10988
|
-
if (
|
|
11240
|
+
if (zt({ messages: JSON.parse(JSON.stringify(b)) }), zt({ todos: J.agent?.getState?.()?.todos ?? [] }), Oe) {
|
|
10989
11241
|
let e = C.getMission();
|
|
10990
|
-
e &&
|
|
11242
|
+
e && zt({ mission: e });
|
|
10991
11243
|
}
|
|
10992
|
-
if (
|
|
11244
|
+
if (ke) {
|
|
10993
11245
|
let e = T.getWorkingMemory();
|
|
10994
|
-
e &&
|
|
11246
|
+
e && zt({ workingMemory: e });
|
|
10995
11247
|
}
|
|
10996
|
-
if (
|
|
11248
|
+
if (H) {
|
|
10997
11249
|
let e = w.getFocuses();
|
|
10998
|
-
|
|
11250
|
+
zt({ focus: e.length ? e : null });
|
|
10999
11251
|
}
|
|
11000
|
-
|
|
11252
|
+
ce && F && (zt({ checkpoints: F.exportStack() }), zt({ usage: i }));
|
|
11001
11253
|
let t = $c(b);
|
|
11002
|
-
if (t && t !==
|
|
11003
|
-
|
|
11254
|
+
if (t && t !== It && (It = t, Bt(J.sessionId, t)), e.autoTitle !== !1 && u && !Lt && b.some((e) => e.role === "user") && b.some((e) => e.role === "assistant")) {
|
|
11255
|
+
Lt = !0;
|
|
11004
11256
|
let e = J.sessionId;
|
|
11005
11257
|
(async () => {
|
|
11006
11258
|
try {
|
|
@@ -11009,9 +11261,9 @@ function wd(e, n) {
|
|
|
11009
11261
|
try {
|
|
11010
11262
|
await s.updateTitle(n, e, t);
|
|
11011
11263
|
} catch (e) {
|
|
11012
|
-
|
|
11264
|
+
Rt("updateTitle", e);
|
|
11013
11265
|
}
|
|
11014
|
-
await
|
|
11266
|
+
await K();
|
|
11015
11267
|
}
|
|
11016
11268
|
} catch {}
|
|
11017
11269
|
})();
|
|
@@ -11019,16 +11271,16 @@ function wd(e, n) {
|
|
|
11019
11271
|
e.debug && console.log("[page-agent-sdk][persist] save", J.sessionId, `${b.length} msgs`);
|
|
11020
11272
|
}
|
|
11021
11273
|
return J.initDone = (async () => {
|
|
11022
|
-
await
|
|
11274
|
+
await kt(), await jt(), mt && await mt.preload(), e.mcp?.length && (async () => {
|
|
11023
11275
|
let t = await Promise.allSettled(e.mcp.map((e) => tc(e))), n = t.flatMap((e) => e.status === "fulfilled" ? [e.value.close] : []);
|
|
11024
|
-
if (
|
|
11276
|
+
if (ge) {
|
|
11025
11277
|
Promise.allSettled(n.map((e) => e()));
|
|
11026
11278
|
return;
|
|
11027
11279
|
}
|
|
11028
11280
|
J.mcpClosers = n, J.mcpServers = [];
|
|
11029
11281
|
let r = /* @__PURE__ */ new Set();
|
|
11030
|
-
for (let e of
|
|
11031
|
-
let t =
|
|
11282
|
+
for (let e of U) {
|
|
11283
|
+
let t = B.get(e.name);
|
|
11032
11284
|
t && !t.startsWith("mcp:") && r.add(e.name);
|
|
11033
11285
|
}
|
|
11034
11286
|
t.forEach((t, n) => {
|
|
@@ -11042,30 +11294,30 @@ function wd(e, n) {
|
|
|
11042
11294
|
console.warn(`[page-agent-sdk][mcp] 工具 "${e.name}" 与内置工具重名,已拒绝注入(安全保留字保护)`);
|
|
11043
11295
|
return;
|
|
11044
11296
|
}
|
|
11045
|
-
|
|
11297
|
+
B.set(e.name, `mcp:${a}`), he.push(e);
|
|
11046
11298
|
})) : console.warn(`[page-agent-sdk][mcp] server ${a} 连接失败:`, t.reason);
|
|
11047
|
-
}),
|
|
11299
|
+
}), he.length && (U = W(), J.agent && J.agent.setTools(U), J.infoTick.value++), e.debug && console.log(`[page-agent-sdk][mcp] 注入 ${he.length} 个工具,${J.mcpServers.length} 个 server`);
|
|
11048
11300
|
})();
|
|
11049
11301
|
let t = el(e.llm) ? e.llm : await m(e.llm);
|
|
11050
11302
|
J.agent = Wi({
|
|
11051
11303
|
llm: t,
|
|
11052
|
-
systemPrompt:
|
|
11053
|
-
tools:
|
|
11054
|
-
middleware:
|
|
11304
|
+
systemPrompt: le,
|
|
11305
|
+
tools: U,
|
|
11306
|
+
middleware: vt,
|
|
11055
11307
|
maxToolRounds: e.maxToolRounds,
|
|
11056
11308
|
maxRetries: e.maxRetries,
|
|
11057
11309
|
stallMs: e.streamStallMs ?? 9e4,
|
|
11058
11310
|
maxParallelTools: e.maxParallelTools,
|
|
11059
11311
|
contextWindow: f.contextWindow,
|
|
11060
11312
|
maxOutputTokens: f.maxOutputTokens,
|
|
11061
|
-
maxVerifyAttempts:
|
|
11313
|
+
maxVerifyAttempts: Be ? Le : 0,
|
|
11062
11314
|
roundTokenBudget: e.roundTokenBudget ?? 0,
|
|
11063
11315
|
onLlmChange: (e) => {
|
|
11064
11316
|
y = e;
|
|
11065
11317
|
},
|
|
11066
|
-
onTrace:
|
|
11318
|
+
onTrace: se ? (e, t) => {
|
|
11067
11319
|
try {
|
|
11068
|
-
|
|
11320
|
+
G({
|
|
11069
11321
|
type: "trace",
|
|
11070
11322
|
spans: e,
|
|
11071
11323
|
metrics: t
|
|
@@ -11073,16 +11325,16 @@ function wd(e, n) {
|
|
|
11073
11325
|
} catch {}
|
|
11074
11326
|
} : void 0,
|
|
11075
11327
|
debug: e.debug
|
|
11076
|
-
}), D.current = J.agent,
|
|
11077
|
-
J.agent && J.agent.setTools(
|
|
11328
|
+
}), D.current = J.agent, Ze && Ze.setReconfigureHook && Ze.setReconfigureHook(() => {
|
|
11329
|
+
J.agent && J.agent.setTools(W());
|
|
11078
11330
|
});
|
|
11079
11331
|
})(), J;
|
|
11080
11332
|
}
|
|
11081
|
-
function
|
|
11333
|
+
function Ud(e, t) {
|
|
11082
11334
|
let n = e.id ?? dl();
|
|
11083
11335
|
e.id || console.warn(`[page-agent-sdk] 未传 options.id,已生成随机 id "${n}"。刷新后持久化数据无法恢复,请传稳定 id。`);
|
|
11084
|
-
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ?
|
|
11085
|
-
o ? a = o : (a =
|
|
11336
|
+
let r = e.streaming ?? !0, i = e.ui ?? "default", a, o = e.shareContext ? Ld.get(n) : void 0;
|
|
11337
|
+
o ? a = o : (a = Hd(e, n), e.shareContext && Ld.set(n, a)), a.refCount++;
|
|
11086
11338
|
let s = null, c = Ll(e), l = null, u = null;
|
|
11087
11339
|
async function d(n) {
|
|
11088
11340
|
if (await a.initDone, s) {
|
|
@@ -11177,6 +11429,9 @@ function Td(e, t) {
|
|
|
11177
11429
|
inspectContext: () => a.getInfo().context,
|
|
11178
11430
|
getMission: a.getMission,
|
|
11179
11431
|
setMission: a.setMission,
|
|
11432
|
+
getPreferences: a.getPreferences,
|
|
11433
|
+
removePreference: a.removePreference,
|
|
11434
|
+
clearPreferences: a.clearPreferences,
|
|
11180
11435
|
getFocus: a.getFocus,
|
|
11181
11436
|
getFocuses: a.getFocuses,
|
|
11182
11437
|
setFocus: a.setFocus,
|
|
@@ -11299,7 +11554,7 @@ function Td(e, t) {
|
|
|
11299
11554
|
}
|
|
11300
11555
|
//#endregion
|
|
11301
11556
|
//#region src/core/sdk/ragSubagent.ts
|
|
11302
|
-
function
|
|
11557
|
+
function Wd(e, t, n, r, i) {
|
|
11303
11558
|
let a = [];
|
|
11304
11559
|
e && a.push("vfs_grep + vfs_read(搜预注入文档)"), t && a.push(`${r}(语义检索)`), n && a.push(`${i}(按 source 加载)`), a.push("fetch_document(公网 URL)");
|
|
11305
11560
|
let o = [];
|
|
@@ -11314,7 +11569,7 @@ function Ed(e, t, n, r, i) {
|
|
|
11314
11569
|
|
|
11315
11570
|
你是只读检索角色,不要尝试修改任何数据。不要尝试上面未列出的工具。`;
|
|
11316
11571
|
}
|
|
11317
|
-
function
|
|
11572
|
+
function Gd(e, t, n, r, i) {
|
|
11318
11573
|
let a = [], o = [];
|
|
11319
11574
|
return e && (a.push("- vfs_grep / vfs_read:搜集成方预注入 vfs 的文档(组件文档 / UI 规范)—— 快、静态,先查"), o.push("- 静态文档(组件库文档 / UI 规范):vfs_grep")), t && (a.push(`- ${r}:语义检索(retriever 向量库)—— 模糊匹配,关键词不确定 / 语义相似时用`), o.push(`- 语义相似(「瀑布流组件」「倒计时」「拼团」):${r}`)), n && (a.push(`- ${i}:按 source 精确加载(已知文档 id / URL / key)—— 精确取特定文档`), o.push(`- 已知文档 id / URL:${i}`)), a.push("- fetch_document:公网 URL —— 查公开资料"), o.push("- 公开 URL(设计规范网站 / 第三方文档):fetch_document"), `# 知识检索策略(RAG)
|
|
11320
11575
|
|
|
@@ -11331,12 +11586,12 @@ ${a.join("\n")}
|
|
|
11331
11586
|
## 何时用何源
|
|
11332
11587
|
${o.join("\n")}`;
|
|
11333
11588
|
}
|
|
11334
|
-
var
|
|
11589
|
+
var Kd = {
|
|
11335
11590
|
name: "rag-search",
|
|
11336
11591
|
description: "多源知识检索策略:vfs 预注入文档 → 语义检索 → 指定文档加载 → 公网;综合结构化结论 + 溯源",
|
|
11337
|
-
getContent: () =>
|
|
11592
|
+
getContent: () => Gd(!0, !0, !0, "search_docs", "load_doc")
|
|
11338
11593
|
};
|
|
11339
|
-
function
|
|
11594
|
+
function qd(e, n, i) {
|
|
11340
11595
|
return r(async ({ query: e, topK: t }) => {
|
|
11341
11596
|
try {
|
|
11342
11597
|
let r = await n(e, { topK: t ?? i });
|
|
@@ -11353,7 +11608,7 @@ function kd(e, n, i) {
|
|
|
11353
11608
|
})
|
|
11354
11609
|
});
|
|
11355
11610
|
}
|
|
11356
|
-
function
|
|
11611
|
+
function Jd(e, n) {
|
|
11357
11612
|
return r(async ({ source: e }) => {
|
|
11358
11613
|
try {
|
|
11359
11614
|
let t = await n(e), r = Array.isArray(t) ? t : [t];
|
|
@@ -11367,19 +11622,19 @@ function Ad(e, n) {
|
|
|
11367
11622
|
schema: t.object({ source: t.string().describe("文档标识(id/URL/key)") })
|
|
11368
11623
|
});
|
|
11369
11624
|
}
|
|
11370
|
-
function
|
|
11625
|
+
function Yd(e) {
|
|
11371
11626
|
let { retriever: t, loader: n, useVfs: r = !0, id: i = "rag", description: a, topK: o = 5, searchToolName: s = "search_docs", loadToolName: c = "load_doc", maxToolRounds: l = 8, summarization: u, skills: d, extraTools: f } = e;
|
|
11372
11627
|
if (!t && !n && r === !1) throw Error("[page-agent-sdk][createRagSubagent] 至少配一种知识源:retriever / loader / useVfs(true)");
|
|
11373
11628
|
let p = [];
|
|
11374
|
-
t && p.push(
|
|
11629
|
+
t && p.push(qd(s, t, o)), n && p.push(Jd(c, n)), f && p.push(...f);
|
|
11375
11630
|
let m = r ? [
|
|
11376
11631
|
"vfs_grep",
|
|
11377
11632
|
"vfs_read",
|
|
11378
11633
|
"vfs_json_read"
|
|
11379
|
-
] : void 0, h =
|
|
11634
|
+
] : void 0, h = Wd(r, !!t, !!n, s, c), g = {
|
|
11380
11635
|
name: "rag-search",
|
|
11381
|
-
description:
|
|
11382
|
-
getContent: () =>
|
|
11636
|
+
description: Kd.description,
|
|
11637
|
+
getContent: () => Gd(r, !!t, !!n, s, c)
|
|
11383
11638
|
};
|
|
11384
11639
|
return {
|
|
11385
11640
|
id: i,
|
|
@@ -11394,7 +11649,7 @@ function jd(e) {
|
|
|
11394
11649
|
}
|
|
11395
11650
|
//#endregion
|
|
11396
11651
|
//#region src/core/utils/clipboard.ts
|
|
11397
|
-
async function
|
|
11652
|
+
async function Xd(e) {
|
|
11398
11653
|
try {
|
|
11399
11654
|
let t = globalThis.navigator?.clipboard;
|
|
11400
11655
|
if (t && typeof t.writeText == "function") return await t.writeText(e), !0;
|
|
@@ -11412,9 +11667,9 @@ async function Md(e) {
|
|
|
11412
11667
|
}
|
|
11413
11668
|
//#endregion
|
|
11414
11669
|
//#region src/core/composables/useChat.ts
|
|
11415
|
-
var
|
|
11416
|
-
function
|
|
11417
|
-
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a } = e, o = /* @__PURE__ */
|
|
11670
|
+
var Zd = 4e3;
|
|
11671
|
+
function Qd(e = {}) {
|
|
11672
|
+
let { fetchResponse: t, fetchStream: n, onPersist: r, onClear: i, onQueuedCleared: a } = e, o = /* @__PURE__ */ bt({
|
|
11418
11673
|
messages: e.messages ?? [],
|
|
11419
11674
|
loading: !1,
|
|
11420
11675
|
error: null
|
|
@@ -11440,7 +11695,7 @@ function Pd(e = {}) {
|
|
|
11440
11695
|
}
|
|
11441
11696
|
async function g(e) {
|
|
11442
11697
|
if (c.value = !0, n) {
|
|
11443
|
-
let t = /* @__PURE__ */
|
|
11698
|
+
let t = /* @__PURE__ */ bt({
|
|
11444
11699
|
role: "assistant",
|
|
11445
11700
|
content: "",
|
|
11446
11701
|
timestamp: Date.now(),
|
|
@@ -11464,25 +11719,34 @@ function Pd(e = {}) {
|
|
|
11464
11719
|
t.steps.push({
|
|
11465
11720
|
name: e.name,
|
|
11466
11721
|
args: e.args,
|
|
11467
|
-
status: "running"
|
|
11722
|
+
status: "running",
|
|
11723
|
+
id: e.id
|
|
11468
11724
|
});
|
|
11469
11725
|
break;
|
|
11470
|
-
case "tool_result":
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
let r = t.steps[
|
|
11474
|
-
|
|
11475
|
-
|
|
11726
|
+
case "tool_result": {
|
|
11727
|
+
let n = -1;
|
|
11728
|
+
if (e.id !== void 0 && (n = t.steps.findIndex((t) => t.id === e.id)), n < 0) {
|
|
11729
|
+
for (let r = t.steps.length - 1; r >= 0; r--) if (t.steps[r].name === e.name && t.steps[r].status === "running") {
|
|
11730
|
+
n = r;
|
|
11731
|
+
break;
|
|
11732
|
+
}
|
|
11733
|
+
}
|
|
11734
|
+
if (n >= 0) {
|
|
11735
|
+
let r = t.steps[n];
|
|
11736
|
+
r.result = e.result, r.status = e.status, r.durationMs = e.durationMs;
|
|
11737
|
+
let i = r.subReason;
|
|
11738
|
+
i && i.length > 80 && (r.subReason = i.slice(0, 80) + "…");
|
|
11476
11739
|
}
|
|
11477
11740
|
break;
|
|
11741
|
+
}
|
|
11478
11742
|
case "subagent": {
|
|
11479
|
-
let n = t.steps[t.steps.length - 1];
|
|
11743
|
+
let n = e.toolCallId === void 0 ? t.steps[t.steps.length - 1] : t.steps.find((t) => t.id === e.toolCallId);
|
|
11480
11744
|
if (!n) break;
|
|
11481
11745
|
if (e.kind === "reasoning") {
|
|
11482
11746
|
let t = e.delta || "";
|
|
11483
11747
|
n.subReasonFull = (n.subReasonFull || "") + t;
|
|
11484
11748
|
let r = (n.subReason || "") + t;
|
|
11485
|
-
n.subReason = r.length >
|
|
11749
|
+
n.subReason = r.length > Zd ? r.slice(-4e3) : r;
|
|
11486
11750
|
break;
|
|
11487
11751
|
}
|
|
11488
11752
|
n.children ||= [];
|
|
@@ -11611,7 +11875,7 @@ function Pd(e = {}) {
|
|
|
11611
11875
|
}
|
|
11612
11876
|
//#endregion
|
|
11613
11877
|
//#region src/core/components/icons.ts
|
|
11614
|
-
var
|
|
11878
|
+
var $d = {
|
|
11615
11879
|
header: "🤖",
|
|
11616
11880
|
subagent: "🤖",
|
|
11617
11881
|
subagentProgress: "🧬",
|
|
@@ -11622,10 +11886,10 @@ var Fd = {
|
|
|
11622
11886
|
recommend: "💡",
|
|
11623
11887
|
conflict: "⚠️"
|
|
11624
11888
|
};
|
|
11625
|
-
function
|
|
11626
|
-
let t = {
|
|
11889
|
+
function ef(e) {
|
|
11890
|
+
let t = { ...$d };
|
|
11627
11891
|
if (!e) return t;
|
|
11628
|
-
let n = Object.keys(
|
|
11892
|
+
let n = Object.keys($d);
|
|
11629
11893
|
for (let r of n) {
|
|
11630
11894
|
let n = e[r];
|
|
11631
11895
|
typeof n == "string" && (t[r] = n);
|
|
@@ -11634,7 +11898,7 @@ function Id(e) {
|
|
|
11634
11898
|
}
|
|
11635
11899
|
//#endregion
|
|
11636
11900
|
//#region src/core/components/messages.ts
|
|
11637
|
-
var
|
|
11901
|
+
var tf = {
|
|
11638
11902
|
defaultTitle: "AI 助手",
|
|
11639
11903
|
inputPlaceholder: "输入消息,Enter 发送...",
|
|
11640
11904
|
newSession: "新建会话",
|
|
@@ -11809,6 +12073,13 @@ var Ld = {
|
|
|
11809
12073
|
debugSameAsMain: "(同主)",
|
|
11810
12074
|
debugTodosTitle: "任务清单",
|
|
11811
12075
|
debugMemoryTitle: "持久指令 (memory)",
|
|
12076
|
+
debugPrefsTitle: "用户偏好(跨会话)",
|
|
12077
|
+
debugPrefTopicColor: "颜色",
|
|
12078
|
+
debugPrefTopicCopy: "文案",
|
|
12079
|
+
debugPrefTopicLayout: "排版",
|
|
12080
|
+
debugPrefTopicInteraction: "交互",
|
|
12081
|
+
debugPrefTopicTech: "技术",
|
|
12082
|
+
debugPrefTopicOther: "其他",
|
|
11812
12083
|
debugLastCompTitle: "上轮压缩",
|
|
11813
12084
|
debugTriggered: "触发",
|
|
11814
12085
|
debugNotTriggered: "✗(未达阈值)",
|
|
@@ -11854,8 +12125,8 @@ var Ld = {
|
|
|
11854
12125
|
codeDemoText: "这是一段示例文字,用于展示 CSS 效果。",
|
|
11855
12126
|
codeDemoButton: "按钮",
|
|
11856
12127
|
codeDemoInput: "输入框"
|
|
11857
|
-
},
|
|
11858
|
-
"zh-CN":
|
|
12128
|
+
}, nf = {
|
|
12129
|
+
"zh-CN": tf,
|
|
11859
12130
|
"en-US": {
|
|
11860
12131
|
defaultTitle: "AI Assistant",
|
|
11861
12132
|
inputPlaceholder: "Type a message, Enter to send...",
|
|
@@ -12031,6 +12302,13 @@ var Ld = {
|
|
|
12031
12302
|
debugSameAsMain: " (same as main)",
|
|
12032
12303
|
debugTodosTitle: "Todos",
|
|
12033
12304
|
debugMemoryTitle: "Persistent instructions (memory)",
|
|
12305
|
+
debugPrefsTitle: "User preferences (cross-session)",
|
|
12306
|
+
debugPrefTopicColor: "color",
|
|
12307
|
+
debugPrefTopicCopy: "copy",
|
|
12308
|
+
debugPrefTopicLayout: "layout",
|
|
12309
|
+
debugPrefTopicInteraction: "interaction",
|
|
12310
|
+
debugPrefTopicTech: "tech",
|
|
12311
|
+
debugPrefTopicOther: "other",
|
|
12034
12312
|
debugLastCompTitle: "Last compression",
|
|
12035
12313
|
debugTriggered: "Triggered",
|
|
12036
12314
|
debugNotTriggered: "✗ (below threshold)",
|
|
@@ -12078,10 +12356,10 @@ var Ld = {
|
|
|
12078
12356
|
codeDemoInput: "Input"
|
|
12079
12357
|
}
|
|
12080
12358
|
};
|
|
12081
|
-
function
|
|
12359
|
+
function rf(e = "zh-CN", t) {
|
|
12082
12360
|
let n = {
|
|
12083
|
-
...
|
|
12084
|
-
...
|
|
12361
|
+
...tf,
|
|
12362
|
+
...nf[e]
|
|
12085
12363
|
};
|
|
12086
12364
|
if (!t) return n;
|
|
12087
12365
|
let r = { ...n };
|
|
@@ -12093,9 +12371,9 @@ function zd(e = "zh-CN", t) {
|
|
|
12093
12371
|
}
|
|
12094
12372
|
//#endregion
|
|
12095
12373
|
//#region src/core/composables/chatContext.ts
|
|
12096
|
-
var
|
|
12097
|
-
function
|
|
12098
|
-
let t =
|
|
12374
|
+
var af = Symbol("chatContext");
|
|
12375
|
+
function of(e = {}) {
|
|
12376
|
+
let t = Qd({
|
|
12099
12377
|
fetchResponse: e.fetchResponse,
|
|
12100
12378
|
fetchStream: e.fetchStream,
|
|
12101
12379
|
messages: e.messages,
|
|
@@ -12115,7 +12393,7 @@ function Vd(e = {}) {
|
|
|
12115
12393
|
}, h = /* @__PURE__ */ At({}), g = (e) => h.value[e] === !0, _ = (e) => {
|
|
12116
12394
|
h.value[e] = !g(e);
|
|
12117
12395
|
}, v = /* @__PURE__ */ At(!1), y = (e) => {
|
|
12118
|
-
|
|
12396
|
+
Xd(e).then((e) => {
|
|
12119
12397
|
e && (v.value = !0, setTimeout(() => {
|
|
12120
12398
|
v.value = !1;
|
|
12121
12399
|
}, 1500));
|
|
@@ -12151,7 +12429,7 @@ function Vd(e = {}) {
|
|
|
12151
12429
|
e.onClearFocus?.();
|
|
12152
12430
|
}, j = (t) => {
|
|
12153
12431
|
e.onFocusChipClick?.(t);
|
|
12154
|
-
}, M =
|
|
12432
|
+
}, M = ef(e.icons), te = e.locale ?? "zh-CN";
|
|
12155
12433
|
return {
|
|
12156
12434
|
chat: t,
|
|
12157
12435
|
inputText: o,
|
|
@@ -12183,18 +12461,18 @@ function Vd(e = {}) {
|
|
|
12183
12461
|
focusChipClick: j,
|
|
12184
12462
|
icons: M,
|
|
12185
12463
|
locale: te,
|
|
12186
|
-
messages:
|
|
12464
|
+
messages: rf(te, e.dialogMessages)
|
|
12187
12465
|
};
|
|
12188
12466
|
}
|
|
12189
|
-
function
|
|
12190
|
-
let e = Rn(
|
|
12467
|
+
function sf() {
|
|
12468
|
+
let e = Rn(af);
|
|
12191
12469
|
if (!e) throw Error("useChatContext 必须在 provide(chatContextKey) 的组件子树内调用");
|
|
12192
12470
|
return e;
|
|
12193
12471
|
}
|
|
12194
12472
|
//#endregion
|
|
12195
12473
|
//#region src/core/index.headless.ts
|
|
12196
|
-
function
|
|
12197
|
-
return
|
|
12474
|
+
function cf(e) {
|
|
12475
|
+
return Ud(e);
|
|
12198
12476
|
}
|
|
12199
12477
|
//#endregion
|
|
12200
|
-
export { Rl as CAPABILITIES, Vl as CONTEXT_PRESETS, Qc as CompressDecisionSchema, is as DEFAULT_PROMPT_SOFT_CAP, nc as DEFAULT_SYSTEM_PROMPT, yc as HTML_VOID_TAGS, Ao as HUMAN_CONFIRM_TOOL_NAME, ai as MIN_CONTEXT_WINDOW, rs as SOFT_CAP_MIN_WINDOW, Zo as STOP_WORDS, Aa as UNSAFE_KEYS, ed as actionsToInspectInfo, $u as actionsToTools, Qr as agentError, Ys as analyzeContext, Ba as applyPatchToClone, Ua as applyPatchToLive, Zr as asAgentError, ic as buildDataPrompt, ac as buildSystemPrompt,
|
|
12478
|
+
export { Rl as CAPABILITIES, Vl as CONTEXT_PRESETS, Qc as CompressDecisionSchema, is as DEFAULT_PROMPT_SOFT_CAP, nc as DEFAULT_SYSTEM_PROMPT, yc as HTML_VOID_TAGS, Ao as HUMAN_CONFIRM_TOOL_NAME, ai as MIN_CONTEXT_WINDOW, rs as SOFT_CAP_MIN_WINDOW, Zo as STOP_WORDS, Aa as UNSAFE_KEYS, ed as actionsToInspectInfo, $u as actionsToTools, Qr as agentError, Ys as analyzeContext, Ba as applyPatchToClone, Ua as applyPatchToLive, Zr as asAgentError, ic as buildDataPrompt, ac as buildSystemPrompt, af as chatContextKey, Du as commitSetToBind, tc as connectMcp, m as constructLlmFromConfig, p as constructOpenLlmSync, Xd as copyText, Wi as createAgent, ko as createApprovalMiddleware, of as createChatContext, cf as createChatSdk, Bo as createCheckpointManager, Vo as createCheckpointMiddleware, ul as createConflictManager, Xs as createContextInspectorMiddleware, Fu as createDataOps, Gc as createHtmlFormatCheck, Jc as createHtmlSubagent, No as createHumanConfirmMiddleware, Mo as createHumanConfirmTool, jl as createMemoryBackend, So as createMemoryMiddleware, u as createProxyLlm, Yd as createRagSubagent, ao as createSandboxRunner, Bl as createSdkEvents, Fd as createSerialRunner, Fl as createSessionStore, pd as createSkillStore, Es as createSubagentMiddleware, us as createSubagentTracker, ks as createSubagentsMiddleware, sd as createUsageHintsMiddleware, As as createVerifyMiddleware, lc as createVfs, Nl as createWebStorageBackend, Is as createWriteBackCheck, Fa as deepClone, rd as defineDataToolset, so as defineSkill, Yc as defineTool, Pa as deleteByPath, $c as deriveTitle, sa as describeSchemaNode, Oi as detectGarbledToolCall, qa as diffObjects, Vu as domToStructure, Uu as domTools, nd as domToolsStatic, $o as estimateMessageTokens, es as estimateRoundTokens, X as estimateTokens, g as extractReasoningDelta, ba as extractSchemaHint, Zs as extractText, h as extractTextDelta, _ as extractUsage, Lu as fetchDocTools, td as fetchTools, Eu as filterByToolMode, Ka as findStrippedKeys, ca as formatConstraints, qr as formatZodIssues, Z as getByPath, Hu as getDomTool, Ku as getEnvSummary, Ji as getSchemaAtPath, Gi as getSchemaTopKeys, li as getTraceMetrics, $ as hashValue, ha as htmlOrchestratorPrompt, ts as indexSummarize, Yu as inspectEnvTool, Xu as inspectTools, el as isChatModel, yi as isContextLengthError, Ki as isPathAllowed, Cl as isQuotaError, ja as isUnsafePath, tu as jpEval, Yr as jsonParseError, Ra as limitDepth, Ia as maybeParseValue, y as normalizeUsage, ci as offloadPassThroughChars, si as offloadThresholdChars, ma as presets, ta as projectBySchema, ea as projectBySchemaDeep, La as projectFields, ns as recallRounds, la as renderSchemaHint, ua as renderSchemaOverview, pa as renderSchemaShallow, zl as resolveCapabilities, Ul as resolveContextOptions, Ll as resolveDialogConfig, ll as resolveLlm, oi as resolveModelCaps, as as resolvePromptSoftCap, Il as resolveStorage, Ga as restoreInPlace, Wa as restoreLive, Xr as routeError, oo as runHostScript, au as runSandboxedScript, Ma as safeMerge, Gu as safeSerialize, Q as safeStringify, ru as searchJson, id as selectBuiltinTools, Na as setByPath, os as shouldTriggerCompression, ga as systemPromptHelpers, Qo as tokenize, Y as toolError, qi as unwrapSchema, Qd as useChat, sf as useChatContext, xc as validateHtmlFormat, e as z, Jr as zodError };
|